mailery 0.14.0 → 0.16.0

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.
@@ -0,0 +1,156 @@
1
+ import{r as zk,g as ah,a as x,R as K,j as p,b as lh,u as ch,L as Uk,c as kn,P as Vk,I as yl}from"./index-m4wK04gU.js";function Dt(t){this.content=t}Dt.prototype={constructor:Dt,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),s=r.content.slice();return i==-1?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new Dt(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Dt(n)},addToStart:function(t,e){return new Dt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Dt(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),s=r.find(t);return i.splice(s==-1?i.length:s,0,e,n),new Dt(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Dt.from(t),t.size?new Dt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Dt.from(t),t.size?new Dt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Dt.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Dt.from=function(t){if(t instanceof Dt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Dt(e)};function Db(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)n++;return n}if(i.content.size||s.content.size){let o=Db(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function Lb(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let o=t.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){n-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let c=0,d=Math.min(o.text.length,a.text.length);for(;c<d&&o.text[o.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(o.content.size||a.content.size){let c=Lb(o.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class L{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,s){for(let o=0,a=0;a<n;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&r(l,i+a,s||null,o)!==!1&&l.content.size){let d=a+1;l.nodesBetween(Math.max(0,e-d),Math.min(l.content.size,n-d),r,i+d)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",o=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new L(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,o=0;o<n;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,n-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,n-o-1))),r.push(a),i+=a.nodeSize),o=l}return new L(r,i)}cutByIndex(e,n){return e==n?L.empty:e==0&&n==this.content.length?this:new L(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new L(i,s)}addToStart(e){return new L([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new L(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))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 n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return Db(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Lb(this,e,n,r)}findIndex(e){if(e==0)return La(0,e);if(e==this.size)return La(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),s=r+i.nodeSize;if(s>=e)return s==e?La(n+1,s):La(n,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,n){if(!n)return L.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new L(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return L.empty;let n,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new L(n||e,r)}static from(e){if(!e)return L.empty;if(e instanceof L)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new L([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}L.empty=new L([],0);const Hd={index:0,offset:0};function La(t,e){return Hd.index=t,Hd.offset=e,Hd}function Ll(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Ll(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Ll(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let We=class Qu{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Ll(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Qu.none;if(e instanceof Qu)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};We.none=[];class Pl extends Error{}class Z{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Bb(this.content,e+this.openStart,n);return r&&new Z(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Z(Pb(this.content,e+this.openStart,n+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,n){if(!n)return Z.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Z(L.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new Z(e,r,i)}}Z.empty=new Z(L.empty,0,0);function Pb(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:a}=t.findIndex(n);if(i==e||s.isText){if(a!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(Pb(s.content,e-i-1,n-i-1)))}function Bb(t,e,n,r){let{index:i,offset:s}=t.findIndex(e),o=t.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=Bb(o.content,e-s-1,n,o);return a&&t.replaceChild(i,o.copy(a))}function Kk(t,e,n){if(n.openStart>t.depth)throw new Pl("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Pl("Inconsistent open depths");return jb(t,e,n,0)}function jb(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let o=jb(t,e,n,r+1);return s.copy(s.content.replaceChild(i,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,a=o.content;return Oi(o,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=Wk(n,t);return Oi(s,Fb(t,o,a,e,r))}else return Oi(s,Bl(t,e,r))}function $b(t,e){if(!e.type.compatibleContent(t.type))throw new Pl("Cannot join "+e.type.name+" onto "+t.type.name)}function ef(t,e,n){let r=t.node(n);return $b(r,e.node(n)),r}function Mi(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function bo(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(Mi(t.nodeAfter,r),s++));for(let a=s;a<o;a++)Mi(i.child(a),r);e&&e.depth==n&&e.textOffset&&Mi(e.nodeBefore,r)}function Oi(t,e){return t.type.checkContent(e),t.copy(e)}function Fb(t,e,n,r,i){let s=t.depth>i&&ef(t,e,i+1),o=r.depth>i&&ef(n,r,i+1),a=[];return bo(null,t,i,a),s&&o&&e.index(i)==n.index(i)?($b(s,o),Mi(Oi(s,Fb(t,e,n,r,i+1)),a)):(s&&Mi(Oi(s,Bl(t,e,i+1)),a),bo(e,n,i,a),o&&Mi(Oi(o,Bl(n,r,i+1)),a)),bo(r,null,i,a),new L(a)}function Bl(t,e,n){let r=[];if(bo(null,t,n,r),t.depth>n){let i=ef(t,e,n+1);Mi(Oi(i,Bl(t,e,n+1)),r)}return bo(e,null,n,r),new L(r)}function Wk(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(L.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Lo{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.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,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return We.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let a=r;r=i,i=a}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){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)&&(!n||n(this.node(r))))return new Po(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 n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),c=s-l;if(r.push(o,a,i+l),!c||(o=o.child(a),o.isText))break;s=c-1,i+=l+1}return new Lo(n,r,s)}static resolveCached(e,n){let r=im.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==n)return o}else im.set(e,r=new Gk);let i=r.elts[r.i]=Lo.resolve(e,n);return r.i=(r.i+1)%qk,i}}class Gk{constructor(){this.elts=[],this.i=0}}const qk=12,im=new WeakMap;class Po{constructor(e,n,r){this.$from=e,this.$to=n,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 Yk=Object.create(null);let ti=class tf{constructor(e,n,r,i=We.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||L.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,n,r,i=0){this.content.nodesBetween(e,n,r,i,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,n,r,i){return this.content.textBetween(e,n,r,i)}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,n,r){return this.type==e&&Ll(this.attrs,n||e.defaultAttrs||Yk)&&We.sameSet(this.marks,r||We.none)}copy(e=null){return e==this.content?this:new tf(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new tf(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return Z.empty;let i=this.resolve(e),s=this.resolve(n),o=r?0:i.sharedDepth(n),a=i.start(o),c=i.node(o).content.cut(i.pos-a,s.pos-a);return new Z(c,i.depth-o,s.depth-o)}replace(e,n,r){return Kk(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return Lo.resolveCached(this,e)}resolveNoCache(e){return Lo.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}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()+")"),Hb(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=L.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=i;l<s;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=We.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!We.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n 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(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=L.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};ti.prototype.text=void 0;class jl extends ti{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Hb(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new jl(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new jl(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Hb(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class ji{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new Jk(e,n);if(r.next==null)return ji.empty;let i=zb(r);r.next&&r.err("Unexpected trailing text");let s=rS(nS(i));return iS(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}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:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function s(o,a){let l=o.matchFragment(e,r);if(l&&(!n||l.validEnd))return L.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:d,next:u}=o.next[c];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(u)==-1){i.push(u);let f=s(u,a.concat(d));if(f)return f}}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 n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),n[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 n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
2
+ `)}}ji.empty=new ji(!0);class Jk{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function zb(t){let e=[];do e.push(Xk(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Xk(t){let e=[];do e.push(Zk(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Zk(t){let e=tS(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=Qk(t,e);else break;return e}function sm(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function Qk(t,e){let n=sm(t),r=n;return t.eat(",")&&(t.next!="}"?r=sm(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function eS(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let o=n[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function tS(t){if(t.eat("(")){let e=zb(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=eS(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function nS(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function i(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(s(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=s(o.exprs[l],a);if(l==o.exprs.length-1)return c;i(c,a=n())}else if(o.type=="star"){let l=n();return r(a,l),i(s(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=n();return i(s(o.expr,a),l),i(s(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(s(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c<o.min;c++){let d=n();i(s(o.expr,l),d),l=d}if(o.max==-1)i(s(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let d=n();r(l,d),i(s(o.expr,l),d),l=d}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Ub(t,e){return e-t}function om(t,e){let n=[];return r(e),n.sort(Ub);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let o=0;o<s.length;o++){let{term:a,to:l}=s[o];!a&&n.indexOf(l)==-1&&r(l)}}}function rS(t){let e=Object.create(null);return n(om(t,0));function n(r){let i=[];r.forEach(o=>{t[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let d=0;d<i.length;d++)i[d][0]==a&&(c=i[d][1]);om(t,l).forEach(d=>{c||i.push([a,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let s=e[r.join(",")]=new ji(r.indexOf(t.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort(Ub);s.next.push({type:i[o][0],next:e[a.join(",")]||n(a)})}return s}}function iS(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];o.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Vb(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function Kb(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let s=t[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function Wb(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let s=t[i];s.validate&&s.validate(e[i])}}function Gb(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new oS(t,r,e[r]);return n}let am=class qb{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Gb(e,r.attrs),this.defaultAttrs=Vb(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==ji.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:Kb(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ti(this,this.computeAttrs(e),L.from(n),We.setFrom(r))}createChecked(e=null,n,r){return n=L.from(n),this.checkContent(n),new ti(this,this.computeAttrs(e),n,We.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=L.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(L.empty,!0);return s?new ti(this,e,n.append(s),We.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Wb(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:We.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,o)=>r[s]=new qb(s,n,o));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");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 sS(t,e,n){let r=n.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class oS{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?sS(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class zc{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=Gb(e,i.attrs),this.excluded=null;let s=Vb(this.attrs);this.instance=s?new We(this,s):null}create(e=null){return!e&&this.instance?this.instance:new We(this,Kb(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new zc(s,i++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){Wb(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}let Yb=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=Dt.from(e.nodes),n.marks=Dt.from(e.marks||{}),this.nodes=am.compile(this.spec.nodes,this),this.marks=zc.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=ji.parse(o,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?lm(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:lm(this,o.split(" "))}this.nodeFromJSON=i=>ti.fromJSON(this,i),this.markFromJSON=i=>We.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof am){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new jl(r,r.defaultAttrs,e,We.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}};function lm(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],o=s;if(s)n.push(s);else for(let a in t.marks){let l=t.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function aS(t){return t.tag!=null}function lS(t){return t.style!=null}let vo=class nf{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(aS(i))this.tags.push(i);else if(lS(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new dm(this,n,!1);return r.addAll(e,We.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new dm(this,n,!0);return r.addAll(e,We.none,n.from,n.to),Z.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(uS(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,n,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(o.getAttrs){let l=o.getAttrs(n);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<n.length;o++){let a=n[o];if((a.priority==null?50:a.priority)<s)break}n.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=um(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=um(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new nf(e,nf.schemaRules(e)))}};const Jb={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},cS={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Xb={ol:!0,ul:!0},Bo=1,rf=2,xo=4;function cm(t,e,n){return e!=null?(e?Bo:0)|(e==="full"?rf:0):t&&t.whitespace=="pre"?Bo|rf:n&~xo}class Pa{constructor(e,n,r,i,s,o){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=We.none,this.match=s||(o&xo?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(L.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Bo)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let n=L.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(L.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Jb.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class dm{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,s,o=cm(null,n.preserveWhitespace,0)|(r?xo:0);i?s=new Pa(i.type,i.attrs,We.none,!0,n.topMatch||i.type.contentMatch,o):r?s=new Pa(null,null,We.none,!0,null,o):s=new Pa(e.schema.topNodeType,null,We.none,!0,null,o),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,s=i.options&rf?"full":this.localPreserveWS||(i.options&Bo)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
3
+ `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),n,!0),a[l]&&this.insertNode(o.text(a[l]),n,!/\S/.test(a[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=i.content[i.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;Xb.hasOwnProperty(o)&&this.parser.normalizeLists&&dS(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:cS.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,d=this.needsBlock;if(Jb.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let u=l&&l.skip?n:this.readStyles(e,n);u&&this.addAll(e,u),c&&this.sync(s),this.needsBlock=d}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
+ `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=r.getPropertyValue(s);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(s,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,i){let s,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(o,n.attrs||null,r,n.preserveWhitespace);l&&(s=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}s&&this.sync(a)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];o!=a;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,n);this.findAtPoint(e,s)}findPlace(e,n,r){let i,s;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],c=l.findWrapping(e);if(c&&(!i||i.length>c.length+a)&&(i=c,s=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)n=this.enterInner(i[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=We.none;for(let a of i.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):fm(a.type,e.type))&&(o=a.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,n,r,i){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,i)),s}enterInner(e,n,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=cm(e,s,o.options);o.options&xo&&o.content.length==0&&(a|=xo);let l=We.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):fm(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Pa(e,n,l,i,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Bo)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let d=l>0||l==0&&i?this.nodes[l].type:r&&l>=s?r.node(l-s).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;l--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function dS(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Xb.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function uS(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function um(t){let e={};for(let n in t)e[n]=t[n];return e}function fm(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=a=>{s.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:d}=a.edge(l);if(c==e||s.indexOf(d)<0&&o(d))return!0}};if(o(i.contentMatch))return!0}}class Ki{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=zd(n).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,l=0;for(;a<s.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(s[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<s.length;)i=s.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],d=this.serializeMark(c,o.isInline,n);d&&(s.push([c,i]),i.appendChild(d.dom),i=d.contentDOM||d.dom)}}i.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=bl(zd(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&bl(zd(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return bl(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ki(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=hm(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return hm(e.marks)}}function hm(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function zd(t){return t.document||window.document}const pm=new WeakMap;function fS(t){let e=pm.get(t);return e===void 0&&pm.set(t,e=hS(t)),e}function hS(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function bl(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=fS(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 o=i.indexOf(" ");o>0&&(n=i.slice(0,o),i=i.slice(o+1));let a,l=n?t.createElementNS(n,i):t.createElement(i),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let u in c)if(c[u]!=null){let f=u.indexOf(" ");f>0?l.setAttributeNS(u.slice(0,f),u.slice(f+1),c[u]):u=="style"&&l.style?l.style.cssText=c[u]:l.setAttribute(u,c[u])}}for(let u=d;u<e.length;u++){let f=e[u];if(f===0){if(u<e.length-1||u>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:h,contentDOM:m}=bl(t,f,n,r);if(l.appendChild(h),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:l,contentDOM:a}}const Zb=65535,Qb=Math.pow(2,16);function pS(t,e){return t+e*Qb}function mm(t){return t&Zb}function mS(t){return(t-(t&Zb))/Qb}const e0=1,t0=2,vl=4,n0=8;class sf{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&n0)>0}get deletedBefore(){return(this.delInfo&(e0|vl))>0}get deletedAfter(){return(this.delInfo&(t0|vl))>0}get deletedAcross(){return(this.delInfo&vl)>0}}class pn{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&pn.empty)return pn.empty}recover(e){let n=0,r=mm(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+mS(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[a+s],d=this.ranges[a+o],u=l+c;if(e<=u){let f=c?e==l?-1:e==u?1:n:n,h=l+i+(f<0?0:d);if(r)return h;let m=e==(n<0?l:u)?null:pS(a/3,e-l),g=e==l?t0:e==u?e0:vl;return(n<0?e!=l:e!=u)&&(g|=n0),new sf(h,g,m)}i+=d-c}return r?e+i:new sf(e+i,0,null)}touches(e,n){let r=0,i=mm(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+s],d=l+c;if(e<=d&&a==i*3)return!0;r+=this.ranges[a+o]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),c=this.ranges[i+n],d=this.ranges[i+r];e(a,a+c,l,l+d),s+=d-c}}invert(){return new pn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?pn.empty:new pn(e<0?[0,-e,0]:[0,0,e])}}pn.empty=new pn([]);class jo{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new jo(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new jo;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],a=o.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new sf(e,i,null)}}const Ud=Object.create(null);class Wt{getMap(){return pn.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ud[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Ud)throw new RangeError("Duplicate use of step JSON ID "+e);return Ud[e]=n,n.prototype.jsonID=e,n}}class mt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new mt(e,null)}static fail(e){return new mt(null,e)}static fromReplace(e,n,r,i){try{return mt.ok(e.replace(n,r,i))}catch(s){if(s instanceof Pl)return mt.fail(s.message);throw s}}}function dh(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(dh(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return L.fromArray(r)}class Jr extends Wt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new Z(dh(n.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return mt.fromReplace(e,this.from,this.to,s)}invert(){return new Qn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Jr(n.pos,r.pos,this.mark)}merge(e){return e instanceof Jr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Jr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Jr(n.from,n.to,e.markFromJSON(n.mark))}}Wt.jsonID("addMark",Jr);class Qn extends Wt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new Z(dh(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return mt.fromReplace(e,this.from,this.to,r)}invert(){return new Jr(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Qn(n.pos,r.pos,this.mark)}merge(e){return e instanceof Qn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Qn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Qn(n.from,n.to,e.markFromJSON(n.mark))}}Wt.jsonID("removeMark",Qn);class Xr extends Wt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return mt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return mt.fromReplace(e,this.pos,this.pos+1,new Z(L.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Xr(this.pos,n.marks[i]);return new Xr(this.pos,this.mark)}}return new $i(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Xr(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Xr(n.pos,e.markFromJSON(n.mark))}}Wt.jsonID("addNodeMark",Xr);class $i extends Wt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return mt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return mt.fromReplace(e,this.pos,this.pos+1,new Z(L.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Xr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new $i(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new $i(n.pos,e.markFromJSON(n.mark))}}Wt.jsonID("removeNodeMark",$i);class pt extends Wt{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&of(e,this.from,this.to)?mt.fail("Structure replace would overwrite content"):mt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new pn([this.from,this.to-this.from,this.slice.size])}invert(e){return new pt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&pt.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new pt(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof pt)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?Z.empty:new Z(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new pt(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?Z.empty:new Z(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new pt(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new pt(n.from,n.to,Z.fromJSON(e,n.slice),!!n.structure)}}pt.MAP_BIAS=1;Wt.jsonID("replace",pt);class St extends Wt{constructor(e,n,r,i,s,o,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(of(e,this.from,this.gapFrom)||of(e,this.gapTo,this.to)))return mt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return mt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?mt.fromReplace(e,this.from,this.to,r):mt.fail("Content does not fit in gap")}getMap(){return new pn([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new St(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new St(n.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new St(n.from,n.to,n.gapFrom,n.gapTo,Z.fromJSON(e,n.slice),n.insert,!!n.structure)}}Wt.jsonID("replaceAround",St);function of(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function gS(t,e,n,r){let i=[],s=[],o,a;t.doc.nodesBetween(e,n,(l,c,d)=>{if(!l.isInline)return;let u=l.marks;if(!r.isInSet(u)&&d.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+l.nodeSize,n),m=r.addToSet(u);for(let g=0;g<u.length;g++)u[g].isInSet(m)||(o&&o.to==f&&o.mark.eq(u[g])?o.to=h:i.push(o=new Qn(f,h,u[g])));a&&a.to==f?a.to=h:s.push(a=new Jr(f,h,r))}}),i.forEach(l=>t.step(l)),s.forEach(l=>t.step(l))}function yS(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(r instanceof zc){let c=o.marks,d;for(;d=r.isInSet(c);)(l||(l=[])).push(d),c=d.removeFromSet(c)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,n);for(let d=0;d<l.length;d++){let u=l[d],f;for(let h=0;h<i.length;h++){let m=i[h];m.step==s-1&&u.eq(i[h].style)&&(f=m)}f?(f.to=c,f.step=s):i.push({style:u,from:Math.max(a,e),to:c,step:s})}}}),i.forEach(o=>t.step(new Qn(o.from,o.to,o.style)))}function uh(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<s.childCount;l++){let c=s.child(l),d=a+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new pt(a,d,Z.empty));else{r=u;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new Qn(a,d,c.marks[f]));if(i&&c.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,m;for(;f=h.exec(c.text);)m||(m=new Z(L.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),o.push(new pt(a+f.index,a+f.index+f[0].length,m))}}a=d}if(!r.validEnd){let l=r.fillBefore(L.empty,!0);t.replace(a,a,new Z(l,0,0))}for(let l=o.length-1;l>=0;l--)t.step(o[l])}function bS(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Ws(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let o=t.$from.node(r),a=t.$from.index(r)+i,l=t.$to.indexAfter(r)-s;if(r<t.depth&&o.canReplace(a,l,n))return r;if(r==0||o.type.spec.isolating||!bS(o,a,l))break;a&&(i=1),l<o.childCount&&(s=1)}return null}function vS(t,e,n){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),a=i.after(s+1),l=o,c=a,d=L.empty,u=0;for(let m=s,g=!1;m>n;m--)g||r.index(m)>0?(g=!0,d=L.from(r.node(m).copy(d)),u++):l--;let f=L.empty,h=0;for(let m=s,g=!1;m>n;m--)g||i.after(m+1)<i.end(m)?(g=!0,f=L.from(i.node(m).copy(f)),h++):c++;t.step(new St(l,c,o,a,new Z(d.append(f),u,h),d.size-u,!0))}function fh(t,e,n=null,r=t){let i=xS(t,e),s=i&&wS(r,e);return s?i.map(gm).concat({type:e,attrs:n}).concat(s.map(gm)):null}function gm(t){return{type:t,attrs:null}}function xS(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(r,i,o)?s:null}function wS(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;l&&c<i;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:o}function ES(t,e,n){let r=L.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let a=n[o].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=L.from(n[o].type.create(n[o].attrs,r))}let i=e.start,s=e.end;t.step(new St(i,s,i,s,new Z(r,0,0),n.length,!0))}function kS(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(o,a)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,l)&&SS(t.doc,t.mapping.slice(s).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!m?c=!1:!h&&m&&(c=!0)}c===!1&&i0(t,o,a,s),uh(t,t.mapping.slice(s).map(a,1),r,void 0,c===null);let d=t.mapping.slice(s),u=d.map(a,1),f=d.map(a+o.nodeSize,1);return t.step(new St(u,f,u+1,f-1,new Z(L.from(r.create(l,null,o.marks)),0,0),1,!0)),c===!0&&r0(t,o,a,s),!1}})}function r0(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let l=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function i0(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(`
5
+ `))}})}function SS(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function CS(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new St(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new Z(L.from(o),0,0),1,!0))}function Sr(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,d=n-2;c>s;c--,d--){let u=i.node(c),f=i.index(c);if(u.type.spec.isolating)return!1;let h=u.content.cutByIndex(f,u.childCount),m=r&&r[d+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[d]||u;if(!u.canReplace(f+1,u.childCount)||!g.type.validContent(h))return!1}let a=i.indexAfter(s),l=r&&r[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function _S(t,e,n=1,r){let i=t.doc.resolve(e),s=L.empty,o=L.empty;for(let a=i.depth,l=i.depth-n,c=n-1;a>l;a--,c--){s=L.from(i.node(a).copy(s));let d=r&&r[c];o=L.from(d?d.type.create(d.attrs,o):i.node(a).copy(o))}t.step(new pt(e,e,new Z(s.append(o),n,n),!0))}function ui(t,e){let n=t.resolve(e),r=n.index();return s0(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function NS(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function s0(t,e){return!!(t&&e&&!t.isLeaf&&NS(t,e))}function Uc(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let s,o,a=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):n>0?(s=r.node(i+1),a++,o=r.node(i).maybeChild(a)):(s=r.node(i).maybeChild(a-1),o=r.node(i+1)),s&&!s.isTextblock&&s0(s,o)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function TS(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),o=s.node().type;if(i&&o.inlineContent){let d=o.whitespace=="pre",u=!!o.contentMatch.matchType(i);d&&!u?r=!1:!d&&u&&(r=!0)}let a=t.steps.length;if(r===!1){let d=t.doc.resolve(e+n);i0(t,d.node(),d.before(),a)}o.inlineContent&&uh(t,e+n-1,o,s.node().contentMatchAt(s.index()),r==null);let l=t.mapping.slice(a),c=l.map(e-n);if(t.step(new pt(c,l.map(e+n,-1),Z.empty,!0)),r===!0){let d=t.doc.resolve(c);r0(t,d.node(),d.before(),t.steps.length)}return t}function AS(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,n))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,n))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function o0(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),c=r.node(o),d=!1;if(s==1)d=c.canReplace(l,l,i);else{let u=c.contentMatchAt(l).findWrapping(i.firstChild.type);d=u&&c.canReplaceWith(l,l,u[0])}if(d)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function Vc(t,e,n=e,r=Z.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return a0(i,s,r)?new pt(e,n,r):new MS(i,s,r).fit()}function a0(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class MS{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=L.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=L.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let l=new Z(s,o,a);return e>-1?new St(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new pt(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Vd(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],d,u=null;if(n==1&&(o?c.matchType(o.type)||(u=c.fillBefore(L.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:u};if(n==2&&o&&(d=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:d};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Vd(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new Z(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Vd(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new Z(ho(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new Z(ho(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let g=0;g<s.length;g++)this.openFrontierNode(s[g]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,c=0,d=[],{match:u,type:f}=this.frontier[n];if(i){for(let g=0;g<i.childCount;g++)d.push(i.child(g));u=u.matchFragment(i)}let h=a.size+e-(o.content.size-o.openEnd);for(;c<a.childCount;){let g=a.child(c),y=u.matchType(g.type);if(!y)break;c++,(c>1||l==0||g.content.size)&&(u=y,d.push(l0(g.mark(f.allowedMarks(g.marks)),c==1?l:0,c==a.childCount?h:-1)))}let m=c==a.childCount;m||(h=-1),this.placed=po(this.placed,n,L.from(d)),this.frontier[n].match=u,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?Z.empty:new Z(ho(o.content,e-1,1),e-1,h<0?o.openEnd:e-1):new Z(ho(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Kd(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=Kd(e,n,i,r,s);if(o){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],d=Kd(e,a,c,l,!0);if(!d||d.childCount)continue e}return{depth:n,fit:o,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=po(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=po(this.placed,this.depth,L.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(L.empty,!0);n.childCount&&(this.placed=po(this.placed,this.frontier.length,n))}}function ho(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(ho(t.firstChild.content,e-1,n)))}function po(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(po(t.lastChild.content,e-1,n)))}function Vd(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function l0(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,l0(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(L.empty,!0)))),t.copy(r)}function Kd(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!OS(n,s.content,o)?a:null}function OS(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function RS(t){return t.spec.defining||t.spec.definingForContent}function IS(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(a0(i,s,r))return t.step(new pt(e,n,r));let o=d0(i,s);o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let f=i.depth,h=i.pos-1;f>0;f--,h--){let m=i.node(f).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;o.indexOf(f)>-1?a=f:i.before(f)==h&&o.splice(1,0,-f)}let l=o.indexOf(a),c=[],d=r.openStart;for(let f=r.content,h=0;;h++){let m=f.firstChild;if(c.push(m),h==r.openStart)break;f=m.content}for(let f=d-1;f>=0;f--){let h=c[f],m=RS(h.type);if(m&&!h.sameMarkup(i.node(Math.abs(a)-1)))d=f;else if(m||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+d+1)%(r.openStart+1),m=c[h];if(m)for(let g=0;g<o.length;g++){let y=o[(g+l)%o.length],b=!0;y<0&&(b=!1,y=-y);let w=i.node(y-1),k=i.index(y-1);if(w.canReplaceWith(k,k,m.type,m.marks))return t.replace(i.before(y),b?s.after(y):n,new Z(c0(r.content,0,r.openStart,h),h,r.openEnd))}}let u=t.steps.length;for(let f=o.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>u));f--){let h=o[f];h<0||(e=i.before(h),n=s.after(h))}}function c0(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(c0(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(L.empty,!0))}return t}function DS(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=AS(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new Z(L.from(r),0,0))}function LS(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let o=r.sharedDepth(n),a=!1;for(let l=r.depth;l>o;l--)r.node(l).type.spec.isolating&&(a=!0);for(let l=i.depth;l>o;l--)i.node(l).type.spec.isolating&&(a=!0);if(!a){for(let l=r.depth;l>0&&e==r.start(l);l--)e=r.before(l);for(let l=i.depth;l>0&&n==i.start(l);l--)n=i.before(l);r=t.doc.resolve(e),i=t.doc.resolve(n)}}let s=d0(r,i);for(let o=0;o<s.length;o++){let a=s[o],l=o==s.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),i.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return t.delete(r.before(a),i.after(a))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function d0(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(s<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}class gs extends Wt{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return mt.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return mt.fromReplace(e,this.pos,this.pos+1,new Z(L.from(i),0,n.isLeaf?0:1))}getMap(){return pn.empty}invert(e){return new gs(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new gs(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new gs(n.pos,n.attr,n.value)}}Wt.jsonID("attr",gs);class $o extends Wt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return mt.ok(r)}getMap(){return pn.empty}invert(e){return new $o(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new $o(n.attr,n.value)}}Wt.jsonID("docAttr",$o);let Ss=class extends Error{};Ss=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Ss.prototype=Object.create(Error.prototype);Ss.prototype.constructor=Ss;Ss.prototype.name="TransformError";class u0{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new jo}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Ss(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),n=i.map(n,-1)),i.forEach((s,o,a,l)=>{e=Math.min(e,a),n=Math.max(n,l)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=Z.empty){let i=Vc(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new Z(L.from(r),0,0))}delete(e,n){return this.replace(e,n,Z.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return IS(this,e,n,r),this}replaceRangeWith(e,n,r){return DS(this,e,n,r),this}deleteRange(e,n){return LS(this,e,n),this}lift(e,n){return vS(this,e,n),this}join(e,n=1){return TS(this,e,n),this}wrap(e,n){return ES(this,e,n),this}setBlockType(e,n=e,r,i=null){return kS(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return CS(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new gs(e,n,r)),this}setDocAttribute(e,n){return this.step(new $o(e,n)),this}addNodeMark(e,n){return this.step(new Xr(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof We)n.isInSet(r.marks)&&this.step(new $i(e,n));else{let i=r.marks,s,o=[];for(;s=n.isInSet(i);)o.push(new $i(e,s)),i=s.removeFromSet(i);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,n=1,r){return _S(this,e,n,r),this}addMark(e,n,r){return gS(this,e,n,r),this}removeMark(e,n,r){return yS(this,e,n,r),this}clearIncompatible(e,n,r){return uh(this,e,n,r),this}}const Wd=Object.create(null);class Se{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new f0(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=Z.empty){let r=n.content.lastChild,i=null;for(let a=0;a<n.openEnd;a++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:c}=o[a],d=e.mapping.slice(s);e.replaceRange(d.map(l.pos),d.map(c.pos),a?Z.empty:n),a==0&&vm(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:a}=i[s],l=e.mapping.slice(r),c=l.map(o.pos),d=l.map(a.pos);s?e.deleteRange(c,d):(e.replaceRangeWith(c,d,n),vm(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new ye(e):as(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=n<0?as(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):as(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new gn(e.node(0))}static atStart(e){return as(e,e,0,0,1)||new gn(e)}static atEnd(e){return as(e,e,e.content.size,e.childCount,-1)||new gn(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Wd[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Wd)throw new RangeError("Duplicate use of selection JSON ID "+e);return Wd[e]=n,n.prototype.jsonID=e,n}getBookmark(){return ye.between(this.$anchor,this.$head).getBookmark()}}Se.prototype.visible=!0;class f0{constructor(e,n){this.$from=e,this.$to=n}}let ym=!1;function bm(t){!ym&&!t.parent.inlineContent&&(ym=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class ye extends Se{constructor(e,n=e){bm(e),bm(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Se.near(r);let i=e.resolve(n.map(this.anchor));return new ye(i.parent.inlineContent?i:r,r)}replace(e,n=Z.empty){if(super.replace(e,n),n==Z.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof ye&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Kc(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new ye(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=Se.findFrom(n,r,!0)||Se.findFrom(n,-r,!0);if(s)n=s.$head;else return Se.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(Se.findFrom(e,-r,!0)||Se.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new ye(e,n)}}Se.jsonID("text",ye);class Kc{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Kc(e.map(this.anchor),e.map(this.head))}resolve(e){return ye.between(e.resolve(this.anchor),e.resolve(this.head))}}class he extends Se{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),s=e.resolve(i);return r?Se.near(s):new he(s)}content(){return new Z(L.from(this.node),0,0)}eq(e){return e instanceof he&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new hh(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new he(e.resolve(n.anchor))}static create(e,n){return new he(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}he.prototype.visible=!1;Se.jsonID("node",he);class hh{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Kc(r,r):new hh(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&he.isSelectable(r)?new he(n):Se.near(n)}}class gn extends Se{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=Z.empty){if(n==Z.empty){e.delete(0,e.doc.content.size);let r=Se.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new gn(e)}map(e){return new gn(e)}eq(e){return e instanceof gn}getBookmark(){return PS}}Se.jsonID("all",gn);const PS={map(){return this},resolve(t){return new gn(t)}};function as(t,e,n,r,i,s=!1){if(e.inlineContent)return ye.create(t,n);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&he.isSelectable(a))return he.create(t,n-(i<0?a.nodeSize:0))}else{let l=as(t,a,n+i,i<0?a.childCount:0,i,s);if(l)return l}n+=a.nodeSize*i}return null}function vm(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof pt||i instanceof St))return;let s=t.mapping.maps[r],o;s.forEach((a,l,c,d)=>{o==null&&(o=d)}),t.setSelection(Se.near(t.doc.resolve(o),n))}const xm=1,Ba=2,wm=4;let BS=class extends u0{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|xm)&~Ba,this.storedMarks=null,this}get selectionSet(){return(this.updated&xm)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Ba,this}ensureMarks(e){return We.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Ba)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Ba,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||We.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(n);s=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,s)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(Se.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=wm,this}get scrolledIntoView(){return(this.updated&wm)>0}};function Em(t,e){return!e||!t?t:t.bind(e)}class mo{constructor(e,n,r){this.name=e,this.init=Em(n.init,r),this.apply=Em(n.apply,r)}}const jS=[new mo("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new mo("selection",{init(t,e){return t.selection||Se.atStart(e.doc)},apply(t){return t.selection}}),new mo("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new mo("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Gd{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=jS.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new mo(r.key,r.spec.state,r))})}}class ps{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=i?i[o].n:0,c=i?i[o].state:this,d=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(d&&r.filterTransaction(d,o)){if(d.setMeta("appendedTransaction",e),!i){i=[];for(let u=0;u<this.config.plugins.length;u++)i.push(u<o?{state:r,n:n.length}:{state:this,n:0})}n.push(d),r=r.applyInner(d),s=!0}i&&(i[o]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new ps(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new BS(this)}static create(e){let n=new Gd(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new ps(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new Gd(this.schema,e.plugins),r=n.fields,i=new ps(n);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Gd(e.schema,e.plugins),s=new ps(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=ti.fromJSON(e.schema,n.doc);else if(o.name=="selection")s.selection=Se.fromJSON(s.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){s[o.name]=c.fromJSON.call(l,e,n[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function h0(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=h0(i,e,{})),n[r]=i}return n}class Ze{constructor(e){this.spec=e,this.props={},e.props&&h0(e.props,this,this.props),this.key=e.key?e.key.key:p0("plugin")}getState(e){return e[this.key]}}const qd=Object.create(null);function p0(t){return t in qd?t+"$"+ ++qd[t]:(qd[t]=0,t+"$")}class Ge{constructor(e="key"){this.key=p0(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Lt=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Cs=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let af=null;const xr=function(t,e,n){let r=af||(af=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},$S=function(){af=null},Fi=function(t,e,n,r){return n&&(km(t,e,n,r,-1)||km(t,e,n,r,1))},FS=/^(img|br|input|textarea|hr)$/i;function km(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Cn(t))){let o=t.parentNode;if(!o||o.nodeType!=1||ga(t)||FS.test(t.nodeName)||t.contentEditable=="false")return!1;e=Lt(t)+(i<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?Cn(t):0}else return!1}}function Cn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function HS(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Cn(t)}else if(t.parentNode&&!ga(t))e=Lt(t),t=t.parentNode;else return null}}function zS(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!ga(t))e=Lt(t)+1,t=t.parentNode;else return null}}function US(t,e,n){for(let r=e==0,i=e==Cn(t);r||i;){if(t==n)return!0;let s=Lt(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==Cn(t)}}function ga(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Wc=function(t){return t.focusNode&&Fi(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Ci(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function VS(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function KS(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Cn(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Cn(r.startContainer),r.startOffset)}}}const sr=typeof navigator<"u"?navigator:null,Sm=typeof document<"u"?document:null,fi=sr&&sr.userAgent||"",lf=/Edge\/(\d+)/.exec(fi),m0=/MSIE \d/.exec(fi),cf=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(fi),an=!!(m0||cf||lf),ni=m0?document.documentMode:cf?+cf[1]:lf?+lf[1]:0,_n=!an&&/gecko\/(\d+)/i.test(fi);_n&&+(/Firefox\/(\d+)/.exec(fi)||[0,0])[1];const df=!an&&/Chrome\/(\d+)/.exec(fi),Bt=!!df,g0=df?+df[1]:0,Vt=!an&&!!sr&&/Apple Computer/.test(sr.vendor),_s=Vt&&(/Mobile\/\w+/.test(fi)||!!sr&&sr.maxTouchPoints>2),Sn=_s||(sr?/Mac/.test(sr.platform):!1),y0=sr?/Win/.test(sr.platform):!1,wr=/Android \d/.test(fi),ya=!!Sm&&"webkitFontSmoothing"in Sm.documentElement.style,WS=ya?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function GS(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function pr(t,e){return typeof t=="number"?t:t[e]}function qS(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Cm(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=Cs(o);continue}let a=o,l=a==s.body,c=l?GS(s):qS(a),d=0,u=0;if(e.top<c.top+pr(r,"top")?u=-(c.top-e.top+pr(i,"top")):e.bottom>c.bottom-pr(r,"bottom")&&(u=e.bottom-e.top>c.bottom-c.top?e.top+pr(i,"top")-c.top:e.bottom-c.bottom+pr(i,"bottom")),e.left<c.left+pr(r,"left")?d=-(c.left-e.left+pr(i,"left")):e.right>c.right-pr(r,"right")&&(d=e.right-c.right+pr(i,"right")),d||u)if(l)s.defaultView.scrollBy(d,u);else{let h=a.scrollLeft,m=a.scrollTop;u&&(a.scrollTop+=u),d&&(a.scrollLeft+=d);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 f=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:Cs(o)}}function YS(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=t.root.elementFromPoint(s,o);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:b0(t.dom)}}function b0(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Cs(r));return e}function JS({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;v0(n,r==0?0:r-e)}function v0(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:s}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Zi=null;function XS(t){if(t.setActive)return t.setActive();if(Zi)return t.focus(Zi);let e=b0(t);t.focus(Zi==null?{get preventScroll(){return Zi={preventScroll:!0},!0}}:void 0),Zi||(Zi=!1,v0(e,0))}function x0(t,e){let n,r=2e8,i,s=0,o=e.top,a=e.top,l,c;for(let d=t.firstChild,u=0;d;d=d.nextSibling,u++){let f;if(d.nodeType==1)f=d.getClientRects();else if(d.nodeType==3)f=xr(d).getClientRects();else continue;for(let h=0;h<f.length;h++){let m=f[h];if(m.top<=o&&m.bottom>=a){o=Math.max(m.bottom,o),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){n=d,r=g,i=g&&n.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,d.nodeType==1&&g&&(s=u+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!l&&m.left<=e.left&&m.right>=e.left&&(l=d,c={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!n&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(s=u+1)}}return!n&&l&&(n=l,i=c,r=0),n&&n.nodeType==3?ZS(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:x0(n,i)}function ZS(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let o=Hr(r,1);if(o.top!=o.bottom&&ph(e,o)){i={node:t,offset:s+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function ph(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function QS(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function eC(t,e,n){let{node:r,offset:i}=x0(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function tC(t,e,n,r){let i=-1;for(let s=e,o=!1;s!=t.dom;){let a=t.docView.nearestDesc(s,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&l.left>r.left||l.top>r.top?i=a.posBefore:(!o&&l.right<r.left||l.bottom<r.top)&&(i=a.posAfter),o=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;s=a.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function w0(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let o=t.childNodes[s];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(ph(e,c))return w0(o,e,c)}}if((s=(s+1)%r)==i)break}return t}function nC(t,e){let n=t.dom.ownerDocument,r,i=0,s=KS(n,e.left,e.top);s&&({node:r,offset:i}=s);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=t.dom.getBoundingClientRect();if(!ph(e,c)||(o=w0(t.dom,e,c),!o))return null}if(Vt)for(let c=o;r&&c;c=Cs(c))c.draggable&&(r=void 0);if(o=QS(o,e),r){if(_n&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let d=r.childNodes[i],u;d.nodeName=="IMG"&&(u=d.getBoundingClientRect()).right<=e.left&&u.bottom>e.top&&i++}let c;ya&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=tC(t,r,i,e))}a==null&&(a=eC(t,o,e));let l=t.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function _m(t){return t.top<t.bottom||t.left<t.right}function Hr(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(_m(r))return r}return Array.prototype.find.call(n,_m)||t.getBoundingClientRect()}const rC=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function E0(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=ya||_n;if(r.nodeType==3)if(o&&(rC.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let l=Hr(xr(r,i,i),n);if(_n&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=Hr(xr(r,i-1,i-1),-1);if(c.top==l.top){let d=Hr(xr(r,i,i+1),-1);if(d.top!=l.top)return ao(d,d.left<c.left)}}return l}else{let l=i,c=i,d=n<0?1:-1;return n<0&&!i?(c++,d=-1):n>=0&&i==r.nodeValue.length?(l--,d=1):n<0?l--:c++,ao(Hr(xr(r,l,c),d),d<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==Cn(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return Yd(l.getBoundingClientRect(),!1)}if(s==null&&i<Cn(r)){let l=r.childNodes[i];if(l.nodeType==1)return Yd(l.getBoundingClientRect(),!0)}return Yd(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==Cn(r))){let l=r.childNodes[i-1],c=l.nodeType==3?xr(l,Cn(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return ao(Hr(c,1),!1)}if(s==null&&i<Cn(r)){let l=r.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?xr(l,0,o?0:1):l.nodeType==1?l:null:null;if(c)return ao(Hr(c,-1),!0)}return ao(Hr(r.nodeType==3?xr(r):r,-n),n>=0)}function ao(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Yd(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function k0(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function iC(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return k0(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let o=E0(t,i.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=xr(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let d=l[c];if(d.bottom>d.top+1&&(n=="up"?o.top-d.top>(d.bottom-o.top)*2:d.bottom-o.bottom>(o.bottom-d.top)*2))return!1}}return!0})}const sC=/[\u0590-\u08ac]/;function oC(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,a=t.domSelection();return a?!sC.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?s:o:k0(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:d,anchorOffset:u}=t.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",n,"character");let h=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:m,focusOffset:g}=t.domSelectionRange(),y=m&&!h.contains(m.nodeType==1?m:m.parentNode)||l==m&&c==g;try{a.collapse(d,u),l&&(l!=d||c!=u)&&a.extend&&a.extend(l,c)}catch{}return f!=null&&(a.caretBidiLevel=f),y}):r.pos==r.start()||r.pos==r.end()}let Nm=null,Tm=null,Am=!1;function aC(t,e,n){return Nm==e&&Tm==n?Am:(Nm=e,Tm=n,Am=n=="up"||n=="down"?iC(t,e,n):oC(t,e,n))}const Nn=0,Mm=1,Ni=2,or=3;class ba{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Nn,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>Lt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!n||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let a=i.children[o];if(a.size){i=a;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],a=s+o.size;if(a>e||o instanceof C0){i=e-s;break}s=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof S0&&s.side>=0;r--);if(n<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&n&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?Lt(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?Lt(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,a=0;;a++){let l=this.children[a],c=o+l.size;if(i==-1&&e<=c){let d=o+l.border;if(e>=d&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,d);e=o;for(let u=a;u>0;u--){let f=this.children[u-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=Lt(f.dom)+1;break}e-=f.size}i==-1&&(i=0)}if(i>-1&&(c>n||a==this.children.length-1)){n=c;for(let d=a+1;d<this.children.length;d++){let u=this.children[d];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(-1)){s=Lt(u.dom);break}n+=u.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let s=Math.min(e,n),o=Math.max(e,n);for(let h=0,m=0;h<this.children.length;h++){let g=this.children[h],y=m+g.size;if(s>m&&o<y)return g.setSelection(e-m-g.border,n-m-g.border,r,i);m=y}let a=this.domFromPos(e,e?-1:1),l=n==e?a:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),d=r.domSelectionRange(),u=!1;if((_n||Vt)&&e==n){let{node:h,offset:m}=a;if(h.nodeType==3){if(u=!!(m&&h.nodeValue[m-1]==`
6
+ `),u&&m==h.nodeValue.length)for(let g=h,y;g;g=g.parentNode){if(y=g.nextSibling){y.nodeName=="BR"&&(a=l={node:y.parentNode,offset:Lt(y)+1});break}let b=g.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let g=h.childNodes[m-1];u=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(_n&&d.focusNode&&d.focusNode!=l.node&&d.focusNode.nodeType==1){let h=d.focusNode.childNodes[d.focusOffset];h&&h.contentEditable=="false"&&(i=!0)}if(!(i||u&&Vt)&&Fi(a.node,a.offset,d.anchorNode,d.anchorOffset)&&Fi(l.node,l.offset,d.focusNode,d.focusOffset))return;let f=!1;if((c.extend||e==n)&&!(u&&_n)){c.collapse(a.node,a.offset);try{e!=n&&c.extend(l.node,l.offset),f=!0}catch{}}if(!f){if(e>n){let m=a;a=l,l=m}let h=document.createRange();h.setEnd(l.node,l.offset),h.setStart(a.node,a.offset),c.removeAllRanges(),c.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,n){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let a=r+s.border,l=o-s.border;if(e>=a&&n<=l){this.dirty=e==r||n==o?Ni:Mm,e==a&&n==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=or:s.markDirty(e-a,n-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Ni:or}r=o}this.dirty=Ni}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Ni:Mm;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class S0 extends ba{constructor(e,n,r,i){let s,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==Nn&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class lC extends ba{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Hi extends ba{constructor(e,n,r,i,s){super(e,[],r,i),this.mark=n,this.spec=s}static create(e,n,r,i){let s=i.nodeViews[n.type.name],o=s&&s(n,i,r);return(!o||!o.dom)&&(o=Ki.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Hi(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&or||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=or&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Nn){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Nn}}slice(e,n,r){let i=Hi.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;n<o&&(s=ff(s,n,o,r)),e>0&&(s=ff(s,0,e,r));for(let a=0;a<s.length;a++)s[a].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class ri extends ba{constructor(e,n,r,i,s,o,a,l,c){super(e,[],s,o),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,n,r,i,s,o){let a=s.nodeViews[n.type.name],l,c=a&&a(n,s,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,i),d=c&&c.dom,u=c&&c.contentDOM;if(n.isText){if(!d)d=document.createTextNode(n.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:u}=Ki.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!u&&!n.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),n.type.spec.draggable&&(d.draggable=!0));let f=d;return d=T0(d,r,n),c?l=new cC(e,n,r,i,d,u||null,f,c,s,o+1):n.isText?new Gc(e,n,r,i,d,f,s):new ri(e,n,r,i,d,u||null,f,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>L.empty)}return e}matchesNode(e,n,r){return this.dirty==Nn&&e.eq(this.node)&&$l(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,o=s&&s.pos>-1?s:null,a=s&&s.pos<0,l=new uC(this,o&&o.node,e);pC(this.node,this.innerDeco,(c,d,u)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e,d):c.type.side>=0&&!u&&l.syncToMarks(d==this.node.childCount?We.none:this.node.child(d).marks,r,e,d),l.placeWidget(c,e,i)},(c,d,u,f)=>{l.syncToMarks(c.marks,r,e,f);let h;l.findNodeMatch(c,d,u,f)||a&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(h=l.findIndexWithChild(s.node))>-1&&l.updateNodeAt(c,d,u,h,e)||l.updateNextNode(c,d,u,e,f,i)||l.addNode(c,d,u,e,i),i+=c.nodeSize}),l.syncToMarks([],r,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Ni)&&(o&&this.protectLocalComposition(e,o),_0(this.contentDOM,this.children,e),_s&&mC(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof ye)||r<n||i>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,a=gC(this.node.content,o,r-n,i-n);return a<0?null:{node:s,pos:a,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new lC(this,s,n,i);e.input.compositionNodes.push(o),this.children=ff(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==or||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Nn}updateOuterDeco(e){if($l(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=N0(this.dom,this.nodeDOM,uf(this.outerDeco,this.node,n),uf(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.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 Om(t,e,n,r,i){T0(r,e,t);let s=new ri(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class Gc extends ri{constructor(e,n,r,i,s,o,a){super(e,n,r,i,s,null,o,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==or||this.dirty!=Nn&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Nn||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Nn,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),s=document.createTextNode(i.text);return new Gc(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=or)}get domAtom(){return!1}isText(e){return this.node.text==e}}class C0 extends ba{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Nn&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class cC extends ri{constructor(e,n,r,i,s,o,a,l,c,d){super(e,n,r,i,s,o,a,c,d),this.spec=l}update(e,n,r,i){if(this.dirty==or)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}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 _0(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],a=o.dom;if(a.parentNode==t){for(;a!=r;)r=Rm(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(a,r);if(o instanceof Hi){let l=r?r.previousSibling:t.lastChild;_0(o.contentDOM,o.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=Rm(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const wo=function(t){t&&(this.nodeName=t)};wo.prototype=Object.create(null);const Ti=[new wo];function uf(t,e,n){if(t.length==0)return Ti;let r=n?Ti[0]:new wo,i=[r];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&i.push(r=new wo(o.nodeName));for(let a in o){let l=o[a];l!=null&&(n&&i.length==1&&i.push(r=new wo(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return i}function N0(t,e,n,r){if(n==Ti&&r==Ti)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],a=n[s];if(s){let l;a&&a.nodeName==o.nodeName&&i!=t&&(l=i.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=Ti[0]),i=l}dC(i,a||Ti[0],o)}return i}function dC(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&t.classList.add(i[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function T0(t,e,n){return N0(t,t,Ti,uf(e,n,t.nodeType!=1))}function $l(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function Rm(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class uC{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=fC(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,i){let s=0,o=this.stack.length>>1,a=Math.min(o,e.length);for(;s<a&&(s==o-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<o;)this.destroyRest(),this.top.dirty=Nn,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let l=-1,c=this.top.children.length;i<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let d=this.index;d<c;d++){let u=this.top.children[d];if(u.matchesMark(e[o])&&!this.isLocked(u.dom)){l=d;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let d=Hi.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,i,s){let o=this.top.children[i];return o.dirty==or&&o.dom==o.contentDOM&&(o.dirty=Ni),o.update(e,n,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,s,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof ri){let c=this.preMatch.matched.get(l);if(c!=null&&c!=s)return!1;let d=l.dom,u,f=this.isLocked(d)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=or&&$l(n,l.outerDeco));if(!f&&l.update(e,n,r,i))return this.destroyBetween(this.index,a),l.dom!=d&&(this.changed=!0),this.index++,!0;if(!f&&(u=this.recreateWrapper(l,e,n,r,i,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=Ni,u.updateChildren(i,o+1),u.dirty=Nn),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,s,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!$l(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=ri.create(this.top,n,r,i,s,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,n,r,i,s){let o=ri.create(this.top,e,n,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new S0(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Hi;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Gc)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Vt||Bt)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new C0(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function fC(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,o=[];e:for(;i>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof Hi)n=c,r=c.children.length;else{a=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}function hC(t,e){return t.type.side-e.type.side}function pC(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let c=0;c<t.childCount;c++){let d=t.child(c);r(d,i,e.forChild(s,d),c),s+=d.nodeSize}return}let o=0,a=[],l=null;for(let c=0;;){let d,u;for(;o<i.length&&i[o].to==s;){let y=i[o++];y.widget&&(d?(u||(u=[d])).push(y):d=y)}if(d)if(u){u.sort(hC);for(let y=0;y<u.length;y++)n(u[y],c,!!l)}else n(d,c,!!l);let f,h;if(l)h=-1,f=l,l=null;else if(c<t.childCount)h=c,f=t.child(c++);else break;for(let y=0;y<a.length;y++)a[y].to<=s&&a.splice(y--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)a.push(i[o++]);let m=s+f.nodeSize;if(f.isText){let y=m;o<i.length&&i[o].from<y&&(y=i[o].from);for(let b=0;b<a.length;b++)a[b].to<y&&(y=a[b].to);y<m&&(l=f.cut(y-s),f=f.cut(0,y-s),m=y,h=-1)}else for(;o<i.length&&i[o].to<m;)o++;let g=f.isInline&&!f.isLeaf?a.filter(y=>!y.inline):a.slice();r(f,g,e.forChild(s,f),h),s=m}}function mC(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function gC(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let o=t.child(i++),a=s;if(s+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<t.childCount;){let c=t.child(i++);if(s+=c.nodeSize,!c.isText)break;l+=c.text}if(s>=n){if(s>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?l.lastIndexOf(e,r-a-1):-1;if(c>=0&&c+e.length+a>=n)return a+c;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function ff(t,e,n,r,i){let s=[];for(let o=0,a=0;o<t.length;o++){let l=t[o],c=a,d=a+=l.size;c>=n||d<=e?s.push(l):(c<e&&s.push(l.slice(0,e-c,r)),i&&(s.push(i),i=void 0),d>n&&s.push(l.slice(n-c,l.size,r)))}return s}function mh(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,c;if(Wc(n)){for(l=o;i&&!i.node;)i=i.parent;let u=i.node;if(i&&u.isAtom&&he.isSelectable(u)&&i.parent&&!(u.isInline&&US(n.focusNode,n.focusOffset,i.dom))){let f=i.posBefore;c=new he(o==f?a:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let u=o,f=o;for(let h=0;h<n.rangeCount;h++){let m=n.getRangeAt(h);u=Math.min(u,t.docView.posFromDOM(m.startContainer,m.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(u<0)return null;[l,o]=f==t.state.selection.anchor?[f,u]:[u,f],a=r.resolve(o)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let d=r.resolve(l);if(!c){let u=e=="pointer"||t.state.selection.head<a.pos&&!s?1:-1;c=gh(t,d,a,u)}return c}function A0(t){return t.editable?t.hasFocus():O0(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Cr(t,e=!1){let n=t.state.selection;if(M0(t,n),!!A0(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Bt){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Fi(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)bC(t);else{let{anchor:r,head:i}=n,s,o;Im&&!(n instanceof ye)&&(n.$from.parent.inlineContent||(s=Dm(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=Dm(t,n.to))),t.docView.setSelection(r,i,t,e),Im&&(s&&Lm(s),o&&Lm(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&yC(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Im=Vt||Bt&&g0<63;function Dm(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(Vt&&i&&i.contentEditable=="false")return Jd(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Jd(i);if(s)return Jd(s)}}function Jd(t){return t.contentEditable="true",Vt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Lm(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function yC(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!A0(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function bC(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Lt(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&an&&ni<=11&&(n.disabled=!0,n.disabled=!1)}function M0(t,e){if(e instanceof he){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Pm(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Pm(t)}function Pm(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function gh(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||ye.between(e,n,r)}function Bm(t){return t.editable&&!t.hasFocus()?!1:O0(t)}function O0(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function vC(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Fi(e.node,e.offset,n.anchorNode,n.anchorOffset)}function hf(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&Se.findFrom(s,e)}function Vr(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function jm(t,e,n){let r=t.state.selection;if(r instanceof ye)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Vr(t,new ye(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=hf(t.state,e);return i&&i instanceof he?Vr(t,i):!1}else if(!(Sn&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let a=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(a))&&!o.contentDOM?he.isSelectable(s)?Vr(t,new he(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):ya?Vr(t,new ye(t.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof he&&r.node.isInline)return Vr(t,new ye(e>0?r.$to:r.$from));{let i=hf(t.state,e);return i?Vr(t,i):!1}}}function Fl(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Eo(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Qi(t,e){return e<0?xC(t):wC(t)}function xC(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(_n&&n.nodeType==1&&r<Fl(n)&&Eo(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Eo(a,-1))i=n,s=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(R0(n))break;{let a=n.previousSibling;for(;a&&Eo(a,-1);)i=n.parentNode,s=Lt(a),a=a.previousSibling;if(a)n=a,r=Fl(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?pf(t,n,r):i&&pf(t,i,s)}function wC(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Fl(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let a=n.childNodes[r];if(Eo(a,1))s=n,o=++r;else break}else{if(R0(n))break;{let a=n.nextSibling;for(;a&&Eo(a,1);)s=a.parentNode,o=Lt(a)+1,a=a.nextSibling;if(a)n=a,r=0,i=Fl(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&pf(t,s,o)}function R0(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function EC(t,e){for(;t&&e==t.childNodes.length&&!ga(t);)e=Lt(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function kC(t,e){for(;t&&!e&&!ga(t);)e=Lt(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function pf(t,e,n){if(e.nodeType!=3){let s,o;(o=EC(e,n))?(e=o,n=0):(s=kC(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Wc(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&Cr(t)},50)}function $m(t,e){let n=t.state.doc.resolve(e);if(!(Bt||y0)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Fm(t,e,n){let r=t.state.selection;if(r instanceof ye&&!r.empty||n.indexOf("s")>-1||Sn&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=hf(t.state,e);if(o&&o instanceof he)return Vr(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=r instanceof gn?Se.near(o,e):Se.findFrom(o,e);return a?Vr(t,a):!1}return!1}function Hm(t,e){if(!(t.state.selection instanceof ye))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function zm(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function SC(t){if(!Vt||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;zm(t,r,"true"),setTimeout(()=>zm(t,r,"false"),20)}return!1}function CC(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function _C(t,e){let n=e.keyCode,r=CC(e);if(n==8||Sn&&n==72&&r=="c")return Hm(t,-1)||Qi(t,-1);if(n==46&&!e.shiftKey||Sn&&n==68&&r=="c")return Hm(t,1)||Qi(t,1);if(n==13||n==27)return!0;if(n==37||Sn&&n==66&&r=="c"){let i=n==37?$m(t,t.state.selection.from)=="ltr"?-1:1:-1;return jm(t,i,r)||Qi(t,i)}else if(n==39||Sn&&n==70&&r=="c"){let i=n==39?$m(t,t.state.selection.from)=="ltr"?1:-1:1;return jm(t,i,r)||Qi(t,i)}else{if(n==38||Sn&&n==80&&r=="c")return Fm(t,-1,r)||Qi(t,-1);if(n==40||Sn&&n==78&&r=="c")return SC(t)||Fm(t,1,r)||Qi(t,1);if(r==(Sn?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function yh(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let o=t.someProp("clipboardSerializer")||Ki.fromSchema(t.state.schema),a=j0(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let c=l.firstChild,d,u=0;for(;c&&c.nodeType==1&&(d=B0[c.nodeName.toLowerCase()]);){for(let h=d.length-1;h>=0;h--){let m=a.createElement(d[h]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),u++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${u?` -${u}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
7
+
8
+ `);return{dom:l,text:f,slice:e}}function I0(t,e,n,r,i){let s=i.parent.type.spec.code,o,a;if(!n&&!e)return null;let l=!!e&&(r||s||!n);if(l){if(t.someProp("transformPastedText",f=>{e=f(e,s||r,t)}),s)return a=new Z(L.from(t.state.schema.text(e.replace(/\r\n?/g,`
9
+ `))),0,0),t.someProp("transformPasted",f=>{a=f(a,t,!0)}),a;let u=t.someProp("clipboardTextParser",f=>f(e,i,r,t));if(u)a=u;else{let f=i.marks(),{schema:h}=t.state,m=Ki.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=o.appendChild(document.createElement("p"));g&&y.appendChild(m.serializeNode(h.text(g,f)))})}}else t.someProp("transformPastedHTML",u=>{n=u(n,t)}),o=MC(n),ya&&OC(o);let c=o&&o.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let u=+d[3];u>0;u--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||vo.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||d),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!NC.test(f.parentNode.nodeName)?{ignore:!0}:null}})),d)a=RC(Um(a,+d[1],+d[2]),d[4]);else if(a=Z.maxOpen(TC(a.content,i),!0),a.openStart||a.openEnd){let u=0,f=0;for(let h=a.content.firstChild;u<a.openStart&&!h.type.spec.isolating;u++,h=h.firstChild);for(let h=a.content.lastChild;f<a.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);a=Um(a,u,f)}return t.someProp("transformPasted",u=>{a=u(a,t,l)}),a}const NC=/^(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 TC(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(a=>{if(!o)return;let l=i.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&s.length&&L0(l,s,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=P0(o[o.length-1],s.length));let d=D0(a,l);o.push(d),i=i.matchType(d.type),s=l}}),o)return L.from(o)}return t}function D0(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,L.from(t));return t}function L0(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=L0(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(L.from(D0(n,t,i+1))))}}function P0(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,P0(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(L.empty,!0);return t.copy(n.append(r))}function mf(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,a=o.content;return t.childCount>1&&(s=0),i<r-1&&(a=mf(a,e,n,r,i+1,s)),i>=n&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(L.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(a))}function Um(t,e,n){return e<t.openStart&&(t=new Z(mf(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new Z(mf(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const B0={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 Vm=null;function j0(){return Vm||(Vm=document.implementation.createHTMLDocument("title"))}let Xd=null;function AC(t){let e=window.trustedTypes;return e?(Xd||(Xd=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Xd.createHTML(t)):t}function MC(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=j0().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&B0[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=AC(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function OC(t){let e=t.querySelectorAll(Bt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function RC(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:o}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=L.from(l.create(r[a+1],i)),s++,o++}return new Z(i,s,o)}const Yt={},Jt={},IC={touchstart:!0,touchmove:!0};class DC{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function LC(t){for(let e in Yt){let n=Yt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{BC(t,r)&&!bh(t,r)&&(t.editable||!(r.type in Jt))&&n(t,r)},IC[e]?{passive:!0}:void 0)}Vt&&t.dom.addEventListener("input",()=>null),gf(t)}function Zr(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function PC(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function gf(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>bh(t,r))})}function bh(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function BC(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function jC(t,e){!bh(t,e)&&Yt[e.type]&&(t.editable||!(e.type in Jt))&&Yt[e.type](t,e)}Jt.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!F0(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(wr&&Bt&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),_s&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,Ci(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||_C(t,n)?n.preventDefault():Zr(t,"key")};Jt.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Jt.keypress=(t,e)=>{let n=e;if(F0(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Sn&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof ye)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function qc(t){return{left:t.clientX,top:t.clientY}}function $C(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function vh(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,a=>o>s.depth?a(t,n,s.nodeAfter,s.before(o),i,!0):a(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function ys(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function FC(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&he.isSelectable(r)?(ys(t,new he(n)),!0):!1}function HC(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof he&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(he.isSelectable(a)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(ys(t,he.create(t.state.doc,i)),!0):!1}function zC(t,e,n,r,i){return vh(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?HC(t,n):FC(t,n))}function UC(t,e,n,r){return vh(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function VC(t,e,n,r){return vh(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||KC(t,n,r)}function KC(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(ys(t,ye.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),a=i.before(s);if(o.inlineContent)ys(t,ye.create(r,a+1,a+1+o.content.size));else if(he.isSelectable(o))ys(t,he.create(r,a));else continue;return!0}}function xh(t){return Hl(t)}const $0=Sn?"metaKey":"ctrlKey";Yt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=xh(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&$C(n,t.input.lastClick)&&!n[$0]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button};let o=t.posAtCoords(qc(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new WC(t,o,n,!!r)):(s=="doubleClick"?UC:VC)(t,o.pos,o.inside,n)?n.preventDefault():Zr(t,"pointer"))};class WC{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[$0],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let d=e.state.doc.resolve(n.pos);s=d.parent,o=d.depth?d.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;r.button==0&&(s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof he&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&_n&&!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)),Zr(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(()=>Cr(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(qc(e))),this.updateAllowDefault(e),this.allowDefault||!n?Zr(this.view,"pointer"):zC(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Vt&&this.mightDrag&&!this.mightDrag.node.isAtom||Bt&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(ys(this.view,Se.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Zr(this.view,"pointer")}move(e){this.updateAllowDefault(e),Zr(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)}}Yt.touchstart=t=>{t.input.lastTouch=Date.now(),xh(t),Zr(t,"pointer")};Yt.touchmove=t=>{t.input.lastTouch=Date.now(),Zr(t,"pointer")};Yt.contextmenu=t=>xh(t);function F0(t,e){return t.composing?!0:Vt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const GC=wr?5e3:-1;Jt.compositionstart=Jt.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof ye&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Bt&&y0&&qC(t)))t.markCursor=t.state.storedMarks||n.marks(),Hl(t,!0),t.markCursor=null;else if(Hl(t,!e.selection.empty),_n&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let a=t.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}H0(t,GC)};function qC(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}Jt.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,H0(t,20))};function H0(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Hl(t),e))}function z0(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=JC());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function YC(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=HS(e.focusNode,e.focusOffset),r=zS(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function JC(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Hl(t,e=!1){if(!(wr&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),z0(t),e||t.docView&&t.docView.dirty){let n=mh(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function XC(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Fo=an&&ni<15||_s&&WS<604;Yt.copy=Jt.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=Fo?null:n.clipboardData,o=r.content(),{dom:a,text:l}=yh(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):XC(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function ZC(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function QC(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Ho(t,r.value,null,i,e):Ho(t,r.textContent,r.innerHTML,i,e)},50)}function Ho(t,e,n,r,i){let s=I0(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,i,s||Z.empty)))return!0;if(!s)return!1;let o=ZC(s),a=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function U0(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Jt.paste=(t,e)=>{let n=e;if(t.composing&&!wr)return;let r=Fo?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Ho(t,U0(r),r.getData("text/html"),i,n)?n.preventDefault():QC(t,n)};class V0{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const e_=Sn?"altKey":"ctrlKey";function K0(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[e_]}Yt.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(qc(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof he?i.to-1:i.to))){if(r&&r.mightDrag)o=he.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let u=t.docView.nearestDesc(n.target,!0);u&&u.node.type.spec.draggable&&u!=t.docView&&(o=he.create(t.state.doc,u.posBefore))}}let a=(o||t.state.selection).content(),{dom:l,text:c,slice:d}=yh(t,a);(!n.dataTransfer.files.length||!Bt||g0>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Fo?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",Fo||n.dataTransfer.setData("text/plain",c),t.dragging=new V0(d,K0(t,n),o)};Yt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Jt.dragover=Jt.dragenter=(t,e)=>e.preventDefault();Jt.drop=(t,e)=>{try{t_(t,e,t.dragging)}finally{t.dragging=null}};function t_(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(qc(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",h=>{s=h(s,t,!1)}):s=I0(t,U0(e.dataTransfer),Fo?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&K0(t,e));if(t.someProp("handleDrop",h=>h(t,e,s||Z.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let a=s?o0(t.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let l=t.state.tr;if(o){let{node:h}=n;h?h.replace(l):l.deleteSelection()}let c=l.mapping.map(a),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,u=l.doc;if(d?l.replaceRangeWith(c,c,s.content.firstChild):l.replaceRange(c,c,s),l.doc.eq(u))return;let f=l.doc.resolve(c);if(d&&he.isSelectable(s.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(s.content.firstChild))l.setSelection(new he(f));else{let h=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((m,g,y,b)=>h=b),l.setSelection(gh(t,f,l.doc.resolve(h)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}Yt.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Cr(t)},20))};Yt.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Yt.beforeinput=(t,e)=>{if(Bt&&wr&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,Ci(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in Jt)Yt[t]=Jt[t];function zo(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class zl{constructor(e,n){this.toDOM=e,this.spec=n||Ri,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new jt(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof zl&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&zo(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class ii{constructor(e,n){this.attrs=e,this.spec=n||Ri}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new jt(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof ii&&zo(this.attrs,e.attrs)&&zo(this.spec,e.spec)}static is(e){return e.type instanceof ii}destroy(){}}class wh{constructor(e,n){this.attrs=e,this.spec=n||Ri}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let o=e.mapResult(n.to+i,-1);return o.deleted||o.pos<=s.pos?null:new jt(s.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof wh&&zo(this.attrs,e.attrs)&&zo(this.spec,e.spec)}destroy(){}}class jt{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new jt(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new jt(e,e,new zl(n,r))}static inline(e,n,r,i){return new jt(e,n,new ii(r,i))}static node(e,n,r,i){return new jt(e,n,new wh(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof ii}get widget(){return this.type instanceof zl}}const ls=[],Ri={};class nt{constructor(e,n){this.local=e.length?e:ls,this.children=n.length?n:ls}static create(e,n){return n.length?Ul(n,e,0,Ri):zt}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=n&&a.to>=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,n-a,r,i+a,s)}}map(e,n,r){return this==zt||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Ri)}mapInner(e,n,r,i,s){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,i);l&&l.type.valid(n,l)?(o||(o=[])).push(l):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?n_(this.children,o||[],e,n,r,i,s):o?new nt(o.sort(Ii),ls):zt}add(e,n){return n.length?this==zt?nt.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((a,l)=>{let c=l+r,d;if(d=G0(n,a,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<l;)s+=3;i[s]==l?i[s+2]=i[s+2].addInner(a,d,c+1):i.splice(s,0,l,l+a.nodeSize,Ul(d,a,c+1,Ri)),s+=3}});let o=W0(s?q0(n):n,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new nt(o.length?this.local.concat(o).sort(Ii):this.local,i||this.children)}remove(e){return e.length==0||this==zt?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,a=r[s]+n,l=r[s+1]+n;for(let d=0,u;d<e.length;d++)(u=e[d])&&u.from>a&&u.to<l&&(e[d]=null,(o||(o=[])).push(u));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(o,a+1);c!=zt?r[s+2]=c:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let a=0;a<i.length;a++)i[a].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new nt(i,r):zt}forChild(e,n){if(this==zt)return this;if(n.isLeaf)return nt.empty;let r,i;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,o=s+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>s&&l.type instanceof ii){let c=Math.max(s,l.from)-s,d=Math.min(o,l.to)-s;c<d&&(i||(i=[])).push(l.copy(c,d))}}if(i){let a=new nt(i.sort(Ii),ls);return r?new Gr([a,r]):a}return r||zt}eq(e){if(this==e)return!0;if(!(e instanceof nt)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Eh(this.localsInner(e))}localsInner(e){if(this==zt)return ls;if(e.inlineContent||!this.local.some(ii.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof ii||n.push(this.local[r]);return n}forEachSet(e){e(this)}}nt.empty=new nt([],[]);nt.removeOverlap=Eh;const zt=nt.empty;class Gr{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Ri));return Gr.from(r)}forChild(e,n){if(n.isLeaf)return nt.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=zt&&(s instanceof Gr?r=r.concat(s.members):r.push(s))}return Gr.from(r)}eq(e){if(!(e instanceof Gr)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?Eh(r?n:n.sort(Ii)):ls}static from(e){switch(e.length){case 0:return zt;case 1:return e[0];default:return new Gr(e.every(n=>n instanceof nt)?e:e.reduce((n,r)=>n.concat(r instanceof nt?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function n_(t,e,n,r,i,s,o){let a=t.slice();for(let c=0,d=s;c<n.maps.length;c++){let u=0;n.maps[c].forEach((f,h,m,g)=>{let y=g-m-(h-f);for(let b=0;b<a.length;b+=3){let w=a[b+1];if(w<0||f>w+d-u)continue;let k=a[b]+d-u;h>=k?a[b+1]=f<=k?-2:-1:f>=d&&y&&(a[b]+=y,a[b+1]+=y)}u+=y}),d=n.maps[c].map(d,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let d=n.map(t[c]+s),u=d-i;if(u<0||u>=r.content.size){l=!0;continue}let f=n.map(t[c+1]+s,-1),h=f-i,{index:m,offset:g}=r.content.findIndex(u),y=r.maybeChild(m);if(y&&g==u&&g+y.nodeSize==h){let b=a[c+2].mapInner(n,y,d+1,t[c]+s+1,o);b!=zt?(a[c]=u,a[c+1]=h,a[c+2]=b):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=r_(a,t,e,n,i,s,o),d=Ul(c,r,0,o);e=d.local;for(let u=0;u<a.length;u+=3)a[u+1]<0&&(a.splice(u,3),u-=3);for(let u=0,f=0;u<d.children.length;u+=3){let h=d.children[u];for(;f<a.length&&a[f]<h;)f+=3;a.splice(f,0,d.children[u],d.children[u+1],d.children[u+2])}}return new nt(e.sort(Ii),a)}function W0(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new jt(i.from+e,i.to+e,i.type))}return n}function r_(t,e,n,r,i,s,o){function a(l,c){for(let d=0;d<l.local.length;d++){let u=l.local[d].map(r,i,c);u?n.push(u):o.onRemove&&o.onRemove(l.local[d].spec)}for(let d=0;d<l.children.length;d+=3)a(l.children[d+2],l.children[d]+c+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+s+1);return n}function G0(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function q0(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Ul(t,e,n,r){let i=[],s=!1;e.forEach((a,l)=>{let c=G0(t,a,l+n);if(c){s=!0;let d=Ul(c,a,n+l+1,r);d!=zt&&i.push(l,l+a.nodeSize,d)}});let o=W0(s?q0(t):t,-n).sort(Ii);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new nt(o,i):zt}function Ii(t,e){return t.from-e.from||t.to-e.to}function Eh(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),Km(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),Km(e,i,r.copy(s.from,r.to)));break}}}return e}function Km(t,e,n){for(;e<t.length&&Ii(n,t[e])>0;)e++;t.splice(e,0,n)}function Zd(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=zt&&e.push(r)}),t.cursorWrapper&&e.push(nt.create(t.state.doc,[t.cursorWrapper.deco])),Gr.from(e)}const i_={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},s_=an&&ni<=11;class o_{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 a_{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new o_,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);an&&ni<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():Vt&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),s_&&(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,i_)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Bm(this.view)){if(this.suppressingSelectionUpdates)return Cr(this.view);if(an&&ni<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Fi(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let s=e.focusNode;s;s=Cs(s))n.add(s);for(let s=e.anchorNode;s;s=Cs(s))if(n.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Bm(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,a=!1,l=[];if(e.editable)for(let d=0;d<n.length;d++){let u=this.registerMutation(n[d],l);u&&(s=s<0?u.from:Math.min(u.from,s),o=o<0?u.to:Math.max(u.to,o),u.typeOver&&(a=!0))}if(l.some(d=>d.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let d of l)if(d.nodeName=="BR"&&d.parentNode){let u=d.nextSibling;for(;u&&u.nodeType==1;){if(u.contentEditable=="false"){d.parentNode.removeChild(d);break}u=u.firstChild}}}else if(_n&&l.length){let d=l.filter(u=>u.nodeName=="BR");if(d.length==2){let[u,f]=d;u.parentNode&&u.parentNode.parentNode==f.parentNode?f.remove():u.remove()}else{let{focusNode:u}=this.currentSelection;for(let f of d){let h=f.parentNode;h&&h.nodeName=="LI"&&(!u||d_(e,u)!=h)&&f.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Wc(r)&&(c=mh(e))&&c.eq(Se.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Cr(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),l_(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,u_(e,l)),this.handleDOMChange(s,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Cr(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let u=e.addedNodes[d];n.push(u),u.nodeType==3&&(this.lastChangedTextNode=u)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(an&&ni<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:u,nextSibling:f}=e.addedNodes[d];(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(i=u),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(s=f)}let o=i&&i.parentNode==e.target?Lt(i)+1:0,a=r.localPosFromDOM(e.target,o,-1),l=s&&s.parentNode==e.target?Lt(s):e.target.childNodes.length,c=r.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Wm=new WeakMap,Gm=!1;function l_(t){if(!Wm.has(t)&&(Wm.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=_n,Gm)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."),Gm=!0}}function qm(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return Fi(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function c_(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return qm(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?qm(t,n):null}function d_(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function u_(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let s of e)if(((n=s.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=s.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let a=o;for(;;){let l=a.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;a=l}a.insertBefore(s,a.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function f_(t,e,n){let{node:r,fromOffset:i,toOffset:s,from:o,to:a}=t.docView.parseRange(e,n),l=t.domSelectionRange(),c,d=l.anchorNode;if(d&&t.dom.contains(d.nodeType==1?d:d.parentNode)&&(c=[{node:d,offset:l.anchorOffset}],Wc(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Bt&&t.input.lastKeyCode===8)for(let y=s;y>i;y--){let b=r.childNodes[y-1],w=b.pmViewDesc;if(b.nodeName=="BR"&&!w){s=y;break}if(!w||w.size)break}let u=t.state.doc,f=t.someProp("domParser")||vo.fromSchema(t.state.schema),h=u.resolve(o),m=null,g=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:s,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:h_,context:h});if(c&&c[0].pos!=null){let y=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=y),m={anchor:y+o,head:b+o}}return{doc:g,sel:m,from:o,to:a}}function h_(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Vt&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Vt&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const p_=/^(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 m_(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let C=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,N=mh(t,C);if(N&&!t.state.selection.eq(N)){if(Bt&&wr&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",D=>D(t,Ci(13,"Enter"))))return;let M=t.state.tr.setSelection(N);C=="pointer"?M.setMeta("pointer",!0):C=="key"&&M.scrollIntoView(),s&&M.setMeta("composition",s),t.dispatch(M)}return}let o=t.state.doc.resolve(e),a=o.sharedDepth(n);e=o.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,c=f_(t,e,n),d=t.state.doc,u=d.slice(c.from,c.to),f,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,h="end"):(f=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let m=b_(u.content,c.doc.content,c.from,f,h);if(m&&t.input.domChangeCount++,(_s&&t.input.lastIOSEnter>Date.now()-225||wr)&&i.some(C=>C.nodeType==1&&!p_.test(C.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",C=>C(t,Ci(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(r&&l instanceof ye&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let C=Ym(t,t.state.doc,c.sel);if(C&&!C.eq(t.state.selection)){let N=t.state.tr.setSelection(C);s&&N.setMeta("composition",s),t.dispatch(N)}}return}t.state.selection.from<t.state.selection.to&&m.start==m.endB&&t.state.selection instanceof ye&&(m.start>t.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?m.start=t.state.selection.from:m.endA<t.state.selection.to&&m.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),an&&ni<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>c.from&&c.doc.textBetween(m.start-c.from-1,m.start-c.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let g=c.doc.resolveNoCache(m.start-c.from),y=c.doc.resolveNoCache(m.endB-c.from),b=d.resolve(m.start),w=g.sameParent(y)&&g.parent.inlineContent&&b.end()>=m.endA;if((_s&&t.input.lastIOSEnter>Date.now()-225&&(!w||i.some(C=>C.nodeName=="DIV"||C.nodeName=="P"))||!w&&g.pos<c.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(c.doc.textBetween(g.pos,y.pos,"","")))&&t.someProp("handleKeyDown",C=>C(t,Ci(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&y_(d,m.start,m.endA,g,y)&&t.someProp("handleKeyDown",C=>C(t,Ci(8,"Backspace")))){wr&&Bt&&t.domObserver.suppressSelectionUpdates();return}Bt&&m.endB==m.start&&(t.input.lastChromeDelete=Date.now()),wr&&!w&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==m.endA&&(m.endB-=2,y=c.doc.resolveNoCache(m.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(C){return C(t,Ci(13,"Enter"))})},20));let k=m.start,v=m.endA,E=C=>{let N=C||t.state.tr.replace(k,v,c.doc.slice(m.start-c.from,m.endB-c.from));if(c.sel){let M=Ym(t,N.doc,c.sel);M&&!(Bt&&t.composing&&M.empty&&(m.start!=m.endB||t.input.lastChromeDelete<Date.now()-100)&&(M.head==k||M.head==N.mapping.map(v)-1)||an&&M.empty&&M.head==k)&&N.setSelection(M)}return s&&N.setMeta("composition",s),N.scrollIntoView()},S;if(w)if(g.pos==y.pos){an&&ni<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Cr(t),20));let C=E(t.state.tr.delete(k,v)),N=d.resolve(m.start).marksAcross(d.resolve(m.endA));N&&C.ensureMarks(N),t.dispatch(C)}else if(m.endA==m.endB&&(S=g_(g.parent.content.cut(g.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,m.endA-b.start())))){let C=E(t.state.tr);S.type=="add"?C.addMark(k,v,S.mark):C.removeMark(k,v,S.mark),t.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),N=()=>E(t.state.tr.insertText(C,k,v));t.someProp("handleTextInput",M=>M(t,k,v,C,N))||t.dispatch(N())}else t.dispatch(E());else t.dispatch(E())}function Ym(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:gh(t,e.resolve(n.anchor),e.resolve(n.head))}function g_(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,o,a,l;for(let d=0;d<r.length;d++)i=r[d].removeFromSet(i);for(let d=0;d<n.length;d++)s=n[d].removeFromSet(s);if(i.length==1&&s.length==0)a=i[0],o="add",l=d=>d.mark(a.addToSet(d.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",l=d=>d.mark(a.removeFromSet(d.marks));else return null;let c=[];for(let d=0;d<e.childCount;d++)c.push(l(e.child(d)));if(L.from(c).eq(t))return{mark:a,type:o}}function y_(t,e,n,r,i){if(n-e<=i.pos-r.pos||Qd(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let a=s.nodeAfter;return a!=null&&n==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=t.resolve(Qd(s,!0,!0));return!o.parent.isTextblock||o.pos>n||Qd(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Qd(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function b_(t,e,n,r,i){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:o,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let l=Math.max(0,s-Math.min(o,a));r-=o+l-s}if(o<s&&t.size<e.size){let l=r<=s&&r>=o?s-r:0;s-=l,s&&s<e.size&&Jm(e.textBetween(s-1,s+1))&&(s+=l?1:-1),a=s+(a-o),o=s}else if(a<s){let l=r<=s&&r>=a?s-r:0;s-=l,s&&s<t.size&&Jm(t.textBetween(s-1,s+1))&&(s+=l?1:-1),o=s+(o-a),a=s}return{start:s,endA:o,endB:a}}function Jm(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class Y0{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new DC,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(tg),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=Qm(this),Zm(this),this.nodeViews=eg(this),this.docView=Om(this.state.doc,Xm(this),Zd(this),this.dom,this),this.domObserver=new a_(this,(r,i,s,o)=>m_(this,r,i,s,o)),this.domObserver.start(),LC(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&gf(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(tg),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(z0(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=eg(this);x_(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&gf(this),this.editable=Qm(this),Zm(this);let l=Zd(this),c=Xm(this),d=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",u=s||!this.docView.matchesNode(e.doc,c,l);(u||!e.selection.eq(i.selection))&&(o=!0);let f=d=="preserve"&&o&&this.dom.style.overflowAnchor==null&&YS(this);if(o){this.domObserver.stop();let h=u&&(an||Bt)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&v_(i.selection,e.selection);if(u){let m=Bt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=YC(this)),(s||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Om(e.doc,c,l,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&vC(this))?Cr(this,h):(M0(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():f&&JS(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof he){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Cm(this,n.getBoundingClientRect(),e)}else Cm(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&s<this.state.doc.content.size&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new V0(e.slice,e.move,i<0?void 0:he.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(i=n?n(a):a))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let a=s[o].props[e];if(a!=null&&(i=n?n(a):a))return i}}hasFocus(){if(an){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&&XS(this.dom),Cr(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return nC(this,e)}coordsAtPos(e,n=1){return E0(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return aC(this,n||this.state,e)}pasteHTML(e,n){return Ho(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Ho(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return yh(this,e)}destroy(){this.docView&&(PC(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Zd(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,$S())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return jC(this,e)}domSelectionRange(){let e=this.domSelection();return e?Vt&&this.root.nodeType===11&&VS(this.dom.ownerDocument)==this.dom&&c_(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Y0.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Xm(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[jt.node(0,t.state.doc.content.size,e)]}function Zm(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:jt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Qm(t){return!t.someProp("editable",e=>e(t.state)===!1)}function v_(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function eg(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function x_(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function tg(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var si={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:"'"},Vl={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},w_=typeof navigator<"u"&&/Mac/.test(navigator.platform),E_=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Pt=0;Pt<10;Pt++)si[48+Pt]=si[96+Pt]=String(Pt);for(var Pt=1;Pt<=24;Pt++)si[Pt+111]="F"+Pt;for(var Pt=65;Pt<=90;Pt++)si[Pt]=String.fromCharCode(Pt+32),Vl[Pt]=String.fromCharCode(Pt);for(var eu in si)Vl.hasOwnProperty(eu)||(Vl[eu]=si[eu]);function k_(t){var e=w_&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||E_&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Vl:si)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const S_=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),C_=typeof navigator<"u"&&/Win/.test(navigator.platform);function __(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))S_?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),o&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function N_(t){let e=Object.create(null);for(let n in t)e[__(n)]=t[n];return e}function tu(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function T_(t){return new Ze({props:{handleKeyDown:J0(t)}})}function J0(t){let e=N_(t);return function(n,r){let i=k_(r),s,o=e[tu(i,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[tu(i,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(C_&&r.ctrlKey&&r.altKey)&&(s=si[r.keyCode])&&s!=i){let a=e[tu(s,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}const kh=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function X0(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Z0=(t,e,n)=>{let r=X0(t,n);if(!r)return!1;let i=Sh(r);if(!i){let o=r.blockRange(),a=o&&Ws(o);return a==null?!1:(e&&e(t.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(av(t,i,e,-1))return!0;if(r.parent.content.size==0&&(Ns(s,"end")||he.isSelectable(s)))for(let o=r.depth;;o--){let a=Vc(t.doc,r.before(o),r.after(o),Z.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(Ns(s,"end")?Se.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):he.create(l.doc,i.pos-s.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},A_=(t,e,n)=>{let r=X0(t,n);if(!r)return!1;let i=Sh(r);return i?Q0(t,i,e):!1},M_=(t,e,n)=>{let r=tv(t,n);if(!r)return!1;let i=Ch(r);return i?Q0(t,i,e):!1};function Q0(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let d=i.lastChild;if(!d)return!1;i=d}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let d=a.firstChild;if(!d)return!1;a=d}let c=Vc(t.doc,s,l,Z.empty);if(!c||c.from!=s||c instanceof pt&&c.slice.size>=l-s)return!1;if(n){let d=t.tr.step(c);d.setSelection(ye.create(d.doc,s)),n(d.scrollIntoView())}return!0}function Ns(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const ev=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=Sh(r)}let o=s&&s.nodeBefore;return!o||!he.isSelectable(o)?!1:(e&&e(t.tr.setSelection(he.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function Sh(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function tv(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const nv=(t,e,n)=>{let r=tv(t,n);if(!r)return!1;let i=Ch(r);if(!i)return!1;let s=i.nodeAfter;if(av(t,i,e,1))return!0;if(r.parent.content.size==0&&(Ns(s,"start")||he.isSelectable(s))){let o=Vc(t.doc,r.before(),r.after(),Z.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=t.tr.step(o);a.setSelection(Ns(s,"start")?Se.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):he.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},rv=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=Ch(r)}let o=s&&s.nodeAfter;return!o||!he.isSelectable(o)?!1:(e&&e(t.tr.setSelection(he.create(t.doc,s.pos)).scrollIntoView()),!0)};function Ch(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const O_=(t,e)=>{let n=t.selection,r=n instanceof he,i;if(r){if(n.node.isTextblock||!ui(t.doc,n.from))return!1;i=n.from}else if(i=Uc(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(he.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},R_=(t,e)=>{let n=t.selection,r;if(n instanceof he){if(n.node.isTextblock||!ui(t.doc,n.to))return!1;r=n.to}else if(r=Uc(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},I_=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&Ws(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},iv=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
10
+ `).scrollIntoView()),!0)};function _h(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const D_=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),o=_h(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,o.createAndFill());l.setSelection(Se.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},sv=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof gn||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=_h(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=t.tr.insert(o,s.createAndFill());a.setSelection(ye.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},ov=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(Sr(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Ws(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function L_(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof he&&e.selection.node.isBlock)return!r.parentOffset||!Sr(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,a,l=!1,c=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){l=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),a=_h(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),s.unshift(l&&a?{type:a}:null),o=h;break}else{if(h==1)return!1;s.unshift(null)}let d=e.tr;(e.selection instanceof ye||e.selection instanceof gn)&&d.deleteSelection();let u=d.mapping.map(r.pos),f=Sr(d.doc,u,s.length,s);if(f||(s[0]=a?{type:a}:null,f=Sr(d.doc,u,s.length,s)),!f)return!1;if(d.split(u,s.length,s),!l&&c&&r.node(o).type!=a){let h=d.mapping.map(r.before(o)),m=d.doc.resolve(h);a&&r.node(o-1).canReplaceWith(m.index(),m.index()+1,a)&&d.setNodeMarkup(d.mapping.map(r.before(o)),a)}return n&&n(d.scrollIntoView()),!0}}const P_=L_(),B_=(t,e)=>{let{$from:n,to:r}=t.selection,i,s=n.sharedDepth(r);return s==0?!1:(i=n.before(s),e&&e(t.tr.setSelection(he.create(t.doc,i))),!0)};function j_(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||ui(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function av(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,o,a,l=i.type.spec.isolating||s.type.spec.isolating;if(!l&&j_(t,e,n))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(a=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&a.matchType(o[0]||s.type).validEnd){if(n){let h=e.pos+s.nodeSize,m=L.empty;for(let b=o.length-1;b>=0;b--)m=L.from(o[b].create(null,m));m=L.from(i.copy(m));let g=t.tr.step(new St(e.pos-1,h,e.pos,h,new Z(m,1,0),o.length,!0)),y=g.doc.resolve(h+2*o.length);y.nodeAfter&&y.nodeAfter.type==i.type&&ui(g.doc,y.pos)&&g.join(y.pos),n(g.scrollIntoView())}return!0}let d=s.type.spec.isolating||r>0&&l?null:Se.findFrom(e,1),u=d&&d.$from.blockRange(d.$to),f=u&&Ws(u);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(u,f).scrollIntoView()),!0;if(c&&Ns(s,"start",!0)&&Ns(i,"end")){let h=i,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(n){let b=L.empty;for(let k=m.length-1;k>=0;k--)b=L.from(m[k].copy(b));let w=t.tr.step(new St(e.pos-m.length,e.pos+s.nodeSize,e.pos+y,e.pos+s.nodeSize-y,new Z(b,m.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function lv(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(e.tr.setSelection(ye.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const $_=lv(-1),F_=lv(1);function H_(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),a=o&&fh(o,t,e);return a?(r&&r(n.tr.wrap(o,a).scrollIntoView()),!0):!1}}function ng(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:a}}=n.selection.ranges[s];n.doc.nodesBetween(o,a,(l,c)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)i=!0;else{let d=n.doc.resolve(c),u=d.index();i=d.parent.canReplaceWith(u,u+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[o];s.setBlockType(a,l,t,e)}r(s.scrollIntoView())}return!0}}function Nh(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}Nh(kh,Z0,ev);Nh(kh,nv,rv);Nh(iv,sv,ov,P_);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function z_(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s);if(!o)return!1;let a=r?n.tr:null;return U_(a,o,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function U_(t,e,n,r=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=o.resolve(e.start-2);s=new Po(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new Po(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=fh(s,n,r,e);return a?(t&&V_(t,e,a,i,n),!0):!1}function V_(t,e,n,r,i){let s=L.empty;for(let d=n.length-1;d>=0;d--)s=L.from(n[d].type.create(n[d].attrs,s));t.step(new St(e.start-(r?2:0),e.end,e.start,e.end,new Z(s,0,0),n.length,!0));let o=0;for(let d=0;d<n.length;d++)n[d].type==i&&(o=d+1);let a=n.length-o,l=e.start+n.length-(r?2:0),c=e.parent;for(let d=e.startIndex,u=e.endIndex,f=!0;d<u;d++,f=!1)!f&&Sr(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(d).nodeSize;return t}function K_(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?W_(e,n,t,s):G_(e,n,s):!0:!1}}function W_(t,e,n,r){let i=t.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new St(s-1,o,s,o,new Z(L.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Po(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const a=Ws(r);if(a==null)return!1;i.lift(r,a);let l=i.doc.resolve(i.mapping.map(s,-1)-1);return ui(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function G_(t,e,n){let r=t.tr,i=n.parent;for(let h=n.end,m=n.endIndex-1,g=n.startIndex;m>g;m--)h-=i.child(m).nodeSize,r.delete(h-1,h+1);let s=r.doc.resolve(n.start),o=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==i.childCount,c=s.node(-1),d=s.index(-1);if(!c.canReplace(d+(a?0:1),d+1,o.content.append(l?L.empty:L.from(i))))return!1;let u=s.pos,f=u+o.nodeSize;return r.step(new St(u-(a?1:0),f+(l?1:0),u+1,f-1,new Z((a?L.empty:L.from(i.copy(L.empty))).append(l?L.empty:L.from(i.copy(L.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function q_(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==t);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,l=a.child(o-1);if(l.type!=t)return!1;if(n){let c=l.lastChild&&l.lastChild.type==a.type,d=L.from(c?t.create():null),u=new Z(L.from(t.create(null,L.from(a.type.create(null,d)))),c?3:1,0),f=s.start,h=s.end;n(e.tr.step(new St(f-(c?3:1),h,f,h,u,1,!0)).scrollIntoView())}return!0}}function Yc(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:s}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,s=n.storedMarks,n}}}class Jc{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:r}=this,{view:i}=n,{tr:s}=r,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...d)=>{const u=l(...d)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,a=[],l=!!e,c=e||s.tr,d=()=>(!l&&n&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(c),a.every(f=>f===!0)),u={...Object.fromEntries(Object.entries(r).map(([f,h])=>[f,(...g)=>{const y=this.buildProps(c,n),b=h(...g)(y);return a.push(b),u}])),run:d};return u}createCan(e){const{rawCommands:n,state:r}=this,i=!1,s=e||r.tr,o=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(n).map(([l,c])=>[l,(...d)=>c(...d)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,a={tr:e,editor:i,view:o,state:Yc({state:s,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([l,c])=>[l,(...d)=>c(...d)(a)]))}};return a}}class Y_{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,n)),this}off(e,n){const r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(i=>i!==n):delete this.callbacks[e]),this}once(e,n){const r=(...i)=>{this.off(e,r),n.apply(this,i)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}}function oe(t,e,n){return t.config[e]===void 0&&t.parent?oe(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?oe(t.parent,e,n):null}):t.config[e]}function Xc(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function cv(t){const e=[],{nodeExtensions:n,markExtensions:r}=Xc(t),i=[...n,...r],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage,extensions:i},l=oe(o,"addGlobalAttributes",a);if(!l)return;l().forEach(d=>{d.types.forEach(u=>{Object.entries(d.attributes).forEach(([f,h])=>{e.push({type:u,name:f,attribute:{...s,...h}})})})})}),i.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=oe(o,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([d,u])=>{const f={...s,...u};typeof f?.default=="function"&&(f.default=f.default()),f?.isRequired&&f?.default===void 0&&delete f.default,e.push({type:o.name,name:d,attribute:f})})}),e}function _t(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function He(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const a=s?String(s).split(" "):[],l=r[i]?r[i].split(" "):[],c=a.filter(d=>!l.includes(d));r[i]=[...l,...c].join(" ")}else if(i==="style"){const a=s?s.split(";").map(d=>d.trim()).filter(Boolean):[],l=r[i]?r[i].split(";").map(d=>d.trim()).filter(Boolean):[],c=new Map;l.forEach(d=>{const[u,f]=d.split(":").map(h=>h.trim());c.set(u,f)}),a.forEach(d=>{const[u,f]=d.split(":").map(h=>h.trim());c.set(u,f)}),r[i]=Array.from(c.entries()).map(([d,u])=>`${d}: ${u}`).join("; ")}else r[i]=s}),r},{})}function Kl(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>He(n,r),{})}function dv(t){return typeof t=="function"}function Ae(t,e=void 0,...n){return dv(t)?e?t.bind(e)(...n):t(...n):t}function J_(t={}){return Object.keys(t).length===0&&t.constructor===Object}function X_(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function rg(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(n):X_(n.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...r,...i}}}}function ig(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&J_(n)?!1:n!=null))}function Z_(t,e){var n;const r=cv(t),{nodeExtensions:i,markExtensions:s}=Xc(t),o=(n=i.find(c=>oe(c,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(i.map(c=>{const d=r.filter(b=>b.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((b,w)=>{const k=oe(w,"extendNodeSchema",u);return{...b,...k?k(c):{}}},{}),h=ig({...f,content:Ae(oe(c,"content",u)),marks:Ae(oe(c,"marks",u)),group:Ae(oe(c,"group",u)),inline:Ae(oe(c,"inline",u)),atom:Ae(oe(c,"atom",u)),selectable:Ae(oe(c,"selectable",u)),draggable:Ae(oe(c,"draggable",u)),code:Ae(oe(c,"code",u)),whitespace:Ae(oe(c,"whitespace",u)),linebreakReplacement:Ae(oe(c,"linebreakReplacement",u)),defining:Ae(oe(c,"defining",u)),isolating:Ae(oe(c,"isolating",u)),attrs:Object.fromEntries(d.map(b=>{var w;return[b.name,{default:(w=b?.attribute)===null||w===void 0?void 0:w.default}]}))}),m=Ae(oe(c,"parseHTML",u));m&&(h.parseDOM=m.map(b=>rg(b,d)));const g=oe(c,"renderHTML",u);g&&(h.toDOM=b=>g({node:b,HTMLAttributes:Kl(b,d)}));const y=oe(c,"renderText",u);return y&&(h.toText=y),[c.name,h]})),l=Object.fromEntries(s.map(c=>{const d=r.filter(y=>y.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((y,b)=>{const w=oe(b,"extendMarkSchema",u);return{...y,...w?w(c):{}}},{}),h=ig({...f,inclusive:Ae(oe(c,"inclusive",u)),excludes:Ae(oe(c,"excludes",u)),group:Ae(oe(c,"group",u)),spanning:Ae(oe(c,"spanning",u)),code:Ae(oe(c,"code",u)),attrs:Object.fromEntries(d.map(y=>{var b;return[y.name,{default:(b=y?.attribute)===null||b===void 0?void 0:b.default}]}))}),m=Ae(oe(c,"parseHTML",u));m&&(h.parseDOM=m.map(y=>rg(y,d)));const g=oe(c,"renderHTML",u);return g&&(h.toDOM=y=>g({mark:y,HTMLAttributes:Kl(y,d)})),[c.name,h]}));return new Yb({topNode:o,nodes:a,marks:l})}function nu(t,e){return e.nodes[t]||e.marks[t]||null}function sg(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Th(t,e){const n=Ki.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}const Q_=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,a)=>{var l,c;const d=((c=(l=i.type.spec).toText)===null||c===void 0?void 0:c.call(l,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?d:d.slice(0,Math.max(0,r-s))}),n};function Ah(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class va{constructor(e){this.find=e.find,this.handler=e.handler}}const eN=(t,e)=>{if(Ah(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function ja(t){var e;const{editor:n,from:r,to:i,text:s,rules:o,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let d=!1;const u=Q_(c)+s;return o.forEach(f=>{if(d)return;const h=eN(u,f.find);if(!h)return;const m=l.state.tr,g=Yc({state:l.state,transaction:m}),y={from:r-(h[0].length-s.length),to:i},{commands:b,chain:w,can:k}=new Jc({editor:n,state:g});f.handler({state:g,range:y,match:h,commands:b,chain:w,can:k})===null||!m.steps.length||(m.setMeta(a,{transform:m,from:r,to:i,text:s}),l.dispatch(m),d=!0)}),d}function tN(t){const{editor:e,rules:n}=t,r=new Ze({state:{init(){return null},apply(i,s,o){const a=i.getMeta(r);if(a)return a;const l=i.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:d}=l;typeof d=="string"?d=d:d=Th(L.from(d),o.schema);const{from:u}=l,f=u+d.length;ja({editor:e,from:u,to:f,text:d,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,a){return ja({editor:e,from:s,to:o,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&ja({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?ja({editor:e,from:o.pos,to:o.pos,text:`
11
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function nN(t){return Object.prototype.toString.call(t).slice(8,-1)}function $a(t){return nN(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Zc(t,e){const n={...t};return $a(t)&&$a(e)&&Object.keys(e).forEach(r=>{$a(e[r])&&$a(t[r])?n[r]=Zc(t[r],e[r]):n[r]=e[r]}),n}class $n{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Ae(oe(this,"addOptions",{name:this.name}))),this.storage=Ae(oe(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new $n(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Zc(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new $n(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=Ae(oe(n,"addOptions",{name:n.name})),n.storage=Ae(oe(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(c=>c?.type.name===n.name))return!1;const l=o.find(c=>c?.type.name===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}function rN(t){return typeof t=="number"}class iN{constructor(e){this.find=e.find,this.handler=e.handler}}const sN=(t,e,n)=>{if(Ah(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=t,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function oN(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:o,dropEvent:a}=t,{commands:l,chain:c,can:d}=new Jc({editor:e,state:n}),u=[];return n.doc.nodesBetween(r,i,(h,m)=>{if(!h.isTextblock||h.type.spec.code)return;const g=Math.max(r,m),y=Math.min(i,m+h.content.size),b=h.textBetween(g-m,y-m,void 0,"");sN(b,s.find,o).forEach(k=>{if(k.index===void 0)return;const v=g+k.index+1,E=v+k[0].length,S={from:n.tr.mapping.map(v),to:n.tr.mapping.map(E)},C=s.handler({state:n,range:S,match:k,commands:l,chain:c,can:d,pasteEvent:o,dropEvent:a});u.push(C)})}),u.every(h=>h!==null)}let Fa=null;const aN=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function lN(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:d,from:u,to:f,rule:h,pasteEvt:m})=>{const g=d.tr,y=Yc({state:d,transaction:g});if(!(!oN({editor:e,state:y,from:Math.max(u-1,0),to:f.b-1,rule:h,pasteEvent:m,dropEvent:a})||!g.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return n.map(d=>new Ze({view(u){const f=m=>{var g;r=!((g=u.dom.parentElement)===null||g===void 0)&&g.contains(m.target)?u.dom.parentElement:null,r&&(Fa=e)},h=()=>{Fa&&(Fa=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(u,f)=>{if(s=r===u.dom.parentElement,a=f,!s){const h=Fa;h?.isEditable&&setTimeout(()=>{const m=h.state.selection;m&&h.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(u,f)=>{var h;const m=(h=f.clipboardData)===null||h===void 0?void 0:h.getData("text/html");return o=f,i=!!m?.includes("data-pm-slice"),!1}}},appendTransaction:(u,f,h)=>{const m=u[0],g=m.getMeta("uiEvent")==="paste"&&!i,y=m.getMeta("uiEvent")==="drop"&&!s,b=m.getMeta("applyPasteRules"),w=!!b;if(!g&&!y&&!w)return;if(w){let{text:E}=b;typeof E=="string"?E=E:E=Th(L.from(E),h.schema);const{from:S}=b,C=S+E.length,N=aN(E);return l({rule:d,state:h,from:S,to:{b:C},pasteEvt:N})}const k=f.doc.content.findDiffStart(h.doc.content),v=f.doc.content.findDiffEnd(h.doc.content);if(!(!rN(k)||!v||k===v.b))return l({rule:d,state:h,from:k,to:v,pasteEvt:o})}}))}function cN(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}class ms{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=ms.resolve(e),this.schema=Z_(this.extensions,n),this.setupExtensions()}static resolve(e){const n=ms.sort(ms.flatten(e)),r=cN(n.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{const r={name:n.name,options:n.options,storage:n.storage},i=oe(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((r,i)=>{const s=oe(r,"priority")||100,o=oe(i,"priority")||100;return s>o?-1:s<o?1:0})}get commands(){return this.extensions.reduce((e,n)=>{const r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:nu(n.name,this.schema)},i=oe(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,n=ms.sort([...this.extensions].reverse()),r=[],i=[],s=n.map(o=>{const a={name:o.name,options:o.options,storage:o.storage,editor:e,type:nu(o.name,this.schema)},l=[],c=oe(o,"addKeyboardShortcuts",a);let d={};if(o.type==="mark"&&oe(o,"exitable",a)&&(d.ArrowRight=()=>$n.handleExit({editor:e,mark:o})),c){const g=Object.fromEntries(Object.entries(c()).map(([y,b])=>[y,()=>b({editor:e})]));d={...d,...g}}const u=T_(d);l.push(u);const f=oe(o,"addInputRules",a);sg(o,e.options.enableInputRules)&&f&&r.push(...f());const h=oe(o,"addPasteRules",a);sg(o,e.options.enablePasteRules)&&h&&i.push(...h());const m=oe(o,"addProseMirrorPlugins",a);if(m){const g=m();l.push(...g)}return l}).flat();return[tN({editor:e,rules:r}),...lN({editor:e,rules:i}),...s]}get attributes(){return cv(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=Xc(this.extensions);return Object.fromEntries(n.filter(r=>!!oe(r,"addNodeView")).map(r=>{const i=this.attributes.filter(l=>l.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:e,type:_t(r.name,this.schema)},o=oe(r,"addNodeView",s);if(!o)return[];const a=(l,c,d,u,f)=>{const h=Kl(l,i);return o()({node:l,view:c,getPos:d,decorations:u,innerDecorations:f,editor:e,extension:r,HTMLAttributes:h})};return[r.name,a]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:nu(e.name,this.schema)};e.type==="mark"&&(!((n=Ae(oe(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const i=oe(e,"onBeforeCreate",r),s=oe(e,"onCreate",r),o=oe(e,"onUpdate",r),a=oe(e,"onSelectionUpdate",r),l=oe(e,"onTransaction",r),c=oe(e,"onFocus",r),d=oe(e,"onBlur",r),u=oe(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),d&&this.editor.on("blur",d),u&&this.editor.on("destroy",u)})}}class ot{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Ae(oe(this,"addOptions",{name:this.name}))),this.storage=Ae(oe(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new ot(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Zc(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new ot({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=Ae(oe(n,"addOptions",{name:n.name})),n.storage=Ae(oe(n,"addStorage",{name:n.name,options:n.options})),n}}function uv(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`
12
+
13
+ `,textSerializers:o={}}=n||{};let a="";return t.nodesBetween(r,i,(l,c,d,u)=>{var f;l.isBlock&&c>r&&(a+=s);const h=o?.[l.type.name];if(h)return d&&(a+=h({node:l,pos:c,parent:d,index:u,range:e})),!1;l.isText&&(a+=(f=l?.text)===null||f===void 0?void 0:f.slice(Math.max(r,c)-c,i-c))}),a}function fv(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const dN=ot.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ze({key:new Ge("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(d=>d.$from.pos)),a=Math.max(...s.map(d=>d.$to.pos)),l=fv(n);return uv(r,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),uN=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),fN=(t=!1)=>({commands:e})=>e.setContent("",t),hN=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:o})=>{t.doc.nodesBetween(s.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:d}=e,u=c.resolve(d.map(l)),f=c.resolve(d.map(l+a.nodeSize)),h=u.blockRange(f);if(!h)return;const m=Ws(h);if(a.type.isTextblock){const{defaultType:g}=u.parent.contentMatchAt(u.index());e.setNodeMarkup(h.start,g)}(m||m===0)&&e.lift(h,m)})}),!0},pN=t=>e=>t(e),mN=()=>({state:t,dispatch:e})=>sv(t,e),gN=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,s=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new ye(r.doc.resolve(Math.max(o-1,0)))),!0},yN=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const a=i.before(s),l=i.after(s);t.delete(a,l).scrollIntoView()}return!0}return!1},bN=t=>({tr:e,state:n,dispatch:r})=>{const i=_t(t,n.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const l=s.before(o),c=s.after(o);e.delete(l,c).scrollIntoView()}return!0}return!1},vN=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},xN=()=>({state:t,dispatch:e})=>kh(t,e),wN=()=>({commands:t})=>t.keyboardShortcut("Enter"),EN=()=>({state:t,dispatch:e})=>D_(t,e);function Wl(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:Ah(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function hv(t,e,n={}){return t.find(r=>r.type===e&&Wl(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function og(t,e,n={}){return!!hv(t,e,n)}function Mh(t,e,n){var r;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(d=>d.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(d=>d.type===e)||(n=n||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!hv([...i.node.marks],e,n)))return;let o=i.index,a=t.start()+i.offset,l=o+1,c=a+i.node.nodeSize;for(;o>0&&og([...t.parent.child(o-1).marks],e,n);)o-=1,a-=t.parent.child(o).nodeSize;for(;l<t.parent.childCount&&og([...t.parent.child(l).marks],e,n);)c+=t.parent.child(l).nodeSize,l+=1;return{from:a,to:c}}function hi(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}const kN=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const s=hi(t,r.schema),{doc:o,selection:a}=n,{$from:l,from:c,to:d}=a;if(i){const u=Mh(l,s,e);if(u&&u.from<=c&&u.to>=d){const f=ye.create(o,u.from,u.to);n.setSelection(f)}}return!0},SN=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function Qc(t){return t instanceof ye}function Er(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function pv(t,e=null){if(!e)return null;const n=Se.atStart(t),r=Se.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?ye.create(t,Er(0,i,s),Er(t.content.size,i,s)):ye.create(t,Er(e,i,s),Er(e,i,s))}function yf(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Uo(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function CN(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const _N=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(Uo()||yf())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),CN()&&!Uo()&&!yf()&&r.dom.focus({preventScroll:!0}))})};if(r.hasFocus()&&t===null||t===!1)return!0;if(s&&t===null&&!Qc(n.state.selection))return o(),!0;const a=pv(i.doc,t)||n.state.selection,l=n.state.selection.eq(a);return s&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},NN=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),TN=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),mv=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&mv(r)}return t};function Ha(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return mv(n)}function Vo(t,e,n){if(t instanceof ti||t instanceof L)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return L.fromArray(t.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),Vo("",e,n)}if(i){if(n.errorOnInvalidContent){let o=!1,a="";const l=new Yb({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?vo.fromSchema(l).parseSlice(Ha(t),n.parseOptions):vo.fromSchema(l).parse(Ha(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=vo.fromSchema(e);return n.slice?s.parseSlice(Ha(t),n.parseOptions).content:s.parse(Ha(t),n.parseOptions)}return Vo("",e,n)}function AN(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof pt||i instanceof St))return;const s=t.mapping.maps[r];let o=0;s.forEach((a,l,c,d)=>{o===0&&(o=d)}),t.setSelection(Se.near(t.doc.resolve(o),n))}const MN=t=>!("type"in t),ON=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{var o;if(i){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const l=y=>{s.emit("contentError",{editor:s,error:y,disableCollaboration:()=>{s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{Vo(e,s.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(y){l(y)}try{a=Vo(e,s.schema,{parseOptions:c,errorOnInvalidContent:(o=n.errorOnInvalidContent)!==null&&o!==void 0?o:s.options.enableContentCheck})}catch(y){return l(y),!1}let{from:d,to:u}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,h=!0;if((MN(a)?a:[a]).forEach(y=>{y.check(),f=f?y.isText&&y.marks.length===0:!1,h=h?y.isBlock:!1}),d===u&&h){const{parent:y}=r.doc.resolve(d);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(d-=1,u+=1)}let g;if(f){if(Array.isArray(e))g=e.map(y=>y.text||"").join("");else if(e instanceof L){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,d,u)}else g=a,r.replaceWith(d,u,g);n.updateSelection&&AN(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:g}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:g})}return!0},RN=()=>({state:t,dispatch:e})=>O_(t,e),IN=()=>({state:t,dispatch:e})=>R_(t,e),DN=()=>({state:t,dispatch:e})=>Z0(t,e),LN=()=>({state:t,dispatch:e})=>nv(t,e),PN=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Uc(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},BN=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Uc(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},jN=()=>({state:t,dispatch:e})=>A_(t,e),$N=()=>({state:t,dispatch:e})=>M_(t,e);function gv(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function FN(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))Uo()||gv()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}const HN=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=FN(t).split(/-(?!$)/),o=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,a))});return l?.steps.forEach(c=>{const d=c.map(r.mapping);d&&i&&r.maybeStep(d)}),!0};function Ko(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,o=e?_t(e,t.schema):null,a=[];t.doc.nodesBetween(r,i,(u,f)=>{if(u.isText)return;const h=Math.max(r,f),m=Math.min(i,f+u.nodeSize);a.push({node:u,from:h,to:m})});const l=i-r,c=a.filter(u=>o?o.name===u.node.type.name:!0).filter(u=>Wl(u.node.attrs,n,{strict:!1}));return s?!!c.length:c.reduce((u,f)=>u+f.to-f.from,0)>=l}const zN=(t,e={})=>({state:n,dispatch:r})=>{const i=_t(t,n.schema);return Ko(n,i,e)?I_(n,r):!1},UN=()=>({state:t,dispatch:e})=>ov(t,e),VN=t=>({state:e,dispatch:n})=>{const r=_t(t,e.schema);return K_(r)(e,n)},KN=()=>({state:t,dispatch:e})=>iv(t,e);function ed(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function ag(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}const WN=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=ed(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(s=_t(t,r.schema)),a==="mark"&&(o=hi(t,r.schema)),i&&n.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,d)=>{s&&s===c.type&&n.setNodeMarkup(d,void 0,ag(c.attrs,e)),o&&c.marks.length&&c.marks.forEach(u=>{o===u.type&&n.addMark(d,d+c.nodeSize,o.create(ag(u.attrs,e)))})})}),!0):!1},GN=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),qN=()=>({tr:t,dispatch:e})=>{if(e){const n=new gn(t.doc);t.setSelection(n)}return!0},YN=()=>({state:t,dispatch:e})=>ev(t,e),JN=()=>({state:t,dispatch:e})=>rv(t,e),XN=()=>({state:t,dispatch:e})=>B_(t,e),ZN=()=>({state:t,dispatch:e})=>F_(t,e),QN=()=>({state:t,dispatch:e})=>$_(t,e);function bf(t,e,n={},r={}){return Vo(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const eT=(t,e=!1,n={},r={})=>({editor:i,tr:s,dispatch:o,commands:a})=>{var l,c;const{doc:d}=s;if(n.preserveWhitespace!=="full"){const u=bf(t,i.schema,n,{errorOnInvalidContent:(l=r.errorOnInvalidContent)!==null&&l!==void 0?l:i.options.enableContentCheck});return o&&s.replaceWith(0,d.content.size,u).setMeta("preventUpdate",!e),!0}return o&&s.setMeta("preventUpdate",!e),a.insertContentAt({from:0,to:d.content.size},t,{parseOptions:n,errorOnInvalidContent:(c=r.errorOnInvalidContent)!==null&&c!==void 0?c:i.options.enableContentCheck})};function yv(t,e){const n=hi(e,t.schema),{from:r,to:i,empty:s}=t.selection,o=[];s?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function tT(t,e){const n=new u0(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function nT(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Ts(t,e){const n=[];return t.descendants((r,i)=>{e(r)&&n.push({node:r,pos:i})}),n}function rT(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function iT(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function xa(t){return e=>iT(e.$from,t)}function sT(t,e){const n={from:0,to:t.content.size};return uv(t,n,e)}function oT(t,e){const n=_t(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===n.name);return o?{...o.attrs}:{}}function bv(t,e){const n=ed(typeof e=="string"?e:e.name,t.schema);return n==="node"?oT(t,e):n==="mark"?yv(t,e):{}}function aT(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function lT(t){const e=aT(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,o)=>o!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function cT(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((a,l)=>{o.push({from:a,to:l})});else{const{from:a,to:l}=n[s];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const c=e.slice(s).map(a,-1),d=e.slice(s).map(l),u=e.invert().map(c,-1),f=e.invert().map(d);r.push({oldRange:{from:u,to:f},newRange:{from:c,to:d}})})}),lT(r)}function Oh(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t),o=Mh(s,i.type);o&&r.push({mark:i,...o})}):n.nodesBetween(t,e,(i,s)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}function xl(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}function vf(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?hi(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(u=>s?s.name===u.type.name:!0).find(u=>Wl(u.attrs,n,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:u,$to:f})=>{const h=u.pos,m=f.pos;t.doc.nodesBetween(h,m,(g,y)=>{if(!g.isText&&!g.marks.length)return;const b=Math.max(h,y),w=Math.min(m,y+g.nodeSize),k=w-b;o+=k,a.push(...g.marks.map(v=>({mark:v,from:b,to:w})))})}),o===0)return!1;const l=a.filter(u=>s?s.name===u.mark.type.name:!0).filter(u=>Wl(u.mark.attrs,n,{strict:!1})).reduce((u,f)=>u+f.to-f.from,0),c=a.filter(u=>s?u.mark.type!==s&&u.mark.type.excludes(s):!0).reduce((u,f)=>u+f.to-f.from,0);return(l>0?l+c:l)>=o}function dT(t,e,n={}){if(!e)return Ko(t,null,n)||vf(t,null,n);const r=ed(e,t.schema);return r==="node"?Ko(t,e,n):r==="mark"?vf(t,e,n):!1}function lg(t,e){const{nodeExtensions:n}=Xc(e),r=n.find(o=>o.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=Ae(oe(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function td(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!==null&&r!==void 0?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(s=>{i!==!1&&(td(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function vv(t){return t instanceof he}function uT(t,e,n){const i=t.state.doc.content.size,s=Er(e,0,i),o=Er(n,0,i),a=t.coordsAtPos(s),l=t.coordsAtPos(o,-1),c=Math.min(a.top,l.top),d=Math.max(a.bottom,l.bottom),u=Math.min(a.left,l.left),f=Math.max(a.right,l.right),h=f-u,m=d-c,b={top:c,bottom:d,left:u,right:f,width:h,height:m,x:u,y:c};return{...b,toJSON:()=>b}}function fT(t,e,n){var r;const{selection:i}=e;let s=null;if(Qc(i)&&(s=i.$cursor),s){const a=(r=t.storedMarks)!==null&&r!==void 0?r:s.marks();return!!n.isInSet(a)||!a.some(l=>l.type.excludes(n))}const{ranges:o}=i;return o.some(({$from:a,$to:l})=>{let c=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(d,u,f)=>{if(c)return!1;if(d.isInline){const h=!f||f.type.allowsMarkType(n),m=!!n.isInSet(d.marks)||!d.marks.some(g=>g.type.excludes(n));c=h&&m}return!c}),c})}const hT=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:o,ranges:a}=s,l=hi(t,r.schema);if(i)if(o){const c=yv(r,l);n.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const d=c.$from.pos,u=c.$to.pos;r.doc.nodesBetween(d,u,(f,h)=>{const m=Math.max(h,d),g=Math.min(h+f.nodeSize,u);f.marks.find(b=>b.type===l)?f.marks.forEach(b=>{l===b.type&&n.addMark(m,g,l.create({...b.attrs,...e}))}):n.addMark(m,g,l.create(e))})});return fT(r,n,l)},pT=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),mT=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=_t(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:a})=>ng(s,{...o,...e})(n)?!0:a.clearNodes()).command(({state:a})=>ng(s,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},gT=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=Er(t,0,r.content.size),s=he.create(r,i);e.setSelection(s)}return!0},yT=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,o=ye.atStart(r).from,a=ye.atEnd(r).to,l=Er(i,o,a),c=Er(s,o,a),d=ye.create(r,l,c);e.setSelection(d)}return!0},bT=t=>({state:e,dispatch:n})=>{const r=_t(t,e.schema);return q_(r)(e,n)};function cg(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}const vT=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:l}=s,c=i.extensionManager.attributes,d=xl(c,a.node().type.name,a.node().attrs);if(s instanceof he&&s.node.isBlock)return!a.parentOffset||!Sr(o,a.pos)?!1:(r&&(t&&cg(n,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const u=l.parentOffset===l.parent.content.size,f=a.depth===0?void 0:nT(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=u&&f?[{type:f,attrs:d}]:void 0,m=Sr(e.doc,e.mapping.map(a.pos),1,h);if(!h&&!m&&Sr(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(m=!0,h=f?[{type:f,attrs:d}]:void 0),r){if(m&&(s instanceof ye&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,h),f&&!u&&!a.parentOffset&&a.parent.type!==f)){const g=e.mapping.map(a.before()),y=e.doc.resolve(g);a.node(-1).canReplaceWith(y.index(),y.index()+1,f)&&e.setNodeMarkup(e.mapping.map(a.before()),f)}t&&cg(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return m},xT=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var o;const a=_t(t,r.schema),{$from:l,$to:c}=r.selection,d=r.selection.node;if(d&&d.isBlock||l.depth<2||!l.sameParent(c))return!1;const u=l.node(-1);if(u.type!==a)return!1;const f=s.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let b=L.empty;const w=l.index(-1)?1:l.index(-2)?2:3;for(let N=l.depth-w;N>=l.depth-3;N-=1)b=L.from(l.node(N).copy(b));const k=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,v={...xl(f,l.node().type.name,l.node().attrs),...e},E=((o=a.contentMatch.defaultType)===null||o===void 0?void 0:o.createAndFill(v))||void 0;b=b.append(L.from(a.createAndFill(null,E)||void 0));const S=l.before(l.depth-(w-1));n.replace(S,l.after(-k),new Z(b,4-w,0));let C=-1;n.doc.nodesBetween(S,n.doc.content.size,(N,M)=>{if(C>-1)return!1;N.isTextblock&&N.content.size===0&&(C=M+1)}),C>-1&&n.setSelection(ye.near(n.doc.resolve(C))),n.scrollIntoView()}return!0}const h=c.pos===l.end()?u.contentMatchAt(0).defaultType:null,m={...xl(f,u.type.name,u.attrs),...e},g={...xl(f,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,c.pos);const y=h?[{type:a,attrs:m},{type:h,attrs:g}]:[{type:a,attrs:m}];if(!Sr(n.doc,l.pos,2))return!1;if(i){const{selection:b,storedMarks:w}=r,{splittableMarks:k}=s.extensionManager,v=w||b.$to.parentOffset&&b.$from.marks();if(n.split(l.pos,2,y).scrollIntoView(),!v||!i)return!0;const E=v.filter(S=>k.includes(S.type.name));n.ensureMarks(E)}return!0},ru=(t,e)=>{const n=xa(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&ui(t.doc,n.pos)&&t.join(n.pos),!0},iu=(t,e)=>{const n=xa(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&ui(t.doc,r)&&t.join(r),!0},wT=(t,e,n,r={})=>({editor:i,tr:s,state:o,dispatch:a,chain:l,commands:c,can:d})=>{const{extensions:u,splittableMarks:f}=i.extensionManager,h=_t(t,o.schema),m=_t(e,o.schema),{selection:g,storedMarks:y}=o,{$from:b,$to:w}=g,k=b.blockRange(w),v=y||g.$to.parentOffset&&g.$from.marks();if(!k)return!1;const E=xa(S=>lg(S.type.name,u))(g);if(k.depth>=1&&E&&k.depth-E.depth<=1){if(E.node.type===h)return c.liftListItem(m);if(lg(E.node.type.name,u)&&h.validContent(E.node.content)&&a)return l().command(()=>(s.setNodeMarkup(E.pos,h),!0)).command(()=>ru(s,h)).command(()=>iu(s,h)).run()}return!n||!v||!a?l().command(()=>d().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>ru(s,h)).command(()=>iu(s,h)).run():l().command(()=>{const S=d().wrapInList(h,r),C=v.filter(N=>f.includes(N.type.name));return s.ensureMarks(C),S?!0:c.clearNodes()}).wrapInList(h,r).command(()=>ru(s,h)).command(()=>iu(s,h)).run()},ET=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,o=hi(t,r.schema);return vf(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},kT=(t,e,n={})=>({state:r,commands:i})=>{const s=_t(t,r.schema),o=_t(e,r.schema),a=Ko(r,s,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?i.setNode(o,l):i.setNode(s,{...l,...n})},ST=(t,e={})=>({state:n,commands:r})=>{const i=_t(t,n.schema);return Ko(n,i,e)?r.lift(i):r.wrapIn(i,e)},CT=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){const o=t.tr,a=s.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(s.text){const l=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,t.schema.text(s.text,l))}else o.delete(s.from,s.to)}return!0}}return!1},_T=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(s=>{t.removeMark(s.$from.pos,s.$to.pos)}),!0},NT=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=n,l=hi(t,r.schema),{$from:c,empty:d,ranges:u}=a;if(!i)return!0;if(d&&o){let{from:f,to:h}=a;const m=(s=c.marks().find(y=>y.type===l))===null||s===void 0?void 0:s.attrs,g=Mh(c,l,m);g&&(f=g.from,h=g.to),n.removeMark(f,h,l)}else u.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,l)});return n.removeStoredMark(l),!0},TT=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=ed(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(s=_t(t,r.schema)),a==="mark"&&(o=hi(t,r.schema)),i&&n.selection.ranges.forEach(l=>{const c=l.$from.pos,d=l.$to.pos;let u,f,h,m;n.selection.empty?r.doc.nodesBetween(c,d,(g,y)=>{s&&s===g.type&&(h=Math.max(y,c),m=Math.min(y+g.nodeSize,d),u=y,f=g)}):r.doc.nodesBetween(c,d,(g,y)=>{y<c&&s&&s===g.type&&(h=Math.max(y,c),m=Math.min(y+g.nodeSize,d),u=y,f=g),y>=c&&y<=d&&(s&&s===g.type&&n.setNodeMarkup(y,void 0,{...g.attrs,...e}),o&&g.marks.length&&g.marks.forEach(b=>{if(o===b.type){const w=Math.max(y,c),k=Math.min(y+g.nodeSize,d);n.addMark(w,k,o.create({...b.attrs,...e}))}}))}),f&&(u!==void 0&&n.setNodeMarkup(u,void 0,{...f.attrs,...e}),o&&f.marks.length&&f.marks.forEach(g=>{o===g.type&&n.addMark(h,m,o.create({...g.attrs,...e}))}))}),!0):!1},AT=(t,e={})=>({state:n,dispatch:r})=>{const i=_t(t,n.schema);return H_(i,e)(n,r)},MT=(t,e={})=>({state:n,dispatch:r})=>{const i=_t(t,n.schema);return z_(i,e)(n,r)};var OT=Object.freeze({__proto__:null,blur:uN,clearContent:fN,clearNodes:hN,command:pN,createParagraphNear:mN,cut:gN,deleteCurrentNode:yN,deleteNode:bN,deleteRange:vN,deleteSelection:xN,enter:wN,exitCode:EN,extendMarkRange:kN,first:SN,focus:_N,forEach:NN,insertContent:TN,insertContentAt:ON,joinBackward:DN,joinDown:IN,joinForward:LN,joinItemBackward:PN,joinItemForward:BN,joinTextblockBackward:jN,joinTextblockForward:$N,joinUp:RN,keyboardShortcut:HN,lift:zN,liftEmptyBlock:UN,liftListItem:VN,newlineInCode:KN,resetAttributes:WN,scrollIntoView:GN,selectAll:qN,selectNodeBackward:YN,selectNodeForward:JN,selectParentNode:XN,selectTextblockEnd:ZN,selectTextblockStart:QN,setContent:eT,setMark:hT,setMeta:pT,setNode:mT,setNodeSelection:gT,setTextSelection:yT,sinkListItem:bT,splitBlock:vT,splitListItem:xT,toggleList:wT,toggleMark:ET,toggleNode:kT,toggleWrap:ST,undoInputRule:CT,unsetAllMarks:_T,unsetMark:NT,updateAttributes:TT,wrapIn:AT,wrapInList:MT});const RT=ot.create({name:"commands",addCommands(){return{...OT}}}),IT=ot.create({name:"drop",addProseMirrorPlugins(){return[new Ze({key:new Ge("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),DT=ot.create({name:"editable",addProseMirrorPlugins(){return[new Ze({key:new Ge("editable"),props:{editable:()=>this.editor.options.editable}})]}}),LT=new Ge("focusEvents"),PT=ot.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ze({key:LT,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),BT=ot.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:d,$anchor:u}=l,{pos:f,parent:h}=u,m=u.parent.isTextblock&&f>0?a.doc.resolve(f-1):u,g=m.parent.type.spec.isolating,y=u.pos-u.parentOffset,b=g&&m.parent.childCount===1?y===u.pos:Se.atStart(c).from===f;return!d||!h.type.isTextblock||h.textContent.length||!b||b&&u.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Uo()||gv()?s:i},addProseMirrorPlugins(){return[new Ze({key:new Ge("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(g=>g.getMeta("composition")))return;const r=t.some(g=>g.docChanged)&&!e.doc.eq(n.doc),i=t.some(g=>g.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:a}=e.selection,l=Se.atStart(e.doc).from,c=Se.atEnd(e.doc).to;if(s||!(o===l&&a===c)||!td(n.doc))return;const f=n.tr,h=Yc({state:n,transaction:f}),{commands:m}=new Jc({editor:this.editor,state:h});if(m.clearNodes(),!!f.steps.length)return f}})]}}),jT=ot.create({name:"paste",addProseMirrorPlugins(){return[new Ze({key:new Ge("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),$T=ot.create({name:"tabindex",addProseMirrorPlugins(){return[new Ze({key:new Ge("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class _i{get name(){return this.node.type.name}constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new _i(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new _i(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 _i(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,o=this.pos+r+(s?0:1);if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(o);if(!i&&a.depth<=this.depth)return;const l=new _i(a,this.editor,i,i?n:null);i&&(l.actualDepth=this.depth+1),e.push(new _i(a,this.editor,i,i?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const s=i.node.attrs,o=Object.keys(n);for(let a=0;a<o.length;a+=1){const l=o[a];if(s[l]!==n[l])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(n);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(l=>n[l]===o.node.attrs[l])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}}const FT=`.ProseMirror {
14
+ position: relative;
15
+ }
16
+
17
+ .ProseMirror {
18
+ word-wrap: break-word;
19
+ white-space: pre-wrap;
20
+ white-space: break-spaces;
21
+ -webkit-font-variant-ligatures: none;
22
+ font-variant-ligatures: none;
23
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
24
+ }
25
+
26
+ .ProseMirror [contenteditable="false"] {
27
+ white-space: normal;
28
+ }
29
+
30
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
31
+ white-space: pre-wrap;
32
+ }
33
+
34
+ .ProseMirror pre {
35
+ white-space: pre-wrap;
36
+ }
37
+
38
+ img.ProseMirror-separator {
39
+ display: inline !important;
40
+ border: none !important;
41
+ margin: 0 !important;
42
+ width: 0 !important;
43
+ height: 0 !important;
44
+ }
45
+
46
+ .ProseMirror-gapcursor {
47
+ display: none;
48
+ pointer-events: none;
49
+ position: absolute;
50
+ margin: 0;
51
+ }
52
+
53
+ .ProseMirror-gapcursor:after {
54
+ content: "";
55
+ display: block;
56
+ position: absolute;
57
+ top: -2px;
58
+ width: 20px;
59
+ border-top: 1px solid black;
60
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
61
+ }
62
+
63
+ @keyframes ProseMirror-cursor-blink {
64
+ to {
65
+ visibility: hidden;
66
+ }
67
+ }
68
+
69
+ .ProseMirror-hideselection *::selection {
70
+ background: transparent;
71
+ }
72
+
73
+ .ProseMirror-hideselection *::-moz-selection {
74
+ background: transparent;
75
+ }
76
+
77
+ .ProseMirror-hideselection * {
78
+ caret-color: transparent;
79
+ }
80
+
81
+ .ProseMirror-focused .ProseMirror-gapcursor {
82
+ display: block;
83
+ }
84
+
85
+ .tippy-box[data-animation=fade][data-state=hidden] {
86
+ opacity: 0
87
+ }`;function HT(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}class zT extends Y_{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),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,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>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("contentError",this.options.onContentError),this.createView(),this.injectCSS(),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:n,slice:r,moved:i})=>this.options.onDrop(n,r,i)),this.on("paste",({event:n,slice:r})=>this.options.onPaste(n,r)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}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&&document&&(this.css=HT(FT,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,n=!0){this.setOptions({editable:e}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,n){const r=dv(n)?n(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}unregisterPlugin(e){if(this.isDestroyed)return;const n=this.state.plugins;let r=n;if([].concat(e).forEach(s=>{const o=typeof s=="string"?`${s}$`:s.key;r=r.filter(a=>!a.key.startsWith(o))}),n.length===r.length)return;const i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}createExtensionManager(){var e,n;const i=[...this.options.enableCoreExtensions?[DT,dN.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),RT,PT,BT,$T,IT,jT].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(i,this)}createCommandManager(){this.commandManager=new Jc({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let n;try{n=bf(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(o){if(!(o instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(o.message))throw o;this.emit("contentError",{editor:this,error:o,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(a=>a.name!=="collaboration"),this.createExtensionManager()}}),n=bf(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const r=pv(n,this.options.autofocus);this.view=new Y0(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)===null||e===void 0?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:ps.create({doc:n,selection:r||void 0})});const i=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(i),this.createNodeViews(),this.prependClass();const s=this.view.dom;s.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(o=>{var a;return(a=this.capturedTransaction)===null||a===void 0?void 0:a.step(o)});return}const n=this.state.apply(e),r=!this.state.selection.eq(n.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:n}),this.view.updateState(n),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const i=e.getMeta("focus"),s=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),s&&this.emit("blur",{editor:this,event:s.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return bv(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,i=typeof e=="string"?n:e;return dT(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Th(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
88
+
89
+ `,textSerializers:r={}}=e||{};return sT(this.state.doc,{blockSeparator:n,textSerializers:{...fv(this.schema),...r}})}get isEmpty(){return td(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,n))||null}$nodes(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,n))||null}$pos(e){const n=this.state.doc.resolve(e);return new _i(n,this)}get $doc(){return this.$pos(0)}}function As(t){return new va({find:t.find,handler:({state:e,range:n,match:r})=>{const i=Ae(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],a=r[0];if(o){const l=a.search(/\S/),c=n.from+a.indexOf(o),d=c+o.length;if(Oh(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(g=>g===t.type&&g!==h.mark.type)).filter(h=>h.to>c).length)return null;d<n.to&&s.delete(d,n.to),c>n.from&&s.delete(n.from+l,c);const f=n.from+l+o.length;s.addMark(n.from+l,f,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}function xv(t){return new va({find:t.find,handler:({state:e,range:n,match:r})=>{const i=Ae(t.getAttributes,void 0,r)||{},{tr:s}=e,o=n.from;let a=n.to;const l=t.type.create(i);if(r[1]){const c=r[0].lastIndexOf(r[1]);let d=o+c;d>a?d=a:a=d+r[1].length;const u=r[0][r[0].length-1];s.insertText(u,o+r[0].length-1),s.replaceWith(d,a,l)}else if(r[0]){const c=t.type.isInline?o:o-1;s.insert(c,t.type.create(i)).delete(s.mapping.map(o),s.mapping.map(a))}s.scrollIntoView()}})}function xf(t){return new va({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=Ae(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,s)}})}function Wo(t){return new va({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=Ae(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),l=o.doc.resolve(n.from).blockRange(),c=l&&fh(l,t.type,s);if(!c)return null;if(o.wrap(l,c),t.keepMarks&&t.editor){const{selection:u,storedMarks:f}=e,{splittableMarks:h}=t.editor.extensionManager,m=f||u.$to.parentOffset&&u.$from.marks();if(m){const g=m.filter(y=>h.includes(y.type.name));o.ensureMarks(g)}}if(t.keepAttributes){const u=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(u,s).run()}const d=o.doc.resolve(n.from-1).nodeBefore;d&&d.type===t.type&&ui(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,d))&&o.join(n.from-1)}})}let dt=class wf{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Ae(oe(this,"addOptions",{name:this.name}))),this.storage=Ae(oe(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new wf(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Zc(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new wf(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=Ae(oe(n,"addOptions",{name:n.name})),n.storage=Ae(oe(n,"addStorage",{name:n.name,options:n.options})),n}};class UT{constructor(e,n,r){this.isDragging=!1,this.component=e,this.editor=n.editor,this.options={stopEvent:null,ignoreMutation:null,...r},this.extension=n.extension,this.node=n.node,this.decorations=n.decorations,this.innerDecorations=n.innerDecorations,this.view=n.view,this.HTMLAttributes=n.HTMLAttributes,this.getPos=n.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var n,r,i,s,o,a,l;const{view:c}=this.editor,d=e.target,u=d.nodeType===3?(n=d.parentElement)===null||n===void 0?void 0:n.closest("[data-drag-handle]"):d.closest("[data-drag-handle]");if(!this.dom||!((r=this.contentDOM)===null||r===void 0)&&r.contains(d)||!u)return;let f=0,h=0;if(this.dom!==u){const w=this.dom.getBoundingClientRect(),k=u.getBoundingClientRect(),v=(i=e.offsetX)!==null&&i!==void 0?i:(s=e.nativeEvent)===null||s===void 0?void 0:s.offsetX,E=(o=e.offsetY)!==null&&o!==void 0?o:(a=e.nativeEvent)===null||a===void 0?void 0:a.offsetY;f=k.x-w.x+v,h=k.y-w.y+E}const m=this.dom.cloneNode(!0);(l=e.dataTransfer)===null||l===void 0||l.setDragImage(m,f,h);const g=this.getPos();if(typeof g!="number")return;const y=he.create(c.state.doc,g),b=c.state.tr.setSelection(y);c.dispatch(b)}stopEvent(e){var n;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:e});const r=e.target;if(!(this.dom.contains(r)&&!(!((n=this.contentDOM)===null||n===void 0)&&n.contains(r))))return!1;const s=e.type.startsWith("drag"),o=e.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(r.tagName)||r.isContentEditable)&&!o&&!s)return!0;const{isEditable:l}=this.editor,{isDragging:c}=this,d=!!this.node.type.spec.draggable,u=he.isSelectable(this.node),f=e.type==="copy",h=e.type==="paste",m=e.type==="cut",g=e.type==="mousedown";if(!d&&u&&s&&e.target===this.dom&&e.preventDefault(),d&&s&&!c&&e.target===this.dom)return e.preventDefault(),!1;if(d&&l&&!c&&g){const y=r.closest("[data-drag-handle]");y&&(this.dom===y||this.dom.contains(y))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(c||o||f||h||m||g&&u)}ignoreMutation(e){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:e}):this.node.isLeaf||this.node.isAtom?!0:e.type==="selection"||this.dom.contains(e.target)&&e.type==="childList"&&(Uo()||yf())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(r=>r.isContentEditable)?!1:this.contentDOM===e.target&&e.type==="attributes"?!0:!this.contentDOM.contains(e.target)}updateAttributes(e){this.editor.commands.command(({tr:n})=>{const r=this.getPos();return typeof r!="number"?!1:(n.setNodeMarkup(r,void 0,{...this.node.attrs,...e}),!0)})}deleteNode(){const e=this.getPos();if(typeof e!="number")return;const n=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:n})}}function zi(t){return new iN({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=Ae(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,a=r[r.length-1],l=r[0];let c=n.to;if(a){const d=l.search(/\S/),u=n.from+l.indexOf(a),f=u+a.length;if(Oh(n.from,n.to,e.doc).filter(m=>m.mark.type.excluded.find(y=>y===t.type&&y!==m.mark.type)).filter(m=>m.to>u).length)return null;f<n.to&&o.delete(f,n.to),u>n.from&&o.delete(n.from+d,u),c=n.from+d+a.length,o.addMark(n.from+d,c,t.type.create(s||{})),o.removeStoredMark(t.type)}}})}function VT(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof he){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let i=r.depth;for(;i>=0;){const s=r.index(i);if(r.node(i).contentMatchAt(s).matchType(e))return!0;i-=1}return!1}function KT(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var ln="top",An="bottom",Mn="right",cn="left",Rh="auto",wa=[ln,An,Mn,cn],Ms="start",Go="end",WT="clippingParents",wv="viewport",lo="popper",GT="reference",dg=wa.reduce(function(t,e){return t.concat([e+"-"+Ms,e+"-"+Go])},[]),Ev=[].concat(wa,[Rh]).reduce(function(t,e){return t.concat([e,e+"-"+Ms,e+"-"+Go])},[]),qT="beforeRead",YT="read",JT="afterRead",XT="beforeMain",ZT="main",QT="afterMain",eA="beforeWrite",tA="write",nA="afterWrite",rA=[qT,YT,JT,XT,ZT,QT,eA,tA,nA];function ar(t){return t?(t.nodeName||"").toLowerCase():null}function bn(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Ui(t){var e=bn(t).Element;return t instanceof e||t instanceof Element}function Tn(t){var e=bn(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function Ih(t){if(typeof ShadowRoot>"u")return!1;var e=bn(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function iA(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},i=e.attributes[n]||{},s=e.elements[n];!Tn(s)||!ar(s)||(Object.assign(s.style,r),Object.keys(i).forEach(function(o){var a=i[o];a===!1?s.removeAttribute(o):s.setAttribute(o,a===!0?"":a)}))})}function sA(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(r){var i=e.elements[r],s=e.attributes[r]||{},o=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),a=o.reduce(function(l,c){return l[c]="",l},{});!Tn(i)||!ar(i)||(Object.assign(i.style,a),Object.keys(s).forEach(function(l){i.removeAttribute(l)}))})}}const kv={name:"applyStyles",enabled:!0,phase:"write",fn:iA,effect:sA,requires:["computeStyles"]};function nr(t){return t.split("-")[0]}var Di=Math.max,Gl=Math.min,Os=Math.round;function Ef(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function Sv(){return!/^((?!chrome|android).)*safari/i.test(Ef())}function Rs(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),i=1,s=1;e&&Tn(t)&&(i=t.offsetWidth>0&&Os(r.width)/t.offsetWidth||1,s=t.offsetHeight>0&&Os(r.height)/t.offsetHeight||1);var o=Ui(t)?bn(t):window,a=o.visualViewport,l=!Sv()&&n,c=(r.left+(l&&a?a.offsetLeft:0))/i,d=(r.top+(l&&a?a.offsetTop:0))/s,u=r.width/i,f=r.height/s;return{width:u,height:f,top:d,right:c+u,bottom:d+f,left:c,x:c,y:d}}function Dh(t){var e=Rs(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function Cv(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&Ih(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function _r(t){return bn(t).getComputedStyle(t)}function oA(t){return["table","td","th"].indexOf(ar(t))>=0}function pi(t){return((Ui(t)?t.ownerDocument:t.document)||window.document).documentElement}function nd(t){return ar(t)==="html"?t:t.assignedSlot||t.parentNode||(Ih(t)?t.host:null)||pi(t)}function ug(t){return!Tn(t)||_r(t).position==="fixed"?null:t.offsetParent}function aA(t){var e=/firefox/i.test(Ef()),n=/Trident/i.test(Ef());if(n&&Tn(t)){var r=_r(t);if(r.position==="fixed")return null}var i=nd(t);for(Ih(i)&&(i=i.host);Tn(i)&&["html","body"].indexOf(ar(i))<0;){var s=_r(i);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return i;i=i.parentNode}return null}function Ea(t){for(var e=bn(t),n=ug(t);n&&oA(n)&&_r(n).position==="static";)n=ug(n);return n&&(ar(n)==="html"||ar(n)==="body"&&_r(n).position==="static")?e:n||aA(t)||e}function Lh(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function ko(t,e,n){return Di(t,Gl(e,n))}function lA(t,e,n){var r=ko(t,e,n);return r>n?n:r}function _v(){return{top:0,right:0,bottom:0,left:0}}function Nv(t){return Object.assign({},_v(),t)}function Tv(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var cA=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,Nv(typeof e!="number"?e:Tv(e,wa))};function dA(t){var e,n=t.state,r=t.name,i=t.options,s=n.elements.arrow,o=n.modifiersData.popperOffsets,a=nr(n.placement),l=Lh(a),c=[cn,Mn].indexOf(a)>=0,d=c?"height":"width";if(!(!s||!o)){var u=cA(i.padding,n),f=Dh(s),h=l==="y"?ln:cn,m=l==="y"?An:Mn,g=n.rects.reference[d]+n.rects.reference[l]-o[l]-n.rects.popper[d],y=o[l]-n.rects.reference[l],b=Ea(s),w=b?l==="y"?b.clientHeight||0:b.clientWidth||0:0,k=g/2-y/2,v=u[h],E=w-f[d]-u[m],S=w/2-f[d]/2+k,C=ko(v,S,E),N=l;n.modifiersData[r]=(e={},e[N]=C,e.centerOffset=C-S,e)}}function uA(t){var e=t.state,n=t.options,r=n.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=e.elements.popper.querySelector(i),!i)||Cv(e.elements.popper,i)&&(e.elements.arrow=i))}const fA={name:"arrow",enabled:!0,phase:"main",fn:dA,effect:uA,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Is(t){return t.split("-")[1]}var hA={top:"auto",right:"auto",bottom:"auto",left:"auto"};function pA(t,e){var n=t.x,r=t.y,i=e.devicePixelRatio||1;return{x:Os(n*i)/i||0,y:Os(r*i)/i||0}}function fg(t){var e,n=t.popper,r=t.popperRect,i=t.placement,s=t.variation,o=t.offsets,a=t.position,l=t.gpuAcceleration,c=t.adaptive,d=t.roundOffsets,u=t.isFixed,f=o.x,h=f===void 0?0:f,m=o.y,g=m===void 0?0:m,y=typeof d=="function"?d({x:h,y:g}):{x:h,y:g};h=y.x,g=y.y;var b=o.hasOwnProperty("x"),w=o.hasOwnProperty("y"),k=cn,v=ln,E=window;if(c){var S=Ea(n),C="clientHeight",N="clientWidth";if(S===bn(n)&&(S=pi(n),_r(S).position!=="static"&&a==="absolute"&&(C="scrollHeight",N="scrollWidth")),S=S,i===ln||(i===cn||i===Mn)&&s===Go){v=An;var M=u&&S===E&&E.visualViewport?E.visualViewport.height:S[C];g-=M-r.height,g*=l?1:-1}if(i===cn||(i===ln||i===An)&&s===Go){k=Mn;var D=u&&S===E&&E.visualViewport?E.visualViewport.width:S[N];h-=D-r.width,h*=l?1:-1}}var j=Object.assign({position:a},c&&hA),B=d===!0?pA({x:h,y:g},bn(n)):{x:h,y:g};if(h=B.x,g=B.y,l){var F;return Object.assign({},j,(F={},F[v]=w?"0":"",F[k]=b?"0":"",F.transform=(E.devicePixelRatio||1)<=1?"translate("+h+"px, "+g+"px)":"translate3d("+h+"px, "+g+"px, 0)",F))}return Object.assign({},j,(e={},e[v]=w?g+"px":"",e[k]=b?h+"px":"",e.transform="",e))}function mA(t){var e=t.state,n=t.options,r=n.gpuAcceleration,i=r===void 0?!0:r,s=n.adaptive,o=s===void 0?!0:s,a=n.roundOffsets,l=a===void 0?!0:a,c={placement:nr(e.placement),variation:Is(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,fg(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,fg(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const gA={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:mA,data:{}};var za={passive:!0};function yA(t){var e=t.state,n=t.instance,r=t.options,i=r.scroll,s=i===void 0?!0:i,o=r.resize,a=o===void 0?!0:o,l=bn(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&c.forEach(function(d){d.addEventListener("scroll",n.update,za)}),a&&l.addEventListener("resize",n.update,za),function(){s&&c.forEach(function(d){d.removeEventListener("scroll",n.update,za)}),a&&l.removeEventListener("resize",n.update,za)}}const bA={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:yA,data:{}};var vA={left:"right",right:"left",bottom:"top",top:"bottom"};function wl(t){return t.replace(/left|right|bottom|top/g,function(e){return vA[e]})}var xA={start:"end",end:"start"};function hg(t){return t.replace(/start|end/g,function(e){return xA[e]})}function Ph(t){var e=bn(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Bh(t){return Rs(pi(t)).left+Ph(t).scrollLeft}function wA(t,e){var n=bn(t),r=pi(t),i=n.visualViewport,s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;var c=Sv();(c||!c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a+Bh(t),y:l}}function EA(t){var e,n=pi(t),r=Ph(t),i=(e=t.ownerDocument)==null?void 0:e.body,s=Di(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),o=Di(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-r.scrollLeft+Bh(t),l=-r.scrollTop;return _r(i||n).direction==="rtl"&&(a+=Di(n.clientWidth,i?i.clientWidth:0)-s),{width:s,height:o,x:a,y:l}}function jh(t){var e=_r(t),n=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function Av(t){return["html","body","#document"].indexOf(ar(t))>=0?t.ownerDocument.body:Tn(t)&&jh(t)?t:Av(nd(t))}function So(t,e){var n;e===void 0&&(e=[]);var r=Av(t),i=r===((n=t.ownerDocument)==null?void 0:n.body),s=bn(r),o=i?[s].concat(s.visualViewport||[],jh(r)?r:[]):r,a=e.concat(o);return i?a:a.concat(So(nd(o)))}function kf(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function kA(t,e){var n=Rs(t,!1,e==="fixed");return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function pg(t,e,n){return e===wv?kf(wA(t,n)):Ui(e)?kA(e,n):kf(EA(pi(t)))}function SA(t){var e=So(nd(t)),n=["absolute","fixed"].indexOf(_r(t).position)>=0,r=n&&Tn(t)?Ea(t):t;return Ui(r)?e.filter(function(i){return Ui(i)&&Cv(i,r)&&ar(i)!=="body"}):[]}function CA(t,e,n,r){var i=e==="clippingParents"?SA(t):[].concat(e),s=[].concat(i,[n]),o=s[0],a=s.reduce(function(l,c){var d=pg(t,c,r);return l.top=Di(d.top,l.top),l.right=Gl(d.right,l.right),l.bottom=Gl(d.bottom,l.bottom),l.left=Di(d.left,l.left),l},pg(t,o,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Mv(t){var e=t.reference,n=t.element,r=t.placement,i=r?nr(r):null,s=r?Is(r):null,o=e.x+e.width/2-n.width/2,a=e.y+e.height/2-n.height/2,l;switch(i){case ln:l={x:o,y:e.y-n.height};break;case An:l={x:o,y:e.y+e.height};break;case Mn:l={x:e.x+e.width,y:a};break;case cn:l={x:e.x-n.width,y:a};break;default:l={x:e.x,y:e.y}}var c=i?Lh(i):null;if(c!=null){var d=c==="y"?"height":"width";switch(s){case Ms:l[c]=l[c]-(e[d]/2-n[d]/2);break;case Go:l[c]=l[c]+(e[d]/2-n[d]/2);break}}return l}function qo(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=r===void 0?t.placement:r,s=n.strategy,o=s===void 0?t.strategy:s,a=n.boundary,l=a===void 0?WT:a,c=n.rootBoundary,d=c===void 0?wv:c,u=n.elementContext,f=u===void 0?lo:u,h=n.altBoundary,m=h===void 0?!1:h,g=n.padding,y=g===void 0?0:g,b=Nv(typeof y!="number"?y:Tv(y,wa)),w=f===lo?GT:lo,k=t.rects.popper,v=t.elements[m?w:f],E=CA(Ui(v)?v:v.contextElement||pi(t.elements.popper),l,d,o),S=Rs(t.elements.reference),C=Mv({reference:S,element:k,placement:i}),N=kf(Object.assign({},k,C)),M=f===lo?N:S,D={top:E.top-M.top+b.top,bottom:M.bottom-E.bottom+b.bottom,left:E.left-M.left+b.left,right:M.right-E.right+b.right},j=t.modifiersData.offset;if(f===lo&&j){var B=j[i];Object.keys(D).forEach(function(F){var G=[Mn,An].indexOf(F)>=0?1:-1,q=[ln,An].indexOf(F)>=0?"y":"x";D[F]+=B[q]*G})}return D}function _A(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=n.boundary,s=n.rootBoundary,o=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,c=l===void 0?Ev:l,d=Is(r),u=d?a?dg:dg.filter(function(m){return Is(m)===d}):wa,f=u.filter(function(m){return c.indexOf(m)>=0});f.length===0&&(f=u);var h=f.reduce(function(m,g){return m[g]=qo(t,{placement:g,boundary:i,rootBoundary:s,padding:o})[nr(g)],m},{});return Object.keys(h).sort(function(m,g){return h[m]-h[g]})}function NA(t){if(nr(t)===Rh)return[];var e=wl(t);return[hg(t),e,hg(e)]}function TA(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var i=n.mainAxis,s=i===void 0?!0:i,o=n.altAxis,a=o===void 0?!0:o,l=n.fallbackPlacements,c=n.padding,d=n.boundary,u=n.rootBoundary,f=n.altBoundary,h=n.flipVariations,m=h===void 0?!0:h,g=n.allowedAutoPlacements,y=e.options.placement,b=nr(y),w=b===y,k=l||(w||!m?[wl(y)]:NA(y)),v=[y].concat(k).reduce(function(X,ne){return X.concat(nr(ne)===Rh?_A(e,{placement:ne,boundary:d,rootBoundary:u,padding:c,flipVariations:m,allowedAutoPlacements:g}):ne)},[]),E=e.rects.reference,S=e.rects.popper,C=new Map,N=!0,M=v[0],D=0;D<v.length;D++){var j=v[D],B=nr(j),F=Is(j)===Ms,G=[ln,An].indexOf(B)>=0,q=G?"width":"height",W=qo(e,{placement:j,boundary:d,rootBoundary:u,altBoundary:f,padding:c}),A=G?F?Mn:cn:F?An:ln;E[q]>S[q]&&(A=wl(A));var T=wl(A),P=[];if(s&&P.push(W[B]<=0),a&&P.push(W[A]<=0,W[T]<=0),P.every(function(X){return X})){M=j,N=!1;break}C.set(j,P)}if(N)for(var Y=m?3:1,te=function(ne){var Ee=v.find(function(be){var Be=C.get(be);if(Be)return Be.slice(0,ne).every(function(Ie){return Ie})});if(Ee)return M=Ee,"break"},pe=Y;pe>0;pe--){var Q=te(pe);if(Q==="break")break}e.placement!==M&&(e.modifiersData[r]._skip=!0,e.placement=M,e.reset=!0)}}const AA={name:"flip",enabled:!0,phase:"main",fn:TA,requiresIfExists:["offset"],data:{_skip:!1}};function mg(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function gg(t){return[ln,Mn,An,cn].some(function(e){return t[e]>=0})}function MA(t){var e=t.state,n=t.name,r=e.rects.reference,i=e.rects.popper,s=e.modifiersData.preventOverflow,o=qo(e,{elementContext:"reference"}),a=qo(e,{altBoundary:!0}),l=mg(o,r),c=mg(a,i,s),d=gg(l),u=gg(c);e.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:d,hasPopperEscaped:u},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":u})}const OA={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:MA};function RA(t,e,n){var r=nr(t),i=[cn,ln].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,o=s[0],a=s[1];return o=o||0,a=(a||0)*i,[cn,Mn].indexOf(r)>=0?{x:a,y:o}:{x:o,y:a}}function IA(t){var e=t.state,n=t.options,r=t.name,i=n.offset,s=i===void 0?[0,0]:i,o=Ev.reduce(function(d,u){return d[u]=RA(u,e.rects,s),d},{}),a=o[e.placement],l=a.x,c=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[r]=o}const DA={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:IA};function LA(t){var e=t.state,n=t.name;e.modifiersData[n]=Mv({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})}const PA={name:"popperOffsets",enabled:!0,phase:"read",fn:LA,data:{}};function BA(t){return t==="x"?"y":"x"}function jA(t){var e=t.state,n=t.options,r=t.name,i=n.mainAxis,s=i===void 0?!0:i,o=n.altAxis,a=o===void 0?!1:o,l=n.boundary,c=n.rootBoundary,d=n.altBoundary,u=n.padding,f=n.tether,h=f===void 0?!0:f,m=n.tetherOffset,g=m===void 0?0:m,y=qo(e,{boundary:l,rootBoundary:c,padding:u,altBoundary:d}),b=nr(e.placement),w=Is(e.placement),k=!w,v=Lh(b),E=BA(v),S=e.modifiersData.popperOffsets,C=e.rects.reference,N=e.rects.popper,M=typeof g=="function"?g(Object.assign({},e.rects,{placement:e.placement})):g,D=typeof M=="number"?{mainAxis:M,altAxis:M}:Object.assign({mainAxis:0,altAxis:0},M),j=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,B={x:0,y:0};if(S){if(s){var F,G=v==="y"?ln:cn,q=v==="y"?An:Mn,W=v==="y"?"height":"width",A=S[v],T=A+y[G],P=A-y[q],Y=h?-N[W]/2:0,te=w===Ms?C[W]:N[W],pe=w===Ms?-N[W]:-C[W],Q=e.elements.arrow,X=h&&Q?Dh(Q):{width:0,height:0},ne=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:_v(),Ee=ne[G],be=ne[q],Be=ko(0,C[W],X[W]),Ie=k?C[W]/2-Y-Be-Ee-D.mainAxis:te-Be-Ee-D.mainAxis,Le=k?-C[W]/2+Y+Be+be+D.mainAxis:pe+Be+be+D.mainAxis,ze=e.elements.arrow&&Ea(e.elements.arrow),Pe=ze?v==="y"?ze.clientTop||0:ze.clientLeft||0:0,je=(F=j?.[v])!=null?F:0,ut=A+Ie-je-Pe,bt=A+Le-je,ge=ko(h?Gl(T,ut):T,A,h?Di(P,bt):P);S[v]=ge,B[v]=ge-A}if(a){var at,st=v==="x"?ln:cn,de=v==="x"?An:Mn,At=S[E],Fe=E==="y"?"height":"width",Me=At+y[st],Mt=At-y[de],qe=[ln,cn].indexOf(b)!==-1,en=(at=j?.[E])!=null?at:0,Ot=qe?Me:At-C[Fe]-N[Fe]-en+D.altAxis,U=qe?At+C[Fe]+N[Fe]-en-D.altAxis:Mt,I=h&&qe?lA(Ot,At,U):ko(h?Ot:Me,At,h?U:Mt);S[E]=I,B[E]=I-At}e.modifiersData[r]=B}}const $A={name:"preventOverflow",enabled:!0,phase:"main",fn:jA,requiresIfExists:["offset"]};function FA(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function HA(t){return t===bn(t)||!Tn(t)?Ph(t):FA(t)}function zA(t){var e=t.getBoundingClientRect(),n=Os(e.width)/t.offsetWidth||1,r=Os(e.height)/t.offsetHeight||1;return n!==1||r!==1}function UA(t,e,n){n===void 0&&(n=!1);var r=Tn(e),i=Tn(e)&&zA(e),s=pi(e),o=Rs(t,i,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((ar(e)!=="body"||jh(s))&&(a=HA(e)),Tn(e)?(l=Rs(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):s&&(l.x=Bh(s))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function VA(t){var e=new Map,n=new Set,r=[];t.forEach(function(s){e.set(s.name,s)});function i(s){n.add(s.name);var o=[].concat(s.requires||[],s.requiresIfExists||[]);o.forEach(function(a){if(!n.has(a)){var l=e.get(a);l&&i(l)}}),r.push(s)}return t.forEach(function(s){n.has(s.name)||i(s)}),r}function KA(t){var e=VA(t);return rA.reduce(function(n,r){return n.concat(e.filter(function(i){return i.phase===r}))},[])}function WA(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function GA(t){var e=t.reduce(function(n,r){var i=n[r.name];return n[r.name]=i?Object.assign({},i,r,{options:Object.assign({},i.options,r.options),data:Object.assign({},i.data,r.data)}):r,n},{});return Object.keys(e).map(function(n){return e[n]})}var yg={placement:"bottom",modifiers:[],strategy:"absolute"};function bg(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return!e.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function qA(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,r=n===void 0?[]:n,i=e.defaultOptions,s=i===void 0?yg:i;return function(a,l,c){c===void 0&&(c=s);var d={placement:"bottom",orderedModifiers:[],options:Object.assign({},yg,s),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},u=[],f=!1,h={state:d,setOptions:function(b){var w=typeof b=="function"?b(d.options):b;g(),d.options=Object.assign({},s,d.options,w),d.scrollParents={reference:Ui(a)?So(a):a.contextElement?So(a.contextElement):[],popper:So(l)};var k=KA(GA([].concat(r,d.options.modifiers)));return d.orderedModifiers=k.filter(function(v){return v.enabled}),m(),h.update()},forceUpdate:function(){if(!f){var b=d.elements,w=b.reference,k=b.popper;if(bg(w,k)){d.rects={reference:UA(w,Ea(k),d.options.strategy==="fixed"),popper:Dh(k)},d.reset=!1,d.placement=d.options.placement,d.orderedModifiers.forEach(function(D){return d.modifiersData[D.name]=Object.assign({},D.data)});for(var v=0;v<d.orderedModifiers.length;v++){if(d.reset===!0){d.reset=!1,v=-1;continue}var E=d.orderedModifiers[v],S=E.fn,C=E.options,N=C===void 0?{}:C,M=E.name;typeof S=="function"&&(d=S({state:d,options:N,name:M,instance:h})||d)}}}},update:WA(function(){return new Promise(function(y){h.forceUpdate(),y(d)})}),destroy:function(){g(),f=!0}};if(!bg(a,l))return h;h.setOptions(c).then(function(y){!f&&c.onFirstUpdate&&c.onFirstUpdate(y)});function m(){d.orderedModifiers.forEach(function(y){var b=y.name,w=y.options,k=w===void 0?{}:w,v=y.effect;if(typeof v=="function"){var E=v({state:d,name:b,instance:h,options:k}),S=function(){};u.push(E||S)}})}function g(){u.forEach(function(y){return y()}),u=[]}return h}}var YA=[bA,PA,gA,kv,DA,AA,$A,fA,OA],JA=qA({defaultModifiers:YA}),XA="tippy-box",Ov="tippy-content",ZA="tippy-backdrop",Rv="tippy-arrow",Iv="tippy-svg-arrow",ki={passive:!0,capture:!0},Dv=function(){return document.body};function su(t,e,n){if(Array.isArray(t)){var r=t[e];return r??(Array.isArray(n)?n[e]:n)}return t}function $h(t,e){var n={}.toString.call(t);return n.indexOf("[object")===0&&n.indexOf(e+"]")>-1}function Lv(t,e){return typeof t=="function"?t.apply(void 0,e):t}function vg(t,e){if(e===0)return t;var n;return function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)}}function QA(t){return t.split(/\s+/).filter(Boolean)}function cs(t){return[].concat(t)}function xg(t,e){t.indexOf(e)===-1&&t.push(e)}function eM(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function tM(t){return t.split("-")[0]}function ql(t){return[].slice.call(t)}function wg(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function Co(){return document.createElement("div")}function rd(t){return["Element","Fragment"].some(function(e){return $h(t,e)})}function nM(t){return $h(t,"NodeList")}function rM(t){return $h(t,"MouseEvent")}function iM(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function sM(t){return rd(t)?[t]:nM(t)?ql(t):Array.isArray(t)?t:ql(document.querySelectorAll(t))}function ou(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function Eg(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function oM(t){var e,n=cs(t),r=n[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function aM(t,e){var n=e.clientX,r=e.clientY;return t.every(function(i){var s=i.popperRect,o=i.popperState,a=i.props,l=a.interactiveBorder,c=tM(o.placement),d=o.modifiersData.offset;if(!d)return!0;var u=c==="bottom"?d.top.y:0,f=c==="top"?d.bottom.y:0,h=c==="right"?d.left.x:0,m=c==="left"?d.right.x:0,g=s.top-r+u>l,y=r-s.bottom-f>l,b=s.left-n+h>l,w=n-s.right-m>l;return g||y||b||w})}function au(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){t[r](i,n)})}function kg(t,e){for(var n=e;n;){var r;if(t.contains(n))return!0;n=n.getRootNode==null||(r=n.getRootNode())==null?void 0:r.host}return!1}var Jn={isTouch:!1},Sg=0;function lM(){Jn.isTouch||(Jn.isTouch=!0,window.performance&&document.addEventListener("mousemove",Pv))}function Pv(){var t=performance.now();t-Sg<20&&(Jn.isTouch=!1,document.removeEventListener("mousemove",Pv)),Sg=t}function cM(){var t=document.activeElement;if(iM(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function dM(){document.addEventListener("touchstart",lM,ki),window.addEventListener("blur",cM)}var uM=typeof window<"u"&&typeof document<"u",fM=uM?!!window.msCrypto:!1,hM={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},pM={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Ln=Object.assign({appendTo:Dv,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},hM,pM),mM=Object.keys(Ln),gM=function(e){var n=Object.keys(e);n.forEach(function(r){Ln[r]=e[r]})};function Bv(t){var e=t.plugins||[],n=e.reduce(function(r,i){var s=i.name,o=i.defaultValue;if(s){var a;r[s]=t[s]!==void 0?t[s]:(a=Ln[s])!=null?a:o}return r},{});return Object.assign({},t,n)}function yM(t,e){var n=e?Object.keys(Bv(Object.assign({},Ln,{plugins:e}))):mM,r=n.reduce(function(i,s){var o=(t.getAttribute("data-tippy-"+s)||"").trim();if(!o)return i;if(s==="content")i[s]=o;else try{i[s]=JSON.parse(o)}catch{i[s]=o}return i},{});return r}function Cg(t,e){var n=Object.assign({},e,{content:Lv(e.content,[t])},e.ignoreAttributes?{}:yM(t,e.plugins));return n.aria=Object.assign({},Ln.aria,n.aria),n.aria={expanded:n.aria.expanded==="auto"?e.interactive:n.aria.expanded,content:n.aria.content==="auto"?e.interactive?null:"describedby":n.aria.content},n}var bM=function(){return"innerHTML"};function Sf(t,e){t[bM()]=e}function _g(t){var e=Co();return t===!0?e.className=Rv:(e.className=Iv,rd(t)?e.appendChild(t):Sf(e,t)),e}function Ng(t,e){rd(e.content)?(Sf(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Sf(t,e.content):t.textContent=e.content)}function Cf(t){var e=t.firstElementChild,n=ql(e.children);return{box:e,content:n.find(function(r){return r.classList.contains(Ov)}),arrow:n.find(function(r){return r.classList.contains(Rv)||r.classList.contains(Iv)}),backdrop:n.find(function(r){return r.classList.contains(ZA)})}}function jv(t){var e=Co(),n=Co();n.className=XA,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=Co();r.className=Ov,r.setAttribute("data-state","hidden"),Ng(r,t.props),e.appendChild(n),n.appendChild(r),i(t.props,t.props);function i(s,o){var a=Cf(e),l=a.box,c=a.content,d=a.arrow;o.theme?l.setAttribute("data-theme",o.theme):l.removeAttribute("data-theme"),typeof o.animation=="string"?l.setAttribute("data-animation",o.animation):l.removeAttribute("data-animation"),o.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?l.setAttribute("role",o.role):l.removeAttribute("role"),(s.content!==o.content||s.allowHTML!==o.allowHTML)&&Ng(c,t.props),o.arrow?d?s.arrow!==o.arrow&&(l.removeChild(d),l.appendChild(_g(o.arrow))):l.appendChild(_g(o.arrow)):d&&l.removeChild(d)}return{popper:e,onUpdate:i}}jv.$$tippy=!0;var vM=1,Ua=[],lu=[];function xM(t,e){var n=Cg(t,Object.assign({},Ln,Bv(wg(e)))),r,i,s,o=!1,a=!1,l=!1,c=!1,d,u,f,h=[],m=vg(ut,n.interactiveDebounce),g,y=vM++,b=null,w=eM(n.plugins),k={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},v={id:y,reference:t,popper:Co(),popperInstance:b,props:n,state:k,plugins:w,clearDelayTimeouts:Ot,setProps:U,setContent:I,show:re,hide:Re,hideWithInteractivity:ft,enable:qe,disable:en,unmount:dn,destroy:io};if(!n.render)return v;var E=n.render(v),S=E.popper,C=E.onUpdate;S.setAttribute("data-tippy-root",""),S.id="tippy-"+v.id,v.popper=S,t._tippy=v,S._tippy=v;var N=w.map(function(O){return O.fn(v)}),M=t.hasAttribute("aria-expanded");return ze(),Y(),A(),T("onCreate",[v]),n.showOnCreate&&Me(),S.addEventListener("mouseenter",function(){v.props.interactive&&v.state.isVisible&&v.clearDelayTimeouts()}),S.addEventListener("mouseleave",function(){v.props.interactive&&v.props.trigger.indexOf("mouseenter")>=0&&G().addEventListener("mousemove",m)}),v;function D(){var O=v.props.touch;return Array.isArray(O)?O:[O,0]}function j(){return D()[0]==="hold"}function B(){var O;return!!((O=v.props.render)!=null&&O.$$tippy)}function F(){return g||t}function G(){var O=F().parentNode;return O?oM(O):document}function q(){return Cf(S)}function W(O){return v.state.isMounted&&!v.state.isVisible||Jn.isTouch||d&&d.type==="focus"?0:su(v.props.delay,O?0:1,Ln.delay)}function A(O){O===void 0&&(O=!1),S.style.pointerEvents=v.props.interactive&&!O?"":"none",S.style.zIndex=""+v.props.zIndex}function T(O,ae,ve){if(ve===void 0&&(ve=!0),N.forEach(function(Oe){Oe[O]&&Oe[O].apply(Oe,ae)}),ve){var $e;($e=v.props)[O].apply($e,ae)}}function P(){var O=v.props.aria;if(O.content){var ae="aria-"+O.content,ve=S.id,$e=cs(v.props.triggerTarget||t);$e.forEach(function(Oe){var wt=Oe.getAttribute(ae);if(v.state.isVisible)Oe.setAttribute(ae,wt?wt+" "+ve:ve);else{var Gt=wt&&wt.replace(ve,"").trim();Gt?Oe.setAttribute(ae,Gt):Oe.removeAttribute(ae)}})}}function Y(){if(!(M||!v.props.aria.expanded)){var O=cs(v.props.triggerTarget||t);O.forEach(function(ae){v.props.interactive?ae.setAttribute("aria-expanded",v.state.isVisible&&ae===F()?"true":"false"):ae.removeAttribute("aria-expanded")})}}function te(){G().removeEventListener("mousemove",m),Ua=Ua.filter(function(O){return O!==m})}function pe(O){if(!(Jn.isTouch&&(l||O.type==="mousedown"))){var ae=O.composedPath&&O.composedPath()[0]||O.target;if(!(v.props.interactive&&kg(S,ae))){if(cs(v.props.triggerTarget||t).some(function(ve){return kg(ve,ae)})){if(Jn.isTouch||v.state.isVisible&&v.props.trigger.indexOf("click")>=0)return}else T("onClickOutside",[v,O]);v.props.hideOnClick===!0&&(v.clearDelayTimeouts(),v.hide(),a=!0,setTimeout(function(){a=!1}),v.state.isMounted||Ee())}}}function Q(){l=!0}function X(){l=!1}function ne(){var O=G();O.addEventListener("mousedown",pe,!0),O.addEventListener("touchend",pe,ki),O.addEventListener("touchstart",X,ki),O.addEventListener("touchmove",Q,ki)}function Ee(){var O=G();O.removeEventListener("mousedown",pe,!0),O.removeEventListener("touchend",pe,ki),O.removeEventListener("touchstart",X,ki),O.removeEventListener("touchmove",Q,ki)}function be(O,ae){Ie(O,function(){!v.state.isVisible&&S.parentNode&&S.parentNode.contains(S)&&ae()})}function Be(O,ae){Ie(O,ae)}function Ie(O,ae){var ve=q().box;function $e(Oe){Oe.target===ve&&(au(ve,"remove",$e),ae())}if(O===0)return ae();au(ve,"remove",u),au(ve,"add",$e),u=$e}function Le(O,ae,ve){ve===void 0&&(ve=!1);var $e=cs(v.props.triggerTarget||t);$e.forEach(function(Oe){Oe.addEventListener(O,ae,ve),h.push({node:Oe,eventType:O,handler:ae,options:ve})})}function ze(){j()&&(Le("touchstart",je,{passive:!0}),Le("touchend",bt,{passive:!0})),QA(v.props.trigger).forEach(function(O){if(O!=="manual")switch(Le(O,je),O){case"mouseenter":Le("mouseleave",bt);break;case"focus":Le(fM?"focusout":"blur",ge);break;case"focusin":Le("focusout",ge);break}})}function Pe(){h.forEach(function(O){var ae=O.node,ve=O.eventType,$e=O.handler,Oe=O.options;ae.removeEventListener(ve,$e,Oe)}),h=[]}function je(O){var ae,ve=!1;if(!(!v.state.isEnabled||at(O)||a)){var $e=((ae=d)==null?void 0:ae.type)==="focus";d=O,g=O.currentTarget,Y(),!v.state.isVisible&&rM(O)&&Ua.forEach(function(Oe){return Oe(O)}),O.type==="click"&&(v.props.trigger.indexOf("mouseenter")<0||o)&&v.props.hideOnClick!==!1&&v.state.isVisible?ve=!0:Me(O),O.type==="click"&&(o=!ve),ve&&!$e&&Mt(O)}}function ut(O){var ae=O.target,ve=F().contains(ae)||S.contains(ae);if(!(O.type==="mousemove"&&ve)){var $e=Fe().concat(S).map(function(Oe){var wt,Gt=Oe._tippy,Pr=(wt=Gt.popperInstance)==null?void 0:wt.state;return Pr?{popperRect:Oe.getBoundingClientRect(),popperState:Pr,props:n}:null}).filter(Boolean);aM($e,O)&&(te(),Mt(O))}}function bt(O){var ae=at(O)||v.props.trigger.indexOf("click")>=0&&o;if(!ae){if(v.props.interactive){v.hideWithInteractivity(O);return}Mt(O)}}function ge(O){v.props.trigger.indexOf("focusin")<0&&O.target!==F()||v.props.interactive&&O.relatedTarget&&S.contains(O.relatedTarget)||Mt(O)}function at(O){return Jn.isTouch?j()!==O.type.indexOf("touch")>=0:!1}function st(){de();var O=v.props,ae=O.popperOptions,ve=O.placement,$e=O.offset,Oe=O.getReferenceClientRect,wt=O.moveTransition,Gt=B()?Cf(S).arrow:null,Pr=Oe?{getBoundingClientRect:Oe,contextElement:Oe.contextElement||F()}:t,so={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(R){var V=R.state;if(B()){var xe=q(),Qe=xe.box;["placement","reference-hidden","escaped"].forEach(function(Ye){Ye==="placement"?Qe.setAttribute("data-placement",V.placement):V.attributes.popper["data-popper-"+Ye]?Qe.setAttribute("data-"+Ye,""):Qe.removeAttribute("data-"+Ye)}),V.attributes.popper={}}}},tn=[{name:"offset",options:{offset:$e}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!wt}},so];B()&&Gt&&tn.push({name:"arrow",options:{element:Gt,padding:3}}),tn.push.apply(tn,ae?.modifiers||[]),v.popperInstance=JA(Pr,S,Object.assign({},ae,{placement:ve,onFirstUpdate:f,modifiers:tn}))}function de(){v.popperInstance&&(v.popperInstance.destroy(),v.popperInstance=null)}function At(){var O=v.props.appendTo,ae,ve=F();v.props.interactive&&O===Dv||O==="parent"?ae=ve.parentNode:ae=Lv(O,[ve]),ae.contains(S)||ae.appendChild(S),v.state.isMounted=!0,st()}function Fe(){return ql(S.querySelectorAll("[data-tippy-root]"))}function Me(O){v.clearDelayTimeouts(),O&&T("onTrigger",[v,O]),ne();var ae=W(!0),ve=D(),$e=ve[0],Oe=ve[1];Jn.isTouch&&$e==="hold"&&Oe&&(ae=Oe),ae?r=setTimeout(function(){v.show()},ae):v.show()}function Mt(O){if(v.clearDelayTimeouts(),T("onUntrigger",[v,O]),!v.state.isVisible){Ee();return}if(!(v.props.trigger.indexOf("mouseenter")>=0&&v.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(O.type)>=0&&o)){var ae=W(!1);ae?i=setTimeout(function(){v.state.isVisible&&v.hide()},ae):s=requestAnimationFrame(function(){v.hide()})}}function qe(){v.state.isEnabled=!0}function en(){v.hide(),v.state.isEnabled=!1}function Ot(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(s)}function U(O){if(!v.state.isDestroyed){T("onBeforeUpdate",[v,O]),Pe();var ae=v.props,ve=Cg(t,Object.assign({},ae,wg(O),{ignoreAttributes:!0}));v.props=ve,ze(),ae.interactiveDebounce!==ve.interactiveDebounce&&(te(),m=vg(ut,ve.interactiveDebounce)),ae.triggerTarget&&!ve.triggerTarget?cs(ae.triggerTarget).forEach(function($e){$e.removeAttribute("aria-expanded")}):ve.triggerTarget&&t.removeAttribute("aria-expanded"),Y(),A(),C&&C(ae,ve),v.popperInstance&&(st(),Fe().forEach(function($e){requestAnimationFrame($e._tippy.popperInstance.forceUpdate)})),T("onAfterUpdate",[v,O])}}function I(O){v.setProps({content:O})}function re(){var O=v.state.isVisible,ae=v.state.isDestroyed,ve=!v.state.isEnabled,$e=Jn.isTouch&&!v.props.touch,Oe=su(v.props.duration,0,Ln.duration);if(!(O||ae||ve||$e)&&!F().hasAttribute("disabled")&&(T("onShow",[v],!1),v.props.onShow(v)!==!1)){if(v.state.isVisible=!0,B()&&(S.style.visibility="visible"),A(),ne(),v.state.isMounted||(S.style.transition="none"),B()){var wt=q(),Gt=wt.box,Pr=wt.content;ou([Gt,Pr],0)}f=function(){var tn;if(!(!v.state.isVisible||c)){if(c=!0,S.offsetHeight,S.style.transition=v.props.moveTransition,B()&&v.props.animation){var _=q(),R=_.box,V=_.content;ou([R,V],Oe),Eg([R,V],"visible")}P(),Y(),xg(lu,v),(tn=v.popperInstance)==null||tn.forceUpdate(),T("onMount",[v]),v.props.animation&&B()&&Be(Oe,function(){v.state.isShown=!0,T("onShown",[v])})}},At()}}function Re(){var O=!v.state.isVisible,ae=v.state.isDestroyed,ve=!v.state.isEnabled,$e=su(v.props.duration,1,Ln.duration);if(!(O||ae||ve)&&(T("onHide",[v],!1),v.props.onHide(v)!==!1)){if(v.state.isVisible=!1,v.state.isShown=!1,c=!1,o=!1,B()&&(S.style.visibility="hidden"),te(),Ee(),A(!0),B()){var Oe=q(),wt=Oe.box,Gt=Oe.content;v.props.animation&&(ou([wt,Gt],$e),Eg([wt,Gt],"hidden"))}P(),Y(),v.props.animation?B()&&be($e,v.unmount):v.unmount()}}function ft(O){G().addEventListener("mousemove",m),xg(Ua,m),m(O)}function dn(){v.state.isVisible&&v.hide(),v.state.isMounted&&(de(),Fe().forEach(function(O){O._tippy.unmount()}),S.parentNode&&S.parentNode.removeChild(S),lu=lu.filter(function(O){return O!==v}),v.state.isMounted=!1,T("onHidden",[v]))}function io(){v.state.isDestroyed||(v.clearDelayTimeouts(),v.unmount(),Pe(),delete t._tippy,v.state.isDestroyed=!0,T("onDestroy",[v]))}}function mi(t,e){e===void 0&&(e={});var n=Ln.plugins.concat(e.plugins||[]);dM();var r=Object.assign({},e,{plugins:n}),i=sM(t),s=i.reduce(function(o,a){var l=a&&xM(a,r);return l&&o.push(l),o},[]);return rd(t)?s[0]:s}mi.defaultProps=Ln;mi.setDefaultProps=gM;mi.currentInput=Jn;Object.assign({},kv,{effect:function(e){var n=e.state,r={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,r.popper),n.styles=r,n.elements.arrow&&Object.assign(n.elements.arrow.style,r.arrow)}});var Wi={name:"sticky",defaultValue:!1,fn:function(e){var n=e.reference,r=e.popper;function i(){return e.popperInstance?e.popperInstance.state.elements.reference:n}function s(c){return e.props.sticky===!0||e.props.sticky===c}var o=null,a=null;function l(){var c=s("reference")?i().getBoundingClientRect():null,d=s("popper")?r.getBoundingClientRect():null;(c&&Tg(o,c)||d&&Tg(a,d))&&e.popperInstance&&e.popperInstance.update(),o=c,a=d,e.state.isMounted&&requestAnimationFrame(l)}return{onMount:function(){e.props.sticky&&l()}}}};function Tg(t,e){return t&&e?t.top!==e.top||t.right!==e.right||t.bottom!==e.bottom||t.left!==e.left:!0}mi.setDefaultProps({render:jv});class wM{constructor({editor:e,element:n,view:r,tippyOptions:i={},updateDelay:s=250,shouldShow:o}){this.preventHide=!1,this.shouldShow=({view:a,state:l,from:c,to:d})=>{const{doc:u,selection:f}=l,{empty:h}=f,m=!u.textBetween(c,d).length&&Qc(l.selection),g=this.element.contains(document.activeElement);return!(!(a.hasFocus()||g)||h||m||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:a})=>{var l;if(this.preventHide){this.preventHide=!1;return}a?.relatedTarget&&(!((l=this.element.parentNode)===null||l===void 0)&&l.contains(a.relatedTarget))||a?.relatedTarget!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=a=>{this.blurHandler({event:a})},this.handleDebouncedUpdate=(a,l)=>{const c=!l?.selection.eq(a.state.selection),d=!l?.doc.eq(a.state.doc);!c&&!d||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(a,c,d,l)},this.updateDelay))},this.updateHandler=(a,l,c,d)=>{var u,f,h;const{state:m,composing:g}=a,{selection:y}=m;if(g||!l&&!c)return;this.createTooltip();const{ranges:w}=y,k=Math.min(...w.map(S=>S.$from.pos)),v=Math.max(...w.map(S=>S.$to.pos));if(!((u=this.shouldShow)===null||u===void 0?void 0:u.call(this,{editor:this.editor,element:this.element,view:a,state:m,oldState:d,from:k,to:v}))){this.hide();return}(f=this.tippy)===null||f===void 0||f.setProps({getReferenceClientRect:((h=this.tippyOptions)===null||h===void 0?void 0:h.getReferenceClientRect)||(()=>{if(vv(m.selection)){let S=a.nodeDOM(k);if(S){const C=S.dataset.nodeViewWrapper?S:S.querySelector("[data-node-view-wrapper]");if(C&&(S=C.firstChild),S)return S.getBoundingClientRect()}}return uT(a,k,v)})}),this.show()},this.editor=e,this.element=n,this.view=r,this.updateDelay=s,o&&(this.shouldShow=o),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.element.tabIndex=0,!(this.tippy||!n)&&(this.tippy=mi(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){const{state:r}=e,i=r.selection.from!==r.selection.to;if(this.updateDelay>0&&i){this.handleDebouncedUpdate(e,n);return}const s=!n?.selection.eq(e.state.selection),o=!n?.doc.eq(e.state.doc);this.updateHandler(e,s,o,n)}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const $v=t=>new Ze({key:typeof t.pluginKey=="string"?new Ge(t.pluginKey):t.pluginKey,view:e=>new wM({view:e,...t})});ot.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[$v({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});var id=zk();const Fv=ah(id);function EM(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Hv={exports:{}},cu={};var Ag;function kM(){if(Ag)return cu;Ag=1;var t=K;function e(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,s=t.useLayoutEffect,o=t.useDebugValue;function a(u,f){var h=f(),m=r({inst:{value:h,getSnapshot:f}}),g=m[0].inst,y=m[1];return s(function(){g.value=h,g.getSnapshot=f,l(g)&&y({inst:g})},[u,h,f]),i(function(){return l(g)&&y({inst:g}),u(function(){l(g)&&y({inst:g})})},[u]),o(h),h}function l(u){var f=u.getSnapshot;u=u.value;try{var h=f();return!n(u,h)}catch{return!0}}function c(u,f){return f()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return cu.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,cu}Hv.exports=kM();var Fh=Hv.exports;const SM=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},CM=({contentComponent:t})=>{const e=Fh.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return K.createElement(K.Fragment,null,Object.values(e))};function _M(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:Fv.createPortal(r.reactElement,r.element,n)},t.forEach(i=>i())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(i=>i())}}}class NM extends K.Component{constructor(e){var n;super(e),this.editorContentRef=K.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(!((n=e.editor)===null||n===void 0)&&n.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const e=this.props.editor;if(e&&!e.isDestroyed&&e.options.element){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.options.element.childNodes),e.setOptions({element:n}),e.contentComponent=_M(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){const e=this.props.editor;if(!e||(this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null,!e.options.element.firstChild))return;const n=document.createElement("div");n.append(...e.options.element.childNodes),e.setOptions({element:n})}render(){const{editor:e,innerRef:n,...r}=this.props;return K.createElement(K.Fragment,null,K.createElement("div",{ref:SM(n,this.editorContentRef),...r}),e?.contentComponent&&K.createElement(CM,{contentComponent:e.contentComponent}))}}const TM=x.forwardRef((t,e)=>{const n=K.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return K.createElement(NM,{key:n,innerRef:e,...t})}),AM=K.memo(TM);var MM=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,i,s;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!t(e[i],n[i]))return!1;return!0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(i of e.entries())if(!n.has(i[0]))return!1;for(i of e.entries())if(!t(i[1],n.get(i[0])))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(i of e.entries())if(!n.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(r=e.length,r!=n.length)return!1;for(i=r;i--!==0;)if(e[i]!==n[i])return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(s=Object.keys(e),r=s.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[i]))return!1;for(i=r;i--!==0;){var o=s[i];if(!(o==="_owner"&&e.$$typeof)&&!t(e[o],n[o]))return!1}return!0}return e!==e&&n!==n},OM=EM(MM),zv={exports:{}},du={};var Mg;function RM(){if(Mg)return du;Mg=1;var t=K,e=Fh;function n(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,o=t.useEffect,a=t.useMemo,l=t.useDebugValue;return du.useSyncExternalStoreWithSelector=function(c,d,u,f,h){var m=s(null);if(m.current===null){var g={hasValue:!1,value:null};m.current=g}else g=m.current;m=a(function(){function b(S){if(!w){if(w=!0,k=S,S=f(S),h!==void 0&&g.hasValue){var C=g.value;if(h(C,S))return v=C}return v=S}if(C=v,r(k,S))return C;var N=f(S);return h!==void 0&&h(C,N)?C:(k=S,v=N)}var w=!1,k,v,E=u===void 0?null:u;return[function(){return b(d())},E===null?void 0:function(){return b(E())}]},[d,u,f,h]);var y=i(c,m[0],m[1]);return o(function(){g.hasValue=!0,g.value=y},[y]),l(y),y},du}zv.exports=RM();var IM=zv.exports;const DM=typeof window<"u"?x.useLayoutEffect:x.useEffect;class LM{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const n=()=>{this.transactionNumber+=1,this.subscribers.forEach(i=>i())},r=this.editor;return r.on("transaction",n),()=>{r.off("transaction",n)}}}}function cr(t){var e;const[n]=x.useState(()=>new LM(t.editor)),r=IM.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!==null&&e!==void 0?e:OM);return DM(()=>n.watch(t.editor),[t.editor,n]),x.useDebugValue(r),r}const PM=!1,_f=typeof window>"u",BM=_f||!!(typeof window<"u"&&window.next);class Hh{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?_f||BM?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onBeforeCreate)===null||s===void 0?void 0:s.call(i,...r)},onBlur:(...r)=>{var i,s;return(s=(i=this.options.current).onBlur)===null||s===void 0?void 0:s.call(i,...r)},onCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onCreate)===null||s===void 0?void 0:s.call(i,...r)},onDestroy:(...r)=>{var i,s;return(s=(i=this.options.current).onDestroy)===null||s===void 0?void 0:s.call(i,...r)},onFocus:(...r)=>{var i,s;return(s=(i=this.options.current).onFocus)===null||s===void 0?void 0:s.call(i,...r)},onSelectionUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onSelectionUpdate)===null||s===void 0?void 0:s.call(i,...r)},onTransaction:(...r)=>{var i,s;return(s=(i=this.options.current).onTransaction)===null||s===void 0?void 0:s.call(i,...r)},onUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onUpdate)===null||s===void 0?void 0:s.call(i,...r)},onContentError:(...r)=>{var i,s;return(s=(i=this.options.current).onContentError)===null||s===void 0?void 0:s.call(i,...r)},onDrop:(...r)=>{var i,s;return(s=(i=this.options.current).onDrop)===null||s===void 0?void 0:s.call(i,...r)},onPaste:(...r)=>{var i,s;return(s=(i=this.options.current).onPaste)===null||s===void 0?void 0:s.call(i,...r)}};return new zT(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((i,s)=>{var o;return i===((o=n.extensions)===null||o===void 0?void 0:o[s])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?Hh.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,i)=>r===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}}function jM(t={},e=[]){const n=x.useRef(t);n.current=t;const[r]=x.useState(()=>new Hh(n)),i=Fh.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return x.useDebugValue(i),x.useEffect(r.onRender(e)),cr({editor:i,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1?null:t.immediatelyRender&&s===0?0:s+1}),i}const Uv=x.createContext({editor:null});Uv.Consumer;const $M=()=>x.useContext(Uv),Ir=t=>{const[e,n]=x.useState(null),{editor:r}=$M();return x.useEffect(()=>{var i;if(!e||!((i=t.editor)===null||i===void 0)&&i.isDestroyed||r?.isDestroyed)return;const{pluginKey:s="bubbleMenu",editor:o,tippyOptions:a={},updateDelay:l,shouldShow:c=null}=t,d=o||r;if(!d){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const u=$v({updateDelay:l,editor:d,element:e,pluginKey:s,shouldShow:c,tippyOptions:a});return d.registerPlugin(u),()=>{d.unregisterPlugin(s)}},[t.editor,r,e]),K.createElement("div",{ref:n,className:t.className,style:{visibility:"hidden"}},t.children)},Vv=x.createContext({onDragStart:void 0}),Kv=()=>x.useContext(Vv),Wv=t=>{const e=t.as||"div",{nodeViewContentRef:n}=Kv();return K.createElement(e,{...t,ref:n,"data-node-view-content":"",style:{whiteSpace:"pre-wrap",...t.style}})},Gi=K.forwardRef((t,e)=>{const{onDragStart:n}=Kv(),r=t.as||"div";return K.createElement(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function Og(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function Rg(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function FM(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function HM(t){if(Og(t)||Rg(t))return!0;if(FM(t)){const e=t.type;if(e)return Og(e)||Rg(e)}return!1}function zM(){try{if(x.version)return parseInt(x.version.split(".")[0],10)>=19}catch{}return!1}class zh{constructor(e,{editor:n,props:r={},as:i="div",className:s=""}){this.ref=null,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=e,this.editor=n,this.props=r,this.element=document.createElement(i),this.element.classList.add("react-renderer"),s&&this.element.classList.add(...s.split(" ")),this.editor.isInitialized?id.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.render()})}render(){var e;const n=this.component,r=this.props,i=this.editor,s=zM(),o=HM(n),a={...r};a.ref&&!(s||o)&&delete a.ref,!a.ref&&(s||o)&&(a.ref=l=>{this.ref=l}),this.reactElement=K.createElement(n,{...a}),(e=i?.contentComponent)===null||e===void 0||e.setRenderer(this.id,this)}updateProps(e={}){this.props={...this.props,...e},this.render()}destroy(){var e;const n=this.editor;(e=n?.contentComponent)===null||e===void 0||e.removeRenderer(this.id)}updateAttributes(e){Object.keys(e).forEach(n=>{this.element.setAttribute(n,e[n])})}}class UM extends UT{constructor(e,n,r){if(super(e,n,r),!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const i=this.dom.querySelector("[data-node-view-content]");if(!i)return;i.appendChild(this.contentDOMElement)}}mount(){const e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(c={})=>this.updateAttributes(c),deleteNode:()=>this.deleteNode(),ref:x.createRef()};if(!this.component.displayName){const c=d=>d.charAt(0).toUpperCase()+d.substring(1);this.component.displayName=c(this.extension.name)}const i={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:c=>{c&&this.contentDOMElement&&c.firstChild!==this.contentDOMElement&&(c.hasAttribute("data-node-view-wrapper")&&c.removeAttribute("data-node-view-wrapper"),c.appendChild(this.contentDOMElement))}},s=this.component,o=x.memo(c=>K.createElement(Vv.Provider,{value:i},x.createElement(s,c)));o.displayName="ReactNodeView";let a=this.node.isInline?"span":"div";this.options.as&&(a=this.options.as);const{className:l=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new zh(o,{editor:this.editor,props:e,as:a,className:`node-${this.node.type.name} ${l}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var e;if(this.renderer.element.firstElementChild&&!(!((e=this.renderer.element.firstElementChild)===null||e===void 0)&&e.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){const{from:e,to:n}=this.editor.state.selection,r=this.getPos();if(typeof r=="number")if(e<=r&&n>=r+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(e,n,r){const i=s=>{this.renderer.updateProps(s),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const s=this.node,o=this.decorations,a=this.innerDecorations;return this.node=e,this.decorations=n,this.innerDecorations=r,this.options.update({oldNode:s,oldDecorations:o,newNode:e,newDecorations:n,oldInnerDecorations:a,innerDecorations:r,updateProps:()=>i({node:e,decorations:n,innerDecorations:r})})}return e===this.node&&this.decorations===n&&this.innerDecorations===r||(this.node=e,this.decorations=n,this.innerDecorations=r,i({node:e,decorations:n,innerDecorations:r})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null}updateElementAttributes(){if(this.options.attrs){let e={};if(typeof this.options.attrs=="function"){const n=this.editor.extensionManager.attributes,r=Kl(this.node,n);e=this.options.attrs({node:this.node,HTMLAttributes:r})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}}function qi(t,e){return n=>n.editor.contentComponent?new UM(t,n,e):{}}const It=[];for(let t=0;t<256;++t)It.push((t+256).toString(16).slice(1));function VM(t,e=0){return(It[t[e+0]]+It[t[e+1]]+It[t[e+2]]+It[t[e+3]]+"-"+It[t[e+4]]+It[t[e+5]]+"-"+It[t[e+6]]+It[t[e+7]]+"-"+It[t[e+8]]+It[t[e+9]]+"-"+It[t[e+10]]+It[t[e+11]]+It[t[e+12]]+It[t[e+13]]+It[t[e+14]]+It[t[e+15]]).toLowerCase()}let uu;const KM=new Uint8Array(16);function WM(){if(!uu){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");uu=crypto.getRandomValues.bind(crypto)}return uu(KM)}const GM=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ig={randomUUID:GM};function Yo(t,e,n){if(Ig.randomUUID&&!t)return Ig.randomUUID();t=t||{};const r=t.random??t.rng?.()??WM();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,VM(r)}var fu,Dg;function qM(){return Dg||(Dg=1,fu=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,i,s;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!t(e[i],n[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(s=Object.keys(e),r=s.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[i]))return!1;for(i=r;i--!==0;){var o=s[i];if(!t(e[o],n[o]))return!1}return!0}return e!==e&&n!==n}),fu}var YM=qM();const gi=ah(YM);function Gv(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=Gv(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function JM(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=Gv(t))&&(r&&(r+=" "),r+=e);return r}function nn(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t?.(i),n===!1||!i.defaultPrevented)return e?.(i)}}function Lg(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Uh(...t){return e=>{let n=!1;const r=t.map(i=>{const s=Lg(i,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i<r.length;i++){const s=r[i];typeof s=="function"?s():Lg(t[i],null)}}}}function dr(...t){return x.useCallback(Uh(...t),t)}function Vh(t,e=[]){let n=[];function r(s,o){const a=x.createContext(o),l=n.length;n=[...n,o];const c=u=>{const{scope:f,children:h,...m}=u,g=f?.[t]?.[l]||a,y=x.useMemo(()=>m,Object.values(m));return p.jsx(g.Provider,{value:y,children:h})};c.displayName=s+"Provider";function d(u,f){const h=f?.[t]?.[l]||a,m=x.useContext(h);if(m)return m;if(o!==void 0)return o;throw new Error(`\`${u}\` must be used within \`${s}\``)}return[c,d]}const i=()=>{const s=n.map(o=>x.createContext(o));return function(a){const l=a?.[t]||s;return x.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[r,XM(i,...e)]}function XM(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const u=l(s)[`__scope${c}`];return{...a,...u}},{});return x.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}function qv(t){const e=ZM(t),n=x.forwardRef((r,i)=>{const{children:s,...o}=r,a=x.Children.toArray(s),l=a.find(eO);if(l){const c=l.props.children,d=a.map(u=>u===l?x.Children.count(c)>1?x.Children.only(null):x.isValidElement(c)?c.props.children:null:u);return p.jsx(e,{...o,ref:i,children:x.isValidElement(c)?x.cloneElement(c,void 0,d):null})}return p.jsx(e,{...o,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}function ZM(t){const e=x.forwardRef((n,r)=>{const{children:i,...s}=n;if(x.isValidElement(i)){const o=nO(i),a=tO(s,i.props);return i.type!==x.Fragment&&(a.ref=r?Uh(r,o):o),x.cloneElement(i,a)}return x.Children.count(i)>1?x.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Yv=Symbol("radix.slottable");function QM(t){const e=({children:n})=>p.jsx(p.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=Yv,e}function eO(t){return x.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Yv}function tO(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function nO(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var rO=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],zn=rO.reduce((t,e)=>{const n=qv(`Primitive.${e}`),r=x.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function iO(t,e){t&&id.flushSync(()=>t.dispatchEvent(e))}function Ds(t){const e=x.useRef(t);return x.useEffect(()=>{e.current=t}),x.useMemo(()=>(...n)=>e.current?.(...n),[])}function sO(t,e=globalThis?.document){const n=Ds(t);x.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var oO="DismissableLayer",Nf="dismissableLayer.update",aO="dismissableLayer.pointerDownOutside",lO="dismissableLayer.focusOutside",Pg,Jv=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Kh=x.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=t,c=x.useContext(Jv),[d,u]=x.useState(null),f=d?.ownerDocument??globalThis?.document,[,h]=x.useState({}),m=dr(e,C=>u(C)),g=Array.from(c.layers),[y]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),b=g.indexOf(y),w=d?g.indexOf(d):-1,k=c.layersWithOutsidePointerEventsDisabled.size>0,v=w>=b,E=uO(C=>{const N=C.target,M=[...c.branches].some(D=>D.contains(N));!v||M||(i?.(C),o?.(C),C.defaultPrevented||a?.())},f),S=fO(C=>{const N=C.target;[...c.branches].some(D=>D.contains(N))||(s?.(C),o?.(C),C.defaultPrevented||a?.())},f);return sO(C=>{w===c.layers.size-1&&(r?.(C),!C.defaultPrevented&&a&&(C.preventDefault(),a()))},f),x.useEffect(()=>{if(d)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(Pg=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(d)),c.layers.add(d),Bg(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Pg)}},[d,f,n,c]),x.useEffect(()=>()=>{d&&(c.layers.delete(d),c.layersWithOutsidePointerEventsDisabled.delete(d),Bg())},[d,c]),x.useEffect(()=>{const C=()=>h({});return document.addEventListener(Nf,C),()=>document.removeEventListener(Nf,C)},[]),p.jsx(zn.div,{...l,ref:m,style:{pointerEvents:k?v?"auto":"none":void 0,...t.style},onFocusCapture:nn(t.onFocusCapture,S.onFocusCapture),onBlurCapture:nn(t.onBlurCapture,S.onBlurCapture),onPointerDownCapture:nn(t.onPointerDownCapture,E.onPointerDownCapture)})});Kh.displayName=oO;var cO="DismissableLayerBranch",dO=x.forwardRef((t,e)=>{const n=x.useContext(Jv),r=x.useRef(null),i=dr(e,r);return x.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),p.jsx(zn.div,{...t,ref:i})});dO.displayName=cO;function uO(t,e=globalThis?.document){const n=Ds(t),r=x.useRef(!1),i=x.useRef(()=>{});return x.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let l=function(){Xv(aO,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=l,e.addEventListener("click",i.current,{once:!0})):l()}else e.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function fO(t,e=globalThis?.document){const n=Ds(t),r=x.useRef(!1);return x.useEffect(()=>{const i=s=>{s.target&&!r.current&&Xv(lO,n,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Bg(){const t=new CustomEvent(Nf);document.dispatchEvent(t)}function Xv(t,e,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?iO(i,s):i.dispatchEvent(s)}var oi=globalThis?.document?x.useLayoutEffect:()=>{},hO=lh[" useId ".trim().toString()]||(()=>{}),pO=0;function Zv(t){const[e,n]=x.useState(hO());return oi(()=>{n(r=>r??String(pO++))},[t]),t||(e?`radix-${e}`:"")}const mO=["top","right","bottom","left"],ai=Math.min,hn=Math.max,Yl=Math.round,Va=Math.floor,rr=t=>({x:t,y:t}),gO={left:"right",right:"left",bottom:"top",top:"bottom"};function Tf(t,e,n){return hn(t,ai(e,n))}function Nr(t,e){return typeof t=="function"?t(e):t}function Tr(t){return t.split("-")[0]}function Gs(t){return t.split("-")[1]}function Wh(t){return t==="x"?"y":"x"}function Gh(t){return t==="y"?"height":"width"}function er(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function qh(t){return Wh(er(t))}function yO(t,e,n){n===void 0&&(n=!1);const r=Gs(t),i=qh(t),s=Gh(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=Jl(o)),[o,Jl(o)]}function bO(t){const e=Jl(t);return[Af(t),e,Af(e)]}function Af(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const jg=["left","right"],$g=["right","left"],vO=["top","bottom"],xO=["bottom","top"];function wO(t,e,n){switch(t){case"top":case"bottom":return n?e?$g:jg:e?jg:$g;case"left":case"right":return e?vO:xO;default:return[]}}function EO(t,e,n,r){const i=Gs(t);let s=wO(Tr(t),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(Af)))),s}function Jl(t){const e=Tr(t);return gO[e]+t.slice(e.length)}function kO(t){return{top:0,right:0,bottom:0,left:0,...t}}function Qv(t){return typeof t!="number"?kO(t):{top:t,right:t,bottom:t,left:t}}function Xl(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function Fg(t,e,n){let{reference:r,floating:i}=t;const s=er(e),o=qh(e),a=Gh(o),l=Tr(e),c=s==="y",d=r.x+r.width/2-i.width/2,u=r.y+r.height/2-i.height/2,f=r[a]/2-i[a]/2;let h;switch(l){case"top":h={x:d,y:r.y-i.height};break;case"bottom":h={x:d,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:u};break;case"left":h={x:r.x-i.width,y:u};break;default:h={x:r.x,y:r.y}}switch(Gs(e)){case"start":h[o]-=f*(n&&c?-1:1);break;case"end":h[o]+=f*(n&&c?-1:1);break}return h}async function SO(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:h=0}=Nr(e,t),m=Qv(h),y=a[f?u==="floating"?"reference":"floating":u],b=Xl(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(y)))==null||n?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:l})),w=u==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),v=await(s.isElement==null?void 0:s.isElement(k))?await(s.getScale==null?void 0:s.getScale(k))||{x:1,y:1}:{x:1,y:1},E=Xl(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:k,strategy:l}):w);return{top:(b.top-E.top+m.top)/v.y,bottom:(E.bottom-b.bottom+m.bottom)/v.y,left:(b.left-E.left+m.left)/v.x,right:(E.right-b.right+m.right)/v.x}}const CO=50,_O=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:SO},l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:d,y:u}=Fg(c,r,l),f=r,h=0;const m={};for(let g=0;g<s.length;g++){const y=s[g];if(!y)continue;const{name:b,fn:w}=y,{x:k,y:v,data:E,reset:S}=await w({x:d,y:u,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:c,platform:a,elements:{reference:t,floating:e}});d=k??d,u=v??u,m[b]={...m[b],...E},S&&h<CO&&(h++,typeof S=="object"&&(S.placement&&(f=S.placement),S.rects&&(c=S.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:i}):S.rects),{x:d,y:u}=Fg(c,f,l)),g=-1)}return{x:d,y:u,placement:f,strategy:i,middlewareData:m}},NO=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:d=0}=Nr(t,e)||{};if(c==null)return{};const u=Qv(d),f={x:n,y:r},h=qh(i),m=Gh(h),g=await o.getDimensions(c),y=h==="y",b=y?"top":"left",w=y?"bottom":"right",k=y?"clientHeight":"clientWidth",v=s.reference[m]+s.reference[h]-f[h]-s.floating[m],E=f[h]-s.reference[h],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let C=S?S[k]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=a.floating[k]||s.floating[m]);const N=v/2-E/2,M=C/2-g[m]/2-1,D=ai(u[b],M),j=ai(u[w],M),B=D,F=C-g[m]-j,G=C/2-g[m]/2+N,q=Tf(B,G,F),W=!l.arrow&&Gs(i)!=null&&G!==q&&s.reference[m]/2-(G<B?D:j)-g[m]/2<0,A=W?G<B?G-B:G-F:0;return{[h]:f[h]+A,data:{[h]:q,centerOffset:G-q-A,...W&&{alignmentOffset:A}},reset:W}}}),TO=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...y}=Nr(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const b=Tr(i),w=er(a),k=Tr(a)===a,v=await(l.isRTL==null?void 0:l.isRTL(c.floating)),E=f||(k||!g?[Jl(a)]:bO(a)),S=m!=="none";!f&&S&&E.push(...EO(a,g,m,v));const C=[a,...E],N=await l.detectOverflow(e,y),M=[];let D=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&M.push(N[b]),u){const G=yO(i,o,v);M.push(N[G[0]],N[G[1]])}if(D=[...D,{placement:i,overflows:M}],!M.every(G=>G<=0)){var j,B;const G=(((j=s.flip)==null?void 0:j.index)||0)+1,q=C[G];if(q&&(!(u==="alignment"?w!==er(q):!1)||D.every(T=>er(T.placement)===w?T.overflows[0]>0:!0)))return{data:{index:G,overflows:D},reset:{placement:q}};let W=(B=D.filter(A=>A.overflows[0]<=0).sort((A,T)=>A.overflows[1]-T.overflows[1])[0])==null?void 0:B.placement;if(!W)switch(h){case"bestFit":{var F;const A=(F=D.filter(T=>{if(S){const P=er(T.placement);return P===w||P==="y"}return!0}).map(T=>[T.placement,T.overflows.filter(P=>P>0).reduce((P,Y)=>P+Y,0)]).sort((T,P)=>T[1]-P[1])[0])==null?void 0:F[0];A&&(W=A);break}case"initialPlacement":W=a;break}if(i!==W)return{reset:{placement:W}}}return{}}}};function Hg(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function zg(t){return mO.some(e=>t[e]>=0)}const AO=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:i="referenceHidden",...s}=Nr(t,e);switch(i){case"referenceHidden":{const o=await r.detectOverflow(e,{...s,elementContext:"reference"}),a=Hg(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:zg(a)}}}case"escaped":{const o=await r.detectOverflow(e,{...s,altBoundary:!0}),a=Hg(o,n.floating);return{data:{escapedOffsets:a,escaped:zg(a)}}}default:return{}}}}},ex=new Set(["left","top"]);async function MO(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Tr(n),a=Gs(n),l=er(n)==="y",c=ex.has(o)?-1:1,d=s&&l?-1:1,u=Nr(e,t);let{mainAxis:f,crossAxis:h,alignmentAxis:m}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof m=="number"&&(h=a==="end"?m*-1:m),l?{x:h*d,y:f*c}:{x:f*c,y:h*d}}const OO=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:s,placement:o,middlewareData:a}=e,l=await MO(e,t);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},RO=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i,platform:s}=e,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:b=>{let{x:w,y:k}=b;return{x:w,y:k}}},...c}=Nr(t,e),d={x:n,y:r},u=await s.detectOverflow(e,c),f=er(Tr(i)),h=Wh(f);let m=d[h],g=d[f];if(o){const b=h==="y"?"top":"left",w=h==="y"?"bottom":"right",k=m+u[b],v=m-u[w];m=Tf(k,m,v)}if(a){const b=f==="y"?"top":"left",w=f==="y"?"bottom":"right",k=g+u[b],v=g-u[w];g=Tf(k,g,v)}const y=l.fn({...e,[h]:m,[f]:g});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[h]:o,[f]:a}}}}}},IO=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=Nr(t,e),d={x:n,y:r},u=er(i),f=Wh(u);let h=d[f],m=d[u];const g=Nr(a,e),y=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){const k=f==="y"?"height":"width",v=s.reference[f]-s.floating[k]+y.mainAxis,E=s.reference[f]+s.reference[k]-y.mainAxis;h<v?h=v:h>E&&(h=E)}if(c){var b,w;const k=f==="y"?"width":"height",v=ex.has(Tr(i)),E=s.reference[u]-s.floating[k]+(v&&((b=o.offset)==null?void 0:b[u])||0)+(v?0:y.crossAxis),S=s.reference[u]+s.reference[k]+(v?0:((w=o.offset)==null?void 0:w[u])||0)-(v?y.crossAxis:0);m<E?m=E:m>S&&(m=S)}return{[f]:h,[u]:m}}}},DO=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:s,platform:o,elements:a}=e,{apply:l=()=>{},...c}=Nr(t,e),d=await o.detectOverflow(e,c),u=Tr(i),f=Gs(i),h=er(i)==="y",{width:m,height:g}=s.floating;let y,b;u==="top"||u==="bottom"?(y=u,b=f===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(b=u,y=f==="end"?"top":"bottom");const w=g-d.top-d.bottom,k=m-d.left-d.right,v=ai(g-d[y],w),E=ai(m-d[b],k),S=!e.middlewareData.shift;let C=v,N=E;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(N=k),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(C=w),S&&!f){const D=hn(d.left,0),j=hn(d.right,0),B=hn(d.top,0),F=hn(d.bottom,0);h?N=m-2*(D!==0||j!==0?D+j:hn(d.left,d.right)):C=g-2*(B!==0||F!==0?B+F:hn(d.top,d.bottom))}await l({...e,availableWidth:N,availableHeight:C});const M=await o.getDimensions(a.floating);return m!==M.width||g!==M.height?{reset:{rects:!0}}:{}}}};function sd(){return typeof window<"u"}function qs(t){return tx(t)?(t.nodeName||"").toLowerCase():"#document"}function yn(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function ur(t){var e;return(e=(tx(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function tx(t){return sd()?t instanceof Node||t instanceof yn(t).Node:!1}function Fn(t){return sd()?t instanceof Element||t instanceof yn(t).Element:!1}function Dr(t){return sd()?t instanceof HTMLElement||t instanceof yn(t).HTMLElement:!1}function Ug(t){return!sd()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof yn(t).ShadowRoot}function ka(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=Hn(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&i!=="inline"&&i!=="contents"}function LO(t){return/^(table|td|th)$/.test(qs(t))}function od(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const PO=/transform|translate|scale|rotate|perspective|filter/,BO=/paint|layout|strict|content/,xi=t=>!!t&&t!=="none";let hu;function Yh(t){const e=Fn(t)?Hn(t):t;return xi(e.transform)||xi(e.translate)||xi(e.scale)||xi(e.rotate)||xi(e.perspective)||!Jh()&&(xi(e.backdropFilter)||xi(e.filter))||PO.test(e.willChange||"")||BO.test(e.contain||"")}function jO(t){let e=li(t);for(;Dr(e)&&!Ls(e);){if(Yh(e))return e;if(od(e))return null;e=li(e)}return null}function Jh(){return hu==null&&(hu=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),hu}function Ls(t){return/^(html|body|#document)$/.test(qs(t))}function Hn(t){return yn(t).getComputedStyle(t)}function ad(t){return Fn(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function li(t){if(qs(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Ug(t)&&t.host||ur(t);return Ug(e)?e.host:e}function nx(t){const e=li(t);return Ls(e)?t.ownerDocument?t.ownerDocument.body:t.body:Dr(e)&&ka(e)?e:nx(e)}function Jo(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=nx(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),o=yn(i);if(s){const a=Mf(o);return e.concat(o,o.visualViewport||[],ka(i)?i:[],a&&n?Jo(a):[])}else return e.concat(i,Jo(i,[],n))}function Mf(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function rx(t){const e=Hn(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=Dr(t),s=i?t.offsetWidth:n,o=i?t.offsetHeight:r,a=Yl(n)!==s||Yl(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function Xh(t){return Fn(t)?t:t.contextElement}function bs(t){const e=Xh(t);if(!Dr(e))return rr(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=rx(e);let o=(s?Yl(n.width):n.width)/r,a=(s?Yl(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const $O=rr(0);function ix(t){const e=yn(t);return!Jh()||!e.visualViewport?$O:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function FO(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==yn(t)?!1:e}function Vi(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=Xh(t);let o=rr(1);e&&(r?Fn(r)&&(o=bs(r)):o=bs(t));const a=FO(s,n,r)?ix(s):rr(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,d=i.width/o.x,u=i.height/o.y;if(s){const f=yn(s),h=r&&Fn(r)?yn(r):r;let m=f,g=Mf(m);for(;g&&r&&h!==m;){const y=bs(g),b=g.getBoundingClientRect(),w=Hn(g),k=b.left+(g.clientLeft+parseFloat(w.paddingLeft))*y.x,v=b.top+(g.clientTop+parseFloat(w.paddingTop))*y.y;l*=y.x,c*=y.y,d*=y.x,u*=y.y,l+=k,c+=v,m=yn(g),g=Mf(m)}}return Xl({width:d,height:u,x:l,y:c})}function ld(t,e){const n=ad(t).scrollLeft;return e?e.left+n:Vi(ur(t)).left+n}function sx(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-ld(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function HO(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",o=ur(r),a=e?od(e.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=rr(1);const d=rr(0),u=Dr(r);if((u||!u&&!s)&&((qs(r)!=="body"||ka(o))&&(l=ad(r)),u)){const h=Vi(r);c=bs(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}const f=o&&!u&&!s?sx(o,l):rr(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+d.x+f.x,y:n.y*c.y-l.scrollTop*c.y+d.y+f.y}}function zO(t){return Array.from(t.getClientRects())}function UO(t){const e=ur(t),n=ad(t),r=t.ownerDocument.body,i=hn(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=hn(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+ld(t);const a=-n.scrollTop;return Hn(r).direction==="rtl"&&(o+=hn(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}const Vg=25;function VO(t,e){const n=yn(t),r=ur(t),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const d=Jh();(!d||d&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const c=ld(r);if(c<=0){const d=r.ownerDocument,u=d.body,f=getComputedStyle(u),h=d.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,m=Math.abs(r.clientWidth-u.clientWidth-h);m<=Vg&&(s-=m)}else c<=Vg&&(s+=c);return{width:s,height:o,x:a,y:l}}function KO(t,e){const n=Vi(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=Dr(t)?bs(t):rr(1),o=t.clientWidth*s.x,a=t.clientHeight*s.y,l=i*s.x,c=r*s.y;return{width:o,height:a,x:l,y:c}}function Kg(t,e,n){let r;if(e==="viewport")r=VO(t,n);else if(e==="document")r=UO(ur(t));else if(Fn(e))r=KO(e,n);else{const i=ix(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Xl(r)}function ox(t,e){const n=li(t);return n===e||!Fn(n)||Ls(n)?!1:Hn(n).position==="fixed"||ox(n,e)}function WO(t,e){const n=e.get(t);if(n)return n;let r=Jo(t,[],!1).filter(a=>Fn(a)&&qs(a)!=="body"),i=null;const s=Hn(t).position==="fixed";let o=s?li(t):t;for(;Fn(o)&&!Ls(o);){const a=Hn(o),l=Yh(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||ka(o)&&!l&&ox(t,o))?r=r.filter(d=>d!==o):i=a,o=li(o)}return e.set(t,r),r}function GO(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?od(e)?[]:WO(e,this._c):[].concat(n),r],a=Kg(e,o[0],i);let l=a.top,c=a.right,d=a.bottom,u=a.left;for(let f=1;f<o.length;f++){const h=Kg(e,o[f],i);l=hn(h.top,l),c=ai(h.right,c),d=ai(h.bottom,d),u=hn(h.left,u)}return{width:c-u,height:d-l,x:u,y:l}}function qO(t){const{width:e,height:n}=rx(t);return{width:e,height:n}}function YO(t,e,n){const r=Dr(e),i=ur(e),s=n==="fixed",o=Vi(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=rr(0);function c(){l.x=ld(i)}if(r||!r&&!s)if((qs(e)!=="body"||ka(i))&&(a=ad(e)),r){const h=Vi(e,!0,s,e);l.x=h.x+e.clientLeft,l.y=h.y+e.clientTop}else i&&c();s&&!r&&i&&c();const d=i&&!r&&!s?sx(i,a):rr(0),u=o.left+a.scrollLeft-l.x-d.x,f=o.top+a.scrollTop-l.y-d.y;return{x:u,y:f,width:o.width,height:o.height}}function pu(t){return Hn(t).position==="static"}function Wg(t,e){if(!Dr(t)||Hn(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return ur(t)===n&&(n=n.ownerDocument.body),n}function ax(t,e){const n=yn(t);if(od(t))return n;if(!Dr(t)){let i=li(t);for(;i&&!Ls(i);){if(Fn(i)&&!pu(i))return i;i=li(i)}return n}let r=Wg(t,e);for(;r&&LO(r)&&pu(r);)r=Wg(r,e);return r&&Ls(r)&&pu(r)&&!Yh(r)?n:r||jO(t)||n}const JO=async function(t){const e=this.getOffsetParent||ax,n=this.getDimensions,r=await n(t.floating);return{reference:YO(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function XO(t){return Hn(t).direction==="rtl"}const ZO={convertOffsetParentRelativeRectToViewportRelativeRect:HO,getDocumentElement:ur,getClippingRect:GO,getOffsetParent:ax,getElementRects:JO,getClientRects:zO,getDimensions:qO,getScale:bs,isElement:Fn,isRTL:XO};function lx(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function QO(t,e){let n=null,r;const i=ur(t);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const c=t.getBoundingClientRect(),{left:d,top:u,width:f,height:h}=c;if(a||e(),!f||!h)return;const m=Va(u),g=Va(i.clientWidth-(d+f)),y=Va(i.clientHeight-(u+h)),b=Va(d),k={rootMargin:-m+"px "+-g+"px "+-y+"px "+-b+"px",threshold:hn(0,ai(1,l))||1};let v=!0;function E(S){const C=S[0].intersectionRatio;if(C!==l){if(!v)return o();C?o(!1,C):r=setTimeout(()=>{o(!1,1e-7)},1e3)}C===1&&!lx(c,t.getBoundingClientRect())&&o(),v=!1}try{n=new IntersectionObserver(E,{...k,root:i.ownerDocument})}catch{n=new IntersectionObserver(E,k)}n.observe(t)}return o(!0),s}function eR(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=Xh(t),d=i||s?[...c?Jo(c):[],...e?Jo(e):[]]:[];d.forEach(b=>{i&&b.addEventListener("scroll",n,{passive:!0}),s&&b.addEventListener("resize",n)});const u=c&&a?QO(c,n):null;let f=-1,h=null;o&&(h=new ResizeObserver(b=>{let[w]=b;w&&w.target===c&&h&&e&&(h.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var k;(k=h)==null||k.observe(e)})),n()}),c&&!l&&h.observe(c),e&&h.observe(e));let m,g=l?Vi(t):null;l&&y();function y(){const b=Vi(t);g&&!lx(g,b)&&n(),g=b,m=requestAnimationFrame(y)}return n(),()=>{var b;d.forEach(w=>{i&&w.removeEventListener("scroll",n),s&&w.removeEventListener("resize",n)}),u?.(),(b=h)==null||b.disconnect(),h=null,l&&cancelAnimationFrame(m)}}const tR=OO,nR=RO,rR=TO,iR=DO,sR=AO,Gg=NO,oR=IO,aR=(t,e,n)=>{const r=new Map,i={platform:ZO,...n},s={...i.platform,_c:r};return _O(t,e,{...i,platform:s})};var lR=typeof document<"u",cR=function(){},El=lR?x.useLayoutEffect:cR;function Zl(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!Zl(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&t.$$typeof)&&!Zl(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function cx(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function qg(t,e){const n=cx(t);return Math.round(e*n)/n}function mu(t){const e=x.useRef(t);return El(()=>{e.current=t}),e}function dR(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=t,[d,u]=x.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[f,h]=x.useState(r);Zl(f,r)||h(r);const[m,g]=x.useState(null),[y,b]=x.useState(null),w=x.useCallback(T=>{T!==S.current&&(S.current=T,g(T))},[]),k=x.useCallback(T=>{T!==C.current&&(C.current=T,b(T))},[]),v=s||m,E=o||y,S=x.useRef(null),C=x.useRef(null),N=x.useRef(d),M=l!=null,D=mu(l),j=mu(i),B=mu(c),F=x.useCallback(()=>{if(!S.current||!C.current)return;const T={placement:e,strategy:n,middleware:f};j.current&&(T.platform=j.current),aR(S.current,C.current,T).then(P=>{const Y={...P,isPositioned:B.current!==!1};G.current&&!Zl(N.current,Y)&&(N.current=Y,id.flushSync(()=>{u(Y)}))})},[f,e,n,j,B]);El(()=>{c===!1&&N.current.isPositioned&&(N.current.isPositioned=!1,u(T=>({...T,isPositioned:!1})))},[c]);const G=x.useRef(!1);El(()=>(G.current=!0,()=>{G.current=!1}),[]),El(()=>{if(v&&(S.current=v),E&&(C.current=E),v&&E){if(D.current)return D.current(v,E,F);F()}},[v,E,F,D,M]);const q=x.useMemo(()=>({reference:S,floating:C,setReference:w,setFloating:k}),[w,k]),W=x.useMemo(()=>({reference:v,floating:E}),[v,E]),A=x.useMemo(()=>{const T={position:n,left:0,top:0};if(!W.floating)return T;const P=qg(W.floating,d.x),Y=qg(W.floating,d.y);return a?{...T,transform:"translate("+P+"px, "+Y+"px)",...cx(W.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:P,top:Y}},[n,a,W.floating,d.x,d.y]);return x.useMemo(()=>({...d,update:F,refs:q,elements:W,floatingStyles:A}),[d,F,q,W,A])}const uR=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:i}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?Gg({element:r.current,padding:i}).fn(n):{}:r?Gg({element:r,padding:i}).fn(n):{}}}},fR=(t,e)=>{const n=tR(t);return{name:n.name,fn:n.fn,options:[t,e]}},hR=(t,e)=>{const n=nR(t);return{name:n.name,fn:n.fn,options:[t,e]}},pR=(t,e)=>({fn:oR(t).fn,options:[t,e]}),mR=(t,e)=>{const n=rR(t);return{name:n.name,fn:n.fn,options:[t,e]}},gR=(t,e)=>{const n=iR(t);return{name:n.name,fn:n.fn,options:[t,e]}},yR=(t,e)=>{const n=sR(t);return{name:n.name,fn:n.fn,options:[t,e]}},bR=(t,e)=>{const n=uR(t);return{name:n.name,fn:n.fn,options:[t,e]}};var vR="Arrow",dx=x.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...s}=t;return p.jsx(zn.svg,{...s,ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:p.jsx("polygon",{points:"0,0 30,0 15,10"})})});dx.displayName=vR;var xR=dx;function wR(t){const[e,n]=x.useState(void 0);return oi(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=t.offsetWidth,a=t.offsetHeight;n({width:o,height:a})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var Zh="Popper",[ux,cd]=Vh(Zh),[ER,fx]=ux(Zh),hx=t=>{const{__scopePopper:e,children:n}=t,[r,i]=x.useState(null);return p.jsx(ER,{scope:e,anchor:r,onAnchorChange:i,children:n})};hx.displayName=Zh;var px="PopperAnchor",mx=x.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,s=fx(px,n),o=x.useRef(null),a=dr(e,o),l=x.useRef(null);return x.useEffect(()=>{const c=l.current;l.current=r?.current||o.current,c!==l.current&&s.onAnchorChange(l.current)}),r?null:p.jsx(zn.div,{...i,ref:a})});mx.displayName=px;var Qh="PopperContent",[kR,SR]=ux(Qh),gx=x.forwardRef((t,e)=>{const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:d=0,sticky:u="partial",hideWhenDetached:f=!1,updatePositionStrategy:h="optimized",onPlaced:m,...g}=t,y=fx(Qh,n),[b,w]=x.useState(null),k=dr(e,be=>w(be)),[v,E]=x.useState(null),S=wR(v),C=S?.width??0,N=S?.height??0,M=r+(s!=="center"?"-"+s:""),D=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},j=Array.isArray(c)?c:[c],B=j.length>0,F={padding:D,boundary:j.filter(_R),altBoundary:B},{refs:G,floatingStyles:q,placement:W,isPositioned:A,middlewareData:T}=dR({strategy:"fixed",placement:M,whileElementsMounted:(...be)=>eR(...be,{animationFrame:h==="always"}),elements:{reference:y.anchor},middleware:[fR({mainAxis:i+N,alignmentAxis:o}),l&&hR({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?pR():void 0,...F}),l&&mR({...F}),gR({...F,apply:({elements:be,rects:Be,availableWidth:Ie,availableHeight:Le})=>{const{width:ze,height:Pe}=Be.reference,je=be.floating.style;je.setProperty("--radix-popper-available-width",`${Ie}px`),je.setProperty("--radix-popper-available-height",`${Le}px`),je.setProperty("--radix-popper-anchor-width",`${ze}px`),je.setProperty("--radix-popper-anchor-height",`${Pe}px`)}}),v&&bR({element:v,padding:a}),NR({arrowWidth:C,arrowHeight:N}),f&&yR({strategy:"referenceHidden",...F})]}),[P,Y]=vx(W),te=Ds(m);oi(()=>{A&&te?.()},[A,te]);const pe=T.arrow?.x,Q=T.arrow?.y,X=T.arrow?.centerOffset!==0,[ne,Ee]=x.useState();return oi(()=>{b&&Ee(window.getComputedStyle(b).zIndex)},[b]),p.jsx("div",{ref:G.setFloating,"data-radix-popper-content-wrapper":"",style:{...q,transform:A?q.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ne,"--radix-popper-transform-origin":[T.transformOrigin?.x,T.transformOrigin?.y].join(" "),...T.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:p.jsx(kR,{scope:n,placedSide:P,onArrowChange:E,arrowX:pe,arrowY:Q,shouldHideArrow:X,children:p.jsx(zn.div,{"data-side":P,"data-align":Y,...g,ref:k,style:{...g.style,animation:A?void 0:"none"}})})})});gx.displayName=Qh;var yx="PopperArrow",CR={top:"bottom",right:"left",bottom:"top",left:"right"},bx=x.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,s=SR(yx,r),o=CR[s.placedSide];return p.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:p.jsx(xR,{...i,ref:n,style:{...i.style,display:"block"}})})});bx.displayName=yx;function _R(t){return t!==null}var NR=t=>({name:"transformOrigin",options:t,fn(e){const{placement:n,rects:r,middlewareData:i}=e,o=i.arrow?.centerOffset!==0,a=o?0:t.arrowWidth,l=o?0:t.arrowHeight,[c,d]=vx(n),u={start:"0%",center:"50%",end:"100%"}[d],f=(i.arrow?.x??0)+a/2,h=(i.arrow?.y??0)+l/2;let m="",g="";return c==="bottom"?(m=o?u:`${f}px`,g=`${-l}px`):c==="top"?(m=o?u:`${f}px`,g=`${r.floating.height+l}px`):c==="right"?(m=`${-l}px`,g=o?u:`${h}px`):c==="left"&&(m=`${r.floating.width+l}px`,g=o?u:`${h}px`),{data:{x:m,y:g}}}});function vx(t){const[e,n="center"]=t.split("-");return[e,n]}var xx=hx,ep=mx,wx=gx,Ex=bx,TR="Portal",kx=x.forwardRef((t,e)=>{const{container:n,...r}=t,[i,s]=x.useState(!1);oi(()=>s(!0),[]);const o=n||i&&globalThis?.document?.body;return o?Fv.createPortal(p.jsx(zn.div,{...r,ref:e}),o):null});kx.displayName=TR;function AR(t,e){return x.useReducer((n,r)=>e[n][r]??n,t)}var dd=t=>{const{present:e,children:n}=t,r=MR(e),i=typeof n=="function"?n({present:r.isPresent}):x.Children.only(n),s=dr(r.ref,OR(i));return typeof n=="function"||r.isPresent?x.cloneElement(i,{ref:s}):null};dd.displayName="Presence";function MR(t){const[e,n]=x.useState(),r=x.useRef(null),i=x.useRef(t),s=x.useRef("none"),o=t?"mounted":"unmounted",[a,l]=AR(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const c=Ka(r.current);s.current=a==="mounted"?c:"none"},[a]),oi(()=>{const c=r.current,d=i.current;if(d!==t){const f=s.current,h=Ka(c);t?l("MOUNT"):h==="none"||c?.display==="none"?l("UNMOUNT"):l(d&&f!==h?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),oi(()=>{if(e){let c;const d=e.ownerDocument.defaultView??window,u=h=>{const g=Ka(r.current).includes(CSS.escape(h.animationName));if(h.target===e&&g&&(l("ANIMATION_END"),!i.current)){const y=e.style.animationFillMode;e.style.animationFillMode="forwards",c=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},f=h=>{h.target===e&&(s.current=Ka(r.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",u),e.addEventListener("animationend",u),()=>{d.clearTimeout(c),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",u),e.removeEventListener("animationend",u)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:x.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function Ka(t){return t?.animationName||"none"}function OR(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var RR=lh[" useInsertionEffect ".trim().toString()]||oi;function Sx({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,s,o]=IR({defaultProp:e,onChange:n}),a=t!==void 0,l=a?t:i;{const d=x.useRef(t!==void 0);x.useEffect(()=>{const u=d.current;u!==a&&console.warn(`${r} is changing from ${u?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=a},[a,r])}const c=x.useCallback(d=>{if(a){const u=DR(d)?d(t):d;u!==t&&o.current?.(u)}else s(d)},[a,t,s,o]);return[l,c]}function IR({defaultProp:t,onChange:e}){const[n,r]=x.useState(t),i=x.useRef(n),s=x.useRef(e);return RR(()=>{s.current=e},[e]),x.useEffect(()=>{i.current!==n&&(s.current?.(n),i.current=n)},[n,i]),[n,r,s]}function DR(t){return typeof t=="function"}var LR=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),PR="VisuallyHidden",Cx=x.forwardRef((t,e)=>p.jsx(zn.span,{...t,ref:e,style:{...LR,...t.style}}));Cx.displayName=PR;var BR=Cx,[ud]=Vh("Tooltip",[cd]),fd=cd(),_x="TooltipProvider",jR=700,Of="tooltip.open",[$R,tp]=ud(_x),Nx=t=>{const{__scopeTooltip:e,delayDuration:n=jR,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=t,o=x.useRef(!0),a=x.useRef(!1),l=x.useRef(0);return x.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),p.jsx($R,{scope:e,isOpenDelayedRef:o,delayDuration:n,onOpen:x.useCallback(()=>{window.clearTimeout(l.current),o.current=!1},[]),onClose:x.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:x.useCallback(c=>{a.current=c},[]),disableHoverableContent:i,children:s})};Nx.displayName=_x;var Xo="Tooltip",[FR,hd]=ud(Xo),Tx=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:a}=t,l=tp(Xo,t.__scopeTooltip),c=fd(e),[d,u]=x.useState(null),f=Zv(),h=x.useRef(0),m=o??l.disableHoverableContent,g=a??l.delayDuration,y=x.useRef(!1),[b,w]=Sx({prop:r,defaultProp:i??!1,onChange:C=>{C?(l.onOpen(),document.dispatchEvent(new CustomEvent(Of))):l.onClose(),s?.(C)},caller:Xo}),k=x.useMemo(()=>b?y.current?"delayed-open":"instant-open":"closed",[b]),v=x.useCallback(()=>{window.clearTimeout(h.current),h.current=0,y.current=!1,w(!0)},[w]),E=x.useCallback(()=>{window.clearTimeout(h.current),h.current=0,w(!1)},[w]),S=x.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{y.current=!0,w(!0),h.current=0},g)},[g,w]);return x.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),p.jsx(xx,{...c,children:p.jsx(FR,{scope:e,contentId:f,open:b,stateAttribute:k,trigger:d,onTriggerChange:u,onTriggerEnter:x.useCallback(()=>{l.isOpenDelayedRef.current?S():v()},[l.isOpenDelayedRef,S,v]),onTriggerLeave:x.useCallback(()=>{m?E():(window.clearTimeout(h.current),h.current=0)},[E,m]),onOpen:v,onClose:E,disableHoverableContent:m,children:n})})};Tx.displayName=Xo;var Rf="TooltipTrigger",Ax=x.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=hd(Rf,n),s=tp(Rf,n),o=fd(n),a=x.useRef(null),l=dr(e,a,i.onTriggerChange),c=x.useRef(!1),d=x.useRef(!1),u=x.useCallback(()=>c.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener("pointerup",u),[u]),p.jsx(ep,{asChild:!0,...o,children:p.jsx(zn.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:nn(t.onPointerMove,f=>{f.pointerType!=="touch"&&!d.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:nn(t.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:nn(t.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener("pointerup",u,{once:!0})}),onFocus:nn(t.onFocus,()=>{c.current||i.onOpen()}),onBlur:nn(t.onBlur,i.onClose),onClick:nn(t.onClick,i.onClose)})})});Ax.displayName=Rf;var HR="TooltipPortal",[CH,zR]=ud(HR,{forceMount:void 0}),Ps="TooltipContent",Mx=x.forwardRef((t,e)=>{const n=zR(Ps,t.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=t,o=hd(Ps,t.__scopeTooltip);return p.jsx(dd,{present:r||o.open,children:o.disableHoverableContent?p.jsx(Ox,{side:i,...s,ref:e}):p.jsx(UR,{side:i,...s,ref:e})})}),UR=x.forwardRef((t,e)=>{const n=hd(Ps,t.__scopeTooltip),r=tp(Ps,t.__scopeTooltip),i=x.useRef(null),s=dr(e,i),[o,a]=x.useState(null),{trigger:l,onClose:c}=n,d=i.current,{onPointerInTransitChange:u}=r,f=x.useCallback(()=>{a(null),u(!1)},[u]),h=x.useCallback((m,g)=>{const y=m.currentTarget,b={x:m.clientX,y:m.clientY},w=qR(b,y.getBoundingClientRect()),k=YR(b,w),v=JR(g.getBoundingClientRect()),E=ZR([...k,...v]);a(E),u(!0)},[u]);return x.useEffect(()=>()=>f(),[f]),x.useEffect(()=>{if(l&&d){const m=y=>h(y,d),g=y=>h(y,l);return l.addEventListener("pointerleave",m),d.addEventListener("pointerleave",g),()=>{l.removeEventListener("pointerleave",m),d.removeEventListener("pointerleave",g)}}},[l,d,h,f]),x.useEffect(()=>{if(o){const m=g=>{const y=g.target,b={x:g.clientX,y:g.clientY},w=l?.contains(y)||d?.contains(y),k=!XR(b,o);w?f():k&&(f(),c())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[l,d,o,c,f]),p.jsx(Ox,{...t,ref:s})}),[VR,KR]=ud(Xo,{isInside:!1}),WR=QM("TooltipContent"),Ox=x.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=t,l=hd(Ps,n),c=fd(n),{onClose:d}=l;return x.useEffect(()=>(document.addEventListener(Of,d),()=>document.removeEventListener(Of,d)),[d]),x.useEffect(()=>{if(l.trigger){const u=f=>{f.target?.contains(l.trigger)&&d()};return window.addEventListener("scroll",u,{capture:!0}),()=>window.removeEventListener("scroll",u,{capture:!0})}},[l.trigger,d]),p.jsx(Kh,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:u=>u.preventDefault(),onDismiss:d,children:p.jsxs(wx,{"data-state":l.stateAttribute,...c,...a,ref:e,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[p.jsx(WR,{children:r}),p.jsx(VR,{scope:n,isInside:!0,children:p.jsx(BR,{id:l.contentId,role:"tooltip",children:i||r})})]})})});Mx.displayName=Ps;var Rx="TooltipArrow",GR=x.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=fd(n);return KR(Rx,n).isInside?null:p.jsx(Ex,{...i,...r,ref:e})});GR.displayName=Rx;function qR(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),i=Math.abs(e.right-t.x),s=Math.abs(e.left-t.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function YR(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function JR(t){const{top:e,right:n,bottom:r,left:i}=t;return[{x:i,y:e},{x:n,y:e},{x:n,y:r},{x:i,y:r}]}function XR(t,e){const{x:n,y:r}=t;let i=!1;for(let s=0,o=e.length-1;s<e.length;o=s++){const a=e[s],l=e[o],c=a.x,d=a.y,u=l.x,f=l.y;d>r!=f>r&&n<(u-c)*(r-d)/(f-d)+c&&(i=!i)}return i}function ZR(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),QR(e)}function QR(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const i=t[r];for(;e.length>=2;){const s=e[e.length-1],o=e[e.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))e.pop();else break}e.push(i)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const i=t[r];for(;n.length>=2;){const s=n[n.length-1],o=n[n.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))n.pop();else break}n.push(i)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var eI=Nx,tI=Tx,nI=Ax,Ix=Mx;const rI=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Dx=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();var iI={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const sI=x.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...a},l)=>x.createElement("svg",{ref:l,...iI,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:Dx("lucide",i),...a},[...o.map(([c,d])=>x.createElement(c,d)),...Array.isArray(s)?s:[s]]));const le=(t,e)=>{const n=x.forwardRef(({className:r,...i},s)=>x.createElement(sI,{ref:s,iconNode:e,className:Dx(`lucide-${rI(t)}`,r),...i}));return n.displayName=`${t}`,n};const oI=[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],Lx=le("AlignCenter",oI);const aI=[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],Px=le("AlignLeft",aI);const lI=[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],Bx=le("AlignRight",lI);const cI=[["path",{d:"M22 17h-3",key:"1lwga1"}],["path",{d:"M22 7h-5",key:"o2endc"}],["path",{d:"M5 17H2",key:"1gx9xc"}],["path",{d:"M7 7H2",key:"6bq26l"}],["rect",{x:"5",y:"14",width:"14",height:"6",rx:"2",key:"1qrzuf"}],["rect",{x:"7",y:"4",width:"10",height:"6",rx:"2",key:"we8e9z"}]],dI=le("AlignVerticalDistributeCenter",cI);const uI=[["rect",{width:"14",height:"6",x:"5",y:"14",rx:"2",key:"jmoj9s"}],["rect",{width:"10",height:"6",x:"7",y:"4",rx:"2",key:"aza5on"}],["path",{d:"M2 20h20",key:"owomy5"}],["path",{d:"M2 10h20",key:"1ir3d8"}]],fI=le("AlignVerticalDistributeEnd",uI);const hI=[["rect",{width:"14",height:"6",x:"5",y:"14",rx:"2",key:"jmoj9s"}],["rect",{width:"10",height:"6",x:"7",y:"4",rx:"2",key:"aza5on"}],["path",{d:"M2 14h20",key:"myj16y"}],["path",{d:"M2 4h20",key:"mda7wb"}]],pI=le("AlignVerticalDistributeStart",hI);const mI=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],gI=le("ArrowDown",mI);const yI=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],bI=le("ArrowUp",yI);const vI=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]],xI=le("Ban",vI);const wI=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],jx=le("Bold",wI);const EI=[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],vs=le("Braces",EI);const kI=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],$x=le("ChevronDown",kI);const SI=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],CI=le("ChevronRight",SI);const _I=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],NI=le("ChevronUp",_I);const TI=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],Fx=le("CodeXml",TI);const AI=[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]],MI=le("Code",AI);const OI=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Hx=le("Columns2",OI);const RI=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],II=le("Columns3",RI);const DI=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],LI=le("Copy",DI);const PI=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M14.83 14.83a4 4 0 1 1 0-5.66",key:"1i56pz"}]],BI=le("Copyright",PI);const jI=[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]],zx=le("CornerDownLeft",jI);const $I=[["circle",{cx:"12",cy:"6",r:"1",key:"1bh7o1"}],["line",{x1:"5",x2:"19",y1:"12",y2:"12",key:"13b5wn"}],["circle",{cx:"12",cy:"18",r:"1",key:"lqb9t5"}]],FI=le("Divide",$I);const HI=[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]],Ux=le("Eraser",HI);const zI=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],UI=le("Eye",zI);const VI=[["path",{d:"M4 16v-2.38C4 11.5 2.97 10.5 3 8c.03-2.72 1.49-6 4.5-6C9.37 2 10 3.8 10 5.5c0 3.11-2 5.66-2 8.68V16a2 2 0 1 1-4 0Z",key:"1dudjm"}],["path",{d:"M20 20v-2.38c0-2.12 1.03-3.12 1-5.62-.03-2.72-1.49-6-4.5-6C14.63 6 14 7.8 14 9.5c0 3.11 2 5.66 2 8.68V20a2 2 0 1 0 4 0Z",key:"l2t8xc"}],["path",{d:"M16 17h4",key:"1dejxt"}],["path",{d:"M4 13h4",key:"1bwh8b"}]],np=le("Footprints",VI);const KI=[["path",{d:"M18 11.5V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1.4",key:"edstyy"}],["path",{d:"M14 10V8a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"19wdwo"}],["path",{d:"M10 9.9V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v5",key:"1lugqo"}],["path",{d:"M6 14a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1hbeus"}],["path",{d:"M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-4a8 8 0 0 1-8-8 2 2 0 1 1 4 0",key:"1etffm"}]],WI=le("Grab",KI);const GI=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],qI=le("GripVertical",GI);const YI=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],rp=le("Heading1",YI);const JI=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],Vx=le("Heading2",JI);const XI=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]],Kx=le("Heading3",XI);const ZI=[["path",{d:"M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21",key:"9csbqa"}],["path",{d:"m14 19 3 3v-5.5",key:"9ldu5r"}],["path",{d:"m17 22 3-3",key:"1nkfve"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]],Wx=le("ImageDown",ZI);const QI=[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]],e2=le("ImageOff",QI);const t2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],ip=le("Image",t2);const n2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Gx=le("Info",n2);const r2=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],qx=le("Italic",r2);const i2=[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]],s2=le("LayoutTemplate",i2);const o2=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],If=le("Link",o2);const a2=[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]],sp=le("ListOrdered",a2);const l2=[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]],op=le("List",l2);const c2=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],d2=le("LoaderCircle",c2);const u2=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],f2=le("LockOpen",u2);const h2=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],p2=le("Lock",h2);const m2=[["path",{d:"M5 12h14",key:"1ays0h"}]],g2=le("Minus",m2);const y2=[["path",{d:"M12.586 12.586 19 19",key:"ea5xo7"}],["path",{d:"M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z",key:"277e5u"}]],b2=le("MousePointer",y2);const v2=[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m8 18 4 4 4-4",key:"bh5tu3"}],["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}]],x2=le("MoveVertical",v2);const w2=[["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",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],E2=le("Pencil",w2);const k2=[["path",{d:"M13 4v16",key:"8vvj80"}],["path",{d:"M17 4v16",key:"7dpous"}],["path",{d:"M19 4H9.5a4.5 4.5 0 0 0 0 9H13",key:"sh4n9v"}]],Yx=le("Pilcrow",k2);const S2=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],C2=le("Plus",S2);const _2=[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]],Jx=le("RectangleHorizontal",_2);const N2=[["path",{d:"m2 9 3-3 3 3",key:"1ltn5i"}],["path",{d:"M13 18H7a2 2 0 0 1-2-2V6",key:"1r6tfw"}],["path",{d:"m22 15-3 3-3-3",key:"4rnwn2"}],["path",{d:"M11 6h6a2 2 0 0 1 2 2v10",key:"2f72bc"}]],Xx=le("Repeat2",N2);const T2=[["line",{x1:"3",x2:"21",y1:"12",y2:"12",key:"10d38w"}],["polyline",{points:"8 8 12 4 16 8",key:"zo8t4w"}],["polyline",{points:"16 16 12 20 8 16",key:"1oyrid"}]],A2=le("SeparatorHorizontal",T2);const M2=[["line",{x1:"4",x2:"4",y1:"21",y2:"14",key:"1p332r"}],["line",{x1:"4",x2:"4",y1:"10",y2:"3",key:"gb41h5"}],["line",{x1:"12",x2:"12",y1:"21",y2:"12",key:"hf2csr"}],["line",{x1:"12",x2:"12",y1:"8",y2:"3",key:"1kfi7u"}],["line",{x1:"20",x2:"20",y1:"21",y2:"16",key:"1lhrwl"}],["line",{x1:"20",x2:"20",y1:"12",y2:"3",key:"16vvfq"}],["line",{x1:"2",x2:"6",y1:"14",y2:"14",key:"1uebub"}],["line",{x1:"10",x2:"14",y1:"8",y2:"8",key:"1yglbp"}],["line",{x1:"18",x2:"22",y1:"16",y2:"16",key:"1jxqpz"}]],O2=le("SlidersVertical",M2);const R2=[["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]],I2=le("Space",R2);const D2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 8h8v8",key:"b65dnt"}],["path",{d:"m8 16 8-8",key:"13b9ih"}]],L2=le("SquareArrowUpRight",D2);const P2=[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]],Zx=le("Strikethrough",P2);const B2=[["path",{d:"M17 6H3",key:"16j9eg"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 18H8",key:"1wfozv"}],["path",{d:"M3 12v6",key:"fv4c87"}]],j2=le("TextQuote",B2);const $2=[["path",{d:"M17 6.1H3",key:"wptmhv"}],["path",{d:"M21 12.1H3",key:"1j38uz"}],["path",{d:"M15.1 18H3",key:"1nb16a"}]],F2=le("Text",$2);const H2=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],z2=le("Trash2",H2);const U2=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]],Qx=le("Trash",U2);const V2=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],K2=le("TriangleAlert",V2);const W2=[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]],ew=le("Underline",W2);const G2=[["path",{d:"M21 17v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2",key:"mrq65r"}],["path",{d:"M21 7V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2",key:"be3xqs"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]],q2=le("View",G2);var Y2=Symbol.for("react.lazy"),Ql=lh[" use ".trim().toString()];function J2(t){return typeof t=="object"&&t!==null&&"then"in t}function tw(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===Y2&&"_payload"in t&&J2(t._payload)}function X2(t){const e=Q2(t),n=x.forwardRef((r,i)=>{let{children:s,...o}=r;tw(s)&&typeof Ql=="function"&&(s=Ql(s._payload));const a=x.Children.toArray(s),l=a.find(tD);if(l){const c=l.props.children,d=a.map(u=>u===l?x.Children.count(c)>1?x.Children.only(null):x.isValidElement(c)?c.props.children:null:u);return p.jsx(e,{...o,ref:i,children:x.isValidElement(c)?x.cloneElement(c,void 0,d):null})}return p.jsx(e,{...o,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}var Z2=X2("Slot");function Q2(t){const e=x.forwardRef((n,r)=>{let{children:i,...s}=n;if(tw(i)&&typeof Ql=="function"&&(i=Ql(i._payload)),x.isValidElement(i)){const o=rD(i),a=nD(s,i.props);return i.type!==x.Fragment&&(a.ref=r?Uh(r,o):o),x.cloneElement(i,a)}return x.Children.count(i)>1?x.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var eD=Symbol("radix.slottable");function tD(t){return x.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===eD}function nD(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function rD(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var gu=0;function iD(){x.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??Yg()),document.body.insertAdjacentElement("beforeend",t[1]??Yg()),gu++,()=>{gu===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),gu--}},[])}function Yg(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var yu="focusScope.autoFocusOnMount",bu="focusScope.autoFocusOnUnmount",Jg={bubbles:!1,cancelable:!0},sD="FocusScope",nw=x.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,l]=x.useState(null),c=Ds(i),d=Ds(s),u=x.useRef(null),f=dr(e,g=>l(g)),h=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(r){let g=function(k){if(h.paused||!a)return;const v=k.target;a.contains(v)?u.current=v:zr(u.current,{select:!0})},y=function(k){if(h.paused||!a)return;const v=k.relatedTarget;v!==null&&(a.contains(v)||zr(u.current,{select:!0}))},b=function(k){if(document.activeElement===document.body)for(const E of k)E.removedNodes.length>0&&zr(a)};document.addEventListener("focusin",g),document.addEventListener("focusout",y);const w=new MutationObserver(b);return a&&w.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",y),w.disconnect()}}},[r,a,h.paused]),x.useEffect(()=>{if(a){Zg.add(h);const g=document.activeElement;if(!a.contains(g)){const b=new CustomEvent(yu,Jg);a.addEventListener(yu,c),a.dispatchEvent(b),b.defaultPrevented||(oD(uD(rw(a)),{select:!0}),document.activeElement===g&&zr(a))}return()=>{a.removeEventListener(yu,c),setTimeout(()=>{const b=new CustomEvent(bu,Jg);a.addEventListener(bu,d),a.dispatchEvent(b),b.defaultPrevented||zr(g??document.body,{select:!0}),a.removeEventListener(bu,d),Zg.remove(h)},0)}}},[a,c,d,h]);const m=x.useCallback(g=>{if(!n&&!r||h.paused)return;const y=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,b=document.activeElement;if(y&&b){const w=g.currentTarget,[k,v]=aD(w);k&&v?!g.shiftKey&&b===v?(g.preventDefault(),n&&zr(k,{select:!0})):g.shiftKey&&b===k&&(g.preventDefault(),n&&zr(v,{select:!0})):b===w&&g.preventDefault()}},[n,r,h.paused]);return p.jsx(zn.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});nw.displayName=sD;function oD(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(zr(r,{select:e}),document.activeElement!==n)return}function aD(t){const e=rw(t),n=Xg(e,t),r=Xg(e.reverse(),t);return[n,r]}function rw(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Xg(t,e){for(const n of t)if(!lD(n,{upTo:e}))return n}function lD(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function cD(t){return t instanceof HTMLInputElement&&"select"in t}function zr(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&cD(t)&&e&&t.select()}}var Zg=dD();function dD(){let t=[];return{add(e){const n=t[0];e!==n&&n?.pause(),t=Qg(t,e),t.unshift(e)},remove(e){t=Qg(t,e),t[0]?.resume()}}}function Qg(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function uD(t){return t.filter(e=>e.tagName!=="A")}var fD=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},es=new WeakMap,Wa=new WeakMap,Ga={},vu=0,iw=function(t){return t&&(t.host||iw(t.parentNode))},hD=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=iw(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},pD=function(t,e,n,r){var i=hD(e,Array.isArray(t)?t:[t]);Ga[n]||(Ga[n]=new WeakMap);var s=Ga[n],o=[],a=new Set,l=new Set(i),c=function(u){!u||a.has(u)||(a.add(u),c(u.parentNode))};i.forEach(c);var d=function(u){!u||l.has(u)||Array.prototype.forEach.call(u.children,function(f){if(a.has(f))d(f);else try{var h=f.getAttribute(r),m=h!==null&&h!=="false",g=(es.get(f)||0)+1,y=(s.get(f)||0)+1;es.set(f,g),s.set(f,y),o.push(f),g===1&&m&&Wa.set(f,!0),y===1&&f.setAttribute(n,"true"),m||f.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",f,b)}})};return d(e),a.clear(),vu++,function(){o.forEach(function(u){var f=es.get(u)-1,h=s.get(u)-1;es.set(u,f),s.set(u,h),f||(Wa.has(u)||u.removeAttribute(r),Wa.delete(u)),h||u.removeAttribute(n)}),vu--,vu||(es=new WeakMap,es=new WeakMap,Wa=new WeakMap,Ga={})}},mD=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=fD(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),pD(r,i,n,"aria-hidden")):function(){return null}},Xn=function(){return Xn=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Xn.apply(this,arguments)};function sw(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function gD(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}var kl="right-scroll-bar-position",Sl="width-before-scroll-bar",yD="with-scroll-bars-hidden",bD="--removed-body-scroll-bar-size";function xu(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function vD(t,e){var n=x.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=e,n.facade}var xD=typeof window<"u"?x.useLayoutEffect:x.useEffect,ey=new WeakMap;function wD(t,e){var n=vD(null,function(r){return t.forEach(function(i){return xu(i,r)})});return xD(function(){var r=ey.get(n);if(r){var i=new Set(r),s=new Set(t),o=n.current;i.forEach(function(a){s.has(a)||xu(a,null)}),s.forEach(function(a){i.has(a)||xu(a,o)})}ey.set(n,t)},[t]),n}function ED(t){return t}function kD(t,e){e===void 0&&(e=ED);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(s){var o=e(s,r);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(s){for(r=!0;n.length;){var o=n;n=[],o.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(s),o=n}var l=function(){var d=o;o=[],d.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(d){o.push(d),c()},filter:function(d){return o=o.filter(d),n}}}};return i}function SD(t){t===void 0&&(t={});var e=kD(null);return e.options=Xn({async:!0,ssr:!1},t),e}var ow=function(t){var e=t.sideCar,n=sw(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return x.createElement(r,Xn({},n))};ow.isSideCarExport=!0;function CD(t,e){return t.useMedium(e),ow}var aw=SD(),wu=function(){},pd=x.forwardRef(function(t,e){var n=x.useRef(null),r=x.useState({onScrollCapture:wu,onWheelCapture:wu,onTouchMoveCapture:wu}),i=r[0],s=r[1],o=t.forwardProps,a=t.children,l=t.className,c=t.removeScrollBar,d=t.enabled,u=t.shards,f=t.sideCar,h=t.noRelative,m=t.noIsolation,g=t.inert,y=t.allowPinchZoom,b=t.as,w=b===void 0?"div":b,k=t.gapMode,v=sw(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=f,S=wD([n,e]),C=Xn(Xn({},v),i);return x.createElement(x.Fragment,null,d&&x.createElement(E,{sideCar:aw,removeScrollBar:c,shards:u,noRelative:h,noIsolation:m,inert:g,setCallbacks:s,allowPinchZoom:!!y,lockRef:n,gapMode:k}),o?x.cloneElement(x.Children.only(a),Xn(Xn({},C),{ref:S})):x.createElement(w,Xn({},C,{className:l,ref:S}),a))});pd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};pd.classNames={fullWidth:Sl,zeroRight:kl};var _D=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function ND(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=_D();return e&&t.setAttribute("nonce",e),t}function TD(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function AD(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var MD=function(){var t=0,e=null;return{add:function(n){t==0&&(e=ND())&&(TD(e,n),AD(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},OD=function(){var t=MD();return function(e,n){x.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},lw=function(){var t=OD(),e=function(n){var r=n.styles,i=n.dynamic;return t(r,i),null};return e},RD={left:0,top:0,right:0,gap:0},Eu=function(t){return parseInt(t||"",10)||0},ID=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],i=e[t==="padding"?"paddingRight":"marginRight"];return[Eu(n),Eu(r),Eu(i)]},DD=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return RD;var e=ID(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},LD=lw(),xs="data-scroll-locked",PD=function(t,e,n,r){var i=t.left,s=t.top,o=t.right,a=t.gap;return n===void 0&&(n="margin"),`
90
+ .`.concat(yD,` {
91
+ overflow: hidden `).concat(r,`;
92
+ padding-right: `).concat(a,"px ").concat(r,`;
93
+ }
94
+ body[`).concat(xs,`] {
95
+ overflow: hidden `).concat(r,`;
96
+ overscroll-behavior: contain;
97
+ `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
98
+ padding-left: `.concat(i,`px;
99
+ padding-top: `).concat(s,`px;
100
+ padding-right: `).concat(o,`px;
101
+ margin-left:0;
102
+ margin-top:0;
103
+ margin-right: `).concat(a,"px ").concat(r,`;
104
+ `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
105
+ }
106
+
107
+ .`).concat(kl,` {
108
+ right: `).concat(a,"px ").concat(r,`;
109
+ }
110
+
111
+ .`).concat(Sl,` {
112
+ margin-right: `).concat(a,"px ").concat(r,`;
113
+ }
114
+
115
+ .`).concat(kl," .").concat(kl,` {
116
+ right: 0 `).concat(r,`;
117
+ }
118
+
119
+ .`).concat(Sl," .").concat(Sl,` {
120
+ margin-right: 0 `).concat(r,`;
121
+ }
122
+
123
+ body[`).concat(xs,`] {
124
+ `).concat(bD,": ").concat(a,`px;
125
+ }
126
+ `)},ty=function(){var t=parseInt(document.body.getAttribute(xs)||"0",10);return isFinite(t)?t:0},BD=function(){x.useEffect(function(){return document.body.setAttribute(xs,(ty()+1).toString()),function(){var t=ty()-1;t<=0?document.body.removeAttribute(xs):document.body.setAttribute(xs,t.toString())}},[])},jD=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;BD();var s=x.useMemo(function(){return DD(i)},[i]);return x.createElement(LD,{styles:PD(s,!e,i,n?"":"!important")})},Df=!1;if(typeof window<"u")try{var qa=Object.defineProperty({},"passive",{get:function(){return Df=!0,!0}});window.addEventListener("test",qa,qa),window.removeEventListener("test",qa,qa)}catch{Df=!1}var ts=Df?{passive:!1}:!1,$D=function(t){return t.tagName==="TEXTAREA"},cw=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!$D(t)&&n[e]==="visible")},FD=function(t){return cw(t,"overflowY")},HD=function(t){return cw(t,"overflowX")},ny=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=dw(t,r);if(i){var s=uw(t,r),o=s[1],a=s[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},zD=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},UD=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},dw=function(t,e){return t==="v"?FD(e):HD(e)},uw=function(t,e){return t==="v"?zD(e):UD(e)},VD=function(t,e){return t==="h"&&e==="rtl"?-1:1},KD=function(t,e,n,r,i){var s=VD(t,window.getComputedStyle(e).direction),o=s*r,a=n.target,l=e.contains(a),c=!1,d=o>0,u=0,f=0;do{if(!a)break;var h=uw(t,a),m=h[0],g=h[1],y=h[2],b=g-y-s*m;(m||b)&&dw(t,a)&&(u+=b,f+=m);var w=a.parentNode;a=w&&w.nodeType===Node.DOCUMENT_FRAGMENT_NODE?w.host:w}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return(d&&Math.abs(u)<1||!d&&Math.abs(f)<1)&&(c=!0),c},Ya=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},ry=function(t){return[t.deltaX,t.deltaY]},iy=function(t){return t&&"current"in t?t.current:t},WD=function(t,e){return t[0]===e[0]&&t[1]===e[1]},GD=function(t){return`
127
+ .block-interactivity-`.concat(t,` {pointer-events: none;}
128
+ .allow-interactivity-`).concat(t,` {pointer-events: all;}
129
+ `)},qD=0,ns=[];function YD(t){var e=x.useRef([]),n=x.useRef([0,0]),r=x.useRef(),i=x.useState(qD++)[0],s=x.useState(lw)[0],o=x.useRef(t);x.useEffect(function(){o.current=t},[t]),x.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var g=gD([t.lockRef.current],(t.shards||[]).map(iy),!0).filter(Boolean);return g.forEach(function(y){return y.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),g.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=x.useCallback(function(g,y){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!o.current.allowPinchZoom;var b=Ya(g),w=n.current,k="deltaX"in g?g.deltaX:w[0]-b[0],v="deltaY"in g?g.deltaY:w[1]-b[1],E,S=g.target,C=Math.abs(k)>Math.abs(v)?"h":"v";if("touches"in g&&C==="h"&&S.type==="range")return!1;var N=window.getSelection(),M=N&&N.anchorNode,D=M?M===S||M.contains(S):!1;if(D)return!1;var j=ny(C,S);if(!j)return!0;if(j?E=C:(E=C==="v"?"h":"v",j=ny(C,S)),!j)return!1;if(!r.current&&"changedTouches"in g&&(k||v)&&(r.current=E),!E)return!0;var B=r.current||E;return KD(B,y,g,B==="h"?k:v)},[]),l=x.useCallback(function(g){var y=g;if(!(!ns.length||ns[ns.length-1]!==s)){var b="deltaY"in y?ry(y):Ya(y),w=e.current.filter(function(E){return E.name===y.type&&(E.target===y.target||y.target===E.shadowParent)&&WD(E.delta,b)})[0];if(w&&w.should){y.cancelable&&y.preventDefault();return}if(!w){var k=(o.current.shards||[]).map(iy).filter(Boolean).filter(function(E){return E.contains(y.target)}),v=k.length>0?a(y,k[0]):!o.current.noIsolation;v&&y.cancelable&&y.preventDefault()}}},[]),c=x.useCallback(function(g,y,b,w){var k={name:g,delta:y,target:b,should:w,shadowParent:JD(b)};e.current.push(k),setTimeout(function(){e.current=e.current.filter(function(v){return v!==k})},1)},[]),d=x.useCallback(function(g){n.current=Ya(g),r.current=void 0},[]),u=x.useCallback(function(g){c(g.type,ry(g),g.target,a(g,t.lockRef.current))},[]),f=x.useCallback(function(g){c(g.type,Ya(g),g.target,a(g,t.lockRef.current))},[]);x.useEffect(function(){return ns.push(s),t.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:f}),document.addEventListener("wheel",l,ts),document.addEventListener("touchmove",l,ts),document.addEventListener("touchstart",d,ts),function(){ns=ns.filter(function(g){return g!==s}),document.removeEventListener("wheel",l,ts),document.removeEventListener("touchmove",l,ts),document.removeEventListener("touchstart",d,ts)}},[]);var h=t.removeScrollBar,m=t.inert;return x.createElement(x.Fragment,null,m?x.createElement(s,{styles:GD(i)}):null,h?x.createElement(jD,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function JD(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const XD=CD(aw,YD);var fw=x.forwardRef(function(t,e){return x.createElement(pd,Xn({},t,{ref:e,sideCar:XD}))});fw.classNames=pd.classNames;var md="Popover",[hw]=Vh(md,[cd]),Sa=cd(),[ZD,yi]=hw(md),pw=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!1}=t,a=Sa(e),l=x.useRef(null),[c,d]=x.useState(!1),[u,f]=Sx({prop:r,defaultProp:i??!1,onChange:s,caller:md});return p.jsx(xx,{...a,children:p.jsx(ZD,{scope:e,contentId:Zv(),triggerRef:l,open:u,onOpenChange:f,onOpenToggle:x.useCallback(()=>f(h=>!h),[f]),hasCustomAnchor:c,onCustomAnchorAdd:x.useCallback(()=>d(!0),[]),onCustomAnchorRemove:x.useCallback(()=>d(!1),[]),modal:o,children:n})})};pw.displayName=md;var mw="PopoverAnchor",QD=x.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=yi(mw,n),s=Sa(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=i;return x.useEffect(()=>(o(),()=>a()),[o,a]),p.jsx(ep,{...s,...r,ref:e})});QD.displayName=mw;var gw="PopoverTrigger",yw=x.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=yi(gw,n),s=Sa(n),o=dr(e,i.triggerRef),a=p.jsx(zn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Ew(i.open),...r,ref:o,onClick:nn(t.onClick,i.onOpenToggle)});return i.hasCustomAnchor?a:p.jsx(ep,{asChild:!0,...s,children:a})});yw.displayName=gw;var ap="PopoverPortal",[eL,tL]=hw(ap,{forceMount:void 0}),bw=t=>{const{__scopePopover:e,forceMount:n,children:r,container:i}=t,s=yi(ap,e);return p.jsx(eL,{scope:e,forceMount:n,children:p.jsx(dd,{present:n||s.open,children:p.jsx(kx,{asChild:!0,container:i,children:r})})})};bw.displayName=ap;var Bs="PopoverContent",vw=x.forwardRef((t,e)=>{const n=tL(Bs,t.__scopePopover),{forceMount:r=n.forceMount,...i}=t,s=yi(Bs,t.__scopePopover);return p.jsx(dd,{present:r||s.open,children:s.modal?p.jsx(rL,{...i,ref:e}):p.jsx(iL,{...i,ref:e})})});vw.displayName=Bs;var nL=qv("PopoverContent.RemoveScroll"),rL=x.forwardRef((t,e)=>{const n=yi(Bs,t.__scopePopover),r=x.useRef(null),i=dr(e,r),s=x.useRef(!1);return x.useEffect(()=>{const o=r.current;if(o)return mD(o)},[]),p.jsx(fw,{as:nL,allowPinchZoom:!0,children:p.jsx(xw,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:nn(t.onCloseAutoFocus,o=>{o.preventDefault(),s.current||n.triggerRef.current?.focus()}),onPointerDownOutside:nn(t.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;s.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:nn(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),iL=x.forwardRef((t,e)=>{const n=yi(Bs,t.__scopePopover),r=x.useRef(!1),i=x.useRef(!1);return p.jsx(xw,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{t.onCloseAutoFocus?.(s),s.defaultPrevented||(r.current||n.triggerRef.current?.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{t.onInteractOutside?.(s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;n.triggerRef.current?.contains(o)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),xw=x.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,...u}=t,f=yi(Bs,n),h=Sa(n);return iD(),p.jsx(nw,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:p.jsx(Kh,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>f.onOpenChange(!1),children:p.jsx(wx,{"data-state":Ew(f.open),role:"dialog",id:f.contentId,...h,...u,ref:e,style:{...u.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),ww="PopoverClose",sL=x.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=yi(ww,n);return p.jsx(zn.button,{type:"button",...r,ref:e,onClick:nn(t.onClick,()=>i.onOpenChange(!1))})});sL.displayName=ww;var oL="PopoverArrow",aL=x.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=Sa(n);return p.jsx(Ex,{...i,...r,ref:e})});aL.displayName=oL;function Ew(t){return t?"open":"closed"}var lL=pw,cL=yw,dL=bw,kw=vw;const ir=()=>new Map,Lf=t=>{const e=ir();return t.forEach((n,r)=>{e.set(r,n)}),e},Ys=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r},uL=(t,e)=>{const n=[];for(const[r,i]of t)n.push(e(i,r));return n},fL=(t,e)=>{for(const[n,r]of t)if(e(r,n))return!0;return!1},js=()=>new Set,ku=t=>t[t.length-1],$s=Array.from,lp=(t,e)=>{for(let n=0;n<t.length;n++)if(!e(t[n],n,t))return!1;return!0},Sw=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1},hL=(t,e)=>{const n=new Array(t);for(let r=0;r<t;r++)n[r]=e(r,n);return n},gd=Array.isArray;class pL{constructor(){this._observers=ir()}on(e,n){return Ys(this._observers,e,js).add(n),n}once(e,n){const r=(...i)=>{this.off(e,r),n(...i)};this.on(e,r)}off(e,n){const r=this._observers.get(e);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(e))}emit(e,n){return $s((this._observers.get(e)||ir()).values()).forEach(r=>r(...n))}destroy(){this._observers=ir()}}const Ar=Math.floor,Cl=Math.abs,Cw=(t,e)=>t<e?t:e,Js=(t,e)=>t>e?t:e,mL=t=>t!==0?t<0:1/t<0,sy=1,oy=2,Su=4,Cu=8,gL=32,_w=64,ec=128,yL=31,ay=63,_o=127,bL=2147483647,ly=Number.MAX_SAFE_INTEGER,cy=Number.MIN_SAFE_INTEGER,vL=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&Ar(t)===t),xL=String.fromCharCode,wL=t=>t.toLowerCase(),EL=/^\s*/g,kL=t=>t.replace(EL,""),SL=/([A-Z])/g,dy=(t,e)=>kL(t.replace(SL,n=>`${e}${wL(n)}`)),CL=t=>{const e=unescape(encodeURIComponent(t)),n=e.length,r=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=e.codePointAt(i);return r},Zo=typeof TextEncoder<"u"?new TextEncoder:null,_L=t=>Zo.encode(t),NL=Zo?_L:CL;let _u=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});_u&&_u.decode(new Uint8Array).length===1&&(_u=null);const TL=(t,e)=>hL(e,()=>t).join("");class Ca{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const cp=()=>new Ca,AL=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},kr=t=>{const e=new Uint8Array(AL(t));let n=0;for(let r=0;r<t.bufs.length;r++){const i=t.bufs[r];e.set(i,n),n+=i.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},ML=(t,e)=>{const n=t.cbuf.length;n-t.cpos<e&&(t.bufs.push(new Uint8Array(t.cbuf.buffer,0,t.cpos)),t.cbuf=new Uint8Array(Js(n,e)*2),t.cpos=0)},kt=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(n*2),t.cpos=0),t.cbuf[t.cpos++]=e},Pf=kt,Ke=(t,e)=>{for(;e>_o;)kt(t,ec|_o&e),e=Ar(e/128);kt(t,_o&e)},dp=(t,e)=>{const n=mL(e);for(n&&(e=-e),kt(t,(e>ay?ec:0)|(n?_w:0)|ay&e),e=Ar(e/64);e>0;)kt(t,(e>_o?ec:0)|_o&e),e=Ar(e/128)},Bf=new Uint8Array(3e4),OL=Bf.length/3,RL=(t,e)=>{if(e.length<OL){const n=Zo.encodeInto(e,Bf).written||0;Ke(t,n);for(let r=0;r<n;r++)kt(t,Bf[r])}else fn(t,NL(e))},IL=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;Ke(t,r);for(let i=0;i<r;i++)kt(t,n.codePointAt(i))},ws=Zo&&Zo.encodeInto?RL:IL,up=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=Cw(n-r,e.length),s=e.length-i;t.cbuf.set(e.subarray(0,i),r),t.cpos+=i,s>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(Js(n*2,s)),t.cbuf.set(e.subarray(i)),t.cpos=s)},fn=(t,e)=>{Ke(t,e.byteLength),up(t,e)},fp=(t,e)=>{ML(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},DL=(t,e)=>fp(t,4).setFloat32(0,e,!1),LL=(t,e)=>fp(t,8).setFloat64(0,e,!1),PL=(t,e)=>fp(t,8).setBigInt64(0,e,!1),uy=new DataView(new ArrayBuffer(4)),BL=t=>(uy.setFloat32(0,t),uy.getFloat32(0)===t),Qo=(t,e)=>{switch(typeof e){case"string":kt(t,119),ws(t,e);break;case"number":vL(e)&&Cl(e)<=bL?(kt(t,125),dp(t,e)):BL(e)?(kt(t,124),DL(t,e)):(kt(t,123),LL(t,e));break;case"bigint":kt(t,122),PL(t,e);break;case"object":if(e===null)kt(t,126);else if(gd(e)){kt(t,117),Ke(t,e.length);for(let n=0;n<e.length;n++)Qo(t,e[n])}else if(e instanceof Uint8Array)kt(t,116),fn(t,e);else{kt(t,118);const n=Object.keys(e);Ke(t,n.length);for(let r=0;r<n.length;r++){const i=n[r];ws(t,i),Qo(t,e[i])}}break;case"boolean":kt(t,e?120:121);break;default:kt(t,127)}};class fy extends Ca{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&Ke(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const hy=t=>{t.count>0&&(dp(t.encoder,t.count===1?t.s:-t.s),t.count>1&&Ke(t.encoder,t.count-2))};class _l{constructor(){this.encoder=new Ca,this.s=0,this.count=0}write(e){this.s===e?this.count++:(hy(this),this.count=1,this.s=e)}toUint8Array(){return hy(this),kr(this.encoder)}}const py=t=>{if(t.count>0){const e=t.diff*2+(t.count===1?0:1);dp(t.encoder,e),t.count>1&&Ke(t.encoder,t.count-2)}};class Nu{constructor(){this.encoder=new Ca,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(py(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return py(this),kr(this.encoder)}}class jL{constructor(){this.sarr=[],this.s="",this.lensE=new _l}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new Ca;return this.sarr.push(this.s),this.s="",ws(e,this.sarr.join("")),up(e,this.lensE.toUint8Array()),kr(e)}}const ci=t=>new Error(t),Pn=()=>{throw ci("Method unimplemented")},lr=()=>{throw ci("Unexpected case")},$L=crypto.getRandomValues.bind(crypto),Nw=()=>$L(new Uint32Array(1))[0],FL="10000000-1000-4000-8000"+-1e11,HL=()=>FL.replace(/[018]/g,t=>(t^Nw()&15>>t/4).toString(16)),my=t=>new Promise(t);Promise.all.bind(Promise);const gy=t=>t===void 0?null:t;class zL{constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let Tw=new zL,UL=!0;try{typeof localStorage<"u"&&localStorage&&(Tw=localStorage,UL=!1)}catch{}const VL=Tw,ea=Symbol("Equality"),Aw=(t,e)=>t===e||!!t?.[ea]?.(e)||!1,KL=t=>typeof t=="object",WL=Object.assign,GL=Object.keys,qL=(t,e)=>{for(const n in t)e(t[n],n)},tc=t=>GL(t).length,YL=t=>{for(const e in t)return!1;return!0},_a=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},hp=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),JL=(t,e)=>t===e||tc(t)===tc(e)&&_a(t,(n,r)=>(n!==void 0||hp(e,r))&&Aw(e[r],n)),XL=Object.freeze,Mw=t=>{for(const e in t){const n=t[e];(typeof n=="object"||typeof n=="function")&&Mw(t[e])}return XL(t)},pp=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&pp(t,e,n+1)}},Nl=(t,e)=>{if(t===e)return!0;if(t==null||e==null||t.constructor!==e.constructor&&(t.constructor||Object)!==(e.constructor||Object))return!1;if(t[ea]!=null)return t[ea](e);switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:{if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;break}case Set:{if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;break}case Map:{if(t.size!==e.size)return!1;for(const n of t.keys())if(!e.has(n)||!Nl(t.get(n),e.get(n)))return!1;break}case void 0:case Object:if(tc(t)!==tc(e))return!1;for(const n in t)if(!hp(t,n)||!Nl(t[n],e[n]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!Nl(t[n],e[n]))return!1;break;default:return!1}return!0},ZL=(t,e)=>e.includes(t);var Ow={};const ta=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]";let Kn;const QL=()=>{if(Kn===void 0)if(ta){Kn=ir();const t=process.argv;let e=null;for(let n=0;n<t.length;n++){const r=t[n];r[0]==="-"?(e!==null&&Kn.set(e,""),e=r):e!==null&&(Kn.set(e,r),e=null)}e!==null&&Kn.set(e,"")}else typeof location=="object"?(Kn=ir(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){const[e,n]=t.split("=");Kn.set(`--${dy(e,"-")}`,n),Kn.set(`-${dy(e,"-")}`,n)}})):Kn=ir();return Kn},jf=t=>QL().has(t),nc=t=>gy(ta?Ow[t.toUpperCase().replaceAll("-","_")]:VL.getItem(t)),Rw=t=>jf("--"+t)||nc(t)!==null,eP=Rw("production"),tP=ta&&ZL(Ow.FORCE_COLOR,["true","1","2"]),nP=tP||!jf("--no-colors")&&!Rw("no-color")&&(!ta||process.stdout.isTTY)&&(!ta||jf("--color")||nc("COLORTERM")!==null||(nc("TERM")||"").includes("color"));class rP{constructor(e,n){this.left=e,this.right=n}}const mr=(t,e)=>new rP(t,e),yy=t=>t.next()>=.5,Tu=(t,e,n)=>Ar(t.next()*(n+1-e)+e),Iw=(t,e,n)=>Ar(t.next()*(n+1-e)+e),mp=(t,e,n)=>Iw(t,e,n),iP=t=>xL(mp(t,97,122)),sP=(t,e=0,n=20)=>{const r=mp(t,e,n);let i="";for(let s=0;s<r;s++)i+=iP(t);return i},Au=(t,e)=>e[mp(t,0,e.length-1)],oP=Symbol("0schema");class aP{constructor(){this._rerrs=[]}extend(e,n,r,i=null){this._rerrs.push({path:e,expected:n,has:r,message:i})}toString(){const e=[];for(let n=this._rerrs.length-1;n>0;n--){const r=this._rerrs[n];e.push(TL(" ",(this._rerrs.length-n)*2)+`${r.path!=null?`[${r.path}] `:""}${r.has} doesn't match ${r.expected}. ${r.message}`)}return e.join(`
130
+ `)}}const $f=(t,e)=>t===e?!0:t==null||e==null||t.constructor!==e.constructor?!1:t[ea]?Aw(t,e):gd(t)?lp(t,n=>Sw(e,r=>$f(n,r))):KL(t)?_a(t,(n,r)=>$f(n,e[r])):!1;class Qt{static _dilutes=!1;extends(e){let[n,r]=[this.shape,e.shape];return this.constructor._dilutes&&([r,n]=[n,r]),$f(n,r)}equals(e){return this.constructor===e.constructor&&Nl(this.shape,e.shape)}[oP](){return!0}[ea](e){return this.equals(e)}validate(e){return this.check(e)}check(e,n){Pn()}get nullable(){return Xs(this,wd)}get optional(){return new Pw(this)}cast(e){return by(e,this),e}expect(e){return by(e,this),e}}class gp extends Qt{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n=void 0){const r=e?.constructor===this.shape&&(this._c==null||this._c(e));return!r&&n?.extend(null,this.shape.name,e?.constructor.name,e?.constructor!==this.shape?"Constructor match failed":"Check failed"),r}}const yt=(t,e=null)=>new gp(t,e);yt(gp);class yp extends Qt{constructor(e){super(),this.shape=e}check(e,n){const r=this.shape(e);return!r&&n?.extend(null,"custom prop",e?.constructor.name,"failed to check custom prop"),r}}const Tt=t=>new yp(t);yt(yp);class yd extends Qt{constructor(e){super(),this.shape=e}check(e,n){const r=this.shape.some(i=>i===e);return!r&&n?.extend(null,this.shape.join(" | "),e.toString()),r}}const bd=(...t)=>new yd(t),Dw=yt(yd),lP=RegExp.escape||(t=>t.replace(/[().|&,$^[\]]/g,e=>"\\"+e)),Lw=t=>{if(Fs.check(t))return[lP(t)];if(Dw.check(t))return t.shape.map(e=>e+"");if(Kw.check(t))return["[+-]?\\d+.?\\d*"];if(Ww.check(t))return[".*"];if(rc.check(t))return t.shape.map(Lw).flat(1);lr()};class cP extends Qt{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(Lw).map(n=>`(${n.join("|")})`).join("")+"$")}check(e,n){const r=this._r.exec(e)!=null;return!r&&n?.extend(null,this._r.toString(),e.toString(),"String doesn't match string template."),r}}yt(cP);const dP=Symbol("optional");class Pw extends Qt{constructor(e){super(),this.shape=e}check(e,n){const r=e===void 0||this.shape.check(e);return!r&&n?.extend(null,"undefined (optional)","()"),r}get[dP](){return!0}}const uP=yt(Pw);class fP extends Qt{check(e,n){return n?.extend(null,"never",typeof e),!1}}yt(fP);class vd extends Qt{constructor(e,n=!1){super(),this.shape=e,this._isPartial=n}static _dilutes=!0;get partial(){return new vd(this.shape,!0)}check(e,n){return e==null?(n?.extend(null,"object","null"),!1):_a(this.shape,(r,i)=>{const s=this._isPartial&&!hp(e,i)||r.check(e[i],n);return!s&&n?.extend(i.toString(),r.toString(),typeof e[i],"Object property does not match"),s})}}const hP=t=>new vd(t),pP=yt(vd),mP=Tt(t=>t!=null&&(t.constructor===Object||t.constructor==null));class Bw extends Qt{constructor(e,n){super(),this.shape={keys:e,values:n}}check(e,n){return e!=null&&_a(e,(r,i)=>{const s=this.shape.keys.check(i,n);return!s&&n?.extend(i+"","Record",typeof e,s?"Key doesn't match schema":"Value doesn't match value"),s&&this.shape.values.check(r,n)})}}const jw=(t,e)=>new Bw(t,e),gP=yt(Bw);class $w extends Qt{constructor(e){super(),this.shape=e}check(e,n){return e!=null&&_a(this.shape,(r,i)=>{const s=r.check(e[i],n);return!s&&n?.extend(i.toString(),"Tuple",typeof r),s})}}const yP=(...t)=>new $w(t);yt($w);class Fw extends Qt{constructor(e){super(),this.shape=e.length===1?e[0]:new bp(e)}check(e,n){const r=gd(e)&&lp(e,i=>this.shape.check(i));return!r&&n?.extend(null,"Array",""),r}}const Hw=(...t)=>new Fw(t),bP=yt(Fw),vP=Tt(t=>gd(t));class zw extends Qt{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n){const r=e instanceof this.shape&&(this._c==null||this._c(e));return!r&&n?.extend(null,this.shape.name,e?.constructor.name),r}}const xP=(t,e=null)=>new zw(t,e);yt(zw);const wP=xP(Qt);class EP extends Qt{constructor(e){super(),this.len=e.length-1,this.args=yP(...e.slice(-1)),this.res=e[this.len]}check(e,n){const r=e.constructor===Function&&e.length<=this.len;return!r&&n?.extend(null,"function",typeof e),r}}const kP=yt(EP),SP=Tt(t=>typeof t=="function");class CP extends Qt{constructor(e){super(),this.shape=e}check(e,n){const r=lp(this.shape,i=>i.check(e,n));return!r&&n?.extend(null,"Intersectinon",typeof e),r}}yt(CP,t=>t.shape.length>0);class bp extends Qt{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,n){const r=Sw(this.shape,i=>i.check(e,n));return n?.extend(null,"Union",typeof e),r}}const Xs=(...t)=>t.findIndex(e=>rc.check(e))>=0?Xs(...t.map(e=>na(e)).map(e=>rc.check(e)?e.shape:[e]).flat(1)):t.length===1?t[0]:new bp(t),rc=yt(bp),Uw=()=>!0,ic=Tt(Uw),_P=yt(yp,t=>t.shape===Uw),vp=Tt(t=>typeof t=="bigint"),NP=Tt(t=>t===vp),Vw=Tt(t=>typeof t=="symbol");Tt(t=>t===Vw);const Es=Tt(t=>typeof t=="number"),Kw=Tt(t=>t===Es),Fs=Tt(t=>typeof t=="string"),Ww=Tt(t=>t===Fs),xd=Tt(t=>typeof t=="boolean"),TP=Tt(t=>t===xd),Gw=bd(void 0);yt(yd,t=>t.shape.length===1&&t.shape[0]===void 0);bd(void 0);const wd=bd(null),AP=yt(yd,t=>t.shape.length===1&&t.shape[0]===null);yt(Uint8Array);yt(gp,t=>t.shape===Uint8Array);const MP=Xs(Es,Fs,wd,Gw,vp,xd,Vw);(()=>{const t=Hw(ic),e=jw(Fs,ic),n=Xs(Es,Fs,wd,xd,t,e);return t.shape=n,e.shape.values=n,n})();const na=t=>{if(wP.check(t))return t;if(mP.check(t)){const e={};for(const n in t)e[n]=na(t[n]);return hP(e)}else{if(vP.check(t))return Xs(...t.map(na));if(MP.check(t))return bd(t);if(SP.check(t))return yt(t)}lr()},by=eP?()=>{}:(t,e)=>{const n=new aP;if(!e.check(t,n))throw ci(`Expected value to be of type ${e.constructor.name}.
131
+ ${n.toString()}`)};class OP{constructor(e){this.patterns=[],this.$state=e}if(e,n){return this.patterns.push({if:na(e),h:n}),this}else(e){return this.if(ic,e)}done(){return(e,n)=>{for(let r=0;r<this.patterns.length;r++){const i=this.patterns[r];if(i.if.check(e))return i.h(e,n)}throw ci("Unhandled pattern")}}}const RP=t=>new OP(t),qw=RP(ic).if(Kw,(t,e)=>Tu(e,cy,ly)).if(Ww,(t,e)=>sP(e)).if(TP,(t,e)=>yy(e)).if(NP,(t,e)=>BigInt(Tu(e,cy,ly))).if(rc,(t,e)=>rs(e,Au(e,t.shape))).if(pP,(t,e)=>{const n={};for(const r in t.shape){let i=t.shape[r];if(uP.check(i)){if(yy(e))continue;i=i.shape}n[r]=qw(i,e)}return n}).if(bP,(t,e)=>{const n=[],r=Iw(e,0,42);for(let i=0;i<r;i++)n.push(rs(e,t.shape));return n}).if(Dw,(t,e)=>Au(e,t.shape)).if(AP,(t,e)=>null).if(kP,(t,e)=>{const n=rs(e,t.res);return()=>n}).if(_P,(t,e)=>rs(e,Au(e,[Es,Fs,wd,Gw,vp,xd,Hw(Es),jw(Xs("a","b","c"),Es)]))).if(gP,(t,e)=>{const n={},r=Tu(e,0,3);for(let i=0;i<r;i++){const s=rs(e,t.shape.keys),o=rs(e,t.shape.values);n[s]=o}return n}).done(),rs=(t,e)=>qw(na(e),t),Ed=typeof document<"u"?document:{};Tt(t=>t.nodeType===BP);typeof DOMParser<"u"&&new DOMParser;Tt(t=>t.nodeType===DP);Tt(t=>t.nodeType===LP);const IP=t=>uL(t,(e,n)=>`${n}:${e};`).join(""),DP=Ed.ELEMENT_NODE,LP=Ed.TEXT_NODE,PP=Ed.DOCUMENT_NODE,BP=Ed.DOCUMENT_FRAGMENT_NODE;Tt(t=>t.nodeType===PP);const Lr=Symbol,Yw=Lr(),Jw=Lr(),jP=Lr(),$P=Lr(),FP=Lr(),Xw=Lr(),HP=Lr(),xp=Lr(),zP=Lr(),UP=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());const e=[],n=[];let r=0;for(;r<t.length;r++){const i=t[r];if(i===void 0)break;if(i.constructor===String||i.constructor===Number)e.push(i);else if(i.constructor===Object)break}for(r>0&&n.push(e.join(""));r<t.length;r++){const i=t[r];i instanceof Symbol||n.push(i)}return n},VP={[Yw]:mr("font-weight","bold"),[Jw]:mr("font-weight","normal"),[jP]:mr("color","blue"),[FP]:mr("color","green"),[$P]:mr("color","grey"),[Xw]:mr("color","red"),[HP]:mr("color","purple"),[xp]:mr("color","orange"),[zP]:mr("color","black")},KP=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());const e=[],n=[],r=ir();let i=[],s=0;for(;s<t.length;s++){const o=t[s],a=VP[o];if(a!==void 0)r.set(a.left,a.right);else{if(o===void 0)break;if(o.constructor===String||o.constructor===Number){const l=IP(r);s>0||l.length>0?(e.push("%c"+o),n.push(l)):e.push(o)}else break}}for(s>0&&(i=n,i.unshift(e.join("")));s<t.length;s++){const o=t[s];o instanceof Symbol||i.push(o)}return i},Zw=nP?KP:UP,WP=(...t)=>{console.log(...Zw(t)),Qw.forEach(e=>e.print(t))},GP=(...t)=>{console.warn(...Zw(t)),t.unshift(xp),Qw.forEach(e=>e.print(t))},Qw=js(),eE=t=>({[Symbol.iterator](){return this},next:t}),qP=(t,e)=>eE(()=>{let n;do n=t.next();while(!n.done&&!e(n.value));return n}),Mu=(t,e)=>eE(()=>{const{done:n,value:r}=t.next();return{done:n,value:n?void 0:e(r)}});class tE{constructor(e,n){this.clock=e,this.len=n}}class YP{constructor(){this.clients=new Map}}const nE=(t,e,n)=>e.clients.forEach((r,i)=>{const s=t.doc.store.clients.get(i);if(s!=null){const o=s[s.length-1],a=o.id.clock+o.length;for(let l=0,c=r[l];l<r.length&&c.clock<a;c=r[++l])cE(t,s,c.clock,c.len,n)}}),JP=(t,e)=>{let n=0,r=t.length-1;for(;n<=r;){const i=Ar((n+r)/2),s=t[i],o=s.clock;if(o<=e){if(e<o+s.len)return i;n=i+1}else r=i-1}return null},rE=(t,e)=>{const n=t.clients.get(e.client);return n!==void 0&&JP(n,e.clock)!==null},iE=t=>{t.clients.forEach(e=>{e.sort((i,s)=>i.clock-s.clock);let n,r;for(n=1,r=1;n<e.length;n++){const i=e[r-1],s=e[n];i.clock+i.len>=s.clock?e[r-1]=new tE(i.clock,Js(i.len,s.clock+s.len-i.clock)):(r<n&&(e[r]=s),r++)}e.length=r})},sE=(t,e,n,r)=>{Ys(t.clients,e,()=>[]).push(new tE(n,r))},XP=(t,e)=>{Ke(t.restEncoder,e.clients.size),$s(e.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{t.resetDsCurVal(),Ke(t.restEncoder,n);const i=r.length;Ke(t.restEncoder,i);for(let s=0;s<i;s++){const o=r[s];t.writeDsClock(o.clock),t.writeDsLen(o.len)}})},oE=Nw;class Na extends pL{constructor({guid:e=HL(),collectionid:n=null,gc:r=!0,gcFilter:i=()=>!0,meta:s=null,autoLoad:o=!1,shouldLoad:a=!0}={}){super(),this.gc=r,this.gcFilter=i,this.clientID=oE(),this.guid=e,this.collectionid=n,this.share=new Map,this.store=new oB,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=a,this.autoLoad=o,this.meta=s,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=my(c=>{this.on("load",()=>{this.isLoaded=!0,c(this)})});const l=()=>my(c=>{const d=u=>{(u===void 0||u===!0)&&(this.off("sync",d),c())};this.on("sync",d)});this.on("sync",c=>{c===!1&&this.isSynced&&(this.whenSynced=l()),this.isSynced=c===void 0||c===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=l()}load(){const e=this._item;e!==null&&!this.shouldLoad&&tt(e.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set($s(this.subdocs).map(e=>e.guid))}transact(e,n=null){return tt(this,e,n)}get(e,n=Ft){const r=Ys(this.share,e,()=>{const s=new n;return s._integrate(this,null),s}),i=r.constructor;if(n!==Ft&&i!==n)if(i===Ft){const s=new n;s._map=r._map,r._map.forEach(o=>{for(;o!==null;o=o.left)o.parent=s}),s._start=r._start;for(let o=s._start;o!==null;o=o.right)o.parent=s;return s._length=r._length,this.share.set(e,s),s._integrate(this,null),s}else throw new Error(`Type with the name ${e} has already been defined with a different constructor`);return r}getArray(e=""){return this.get(e,No)}getText(e=""){return this.get(e,oa)}getMap(e=""){return this.get(e,lc)}getXmlElement(e=""){return this.get(e,aa)}getXmlFragment(e=""){return this.get(e,Hs)}toJSON(){const e={};return this.share.forEach((n,r)=>{e[r]=n.toJSON()}),e}destroy(){this.isDestroyed=!0,$s(this.subdocs).forEach(n=>n.destroy());const e=this._item;if(e!==null){this._item=null;const n=e.content;n.doc=new Na({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=e,tt(e.parent.doc,r=>{const i=n.doc;e.deleted||r.subdocsAdded.add(i),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class ZP{constructor(){this.restEncoder=cp()}toUint8Array(){return kr(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){Ke(this.restEncoder,e)}writeDsLen(e){Ke(this.restEncoder,e)}}class QP extends ZP{writeLeftID(e){Ke(this.restEncoder,e.client),Ke(this.restEncoder,e.clock)}writeRightID(e){Ke(this.restEncoder,e.client),Ke(this.restEncoder,e.clock)}writeClient(e){Ke(this.restEncoder,e)}writeInfo(e){Pf(this.restEncoder,e)}writeString(e){ws(this.restEncoder,e)}writeParentInfo(e){Ke(this.restEncoder,e?1:0)}writeTypeRef(e){Ke(this.restEncoder,e)}writeLen(e){Ke(this.restEncoder,e)}writeAny(e){Qo(this.restEncoder,e)}writeBuf(e){fn(this.restEncoder,e)}writeJSON(e){ws(this.restEncoder,JSON.stringify(e))}writeKey(e){ws(this.restEncoder,e)}}class eB{constructor(){this.restEncoder=cp(),this.dsCurrVal=0}toUint8Array(){return kr(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const n=e-this.dsCurrVal;this.dsCurrVal=e,Ke(this.restEncoder,n)}writeDsLen(e){e===0&&lr(),Ke(this.restEncoder,e-1),this.dsCurrVal+=e}}class tB extends eB{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new Nu,this.clientEncoder=new _l,this.leftClockEncoder=new Nu,this.rightClockEncoder=new Nu,this.infoEncoder=new fy(Pf),this.stringEncoder=new jL,this.parentInfoEncoder=new fy(Pf),this.typeRefEncoder=new _l,this.lenEncoder=new _l}toUint8Array(){const e=cp();return Ke(e,0),fn(e,this.keyClockEncoder.toUint8Array()),fn(e,this.clientEncoder.toUint8Array()),fn(e,this.leftClockEncoder.toUint8Array()),fn(e,this.rightClockEncoder.toUint8Array()),fn(e,kr(this.infoEncoder)),fn(e,this.stringEncoder.toUint8Array()),fn(e,kr(this.parentInfoEncoder)),fn(e,this.typeRefEncoder.toUint8Array()),fn(e,this.lenEncoder.toUint8Array()),up(e,kr(this.restEncoder)),kr(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){Qo(this.restEncoder,e)}writeBuf(e){fn(this.restEncoder,e)}writeJSON(e){Qo(this.restEncoder,e)}writeKey(e){const n=this.keyMap.get(e);n===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(n)}}const nB=(t,e,n,r)=>{r=Js(r,e[0].id.clock);const i=Mr(e,r);Ke(t.restEncoder,e.length-i),t.writeClient(n),Ke(t.restEncoder,r);const s=e[i];s.write(t,r-s.id.clock);for(let o=i+1;o<e.length;o++)e[o].write(t,0)},rB=(t,e,n)=>{const r=new Map;n.forEach((i,s)=>{sn(e,s)>i&&r.set(s,i)}),wp(e).forEach((i,s)=>{n.has(s)||r.set(s,0)}),Ke(t.restEncoder,r.size),$s(r.entries()).sort((i,s)=>s[0]-i[0]).forEach(([i,s])=>{nB(t,e.clients.get(i),i,s)})},iB=(t,e)=>rB(t,e.doc.store,e.beforeState);class sB{constructor(){this.l=[]}}const vy=()=>new sB,xy=(t,e)=>t.l.push(e),wy=(t,e)=>{const n=t.l,r=n.length;t.l=n.filter(i=>e!==i),r===t.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},aE=(t,e,n)=>pp(t.l,[e,n]);class Tl{constructor(e,n){this.client=e,this.clock=n}}const Ja=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,it=(t,e)=>new Tl(t,e),ra=t=>{for(const[e,n]of t.doc.share.entries())if(n===t)return e;throw lr()};class sc{constructor(e,n,r,i=0){this.type=e,this.tname=n,this.item=r,this.assoc=i}}const Xa=(t,e,n)=>{let r=null,i=null;return t._item===null?i=ra(t):r=it(t._item.id.client,t._item.id.clock),new sc(r,i,e,n)},Ou=(t,e,n=0)=>{let r=t._start;if(n<0){if(e===0)return Xa(t,null,n);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return Xa(t,it(r.id.client,r.id.clock+e),n);e-=r.length}if(r.right===null&&n<0)return Xa(t,r.lastId,n);r=r.right}return Xa(t,null,n)},ds=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!rE(e.ds,t.id),Ff=(t,e)=>{const n=Ys(t.meta,Ff,js),r=t.doc.store;n.has(e)||(e.sv.forEach((i,s)=>{i<sn(r,s)&&di(t,it(s,i))}),nE(t,e.ds,i=>{}),n.add(e))};class oB{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const wp=t=>{const e=new Map;return t.clients.forEach((n,r)=>{const i=n[n.length-1];e.set(r,i.id.clock+i.length)}),e},sn=(t,e)=>{const n=t.clients.get(e);if(n===void 0)return 0;const r=n[n.length-1];return r.id.clock+r.length},lE=(t,e)=>{let n=t.clients.get(e.id.client);if(n===void 0)n=[],t.clients.set(e.id.client,n);else{const r=n[n.length-1];if(r.id.clock+r.length!==e.id.clock)throw lr()}n.push(e)},Mr=(t,e)=>{let n=0,r=t.length-1,i=t[r],s=i.id.clock;if(s===e)return r;let o=Ar(e/(s+i.length-1)*r);for(;n<=r;){if(i=t[o],s=i.id.clock,s<=e){if(e<s+i.length)return o;n=o+1}else r=o-1;o=Ar((n+r)/2)}throw lr()},aB=(t,e)=>{const n=t.clients.get(e.client);return n[Mr(n,e.clock)]},Ru=aB,Hf=(t,e,n)=>{const r=Mr(e,n),i=e[r];return i.id.clock<n&&i instanceof mn?(e.splice(r+1,0,NE(t,i,n-i.id.clock)),r+1):r},di=(t,e)=>{const n=t.doc.store.clients.get(e.client);return n[Hf(t,n,e.clock)]},Ey=(t,e,n)=>{const r=e.clients.get(n.client),i=Mr(r,n.clock),s=r[i];return n.clock!==s.id.clock+s.length-1&&s.constructor!==qr&&r.splice(i+1,0,NE(t,s,n.clock-s.id.clock+1)),s},lB=(t,e,n)=>{const r=t.clients.get(e.id.client);r[Mr(r,e.id.clock)]=n},cE=(t,e,n,r,i)=>{if(r===0)return;const s=n+r;let o=Hf(t,e,n),a;do a=e[o++],s<a.id.clock+a.length&&Hf(t,e,s),i(a);while(o<e.length&&e[o].id.clock<s)};class cB{constructor(e,n,r){this.doc=e,this.deleteSet=new YP,this.beforeState=wp(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=n,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const ky=(t,e)=>e.deleteSet.clients.size===0&&!fL(e.afterState,(n,r)=>e.beforeState.get(r)!==n)?!1:(iE(e.deleteSet),iB(t,e),XP(t,e.deleteSet),!0),Sy=(t,e,n)=>{const r=e._item;(r===null||r.id.clock<(t.beforeState.get(r.id.client)||0)&&!r.deleted)&&Ys(t.changed,e,js).add(n)},Al=(t,e)=>{let n=t[e],r=t[e-1],i=e;for(;i>0;n=r,r=t[--i-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof mn&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}const s=e-i;return s&&t.splice(e+1-s,s),s},dB=(t,e,n)=>{for(const[r,i]of t.clients.entries()){const s=e.clients.get(r);for(let o=i.length-1;o>=0;o--){const a=i[o],l=a.clock+a.len;for(let c=Mr(s,a.clock),d=s[c];c<s.length&&d.id.clock<l;d=s[++c]){const u=s[c];if(a.clock+a.len<=u.id.clock)break;u instanceof mn&&u.deleted&&!u.keep&&n(u)&&u.gc(e,!1)}}}},uB=(t,e)=>{t.clients.forEach((n,r)=>{const i=e.clients.get(r);for(let s=n.length-1;s>=0;s--){const o=n[s],a=Cw(i.length-1,1+Mr(i,o.clock+o.len-1));for(let l=a,c=i[l];l>0&&c.id.clock>=o.clock;c=i[l])l-=1+Al(i,l)}})},dE=(t,e)=>{if(e<t.length){const n=t[e],r=n.doc,i=r.store,s=n.deleteSet,o=n._mergeStructs;try{iE(s),n.afterState=wp(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const a=[];n.changed.forEach((l,c)=>a.push(()=>{(c._item===null||!c._item.deleted)&&c._callObserver(n,l)})),a.push(()=>{n.changedParentTypes.forEach((l,c)=>{c._dEH.l.length>0&&(c._item===null||!c._item.deleted)&&(l=l.filter(d=>d.target._item===null||!d.target._item.deleted),l.forEach(d=>{d.currentTarget=c,d._path=null}),l.sort((d,u)=>d.path.length-u.path.length),a.push(()=>{aE(c._dEH,l,n)}))}),a.push(()=>r.emit("afterTransaction",[n,r])),a.push(()=>{n._needFormattingCleanup&&kB(n)})}),pp(a,[])}finally{r.gc&&dB(s,i,r.gcFilter),uB(s,i),n.afterState.forEach((d,u)=>{const f=n.beforeState.get(u)||0;if(f!==d){const h=i.clients.get(u),m=Js(Mr(h,f),1);for(let g=h.length-1;g>=m;)g-=1+Al(h,g)}});for(let d=o.length-1;d>=0;d--){const{client:u,clock:f}=o[d].id,h=i.clients.get(u),m=Mr(h,f);m+1<h.length&&Al(h,m+1)>1||m>0&&Al(h,m)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(WP(xp,Yw,"[yjs] ",Jw,Xw,"Changed the client-id because another client seems to be using it."),r.clientID=oE()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const d=new QP;ky(d,n)&&r.emit("update",[d.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const d=new tB;ky(d,n)&&r.emit("updateV2",[d.toUint8Array(),n.origin,r,n])}const{subdocsAdded:a,subdocsLoaded:l,subdocsRemoved:c}=n;(a.size>0||c.size>0||l.size>0)&&(a.forEach(d=>{d.clientID=r.clientID,d.collectionid==null&&(d.collectionid=r.collectionid),r.subdocs.add(d)}),c.forEach(d=>r.subdocs.delete(d)),r.emit("subdocs",[{loaded:l,added:a,removed:c},r,n]),c.forEach(d=>d.destroy())),t.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,t])):dE(t,e+1)}}},tt=(t,e,n=null,r=!0)=>{const i=t._transactionCleanups;let s=!1,o=null;t._transaction===null&&(s=!0,t._transaction=new cB(t,n,r),i.push(t._transaction),i.length===1&&t.emit("beforeAllTransactions",[t]),t.emit("beforeTransaction",[t._transaction,t]));try{o=e(t._transaction)}finally{if(s){const a=t._transaction===i[0];t._transaction=null,a&&dE(i,0)}}return o},Cy="You must not compute changes after the event-handler fired.";class kd{constructor(e,n){this.target=e,this.currentTarget=e,this.transaction=n,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=fB(this.currentTarget,this.target))}deletes(e){return rE(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw ci(Cy);const e=new Map,n=this.target;this.transaction.changed.get(n).forEach(i=>{if(i!==null){const s=n._map.get(i);let o,a;if(this.adds(s)){let l=s.left;for(;l!==null&&this.adds(l);)l=l.left;if(this.deletes(s))if(l!==null&&this.deletes(l))o="delete",a=ku(l.content.getContent());else return;else l!==null&&this.deletes(l)?(o="update",a=ku(l.content.getContent())):(o="add",a=void 0)}else if(this.deletes(s))o="delete",a=ku(s.content.getContent());else return;e.set(i,{action:o,oldValue:a})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw ci(Cy);const n=this.target,r=js(),i=js(),s=[];if(e={added:r,deleted:i,delta:s,keys:this.keys},this.transaction.changed.get(n).has(null)){let a=null;const l=()=>{a&&s.push(a)};for(let c=n._start;c!==null;c=c.right)c.deleted?this.deletes(c)&&!this.adds(c)&&((a===null||a.delete===void 0)&&(l(),a={delete:0}),a.delete+=c.length,i.add(c)):this.adds(c)?((a===null||a.insert===void 0)&&(l(),a={insert:[]}),a.insert=a.insert.concat(c.content.getContent()),r.add(c)):((a===null||a.retain===void 0)&&(l(),a={retain:0}),a.retain+=c.length);a!==null&&a.retain===void 0&&l()}this._changes=e}return e}}const fB=(t,e)=>{const n=[];for(;e._item!==null&&e!==t;){if(e._item.parentSub!==null)n.unshift(e._item.parentSub);else{let r=0,i=e._item.parent._start;for(;i!==e._item&&i!==null;)!i.deleted&&i.countable&&(r+=i.length),i=i.right;n.unshift(r)}e=e._item.parent}return n},Ut=()=>{GP("Invalid access: Add Yjs type to a document before reading data.")},uE=80;let Ep=0;class hB{constructor(e,n){e.marker=!0,this.p=e,this.index=n,this.timestamp=Ep++}}const pB=t=>{t.timestamp=Ep++},fE=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=Ep++},mB=(t,e,n)=>{if(t.length>=uE){const r=t.reduce((i,s)=>i.timestamp<s.timestamp?i:s);return fE(r,e,n),r}else{const r=new hB(e,n);return t.push(r),r}},Sd=(t,e)=>{if(t._start===null||e===0||t._searchMarker===null)return null;const n=t._searchMarker.length===0?null:t._searchMarker.reduce((s,o)=>Cl(e-s.index)<Cl(e-o.index)?s:o);let r=t._start,i=0;for(n!==null&&(r=n.p,i=n.index,pB(n));r.right!==null&&i<e;){if(!r.deleted&&r.countable){if(e<i+r.length)break;i+=r.length}r=r.right}for(;r.left!==null&&i>e;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);return n!==null&&Cl(n.index-i)<r.parent.length/uE?(fE(n,r,i),n):mB(t._searchMarker,r,i)},ia=(t,e,n)=>{for(let r=t.length-1;r>=0;r--){const i=t[r];if(n>0){let s=i.p;for(s.marker=!1;s&&(s.deleted||!s.countable);)s=s.left,s&&!s.deleted&&s.countable&&(i.index-=s.length);if(s===null||s.marker===!0){t.splice(r,1);continue}i.p=s,s.marker=!0}(e<i.index||n>0&&e===i.index)&&(i.index=Js(e,i.index+n))}},Cd=(t,e,n)=>{const r=t,i=e.changedParentTypes;for(;Ys(i,t,()=>[]).push(n),t._item!==null;)t=t._item.parent;aE(r._eH,n,e)};class Ft{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=vy(),this._dEH=vy(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,n){this.doc=e,this._item=n}_copy(){throw Pn()}clone(){throw Pn()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,n){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){xy(this._eH,e)}observeDeep(e){xy(this._dEH,e)}unobserve(e){wy(this._eH,e)}unobserveDeep(e){wy(this._dEH,e)}toJSON(){}}const hE=(t,e,n)=>{t.doc??Ut(),e<0&&(e=t._length+e),n<0&&(n=t._length+n);let r=n-e;const i=[];let s=t._start;for(;s!==null&&r>0;){if(s.countable&&!s.deleted){const o=s.content.getContent();if(o.length<=e)e-=o.length;else{for(let a=e;a<o.length&&r>0;a++)i.push(o[a]),r--;e=0}}s=s.right}return i},pE=t=>{t.doc??Ut();const e=[];let n=t._start;for(;n!==null;){if(n.countable&&!n.deleted){const r=n.content.getContent();for(let i=0;i<r.length;i++)e.push(r[i])}n=n.right}return e},sa=(t,e)=>{let n=0,r=t._start;for(t.doc??Ut();r!==null;){if(r.countable&&!r.deleted){const i=r.content.getContent();for(let s=0;s<i.length;s++)e(i[s],n++,t)}r=r.right}},mE=(t,e)=>{const n=[];return sa(t,(r,i)=>{n.push(e(r,i,t))}),n},gB=t=>{let e=t._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;e!==null&&e.deleted;)e=e.right;if(e===null)return{done:!0,value:void 0};n=e.content.getContent(),r=0,e=e.right}const i=n[r++];return n.length<=r&&(n=null),{done:!1,value:i}}}},gE=(t,e)=>{t.doc??Ut();const n=Sd(t,e);let r=t._start;for(n!==null&&(r=n.p,e-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(e<r.length)return r.content.getContent()[e];e-=r.length}},oc=(t,e,n,r)=>{let i=n;const s=t.doc,o=s.clientID,a=s.store,l=n===null?e._start:n.right;let c=[];const d=()=>{c.length>0&&(i=new mn(it(o,sn(a,o)),i,i&&i.lastId,l,l&&l.id,e,null,new zs(c)),i.integrate(t,0),c=[])};r.forEach(u=>{if(u===null)c.push(u);else switch(u.constructor){case Number:case Object:case Boolean:case Array:case String:c.push(u);break;default:switch(d(),u.constructor){case Uint8Array:case ArrayBuffer:i=new mn(it(o,sn(a,o)),i,i&&i.lastId,l,l&&l.id,e,null,new _d(new Uint8Array(u))),i.integrate(t,0);break;case Na:i=new mn(it(o,sn(a,o)),i,i&&i.lastId,l,l&&l.id,e,null,new Nd(u)),i.integrate(t,0);break;default:if(u instanceof Ft)i=new mn(it(o,sn(a,o)),i,i&&i.lastId,l,l&&l.id,e,null,new bi(u)),i.integrate(t,0);else throw new Error("Unexpected content type in insert operation")}}}),d()},yE=()=>ci("Length exceeded!"),bE=(t,e,n,r)=>{if(n>e._length)throw yE();if(n===0)return e._searchMarker&&ia(e._searchMarker,n,r.length),oc(t,e,null,r);const i=n,s=Sd(e,n);let o=e._start;for(s!==null&&(o=s.p,n-=s.index,n===0&&(o=o.prev,n+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(n<=o.length){n<o.length&&di(t,it(o.id.client,o.id.clock+n));break}n-=o.length}return e._searchMarker&&ia(e._searchMarker,i,r.length),oc(t,e,o,r)},yB=(t,e,n)=>{let i=(e._searchMarker||[]).reduce((s,o)=>o.index>s.index?o:s,{index:0,p:e._start}).p;if(i)for(;i.right;)i=i.right;return oc(t,e,i,n)},vE=(t,e,n,r)=>{if(r===0)return;const i=n,s=r,o=Sd(e,n);let a=e._start;for(o!==null&&(a=o.p,n-=o.index);a!==null&&n>0;a=a.right)!a.deleted&&a.countable&&(n<a.length&&di(t,it(a.id.client,a.id.clock+n)),n-=a.length);for(;r>0&&a!==null;)a.deleted||(r<a.length&&di(t,it(a.id.client,a.id.clock+r)),a.delete(t),r-=a.length),a=a.right;if(r>0)throw yE();e._searchMarker&&ia(e._searchMarker,i,-s+r)},ac=(t,e,n)=>{const r=e._map.get(n);r!==void 0&&r.delete(t)},kp=(t,e,n,r)=>{const i=e._map.get(n)||null,s=t.doc,o=s.clientID;let a;if(r==null)a=new zs([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:a=new zs([r]);break;case Uint8Array:a=new _d(r);break;case Na:a=new Nd(r);break;default:if(r instanceof Ft)a=new bi(r);else throw new Error("Unexpected content type")}new mn(it(o,sn(s.store,o)),i,i&&i.lastId,null,null,e,n,a).integrate(t,0)},Sp=(t,e)=>{t.doc??Ut();const n=t._map.get(e);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},xE=t=>{const e={};return t.doc??Ut(),t._map.forEach((n,r)=>{n.deleted||(e[r]=n.content.getContent()[n.length-1])}),e},wE=(t,e)=>{t.doc??Ut();const n=t._map.get(e);return n!==void 0&&!n.deleted},bB=(t,e)=>{const n={};return t._map.forEach((r,i)=>{let s=r;for(;s!==null&&(!e.sv.has(s.id.client)||s.id.clock>=(e.sv.get(s.id.client)||0));)s=s.left;s!==null&&ds(s,e)&&(n[i]=s.content.getContent()[s.length-1])}),n},Za=t=>(t.doc??Ut(),qP(t._map.entries(),e=>!e[1].deleted));class vB extends kd{}class No extends Ft{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const n=new No;return n.push(e),n}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new No}clone(){const e=new No;return e.insert(0,this.toArray().map(n=>n instanceof Ft?n.clone():n)),e}get length(){return this.doc??Ut(),this._length}_callObserver(e,n){super._callObserver(e,n),Cd(this,e,new vB(this,e))}insert(e,n){this.doc!==null?tt(this.doc,r=>{bE(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}push(e){this.doc!==null?tt(this.doc,n=>{yB(n,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,n=1){this.doc!==null?tt(this.doc,r=>{vE(r,this,e,n)}):this._prelimContent.splice(e,n)}get(e){return gE(this,e)}toArray(){return pE(this)}slice(e=0,n=this.length){return hE(this,e,n)}toJSON(){return this.map(e=>e instanceof Ft?e.toJSON():e)}map(e){return mE(this,e)}forEach(e){sa(this,e)}[Symbol.iterator](){return gB(this)}_write(e){e.writeTypeRef(AB)}}class xB extends kd{constructor(e,n,r){super(e,n),this.keysChanged=r}}class lc extends Ft{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,n){super._integrate(e,n),this._prelimContent.forEach((r,i)=>{this.set(i,r)}),this._prelimContent=null}_copy(){return new lc}clone(){const e=new lc;return this.forEach((n,r)=>{e.set(r,n instanceof Ft?n.clone():n)}),e}_callObserver(e,n){Cd(this,e,new xB(this,e,n))}toJSON(){this.doc??Ut();const e={};return this._map.forEach((n,r)=>{if(!n.deleted){const i=n.content.getContent()[n.length-1];e[r]=i instanceof Ft?i.toJSON():i}}),e}get size(){return[...Za(this)].length}keys(){return Mu(Za(this),e=>e[0])}values(){return Mu(Za(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return Mu(Za(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??Ut(),this._map.forEach((n,r)=>{n.deleted||e(n.content.getContent()[n.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?tt(this.doc,n=>{ac(n,this,e)}):this._prelimContent.delete(e)}set(e,n){return this.doc!==null?tt(this.doc,r=>{kp(r,this,e,n)}):this._prelimContent.set(e,n),n}get(e){return Sp(this,e)}has(e){return wE(this,e)}clear(){this.doc!==null?tt(this.doc,e=>{this.forEach(function(n,r,i){ac(e,i,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(MB)}}const Qr=(t,e)=>t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&JL(t,e);class zf{constructor(e,n,r,i){this.left=e,this.right=n,this.index=r,this.currentAttributes=i}forward(){this.right===null&&lr(),this.right.content.constructor===Nt?this.right.deleted||Zs(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}}const _y=(t,e,n)=>{for(;e.right!==null&&n>0;)e.right.content.constructor===Nt?e.right.deleted||Zs(e.currentAttributes,e.right.content):e.right.deleted||(n<e.right.length&&di(t,it(e.right.id.client,e.right.id.clock+n)),e.index+=e.right.length,n-=e.right.length),e.left=e.right,e.right=e.right.right;return e},Qa=(t,e,n,r)=>{const i=new Map,s=r?Sd(e,n):null;if(s){const o=new zf(s.p.left,s.p,s.index,i);return _y(t,o,n-s.index)}else{const o=new zf(null,e._start,0,i);return _y(t,o,n)}},EE=(t,e,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===Nt&&Qr(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();const i=t.doc,s=i.clientID;r.forEach((o,a)=>{const l=n.left,c=n.right,d=new mn(it(s,sn(i.store,s)),l,l&&l.lastId,c,c&&c.id,e,null,new Nt(a,o));d.integrate(t,0),n.right=d,n.forward()})},Zs=(t,e)=>{const{key:n,value:r}=e;r===null?t.delete(n):t.set(n,r)},kE=(t,e)=>{for(;t.right!==null;){if(!(t.right.deleted||t.right.content.constructor===Nt&&Qr(e[t.right.content.key]??null,t.right.content.value)))break;t.forward()}},SE=(t,e,n,r)=>{const i=t.doc,s=i.clientID,o=new Map;for(const a in r){const l=r[a],c=n.currentAttributes.get(a)??null;if(!Qr(c,l)){o.set(a,c);const{left:d,right:u}=n;n.right=new mn(it(s,sn(i.store,s)),d,d&&d.lastId,u,u&&u.id,e,null,new Nt(a,l)),n.right.integrate(t,0),n.forward()}}return o},Iu=(t,e,n,r,i)=>{n.currentAttributes.forEach((f,h)=>{i[h]===void 0&&(i[h]=null)});const s=t.doc,o=s.clientID;kE(n,i);const a=SE(t,e,n,i),l=r.constructor===String?new Or(r):r instanceof Ft?new bi(r):new Qs(r);let{left:c,right:d,index:u}=n;e._searchMarker&&ia(e._searchMarker,n.index,l.getLength()),d=new mn(it(o,sn(s.store,o)),c,c&&c.lastId,d,d&&d.id,e,null,l),d.integrate(t,0),n.right=d,n.index=u,n.forward(),EE(t,e,n,a)},Ny=(t,e,n,r,i)=>{const s=t.doc,o=s.clientID;kE(n,i);const a=SE(t,e,n,i);e:for(;n.right!==null&&(r>0||a.size>0&&(n.right.deleted||n.right.content.constructor===Nt));){if(!n.right.deleted)switch(n.right.content.constructor){case Nt:{const{key:l,value:c}=n.right.content,d=i[l];if(d!==void 0){if(Qr(d,c))a.delete(l);else{if(r===0)break e;a.set(l,c)}n.right.delete(t)}else n.currentAttributes.set(l,c);break}default:r<n.right.length&&di(t,it(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let l="";for(;r>0;r--)l+=`
132
+ `;n.right=new mn(it(o,sn(s.store,o)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new Or(l)),n.right.integrate(t,0),n.forward()}EE(t,e,n,a)},CE=(t,e,n,r,i)=>{let s=e;const o=ir();for(;s&&(!s.countable||s.deleted);){if(!s.deleted&&s.content.constructor===Nt){const c=s.content;o.set(c.key,c)}s=s.right}let a=0,l=!1;for(;e!==s;){if(n===e&&(l=!0),!e.deleted){const c=e.content;if(c.constructor===Nt){const{key:d,value:u}=c,f=r.get(d)??null;(o.get(d)!==c||f===u)&&(e.delete(t),a++,!l&&(i.get(d)??null)===u&&f!==u&&(f===null?i.delete(d):i.set(d,f))),!l&&!e.deleted&&Zs(i,c)}}e=e.right}return a},wB=(t,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;const n=new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===Nt){const r=e.content.key;n.has(r)?e.delete(t):n.add(r)}e=e.left}},EB=t=>{let e=0;return tt(t.doc,n=>{let r=t._start,i=t._start,s=ir();const o=Lf(s);for(;i;)i.deleted===!1&&(i.content.constructor===Nt?Zs(o,i.content):(e+=CE(n,r,i,s,o),s=Lf(o),r=i)),i=i.right}),e},kB=t=>{const e=new Set,n=t.doc;for(const[r,i]of t.afterState.entries()){const s=t.beforeState.get(r)||0;i!==s&&cE(t,n.store.clients.get(r),s,i,o=>{!o.deleted&&o.content.constructor===Nt&&o.constructor!==qr&&e.add(o.parent)})}tt(n,r=>{nE(t,t.deleteSet,i=>{if(i instanceof qr||!i.parent._hasFormatting||e.has(i.parent))return;const s=i.parent;i.content.constructor===Nt?e.add(s):wB(r,i)});for(const i of e)EB(i)})},Ty=(t,e,n)=>{const r=n,i=Lf(e.currentAttributes),s=e.right;for(;n>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case bi:case Qs:case Or:n<e.right.length&&di(t,it(e.right.id.client,e.right.id.clock+n)),n-=e.right.length,e.right.delete(t);break}e.forward()}s&&CE(t,s,e.right,i,e.currentAttributes);const o=(e.left||e.right).parent;return o._searchMarker&&ia(o._searchMarker,e.index,-r+n),e};class SB extends kd{constructor(e,n,r){super(e,n),this.childListChanged=!1,this.keysChanged=new Set,r.forEach(i=>{i===null?this.childListChanged=!0:this.keysChanged.add(i)})}get changes(){if(this._changes===null){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){const e=this.target.doc,n=[];tt(e,r=>{const i=new Map,s=new Map;let o=this.target._start,a=null;const l={};let c="",d=0,u=0;const f=()=>{if(a!==null){let h=null;switch(a){case"delete":u>0&&(h={delete:u}),u=0;break;case"insert":(typeof c=="object"||c.length>0)&&(h={insert:c},i.size>0&&(h.attributes={},i.forEach((m,g)=>{m!==null&&(h.attributes[g]=m)}))),c="";break;case"retain":d>0&&(h={retain:d},YL(l)||(h.attributes=WL({},l))),d=0;break}h&&n.push(h),a=null}};for(;o!==null;){switch(o.content.constructor){case bi:case Qs:this.adds(o)?this.deletes(o)||(f(),a="insert",c=o.content.getContent()[0],f()):this.deletes(o)?(a!=="delete"&&(f(),a="delete"),u+=1):o.deleted||(a!=="retain"&&(f(),a="retain"),d+=1);break;case Or:this.adds(o)?this.deletes(o)||(a!=="insert"&&(f(),a="insert"),c+=o.content.str):this.deletes(o)?(a!=="delete"&&(f(),a="delete"),u+=o.length):o.deleted||(a!=="retain"&&(f(),a="retain"),d+=o.length);break;case Nt:{const{key:h,value:m}=o.content;if(this.adds(o)){if(!this.deletes(o)){const g=i.get(h)??null;Qr(g,m)?m!==null&&o.delete(r):(a==="retain"&&f(),Qr(m,s.get(h)??null)?delete l[h]:l[h]=m)}}else if(this.deletes(o)){s.set(h,m);const g=i.get(h)??null;Qr(g,m)||(a==="retain"&&f(),l[h]=g)}else if(!o.deleted){s.set(h,m);const g=l[h];g!==void 0&&(Qr(g,m)?g!==null&&o.delete(r):(a==="retain"&&f(),m===null?delete l[h]:l[h]=m))}o.deleted||(a==="insert"&&f(),Zs(i,o.content));break}}o=o.right}for(f();n.length>0;){const h=n[n.length-1];if(h.retain!==void 0&&h.attributes===void 0)n.pop();else break}}),this._delta=n}return this._delta}}class oa extends Ft{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??Ut(),this._length}_integrate(e,n){super._integrate(e,n);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new oa}clone(){const e=new oa;return e.applyDelta(this.toDelta()),e}_callObserver(e,n){super._callObserver(e,n);const r=new SB(this,e,n);Cd(this,e,r),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??Ut();let e="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===Or&&(e+=n.content.str),n=n.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:n=!0}={}){this.doc!==null?tt(this.doc,r=>{const i=new zf(null,this._start,0,new Map);for(let s=0;s<e.length;s++){const o=e[s];if(o.insert!==void 0){const a=!n&&typeof o.insert=="string"&&s===e.length-1&&i.right===null&&o.insert.slice(-1)===`
133
+ `?o.insert.slice(0,-1):o.insert;(typeof a!="string"||a.length>0)&&Iu(r,this,i,a,o.attributes||{})}else o.retain!==void 0?Ny(r,this,i,o.retain,o.attributes||{}):o.delete!==void 0&&Ty(r,i,o.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,n,r){this.doc??Ut();const i=[],s=new Map,o=this.doc;let a="",l=this._start;function c(){if(a.length>0){const u={};let f=!1;s.forEach((m,g)=>{f=!0,u[g]=m});const h={insert:a};f&&(h.attributes=u),i.push(h),a=""}}const d=()=>{for(;l!==null;){if(ds(l,e)||n!==void 0&&ds(l,n))switch(l.content.constructor){case Or:{const u=s.get("ychange");e!==void 0&&!ds(l,e)?(u===void 0||u.user!==l.id.client||u.type!=="removed")&&(c(),s.set("ychange",r?r("removed",l.id):{type:"removed"})):n!==void 0&&!ds(l,n)?(u===void 0||u.user!==l.id.client||u.type!=="added")&&(c(),s.set("ychange",r?r("added",l.id):{type:"added"})):u!==void 0&&(c(),s.delete("ychange")),a+=l.content.str;break}case bi:case Qs:{c();const u={insert:l.content.getContent()[0]};if(s.size>0){const f={};u.attributes=f,s.forEach((h,m)=>{f[m]=h})}i.push(u);break}case Nt:ds(l,e)&&(c(),Zs(s,l.content));break}l=l.right}c()};return e||n?tt(o,u=>{e&&Ff(u,e),n&&Ff(u,n),d()},"cleanup"):d(),i}insert(e,n,r){if(n.length<=0)return;const i=this.doc;i!==null?tt(i,s=>{const o=Qa(s,this,e,!r);r||(r={},o.currentAttributes.forEach((a,l)=>{r[l]=a})),Iu(s,this,o,n,r)}):this._pending.push(()=>this.insert(e,n,r))}insertEmbed(e,n,r){const i=this.doc;i!==null?tt(i,s=>{const o=Qa(s,this,e,!r);Iu(s,this,o,n,r||{})}):this._pending.push(()=>this.insertEmbed(e,n,r||{}))}delete(e,n){if(n===0)return;const r=this.doc;r!==null?tt(r,i=>{Ty(i,Qa(i,this,e,!0),n)}):this._pending.push(()=>this.delete(e,n))}format(e,n,r){if(n===0)return;const i=this.doc;i!==null?tt(i,s=>{const o=Qa(s,this,e,!1);o.right!==null&&Ny(s,this,o,n,r)}):this._pending.push(()=>this.format(e,n,r))}removeAttribute(e){this.doc!==null?tt(this.doc,n=>{ac(n,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,n){this.doc!==null?tt(this.doc,r=>{kp(r,this,e,n)}):this._pending.push(()=>this.setAttribute(e,n))}getAttribute(e){return Sp(this,e)}getAttributes(){return xE(this)}_write(e){e.writeTypeRef(OB)}}class Du{constructor(e,n=()=>!0){this._filter=n,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??Ut()}[Symbol.iterator](){return this}next(){let e=this._currentNode,n=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(n)))do if(n=e.content.type,!e.deleted&&(n.constructor===aa||n.constructor===Hs)&&n._start!==null)e=n._start;else for(;e!==null;){const r=e.next;if(r!==null){e=r;break}else e.parent===this._root?e=null:e=e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class Hs extends Ft{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Hs}clone(){const e=new Hs;return e.insert(0,this.toArray().map(n=>n instanceof Ft?n.clone():n)),e}get length(){return this.doc??Ut(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new Du(this,e)}querySelector(e){e=e.toUpperCase();const r=new Du(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),$s(new Du(this,n=>n.nodeName&&n.nodeName.toUpperCase()===e))}_callObserver(e,n){Cd(this,e,new CB(this,n,e))}toString(){return mE(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,n={},r){const i=e.createDocumentFragment();return r!==void 0&&r._createAssociation(i,this),sa(this,s=>{i.insertBefore(s.toDOM(e,n,r),null)}),i}insert(e,n){this.doc!==null?tt(this.doc,r=>{bE(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}insertAfter(e,n){if(this.doc!==null)tt(this.doc,r=>{const i=e&&e instanceof Ft?e._item:e;oc(r,this,i,n)});else{const r=this._prelimContent,i=e===null?0:r.findIndex(s=>s===e)+1;if(i===0&&e!==null)throw ci("Reference item not found");r.splice(i,0,...n)}}delete(e,n=1){this.doc!==null?tt(this.doc,r=>{vE(r,this,e,n)}):this._prelimContent.splice(e,n)}toArray(){return pE(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return gE(this,e)}slice(e=0,n=this.length){return hE(this,e,n)}forEach(e){sa(this,e)}_write(e){e.writeTypeRef(IB)}}class aa extends Hs{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,n){super._integrate(e,n),this._prelimAttrs.forEach((r,i)=>{this.setAttribute(i,r)}),this._prelimAttrs=null}_copy(){return new aa(this.nodeName)}clone(){const e=new aa(this.nodeName),n=this.getAttributes();return qL(n,(r,i)=>{e.setAttribute(i,r)}),e.insert(0,this.toArray().map(r=>r instanceof Ft?r.clone():r)),e}toString(){const e=this.getAttributes(),n=[],r=[];for(const a in e)r.push(a);r.sort();const i=r.length;for(let a=0;a<i;a++){const l=r[a];n.push(l+'="'+e[l]+'"')}const s=this.nodeName.toLocaleLowerCase(),o=n.length>0?" "+n.join(" "):"";return`<${s}${o}>${super.toString()}</${s}>`}removeAttribute(e){this.doc!==null?tt(this.doc,n=>{ac(n,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,n){this.doc!==null?tt(this.doc,r=>{kp(r,this,e,n)}):this._prelimAttrs.set(e,n)}getAttribute(e){return Sp(this,e)}hasAttribute(e){return wE(this,e)}getAttributes(e){return e?bB(this,e):xE(this)}toDOM(e=document,n={},r){const i=e.createElement(this.nodeName),s=this.getAttributes();for(const o in s){const a=s[o];typeof a=="string"&&i.setAttribute(o,a)}return sa(this,o=>{i.appendChild(o.toDOM(e,n,r))}),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(RB),e.writeKey(this.nodeName)}}class CB extends kd{constructor(e,n,r){super(e,r),this.childListChanged=!1,this.attributesChanged=new Set,n.forEach(i=>{i===null?this.childListChanged=!0:this.attributesChanged.add(i)})}}class la extends oa{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new la}clone(){const e=new la;return e.applyDelta(this.toDelta()),e}toDOM(e=document,n,r){const i=e.createTextNode(this.toString());return r!==void 0&&r._createAssociation(i,this),i}toString(){return this.toDelta().map(e=>{const n=[];for(const i in e.attributes){const s=[];for(const o in e.attributes[i])s.push({key:o,value:e.attributes[i][o]});s.sort((o,a)=>o.key<a.key?-1:1),n.push({nodeName:i,attrs:s})}n.sort((i,s)=>i.nodeName<s.nodeName?-1:1);let r="";for(let i=0;i<n.length;i++){const s=n[i];r+=`<${s.nodeName}`;for(let o=0;o<s.attrs.length;o++){const a=s.attrs[o];r+=` ${a.key}="${a.value}"`}r+=">"}r+=e.insert;for(let i=n.length-1;i>=0;i--)r+=`</${n[i].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(DB)}}class _E{constructor(e,n){this.id=e,this.length=n}get deleted(){throw Pn()}mergeWith(e){return!1}write(e,n,r){throw Pn()}integrate(e,n){throw Pn()}}const _B=0;class qr extends _E{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){n>0&&(this.id.clock+=n,this.length-=n),lE(e.doc.store,this)}write(e,n){e.writeInfo(_B),e.writeLen(this.length-n)}getMissing(e,n){return null}}class _d{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new _d(this.content)}splice(e){throw Pn()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeBuf(this.content)}getRef(){return 3}}class cc{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new cc(this.len)}splice(e){const n=new cc(this.len-e);return this.len=e,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,n){sE(e.deleteSet,n.id.client,n.id.clock,this.len),n.markDeleted()}delete(e){}gc(e){}write(e,n){e.writeLen(this.len-n)}getRef(){return 1}}const NB=(t,e)=>new Na({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class Nd{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const n={};this.opts=n,e.gc||(n.gc=!1),e.autoLoad&&(n.autoLoad=!0),e.meta!==null&&(n.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new Nd(NB(this.doc.guid,this.opts))}splice(e){throw Pn()}mergeWith(e){return!1}integrate(e,n){this.doc._item=n,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,n){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}class Qs{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new Qs(this.embed)}splice(e){throw Pn()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeJSON(this.embed)}getRef(){return 5}}class Nt{constructor(e,n){this.key=e,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new Nt(this.key,this.value)}splice(e){throw Pn()}mergeWith(e){return!1}integrate(e,n){const r=n.parent;r._searchMarker=null,r._hasFormatting=!0}delete(e){}gc(e){}write(e,n){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const TB=nc("node_env")==="development";class zs{constructor(e){this.arr=e,TB&&Mw(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new zs(this.arr)}splice(e){const n=new zs(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let i=n;i<r;i++){const s=this.arr[i];e.writeAny(s)}}getRef(){return 8}}class Or{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new Or(this.str)}splice(e){const n=new Or(this.str.slice(e));this.str=this.str.slice(0,e);const r=this.str.charCodeAt(e-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,e-1)+"�",n.str="�"+n.str.slice(1)),n}mergeWith(e){return this.str+=e.str,!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeString(n===0?this.str:this.str.slice(n))}getRef(){return 4}}const AB=0,MB=1,OB=2,RB=3,IB=4,DB=6;class bi{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new bi(this.type._copy())}splice(e){throw Pn()}mergeWith(e){return!1}integrate(e,n){this.type._integrate(e.doc,n)}delete(e){let n=this.type._start;for(;n!==null;)n.deleted?n.id.clock<(e.beforeState.get(n.id.client)||0)&&e._mergeStructs.push(n):n.delete(e),n=n.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(e.beforeState.get(r.id.client)||0)&&e._mergeStructs.push(r):r.delete(e)}),e.changed.delete(this.type)}gc(e){let n=this.type._start;for(;n!==null;)n.gc(e,!0),n=n.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(e,!0),r=r.left}),this.type._map=new Map}write(e,n){this.type._write(e)}getRef(){return 7}}const NE=(t,e,n)=>{const{client:r,clock:i}=e.id,s=new mn(it(r,i+n),e,it(r,i+n-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(n));return e.deleted&&s.markDeleted(),e.keep&&(s.keep=!0),e.redone!==null&&(s.redone=it(e.redone.client,e.redone.clock+n)),e.right=s,s.right!==null&&(s.right.left=s),t._mergeStructs.push(s),s.parentSub!==null&&s.right===null&&s.parent._map.set(s.parentSub,s),e.length=n,s};let mn=class Uf extends _E{constructor(e,n,r,i,s,o,a,l){super(e,l.getLength()),this.origin=r,this.left=n,this.right=i,this.rightOrigin=s,this.parent=o,this.parentSub=a,this.redone=null,this.content=l,this.info=this.content.isCountable()?oy:0}set marker(e){(this.info&Cu)>0!==e&&(this.info^=Cu)}get marker(){return(this.info&Cu)>0}get keep(){return(this.info&sy)>0}set keep(e){this.keep!==e&&(this.info^=sy)}get countable(){return(this.info&oy)>0}get deleted(){return(this.info&Su)>0}set deleted(e){this.deleted!==e&&(this.info^=Su)}markDeleted(){this.info|=Su}getMissing(e,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=sn(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=sn(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===Tl&&this.id.client!==this.parent.client&&this.parent.clock>=sn(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=Ey(e,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=di(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===qr||this.right&&this.right.constructor===qr)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===Uf?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===Uf&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===Tl){const r=Ru(n,this.parent);r.constructor===qr?this.parent=null:this.parent=r.content.type}return null}integrate(e,n){if(n>0&&(this.id.clock+=n,this.left=Ey(e,e.doc.store,it(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(n),this.length-=n),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,i;if(r!==null)i=r.right;else if(this.parentSub!==null)for(i=this.parent._map.get(this.parentSub)||null;i!==null&&i.left!==null;)i=i.left;else i=this.parent._start;const s=new Set,o=new Set;for(;i!==null&&i!==this.right;){if(o.add(i),s.add(i),Ja(this.origin,i.origin)){if(i.id.client<this.id.client)r=i,s.clear();else if(Ja(this.rightOrigin,i.rightOrigin))break}else if(i.origin!==null&&o.has(Ru(e.doc.store,i.origin)))s.has(Ru(e.doc.store,i.origin))||(r=i,s.clear());else break;i=i.right}this.left=r}if(this.left!==null){const r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start,this.parent._start=this;this.right=r}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),lE(e.doc.store,this),this.content.integrate(e,this),Sy(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new qr(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:it(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&Ja(e.origin,this.lastId)&&this.right===e&&Ja(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const n=this.parent._searchMarker;return n&&n.forEach(r=>{r.p===e&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),sE(e.deleteSet,this.id.client,this.id.clock,this.length),Sy(e,n,this.parentSub),this.content.delete(e)}}gc(e,n){if(!this.deleted)throw lr();this.content.gc(e),n?lB(e,this,new qr(this.id,this.length)):this.content=new cc(this.length)}write(e,n){const r=n>0?it(this.id.client,this.id.clock+n-1):this.origin,i=this.rightOrigin,s=this.parentSub,o=this.content.getRef()&yL|(r===null?0:ec)|(i===null?0:_w)|(s===null?0:gL);if(e.writeInfo(o),r!==null&&e.writeLeftID(r),i!==null&&e.writeRightID(i),r===null&&i===null){const a=this.parent;if(a._item!==void 0){const l=a._item;if(l===null){const c=ra(a);e.writeParentInfo(!0),e.writeString(c)}else e.writeParentInfo(!1),e.writeLeftID(l.id)}else a.constructor===String?(e.writeParentInfo(!0),e.writeString(a)):a.constructor===Tl?(e.writeParentInfo(!1),e.writeLeftID(a)):lr();s!==null&&e.writeString(s)}this.content.write(e,n)}};const TE=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},AE="__ $YJS$ __";TE[AE]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");TE[AE]=!0;const LB=new Ge("y-sync");new Ge("y-undo");new Ge("yjs-cursor");const PB=(t,e,n)=>{if(t===0)return Ou(e,0,e.length===0?-1:0);let r=e._first===null?null:e._first.content.type;for(;r!==null&&e!==r;){if(r instanceof la){if(r._length>=t)return Ou(r,t,e.length===0?-1:0);if(t-=r._length,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{do r=r._item===null?null:r._item.parent,t--;while(r!==e&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==e&&(r=r._item===null?null:r._item.next.content.type)}}else{const i=(n.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&t<i)r=r._first.content.type,t--;else{if(t===1&&r._length===0&&i>1)return new sc(r._item===null?null:r._item.id,r._item===null?ra(r):null,null);if(t-=i,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{if(t===0)return r=r._item===null?r:r._item.parent,new sc(r._item===null?null:r._item.id,r._item===null?ra(r):null,null);do r=r._item.parent,t--;while(r!==e&&r._item.next===null);r!==e&&(r=r._item.next.content.type)}}}if(r===null)throw lr();if(t===0&&r.constructor!==la&&r!==e)return BB(r._item.parent,r._item)}return Ou(e,e._length,e.length===0?-1:0)},BB=(t,e)=>{let n=null,r=null;return t._item===null?r=ra(t):n=it(t._item.id.client,t._item.id.clock),new sc(n,r,e.id)},jB=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Cp=dt.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",He(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[xv({find:jB,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}});function $B(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:s,startOfLine:o,$position:a}=t,l=r&&!i,c=KT(n),d=new RegExp(`\\s${c}$`),u=o?"^":"",f=i?"":c,h=l?new RegExp(`${u}${c}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${u}(?:^)?${c}[^\\s${f}]*`,"gm"),m=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!m)return null;const g=a.pos-m.length,y=Array.from(m.matchAll(h)).pop();if(!y||y.input===void 0||y.index===void 0)return null;const b=y.input.slice(Math.max(0,y.index-1),y.index),w=new RegExp(`^[${s?.join("")}\0]?$`).test(b);if(s!==null&&!w)return null;const k=g+y.index;let v=k+y[0].length;return l&&d.test(m.slice(v-1,v+1))&&(y[0]+=" ",v+=1),k<a.pos&&v>=a.pos?{range:{from:k,to:v},query:y[0].slice(n.length),text:y[0]}:null}const FB=new Ge("suggestion");function ME({pluginKey:t=FB,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:s=[" "],startOfLine:o=!1,decorationTag:a="span",decorationClass:l="suggestion",decorationContent:c="",decorationEmptyClass:d="is-empty",command:u=()=>null,items:f=()=>[],render:h=()=>({}),allow:m=()=>!0,findSuggestionMatch:g=$B}){let y;const b=h?.(),w=new Ze({key:t,view(){return{update:async(k,v)=>{var E,S,C,N,M,D,j;const B=(E=this.key)===null||E===void 0?void 0:E.getState(v),F=(S=this.key)===null||S===void 0?void 0:S.getState(k.state),G=B.active&&F.active&&B.range.from!==F.range.from,q=!B.active&&F.active,W=B.active&&!F.active,A=!q&&!W&&B.query!==F.query,T=q||G&&A,P=A||G,Y=W||G&&A;if(!T&&!P&&!Y)return;const te=Y&&!T?B:F,pe=k.dom.querySelector(`[data-decoration-id="${te.decorationId}"]`);y={editor:e,range:te.range,query:te.query,text:te.text,items:[],command:Q=>u({editor:e,range:te.range,props:Q}),decorationNode:pe,clientRect:pe?()=>{var Q;const{decorationId:X}=(Q=this.key)===null||Q===void 0?void 0:Q.getState(e.state),ne=k.dom.querySelector(`[data-decoration-id="${X}"]`);return ne?.getBoundingClientRect()||null}:null},T&&((C=b?.onBeforeStart)===null||C===void 0||C.call(b,y)),P&&((N=b?.onBeforeUpdate)===null||N===void 0||N.call(b,y)),(P||T)&&(y.items=await f({editor:e,query:te.query})),Y&&((M=b?.onExit)===null||M===void 0||M.call(b,y)),P&&((D=b?.onUpdate)===null||D===void 0||D.call(b,y)),T&&((j=b?.onStart)===null||j===void 0||j.call(b,y))},destroy:()=>{var k;y&&((k=b?.onExit)===null||k===void 0||k.call(b,y))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(k,v,E,S){const{isEditable:C}=e,{composing:N}=e.view,{selection:M}=k,{empty:D,from:j}=M,B={...v};if(B.composing=N,C&&(D||e.view.composing)){(j<v.range.from||j>v.range.to)&&!N&&!v.composing&&(B.active=!1);const F=g({char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:s,startOfLine:o,$position:M.$from}),G=`id_${Math.floor(Math.random()*4294967295)}`;F&&m({editor:e,state:S,range:F.range,isActive:v.active})?(B.active=!0,B.decorationId=v.decorationId?v.decorationId:G,B.range=F.range,B.query=F.query,B.text=F.text):B.active=!1}else B.active=!1;return B.active||(B.decorationId=null,B.range={from:0,to:0},B.query=null,B.text=null),B}},props:{handleKeyDown(k,v){var E;const{active:S,range:C}=w.getState(k.state);return S&&((E=b?.onKeyDown)===null||E===void 0?void 0:E.call(b,{view:k,event:v,range:C}))||!1},decorations(k){const{active:v,range:E,decorationId:S,query:C}=w.getState(k);if(!v)return null;const N=!C?.length,M=[l];return N&&M.push(d),nt.create(k.doc,[jt.inline(E.from,E.to,{nodeName:a,class:M.join(" "),"data-decoration-id":S,"data-decoration-content":c})])}}});return w}function eo(){return(eo=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function Td(t,e){if(t==null)return{};var n,r,i={},s=Object.keys(t);for(r=0;r<s.length;r++)e.indexOf(n=s[r])>=0||(i[n]=t[n]);return i}function Li(t){var e=x.useRef(t),n=x.useRef(function(r){e.current&&e.current(r)});return e.current=t,n.current}var ca=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t<e?e:t},To=function(t){return"touches"in t},Vf=function(t){return t&&t.ownerDocument.defaultView||self},Ay=function(t,e,n){var r=t.getBoundingClientRect(),i=To(e)?(function(s,o){for(var a=0;a<s.length;a++)if(s[a].identifier===o)return s[a];return s[0]})(e.touches,n):e;return{left:ca((i.pageX-(r.left+Vf(t).pageXOffset))/r.width),top:ca((i.pageY-(r.top+Vf(t).pageYOffset))/r.height)}},My=function(t){!To(t)&&t.preventDefault()},OE=K.memo(function(t){var e=t.onMove,n=t.onKey,r=t.onEnd,i=Td(t,["onMove","onKey","onEnd"]),s=x.useRef(null),o=Li(e),a=Li(n),l=Li(r),c=x.useRef(null),d=x.useRef(!1),u=x.useMemo(function(){var y=function(k){My(k),(To(k)?k.touches.length>0:k.buttons>0)&&s.current?o(Ay(s.current,k,c.current)):(w(!1),l())},b=function(){w(!1),l()};function w(k){var v=d.current,E=Vf(s.current),S=k?E.addEventListener:E.removeEventListener;S(v?"touchmove":"mousemove",y),S(v?"touchend":"mouseup",b)}return[function(k){var v=k.nativeEvent,E=s.current;if(E&&(My(v),!(function(C,N){return N&&!To(C)})(v,d.current)&&E)){if(To(v)){d.current=!0;var S=v.changedTouches||[];S.length&&(c.current=S[0].identifier)}E.focus(),o(Ay(E,v,c.current)),w(!0)}},function(k){var v=k.which||k.keyCode;v<37||v>40||(k.preventDefault(),a({left:v===39?.05:v===37?-.05:0,top:v===40?.05:v===38?-.05:0}))},function(k){var v=k.which||k.keyCode;v>=37&&v<=40&&l()},w]},[a,o,l]),f=u[0],h=u[1],m=u[2],g=u[3];return x.useEffect(function(){return g},[g]),K.createElement("div",eo({},i,{onTouchStart:f,onMouseDown:f,className:"react-colorful__interactive",ref:s,onKeyDown:h,onKeyUp:m,tabIndex:0,role:"slider"}))}),_p=function(t){return t.filter(Boolean).join(" ")},RE=function(t){var e=t.color,n=t.left,r=t.top,i=r===void 0?.5:r,s=_p(["react-colorful__pointer",t.className]);return K.createElement("div",{className:s,style:{top:100*i+"%",left:100*n+"%"}},K.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:e}}))},$t=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n},HB=function(t){return WB(Kf(t))},Kf=function(t){return t[0]==="#"&&(t=t.substring(1)),t.length<6?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?$t(parseInt(t[3]+t[3],16)/255,2):1}:{r:parseInt(t.substring(0,2),16),g:parseInt(t.substring(2,4),16),b:parseInt(t.substring(4,6),16),a:t.length===8?$t(parseInt(t.substring(6,8),16)/255,2):1}},zB=function(t){return KB(VB(t))},UB=function(t){var e=t.s,n=t.v,r=t.a,i=(200-e)*n/100;return{h:$t(t.h),s:$t(i>0&&i<200?e*n/100/(i<=100?i:200-i)*100:0),l:$t(i/2),a:$t(r,2)}},Wf=function(t){var e=UB(t);return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},VB=function(t){var e=t.h,n=t.s,r=t.v,i=t.a;e=e/360*6,n/=100,r/=100;var s=Math.floor(e),o=r*(1-n),a=r*(1-(e-s)*n),l=r*(1-(1-e+s)*n),c=s%6;return{r:$t(255*[r,a,o,o,l,r][c]),g:$t(255*[l,r,r,a,o,o][c]),b:$t(255*[o,o,l,r,r,a][c]),a:$t(i,2)}},el=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},KB=function(t){var e=t.r,n=t.g,r=t.b,i=t.a,s=i<1?el($t(255*i)):"";return"#"+el(e)+el(n)+el(r)+s},WB=function(t){var e=t.r,n=t.g,r=t.b,i=t.a,s=Math.max(e,n,r),o=s-Math.min(e,n,r),a=o?s===e?(n-r)/o:s===n?2+(r-e)/o:4+(e-n)/o:0;return{h:$t(60*(a<0?a+6:a)),s:$t(s?o/s*100:0),v:$t(s/255*100),a:i}},GB=K.memo(function(t){var e=t.hue,n=t.onChange,r=t.onChangeEnd,i=_p(["react-colorful__hue",t.className]);return K.createElement("div",{className:i},K.createElement(OE,{onMove:function(s){n({h:360*s.left})},onKey:function(s){n({h:ca(e+360*s.left,0,360)})},onEnd:r,"aria-label":"Hue","aria-valuenow":$t(e),"aria-valuemax":"360","aria-valuemin":"0"},K.createElement(RE,{className:"react-colorful__hue-pointer",left:e/360,color:Wf({h:e,s:100,v:100,a:1})})))}),qB=K.memo(function(t){var e=t.hsva,n=t.onChange,r=t.onChangeEnd,i={backgroundColor:Wf({h:e.h,s:100,v:100,a:1})};return K.createElement("div",{className:"react-colorful__saturation",style:i},K.createElement(OE,{onMove:function(s){n({s:100*s.left,v:100-100*s.top})},onKey:function(s){n({s:ca(e.s+100*s.left,0,100),v:ca(e.v-100*s.top,0,100)})},onEnd:r,"aria-label":"Color","aria-valuetext":"Saturation "+$t(e.s)+"%, Brightness "+$t(e.v)+"%"},K.createElement(RE,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:Wf(e)})))}),IE=function(t,e){if(t===e)return!0;for(var n in t)if(t[n]!==e[n])return!1;return!0},YB=function(t,e){return t.toLowerCase()===e.toLowerCase()||IE(Kf(t),Kf(e))};function JB(t,e,n,r){var i=Li(n),s=Li(r),o=x.useState(function(){return t.toHsva(e)}),a=o[0],l=o[1],c=x.useRef({color:e,hsva:a}),d=x.useRef(!1);x.useEffect(function(){if(!t.equal(e,c.current.color)){var h=t.toHsva(e);c.current={hsva:h,color:e},l(h),d.current=!1}},[e,t]),x.useEffect(function(){var h;IE(a,c.current.hsva)||t.equal(h=t.fromHsva(a),c.current.color)||(c.current={hsva:a,color:h},i(h),d.current=!0)},[a,t,i]);var u=x.useCallback(function(h){l(function(m){return Object.assign({},m,h)})},[]),f=x.useCallback(function(){d.current&&(d.current=!1,s(c.current.color))},[s]);return[a,u,f]}var XB=typeof window<"u"?x.useLayoutEffect:x.useEffect,ZB=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},Oy=new Map,QB=function(t){XB(function(){var e=t.current?t.current.ownerDocument:document;if(e!==void 0&&!Oy.has(e)){var n=e.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,Oy.set(e,n);var r=ZB();r&&n.setAttribute("nonce",r),e.head.appendChild(n)}},[])},e3=function(t){var e=t.className,n=t.colorModel,r=t.color,i=r===void 0?n.defaultColor:r,s=t.onChange,o=t.onChangeEnd,a=Td(t,["className","colorModel","color","onChange","onChangeEnd"]),l=x.useRef(null);QB(l);var c=JB(n,i,s,o),d=c[0],u=c[1],f=c[2],h=_p(["react-colorful",e]);return K.createElement("div",eo({},a,{ref:l,className:h}),K.createElement(qB,{hsva:d,onChange:u,onChangeEnd:f}),K.createElement(GB,{hue:d.h,onChange:u,onChangeEnd:f,className:"react-colorful__last-control"}))},t3={defaultColor:"000",toHsva:HB,fromHsva:function(t){return zB({h:t.h,s:t.s,v:t.v,a:1})},equal:YB},n3=function(t){return K.createElement(e3,eo({},t,{colorModel:t3}))},r3=/^#?([0-9A-F]{3,8})$/i,i3=function(t){var e=t.color,n=e===void 0?"":e,r=t.onChange,i=t.onBlur,s=t.escape,o=t.validate,a=t.format,l=t.process,c=Td(t,["color","onChange","onBlur","escape","validate","format","process"]),d=x.useState(function(){return s(n)}),u=d[0],f=d[1],h=Li(r),m=Li(i),g=x.useCallback(function(b){var w=s(b.target.value);f(w),o(w)&&h(l?l(w):w)},[s,l,o,h]),y=x.useCallback(function(b){o(b.target.value)||f(s(n)),m(b)},[n,s,o,m]);return x.useEffect(function(){f(s(n))},[n,s]),K.createElement("input",eo({},c,{value:a?a(u):u,spellCheck:"false",onChange:g,onBlur:y}))},Ry=function(t){return"#"+t},s3=function(t){var e=t.prefixed,n=t.alpha,r=Td(t,["prefixed","alpha"]),i=x.useCallback(function(o){return o.replace(/([^0-9A-F]+)/gi,"").substring(0,n?8:6)},[n]),s=x.useCallback(function(o){return(function(a,l){var c=r3.exec(a),d=c?c[1].length:0;return d===3||d===6||!!l&&d===4||!!l&&d===8})(o,n)},[n]);return K.createElement(i3,eo({},r,{escape:i,format:e?Ry:void 0,process:Ry,validate:s}))};const DE=dt.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",He(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!VT(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$from:r,$to:i}=n,s=t();return r.parentOffset===0?s.insertContentAt({from:Math.max(r.pos-1,0),to:i.pos},{type:this.name}):vv(n)?s.insertContentAt(i.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({tr:o,dispatch:a})=>{var l;if(a){const{$to:c}=o.selection,d=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?o.setSelection(ye.create(o.doc,c.pos+1)):c.nodeAfter.isBlock?o.setSelection(he.create(o.doc,c.pos)):o.setSelection(ye.create(o.doc,c.pos));else{const u=(l=c.parent.type.contentMatch.defaultType)===null||l===void 0?void 0:l.create();u&&(o.insert(d,u),o.setSelection(ye.create(o.doc,d+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[xv({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),o3=/^```([a-z]+)?[\s\n]$/,a3=/^~~~([a-z]+)?[\s\n]$/,LE=dt.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options,s=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",He(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
134
+
135
+ `);return!s||!o?!1:t.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:s}=n;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const a=i.after();return a===void 0?!1:r.nodeAt(a)?t.commands.command(({tr:c})=>(c.setSelection(Se.near(r.resolve(a))),!0)):t.commands.exitCode()}}},addInputRules(){return[xf({find:o3,type:this.type,getAttributes:t=>({language:t[1]})}),xf({find:a3,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Ze({key:new Ge("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i?.mode;if(!n||!s)return!1;const{tr:o,schema:a}=t.state,l=a.text(n.replace(/\r\n?/g,`
136
+ `));return o.replaceSelectionWith(this.type.create({language:s},l)),o.selection.$from.parent.type!==this.type&&o.setSelection(ye.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}});function l3(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function PE(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(e=>{const n=t[e],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&PE(n)}),t}class Iy{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function BE(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function ei(t,...e){const n=Object.create(null);for(const r in t)n[r]=t[r];return e.forEach(function(r){for(const i in r)n[i]=r[i]}),n}const c3="</span>",Dy=t=>!!t.scope,d3=(t,{prefix:e})=>{if(t.startsWith("language:"))return t.replace("language:","language-");if(t.includes(".")){const n=t.split(".");return[`${e}${n.shift()}`,...n.map((r,i)=>`${r}${"_".repeat(i+1)}`)].join(" ")}return`${e}${t}`};class u3{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=BE(e)}openNode(e){if(!Dy(e))return;const n=d3(e.scope,{prefix:this.classPrefix});this.span(n)}closeNode(e){Dy(e)&&(this.buffer+=c3)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}}const Ly=(t={})=>{const e={children:[]};return Object.assign(e,t),e};class Np{constructor(){this.rootNode=Ly(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const n=Ly({scope:e});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,n){return typeof n=="string"?e.addText(n):n.children&&(e.openNode(n),n.children.forEach(r=>this._walk(e,r)),e.closeNode(n)),e}static _collapse(e){typeof e!="string"&&e.children&&(e.children.every(n=>typeof n=="string")?e.children=[e.children.join("")]:e.children.forEach(n=>{Np._collapse(n)}))}}class f3 extends Np{constructor(e){super(),this.options=e}addText(e){e!==""&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,n){const r=e.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new u3(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function da(t){return t?typeof t=="string"?t:t.source:null}function jE(t){return Yi("(?=",t,")")}function h3(t){return Yi("(?:",t,")*")}function p3(t){return Yi("(?:",t,")?")}function Yi(...t){return t.map(n=>da(n)).join("")}function m3(t){const e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function Tp(...t){return"("+(m3(t).capture?"":"?:")+t.map(r=>da(r)).join("|")+")"}function $E(t){return new RegExp(t.toString()+"|").exec("").length-1}function g3(t,e){const n=t&&t.exec(e);return n&&n.index===0}const y3=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Ap(t,{joinWith:e}){let n=0;return t.map(r=>{n+=1;const i=n;let s=da(r),o="";for(;s.length>0;){const a=y3.exec(s);if(!a){o+=s;break}o+=s.substring(0,a.index),s=s.substring(a.index+a[0].length),a[0][0]==="\\"&&a[1]?o+="\\"+String(Number(a[1])+i):(o+=a[0],a[0]==="("&&n++)}return o}).map(r=>`(${r})`).join(e)}const b3=/\b\B/,FE="[a-zA-Z]\\w*",Mp="[a-zA-Z_]\\w*",HE="\\b\\d+(\\.\\d+)?",zE="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",UE="\\b(0b[01]+)",v3="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",x3=(t={})=>{const e=/^#![ ]*\//;return t.binary&&(t.begin=Yi(e,/.*\b/,t.binary,/\b.*/)),ei({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},t)},ua={begin:"\\\\[\\s\\S]",relevance:0},w3={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[ua]},E3={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[ua]},k3={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Ad=function(t,e,n={}){const r=ei({scope:"comment",begin:t,end:e,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const i=Tp("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:Yi(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},S3=Ad("//","$"),C3=Ad("/\\*","\\*/"),_3=Ad("#","$"),N3={scope:"number",begin:HE,relevance:0},T3={scope:"number",begin:zE,relevance:0},A3={scope:"number",begin:UE,relevance:0},M3={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[ua,{begin:/\[/,end:/\]/,relevance:0,contains:[ua]}]},O3={scope:"title",begin:FE,relevance:0},R3={scope:"title",begin:Mp,relevance:0},I3={begin:"\\.\\s*"+Mp,relevance:0},D3=function(t){return Object.assign(t,{"on:begin":(e,n)=>{n.data._beginMatch=e[1]},"on:end":(e,n)=>{n.data._beginMatch!==e[1]&&n.ignoreMatch()}})};var tl=Object.freeze({__proto__:null,APOS_STRING_MODE:w3,BACKSLASH_ESCAPE:ua,BINARY_NUMBER_MODE:A3,BINARY_NUMBER_RE:UE,COMMENT:Ad,C_BLOCK_COMMENT_MODE:C3,C_LINE_COMMENT_MODE:S3,C_NUMBER_MODE:T3,C_NUMBER_RE:zE,END_SAME_AS_BEGIN:D3,HASH_COMMENT_MODE:_3,IDENT_RE:FE,MATCH_NOTHING_RE:b3,METHOD_GUARD:I3,NUMBER_MODE:N3,NUMBER_RE:HE,PHRASAL_WORDS_MODE:k3,QUOTE_STRING_MODE:E3,REGEXP_MODE:M3,RE_STARTERS_RE:v3,SHEBANG:x3,TITLE_MODE:O3,UNDERSCORE_IDENT_RE:Mp,UNDERSCORE_TITLE_MODE:R3});function L3(t,e){t.input[t.index-1]==="."&&e.ignoreMatch()}function P3(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className)}function B3(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=L3,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0))}function j3(t,e){Array.isArray(t.illegal)&&(t.illegal=Tp(...t.illegal))}function $3(t,e){if(t.match){if(t.begin||t.end)throw new Error("begin & end are not supported with match");t.begin=t.match,delete t.match}}function F3(t,e){t.relevance===void 0&&(t.relevance=1)}const H3=(t,e)=>{if(!t.beforeMatch)return;if(t.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},t);Object.keys(t).forEach(r=>{delete t[r]}),t.keywords=n.keywords,t.begin=Yi(n.beforeMatch,jE(n.begin)),t.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},t.relevance=0,delete n.beforeMatch},z3=["of","and","for","in","not","or","if","then","parent","list","value"],U3="keyword";function VE(t,e,n=U3){const r=Object.create(null);return typeof t=="string"?i(n,t.split(" ")):Array.isArray(t)?i(n,t):Object.keys(t).forEach(function(s){Object.assign(r,VE(t[s],e,s))}),r;function i(s,o){e&&(o=o.map(a=>a.toLowerCase())),o.forEach(function(a){const l=a.split("|");r[l[0]]=[s,V3(l[0],l[1])]})}}function V3(t,e){return e?Number(e):K3(t)?0:1}function K3(t){return z3.includes(t.toLowerCase())}const Py={},Pi=t=>{console.error(t)},By=(t,...e)=>{console.log(`WARN: ${t}`,...e)},is=(t,e)=>{Py[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),Py[`${t}/${e}`]=!0)},dc=new Error;function KE(t,e,{key:n}){let r=0;const i=t[n],s={},o={};for(let a=1;a<=e.length;a++)o[a+r]=i[a],s[a+r]=!0,r+=$E(e[a-1]);t[n]=o,t[n]._emit=s,t[n]._multi=!0}function W3(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw Pi("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),dc;if(typeof t.beginScope!="object"||t.beginScope===null)throw Pi("beginScope must be object"),dc;KE(t,t.begin,{key:"beginScope"}),t.begin=Ap(t.begin,{joinWith:""})}}function G3(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw Pi("skip, excludeEnd, returnEnd not compatible with endScope: {}"),dc;if(typeof t.endScope!="object"||t.endScope===null)throw Pi("endScope must be object"),dc;KE(t,t.end,{key:"endScope"}),t.end=Ap(t.end,{joinWith:""})}}function q3(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope)}function Y3(t){q3(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),W3(t),G3(t)}function J3(t){function e(o,a){return new RegExp(da(o),"m"+(t.case_insensitive?"i":"")+(t.unicodeRegex?"u":"")+(a?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(a,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,a]),this.matchAt+=$E(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const a=this.regexes.map(l=>l[1]);this.matcherRe=e(Ap(a,{joinWith:"|"}),!0),this.lastIndex=0}exec(a){this.matcherRe.lastIndex=this.lastIndex;const l=this.matcherRe.exec(a);if(!l)return null;const c=l.findIndex((u,f)=>f>0&&u!==void 0),d=this.matchIndexes[c];return l.splice(0,c),Object.assign(l,d)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(a){if(this.multiRegexes[a])return this.multiRegexes[a];const l=new n;return this.rules.slice(a).forEach(([c,d])=>l.addRule(c,d)),l.compile(),this.multiRegexes[a]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(a,l){this.rules.push([a,l]),l.type==="begin"&&this.count++}exec(a){const l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let c=l.exec(a);if(this.resumingScanAtSamePosition()&&!(c&&c.index===this.lastIndex)){const d=this.getMatcher(0);d.lastIndex=this.lastIndex+1,c=d.exec(a)}return c&&(this.regexIndex+=c.position+1,this.regexIndex===this.count&&this.considerAll()),c}}function i(o){const a=new r;return o.contains.forEach(l=>a.addRule(l.begin,{rule:l,type:"begin"})),o.terminatorEnd&&a.addRule(o.terminatorEnd,{type:"end"}),o.illegal&&a.addRule(o.illegal,{type:"illegal"}),a}function s(o,a){const l=o;if(o.isCompiled)return l;[P3,$3,Y3,H3].forEach(d=>d(o,a)),t.compilerExtensions.forEach(d=>d(o,a)),o.__beforeBegin=null,[B3,j3,F3].forEach(d=>d(o,a)),o.isCompiled=!0;let c=null;return typeof o.keywords=="object"&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),c=o.keywords.$pattern,delete o.keywords.$pattern),c=c||/\w+/,o.keywords&&(o.keywords=VE(o.keywords,t.case_insensitive)),l.keywordPatternRe=e(c,!0),a&&(o.begin||(o.begin=/\B|\b/),l.beginRe=e(l.begin),!o.end&&!o.endsWithParent&&(o.end=/\B|\b/),o.end&&(l.endRe=e(l.end)),l.terminatorEnd=da(l.end)||"",o.endsWithParent&&a.terminatorEnd&&(l.terminatorEnd+=(o.end?"|":"")+a.terminatorEnd)),o.illegal&&(l.illegalRe=e(o.illegal)),o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map(function(d){return X3(d==="self"?o:d)})),o.contains.forEach(function(d){s(d,l)}),o.starts&&s(o.starts,a),l.matcher=i(l),l}if(t.compilerExtensions||(t.compilerExtensions=[]),t.contains&&t.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return t.classNameAliases=ei(t.classNameAliases||{}),s(t)}function WE(t){return t?t.endsWithParent||WE(t.starts):!1}function X3(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return ei(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:WE(t)?ei(t,{starts:t.starts?ei(t.starts):null}):Object.isFrozen(t)?ei(t):t}var Z3="11.10.0";class Q3 extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}}const Lu=BE,jy=ei,$y=Symbol("nomatch"),e4=7,GE=function(t){const e=Object.create(null),n=Object.create(null),r=[];let i=!0;const s="Could not find the language '{}', did you forget to load/include a language module?",o={disableAutodetect:!0,name:"Plain text",contains:[]};let a={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:f3};function l(A){return a.noHighlightRe.test(A)}function c(A){let T=A.className+" ";T+=A.parentNode?A.parentNode.className:"";const P=a.languageDetectRe.exec(T);if(P){const Y=M(P[1]);return Y||(By(s.replace("{}",P[1])),By("Falling back to no-highlight mode for this block.",A)),Y?P[1]:"no-highlight"}return T.split(/\s+/).find(Y=>l(Y)||M(Y))}function d(A,T,P){let Y="",te="";typeof T=="object"?(Y=A,P=T.ignoreIllegals,te=T.language):(is("10.7.0","highlight(lang, code, ...args) has been deprecated."),is("10.7.0",`Please use highlight(code, options) instead.
137
+ https://github.com/highlightjs/highlight.js/issues/2277`),te=A,Y=T),P===void 0&&(P=!0);const pe={code:Y,language:te};q("before:highlight",pe);const Q=pe.result?pe.result:u(pe.language,pe.code,P);return Q.code=pe.code,q("after:highlight",Q),Q}function u(A,T,P,Y){const te=Object.create(null);function pe(U,I){return U.keywords[I]}function Q(){if(!de.keywords){Fe.addText(Me);return}let U=0;de.keywordPatternRe.lastIndex=0;let I=de.keywordPatternRe.exec(Me),re="";for(;I;){re+=Me.substring(U,I.index);const Re=ge.case_insensitive?I[0].toLowerCase():I[0],ft=pe(de,Re);if(ft){const[dn,io]=ft;if(Fe.addText(re),re="",te[Re]=(te[Re]||0)+1,te[Re]<=e4&&(Mt+=io),dn.startsWith("_"))re+=I[0];else{const O=ge.classNameAliases[dn]||dn;Ee(I[0],O)}}else re+=I[0];U=de.keywordPatternRe.lastIndex,I=de.keywordPatternRe.exec(Me)}re+=Me.substring(U),Fe.addText(re)}function X(){if(Me==="")return;let U=null;if(typeof de.subLanguage=="string"){if(!e[de.subLanguage]){Fe.addText(Me);return}U=u(de.subLanguage,Me,!0,At[de.subLanguage]),At[de.subLanguage]=U._top}else U=h(Me,de.subLanguage.length?de.subLanguage:null);de.relevance>0&&(Mt+=U.relevance),Fe.__addSublanguage(U._emitter,U.language)}function ne(){de.subLanguage!=null?X():Q(),Me=""}function Ee(U,I){U!==""&&(Fe.startScope(I),Fe.addText(U),Fe.endScope())}function be(U,I){let re=1;const Re=I.length-1;for(;re<=Re;){if(!U._emit[re]){re++;continue}const ft=ge.classNameAliases[U[re]]||U[re],dn=I[re];ft?Ee(dn,ft):(Me=dn,Q(),Me=""),re++}}function Be(U,I){return U.scope&&typeof U.scope=="string"&&Fe.openNode(ge.classNameAliases[U.scope]||U.scope),U.beginScope&&(U.beginScope._wrap?(Ee(Me,ge.classNameAliases[U.beginScope._wrap]||U.beginScope._wrap),Me=""):U.beginScope._multi&&(be(U.beginScope,I),Me="")),de=Object.create(U,{parent:{value:de}}),de}function Ie(U,I,re){let Re=g3(U.endRe,re);if(Re){if(U["on:end"]){const ft=new Iy(U);U["on:end"](I,ft),ft.isMatchIgnored&&(Re=!1)}if(Re){for(;U.endsParent&&U.parent;)U=U.parent;return U}}if(U.endsWithParent)return Ie(U.parent,I,re)}function Le(U){return de.matcher.regexIndex===0?(Me+=U[0],1):(Ot=!0,0)}function ze(U){const I=U[0],re=U.rule,Re=new Iy(re),ft=[re.__beforeBegin,re["on:begin"]];for(const dn of ft)if(dn&&(dn(U,Re),Re.isMatchIgnored))return Le(I);return re.skip?Me+=I:(re.excludeBegin&&(Me+=I),ne(),!re.returnBegin&&!re.excludeBegin&&(Me=I)),Be(re,U),re.returnBegin?0:I.length}function Pe(U){const I=U[0],re=T.substring(U.index),Re=Ie(de,U,re);if(!Re)return $y;const ft=de;de.endScope&&de.endScope._wrap?(ne(),Ee(I,de.endScope._wrap)):de.endScope&&de.endScope._multi?(ne(),be(de.endScope,U)):ft.skip?Me+=I:(ft.returnEnd||ft.excludeEnd||(Me+=I),ne(),ft.excludeEnd&&(Me=I));do de.scope&&Fe.closeNode(),!de.skip&&!de.subLanguage&&(Mt+=de.relevance),de=de.parent;while(de!==Re.parent);return Re.starts&&Be(Re.starts,U),ft.returnEnd?0:I.length}function je(){const U=[];for(let I=de;I!==ge;I=I.parent)I.scope&&U.unshift(I.scope);U.forEach(I=>Fe.openNode(I))}let ut={};function bt(U,I){const re=I&&I[0];if(Me+=U,re==null)return ne(),0;if(ut.type==="begin"&&I.type==="end"&&ut.index===I.index&&re===""){if(Me+=T.slice(I.index,I.index+1),!i){const Re=new Error(`0 width match regex (${A})`);throw Re.languageName=A,Re.badRule=ut.rule,Re}return 1}if(ut=I,I.type==="begin")return ze(I);if(I.type==="illegal"&&!P){const Re=new Error('Illegal lexeme "'+re+'" for mode "'+(de.scope||"<unnamed>")+'"');throw Re.mode=de,Re}else if(I.type==="end"){const Re=Pe(I);if(Re!==$y)return Re}if(I.type==="illegal"&&re==="")return 1;if(en>1e5&&en>I.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Me+=re,re.length}const ge=M(A);if(!ge)throw Pi(s.replace("{}",A)),new Error('Unknown language: "'+A+'"');const at=J3(ge);let st="",de=Y||at;const At={},Fe=new a.__emitter(a);je();let Me="",Mt=0,qe=0,en=0,Ot=!1;try{if(ge.__emitTokens)ge.__emitTokens(T,Fe);else{for(de.matcher.considerAll();;){en++,Ot?Ot=!1:de.matcher.considerAll(),de.matcher.lastIndex=qe;const U=de.matcher.exec(T);if(!U)break;const I=T.substring(qe,U.index),re=bt(I,U);qe=U.index+re}bt(T.substring(qe))}return Fe.finalize(),st=Fe.toHTML(),{language:A,value:st,relevance:Mt,illegal:!1,_emitter:Fe,_top:de}}catch(U){if(U.message&&U.message.includes("Illegal"))return{language:A,value:Lu(T),illegal:!0,relevance:0,_illegalBy:{message:U.message,index:qe,context:T.slice(qe-100,qe+100),mode:U.mode,resultSoFar:st},_emitter:Fe};if(i)return{language:A,value:Lu(T),illegal:!1,relevance:0,errorRaised:U,_emitter:Fe,_top:de};throw U}}function f(A){const T={value:Lu(A),illegal:!1,relevance:0,_top:o,_emitter:new a.__emitter(a)};return T._emitter.addText(A),T}function h(A,T){T=T||a.languages||Object.keys(e);const P=f(A),Y=T.filter(M).filter(j).map(ne=>u(ne,A,!1));Y.unshift(P);const te=Y.sort((ne,Ee)=>{if(ne.relevance!==Ee.relevance)return Ee.relevance-ne.relevance;if(ne.language&&Ee.language){if(M(ne.language).supersetOf===Ee.language)return 1;if(M(Ee.language).supersetOf===ne.language)return-1}return 0}),[pe,Q]=te,X=pe;return X.secondBest=Q,X}function m(A,T,P){const Y=T&&n[T]||P;A.classList.add("hljs"),A.classList.add(`language-${Y}`)}function g(A){let T=null;const P=c(A);if(l(P))return;if(q("before:highlightElement",{el:A,language:P}),A.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",A);return}if(A.children.length>0&&(a.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(A)),a.throwUnescapedHTML))throw new Q3("One of your code blocks includes unescaped HTML.",A.innerHTML);T=A;const Y=T.textContent,te=P?d(Y,{language:P,ignoreIllegals:!0}):h(Y);A.innerHTML=te.value,A.dataset.highlighted="yes",m(A,P,te.language),A.result={language:te.language,re:te.relevance,relevance:te.relevance},te.secondBest&&(A.secondBest={language:te.secondBest.language,relevance:te.secondBest.relevance}),q("after:highlightElement",{el:A,result:te,text:Y})}function y(A){a=jy(a,A)}const b=()=>{v(),is("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function w(){v(),is("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let k=!1;function v(){if(document.readyState==="loading"){k=!0;return}document.querySelectorAll(a.cssSelector).forEach(g)}function E(){k&&v()}typeof window<"u"&&window.addEventListener&&window.addEventListener("DOMContentLoaded",E,!1);function S(A,T){let P=null;try{P=T(t)}catch(Y){if(Pi("Language definition for '{}' could not be registered.".replace("{}",A)),i)Pi(Y);else throw Y;P=o}P.name||(P.name=A),e[A]=P,P.rawDefinition=T.bind(null,t),P.aliases&&D(P.aliases,{languageName:A})}function C(A){delete e[A];for(const T of Object.keys(n))n[T]===A&&delete n[T]}function N(){return Object.keys(e)}function M(A){return A=(A||"").toLowerCase(),e[A]||e[n[A]]}function D(A,{languageName:T}){typeof A=="string"&&(A=[A]),A.forEach(P=>{n[P.toLowerCase()]=T})}function j(A){const T=M(A);return T&&!T.disableAutodetect}function B(A){A["before:highlightBlock"]&&!A["before:highlightElement"]&&(A["before:highlightElement"]=T=>{A["before:highlightBlock"](Object.assign({block:T.el},T))}),A["after:highlightBlock"]&&!A["after:highlightElement"]&&(A["after:highlightElement"]=T=>{A["after:highlightBlock"](Object.assign({block:T.el},T))})}function F(A){B(A),r.push(A)}function G(A){const T=r.indexOf(A);T!==-1&&r.splice(T,1)}function q(A,T){const P=A;r.forEach(function(Y){Y[P]&&Y[P](T)})}function W(A){return is("10.7.0","highlightBlock will be removed entirely in v12.0"),is("10.7.0","Please use highlightElement now."),g(A)}Object.assign(t,{highlight:d,highlightAuto:h,highlightAll:v,highlightElement:g,highlightBlock:W,configure:y,initHighlighting:b,initHighlightingOnLoad:w,registerLanguage:S,unregisterLanguage:C,listLanguages:N,getLanguage:M,registerAliases:D,autoDetection:j,inherit:jy,addPlugin:F,removePlugin:G}),t.debugMode=function(){i=!1},t.safeMode=function(){i=!0},t.versionString=Z3,t.regex={concat:Yi,lookahead:jE,either:Tp,optional:p3,anyNumberOfTimes:h3};for(const A in tl)typeof tl[A]=="object"&&PE(tl[A]);return Object.assign(t,tl),t},Us=GE({});Us.newInstance=()=>GE({});var t4=Us;Us.HighlightJS=Us;Us.default=Us;var n4=l3(t4);function qE(t,e=[]){return t.map(n=>{const r=[...e,...n.properties?n.properties.className:[]];return n.children?qE(n.children,r):{text:n.value,classes:r}}).flat()}function Fy(t){return t.value||t.children||[]}function r4(t){return!!n4.getLanguage(t)}function Hy({doc:t,name:e,lowlight:n,defaultLanguage:r}){const i=[];return Ts(t,s=>s.type.name===e).forEach(s=>{var o;let a=s.pos+1;const l=s.node.attrs.language||r,c=n.listLanguages(),d=l&&(c.includes(l)||r4(l)||!((o=n.registered)===null||o===void 0)&&o.call(n,l))?Fy(n.highlight(l,s.node.textContent)):Fy(n.highlightAuto(s.node.textContent));qE(d).forEach(u=>{const f=a+u.text.length;if(u.classes.length){const h=jt.inline(a,f,{class:u.classes.join(" ")});i.push(h)}a=f})}),nt.create(t,i)}function i4(t){return typeof t=="function"}function s4({name:t,lowlight:e,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(i=>i4(e[i])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const r=new Ze({key:new Ge("lowlight"),state:{init:(i,{doc:s})=>Hy({doc:s,name:t,lowlight:e,defaultLanguage:n}),apply:(i,s,o,a)=>{const l=o.selection.$head.parent.type.name,c=a.selection.$head.parent.type.name,d=Ts(o.doc,f=>f.type.name===t),u=Ts(a.doc,f=>f.type.name===t);return i.docChanged&&([l,c].includes(t)||u.length!==d.length||i.steps.some(f=>f.from!==void 0&&f.to!==void 0&&d.some(h=>h.pos>=f.from&&h.pos+h.node.nodeSize<=f.to)))?Hy({doc:i.doc,name:t,lowlight:e,defaultLanguage:n}):s.map(i.mapping,i.doc)}},props:{decorations(i){return r.getState(i)}}});return r}const o4=LE.extend({addOptions(){var t;return{...(t=this.parent)===null||t===void 0?void 0:t.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},addProseMirrorPlugins(){var t;return[...((t=this.parent)===null||t===void 0?void 0:t.call(this))||[],s4({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}});function YE(t){const e=t.regex,n=e.concat(/[\p{L}_]/u,e.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},s={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=t.inherit(s,{begin:/\(/,end:/\)/}),a=t.inherit(t.APOS_STRING_MODE,{className:"string"}),l=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),c={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[s,l,a,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[s,o,l,a]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[c],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[c],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:e.concat(/</,e.lookahead(e.concat(n,e.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:c}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function a4(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="(?!struct)("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",a={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},u={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},h=e.optional(i)+t.IDENT_RE+"\\s*\\(",m=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],g=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],y=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],b=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],v={type:g,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:y},E={className:"function.dispatch",relevance:0,keywords:{_hint:b},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},S=[E,u,a,n,t.C_BLOCK_COMMENT_MODE,d,c],C={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:v,contains:S.concat([{begin:/\(/,end:/\)/,keywords:v,contains:S.concat(["self"]),relevance:0}]),relevance:0},N={className:"function",begin:"("+o+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:v,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:v,relevance:0},{begin:h,returnBegin:!0,contains:[f],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,c,d,a,{begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,c,d,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,u]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:v,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(C,N,E,S,[u,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:v,contains:["self",a]},{begin:t.IDENT_RE+"::",keywords:v},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function l4(t){const e={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},n=a4(t),r=n.keywords;return r.type=[...r.type,...e.type],r.literal=[...r.literal,...e.literal],r.built_in=[...r.built_in,...e.built_in],r._hints=e._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function c4(t){const e=t.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:e.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const i={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},s=t.inherit(t.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},a={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,n,i]};i.contains.push(a);const l={match:/\\"/},c={className:"string",begin:/'/,end:/'/},d={match:/\\'/},u={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,n]},f=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],h=t.SHEBANG({binary:`(${f.join("|")})`,relevance:10}),m={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},g=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],y=["true","false"],b={match:/(\/[a-z._-]+)+/},w=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],k=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],v=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],E=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:g,literal:y,built_in:[...w,...k,"set","shopt",...v,...E]},contains:[h,t.SHEBANG(),m,u,s,o,b,a,l,c,d,n]}}function d4(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",a={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},u={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},h=e.optional(i)+t.IDENT_RE+"\\s*\\(",y={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},b=[u,a,n,t.C_BLOCK_COMMENT_MODE,d,c],w={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:y,contains:b.concat([{begin:/\(/,end:/\)/,keywords:y,contains:b.concat(["self"]),relevance:0}]),relevance:0},k={begin:"("+o+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:y,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:y,relevance:0},{begin:h,returnBegin:!0,contains:[t.inherit(f,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:y,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,c,d,a,{begin:/\(/,end:/\)/,keywords:y,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,c,d,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,u]};return{name:"C",aliases:["h"],keywords:y,disableAutodetect:!0,illegal:"</",contains:[].concat(w,k,b,[u,{begin:t.IDENT_RE+"::",keywords:y},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},t.TITLE_MODE]}]),exports:{preprocessor:u,strings:c,keywords:y}}}function u4(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="(?!struct)("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",a={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},u={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},h=e.optional(i)+t.IDENT_RE+"\\s*\\(",m=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],g=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],y=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],b=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],v={type:g,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:y},E={className:"function.dispatch",relevance:0,keywords:{_hint:b},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},S=[E,u,a,n,t.C_BLOCK_COMMENT_MODE,d,c],C={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:v,contains:S.concat([{begin:/\(/,end:/\)/,keywords:v,contains:S.concat(["self"]),relevance:0}]),relevance:0},N={className:"function",begin:"("+o+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:v,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:v,relevance:0},{begin:h,returnBegin:!0,contains:[f],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,c,d,a,{begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,c,d,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,u]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:v,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(C,N,E,S,[u,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:v,contains:["self",a]},{begin:t.IDENT_RE+"::",keywords:v},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function f4(t){const e=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],i=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],s=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],o={keyword:i.concat(s),built_in:e,literal:r},a=t.inherit(t.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),l={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},c={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},d={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},u=t.inherit(d,{illegal:/\n/}),f={className:"subst",begin:/\{/,end:/\}/,keywords:o},h=t.inherit(f,{illegal:/\n/}),m={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},t.BACKSLASH_ESCAPE,h]},g={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},f]},y=t.inherit(g,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]});f.contains=[g,m,d,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,l,t.C_BLOCK_COMMENT_MODE],h.contains=[y,m,u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,l,t.inherit(t.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const b={variants:[c,g,m,d,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},w={begin:"<",end:">",contains:[{beginKeywords:"in out"},a]},k=t.IDENT_RE+"(<"+t.IDENT_RE+"(\\s*,\\s*"+t.IDENT_RE+")*>)?(\\[\\])?",v={begin:"@"+t.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:o,illegal:/::/,contains:[t.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},b,l,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},a,w,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,w,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+k+"\\s+)+"+t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:o,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[t.TITLE_MODE,w],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,relevance:0,contains:[b,l,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},v]}}const h4=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),p4=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],m4=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],g4=[...p4,...m4],y4=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),b4=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),v4=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),x4=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function w4(t){const e=t.regex,n=h4(t),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",s=/@-?\w[\w]*(-\w+)*/,o="[a-zA-Z-][a-zA-Z0-9_-]*",a=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+o,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+b4.join("|")+")"},{begin:":(:)?("+v4.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+x4.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...a,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:e.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:s},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:y4.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+g4.join("|")+")\\b"}]}}function E4(t){const e=t.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:e.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:e.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function k4(t){const s={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:s,illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"string",variants:[t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[t.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:s,illegal:/["']/}]}]}}function S4(t){const e=t.regex,n=/[_A-Za-z][_0-9A-Za-z]*/;return{name:"GraphQL",aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],literal:["true","false","null"]},contains:[t.HASH_COMMENT_MODE,t.QUOTE_STRING_MODE,t.NUMBER_MODE,{scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{scope:"symbol",begin:e.concat(n,e.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}function C4(t){const e=t.regex,n={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:t.NUMBER_RE}]},r=t.COMMENT();r.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const i={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},s={className:"literal",begin:/\bon|off|true|false|yes|no\b/},o={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},a={begin:/\[/,end:/\]/,contains:[r,s,i,o,n,"self"],relevance:0},l=/[A-Za-z0-9_-]+/,c=/"(\\"|[^"])*"/,d=/'[^']*'/,u=e.either(l,c,d),f=e.concat(u,"(\\s*\\.\\s*",u,")*",e.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[r,{className:"section",begin:/\[+/,end:/\]+/},{begin:f,className:"attr",starts:{end:/$/,contains:[r,a,s,i,o,n]}}]}}var us="[0-9](_*[0-9])*",nl=`\\.(${us})`,rl="[0-9a-fA-F](_*[0-9a-fA-F])*",zy={className:"number",variants:[{begin:`(\\b(${us})((${nl})|\\.)?|(${nl}))[eE][+-]?(${us})[fFdD]?\\b`},{begin:`\\b(${us})((${nl})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${nl})[fFdD]?\\b`},{begin:`\\b(${us})[fFdD]\\b`},{begin:`\\b0[xX]((${rl})\\.?|(${rl})?\\.(${rl}))[pP][+-]?(${us})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${rl})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function JE(t,e,n){return n===-1?"":t.replace(e,r=>JE(t,e,n-1))}function _4(t){const e=t.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+JE("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),l={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},c={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},d={className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[t.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:l,illegal:/<\/|#/,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[t.BACKSLASH_ESCAPE]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[e.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[d,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",t.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:l,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[c,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,zy,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},zy,c]}}const Uy="[A-Za-z$_][0-9A-Za-z$_]*",N4=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],T4=["true","false","null","undefined","NaN","Infinity"],XE=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],ZE=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],QE=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],A4=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],M4=[].concat(QE,XE,ZE);function O4(t){const e=t.regex,n=(T,{after:P})=>{const Y="</"+T[0].slice(1);return T.input.indexOf(Y,P)!==-1},r=Uy,i={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(T,P)=>{const Y=T[0].length+T.index,te=T.input[Y];if(te==="<"||te===","){P.ignoreMatch();return}te===">"&&(n(T,{after:Y})||P.ignoreMatch());let pe;const Q=T.input.substring(Y);if(pe=Q.match(/^\s*=/)){P.ignoreMatch();return}if((pe=Q.match(/^\s+extends\s+/))&&pe.index===0){P.ignoreMatch();return}}},a={$pattern:Uy,keyword:N4,literal:T4,built_in:M4,"variable.language":A4},l="[0-9](_?[0-9])*",c=`\\.(${l})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",u={className:"number",variants:[{begin:`(\\b(${d})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${d})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},f={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},h={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},y={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,f]},w={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},k=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,h,m,g,y,{match:/\$\d+/},u];f.contains=k.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(k)});const v=[].concat(w,f.contains),E=v.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(v)}]),S={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:E},C={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},N={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...XE,...ZE]}},M={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},D={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[S],illegal:/%/},j={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function B(T){return e.concat("(?!",T.join("|"),")")}const F={match:e.concat(/\b/,B([...QE,"super","import"].map(T=>`${T}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},G={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},q={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},S]},W="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",A={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(W)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[S]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:E,CLASS_REFERENCE:N},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),M,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,h,m,g,y,w,{match:/\$\d+/},u,N,{scope:"attr",match:r+e.lookahead(":"),relevance:0},A,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[w,t.REGEXP_MODE,{className:"function",begin:W,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:E}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:s},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},D,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[S,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},G,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[S]},F,j,C,q,{match:/\$[(.]/}]}}function R4(t){const e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],i={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[e,n,t.QUOTE_STRING_MODE,i,t.C_NUMBER_MODE,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var fs="[0-9](_*[0-9])*",il=`\\.(${fs})`,sl="[0-9a-fA-F](_*[0-9a-fA-F])*",I4={className:"number",variants:[{begin:`(\\b(${fs})((${il})|\\.)?|(${il}))[eE][+-]?(${fs})[fFdD]?\\b`},{begin:`\\b(${fs})((${il})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${il})[fFdD]?\\b`},{begin:`\\b(${fs})[fFdD]\\b`},{begin:`\\b0[xX]((${sl})\\.?|(${sl})?\\.(${sl}))[pP][+-]?(${fs})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${sl})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function D4(t){const e={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"@"},i={className:"subst",begin:/\$\{/,end:/\}/,contains:[t.C_NUMBER_MODE]},s={className:"variable",begin:"\\$"+t.UNDERSCORE_IDENT_RE},o={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[s,i]},{begin:"'",end:"'",illegal:/\n/,contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[t.BACKSLASH_ESCAPE,s,i]}]};i.contains.push(o);const a={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+t.UNDERSCORE_IDENT_RE+")?"},l={className:"meta",begin:"@"+t.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[t.inherit(o,{className:"string"}),"self"]}]},c=I4,d=t.COMMENT("/\\*","\\*/",{contains:[t.C_BLOCK_COMMENT_MODE]}),u={variants:[{className:"type",begin:t.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},f=u;return f.variants[1].contains=[u],u.variants[1].contains=[f],{name:"Kotlin",aliases:["kt","kts"],keywords:e,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),t.C_LINE_COMMENT_MODE,d,n,r,a,l,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:e,relevance:5,contains:[{begin:t.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[t.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:e,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[u,t.C_LINE_COMMENT_MODE,d],relevance:0},t.C_LINE_COMMENT_MODE,d,a,l,o,t.C_NUMBER_MODE]},d]},{begin:[/class|interface|trait/,/\s+/,t.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},t.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},a,l]},o,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
138
+ `},c]}}const L4=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),P4=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],B4=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],j4=[...P4,...B4],$4=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),e1=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),t1=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),F4=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),H4=e1.concat(t1).sort().reverse();function z4(t){const e=L4(t),n=H4,r="and or not only",i="[\\w-]+",s="("+i+"|@\\{"+i+"\\})",o=[],a=[],l=function(k){return{className:"string",begin:"~?"+k+".*?"+k}},c=function(k,v,E){return{className:k,begin:v,relevance:E}},d={$pattern:/[a-z-]+/,keyword:r,attribute:$4.join(" ")},u={begin:"\\(",end:"\\)",contains:a,keywords:d,relevance:0};a.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,l("'"),l('"'),e.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},e.HEXCOLOR,u,c("variable","@@?"+i,10),c("variable","@\\{"+i+"\\}"),c("built_in","~?`[^`]*?`"),{className:"attribute",begin:i+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},e.IMPORTANT,{beginKeywords:"and not"},e.FUNCTION_DISPATCH);const f=a.concat({begin:/\{/,end:/\}/,contains:o}),h={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(a)},m={begin:s+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+F4.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:a}}]},g={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:d,returnEnd:!0,contains:a,relevance:0}},y={className:"variable",variants:[{begin:"@"+i+"\\s*:",relevance:15},{begin:"@"+i}],starts:{end:"[;}]",returnEnd:!0,contains:f}},b={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:s,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,h,c("keyword","all\\b"),c("variable","@\\{"+i+"\\}"),{begin:"\\b("+j4.join("|")+")\\b",className:"selector-tag"},e.CSS_NUMBER_MODE,c("selector-tag",s,0),c("selector-id","#"+s),c("selector-class","\\."+s,0),c("selector-tag","&",0),e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+e1.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+t1.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:f},{begin:"!important"},e.FUNCTION_DISPATCH]},w={begin:i+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[b]};return o.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,g,y,w,m,b,h,e.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:o}}function U4(t){const e="\\[=*\\[",n="\\]=*\\]",r={begin:e,end:n,contains:["self"]},i=[t.COMMENT("--(?!"+e+")","$"),t.COMMENT("--"+e,n,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:t.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:i.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[t.inherit(t.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:i}].concat(i)},t.C_NUMBER_MODE,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{className:"string",begin:e,end:n,contains:[r],relevance:5}])}}function V4(t){const e={className:"variable",variants:[{begin:"\\$\\("+t.UNDERSCORE_IDENT_RE+"\\)",contains:[t.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},n={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,e]},r={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[e,n]},i={begin:"^"+t.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},s={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},o={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[e]};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[t.HASH_COMMENT_MODE,e,n,r,i,s,o]}}function K4(t){const e=t.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},i={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},s={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},a=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:e.concat(/\[.+?\]\(/,a,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},c={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},d={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},u=t.inherit(c,{contains:[]}),f=t.inherit(d,{contains:[]});c.contains.push(f),d.contains.push(u);let h=[n,l];return[c,d,u,f].forEach(b=>{b.contains=b.contains.concat(h)}),h=h.concat(c,d),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:h},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:h}]}]},n,s,c,d,{className:"quote",begin:"^>\\s+",contains:h,end:"$"},i,r,l,o,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function W4(t){const e={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,a={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},l={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:a,illegal:"</",contains:[e,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,t.C_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+l.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:l,contains:[t.UNDERSCORE_TITLE_MODE]},{begin:"\\."+t.UNDERSCORE_IDENT_RE,relevance:0}]}}function G4(t){const e=t.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,i={$pattern:/[\w.]+/,keyword:n.join(" ")},s={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:i},o={begin:/->\{/,end:/\}/},a={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},l={scope:"variable",variants:[{begin:/\$\d/},{begin:e.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[a]},c={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},d=[t.BACKSLASH_ESCAPE,s,l],u=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],f=(g,y,b="\\1")=>{const w=b==="\\1"?b:e.concat(b,y);return e.concat(e.concat("(?:",g,")"),y,/(?:\\.|[^\\\/])*?/,w,/(?:\\.|[^\\\/])*?/,b,r)},h=(g,y,b)=>e.concat(e.concat("(?:",g,")"),y,/(?:\\.|[^\\\/])*?/,b,r),m=[l,t.HASH_COMMENT_MODE,t.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),o,{className:"string",contains:d,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},c,{begin:"(\\/\\/|"+t.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[t.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:f("s|tr|y",e.either(...u,{capture:!0}))},{begin:f("s|tr|y","\\(","\\)")},{begin:f("s|tr|y","\\[","\\]")},{begin:f("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:h("(?:m|qr)?",/\//,/\//)},{begin:h("m|qr",e.either(...u,{capture:!0}),/\1/)},{begin:h("m|qr",/\(/,/\)/)},{begin:h("m|qr",/\[/,/\]/)},{begin:h("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,a]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,a,c]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return s.contains=m,o.contains=m,{name:"Perl",aliases:["pl","pm"],keywords:i,contains:m}}function q4(t){const e=t.regex,n=/(?![A-Za-z0-9])(?![$])/,r=e.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),i=e.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),s=e.concat(/[A-Z]+/,n),o={scope:"variable",match:"\\$+"+r},a={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},l={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},c=t.inherit(t.APOS_STRING_MODE,{illegal:null}),d=t.inherit(t.QUOTE_STRING_MODE,{illegal:null,contains:t.QUOTE_STRING_MODE.contains.concat(l)}),u={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:t.QUOTE_STRING_MODE.contains.concat(l),"on:begin":(G,q)=>{q.data._beginMatch=G[1]||G[2]},"on:end":(G,q)=>{q.data._beginMatch!==G[1]&&q.ignoreMatch()}},f=t.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),h=`[
139
+ ]`,m={scope:"string",variants:[d,c,u,f]},g={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},y=["false","null","true"],b=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],w=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],v={keyword:b,literal:(G=>{const q=[];return G.forEach(W=>{q.push(W),W.toLowerCase()===W?q.push(W.toUpperCase()):q.push(W.toLowerCase())}),q})(y),built_in:w},E=G=>G.map(q=>q.replace(/\|\d+$/,"")),S={variants:[{match:[/new/,e.concat(h,"+"),e.concat("(?!",E(w).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},C=e.concat(r,"\\b(?!\\()"),N={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),C],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,e.concat(/::/,e.lookahead(/(?!class\b)/)),C],scope:{1:"title.class",3:"variable.constant"}},{match:[i,e.concat("::",e.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},M={scope:"attr",match:e.concat(r,e.lookahead(":"),e.lookahead(/(?!::)/))},D={relevance:0,begin:/\(/,end:/\)/,keywords:v,contains:[M,o,N,t.C_BLOCK_COMMENT_MODE,m,g,S]},j={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",E(b).join("\\b|"),"|",E(w).join("\\b|"),"\\b)"),r,e.concat(h,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[D]};D.contains.push(j);const B=[M,N,t.C_BLOCK_COMMENT_MODE,m,g,S],F={begin:e.concat(/#\[\s*\\?/,e.either(i,s)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:y,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:y,keyword:["new","array"]},contains:["self",...B]},...B,{scope:"meta",variants:[{match:i},{match:s}]}]};return{case_insensitive:!1,keywords:v,contains:[F,t.HASH_COMMENT_MODE,t.COMMENT("//","$"),t.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:t.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},a,{scope:"variable.language",match:/\$this\b/},o,j,N,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},S,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},t.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:v,contains:["self",F,o,N,t.C_BLOCK_COMMENT_MODE,m,g]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},t.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[t.inherit(t.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},t.UNDERSCORE_TITLE_MODE]},m,g]}}function Y4(t){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},t.inherit(t.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),t.inherit(t.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function J4(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function X4(t){const e=t.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],a={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},l={className:"meta",begin:/^(>>>|\.\.\.) /},c={className:"subst",begin:/\{/,end:/\}/,keywords:a,illegal:/#/},d={begin:/\{\{/,relevance:0},u={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,l,d,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,l,d,c]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[t.BACKSLASH_ESCAPE,d,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,d,c]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},f="[0-9](_?[0-9])*",h=`(\\b(${f}))?\\.(${f})|\\b(${f})\\.`,m=`\\b|${r.join("|")}`,g={className:"number",relevance:0,variants:[{begin:`(\\b(${f})|(${h}))[eE][+-]?(${f})[jJ]?(?=${m})`},{begin:`(${h})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${m})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${m})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${m})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${m})`},{begin:`\\b(${f})[jJ](?=${m})`}]},y={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:a,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},b={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:["self",l,g,u,t.HASH_COMMENT_MODE]}]};return c.contains=[u,g,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:a,illegal:/(<\/|\?)|=>/,contains:[l,g,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},u,y,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[b]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[g,b,u]}]}}function Z4(t){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function Q4(t){const e=t.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=e.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,s=e.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[t.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:e.lookahead(e.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),t.HASH_COMMENT_MODE,{scope:"string",contains:[t.BACKSLASH_ESCAPE],variants:[t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[i,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[s,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:s},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function e5(t){const e=t.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=e.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=e.concat(r,/(::\w+)*/),o={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},a={className:"doctag",begin:"@[A-Za-z]+"},l={begin:"#<",end:">"},c=[t.COMMENT("#","$",{contains:[a]}),t.COMMENT("^=begin","^=end",{contains:[a],relevance:10}),t.COMMENT("^__END__",t.MATCH_NOTHING_RE)],d={className:"subst",begin:/#\{/,end:/\}/,keywords:o},u={className:"string",contains:[t.BACKSLASH_ESCAPE,d],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:e.concat(/<<[-~]?'?/,e.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[t.BACKSLASH_ESCAPE,d]})]}]},f="[1-9](_?[0-9])*|0",h="[0-9](_?[0-9])*",m={className:"number",relevance:0,variants:[{begin:`\\b(${f})(\\.(${h}))?([eE][+-]?(${h})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},g={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:o}]},S=[u,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:o},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:o},{relevance:0,match:[i,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[g]},{begin:t.IDENT_RE+"::"},{className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[u,{begin:n}],relevance:0},m,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:o},{begin:"("+t.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[t.BACKSLASH_ESCAPE,d],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(l,c),relevance:0}].concat(l,c);d.contains=S,g.contains=S;const D=[{begin:/^\s*=>/,starts:{end:"$",contains:S}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:o,contains:S}}];return c.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:o,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(D).concat(c).concat(S)}}function t5(t){const e=t.regex,n=/(r#)?/,r=e.concat(n,t.UNDERSCORE_IDENT_RE),i=e.concat(n,t.IDENT_RE),s={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,e.lookahead(/\s*\(/))},o="([ui](8|16|32|64|128|size)|f(32|64))?",a=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],l=["true","false","Some","None","Ok","Err"],c=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],d=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:t.IDENT_RE+"!?",type:d,keyword:a,literal:l,built_in:c},illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.COMMENT("/\\*","\\*/",{contains:["self"]}),t.inherit(t.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+o},{begin:"\\b0o([0-7_]+)"+o},{begin:"\\b0x([A-Fa-f0-9_]+)"+o},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+o}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:t.IDENT_RE+"::",keywords:{keyword:"Self",built_in:c,type:d}},{className:"punctuation",begin:"->"},s]}}const n5=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),r5=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],i5=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],s5=[...r5,...i5],o5=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),a5=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),l5=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),c5=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function d5(t){const e=n5(t),n=l5,r=a5,i="@[a-z-]+",s="and or not only",a={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,e.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+s5.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},a,{begin:/\(/,end:/\)/,contains:[e.CSS_NUMBER_MODE]},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+c5.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[e.BLOCK_COMMENT,a,e.HEXCOLOR,e.CSS_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,e.IMPORTANT,e.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:i,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:o5.join(" ")},contains:[{begin:i,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},a,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,e.HEXCOLOR,e.CSS_NUMBER_MODE]},e.FUNCTION_DISPATCH]}}function u5(t){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function f5(t){const e=t.regex,n=t.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},s=["true","false","unknown"],o=["double precision","large object","with timezone","without timezone"],a=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],l=["add","asc","collation","desc","final","first","last","view"],c=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],d=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],u=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],f=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],h=d,m=[...c,...l].filter(E=>!d.includes(E)),g={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},y={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},b={match:e.concat(/\b/,e.either(...h),/\s*\(/),relevance:0,keywords:{built_in:h}};function w(E){return e.concat(/\b/,e.either(...E.map(S=>S.replace(/\s+/,"\\s+"))),/\b/)}const k={scope:"keyword",match:w(f),relevance:0};function v(E,{exceptions:S,when:C}={}){const N=C;return S=S||[],E.map(M=>M.match(/\|\d+$/)||S.includes(M)?M:N(M)?`${M}|0`:M)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:v(m,{when:E=>E.length<3}),literal:s,type:a,built_in:u},contains:[{scope:"type",match:w(o)},k,b,g,r,i,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,y]}}function n1(t){return t?typeof t=="string"?t:t.source:null}function co(t){return Ve("(?=",t,")")}function Ve(...t){return t.map(n=>n1(n)).join("")}function h5(t){const e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function qt(...t){return"("+(h5(t).capture?"":"?:")+t.map(r=>n1(r)).join("|")+")"}const Op=t=>Ve(/\b/,t,/\w$/.test(t)?/\b/:/\B/),p5=["Protocol","Type"].map(Op),Vy=["init","self"].map(Op),m5=["Any","Self"],Pu=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],Ky=["false","nil","true"],g5=["assignment","associativity","higherThan","left","lowerThan","none","right"],y5=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],Wy=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],r1=qt(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),i1=qt(r1,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),Bu=Ve(r1,i1,"*"),s1=qt(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),uc=qt(s1,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Wn=Ve(s1,uc,"*"),ol=Ve(/[A-Z]/,uc,"*"),b5=["attached","autoclosure",Ve(/convention\(/,qt("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Ve(/objc\(/,Wn,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],v5=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function x5(t){const e={match:/\s+/,relevance:0},n=t.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[t.C_LINE_COMMENT_MODE,n],i={match:[/\./,qt(...p5,...Vy)],className:{2:"keyword"}},s={match:Ve(/\./,qt(...Pu)),relevance:0},o=Pu.filter(ge=>typeof ge=="string").concat(["_|0"]),a=Pu.filter(ge=>typeof ge!="string").concat(m5).map(Op),l={variants:[{className:"keyword",match:qt(...a,...Vy)}]},c={$pattern:qt(/\b\w+/,/#\w+/),keyword:o.concat(y5),literal:Ky},d=[i,s,l],u={match:Ve(/\./,qt(...Wy)),relevance:0},f={className:"built_in",match:Ve(/\b/,qt(...Wy),/(?=\()/)},h=[u,f],m={match:/->/,relevance:0},g={className:"operator",relevance:0,variants:[{match:Bu},{match:`\\.(\\.|${i1})+`}]},y=[m,g],b="([0-9]_*)+",w="([0-9a-fA-F]_*)+",k={className:"number",relevance:0,variants:[{match:`\\b(${b})(\\.(${b}))?([eE][+-]?(${b}))?\\b`},{match:`\\b0x(${w})(\\.(${w}))?([pP][+-]?(${b}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},v=(ge="")=>({className:"subst",variants:[{match:Ve(/\\/,ge,/[0\\tnr"']/)},{match:Ve(/\\/,ge,/u\{[0-9a-fA-F]{1,8}\}/)}]}),E=(ge="")=>({className:"subst",match:Ve(/\\/,ge,/[\t ]*(?:[\r\n]|\r\n)/)}),S=(ge="")=>({className:"subst",label:"interpol",begin:Ve(/\\/,ge,/\(/),end:/\)/}),C=(ge="")=>({begin:Ve(ge,/"""/),end:Ve(/"""/,ge),contains:[v(ge),E(ge),S(ge)]}),N=(ge="")=>({begin:Ve(ge,/"/),end:Ve(/"/,ge),contains:[v(ge),S(ge)]}),M={className:"string",variants:[C(),C("#"),C("##"),C("###"),N(),N("#"),N("##"),N("###")]},D=[t.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[t.BACKSLASH_ESCAPE]}],j={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:D},B=ge=>{const at=Ve(ge,/\//),st=Ve(/\//,ge);return{begin:at,end:st,contains:[...D,{scope:"comment",begin:`#(?!.*${st})`,end:/$/}]}},F={scope:"regexp",variants:[B("###"),B("##"),B("#"),j]},G={match:Ve(/`/,Wn,/`/)},q={className:"variable",match:/\$\d+/},W={className:"variable",match:`\\$${uc}+`},A=[G,q,W],T={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:v5,contains:[...y,k,M]}]}},P={scope:"keyword",match:Ve(/@/,qt(...b5),co(qt(/\(/,/\s+/)))},Y={scope:"meta",match:Ve(/@/,Wn)},te=[T,P,Y],pe={match:co(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Ve(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,uc,"+")},{className:"type",match:ol,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Ve(/\s+&\s+/,co(ol)),relevance:0}]},Q={begin:/</,end:/>/,keywords:c,contains:[...r,...d,...te,m,pe]};pe.contains.push(Q);const X={match:Ve(Wn,/\s*:/),keywords:"_|0",relevance:0},ne={begin:/\(/,end:/\)/,relevance:0,keywords:c,contains:["self",X,...r,F,...d,...h,...y,k,M,...A,...te,pe]},Ee={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,pe]},be={begin:qt(co(Ve(Wn,/\s*:/)),co(Ve(Wn,/\s+/,Wn,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Wn}]},Be={begin:/\(/,end:/\)/,keywords:c,contains:[be,...r,...d,...y,k,M,...te,pe,ne],endsParent:!0,illegal:/["']/},Ie={match:[/(func|macro)/,/\s+/,qt(G.match,Wn,Bu)],className:{1:"keyword",3:"title.function"},contains:[Ee,Be,e],illegal:[/\[/,/%/]},Le={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[Ee,Be,e],illegal:/\[|%/},ze={match:[/operator/,/\s+/,Bu],className:{1:"keyword",3:"title"}},Pe={begin:[/precedencegroup/,/\s+/,ol],className:{1:"keyword",3:"title"},contains:[pe],keywords:[...g5,...Ky],end:/}/},je={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},ut={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},bt={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,Wn,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:c,contains:[Ee,...d,{begin:/:/,end:/\{/,keywords:c,contains:[{scope:"title.class.inherited",match:ol},...d],relevance:0}]};for(const ge of M.variants){const at=ge.contains.find(de=>de.label==="interpol");at.keywords=c;const st=[...d,...h,...y,k,M,...A];at.contains=[...st,{begin:/\(/,end:/\)/,contains:["self",...st]}]}return{name:"Swift",keywords:c,contains:[...r,Ie,Le,je,ut,bt,ze,Pe,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},F,...d,...h,...y,k,M,...A,...te,pe,ne]}}const fc="[A-Za-z$_][0-9A-Za-z$_]*",o1=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],a1=["true","false","null","undefined","NaN","Infinity"],l1=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],c1=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],d1=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],u1=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],f1=[].concat(d1,l1,c1);function w5(t){const e=t.regex,n=(T,{after:P})=>{const Y="</"+T[0].slice(1);return T.input.indexOf(Y,P)!==-1},r=fc,i={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(T,P)=>{const Y=T[0].length+T.index,te=T.input[Y];if(te==="<"||te===","){P.ignoreMatch();return}te===">"&&(n(T,{after:Y})||P.ignoreMatch());let pe;const Q=T.input.substring(Y);if(pe=Q.match(/^\s*=/)){P.ignoreMatch();return}if((pe=Q.match(/^\s+extends\s+/))&&pe.index===0){P.ignoreMatch();return}}},a={$pattern:fc,keyword:o1,literal:a1,built_in:f1,"variable.language":u1},l="[0-9](_?[0-9])*",c=`\\.(${l})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",u={className:"number",variants:[{begin:`(\\b(${d})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${d})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},f={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},h={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},y={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,f]},w={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},k=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,h,m,g,y,{match:/\$\d+/},u];f.contains=k.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(k)});const v=[].concat(w,f.contains),E=v.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(v)}]),S={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:E},C={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},N={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...l1,...c1]}},M={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},D={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[S],illegal:/%/},j={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function B(T){return e.concat("(?!",T.join("|"),")")}const F={match:e.concat(/\b/,B([...d1,"super","import"].map(T=>`${T}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},G={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},q={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},S]},W="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",A={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(W)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[S]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:E,CLASS_REFERENCE:N},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),M,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,h,m,g,y,w,{match:/\$\d+/},u,N,{scope:"attr",match:r+e.lookahead(":"),relevance:0},A,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[w,t.REGEXP_MODE,{className:"function",begin:W,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:E}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:s},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},D,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[S,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},G,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[S]},F,j,C,q,{match:/\$[(.]/}]}}function E5(t){const e=t.regex,n=w5(t),r=fc,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],s={begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[n.exports.CLASS_REFERENCE]},a={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],c={$pattern:fc,keyword:o1.concat(l),literal:a1,built_in:f1.concat(i),"variable.language":u1},d={className:"meta",begin:"@"+r},u=(g,y,b)=>{const w=g.contains.findIndex(k=>k.label===y);if(w===-1)throw new Error("can not find mode to replace");g.contains.splice(w,1,b)};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(d);const f=n.contains.find(g=>g.scope==="attr"),h=Object.assign({},f,{match:e.concat(r,e.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,f,h]),n.contains=n.contains.concat([d,s,o,h]),u(n,"shebang",t.SHEBANG()),u(n,"use_strict",a);const m=n.contains.find(g=>g.label==="func.def");return m.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function k5(t){const e=t.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,s=/\d{4}-\d{1,2}-\d{1,2}/,o=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,a=/\d{1,2}(:\d{1,2}){1,2}/,l={className:"literal",variants:[{begin:e.concat(/# */,e.either(s,i),/ *#/)},{begin:e.concat(/# */,a,/ *#/)},{begin:e.concat(/# */,o,/ *#/)},{begin:e.concat(/# */,e.either(s,i),/ +/,e.either(o,a),/ *#/)}]},c={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},d={className:"label",begin:/^\w+:/},u=t.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),f=t.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,r,l,c,d,u,f,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[f]}]}}function S5(t){t.regex;const e=t.COMMENT(/\(;/,/;\)/);e.contains.push("self");const n=t.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],i={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},s={className:"variable",begin:/\$[\w_]+/},o={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},a={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},l={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},c={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[n,e,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},s,o,i,t.QUOTE_STRING_MODE,l,c,a]}}function C5(t){const e="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},s={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,i]},a=t.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),f={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},h={end:",",endsWithParent:!0,excludeEnd:!0,keywords:e,relevance:0},m={begin:/\{/,end:/\}/,contains:[h],illegal:"\\n",relevance:0},g={begin:"\\[",end:"\\]",contains:[h],illegal:"\\n",relevance:0},y=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+t.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+t.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},t.HASH_COMMENT_MODE,{beginKeywords:e,keywords:{literal:e}},f,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},m,g,s,o],b=[...y];return b.pop(),b.push(a),h.contains=b,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:y}}const _5={arduino:l4,bash:c4,c:d4,cpp:u4,csharp:f4,css:w4,diff:E4,go:k4,graphql:S4,ini:C4,java:_4,javascript:O4,json:R4,kotlin:D4,less:z4,lua:U4,makefile:V4,markdown:K4,objectivec:W4,perl:G4,php:q4,"php-template":Y4,plaintext:J4,python:X4,"python-repl":Z4,r:Q4,ruby:e5,rust:t5,scss:d5,shell:u5,sql:f5,swift:x5,typescript:E5,vbnet:k5,wasm:S5,xml:YE,yaml:C5};var ju,Gy;function N5(){if(Gy)return ju;Gy=1;function t(_){return _ instanceof Map?_.clear=_.delete=_.set=function(){throw new Error("map is read-only")}:_ instanceof Set&&(_.add=_.clear=_.delete=function(){throw new Error("set is read-only")}),Object.freeze(_),Object.getOwnPropertyNames(_).forEach(R=>{const V=_[R],xe=typeof V;(xe==="object"||xe==="function")&&!Object.isFrozen(V)&&t(V)}),_}class e{constructor(R){R.data===void 0&&(R.data={}),this.data=R.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(_){return _.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function r(_,...R){const V=Object.create(null);for(const xe in _)V[xe]=_[xe];return R.forEach(function(xe){for(const Qe in xe)V[Qe]=xe[Qe]}),V}const i="</span>",s=_=>!!_.scope,o=(_,{prefix:R})=>{if(_.startsWith("language:"))return _.replace("language:","language-");if(_.includes(".")){const V=_.split(".");return[`${R}${V.shift()}`,...V.map((xe,Qe)=>`${xe}${"_".repeat(Qe+1)}`)].join(" ")}return`${R}${_}`};class a{constructor(R,V){this.buffer="",this.classPrefix=V.classPrefix,R.walk(this)}addText(R){this.buffer+=n(R)}openNode(R){if(!s(R))return;const V=o(R.scope,{prefix:this.classPrefix});this.span(V)}closeNode(R){s(R)&&(this.buffer+=i)}value(){return this.buffer}span(R){this.buffer+=`<span class="${R}">`}}const l=(_={})=>{const R={children:[]};return Object.assign(R,_),R};class c{constructor(){this.rootNode=l(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(R){this.top.children.push(R)}openNode(R){const V=l({scope:R});this.add(V),this.stack.push(V)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(R){return this.constructor._walk(R,this.rootNode)}static _walk(R,V){return typeof V=="string"?R.addText(V):V.children&&(R.openNode(V),V.children.forEach(xe=>this._walk(R,xe)),R.closeNode(V)),R}static _collapse(R){typeof R!="string"&&R.children&&(R.children.every(V=>typeof V=="string")?R.children=[R.children.join("")]:R.children.forEach(V=>{c._collapse(V)}))}}class d extends c{constructor(R){super(),this.options=R}addText(R){R!==""&&this.add(R)}startScope(R){this.openNode(R)}endScope(){this.closeNode()}__addSublanguage(R,V){const xe=R.root;V&&(xe.scope=`language:${V}`),this.add(xe)}toHTML(){return new a(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function u(_){return _?typeof _=="string"?_:_.source:null}function f(_){return g("(?=",_,")")}function h(_){return g("(?:",_,")*")}function m(_){return g("(?:",_,")?")}function g(..._){return _.map(V=>u(V)).join("")}function y(_){const R=_[_.length-1];return typeof R=="object"&&R.constructor===Object?(_.splice(_.length-1,1),R):{}}function b(..._){return"("+(y(_).capture?"":"?:")+_.map(xe=>u(xe)).join("|")+")"}function w(_){return new RegExp(_.toString()+"|").exec("").length-1}function k(_,R){const V=_&&_.exec(R);return V&&V.index===0}const v=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function E(_,{joinWith:R}){let V=0;return _.map(xe=>{V+=1;const Qe=V;let Ye=u(xe),ce="";for(;Ye.length>0;){const ee=v.exec(Ye);if(!ee){ce+=Ye;break}ce+=Ye.substring(0,ee.index),Ye=Ye.substring(ee.index+ee[0].length),ee[0][0]==="\\"&&ee[1]?ce+="\\"+String(Number(ee[1])+Qe):(ce+=ee[0],ee[0]==="("&&V++)}return ce}).map(xe=>`(${xe})`).join(R)}const S=/\b\B/,C="[a-zA-Z]\\w*",N="[a-zA-Z_]\\w*",M="\\b\\d+(\\.\\d+)?",D="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",j="\\b(0b[01]+)",B="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",F=(_={})=>{const R=/^#![ ]*\//;return _.binary&&(_.begin=g(R,/.*\b/,_.binary,/\b.*/)),r({scope:"meta",begin:R,end:/$/,relevance:0,"on:begin":(V,xe)=>{V.index!==0&&xe.ignoreMatch()}},_)},G={begin:"\\\\[\\s\\S]",relevance:0},q={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[G]},W={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[G]},A={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},T=function(_,R,V={}){const xe=r({scope:"comment",begin:_,end:R,contains:[]},V);xe.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const Qe=b("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return xe.contains.push({begin:g(/[ ]+/,"(",Qe,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),xe},P=T("//","$"),Y=T("/\\*","\\*/"),te=T("#","$"),pe={scope:"number",begin:M,relevance:0},Q={scope:"number",begin:D,relevance:0},X={scope:"number",begin:j,relevance:0},ne={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[G,{begin:/\[/,end:/\]/,relevance:0,contains:[G]}]},Ee={scope:"title",begin:C,relevance:0},be={scope:"title",begin:N,relevance:0},Be={begin:"\\.\\s*"+N,relevance:0};var Le=Object.freeze({__proto__:null,APOS_STRING_MODE:q,BACKSLASH_ESCAPE:G,BINARY_NUMBER_MODE:X,BINARY_NUMBER_RE:j,COMMENT:T,C_BLOCK_COMMENT_MODE:Y,C_LINE_COMMENT_MODE:P,C_NUMBER_MODE:Q,C_NUMBER_RE:D,END_SAME_AS_BEGIN:function(_){return Object.assign(_,{"on:begin":(R,V)=>{V.data._beginMatch=R[1]},"on:end":(R,V)=>{V.data._beginMatch!==R[1]&&V.ignoreMatch()}})},HASH_COMMENT_MODE:te,IDENT_RE:C,MATCH_NOTHING_RE:S,METHOD_GUARD:Be,NUMBER_MODE:pe,NUMBER_RE:M,PHRASAL_WORDS_MODE:A,QUOTE_STRING_MODE:W,REGEXP_MODE:ne,RE_STARTERS_RE:B,SHEBANG:F,TITLE_MODE:Ee,UNDERSCORE_IDENT_RE:N,UNDERSCORE_TITLE_MODE:be});function ze(_,R){_.input[_.index-1]==="."&&R.ignoreMatch()}function Pe(_,R){_.className!==void 0&&(_.scope=_.className,delete _.className)}function je(_,R){R&&_.beginKeywords&&(_.begin="\\b("+_.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",_.__beforeBegin=ze,_.keywords=_.keywords||_.beginKeywords,delete _.beginKeywords,_.relevance===void 0&&(_.relevance=0))}function ut(_,R){Array.isArray(_.illegal)&&(_.illegal=b(..._.illegal))}function bt(_,R){if(_.match){if(_.begin||_.end)throw new Error("begin & end are not supported with match");_.begin=_.match,delete _.match}}function ge(_,R){_.relevance===void 0&&(_.relevance=1)}const at=(_,R)=>{if(!_.beforeMatch)return;if(_.starts)throw new Error("beforeMatch cannot be used with starts");const V=Object.assign({},_);Object.keys(_).forEach(xe=>{delete _[xe]}),_.keywords=V.keywords,_.begin=g(V.beforeMatch,f(V.begin)),_.starts={relevance:0,contains:[Object.assign(V,{endsParent:!0})]},_.relevance=0,delete V.beforeMatch},st=["of","and","for","in","not","or","if","then","parent","list","value"],de="keyword";function At(_,R,V=de){const xe=Object.create(null);return typeof _=="string"?Qe(V,_.split(" ")):Array.isArray(_)?Qe(V,_):Object.keys(_).forEach(function(Ye){Object.assign(xe,At(_[Ye],R,Ye))}),xe;function Qe(Ye,ce){R&&(ce=ce.map(ee=>ee.toLowerCase())),ce.forEach(function(ee){const we=ee.split("|");xe[we[0]]=[Ye,Fe(we[0],we[1])]})}}function Fe(_,R){return R?Number(R):Me(_)?0:1}function Me(_){return st.includes(_.toLowerCase())}const Mt={},qe=_=>{console.error(_)},en=(_,...R)=>{console.log(`WARN: ${_}`,...R)},Ot=(_,R)=>{Mt[`${_}/${R}`]||(console.log(`Deprecated as of ${_}. ${R}`),Mt[`${_}/${R}`]=!0)},U=new Error;function I(_,R,{key:V}){let xe=0;const Qe=_[V],Ye={},ce={};for(let ee=1;ee<=R.length;ee++)ce[ee+xe]=Qe[ee],Ye[ee+xe]=!0,xe+=w(R[ee-1]);_[V]=ce,_[V]._emit=Ye,_[V]._multi=!0}function re(_){if(Array.isArray(_.begin)){if(_.skip||_.excludeBegin||_.returnBegin)throw qe("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),U;if(typeof _.beginScope!="object"||_.beginScope===null)throw qe("beginScope must be object"),U;I(_,_.begin,{key:"beginScope"}),_.begin=E(_.begin,{joinWith:""})}}function Re(_){if(Array.isArray(_.end)){if(_.skip||_.excludeEnd||_.returnEnd)throw qe("skip, excludeEnd, returnEnd not compatible with endScope: {}"),U;if(typeof _.endScope!="object"||_.endScope===null)throw qe("endScope must be object"),U;I(_,_.end,{key:"endScope"}),_.end=E(_.end,{joinWith:""})}}function ft(_){_.scope&&typeof _.scope=="object"&&_.scope!==null&&(_.beginScope=_.scope,delete _.scope)}function dn(_){ft(_),typeof _.beginScope=="string"&&(_.beginScope={_wrap:_.beginScope}),typeof _.endScope=="string"&&(_.endScope={_wrap:_.endScope}),re(_),Re(_)}function io(_){function R(ce,ee){return new RegExp(u(ce),"m"+(_.case_insensitive?"i":"")+(_.unicodeRegex?"u":"")+(ee?"g":""))}class V{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(ee,we){we.position=this.position++,this.matchIndexes[this.matchAt]=we,this.regexes.push([we,ee]),this.matchAt+=w(ee)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const ee=this.regexes.map(we=>we[1]);this.matcherRe=R(E(ee,{joinWith:"|"}),!0),this.lastIndex=0}exec(ee){this.matcherRe.lastIndex=this.lastIndex;const we=this.matcherRe.exec(ee);if(!we)return null;const Et=we.findIndex((oo,Ld)=>Ld>0&&oo!==void 0),ht=this.matchIndexes[Et];return we.splice(0,Et),Object.assign(we,ht)}}class xe{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(ee){if(this.multiRegexes[ee])return this.multiRegexes[ee];const we=new V;return this.rules.slice(ee).forEach(([Et,ht])=>we.addRule(Et,ht)),we.compile(),this.multiRegexes[ee]=we,we}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(ee,we){this.rules.push([ee,we]),we.type==="begin"&&this.count++}exec(ee){const we=this.getMatcher(this.regexIndex);we.lastIndex=this.lastIndex;let Et=we.exec(ee);if(this.resumingScanAtSamePosition()&&!(Et&&Et.index===this.lastIndex)){const ht=this.getMatcher(0);ht.lastIndex=this.lastIndex+1,Et=ht.exec(ee)}return Et&&(this.regexIndex+=Et.position+1,this.regexIndex===this.count&&this.considerAll()),Et}}function Qe(ce){const ee=new xe;return ce.contains.forEach(we=>ee.addRule(we.begin,{rule:we,type:"begin"})),ce.terminatorEnd&&ee.addRule(ce.terminatorEnd,{type:"end"}),ce.illegal&&ee.addRule(ce.illegal,{type:"illegal"}),ee}function Ye(ce,ee){const we=ce;if(ce.isCompiled)return we;[Pe,bt,dn,at].forEach(ht=>ht(ce,ee)),_.compilerExtensions.forEach(ht=>ht(ce,ee)),ce.__beforeBegin=null,[je,ut,ge].forEach(ht=>ht(ce,ee)),ce.isCompiled=!0;let Et=null;return typeof ce.keywords=="object"&&ce.keywords.$pattern&&(ce.keywords=Object.assign({},ce.keywords),Et=ce.keywords.$pattern,delete ce.keywords.$pattern),Et=Et||/\w+/,ce.keywords&&(ce.keywords=At(ce.keywords,_.case_insensitive)),we.keywordPatternRe=R(Et,!0),ee&&(ce.begin||(ce.begin=/\B|\b/),we.beginRe=R(we.begin),!ce.end&&!ce.endsWithParent&&(ce.end=/\B|\b/),ce.end&&(we.endRe=R(we.end)),we.terminatorEnd=u(we.end)||"",ce.endsWithParent&&ee.terminatorEnd&&(we.terminatorEnd+=(ce.end?"|":"")+ee.terminatorEnd)),ce.illegal&&(we.illegalRe=R(ce.illegal)),ce.contains||(ce.contains=[]),ce.contains=[].concat(...ce.contains.map(function(ht){return ae(ht==="self"?ce:ht)})),ce.contains.forEach(function(ht){Ye(ht,we)}),ce.starts&&Ye(ce.starts,ee),we.matcher=Qe(we),we}if(_.compilerExtensions||(_.compilerExtensions=[]),_.contains&&_.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return _.classNameAliases=r(_.classNameAliases||{}),Ye(_)}function O(_){return _?_.endsWithParent||O(_.starts):!1}function ae(_){return _.variants&&!_.cachedVariants&&(_.cachedVariants=_.variants.map(function(R){return r(_,{variants:null},R)})),_.cachedVariants?_.cachedVariants:O(_)?r(_,{starts:_.starts?r(_.starts):null}):Object.isFrozen(_)?r(_):_}var ve="11.11.1";class $e extends Error{constructor(R,V){super(R),this.name="HTMLInjectionError",this.html=V}}const Oe=n,wt=r,Gt=Symbol("nomatch"),Pr=7,so=function(_){const R=Object.create(null),V=Object.create(null),xe=[];let Qe=!0;const Ye="Could not find the language '{}', did you forget to load/include a language module?",ce={disableAutodetect:!0,name:"Plain text",contains:[]};let ee={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:d};function we(z){return ee.noHighlightRe.test(z)}function Et(z){let me=z.className+" ";me+=z.parentNode?z.parentNode.className:"";const De=ee.languageDetectRe.exec(me);if(De){const Je=Br(De[1]);return Je||(en(Ye.replace("{}",De[1])),en("Falling back to no-highlight mode for this block.",z)),Je?De[1]:"no-highlight"}return me.split(/\s+/).find(Je=>we(Je)||Br(Je))}function ht(z,me,De){let Je="",vt="";typeof me=="object"?(Je=z,De=me.ignoreIllegals,vt=me.language):(Ot("10.7.0","highlight(lang, code, ...args) has been deprecated."),Ot("10.7.0",`Please use highlight(code, options) instead.
140
+ https://github.com/highlightjs/highlight.js/issues/2277`),vt=z,Je=me),De===void 0&&(De=!0);const In={code:Je,language:vt};Oa("before:highlight",In);const jr=In.result?In.result:oo(In.language,In.code,De);return jr.code=In.code,Oa("after:highlight",jr),jr}function oo(z,me,De,Je){const vt=Object.create(null);function In(J,fe){return J.keywords[fe]}function jr(){if(!ke.keywords){Rt.addText(Xe);return}let J=0;ke.keywordPatternRe.lastIndex=0;let fe=ke.keywordPatternRe.exec(Xe),Ne="";for(;fe;){Ne+=Xe.substring(J,fe.index);const Ue=Vn.case_insensitive?fe[0].toLowerCase():fe[0],Ht=In(ke,Ue);if(Ht){const[hr,Fk]=Ht;if(Rt.addText(Ne),Ne="",vt[Ue]=(vt[Ue]||0)+1,vt[Ue]<=Pr&&(Da+=Fk),hr.startsWith("_"))Ne+=fe[0];else{const Hk=Vn.classNameAliases[hr]||hr;Un(fe[0],Hk)}}else Ne+=fe[0];J=ke.keywordPatternRe.lastIndex,fe=ke.keywordPatternRe.exec(Xe)}Ne+=Xe.substring(J),Rt.addText(Ne)}function Ra(){if(Xe==="")return;let J=null;if(typeof ke.subLanguage=="string"){if(!R[ke.subLanguage]){Rt.addText(Xe);return}J=oo(ke.subLanguage,Xe,!0,rm[ke.subLanguage]),rm[ke.subLanguage]=J._top}else J=Pd(Xe,ke.subLanguage.length?ke.subLanguage:null);ke.relevance>0&&(Da+=J.relevance),Rt.__addSublanguage(J._emitter,J.language)}function un(){ke.subLanguage!=null?Ra():jr(),Xe=""}function Un(J,fe){J!==""&&(Rt.startScope(fe),Rt.addText(J),Rt.endScope())}function Qp(J,fe){let Ne=1;const Ue=fe.length-1;for(;Ne<=Ue;){if(!J._emit[Ne]){Ne++;continue}const Ht=Vn.classNameAliases[J[Ne]]||J[Ne],hr=fe[Ne];Ht?Un(hr,Ht):(Xe=hr,jr(),Xe=""),Ne++}}function em(J,fe){return J.scope&&typeof J.scope=="string"&&Rt.openNode(Vn.classNameAliases[J.scope]||J.scope),J.beginScope&&(J.beginScope._wrap?(Un(Xe,Vn.classNameAliases[J.beginScope._wrap]||J.beginScope._wrap),Xe=""):J.beginScope._multi&&(Qp(J.beginScope,fe),Xe="")),ke=Object.create(J,{parent:{value:ke}}),ke}function tm(J,fe,Ne){let Ue=k(J.endRe,Ne);if(Ue){if(J["on:end"]){const Ht=new e(J);J["on:end"](fe,Ht),Ht.isMatchIgnored&&(Ue=!1)}if(Ue){for(;J.endsParent&&J.parent;)J=J.parent;return J}}if(J.endsWithParent)return tm(J.parent,fe,Ne)}function Lk(J){return ke.matcher.regexIndex===0?(Xe+=J[0],1):(Fd=!0,0)}function Pk(J){const fe=J[0],Ne=J.rule,Ue=new e(Ne),Ht=[Ne.__beforeBegin,Ne["on:begin"]];for(const hr of Ht)if(hr&&(hr(J,Ue),Ue.isMatchIgnored))return Lk(fe);return Ne.skip?Xe+=fe:(Ne.excludeBegin&&(Xe+=fe),un(),!Ne.returnBegin&&!Ne.excludeBegin&&(Xe=fe)),em(Ne,J),Ne.returnBegin?0:fe.length}function Bk(J){const fe=J[0],Ne=me.substring(J.index),Ue=tm(ke,J,Ne);if(!Ue)return Gt;const Ht=ke;ke.endScope&&ke.endScope._wrap?(un(),Un(fe,ke.endScope._wrap)):ke.endScope&&ke.endScope._multi?(un(),Qp(ke.endScope,J)):Ht.skip?Xe+=fe:(Ht.returnEnd||Ht.excludeEnd||(Xe+=fe),un(),Ht.excludeEnd&&(Xe=fe));do ke.scope&&Rt.closeNode(),!ke.skip&&!ke.subLanguage&&(Da+=ke.relevance),ke=ke.parent;while(ke!==Ue.parent);return Ue.starts&&em(Ue.starts,J),Ht.returnEnd?0:fe.length}function jk(){const J=[];for(let fe=ke;fe!==Vn;fe=fe.parent)fe.scope&&J.unshift(fe.scope);J.forEach(fe=>Rt.openNode(fe))}let Ia={};function nm(J,fe){const Ne=fe&&fe[0];if(Xe+=J,Ne==null)return un(),0;if(Ia.type==="begin"&&fe.type==="end"&&Ia.index===fe.index&&Ne===""){if(Xe+=me.slice(fe.index,fe.index+1),!Qe){const Ue=new Error(`0 width match regex (${z})`);throw Ue.languageName=z,Ue.badRule=Ia.rule,Ue}return 1}if(Ia=fe,fe.type==="begin")return Pk(fe);if(fe.type==="illegal"&&!De){const Ue=new Error('Illegal lexeme "'+Ne+'" for mode "'+(ke.scope||"<unnamed>")+'"');throw Ue.mode=ke,Ue}else if(fe.type==="end"){const Ue=Bk(fe);if(Ue!==Gt)return Ue}if(fe.type==="illegal"&&Ne==="")return Xe+=`
141
+ `,1;if($d>1e5&&$d>fe.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Xe+=Ne,Ne.length}const Vn=Br(z);if(!Vn)throw qe(Ye.replace("{}",z)),new Error('Unknown language: "'+z+'"');const $k=io(Vn);let jd="",ke=Je||$k;const rm={},Rt=new ee.__emitter(ee);jk();let Xe="",Da=0,vi=0,$d=0,Fd=!1;try{if(Vn.__emitTokens)Vn.__emitTokens(me,Rt);else{for(ke.matcher.considerAll();;){$d++,Fd?Fd=!1:ke.matcher.considerAll(),ke.matcher.lastIndex=vi;const J=ke.matcher.exec(me);if(!J)break;const fe=me.substring(vi,J.index),Ne=nm(fe,J);vi=J.index+Ne}nm(me.substring(vi))}return Rt.finalize(),jd=Rt.toHTML(),{language:z,value:jd,relevance:Da,illegal:!1,_emitter:Rt,_top:ke}}catch(J){if(J.message&&J.message.includes("Illegal"))return{language:z,value:Oe(me),illegal:!0,relevance:0,_illegalBy:{message:J.message,index:vi,context:me.slice(vi-100,vi+100),mode:J.mode,resultSoFar:jd},_emitter:Rt};if(Qe)return{language:z,value:Oe(me),illegal:!1,relevance:0,errorRaised:J,_emitter:Rt,_top:ke};throw J}}function Ld(z){const me={value:Oe(z),illegal:!1,relevance:0,_top:ce,_emitter:new ee.__emitter(ee)};return me._emitter.addText(z),me}function Pd(z,me){me=me||ee.languages||Object.keys(R);const De=Ld(z),Je=me.filter(Br).filter(Zp).map(un=>oo(un,z,!1));Je.unshift(De);const vt=Je.sort((un,Un)=>{if(un.relevance!==Un.relevance)return Un.relevance-un.relevance;if(un.language&&Un.language){if(Br(un.language).supersetOf===Un.language)return 1;if(Br(Un.language).supersetOf===un.language)return-1}return 0}),[In,jr]=vt,Ra=In;return Ra.secondBest=jr,Ra}function Sk(z,me,De){const Je=me&&V[me]||De;z.classList.add("hljs"),z.classList.add(`language-${Je}`)}function Bd(z){let me=null;const De=Et(z);if(we(De))return;if(Oa("before:highlightElement",{el:z,language:De}),z.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",z);return}if(z.children.length>0&&(ee.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(z)),ee.throwUnescapedHTML))throw new $e("One of your code blocks includes unescaped HTML.",z.innerHTML);me=z;const Je=me.textContent,vt=De?ht(Je,{language:De,ignoreIllegals:!0}):Pd(Je);z.innerHTML=vt.value,z.dataset.highlighted="yes",Sk(z,De,vt.language),z.result={language:vt.language,re:vt.relevance,relevance:vt.relevance},vt.secondBest&&(z.secondBest={language:vt.secondBest.language,relevance:vt.secondBest.relevance}),Oa("after:highlightElement",{el:z,result:vt,text:Je})}function Ck(z){ee=wt(ee,z)}const _k=()=>{Ma(),Ot("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Nk(){Ma(),Ot("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Jp=!1;function Ma(){function z(){Ma()}if(document.readyState==="loading"){Jp||window.addEventListener("DOMContentLoaded",z,!1),Jp=!0;return}document.querySelectorAll(ee.cssSelector).forEach(Bd)}function Tk(z,me){let De=null;try{De=me(_)}catch(Je){if(qe("Language definition for '{}' could not be registered.".replace("{}",z)),Qe)qe(Je);else throw Je;De=ce}De.name||(De.name=z),R[z]=De,De.rawDefinition=me.bind(null,_),De.aliases&&Xp(De.aliases,{languageName:z})}function Ak(z){delete R[z];for(const me of Object.keys(V))V[me]===z&&delete V[me]}function Mk(){return Object.keys(R)}function Br(z){return z=(z||"").toLowerCase(),R[z]||R[V[z]]}function Xp(z,{languageName:me}){typeof z=="string"&&(z=[z]),z.forEach(De=>{V[De.toLowerCase()]=me})}function Zp(z){const me=Br(z);return me&&!me.disableAutodetect}function Ok(z){z["before:highlightBlock"]&&!z["before:highlightElement"]&&(z["before:highlightElement"]=me=>{z["before:highlightBlock"](Object.assign({block:me.el},me))}),z["after:highlightBlock"]&&!z["after:highlightElement"]&&(z["after:highlightElement"]=me=>{z["after:highlightBlock"](Object.assign({block:me.el},me))})}function Rk(z){Ok(z),xe.push(z)}function Ik(z){const me=xe.indexOf(z);me!==-1&&xe.splice(me,1)}function Oa(z,me){const De=z;xe.forEach(function(Je){Je[De]&&Je[De](me)})}function Dk(z){return Ot("10.7.0","highlightBlock will be removed entirely in v12.0"),Ot("10.7.0","Please use highlightElement now."),Bd(z)}Object.assign(_,{highlight:ht,highlightAuto:Pd,highlightAll:Ma,highlightElement:Bd,highlightBlock:Dk,configure:Ck,initHighlighting:_k,initHighlightingOnLoad:Nk,registerLanguage:Tk,unregisterLanguage:Ak,listLanguages:Mk,getLanguage:Br,registerAliases:Xp,autoDetection:Zp,inherit:wt,addPlugin:Rk,removePlugin:Ik}),_.debugMode=function(){Qe=!1},_.safeMode=function(){Qe=!0},_.versionString=ve,_.regex={concat:g,lookahead:f,either:b,optional:m,anyNumberOfTimes:h};for(const z in Le)typeof Le[z]=="object"&&t(Le[z]);return Object.assign(_,Le),_},tn=so({});return tn.newInstance=()=>so({}),ju=tn,tn.HighlightJS=tn,tn.default=tn,ju}var T5=N5();const A5=ah(T5),qy={},M5="hljs-";function O5(t){const e=A5.newInstance();return t&&s(t),{highlight:n,highlightAuto:r,listLanguages:i,register:s,registerAlias:o,registered:a};function n(l,c,d){const u=d||qy,f=typeof u.prefix=="string"?u.prefix:M5;if(!e.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");e.configure({__emitter:R5,classPrefix:f});const h=e.highlight(c,{ignoreIllegals:!0,language:l});if(h.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:h.errorRaised});const m=h._emitter.root,g=m.data;return g.language=h.language,g.relevance=h.relevance,m}function r(l,c){const u=(c||qy).subset||i();let f=-1,h=0,m;for(;++f<u.length;){const g=u[f];if(!e.getLanguage(g))continue;const y=n(g,l,c);y.data&&y.data.relevance!==void 0&&y.data.relevance>h&&(h=y.data.relevance,m=y)}return m||{type:"root",children:[],data:{language:void 0,relevance:h}}}function i(){return e.listLanguages()}function s(l,c){if(typeof l=="string")e.registerLanguage(l,c);else{let d;for(d in l)Object.hasOwn(l,d)&&e.registerLanguage(d,l[d])}}function o(l,c){if(typeof l=="string")e.registerAliases(typeof c=="string"?c:[...c],{languageName:l});else{let d;for(d in l)if(Object.hasOwn(l,d)){const u=l[d];e.registerAliases(typeof u=="string"?u:[...u],{languageName:d})}}}function a(l){return!!e.getLanguage(l)}}class R5{constructor(e){this.options=e,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(e){if(e==="")return;const n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=e:n.children.push({type:"text",value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,n){const r=this.stack[this.stack.length-1],i=e.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:i}):r.children.push(...i)}openNode(e){const n=this,r=e.split(".").map(function(o,a){return a?o+"_".repeat(a):n.options.classPrefix+o}),i=this.stack[this.stack.length-1],s={type:"element",tagName:"span",properties:{className:r},children:[]};i.children.push(s),this.stack.push(s)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const I5=t=>{if(!t.children.length)return;const e=t.querySelectorAll("span");e&&e.forEach(n=>{var r,i;const s=n.getAttribute("style"),o=(i=(r=n.parentElement)===null||r===void 0?void 0:r.closest("span"))===null||i===void 0?void 0:i.getAttribute("style");n.setAttribute("style",`${o};${s}`)})},Yy=$n.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&I5(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",He(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(n,r)=>{if(n.isTextblock)return!0;n.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(s=>!!s))||t.removeMark(r,r+n.nodeSize,this.type)}),!0}}}}),D5=ot.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;return(e=t.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),L5=/^\s*>\s$/,P5=dt.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",He(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Wo({find:L5,type:this.type})]}}),B5=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,j5=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,$5=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,F5=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,H5=$n.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",He(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[As({find:B5,type:this.type}),As({find:$5,type:this.type})]},addPasteRules(){return[zi({find:j5,type:this.type}),zi({find:F5,type:this.type})]}}),z5="listItem",Jy="textStyle",Xy=/^\s*([-+*])\s$/,U5=dt.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",He(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(z5,this.editor.getAttributes(Jy)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Wo({find:Xy,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Wo({find:Xy,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Jy),editor:this.editor})),[t]}}),V5=/(^|[^`])`([^`]+)`(?!`)/,K5=/(^|[^`])`([^`]+)`(?!`)/g,W5=$n.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",He(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[As({find:V5,type:this.type})]},addPasteRules(){return[zi({find:K5,type:this.type})]}}),h1=dt.create({name:"doc",topNode:!0,content:"block+"});function G5(t={}){return new Ze({view(e){return new q5(e,t)}})}class q5{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,a=s.height/i.offsetHeight;if(n){let u=e.nodeBefore,f=e.nodeAfter;if(u||f){let h=this.editorView.nodeDOM(this.cursorPos-(u?u.nodeSize:0));if(h){let m=h.getBoundingClientRect(),g=u?m.bottom:m.top;u&&f&&(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 u=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*o;r={left:u.left-f,right:u.left+f,top:u.top,bottom:u.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,d;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,d=-pageYOffset;else{let u=l.getBoundingClientRect(),f=u.width/l.offsetWidth,h=u.height/l.offsetHeight;c=u.left-l.scrollLeft*f,d=u.top-l.scrollTop*h}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-d)/a+"px",this.element.style.width=(r.right-r.left)/o+"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 n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!s){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=o0(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const p1=ot.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[G5(this.options)]}});class ct extends Se{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return ct.valid(r)?new ct(r):Se.near(r)}content(){return Z.empty}eq(e){return e instanceof ct&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ct(e.resolve(n.pos))}getBookmark(){return new Rp(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!Y5(e)||!J5(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&ct.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let a=e.node(o);if(n>0?e.indexAfter(o)<a.childCount:e.index(o)>0){s=a.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=n;let l=e.doc.resolve(i);if(ct.valid(l))return l}for(;;){let o=n>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!he.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*n),r=!1;continue e}break}s=o,i+=n;let a=e.doc.resolve(i);if(ct.valid(a))return a}return null}}}ct.prototype.visible=!1;ct.findFrom=ct.findGapCursorFrom;Se.jsonID("gapcursor",ct);class Rp{constructor(e){this.pos=e}map(e){return new Rp(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return ct.valid(n)?new ct(n):Se.near(n)}}function m1(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function Y5(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||m1(i.type))return!0;if(i.inlineContent)return!1}}return!0}function J5(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||m1(i.type))return!0;if(i.inlineContent)return!1}}return!0}function X5(){return new Ze({props:{decorations:tj,createSelectionBetween(t,e,n){return e.pos==n.pos&&ct.valid(n)?new ct(n):null},handleClick:Q5,handleKeyDown:Z5,handleDOMEvents:{beforeinput:ej}}})}const Z5=J0({ArrowLeft:al("horiz",-1),ArrowRight:al("horiz",1),ArrowUp:al("vert",-1),ArrowDown:al("vert",1)});function al(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof ye){if(!s.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=ct.findGapCursorFrom(a,e,l);return c?(i&&i(r.tr.setSelection(new ct(c))),!0):!1}}function Q5(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!ct.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&he.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new ct(r))),!0)}function ej(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof ct))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=L.empty;for(let o=r.length-1;o>=0;o--)i=L.from(r[o].createAndFill(null,i));let s=t.state.tr.replace(n.pos,n.pos,new Z(i,0,0));return s.setSelection(ye.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function tj(t){if(!(t.selection instanceof ct))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",nt.create(t.doc,[jt.widget(t.selection.head,e,{key:"gapcursor"})])}const nj=ot.create({name:"gapCursor",addProseMirrorPlugins(){return[X5()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Ae(oe(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),rj=dt.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",He(this.options.HTMLAttributes,t)]},renderText(){return`
142
+ `},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:s}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,l=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:d})=>{if(d&&l&&o){const u=l.filter(f=>a.includes(f.type.name));c.ensureMarks(u)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Ip=dt.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,He(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>xf({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var hc=200,Ct=function(){};Ct.prototype.append=function(e){return e.length?(e=Ct.from(e),!this.length&&e||e.length<hc&&this.leafAppend(e)||this.length<hc&&e.leafPrepend(this)||this.appendInner(e)):this};Ct.prototype.prepend=function(e){return e.length?Ct.from(e).append(this):this};Ct.prototype.appendInner=function(e){return new ij(this,e)};Ct.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Ct.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Ct.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Ct.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Ct.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},n,r),i};Ct.from=function(e){return e instanceof Ct?e:e&&e.length?new g1(e):Ct.empty};var g1=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var l=s;l<o;l++)if(i(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,a){for(var l=s-1;l>=o;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=hc)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=hc)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Ct);Ct.empty=new g1([]);var ij=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,o){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(s,a),o)===!1||s>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(s,a)-a,o+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(i,a),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,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})(Ct);const sj=500;class Dn{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,a,l,c=[],d=[];return this.items.forEach((u,f)=>{if(!u.step){i||(i=this.remapping(r,f+1),s=i.maps.length),s--,d.push(u);return}if(i){d.push(new Gn(u.map));let h=u.step.map(i.slice(s)),m;h&&o.maybeStep(h).doc&&(m=o.mapping.maps[o.mapping.maps.length-1],c.push(new Gn(m,void 0,void 0,c.length+d.length))),s--,m&&i.appendMap(m,s)}else o.maybeStep(u.step);if(u.selection)return a=i?u.selection.map(i.slice(s)):u.selection,l=new Dn(this.items.slice(0,r).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,n,r,i){let s=[],o=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let d=0;d<e.steps.length;d++){let u=e.steps[d].invert(e.docs[d]),f=new Gn(e.mapping.maps[d],u,n),h;(h=l&&l.merge(f))&&(f=h,d?s.pop():a=a.slice(0,a.length-1)),s.push(f),n&&(o++,n=void 0),i||(l=f)}let c=o-r.depth;return c>aj&&(a=oj(a,c),o-=c),new Dn(a.append(s),o)}remapping(e,n){let r=new jo;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new Dn(this.items.append(e.map(n=>new Gn(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},i);let l=n;this.items.forEach(f=>{let h=s.getMirror(--l);if(h==null)return;o=Math.min(o,h);let m=s.maps[h];if(f.step){let g=e.steps[h].invert(e.docs[h]),y=f.selection&&f.selection.map(s.slice(l+1,h));y&&a++,r.push(new Gn(m,g,y))}else r.push(new Gn(m))},i);let c=[];for(let f=n;f<o;f++)c.push(new Gn(s.maps[f]));let d=this.items.slice(0,i).append(c).append(r),u=new Dn(d,a);return u.emptyItemCount()>sj&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let l=o.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let d=o.selection&&o.selection.map(n.slice(r));d&&s++;let u=new Gn(c.invert(),l,d),f,h=i.length-1;(f=i.length&&i[h].merge(u))?i[h]=f:i.push(u)}}else o.map&&r--},this.items.length,0),new Dn(Ct.from(i.reverse()),s)}}Dn.empty=new Dn(Ct.empty,0);function oj(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class Gn{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Gn(n.getMap().invert(),n,this.selection)}}}class Kr{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const aj=20;function lj(t,e,n,r){let i=n.getMeta(Bi),s;if(i)return i.historyState;n.getMeta(uj)&&(t=new Kr(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(Bi))return o.getMeta(Bi).redo?new Kr(t.done.addTransform(n,void 0,r,Ml(e)),t.undone,Zy(n.mapping.maps),t.prevTime,t.prevComposition):new Kr(t.done,t.undone.addTransform(n,void 0,r,Ml(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!o&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!cj(n,t.prevRanges)),c=o?$u(t.prevRanges,n.mapping):Zy(n.mapping.maps);return new Kr(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Ml(e)),Dn.empty,c,n.time,a??t.prevComposition)}else return(s=n.getMeta("rebased"))?new Kr(t.done.rebased(n,s),t.undone.rebased(n,s),$u(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Kr(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),$u(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function cj(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(n=!0)}),n}function Zy(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,s,o)=>e.push(s,o));return e}function $u(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),s=e.map(t[r+1],-1);i<=s&&n.push(i,s)}return n}function dj(t,e,n){let r=Ml(e),i=Bi.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),l=new Kr(n?a:s.remaining,n?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(Bi,{redo:n,historyState:l})}let Fu=!1,Qy=null;function Ml(t){let e=t.plugins;if(Qy!=e){Fu=!1,Qy=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Fu=!0;break}}return Fu}const Bi=new Ge("history"),uj=new Ge("closeHistory");function fj(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Ze({key:Bi,state:{init(){return new Kr(Dn.empty,Dn.empty,null,0,-1)},apply(e,n,r){return lj(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?b1:r=="historyRedo"?v1:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function y1(t,e){return(n,r)=>{let i=Bi.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=dj(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const b1=y1(!1,!0),v1=y1(!0,!0),hj=ot.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>b1(t,e),redo:()=>({state:t,dispatch:e})=>v1(t,e)}},addProseMirrorPlugins(){return[fj(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()}}}),pj=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,mj=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,gj=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,yj=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,bj=$n.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",He(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[As({find:pj,type:this.type}),As({find:gj,type:this.type})]},addPasteRules(){return[zi({find:mj,type:this.type}),zi({find:yj,type:this.type})]}}),x1=dt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",He(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),vj="listItem",eb="textStyle",tb=/^(\d+)\.\s$/,xj=dt.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",He(this.options.HTMLAttributes,n),0]:["ol",He(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(vj,this.editor.getAttributes(eb)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Wo({find:tb,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Wo({find:tb,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(eb)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),Dp=dt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",He(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),wj=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Ej=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,kj=$n.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",He(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[As({find:wj,type:this.type})]},addPasteRules(){return[zi({find:Ej,type:this.type})]}}),Sj=dt.create({name:"text",group:"inline"}),Cj=ot.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(H5.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(P5.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(U5.configure(this.options.bulletList)),this.options.code!==!1&&t.push(W5.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(LE.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(h1.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(p1.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(nj.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(rj.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(Ip.configure(this.options.heading)),this.options.history!==!1&&t.push(hj.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(DE.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(bj.configure(this.options.italic)),this.options.listItem!==!1&&t.push(x1.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(xj.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(Dp.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(kj.configure(this.options.strike)),this.options.text!==!1&&t.push(Sj.configure(this.options.text)),t}}),_j=ot.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!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")}}}),Nj=$n.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",He(this.options.HTMLAttributes,t),0]},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),Tj=ot.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Ze({key:new Ge("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:i}=e,s=[];if(!n||!r)return nt.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((l,c)=>{if(l.isText)return;if(!(i>=c&&i<=c+l.nodeSize-1))return!1;o+=1});let a=0;return t.descendants((l,c)=>{if(l.isText||!(i>=c&&i<=c+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&o-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";s.push(jt.node(c,c+l.nodeSize,{class:this.options.className}))}),nt.create(t,s)}}})]}}),Aj="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Mj="ελ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",Gf="numeric",qf="ascii",Yf="alpha",Ao="asciinumeric",go="alphanumeric",Jf="domain",w1="emoji",Oj="scheme",Rj="slashscheme",Hu="whitespace";function Ij(t,e){return t in e||(e[t]=[]),e[t]}function Ai(t,e,n){e[Gf]&&(e[Ao]=!0,e[go]=!0),e[qf]&&(e[Ao]=!0,e[Yf]=!0),e[Ao]&&(e[go]=!0),e[Yf]&&(e[go]=!0),e[go]&&(e[Jf]=!0),e[w1]&&(e[Jf]=!0);for(const r in e){const i=Ij(r,n);i.indexOf(t)<0&&i.push(t)}}function Dj(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function rn(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}rn.groups={};rn.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],s=e.jr[r][1];if(s&&i.test(t))return s}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let i=0;i<t.length;i++)this.tt(t[i],e,n,r)},tr(t,e,n,r){r=r||rn.groups;let i;return e&&e.j?i=e:(i=new rn(e),n&&r&&Ai(e,n,r)),this.jr.push([t,i]),i},ts(t,e,n,r){let i=this;const s=t.length;if(!s)return i;for(let o=0;o<s-1;o++)i=i.tt(t[o]);return i.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||rn.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const s=e;let o,a=i.go(t);if(a?(o=new rn,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new rn,s){if(r)if(o.t&&typeof o.t=="string"){const l=Object.assign(Dj(o.t,r),n);Ai(s,l,r)}else n&&Ai(s,n,r);o.t=s}return i.j[t]=o,o}};const _e=(t,e,n,r,i)=>t.ta(e,n,r,i),lt=(t,e,n,r,i)=>t.tr(e,n,r,i),nb=(t,e,n,r,i)=>t.ts(e,n,r,i),$=(t,e,n,r,i)=>t.tt(e,n,r,i),vr="WORD",Xf="UWORD",E1="ASCIINUMERICAL",k1="ALPHANUMERICAL",fa="LOCALHOST",Zf="TLD",Qf="UTLD",Ol="SCHEME",hs="SLASH_SCHEME",Lp="NUM",eh="WS",Pp="NL",Mo="OPENBRACE",Oo="CLOSEBRACE",pc="OPENBRACKET",mc="CLOSEBRACKET",gc="OPENPAREN",yc="CLOSEPAREN",bc="OPENANGLEBRACKET",vc="CLOSEANGLEBRACKET",xc="FULLWIDTHLEFTPAREN",wc="FULLWIDTHRIGHTPAREN",Ec="LEFTCORNERBRACKET",kc="RIGHTCORNERBRACKET",Sc="LEFTWHITECORNERBRACKET",Cc="RIGHTWHITECORNERBRACKET",_c="FULLWIDTHLESSTHAN",Nc="FULLWIDTHGREATERTHAN",Tc="AMPERSAND",Ac="APOSTROPHE",Mc="ASTERISK",Wr="AT",Oc="BACKSLASH",Rc="BACKTICK",Ic="CARET",Yr="COLON",Bp="COMMA",Dc="DOLLAR",qn="DOT",Lc="EQUALS",jp="EXCLAMATION",En="HYPHEN",Ro="PERCENT",Pc="PIPE",Bc="PLUS",jc="POUND",Io="QUERY",$p="QUOTE",S1="FULLWIDTHMIDDLEDOT",Fp="SEMI",Yn="SLASH",Do="TILDE",$c="UNDERSCORE",C1="EMOJI",Fc="SYM";var _1=Object.freeze({__proto__:null,ALPHANUMERICAL:k1,AMPERSAND:Tc,APOSTROPHE:Ac,ASCIINUMERICAL:E1,ASTERISK:Mc,AT:Wr,BACKSLASH:Oc,BACKTICK:Rc,CARET:Ic,CLOSEANGLEBRACKET:vc,CLOSEBRACE:Oo,CLOSEBRACKET:mc,CLOSEPAREN:yc,COLON:Yr,COMMA:Bp,DOLLAR:Dc,DOT:qn,EMOJI:C1,EQUALS:Lc,EXCLAMATION:jp,FULLWIDTHGREATERTHAN:Nc,FULLWIDTHLEFTPAREN:xc,FULLWIDTHLESSTHAN:_c,FULLWIDTHMIDDLEDOT:S1,FULLWIDTHRIGHTPAREN:wc,HYPHEN:En,LEFTCORNERBRACKET:Ec,LEFTWHITECORNERBRACKET:Sc,LOCALHOST:fa,NL:Pp,NUM:Lp,OPENANGLEBRACKET:bc,OPENBRACE:Mo,OPENBRACKET:pc,OPENPAREN:gc,PERCENT:Ro,PIPE:Pc,PLUS:Bc,POUND:jc,QUERY:Io,QUOTE:$p,RIGHTCORNERBRACKET:kc,RIGHTWHITECORNERBRACKET:Cc,SCHEME:Ol,SEMI:Fp,SLASH:Yn,SLASH_SCHEME:hs,SYM:Fc,TILDE:Do,TLD:Zf,UNDERSCORE:$c,UTLD:Qf,UWORD:Xf,WORD:vr,WS:eh});const gr=/[a-z]/,uo=new RegExp("\\p{L}","u"),zu=new RegExp("\\p{Emoji}","u"),yr=/\d/,Uu=/\s/,rb="\r",Vu=`
143
+ `,Lj="️",Pj="‍",Ku="";let ll=null,cl=null;function Bj(t=[]){const e={};rn.groups=e;const n=new rn;ll==null&&(ll=ib(Aj)),cl==null&&(cl=ib(Mj)),$(n,"'",Ac),$(n,"{",Mo),$(n,"}",Oo),$(n,"[",pc),$(n,"]",mc),$(n,"(",gc),$(n,")",yc),$(n,"<",bc),$(n,">",vc),$(n,"(",xc),$(n,")",wc),$(n,"「",Ec),$(n,"」",kc),$(n,"『",Sc),$(n,"』",Cc),$(n,"<",_c),$(n,">",Nc),$(n,"&",Tc),$(n,"*",Mc),$(n,"@",Wr),$(n,"`",Rc),$(n,"^",Ic),$(n,":",Yr),$(n,",",Bp),$(n,"$",Dc),$(n,".",qn),$(n,"=",Lc),$(n,"!",jp),$(n,"-",En),$(n,"%",Ro),$(n,"|",Pc),$(n,"+",Bc),$(n,"#",jc),$(n,"?",Io),$(n,'"',$p),$(n,"/",Yn),$(n,";",Fp),$(n,"~",Do),$(n,"_",$c),$(n,"\\",Oc),$(n,"・",S1);const r=lt(n,yr,Lp,{[Gf]:!0});lt(r,yr,r);const i=lt(r,gr,E1,{[Ao]:!0}),s=lt(r,uo,k1,{[go]:!0}),o=lt(n,gr,vr,{[qf]:!0});lt(o,yr,i),lt(o,gr,o),lt(i,yr,i),lt(i,gr,i);const a=lt(n,uo,Xf,{[Yf]:!0});lt(a,gr),lt(a,yr,s),lt(a,uo,a),lt(s,yr,s),lt(s,gr),lt(s,uo,s);const l=$(n,Vu,Pp,{[Hu]:!0}),c=$(n,rb,eh,{[Hu]:!0}),d=lt(n,Uu,eh,{[Hu]:!0});$(n,Ku,d),$(c,Vu,l),$(c,Ku,d),lt(c,Uu,d),$(d,rb),$(d,Vu),lt(d,Uu,d),$(d,Ku,d);const u=lt(n,zu,C1,{[w1]:!0});$(u,"#"),lt(u,zu,u),$(u,Lj,u);const f=$(u,Pj);$(f,"#"),lt(f,zu,u);const h=[[gr,o],[yr,i]],m=[[gr,null],[uo,a],[yr,s]];for(let g=0;g<ll.length;g++)$r(n,ll[g],Zf,vr,h);for(let g=0;g<cl.length;g++)$r(n,cl[g],Qf,Xf,m);Ai(Zf,{tld:!0,ascii:!0},e),Ai(Qf,{utld:!0,alpha:!0},e),$r(n,"file",Ol,vr,h),$r(n,"mailto",Ol,vr,h),$r(n,"http",hs,vr,h),$r(n,"https",hs,vr,h),$r(n,"ftp",hs,vr,h),$r(n,"ftps",hs,vr,h),Ai(Ol,{scheme:!0,ascii:!0},e),Ai(hs,{slashscheme:!0,ascii:!0},e),t=t.sort((g,y)=>g[0]>y[0]?1:-1);for(let g=0;g<t.length;g++){const y=t[g][0],w=t[g][1]?{[Oj]:!0}:{[Rj]:!0};y.indexOf("-")>=0?w[Jf]=!0:gr.test(y)?yr.test(y)?w[Ao]=!0:w[qf]=!0:w[Gf]=!0,nb(n,y,y,w)}return nb(n,"localhost",fa,{ascii:!0}),n.jd=new rn(Fc),{start:n,tokens:Object.assign({groups:e},_1)}}function N1(t,e){const n=jj(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,i=[];let s=0,o=0;for(;o<r;){let a=t,l=null,c=0,d=null,u=-1,f=-1;for(;o<r&&(l=a.go(n[o]));)a=l,a.accepts()?(u=0,f=0,d=a):u>=0&&(u+=n[o].length,f++),c+=n[o].length,s+=n[o].length,o++;s-=u,o-=f,c-=u,i.push({t:d.t,v:e.slice(s-c,s),s:s-c,e:s})}return i}function jj(t){const e=[],n=t.length;let r=0;for(;r<n;){let i=t.charCodeAt(r),s,o=i<55296||i>56319||r+1===n||(s=t.charCodeAt(r+1))<56320||s>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function $r(t,e,n,r,i){let s;const o=e.length;for(let a=0;a<o-1;a++){const l=e[a];t.j[l]?s=t.j[l]:(s=new rn(r),s.jr=i.slice(),t.j[l]=s),t=s}return s=new rn(n),s.jr=i.slice(),t.j[e[o-1]]=s,s}function ib(t){const e=[],n=[];let r=0,i="0123456789";for(;r<t.length;){let s=0;for(;i.indexOf(t[r+s])>=0;)s++;if(s>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+s),10);o>0;o--)n.pop();r+=s}else n.push(t[r]),r++}return e}const ha={defaultProtocol:"http",events:null,format:sb,formatHref:sb,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Hp(t,e=null){let n=Object.assign({},ha);t&&(n=Object.assign(n,t instanceof Hp?t.o:t));const r=n.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=i}Hp.prototype={o:ha,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let i=this.o[t];return i&&(typeof i=="object"?(i=n.t in i?i[n.t]:ha[t],typeof i=="function"&&r&&(i=i(e,n))):typeof i=="function"&&r&&(i=i(e,n.t,n)),i)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function sb(t){return t}function T1(t,e){this.t="token",this.v=t,this.tk=e}T1.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=ha.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),i=t.get("tagName",n,e),s=this.toFormattedString(t),o={},a=t.get("className",n,e),l=t.get("target",n,e),c=t.get("rel",n,e),d=t.getObj("attributes",n,e),u=t.getObj("events",n,e);return o.href=r,a&&(o.class=a),l&&(o.target=l),c&&(o.rel=c),d&&Object.assign(o,d),{tagName:i,attributes:o,content:s,eventListeners:u}}};function Md(t,e){class n extends T1{constructor(i,s){super(i,s),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const ob=Md("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),ab=Md("text"),$j=Md("nl"),dl=Md("url",{isLink:!0,toHref(t=ha.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==fa&&t[1].t===Yr}}),wn=t=>new rn(t);function Fj({groups:t}){const e=t.domain.concat([Tc,Mc,Wr,Oc,Rc,Ic,Dc,Lc,En,Lp,Ro,Pc,Bc,jc,Yn,Fc,Do,$c]),n=[Ac,Yr,Bp,qn,jp,Ro,Io,$p,Fp,bc,vc,Mo,Oo,mc,pc,gc,yc,xc,wc,Ec,kc,Sc,Cc,_c,Nc],r=[Tc,Ac,Mc,Oc,Rc,Ic,Dc,Lc,En,Mo,Oo,Ro,Pc,Bc,jc,Io,Yn,Fc,Do,$c],i=wn(),s=$(i,Do);_e(s,r,s),_e(s,t.domain,s);const o=wn(),a=wn(),l=wn();_e(i,t.domain,o),_e(i,t.scheme,a),_e(i,t.slashscheme,l),_e(o,r,s),_e(o,t.domain,o);const c=$(o,Wr);$(s,Wr,c),$(a,Wr,c),$(l,Wr,c);const d=$(s,qn);_e(d,r,s),_e(d,t.domain,s);const u=wn();_e(c,t.domain,u),_e(u,t.domain,u);const f=$(u,qn);_e(f,t.domain,u);const h=wn(ob);_e(f,t.tld,h),_e(f,t.utld,h),$(c,fa,h);const m=$(u,En);$(m,En,m),_e(m,t.domain,u),_e(h,t.domain,u),$(h,qn,f),$(h,En,m);const g=$(h,Yr);_e(g,t.numeric,ob);const y=$(o,En),b=$(o,qn);$(y,En,y),_e(y,t.domain,o),_e(b,r,s),_e(b,t.domain,o);const w=wn(dl);_e(b,t.tld,w),_e(b,t.utld,w),_e(w,t.domain,o),_e(w,r,s),$(w,qn,b),$(w,En,y),$(w,Wr,c);const k=$(w,Yr),v=wn(dl);_e(k,t.numeric,v);const E=wn(dl),S=wn();_e(E,e,E),_e(E,n,S),_e(S,e,E),_e(S,n,S),$(w,Yn,E),$(v,Yn,E);const C=$(a,Yr),N=$(l,Yr),M=$(N,Yn),D=$(M,Yn);_e(a,t.domain,o),$(a,qn,b),$(a,En,y),_e(l,t.domain,o),$(l,qn,b),$(l,En,y),_e(C,t.domain,E),$(C,Yn,E),$(C,Io,E),_e(D,t.domain,E),_e(D,e,E),$(D,Yn,E);const j=[[Mo,Oo],[pc,mc],[gc,yc],[bc,vc],[xc,wc],[Ec,kc],[Sc,Cc],[_c,Nc]];for(let B=0;B<j.length;B++){const[F,G]=j[B],q=$(E,F);$(S,F,q),$(q,G,E);const W=wn(dl);_e(q,e,W);const A=wn();_e(q,n),_e(W,e,W),_e(W,n,A),_e(A,e,W),_e(A,n,A),$(W,G,E),$(A,G,E)}return $(i,fa,w),$(i,Pp,$j),{start:i,tokens:_1}}function Hj(t,e,n){let r=n.length,i=0,s=[],o=[];for(;i<r;){let a=t,l=null,c=null,d=0,u=null,f=-1;for(;i<r&&!(l=a.go(n[i].t));)o.push(n[i++]);for(;i<r&&(c=l||a.go(n[i].t));)l=null,a=c,a.accepts()?(f=0,u=a):f>=0&&f++,i++,d++;if(f<0)i-=d,i<r&&(o.push(n[i]),i++);else{o.length>0&&(s.push(Wu(ab,e,o)),o=[]),i-=f,d-=f;const h=u.t,m=n.slice(i-d,i);s.push(Wu(h,e,m))}}return o.length>0&&s.push(Wu(ab,e,o)),s}function Wu(t,e,n){const r=n[0].s,i=n[n.length-1].e,s=e.slice(r,i);return new t(s,n)}const zj=typeof console<"u"&&console&&console.warn||(()=>{}),Uj="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",et={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Vj(){return rn.groups={},et.scanner=null,et.parser=null,et.tokenQueue=[],et.pluginQueue=[],et.customSchemes=[],et.initialized=!1,et}function lb(t,e=!1){if(et.initialized&&zj(`linkifyjs: already initialized - will not register custom scheme "${t}" ${Uj}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
144
+ 1. Must only contain digits, lowercase ASCII letters or "-"
145
+ 2. Cannot start or end with "-"
146
+ 3. "-" cannot repeat`);et.customSchemes.push([t,e])}function Kj(){et.scanner=Bj(et.customSchemes);for(let t=0;t<et.tokenQueue.length;t++)et.tokenQueue[t][1]({scanner:et.scanner});et.parser=Fj(et.scanner.tokens);for(let t=0;t<et.pluginQueue.length;t++)et.pluginQueue[t][1]({scanner:et.scanner,parser:et.parser});return et.initialized=!0,et}function zp(t){return et.initialized||Kj(),Hj(et.parser.start,t,N1(et.scanner.start,t))}zp.scan=N1;function A1(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new Hp(n),i=zp(t),s=[];for(let o=0;o<i.length;o++){const a=i[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&s.push(a.toFormattedObject(r))}return s}const Up="[\0-   ᠎ -\u2029  ]",Wj=new RegExp(Up),Gj=new RegExp(`${Up}$`),qj=new RegExp(Up,"g");function Yj(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Jj(t){return new Ze({key:new Ge("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,a=tT(n.doc,[...e]);if(cT(a).forEach(({newRange:c})=>{const d=rT(r.doc,c,h=>h.isTextblock);let u,f;if(d.length>1)u=d[0],f=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ");else if(d.length){const h=r.doc.textBetween(c.from,c.to," "," ");if(!Gj.test(h))return;u=d[0],f=r.doc.textBetween(u.pos,c.to,void 0," ")}if(u&&f){const h=f.split(Wj).filter(Boolean);if(h.length<=0)return!1;const m=h[h.length-1],g=u.pos+f.lastIndexOf(m);if(!m)return!1;const y=zp(m).map(b=>b.toObject(t.defaultProtocol));if(!Yj(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=>t.validate(b.value)).filter(b=>t.shouldAutoLink(b.value)).forEach(b=>{Oh(b.from,b.to,r.doc).some(w=>w.mark.type===t.type)||o.addMark(b.from,b.to,t.type.create({href:b.href}))})}}),!!o.steps.length)return o}})}function Xj(t){return new Ze({key:new Ge("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let o=r.target;const a=[];for(;o.nodeName!=="DIV";)a.push(o),o=o.parentNode;if(!a.find(f=>f.nodeName==="A"))return!1;const l=bv(e.state,t.type.name),c=r.target,d=(i=c?.href)!==null&&i!==void 0?i:l.href,u=(s=c?.target)!==null&&s!==void 0?s:l.target;return c&&d?(window.open(d,u),!0):!1}}})}function Zj(t){return new Ze({key:new Ge("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:i}=e,{selection:s}=i,{empty:o}=s;if(o)return!1;let a="";r.content.forEach(c=>{a+=c.textContent});const l=A1(a,{defaultProtocol:t.defaultProtocol}).find(c=>c.isLink&&c.value===a);return!a||!l?!1:t.editor.commands.setMark(t.type,{href:l.href})}}})}function wi(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!t||t.replace(qj,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const Qj=$n.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){lb(t);return}lb(t.scheme,t.optionalSlashes)})},onDestroy(){Vj()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!wi(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!wi(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!wi(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",He(this.options.HTMLAttributes,t),0]:["a",He(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!wi(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!wi(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[zi({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=A1(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:o=>!!wi(o,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(s=>e.push({text:s.value,data:{href:s.href},index:s.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(Jj({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!wi(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(Xj({type:this.type})),this.options.linkOnPaste&&t.push(Zj({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),e$=ot.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Ze({key:new Ge("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,i=[];if(!n)return null;const s=this.editor.isEmpty;return t.descendants((o,a)=>{const l=r>=a&&r<=a+o.nodeSize,c=!o.isLeaf&&td(o);if((l||!this.options.showOnlyCurrent)&&c){const d=[this.options.emptyNodeClass];s&&d.push(this.options.emptyEditorClass);const u=jt.node(a,a+o.nodeSize,{class:d.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:a,hasAnchor:l}):this.options.placeholder});i.push(u)}return this.options.includeChildren}),nt.create(t,i)}}})]}});var t$=Object.defineProperty,n$=Object.defineProperties,r$=Object.getOwnPropertyDescriptors,Hc=Object.getOwnPropertySymbols,M1=Object.prototype.hasOwnProperty,O1=Object.prototype.propertyIsEnumerable,cb=(t,e,n)=>e in t?t$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,H=(t,e)=>{for(var n in e||(e={}))M1.call(e,n)&&cb(t,n,e[n]);if(Hc)for(var n of Hc(e))O1.call(e,n)&&cb(t,n,e[n]);return t},ue=(t,e)=>n$(t,r$(e)),fr=(t,e)=>{var n={};for(var r in t)M1.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Hc)for(var r of Hc(t))e.indexOf(r)<0&&O1.call(t,r)&&(n[r]=t[r]);return n},ks=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())});function Od(t,e){const{view:n,state:{selection:{from:r}}}=t,i=document.querySelectorAll(".has-focus"),s=i.length,a=i[s-1];if(a&&a.getAttribute("data-type")&&a.getAttribute("data-type")===e||a&&a.classList&&(a.classList.contains(e)||a.classList.contains(`node-${e}`)))return a;const l=n.domAtPos(r).node;let c=l;for(c.tagName||(c=l.parentElement);c&&!(c.getAttribute("data-type")&&c.getAttribute("data-type")===e)&&!c.classList.contains(e);)c=c.parentElement;return c}function Rd(t){const{state:{doc:e,selection:n,selection:{empty:r,from:i,to:s}}}=t,o=!e.textBetween(i,s).length&&Qc(n);return!(r||o||!t.isEditable)}function to(t,e){return({commands:n})=>n.command(({tr:r,state:i,dispatch:s})=>{if(s){let o=null;if(r.selection.ranges.forEach(a=>{i.doc.nodesBetween(a.$from.pos,a.$to.pos,(l,c)=>{l.type.name===t&&(o=c)})}),o!==null){const a=i.doc.nodeAt(o);if(a)r.setNodeMarkup(o,null,H(H({},a.attrs),e));else for(const[l,c]of Object.entries(e))r.setNodeAttribute(o,l,c)}t==="button"&&r.setSelection(r.selection)}return!0})}var Rl="auto",db="top",R1=dt.create({name:"column",content:"block+",isolating:!0,addAttributes(){return{columnId:{default:null,parseHTML:t=>t.getAttribute("data-column-id")||Yo(),renderHTML:t=>t.columnId?{"data-column-id":t.columnId}:{"data-column-id":Yo()}},width:{default:Rl,parseHTML:t=>t.style.width.replace(/['"]+/g,"")||Rl,renderHTML:t=>!t.width||t.width===Rl?{}:{style:`width: ${t.width}%;max-width:${t.width}%`}},verticalAlign:{default:db,parseHTML:t=>{var e;return((e=t?.style)==null?void 0:e.verticalAlign)||"top"},renderHTML:t=>{const{verticalAlign:e}=t;if(!e||e===db)return{};if(e==="middle")return{style:"display: flex;flex-direction: column;justify-content: center;"};if(e==="bottom")return{style:"display: flex;flex-direction: column;justify-content: flex-end;"}}}}},addCommands(){return{updateColumn:t=>to(this.name,t)}},renderHTML({HTMLAttributes:t}){return["div",He(t,{"data-type":"column",class:"hide-scrollbars"}),0]},parseHTML(){return[{tag:'div[data-type="column"]'}]}});function i$(t){var e,n;return((n=(e=Rr(t,"columns"))==null?void 0:e.node)==null?void 0:n.childCount)||0}function Rr(t,e){const{state:n}=t.view;return xa(r=>r.type.name===e)(n.selection)}function ub(t,e){const n=Rr(t,"columns"),r=Rr(t,"column");if(!n||!r)return!1;const{state:i,dispatch:s}=t.view,o=n.node;let a=0;o.content.forEach((f,h,m)=>{var g,y,b;f.eq(r.node)&&((g=f?.attrs)==null?void 0:g.columnId)===((b=(y=r.node)==null?void 0:y.attrs)==null?void 0:b.columnId)&&(a=m)});const l=e==="next"?a+1:a-1;if(l<0||l>=o.childCount)return!1;let c=n.pos;o.content.forEach((f,h,m)=>{m<l&&(c+=f.nodeSize)});const d=i.tr.setTime(Date.now()),u=ye.near(d.doc.resolve(c));return d.setSelection(u),s(d),!0}function s$(t,e,n="auto"){const{node:r,pos:i=0}=Rr(t,"columns")||{};if(!r)return!1;const{state:s,dispatch:o}=t.view,{tr:a}=s,{selection:l}=s,c=i+r.nodeSize,d={from:l.from-i,to:l.to-i},u=[];r.content.forEach((g,y,b)=>{var w;u.push(g.type.create(ue(H({},g?.attrs),{width:b===e?n:(w=g?.attrs)==null?void 0:w.width}),g.content))});const f=r.copy(L.from(u)),h=a.replaceWith(i,c,f),m=ye.create(h.doc,i+d.from,i+d.to);return o(h.setSelection(m)),!0}function o$(t,e=-1){const{node:n,pos:r=0}=Rr(t,"columns")||{};if(!n)return!1;const i=e<0?n.childCount:e,{state:s}=t.view,o=s.schema.nodes.column.create({width:Rl,columnId:Yo()},s.schema.nodes.paragraph.create(null)),a=[];n.content.forEach((f,h,m)=>{a.push(f),m===i&&a.push(o)}),e===-1&&a.push(o);const l=n.copy(L.from(a)),c=s.tr.replaceWith(r,r+n.nodeSize,l),d=r+a.slice(0,i).reduce((f,h)=>f+h.nodeSize,0),u=ye.near(c.doc.resolve(d));return c.setSelection(u),t.view.dispatch(c),!0}function a$(t,e=-1){const{node:n,pos:r=0}=Rr(t,"columns")||{};if(!n)return!1;const{state:i,dispatch:s}=t.view,{tr:o}=i,a=[];n.content.forEach((h,m,g)=>{g!==e&&a.push(h)}),e===-1&&a.pop();const l=n.copy(L.from(a)),c=o.replaceWith(r,r+n.nodeSize,l),d=e===n.childCount-1?e-1:e,u=r+a.slice(0,d).reduce((h,m)=>h+m.nodeSize,0),f=ye.near(c.doc.resolve(u));return c.setSelection(f),s(c),!0}function l$(t){const{node:e,pos:n=0}=Rr(t,"columns")||{};if(!e)return[];const r=[];return e.content.forEach(i=>{const{columnId:s,width:o}=i.attrs;r.push({id:s,width:o})}),r}var c$=t=>cr({editor:t,selector:n=>{var r,i,s;return{isSectionActive:n.editor.isActive("section"),isColumnActive:n.editor.isActive("column"),currentVerticalAlignment:((r=n.editor.getAttributes("column"))==null?void 0:r.verticalAlign)||"top",currentShowIfKey:((i=n.editor.getAttributes("columns"))==null?void 0:i.showIfKey)||"",columnsCount:i$(n.editor),columnWidths:l$(n.editor).map(o=>o.width),currentColumnsGap:((s=n.editor.getAttributes("columns"))==null?void 0:s.gap)||0}},equalityFn:gi}),Vp="-",d$=t=>{const e=f$(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{const a=o.split(Vp);return a[0]===""&&a.length!==1&&a.shift(),I1(a,e)||u$(o)},getConflictingClassGroupIds:(o,a)=>{const l=n[o]||[];return a&&r[o]?[...l,...r[o]]:l}}},I1=(t,e)=>{var n;if(t.length===0)return e.classGroupId;const r=t[0],i=e.nextPart.get(r),s=i?I1(t.slice(1),i):void 0;if(s)return s;if(e.validators.length===0)return;const o=t.join(Vp);return(n=e.validators.find(({validator:a})=>a(o)))==null?void 0:n.classGroupId},fb=/^\[(.+)\]$/,u$=t=>{if(fb.test(t)){const e=fb.exec(t)[1],n=e?.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},f$=t=>{const{theme:e,classGroups:n}=t,r={nextPart:new Map,validators:[]};for(const i in n)th(n[i],r,i,e);return r},th=(t,e,n,r)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:hb(e,i);s.classGroupId=n;return}if(typeof i=="function"){if(h$(i)){th(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,o])=>{th(o,hb(e,s),n,r)})})},hb=(t,e)=>{let n=t;return e.split(Vp).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},h$=t=>t.isThemeGetter,p$=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const i=(s,o)=>{n.set(s,o),e++,e>t&&(e=0,r=n,n=new Map)};return{get(s){let o=n.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){n.has(s)?n.set(s,o):i(s,o)}}},nh="!",rh=":",m$=rh.length,g$=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=i=>{const s=[];let o=0,a=0,l=0,c;for(let m=0;m<i.length;m++){let g=i[m];if(o===0&&a===0){if(g===rh){s.push(i.slice(l,m)),l=m+m$;continue}if(g==="/"){c=m;continue}}g==="["?o++:g==="]"?o--:g==="("?a++:g===")"&&a--}const d=s.length===0?i:i.substring(l),u=y$(d),f=u!==d,h=c&&c>l?c-l:void 0;return{modifiers:s,hasImportantModifier:f,baseClassName:u,maybePostfixModifierPosition:h}};if(e){const i=e+rh,s=r;r=o=>o.startsWith(i)?s(o.substring(i.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(n){const i=r;r=s=>n({className:s,parseClassName:i})}return r},y$=t=>t.endsWith(nh)?t.substring(0,t.length-1):t.startsWith(nh)?t.substring(1):t,b$=t=>{const e=Object.fromEntries(t.orderSensitiveModifiers.map(r=>[r,!0]));return r=>{if(r.length<=1)return r;const i=[];let s=[];return r.forEach(o=>{o[0]==="["||e[o]?(i.push(...s.sort(),o),s=[]):s.push(o)}),i.push(...s.sort()),i}},v$=t=>H({cache:p$(t.cacheSize),parseClassName:g$(t),sortModifiers:b$(t)},d$(t)),x$=/\s+/,w$=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=e,o=[],a=t.trim().split(x$);let l="";for(let c=a.length-1;c>=0;c-=1){const d=a[c],{isExternal:u,modifiers:f,hasImportantModifier:h,baseClassName:m,maybePostfixModifierPosition:g}=n(d);if(u){l=d+(l.length>0?" "+l:l);continue}let y=!!g,b=r(y?m.substring(0,g):m);if(!b){if(!y){l=d+(l.length>0?" "+l:l);continue}if(b=r(m),!b){l=d+(l.length>0?" "+l:l);continue}y=!1}const w=s(f).join(":"),k=h?w+nh:w,v=k+b;if(o.includes(v))continue;o.push(v);const E=i(b,y);for(let S=0;S<E.length;++S){const C=E[S];o.push(k+C)}l=d+(l.length>0?" "+l:l)}return l};function E$(){let t=0,e,n,r="";for(;t<arguments.length;)(e=arguments[t++])&&(n=D1(e))&&(r&&(r+=" "),r+=n);return r}var D1=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=D1(t[r]))&&(n&&(n+=" "),n+=e);return n};function pb(t,...e){let n,r,i,s=o;function o(l){const c=e.reduce((d,u)=>u(d),t());return n=v$(c),r=n.cache.get,i=n.cache.set,s=a,a(l)}function a(l){const c=r(l);if(c)return c;const d=w$(l,n);return i(l,d),d}return function(){return s(E$.apply(null,arguments))}}var xt=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},L1=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,P1=/^\((?:(\w[\w-]*):)?(.+)\)$/i,k$=/^\d+\/\d+$/,S$=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,C$=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,_$=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,N$=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,T$=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ss=t=>k$.test(t),Te=t=>!!t&&!Number.isNaN(Number(t)),Fr=t=>!!t&&Number.isInteger(Number(t)),Gu=t=>t.endsWith("%")&&Te(t.slice(0,-1)),br=t=>S$.test(t),A$=()=>!0,M$=t=>C$.test(t)&&!_$.test(t),B1=()=>!1,O$=t=>N$.test(t),R$=t=>T$.test(t),I$=t=>!ie(t)&&!se(t),D$=t=>no(t,F1,B1),ie=t=>L1.test(t),Ei=t=>no(t,H1,M$),qu=t=>no(t,$$,Te),mb=t=>no(t,j1,B1),L$=t=>no(t,$1,R$),ul=t=>no(t,z1,O$),se=t=>P1.test(t),fo=t=>ro(t,H1),P$=t=>ro(t,F$),gb=t=>ro(t,j1),B$=t=>ro(t,F1),j$=t=>ro(t,$1),fl=t=>ro(t,z1,!0),no=(t,e,n)=>{const r=L1.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},ro=(t,e,n=!1)=>{const r=P1.exec(t);return r?r[1]?e(r[1]):n:!1},j1=t=>t==="position"||t==="percentage",$1=t=>t==="image"||t==="url",F1=t=>t==="length"||t==="size"||t==="bg-size",H1=t=>t==="length",$$=t=>t==="number",F$=t=>t==="family-name",z1=t=>t==="shadow",yb=()=>{const t=xt("color"),e=xt("font"),n=xt("text"),r=xt("font-weight"),i=xt("tracking"),s=xt("leading"),o=xt("breakpoint"),a=xt("container"),l=xt("spacing"),c=xt("radius"),d=xt("shadow"),u=xt("inset-shadow"),f=xt("text-shadow"),h=xt("drop-shadow"),m=xt("blur"),g=xt("perspective"),y=xt("aspect"),b=xt("ease"),w=xt("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],v=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...v(),se,ie],S=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto","contain","none"],N=()=>[se,ie,l],M=()=>[ss,"full","auto",...N()],D=()=>[Fr,"none","subgrid",se,ie],j=()=>["auto",{span:["full",Fr,se,ie]},Fr,se,ie],B=()=>[Fr,"auto",se,ie],F=()=>["auto","min","max","fr",se,ie],G=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],q=()=>["start","end","center","stretch","center-safe","end-safe"],W=()=>["auto",...N()],A=()=>[ss,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...N()],T=()=>[t,se,ie],P=()=>[...v(),gb,mb,{position:[se,ie]}],Y=()=>["no-repeat",{repeat:["","x","y","space","round"]}],te=()=>["auto","cover","contain",B$,D$,{size:[se,ie]}],pe=()=>[Gu,fo,Ei],Q=()=>["","none","full",c,se,ie],X=()=>["",Te,fo,Ei],ne=()=>["solid","dashed","dotted","double"],Ee=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],be=()=>[Te,Gu,gb,mb],Be=()=>["","none",m,se,ie],Ie=()=>["none",Te,se,ie],Le=()=>["none",Te,se,ie],ze=()=>[Te,se,ie],Pe=()=>[ss,"full",...N()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[br],breakpoint:[br],color:[A$],container:[br],"drop-shadow":[br],ease:["in","out","in-out"],font:[I$],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[br],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[br],shadow:[br],spacing:["px",Te],text:[br],"text-shadow":[br],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ss,ie,se,y]}],container:["container"],columns:[{columns:[Te,ie,se,a]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:M()}],"inset-x":[{"inset-x":M()}],"inset-y":[{"inset-y":M()}],start:[{start:M()}],end:[{end:M()}],top:[{top:M()}],right:[{right:M()}],bottom:[{bottom:M()}],left:[{left:M()}],visibility:["visible","invisible","collapse"],z:[{z:[Fr,"auto",se,ie]}],basis:[{basis:[ss,"full","auto",a,...N()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Te,ss,"auto","initial","none",ie]}],grow:[{grow:["",Te,se,ie]}],shrink:[{shrink:["",Te,se,ie]}],order:[{order:[Fr,"first","last","none",se,ie]}],"grid-cols":[{"grid-cols":D()}],"col-start-end":[{col:j()}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":D()}],"row-start-end":[{row:j()}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:N()}],"gap-x":[{"gap-x":N()}],"gap-y":[{"gap-y":N()}],"justify-content":[{justify:[...G(),"normal"]}],"justify-items":[{"justify-items":[...q(),"normal"]}],"justify-self":[{"justify-self":["auto",...q()]}],"align-content":[{content:["normal",...G()]}],"align-items":[{items:[...q(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...q(),{baseline:["","last"]}]}],"place-content":[{"place-content":G()}],"place-items":[{"place-items":[...q(),"baseline"]}],"place-self":[{"place-self":["auto",...q()]}],p:[{p:N()}],px:[{px:N()}],py:[{py:N()}],ps:[{ps:N()}],pe:[{pe:N()}],pt:[{pt:N()}],pr:[{pr:N()}],pb:[{pb:N()}],pl:[{pl:N()}],m:[{m:W()}],mx:[{mx:W()}],my:[{my:W()}],ms:[{ms:W()}],me:[{me:W()}],mt:[{mt:W()}],mr:[{mr:W()}],mb:[{mb:W()}],ml:[{ml:W()}],"space-x":[{"space-x":N()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":N()}],"space-y-reverse":["space-y-reverse"],size:[{size:A()}],w:[{w:[a,"screen",...A()]}],"min-w":[{"min-w":[a,"screen","none",...A()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...A()]}],h:[{h:["screen","lh",...A()]}],"min-h":[{"min-h":["screen","lh","none",...A()]}],"max-h":[{"max-h":["screen","lh",...A()]}],"font-size":[{text:["base",n,fo,Ei]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,se,qu]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Gu,ie]}],"font-family":[{font:[P$,ie,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,se,ie]}],"line-clamp":[{"line-clamp":[Te,"none",se,qu]}],leading:[{leading:[s,...N()]}],"list-image":[{"list-image":["none",se,ie]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",se,ie]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:T()}],"text-color":[{text:T()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ne(),"wavy"]}],"text-decoration-thickness":[{decoration:[Te,"from-font","auto",se,Ei]}],"text-decoration-color":[{decoration:T()}],"underline-offset":[{"underline-offset":[Te,"auto",se,ie]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:N()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",se,ie]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",se,ie]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:P()}],"bg-repeat":[{bg:Y()}],"bg-size":[{bg:te()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Fr,se,ie],radial:["",se,ie],conic:[Fr,se,ie]},j$,L$]}],"bg-color":[{bg:T()}],"gradient-from-pos":[{from:pe()}],"gradient-via-pos":[{via:pe()}],"gradient-to-pos":[{to:pe()}],"gradient-from":[{from:T()}],"gradient-via":[{via:T()}],"gradient-to":[{to:T()}],rounded:[{rounded:Q()}],"rounded-s":[{"rounded-s":Q()}],"rounded-e":[{"rounded-e":Q()}],"rounded-t":[{"rounded-t":Q()}],"rounded-r":[{"rounded-r":Q()}],"rounded-b":[{"rounded-b":Q()}],"rounded-l":[{"rounded-l":Q()}],"rounded-ss":[{"rounded-ss":Q()}],"rounded-se":[{"rounded-se":Q()}],"rounded-ee":[{"rounded-ee":Q()}],"rounded-es":[{"rounded-es":Q()}],"rounded-tl":[{"rounded-tl":Q()}],"rounded-tr":[{"rounded-tr":Q()}],"rounded-br":[{"rounded-br":Q()}],"rounded-bl":[{"rounded-bl":Q()}],"border-w":[{border:X()}],"border-w-x":[{"border-x":X()}],"border-w-y":[{"border-y":X()}],"border-w-s":[{"border-s":X()}],"border-w-e":[{"border-e":X()}],"border-w-t":[{"border-t":X()}],"border-w-r":[{"border-r":X()}],"border-w-b":[{"border-b":X()}],"border-w-l":[{"border-l":X()}],"divide-x":[{"divide-x":X()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":X()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ne(),"hidden","none"]}],"divide-style":[{divide:[...ne(),"hidden","none"]}],"border-color":[{border:T()}],"border-color-x":[{"border-x":T()}],"border-color-y":[{"border-y":T()}],"border-color-s":[{"border-s":T()}],"border-color-e":[{"border-e":T()}],"border-color-t":[{"border-t":T()}],"border-color-r":[{"border-r":T()}],"border-color-b":[{"border-b":T()}],"border-color-l":[{"border-l":T()}],"divide-color":[{divide:T()}],"outline-style":[{outline:[...ne(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Te,se,ie]}],"outline-w":[{outline:["",Te,fo,Ei]}],"outline-color":[{outline:T()}],shadow:[{shadow:["","none",d,fl,ul]}],"shadow-color":[{shadow:T()}],"inset-shadow":[{"inset-shadow":["none",u,fl,ul]}],"inset-shadow-color":[{"inset-shadow":T()}],"ring-w":[{ring:X()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:T()}],"ring-offset-w":[{"ring-offset":[Te,Ei]}],"ring-offset-color":[{"ring-offset":T()}],"inset-ring-w":[{"inset-ring":X()}],"inset-ring-color":[{"inset-ring":T()}],"text-shadow":[{"text-shadow":["none",f,fl,ul]}],"text-shadow-color":[{"text-shadow":T()}],opacity:[{opacity:[Te,se,ie]}],"mix-blend":[{"mix-blend":[...Ee(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ee()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Te]}],"mask-image-linear-from-pos":[{"mask-linear-from":be()}],"mask-image-linear-to-pos":[{"mask-linear-to":be()}],"mask-image-linear-from-color":[{"mask-linear-from":T()}],"mask-image-linear-to-color":[{"mask-linear-to":T()}],"mask-image-t-from-pos":[{"mask-t-from":be()}],"mask-image-t-to-pos":[{"mask-t-to":be()}],"mask-image-t-from-color":[{"mask-t-from":T()}],"mask-image-t-to-color":[{"mask-t-to":T()}],"mask-image-r-from-pos":[{"mask-r-from":be()}],"mask-image-r-to-pos":[{"mask-r-to":be()}],"mask-image-r-from-color":[{"mask-r-from":T()}],"mask-image-r-to-color":[{"mask-r-to":T()}],"mask-image-b-from-pos":[{"mask-b-from":be()}],"mask-image-b-to-pos":[{"mask-b-to":be()}],"mask-image-b-from-color":[{"mask-b-from":T()}],"mask-image-b-to-color":[{"mask-b-to":T()}],"mask-image-l-from-pos":[{"mask-l-from":be()}],"mask-image-l-to-pos":[{"mask-l-to":be()}],"mask-image-l-from-color":[{"mask-l-from":T()}],"mask-image-l-to-color":[{"mask-l-to":T()}],"mask-image-x-from-pos":[{"mask-x-from":be()}],"mask-image-x-to-pos":[{"mask-x-to":be()}],"mask-image-x-from-color":[{"mask-x-from":T()}],"mask-image-x-to-color":[{"mask-x-to":T()}],"mask-image-y-from-pos":[{"mask-y-from":be()}],"mask-image-y-to-pos":[{"mask-y-to":be()}],"mask-image-y-from-color":[{"mask-y-from":T()}],"mask-image-y-to-color":[{"mask-y-to":T()}],"mask-image-radial":[{"mask-radial":[se,ie]}],"mask-image-radial-from-pos":[{"mask-radial-from":be()}],"mask-image-radial-to-pos":[{"mask-radial-to":be()}],"mask-image-radial-from-color":[{"mask-radial-from":T()}],"mask-image-radial-to-color":[{"mask-radial-to":T()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":v()}],"mask-image-conic-pos":[{"mask-conic":[Te]}],"mask-image-conic-from-pos":[{"mask-conic-from":be()}],"mask-image-conic-to-pos":[{"mask-conic-to":be()}],"mask-image-conic-from-color":[{"mask-conic-from":T()}],"mask-image-conic-to-color":[{"mask-conic-to":T()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:P()}],"mask-repeat":[{mask:Y()}],"mask-size":[{mask:te()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",se,ie]}],filter:[{filter:["","none",se,ie]}],blur:[{blur:Be()}],brightness:[{brightness:[Te,se,ie]}],contrast:[{contrast:[Te,se,ie]}],"drop-shadow":[{"drop-shadow":["","none",h,fl,ul]}],"drop-shadow-color":[{"drop-shadow":T()}],grayscale:[{grayscale:["",Te,se,ie]}],"hue-rotate":[{"hue-rotate":[Te,se,ie]}],invert:[{invert:["",Te,se,ie]}],saturate:[{saturate:[Te,se,ie]}],sepia:[{sepia:["",Te,se,ie]}],"backdrop-filter":[{"backdrop-filter":["","none",se,ie]}],"backdrop-blur":[{"backdrop-blur":Be()}],"backdrop-brightness":[{"backdrop-brightness":[Te,se,ie]}],"backdrop-contrast":[{"backdrop-contrast":[Te,se,ie]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Te,se,ie]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Te,se,ie]}],"backdrop-invert":[{"backdrop-invert":["",Te,se,ie]}],"backdrop-opacity":[{"backdrop-opacity":[Te,se,ie]}],"backdrop-saturate":[{"backdrop-saturate":[Te,se,ie]}],"backdrop-sepia":[{"backdrop-sepia":["",Te,se,ie]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":N()}],"border-spacing-x":[{"border-spacing-x":N()}],"border-spacing-y":[{"border-spacing-y":N()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",se,ie]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Te,"initial",se,ie]}],ease:[{ease:["linear","initial",b,se,ie]}],delay:[{delay:[Te,se,ie]}],animate:[{animate:["none",w,se,ie]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,se,ie]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:Ie()}],"rotate-x":[{"rotate-x":Ie()}],"rotate-y":[{"rotate-y":Ie()}],"rotate-z":[{"rotate-z":Ie()}],scale:[{scale:Le()}],"scale-x":[{"scale-x":Le()}],"scale-y":[{"scale-y":Le()}],"scale-z":[{"scale-z":Le()}],"scale-3d":["scale-3d"],skew:[{skew:ze()}],"skew-x":[{"skew-x":ze()}],"skew-y":[{"skew-y":ze()}],transform:[{transform:[se,ie,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Pe()}],"translate-x":[{"translate-x":Pe()}],"translate-y":[{"translate-y":Pe()}],"translate-z":[{"translate-z":Pe()}],"translate-none":["translate-none"],accent:[{accent:T()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:T()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",se,ie]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":N()}],"scroll-mx":[{"scroll-mx":N()}],"scroll-my":[{"scroll-my":N()}],"scroll-ms":[{"scroll-ms":N()}],"scroll-me":[{"scroll-me":N()}],"scroll-mt":[{"scroll-mt":N()}],"scroll-mr":[{"scroll-mr":N()}],"scroll-mb":[{"scroll-mb":N()}],"scroll-ml":[{"scroll-ml":N()}],"scroll-p":[{"scroll-p":N()}],"scroll-px":[{"scroll-px":N()}],"scroll-py":[{"scroll-py":N()}],"scroll-ps":[{"scroll-ps":N()}],"scroll-pe":[{"scroll-pe":N()}],"scroll-pt":[{"scroll-pt":N()}],"scroll-pr":[{"scroll-pr":N()}],"scroll-pb":[{"scroll-pb":N()}],"scroll-pl":[{"scroll-pl":N()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",se,ie]}],fill:[{fill:["none",...T()]}],"stroke-w":[{stroke:[Te,fo,Ei,qu]}],stroke:[{stroke:["none",...T()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},H$=(t,{cacheSize:e,prefix:n,experimentalParseClassName:r,extend:i={},override:s={}})=>(yo(t,"cacheSize",e),yo(t,"prefix",n),yo(t,"experimentalParseClassName",r),hl(t.theme,s.theme),hl(t.classGroups,s.classGroups),hl(t.conflictingClassGroups,s.conflictingClassGroups),hl(t.conflictingClassGroupModifiers,s.conflictingClassGroupModifiers),yo(t,"orderSensitiveModifiers",s.orderSensitiveModifiers),pl(t.theme,i.theme),pl(t.classGroups,i.classGroups),pl(t.conflictingClassGroups,i.conflictingClassGroups),pl(t.conflictingClassGroupModifiers,i.conflictingClassGroupModifiers),U1(t,i,"orderSensitiveModifiers"),t),yo=(t,e,n)=>{n!==void 0&&(t[e]=n)},hl=(t,e)=>{if(e)for(const n in e)yo(t,n,e[n])},pl=(t,e)=>{if(e)for(const n in e)U1(t,e,n)},U1=(t,e,n)=>{const r=e[n];r!==void 0&&(t[n]=t[n]?t[n].concat(r):r)},z$=(t,...e)=>typeof t=="function"?pb(yb,t,...e):pb(()=>H$(yb(),t),...e),U$=z$({prefix:"mly"});function Ce(...t){return U$(JM(t))}function rt(t){const{type:e="vertical",className:n}=t;return p.jsx("div",{className:Ce("mly:shrink-0 mly:bg-gray-200",e==="vertical"?"mly:mx-0.5 mly:w-px":"mly:my-0.5 mly:h-px",n)})}var vn=eI,Xt=tI,Zt=nI,Kt=x.forwardRef((t,e)=>{var n=t,{className:r,sideOffset:i=4}=n,s=fr(n,["className","sideOffset"]);return p.jsx(Ix,H({ref:e,sideOffset:i,className:Ce("mly:z-50 mly:overflow-hidden mly:rounded-md mly:border mly:border-gray-200 mly:bg-white mly:px-2 mly:py-1 mly:text-xs mly:animate-in mly:fade-in-0 mly:zoom-in-95",r)},s))});Kt.displayName=Ix.displayName;var on=x.forwardRef((t,e)=>{var n=t,{className:r,variant:i="default",size:s="default",asChild:o=!1}=n,a=fr(n,["className","variant","size","asChild"]);const l=o?Z2:"button",c="mly:inline-flex mly:items-center mly:justify-center mly:rounded-md mly:text-sm mly:font-medium mly:ring-offset-white mly:transition-colors mly:focus-visible:outline-hidden mly:focus-visible:ring-2 mly:focus-visible:ring-gray-400 mly:focus-visible:ring-offset-2 mly:focus-visible:relative mly:focus-visible:z-10 mly:disabled:opacity-50 ",d={default:"mly:bg-gray-900 mly:text-gray-50 mly:hover:bg-soft-gray",destructive:"mly:bg-red-500 mly:text-gray-50 mly:hover:bg-red-500/90",outline:"mly:border mly:border-gray-200 mly:bg-white mly:hover:bg-gray-100 mly:hover:text-gray-900",secondary:"mly:bg-gray-100 mly:text-gray-900 mly:hover:bg-gray-100/80",ghost:"mly:hover:bg-soft-gray bg-transparent mly:hover:text-gray-900 mly:data-[state=true]:bg-soft-gray mly:data-[state=true]:text-gray-900",link:"mly:text-gray-900 mly:underline-offset-4 mly:hover:underline"},u={default:"mly:h-10 mly:px-4 mly:py-2",sm:"mly:h-9 mly:rounded-md mly:px-3",lg:"mly:h-11 mly:rounded-md mly:px-8",icon:"mly:h-10 mly:w-10"},f=Ce("mly-editor",c,d[i],u[s],r);return p.jsx(l,H({className:f,ref:e},a))});on.displayName="BaseButton";function Bn(t){var e;const{tooltip:n}=t,r=p.jsx(on,ue(H({variant:"ghost",size:"sm"},t.command?{onClick:t.command}:{}),{"data-state":(e=t?.isActive)==null?void 0:e.call(t),className:Ce("mly:size-7! mly:px-2.5 mly:disabled:cursor-not-allowed",t?.className),type:"button",disabled:t.disbabled,children:t.icon?p.jsx(t.icon,{className:Ce("mly:h-3 mly:w-3 mly:shrink-0 mly:stroke-[2.5]",t?.iconClassName)}):p.jsx("span",{className:Ce("mly:text-sm mly:font-medium mly:text-slate-600",t?.nameClassName),children:t.name})}));return n?p.jsxs(Xt,{children:[p.jsx(Zt,{asChild:!0,children:r}),p.jsx(Kt,{sideOffset:8,children:n})]}):r}function V$(t){const{alignment:e="top",onAlignmentChange:n}=t,r={top:{icon:pI,tooltip:"Align Top",onClick:()=>{n("middle")}},middle:{icon:dI,tooltip:"Align Center",onClick:()=>{n("bottom")}},bottom:{icon:fI,tooltip:"Align Bottom",onClick:()=>{n("top")}}}[e];return p.jsx(Bn,{icon:r.icon,tooltip:r.tooltip,command:r.onClick})}function V1(t,e){const n=t.extensionManager.extensions.find(r=>r.name===e);if(!n)throw new Error(`Node ${e} not found`);return n.options}function K1(t){return V1(t,"variable")}function Ji(t){return x.useMemo(()=>K1(t),[t])}function Ta(t,e){const{query:n}=e,r=n.toLowerCase();let i=[];if(Array.isArray(t))return i=t.filter(s=>s.name.toLowerCase().startsWith(r)),n.length>0&&!i.some(s=>s.name===n)&&i.push({name:n,required:!0}),i;if(typeof t=="function")return t(e);throw new Error(`Invalid variables type. Expected 'Array' or 'Function', but received '${typeof t}'.
147
+
148
+ You can check out the documentation for more information: https://github.com/arikchakma/maily.to/blob/main/packages/core/readme.md`)}var On=lL,Rn=cL,xn=x.forwardRef((t,e)=>{var n=t,{className:r,align:i="center",sideOffset:s=4,portal:o=!1}=n,a=fr(n,["className","align","sideOffset","portal"]);const l=p.jsx(kw,H({ref:e,align:i,sideOffset:s,className:Ce("mly:z-9999 mly:w-72 mly:rounded-md mly:border mly:border-gray-200 mly:bg-white mly:p-4 mly:text-gray-950 mly:shadow-md mly:outline-hidden","mly-editor",r)},a));return o?p.jsx(dL,{children:l}):l});xn.displayName=kw.displayName;var Vs=Object.freeze({autoComplete:"off","data-1p-ignore":!0,"data-form-type":"other"});function K$(t,e){const n=x.useCallback(r=>{t.current&&!t.current.contains(r.target)&&e()},[t,e]);x.useEffect(()=>(document.addEventListener("mousedown",n),document.addEventListener("touchstart",n),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n)}),[n])}var Aa=x.forwardRef((t,e)=>{var n;const r=t,{value:i="",onValueChange:s,className:o,onOutsideClick:a,onSelectOption:l,autoCompleteOptions:c=[],triggerChar:d="",editor:u}=r,f=fr(r,["value","onValueChange","className","onOutsideClick","onSelectOption","autoCompleteOptions","triggerChar","editor"]),h=x.useRef(null),m=x.useRef(null),g=(n=Ji(u))==null?void 0:n.variableSuggestionsPopover;K$(h,()=>{a?.()});const y=i.startsWith(d);return p.jsxs("div",{className:Ce("mly:relative"),ref:h,children:[p.jsxs("label",{className:"mly:relative",children:[p.jsx("input",ue(H(ue(H({},Vs),{placeholder:"e.g. items",type:"text"}),f),{ref:e,value:i,onChange:b=>{s(b.target.value)},className:Ce("mly:h-7 mly:w-40 mly:rounded-md mly:bg-white mly:px-2 mly:pr-6 mly:text-sm mly:text-midnight-gray mly:hover:bg-soft-gray mly:focus:bg-soft-gray mly:focus:outline-hidden",o),onKeyDown:b=>{if(!m.current||!y)return;const{moveUp:w,moveDown:k,select:v}=m.current;b.key==="ArrowDown"?(b.preventDefault(),k()):b.key==="ArrowUp"?(b.preventDefault(),w()):b.key==="Enter"&&(b.preventDefault(),v())},spellCheck:!1})),p.jsx("div",{className:"mly:absolute mly:inset-y-0 mly:right-1 mly:flex mly:items-center",children:p.jsx(zx,{className:"mly:h-3 mly:w-3 mly:stroke-[2.5] mly:text-midnight-gray"})})]}),y&&p.jsx("div",{className:"mly:absolute mly:left-0 mly:top-8",children:p.jsx(g,{items:c.map(b=>({name:b})),onSelectItem:b=>{l?.(b.name)},ref:m})})]})});Aa.displayName="InputAutocomplete";function W$(t){const{showIfKey:e="",onShowIfKeyValueChange:n,editor:r}=t,i=Ji(r),s=i?.variables,o=i?.renderVariable,[a,l]=x.useState(!1),c=x.useRef(null),d=x.useMemo(()=>Ta(s,{query:e||"",from:"bubble-variable",editor:r}).map(f=>f.name),[s,e,r]),u=e||d.includes(e);return p.jsxs(On,{onOpenChange:f=>{f||l(!1)},children:[p.jsxs(Xt,{children:[p.jsx(Zt,{asChild:!0,children:p.jsx(Rn,{className:Ce("mly:flex mly:size-7 mly:items-center mly:justify-center mly:gap-1 mly:rounded-md mly:px-1.5 mly:text-sm mly:data-[state=open]:bg-soft-gray mly:hover:bg-soft-gray mly:focus-visible:relative mly:focus-visible:z-10 mly:focus-visible:outline-hidden mly:focus-visible:ring-2 mly:focus-visible:ring-gray-400 mly:focus-visible:ring-offset-2",e&&"mly:bg-rose-100 mly:text-rose-800 mly:data-[state=open]:bg-rose-100 mly:hover:bg-rose-100"),children:p.jsx(UI,{className:"mly:h-3 mly:w-3 mly:stroke-[2.5]"})})}),p.jsx(Kt,{sideOffset:8,children:"Show block conditionally"})]}),p.jsxs(xn,{className:"mly:flex mly:w-max mly:rounded-lg mly:p-0.5!",side:"top",sideOffset:8,align:"end",onOpenAutoFocus:f=>{f.preventDefault()},onCloseAutoFocus:f=>{f.preventDefault()},children:[p.jsxs("div",{className:"mly:flex mly:items-center mly:gap-1.5 mly:px-1.5 mly:text-sm mly:leading-none",children:["Show if",p.jsxs(Xt,{children:[p.jsx(Zt,{children:p.jsx(Gx,{className:Ce("mly:size-3 mly:stroke-[2.5] mly:text-gray-500")})}),p.jsx(Kt,{sideOffset:14,className:"mly:max-w-[285px]",align:"start",children:"Show the block if the selected variable is true."})]})]}),!a&&p.jsx("button",{onClick:()=>{l(!0),setTimeout(()=>{var f;(f=c.current)==null||f.focus()},0)},children:o({variable:{name:e,valid:!!u},fallback:"",from:"bubble-variable",editor:r})}),a&&p.jsx("form",{onSubmit:f=>{f.preventDefault(),l(!1)},onKeyDown:f=>{f.key==="Escape"&&l(!1)},children:p.jsx(Aa,{editor:r,value:e||"",onValueChange:f=>{n?.(f)},onOutsideClick:()=>{l(!1)},onSelectOption:f=>{n?.(f),l(!1)},autoCompleteOptions:d,ref:c})})]})]})}var Xi=x.memo(W$);function G$(t){const{columnsCount:e=2,onColumnsCountChange:n,columnWidths:r,onColumnWidthChange:i}=t;return p.jsxs(On,{children:[p.jsx(Rn,{className:"mly:flex mly:size-7 mly:items-center mly:justify-center mly:gap-1 mly:rounded-md mly:text-sm mly:data-[state=open]:bg-soft-gray mly:hover:bg-soft-gray",children:p.jsx(O2,{className:"mly:h-3 mly:w-3 mly:stroke-[2.5]"})}),p.jsxs(xn,{className:"mly:w-[300px] mly:rounded-lg mly:p-0.5!",side:"top",sideOffset:8,align:"center",onOpenAutoFocus:s=>{s.preventDefault()},onCloseAutoFocus:s=>{s.preventDefault()},children:[p.jsxs("div",{className:"mly:grid mly:grid-cols-2 mly:gap-1",children:[p.jsxs(bb,{onClick:()=>n(2),isActive:e===2,children:[p.jsx(Hx,{className:"mly:h-4 mly:w-4 mly:stroke-[2.5]"}),p.jsx("span",{children:"2 Columns"})]}),p.jsxs(bb,{onClick:()=>n(3),isActive:e===3,children:[p.jsx(II,{className:"mly:h-4 mly:w-4 mly:stroke-[2.5]"}),p.jsx("span",{children:"3 Columns"})]})]}),p.jsx("hr",{className:"mly:my-0.5 mly:border-gray-200"}),p.jsx("div",{className:"mly:grid mly:gap-1 mly:p-1",style:{gridTemplateColumns:`repeat(${e}, 1fr)`},children:Array.from({length:e}).map((s,o)=>{const a=r[o]==="auto"?"":r[o],l=e===2?o===0?"Left":"Right":o===0?"Left":o===1?"Middle":"Right";return p.jsxs("div",{className:"mly:flex mly:flex-col mly:gap-1",children:[p.jsx("span",{className:"mly:text-xs mly:text-gray-400",children:l}),p.jsxs("label",{className:"mly:relative",children:[p.jsx("input",ue(H({},Vs),{placeholder:"auto",min:1,max:90,type:"number",className:"hide-number-controls mly:w-full mly:appearance-none mly:rounded-md mly:bg-soft-gray mly:px-1.5 mly:py-1 mly:pr-6 mly:text-sm mly:tabular-nums mly:outline-hidden mly:focus:bg-soft-gray mly:focus:outline-hidden mly:focus:ring-1 mly:focus:ring-midnight-gray/50",value:a,onChange:c=>{const d=c.target.value;i?.(o,d)}})),p.jsx("span",{className:"mly:absolute mly:inset-y-0 mly:right-0 mly:flex mly:aspect-square mly:items-center mly:justify-center mly:text-xs mly:tabular-nums mly:text-gray-500",children:"%"})]})]},o)})})]})]})}function bb(t){const{onClick:e,isActive:n=!1,children:r}=t;return p.jsx("button",{className:Ce("mly:flex mly:h-7 mly:items-center mly:gap-1 mly:rounded-md mly:px-2 mly:text-sm mly:text-gray-500 mly:hover:bg-soft-gray mly:hover:text-midnight-gray",n&&"mly:bg-soft-gray mly:text-midnight-gray"),onClick:e,children:r})}function tr(t){const{label:e,options:n,value:r,onValueChange:i,tooltip:s,className:o,icon:a,iconClassName:l,placeholder:c}=t,d=`mly${x.useId()}`,u=p.jsxs("div",{className:"mly:relative",children:[p.jsx("label",{htmlFor:d,className:"mly:sr-only",children:e}),a&&p.jsx("div",{className:"mly:pointer-events-none mly:absolute mly:inset-y-0 mly:left-2 mly:z-20 mly:flex mly:items-center",children:p.jsx(a,{className:Ce("mly:size-3",l)})}),p.jsxs("select",{id:d,className:Ce("mly:flex mly:min-h-7 mly:max-w-max mly:appearance-none mly:items-center mly:rounded-md mly:bg-white mly:px-1.5 mly:py-0.5 mly:pr-7 mly:text-sm mly:text-midnight-gray mly:ring-offset-white mly:transition-colors mly:hover:bg-soft-gray mly:focus-visible:relative mly:focus-visible:z-10 mly:focus-visible:outline-hidden mly:focus-visible:ring-2 mly:focus-visible:ring-gray-400 mly:focus-visible:ring-offset-2 mly:active:bg-soft-gray",!!a&&"mly:pl-7",o),value:r||"",onChange:f=>i(f.target.value),children:[c&&p.jsx("option",{value:"",disabled:!0,hidden:!0,children:c}),n.map(f=>p.jsx("option",{value:f.value,children:f.label},f.value))]}),p.jsx("span",{className:"mly:pointer-events-none mly:absolute mly:inset-y-0 mly:right-0 mly:z-10 mly:flex mly:h-full mly:w-7 mly:items-center mly:justify-center mly:text-gray-600 mly:peer-disabled:opacity-50",children:p.jsx($x,{size:16,strokeWidth:2,"aria-hidden":"true",role:"img"})})]});return s?p.jsxs(Xt,{children:[p.jsx(Zt,{asChild:!0,children:u}),p.jsx(Kt,{sideOffset:8,children:s})]}):u}function W1(t,e){const{state:n}=t.view,r=xa(l=>l.type.name===e)(n.selection);if(!r)return;const i=r.pos,s=i+r.node.nodeSize,{tr:o}=n,a=o.delete(i,s);t.view.dispatch(a)}var pa=[{name:"Extra Small",short:"xs",value:4},{name:"Small",short:"sm",value:8},{name:"Medium",short:"md",value:16},{name:"Large",short:"lg",value:32},{name:"Extra Large",short:"xl",value:64}];function G1(t){const{editor:e}=t;if(!e)return null;const n=c$(e),r=n.columnsCount;return p.jsx(vn,{children:p.jsxs("div",{className:"mly:flex mly:items-stretch",children:[n.isColumnActive&&p.jsxs(p.Fragment,{children:[p.jsx(G$,{columnsCount:r,columnWidths:n.columnWidths,onColumnsCountChange:i=>{i>r?o$(e):a$(e)},onColumnWidthChange:(i,s)=>{s$(e,i,s)}}),p.jsx(rt,{})]}),p.jsx(V$,{alignment:n.currentVerticalAlignment,onAlignmentChange:i=>{e.commands.updateColumn({verticalAlign:i})}}),p.jsx(rt,{}),p.jsx(tr,{icon:I2,label:"Columns Gap",value:n.currentColumnsGap,options:[{value:"0",label:"None"},...pa.map(i=>({label:i.name,value:String(i.value)}))],onValueChange:i=>{e.commands.updateColumns({gap:+i})},tooltip:"Columns Gap"}),p.jsx(rt,{}),p.jsx(Bn,{icon:Qx,tooltip:"Delete Columns",command:()=>{W1(e,"columns")}}),p.jsx(rt,{}),p.jsx(Xi,{showIfKey:n.currentShowIfKey,onShowIfKeyValueChange:i=>{e.commands.updateColumns({showIfKey:i})},editor:e})]})})}function q$(t){const{appendTo:e,editor:n}=t;if(!n)return null;const r=x.useCallback(()=>{const s=Od(n,"columns");return s?.getBoundingClientRect()||new DOMRect(-1e3,-1e3,0,0)},[n]),i=ue(H(H({},t),e?{appendTo:e.current}:{}),{shouldShow:({editor:s})=>Rd(s)||s.isActive("section")||s.isActive("repeat")||!s.isEditable?!1:s.isActive("columns"),tippyOptions:{offset:[0,8],popperOptions:{modifiers:[{name:"flip",enabled:!1}]},getReferenceClientRect:r,appendTo:()=>e?.current,plugins:[Wi],sticky:"popper",maxWidth:"auto"},pluginKey:"columnsBubbleMenu"});return p.jsx(Ir,ue(H({},i),{className:"mly:rounded-lg mly:border mly:border-gray-200 mly:bg-white mly:p-0.5 mly:shadow-md",children:p.jsx(G1,{editor:n})}))}function Kp(t,e,n){const r=[],i=t.node(0);n=typeof n=="number"&&n>=0?n:t.sameParent(e)?Math.max(0,t.sharedDepth(e.pos)-1):t.sharedDepth(e.pos);const s=new Po(t,e,n),o=s.depth===0?0:i.resolve(s.start).posAtIndex(0);return s.parent.forEach((a,l)=>{const c=o+l,d=c+a.nodeSize;if(c<s.start||c>=s.end)return;const u=new f0(i.resolve(c),i.resolve(d));r.push(u)}),r}var Y$=class q1{constructor(e,n){this.anchor=e,this.head=n}map(e){return new q1(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return new Y1(n,r)}},Y1=class Ur extends Se{constructor(e,n,r,i=1){const{doc:s}=e,o=e===n,a=e.pos===s.content.size&&n.pos===s.content.size,l=o&&!a?s.resolve(n.pos+(i>0?1:-1)):n,c=o&&a?s.resolve(e.pos-(i>0?1:-1)):e,d=Kp(c.min(l),c.max(l),r);super(l.pos>=e.pos?d[0].$from:d[d.length-1].$to,l.pos>=e.pos?d[d.length-1].$to:d[0].$from,d),this.depth=r}get $to(){return this.ranges[this.ranges.length-1].$to}eq(e){return e instanceof Ur&&e.$from.pos===this.$from.pos&&e.$to.pos===this.$to.pos}map(e,n){const r=e.resolve(n.map(this.anchor)),i=e.resolve(n.map(this.head));return new Ur(r,i)}toJSON(){return{type:"nodeRange",anchor:this.anchor,head:this.head}}get isForwards(){return this.head>=this.anchor}get isBackwards(){return!this.isForwards}extendBackwards(){const{doc:e}=this.$from;if(this.isForwards&&this.ranges.length>1){const i=this.ranges.slice(0,-1),s=i[0].$from,o=i[i.length-1].$to;return new Ur(s,o,this.depth)}const n=this.ranges[0],r=e.resolve(Math.max(0,n.$from.pos-1));return new Ur(this.$anchor,r,this.depth)}extendForwards(){const{doc:e}=this.$from;if(this.isBackwards&&this.ranges.length>1){const i=this.ranges.slice(1),s=i[0].$from,o=i[i.length-1].$to;return new Ur(o,s,this.depth)}const n=this.ranges[this.ranges.length-1],r=e.resolve(Math.min(e.content.size,n.$to.pos+1));return new Ur(this.$anchor,r,this.depth)}static fromJSON(e,n){return new Ur(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r,i,s=1){return new this(e.resolve(n),e.resolve(r),i,s)}getBookmark(){return new Y$(this.anchor,this.head)}};function J$(t){const e=t.cloneNode(!0),n=[t,...Array.from(t.getElementsByTagName("*"))],r=[e,...Array.from(e.getElementsByTagName("*"))];return n.forEach((i,s)=>{const o=r[s];o instanceof HTMLElement&&i instanceof HTMLElement&&(o.style.cssText=(function(a){let l="";const c=getComputedStyle(a);for(let d=0;d<c.length;d+=1)l+=`${c[d]}:${c.getPropertyValue(c[d])};`;return l})(i))}),e}function ml(t,e){return window.getComputedStyle(t)[e]}function X$(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function vb(t){t.parentNode!==null&&t.parentNode!==void 0&&t.parentNode.removeChild(t)}var J1=t=>{const{x:e,y:n,direction:r,editor:i}=t;let s=null,o=null,a=null,l=e;for(;o===null&&l<window.innerWidth&&l>0;){const c=document.elementsFromPoint(l,n),d=c.findIndex(f=>f.classList.contains("ProseMirror")),u=c.slice(0,d);if(u.length>0){const f=u[0];if(s=f,a=i.view.posAtDOM(f,0),a>=0){o=i.state.doc.nodeAt(Math.max(a-1,0)),(o===null||o.isText)&&(o=i.state.doc.nodeAt(Math.max(a-1,0))),o||(o=i.state.doc.nodeAt(Math.max(a,0)));break}}r==="left"?l-=1:l+=1}return{resultElement:s,resultNode:o,pos:a!==null?a:null}};function Z$(t,e){const{doc:n}=e.view.state,r=J1({editor:e,x:t.clientX,y:t.clientY,direction:"right"});if(!r.resultNode||r.pos===null)return[];const i=t.clientX,s=(function(d,u,f){const h=parseInt(ml(d.dom,"paddingLeft"),10),m=parseInt(ml(d.dom,"paddingRight"),10),g=parseInt(ml(d.dom,"borderLeftWidth"),10),y=parseInt(ml(d.dom,"borderLeftWidth"),10),b=d.dom.getBoundingClientRect();return{left:X$(u,b.left+h+g,b.right-m-y),top:f}})(e.view,i,t.clientY),o=e.view.posAtCoords(s);if(!o)return[];const{pos:a}=o;if(!n.resolve(a).parent)return[];const l=n.resolve(r.pos),c=n.resolve(r.pos+1);return Kp(l,c,0)}var xb=(t,e)=>{const n=t.resolve(e),{depth:r}=n;return r===0?e:n.pos-n.parentOffset-1},wb=(t,e)=>{const n=t.nodeAt(e),r=t.resolve(e);let{depth:i}=r,s=n;for(;i>0;){const o=r.node(i);i-=1,i===0&&(s=o)}return s},Yu=(t,e)=>{const n=LB.getState(t);return n?PB(e,n.type,n.binding.mapping):null},Eb=(t,e)=>{let n=e;for(;n&&n.parentNode&&n.parentNode!==t.dom;)n=n.parentNode;return n},X1=new Ge("dragHandle");function Q$(t){const{pluginKey:e=X1,element:n,editor:r,tippyOptions:i,onNodeChange:s}=t,o=document.createElement("div");let a=null,l=!1,c=null,d=-1;return n.addEventListener("dragstart",u=>{const{view:f}=r;if(!u.dataTransfer)return;const{empty:h,$from:m,$to:g}=f.state.selection,y=Z$(u,r),b=Kp(m,g,0),w=b.some(D=>y.find(j=>j.$from===D.$from&&j.$to===D.$to)),k=h||!w?y:b;if(!k.length)return;const{tr:v}=f.state,E=document.createElement("div"),S=k[0].$from.pos,C=k[k.length-1].$to.pos,N=Y1.create(f.state.doc,S,C),M=N.content();k.forEach(D=>{const j=J$(f?.nodeDOM(D.$from.pos));E.append(j)}),E.style.position="absolute",E.style.top="-10000px",document.body.append(E),u.dataTransfer.clearData(),u.dataTransfer.setDragImage(E,0,0),f.dragging={slice:M,move:!0},v.setSelection(N),f.dispatch(v),document.addEventListener("drop",()=>vb(E),{once:!0}),setTimeout(()=>{n&&(n.style.pointerEvents="none")},0)}),n.addEventListener("dragend",()=>{n&&(n.style.pointerEvents="auto")}),new Ze({key:typeof e=="string"?new Ge(e):e,state:{init:()=>({locked:!1}),apply(u,f,h,m){const g=u.getMeta("lockDragHandle"),y=u.getMeta("hideDragHandle");if(g!==void 0&&(l=g),y&&a)return a?.hide(),l=!1,c=null,d=-1,s?.({editor:r,node:null,pos:-1}),f;if(u.docChanged&&d!==-1&&n&&a){const b=u.mapping.map(d);b!==d&&(d=b,Yu(m,d))}return f}},view:u=>{var f;return n.draggable=!0,n.style.pointerEvents="auto",(f=r.view.dom.parentElement)===null||f===void 0||f.appendChild(o),o.appendChild(n),o.style.pointerEvents="none",o.style.position="absolute",o.style.top="0",o.style.left="0",a=mi(u.dom,ue(H({getReferenceClientRect:null,interactive:!0,trigger:"manual",placement:"left-start",hideOnClick:!1,duration:100,zIndex:10,popperOptions:{modifiers:[{name:"flip",enabled:!1},{name:"preventOverflow",options:{rootBoundary:"document",mainAxis:!1}}]}},i),{appendTo:o,content:n})),{update(h,m){if(!n||!a||(n.draggable=!l,u.state.doc.eq(m.doc)||d===-1))return;let g=u.nodeDOM(d);if(g=Eb(u,g),g===u.dom||g?.nodeType!==1)return;const y=u.posAtDOM(g,0),b=wb(r.state.doc,y);if(b!==c){const w=xb(r.state.doc,y);c=b,d=w,Yu(u.state,d),s?.({editor:r,node:c,pos:d}),a.setProps({getReferenceClientRect:()=>g?.getBoundingClientRect()}),a.show()}},destroy(){a?.destroy(),n&&vb(o)}}},props:{handleDOMEvents:{mouseleave:(u,f)=>(l||f.target&&!o.contains(f?.relatedTarget)&&(a?.hide(),c=null,d=-1,s?.({editor:r,node:null,pos:-1})),!1),mousemove(u,f){if(!n||!a||l)return!1;const h=J1({x:f.clientX,y:f.clientY,direction:"right",editor:r});if(!h.resultElement)return!1;let m=h.resultElement;if(m=Eb(u,m),m===u.dom||m?.nodeType!==1)return!1;const g=u.posAtDOM(m,0),y=wb(r.state.doc,g);if(y!==c){const b=xb(r.state.doc,g);c=y,d=b,Yu(u.state,d),s?.({editor:r,node:c,pos:d}),a.setProps({getReferenceClientRect:()=>m.getBoundingClientRect()}),a.show()}return!1}}}})}function e9(t){const{className:e="drag-handle",children:n,editor:r,pluginKey:i=X1,onNodeChange:s,tippyOptions:o={}}=t,[a,l]=x.useState(null),c=x.useRef(null);return x.useEffect(()=>a?r.isDestroyed?()=>{c.current=null}:(c.current||(c.current=Q$({editor:r,element:a,pluginKey:i,tippyOptions:o,onNodeChange:s}),r.registerPlugin(c.current)),()=>{r.unregisterPlugin(i),c.current=null}):()=>{c.current=null},[a,r,s,i]),p.jsx("div",{className:e,ref:l,children:n})}function t9(t){const{editor:e}=t,[n,r]=x.useState(!1),[i,s]=x.useState(null),[o,a]=x.useState(-1),l=x.useCallback(f=>{f.node&&s(f.node),a(f.pos)},[a,s]);function c(){e.commands.setNodeSelection(o);const{$anchor:f}=e.state.selection,h=f.node(1)||e.state.selection.node;e.chain().setMeta("hideDragHandle",!0).insertContentAt(o+(i?.nodeSize||0),h.toJSON()).run(),r(!1)}function d(){e.chain().setMeta("hideDragHandle",!0).setNodeSelection(o).deleteSelection().run(),r(!1)}function u(){var f;if(o!==-1){const h=i?.nodeSize||0,m=o+h,g=i?.type.name==="paragraph"&&((f=i?.content)==null?void 0:f.size)===0,y=g?o+2:m+2;e.chain().command(({dispatch:b,tr:w,state:k})=>b?(g?w.insertText("/",o,o+1):w.insert(m,k.schema.nodes.paragraph.create(null,[k.schema.text("/")])),b(w)):!0).focus(y).run()}}return x.useEffect(()=>(n?e.commands.setMeta("lockDragHandle",!0):e.commands.setMeta("lockDragHandle",!1),()=>{e.commands.setMeta("lockDragHandle",!1)}),[e,n]),p.jsx(e9,{pluginKey:"ContentMenu",editor:e,tippyOptions:{offset:[2,0],zIndex:99},onNodeChange:l,className:Ce(e.isEditable?"mly:visible":"mly:hidden"),children:p.jsx(vn,{children:p.jsxs("div",{className:"mly:flex mly:items-center mly:pr-1.5",children:[p.jsxs(Xt,{children:[p.jsx(Zt,{asChild:!0,children:p.jsx(on,{variant:"ghost",size:"icon",className:"mly:size-5! mly:cursor-grab mly:text-gray-500 mly:hover:text-black",onClick:u,type:"button",children:p.jsx(C2,{className:"mly:size-3.5 mly:shrink-0"})})}),p.jsx(Kt,{sideOffset:8,children:"Add new node"})]}),p.jsxs(On,{open:n,onOpenChange:r,children:[p.jsxs("div",{className:"mly:relative mly:flex mly:flex-col",children:[p.jsxs(Xt,{children:[p.jsx(Zt,{asChild:!0,children:p.jsx(on,{variant:"ghost",size:"icon",className:"mly:relative mly:z-1 mly:size-5! mly:cursor-grab mly:text-gray-500 mly:hover:text-black",onClick:f=>{f.preventDefault(),r(!0),e.commands.setNodeSelection(o)},type:"button",children:p.jsx(qI,{className:"mly:size-3.5 mly:shrink-0"})})}),p.jsx(Kt,{sideOffset:8,children:"Node actions"})]}),p.jsx(Rn,{className:"mly:absolute mly:left-0 mly:top-0 mly:z-0 mly:h-5 mly:w-5"})]}),p.jsxs(xn,{align:"start",side:"bottom",sideOffset:8,className:"mly:flex mly:w-max mly:flex-col mly:rounded-md mly:p-1",children:[p.jsxs(on,{variant:"ghost",onClick:c,className:"mly:h-auto mly:justify-start mly:gap-2 mly:rounded! mly:px-2 mly:py-1 mly:text-sm mly:font-normal",children:[p.jsx(LI,{className:"mly:size-[15px] mly:shrink-0"}),"Duplicate"]}),p.jsx(rt,{type:"horizontal"}),p.jsxs(on,{onClick:d,className:"mly:h-auto mly:justify-start mly:gap-2 mly:rounded! mly:bg-red-100 mly:px-2 mly:py-1 mly:text-sm mly:font-normal mly:text-red-600 mly:hover:bg-red-200 mly:focus:bg-red-200",children:[p.jsx(z2,{className:"mly:size-[15px] mly:shrink-0"}),"Delete"]})]})]})]})})})}var n9=t=>{const{editor:e,config:n}=t,r=x.useMemo(()=>[{name:"bold",command:()=>e.chain().focus().toggleBold().run(),isActive:()=>e.isActive("bold"),group:"mark",icon:jx},{name:"italic",command:()=>e.chain().focus().toggleItalic().run(),isActive:()=>e.isActive("italic"),group:"mark",icon:qx},{name:"underline",command:()=>e.chain().focus().toggleUnderline().run(),isActive:()=>e.isActive("underline"),group:"mark",icon:ew},{name:"strike",command:()=>e.chain().focus().toggleStrike().run(),isActive:()=>e.isActive("strike"),group:"mark",icon:Zx},{name:"delete-line",command:()=>e.chain().focus().selectParentNode().deleteSelection().run(),isActive:()=>!1,group:"mark",icon:Ux},{name:"divider",command:()=>e.chain().focus().setHorizontalRule().run(),isActive:()=>e.isActive("horizontalRule"),group:"custom",icon:A2},{name:"link",command:()=>{const s=e.getAttributes("link").href,o=window.prompt("URL",s);if(o!==null){if(o===""){e.chain().focus().extendMarkRange("link").unsetLink().run();return}e.chain().focus().extendMarkRange("link").setLink({href:o}).run()}},isActive:()=>e.isActive("link"),group:"custom",icon:If},{name:"left",command:()=>e.chain().focus().setTextAlign("left").run(),isActive:()=>e.isActive({textAlign:"left"}),group:"alignment",icon:Px},{name:"center",command:()=>e.chain().focus().setTextAlign("center").run(),isActive:()=>e.isActive({textAlign:"center"}),group:"alignment",icon:Lx},{name:"right",command:()=>e.chain().focus().setTextAlign("right").run(),isActive:()=>e.isActive({textAlign:"right"}),group:"alignment",icon:Bx}],[e]),i=x.useMemo(()=>r.reduce((s,o)=>(s.includes(o.group)||s.push(o.group),s),[]),[r]);return e?p.jsx("div",{className:`mly:flex mly:items-center mly:gap-3 ${n?.toolbarClassName}`,children:i.map((s,o)=>p.jsx("div",{className:"mly:flex mly:items-center mly:gap-1 mly:rounded-md mly:border mly:border-gray-200 mly:bg-white mly:p-1",children:r.filter(a=>a.group===s).map((a,l)=>p.jsx(Bn,H({},a),l))},o))}):null},r9=t=>cr({editor:t,selector:n=>{var r,i;return{activeTab:((r=n.editor.getAttributes("htmlCodeBlock"))==null?void 0:r.activeTab)||"code",currentShowIfKey:((i=n.editor.getAttributes("htmlCodeBlock"))==null?void 0:i.showIfKey)||""}},equalityFn:gi});function i9(t){const{appendTo:e,editor:n}=t;if(!n)return null;const r=r9(n),i=x.useCallback(()=>{const a=Od(n,"htmlCodeBlock");return a?.getBoundingClientRect()||new DOMRect(-1e3,-1e3,0,0)},[n]),s=ue(H(H({},t),e?{appendTo:e.current}:{}),{shouldShow:({editor:a})=>a.isActive("htmlCodeBlock"),tippyOptions:{offset:[0,8],popperOptions:{modifiers:[{name:"flip",enabled:!1}]},getReferenceClientRect:i,appendTo:()=>e?.current,plugins:[Wi],sticky:"popper",maxWidth:"auto"},pluginKey:"htmlCodeBlockBubbleMenu"}),{activeTab:o="code"}=r;return p.jsx(Ir,ue(H({},s),{className:"mly:flex mly:items-stretch mly:rounded-lg mly:border mly:border-gray-200 mly:bg-white mly:p-0.5 mly:shadow-md",children:p.jsxs(vn,{children:[p.jsxs("div",{className:"mly:flex mly:items-center mly:h-7 mly:rounded-md mly:bg-soft-gray mly:px-0.5",children:[p.jsxs(Xt,{children:[p.jsx(Zt,{asChild:!0,children:p.jsx("button",{className:Ce("mly:flex mly:size-6 mly:shrink-0 mly:items-center mly:justify-center mly:rounded mly:focus-visible:relative mly:focus-visible:z-10 mly:focus-visible:outline-hidden mly:focus-visible:ring-2 mly:focus-visible:ring-gray-400 mly:focus-visible:ring-offset-2",o==="code"&&"mly:bg-white"),disabled:o==="code",onClick:()=>{var a;(a=n?.commands)==null||a.updateHtmlCodeBlock({activeTab:"code"})},children:p.jsx(Fx,{className:"mly:size-3 mly:shrink-0 mly:stroke-[2.5]"})})}),p.jsx(Kt,{sideOffset:8,children:"HTML Code"})]}),p.jsxs(Xt,{children:[p.jsx(Zt,{asChild:!0,children:p.jsx("button",{className:Ce("mly:flex mly:size-6 mly:shrink-0 mly:items-center mly:justify-center mly:rounded mly:focus-visible:relative mly:focus-visible:z-10 mly:focus-visible:outline-hidden mly:focus-visible:ring-2 mly:focus-visible:ring-gray-400 mly:focus-visible:ring-offset-2",o==="preview"&&"mly:bg-white"),disabled:o==="preview",onClick:()=>{var a;(a=n?.commands)==null||a.updateHtmlCodeBlock({activeTab:"preview"})},children:p.jsx(q2,{className:"mly:size-3 mly:shrink-0 mly:stroke-[2.5]"})})}),p.jsx(Kt,{sideOffset:8,children:"Preview"})]})]}),p.jsx(rt,{}),p.jsx(Xi,{showIfKey:r.currentShowIfKey,onShowIfKeyValueChange:a=>{n.commands.updateHtmlCodeBlock({showIfKey:a})},editor:n})]})}))}var Z1="#f7f7f7",kb="left",s9=2,Q1="#e2e2e2",o9=0,a9=0,l9=0,c9=0,d9=0,u9=0,f9=0,h9=0,gt=null,ek=dt.create({name:"section",group:"block",content:"(block|columns)+",defining:!0,isolating:!0,addAttributes(){return{borderRadius:{default:0,parseHTML:t=>{var e,n;return Number((n=(e=t?.style)==null?void 0:e.borderRadius)==null?void 0:n.replace(/['"]+/g,""))},renderHTML:t=>t.borderRadius?{style:`border-radius: ${t.borderRadius}px`}:{}},backgroundColor:{default:Z1,parseHTML:t=>t.style.backgroundColor,renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor};--bg-color: ${t.backgroundColor}`}:{}},align:{default:kb,parseHTML:t=>t.getAttribute("align")||kb,renderHTML(t){return t.align?{align:t.align}:{}}},borderWidth:{default:s9,parseHTML:t=>{var e,n;return Number((n=(e=t?.style)==null?void 0:e.borderWidth)==null?void 0:n.replace(/['"]+/g,""))||0},renderHTML:t=>t.borderWidth?{style:`border-width: ${t.borderWidth}px`}:{}},borderColor:{default:Q1,parseHTML:t=>t.style.borderColor,renderHTML:t=>t.borderColor?{style:`border-color: ${t.borderColor}`}:{}},paddingTop:{default:d9,parseHTML:t=>{var e,n;return Number((n=(e=t?.style)==null?void 0:e.paddingTop)==null?void 0:n.replace(/['"]+/g,""))||0},renderHTML:t=>t.paddingTop?{style:`padding-top: ${t.paddingTop}px`}:{}},paddingRight:{default:u9,parseHTML:t=>{var e,n;return Number((n=(e=t?.style)==null?void 0:e.paddingRight)==null?void 0:n.replace(/['"]+/g,""))||0},renderHTML:t=>t.paddingRight?{style:`padding-right: ${t.paddingRight}px`}:{}},paddingBottom:{default:f9,parseHTML:t=>{var e,n;return Number((n=(e=t?.style)==null?void 0:e.paddingBottom)==null?void 0:n.replace(/['"]+/g,""))||0},renderHTML:t=>t.paddingBottom?{style:`padding-bottom: ${t.paddingBottom}px`}:{}},paddingLeft:{default:h9,parseHTML:t=>{var e,n;return Number((n=(e=t?.style)==null?void 0:e.paddingLeft)==null?void 0:n.replace(/['"]+/g,""))||0},renderHTML:t=>t.paddingLeft?{style:`padding-left: ${t.paddingLeft}px`}:{}},marginTop:{default:o9,parseHTML:t=>{var e,n;return Number((n=(e=t?.style)==null?void 0:e.marginTop)==null?void 0:n.replace(/['"]+/g,""))||0},renderHTML:t=>t.marginTop?{marginTop:t.marginTop}:{}},marginRight:{default:a9,parseHTML:t=>{var e,n;return Number((n=(e=t?.style)==null?void 0:e.marginRight)==null?void 0:n.replace(/['"]+/g,""))||0},renderHTML:t=>t.marginRight?{marginRight:t.marginRight}:{}},marginBottom:{default:l9,parseHTML:t=>{var e,n;return Number((n=(e=t?.style)==null?void 0:e.marginBottom)==null?void 0:n.replace(/['"]+/g,""))||0},renderHTML:t=>t.marginBottom?{marginBottom:t.marginBottom}:{}},marginLeft:{default:c9,parseHTML:t=>{var e,n;return Number((n=(e=t?.style)==null?void 0:e.marginLeft)==null?void 0:n.replace(/['"]+/g,""))||0},renderHTML:t=>t.marginLeft?{marginLeft:t.marginLeft}:{}},showIfKey:{default:gt,parseHTML:t=>t.getAttribute("data-show-if-key")||gt,renderHTML(t){return t.showIfKey?{"data-show-if-key":t.showIfKey}:{}}}}},addCommands(){return{setSection:()=>({commands:t})=>t.insertContent({type:this.name,attrs:{type:this.name},content:[{type:"paragraph"}]}),updateSection:t=>to(this.name,t)}},renderHTML({HTMLAttributes:t}){const{marginTop:e=0,marginRight:n=0,marginBottom:r=0,marginLeft:i=0}=t;return["table",{"data-type":this.name,border:0,cellpadding:0,cellspacing:0,class:"mly:w-full mly:border-separate mly:relative mly:table-fixed",style:`margin-top: ${e}px; margin-right: ${n}px; margin-bottom: ${r}px; margin-left: ${i}px;`},["tbody",{class:"mly:w-full"},["tr",{class:"mly:w-full"},["td",He(t,{"data-type":"section-cell",style:"border-style: solid",class:"mly:w-full mly:[text-align:revert-layer]"}),0]]]]},parseHTML(){return[{tag:'table[data-type="section"]'}]}});function p9(t){const{editor:e,onImageUpload:n,allowedMimeTypes:r}=t;function i(s,o,a){var l,c,d;const u=URL.createObjectURL(o),{tr:f,schema:h}=s.state,m=h.nodes.image.create({src:u,isSrcVariable:!1,alt:o.name,externalLink:"",isExternalLinkVariable:!1});(d=(c=(l=e?.extensionStorage)==null?void 0:l.imageUpload)==null?void 0:c.placeholderImages)==null||d.add(u);const g=a!==void 0?s.state.doc.resolve(a):s.state.selection.$head,y=f.insert(g.pos,m);s.dispatch(y),n?.(o).then(b=>{const w=s.state.tr,k=v=>v.type.name==="image"&&v.attrs.src===u;s.state.doc.descendants((v,E)=>{if(k(v))return w.setNodeMarkup(E,void 0,ue(H({},v.attrs),{src:b})),!1}),s.dispatch(w)}).catch(b=>{console.error("Image upload failed",b)}).finally(()=>{e.extensionStorage.imageUpload.placeholderImages.delete(u),URL.revokeObjectURL(u)})}return new Ze({key:new Ge("imageUpload"),props:{handleDrop:(s,o)=>{var a,l;if(!n||!((l=(a=o.dataTransfer)==null?void 0:a.files)!=null&&l.length))return!1;const c=Array.from(o.dataTransfer.files).filter(u=>r?.includes(u.type));if(c.length===0)return!1;const d=s.posAtCoords({left:o.clientX,top:o.clientY});return d?(o.preventDefault(),o.stopPropagation(),c.forEach(u=>i(s,u,d.pos)),!0):!1},handlePaste:(s,o)=>{var a,l;if(!n||!((l=(a=o.clipboardData)==null?void 0:a.files)!=null&&l.length))return!1;const c=Array.from(o.clipboardData.files).filter(d=>r?.includes(d.type));return c.length===0?!1:(o.preventDefault(),o.stopPropagation(),c.forEach(d=>i(s,d)),!0)}}})}ot.create({name:"imageUpload",addOptions(){return{allowedMimeTypes:["image/jpeg","image/png","image/gif","image/webp","image/svg+xml"],onImageUpload:void 0}},addStorage(){return{placeholderImages:new Set}},addProseMirrorPlugins(){const{onImageUpload:t}=this.options;return t?[p9({editor:this.editor,allowedMimeTypes:this.options.allowedMimeTypes,onImageUpload:this.options.onImageUpload})]:[]}});function tk(t){return x.useMemo(()=>{const e=t.extensionManager.extensions.find(n=>n.name==="imageUpload");return e?.options||{}},[t])}var m9=t=>{const e=x.useRef(null);return x.useLayoutEffect(()=>{e.current=t},[t]),x.useCallback((...n)=>{if(e.current===null)throw new Error("Handler is not assigned");return e.current(...n)},[])};function Sb(t,e){return t/e}function ih(t,e){return t<=0||e<=0?0:t/e}function g9(t,e){return t*e}var Cb=20,nk=600,_b=400;function y9(t){const{node:e,updateAttributes:n,selected:r,editor:i}=t,[s,o]=x.useState("idle"),[a,l]=x.useState(!1),{onImageUpload:c,allowedMimeTypes:d=[]}=tk(i),u=x.useRef(null),f=x.useRef(null),[h,m]=x.useState(),[g,y]=x.useState(!1),b=m9(X=>{const ne=document.querySelector(".ProseMirror-selectednode");if(!f.current||!ne||!r)return;const Ee=Math.max(ne.offsetWidth,nk);X.preventDefault();const be=X.currentTarget.dataset.direction||"--",Be=X.clientX,Ie=X.clientY,Le=f.current.width,ze=f.current.height;let Pe=Le,je=ze;const ut=be[1]==="w"?-1:1,bt=be[0]==="n"?-1:1,ge=()=>{window.removeEventListener("mousemove",at),window.removeEventListener("mouseup",ge);const st=Sb(Pe,je);n({width:Pe,height:je,aspectRatio:st}),m(void 0)},at=st=>{if(Pe=Math.max(Le+ut*(st.clientX-Be),Cb),je=Math.max(ze+bt*(st.clientY-Ie),Cb),Pe>Ee&&(Pe=Ee),je>_b&&(je=_b),e.attrs.lockAspectRatio){const de=e.attrs.aspectRatio&&isFinite(e.attrs.aspectRatio)&&e.attrs.aspectRatio>0?e.attrs.aspectRatio:Le/ze;je=ih(Pe,de)}if(m({width:Pe,height:je}),!st.buttons)return ge()};window.addEventListener("mousemove",at),window.addEventListener("mouseup",ge)}),w=x.useCallback(X=>a?null:p.jsx("div",{role:"button",tabIndex:0,onMouseDown:b,"data-direction":X,className:"mly:bg-rose-500",style:ue(H(H({position:"absolute",height:"10px",width:"10px"},{n:{top:0},s:{bottom:0}}[X[0]]),{w:{left:0},e:{right:0}}[X[1]]),{cursor:`${X}-resize`})}),[b,a]);let{alignment:k="center",width:v,height:E,src:S,borderRadius:C}=e.attrs||{};const N=e.attrs||{},{externalLink:M,isExternalLinkVariable:D,isSrcVariable:j,showIfKey:B,aspectRatio:F,borderRadius:G,lockAspectRatio:q}=N,W=fr(N,["externalLink","isExternalLinkVariable","isSrcVariable","showIfKey","aspectRatio","borderRadius","lockAspectRatio"]),A=!!W.src,T=!!c&&i.isEditable&&!A&&!j&&s==="idle",P=X=>ks(this,null,function*(){if(!T||!X.target.files||X.target.files.length===0)return;const ne=X.target.files[0];yield Y(ne)}),Y=x.useCallback(X=>ks(this,null,function*(){if(T)try{o("loading");const ne=yield c(X);n({src:ne}),l(!1),o("loaded")}catch(ne){console.error("Error uploading image:",ne),o("error")}}),[c,n]);x.useEffect(()=>{var X,ne,Ee,be;if(!S||j)return;o("loading");const Be=(be=(Ee=(ne=(X=i?.extensionStorage)==null?void 0:X.imageUpload)==null?void 0:ne.placeholderImages)==null?void 0:Ee.has(S))!=null?be:!1;l(Be);const Ie=new Image;return Ie.src=S,Ie.onload=()=>{o("loaded");const{naturalWidth:Le,naturalHeight:ze}=Ie,Pe=u?.current;if(!Pe||v!=="auto"||!Le)return;const je=Pe.offsetWidth,ut=Sb(Le,ze),bt=Math.min(ih(je,ut),ze);n({width:Math.min(je,Le),height:Math.min(bt,ze),aspectRatio:ut})},Ie.onerror=()=>{o("error")},()=>{Ie.src="",Ie.onload=null,Ie.onerror=null}},[S]);const te=x.useCallback(X=>{T&&(X.preventDefault(),X.stopPropagation(),y(!0))},[c]),pe=x.useCallback(X=>{T&&(X.preventDefault(),X.stopPropagation(),y(!1))},[c]),Q=x.useCallback(X=>ks(this,null,function*(){var ne;if(!T)return;X.preventDefault(),X.stopPropagation(),y(!1);const Ee=(ne=X.dataTransfer)==null?void 0:ne.files;if(!Ee||Ee?.length===0)return;const be=Ee[0];d.includes(be.type)&&(yield Y(be))}),[Y]);return p.jsxs(Gi,ue(H({as:"div",draggable:i.isEditable,"data-drag-handle":i.isEditable,className:Ce("mly-image-drop-zone",g&&"mly-drag-over"),style:H(ue(H({},A&&s==="loaded"?H({width:v&&v!=="auto"?`${v}px`:void 0,height:E&&E!=="auto"?`${E}px`:void 0},h):{}),{overflow:"hidden",position:"relative",lineHeight:"0px",display:"block",maxWidth:"100%"}),{center:{marginLeft:"auto",marginRight:"auto"},left:{marginRight:"auto"},right:{marginLeft:"auto"}}[k]||{}),ref:u},T?{onDragOver:te,onDragLeave:pe,onDrop:Q}:{}),{children:[!A&&s==="idle"&&p.jsx(Zn,{status:"idle",minHeight:E,isDropZone:T}),!A&&s==="loading"&&!j&&p.jsx(Zn,{status:"loading",minHeight:E}),A&&j&&p.jsx(Zn,{status:"variable",minHeight:E}),A&&s==="loading"&&!j&&p.jsx(Zn,{status:"loading",minHeight:E}),A&&s==="error"&&!j&&p.jsx(Zn,{status:"error",minHeight:E}),T&&p.jsx("input",{type:"file",accept:"image/*",onChange:P,className:"mly:absolute mly:inset-0 mly:opacity-0",multiple:!1}),A&&s==="loaded"&&!j&&p.jsxs(p.Fragment,{children:[p.jsx("img",ue(H({},W),{ref:f,style:ue(H({},h),{cursor:"default",objectFit:"fill",marginBottom:0,borderRadius:C,width:h?.width?`${h.width}px`:v&&v!=="auto"?`${v}px`:"auto",height:h?.height?`${h.height}px`:E&&E!=="auto"?`${E}px`:"auto"}),draggable:i.isEditable,className:Ce(a&&"mly:animate-pulse mly:opacity-40")})),r&&i.isEditable&&!a&&p.jsxs(p.Fragment,{children:[[{left:0,top:0,height:"100%",width:"1px"},{right:0,top:0,height:"100%",width:"1px"},{top:0,left:0,width:"100%",height:"1px"},{bottom:0,left:0,width:"100%",height:"1px"}].map((X,ne)=>p.jsx("div",{className:"mly:bg-rose-500",style:H({position:"absolute"},X)},ne)),w("nw"),w("ne"),w("sw"),w("se")]})]})]}))}function Zn(t){const e=t,{status:n,minHeight:r,className:i,style:s,isDropZone:o}=e,a=fr(e,["status","minHeight","className","style","isDropZone"]);return p.jsxs("div",ue(H({},a),{className:Ce("mly:flex mly:items-center mly:justify-center mly:gap-2 mly:rounded-lg mly:bg-soft-gray mly:px-4 mly:py-2 mly:text-sm mly:font-medium",{"mly:text-gray-500 mly:hover:bg-soft-gray/60":n==="loading","mly:text-red-500 mly:hover:bg-soft-gray/60":n==="error"},i),style:H(H({},r?{minHeight:r}:{}),s),children:[n==="idle"&&!o&&p.jsxs(p.Fragment,{children:[p.jsx(e2,{className:"mly:size-4 mly:stroke-[2.5]"}),p.jsx("span",{children:"No image selected"})]}),n==="idle"&&o&&p.jsxs(p.Fragment,{children:[p.jsx(WI,{className:"mly:size-4 mly:stroke-[2.5]"}),p.jsx("span",{children:"Click or Drop image here"})]}),n==="loading"&&p.jsxs(p.Fragment,{children:[p.jsx(d2,{className:"mly:size-4 mly:animate-spin mly:stroke-[2.5]"}),p.jsx("span",{children:"Loading image..."})]}),n==="error"&&p.jsxs(p.Fragment,{children:[p.jsx(xI,{className:"mly:size-4 mly:stroke-[2.5]"}),p.jsx("span",{children:"Error loading image"})]}),n==="variable"&&p.jsxs(p.Fragment,{children:[p.jsx(vs,{className:"mly:size-4 mly:stroke-[2.5]"}),p.jsx("span",{children:"Variable Image URL"})]})]}))}function b9(t){const{node:e,editor:n,updateAttributes:r}=t,[i,s]=x.useState("idle"),[o,a]=x.useState(!1),[l,c]=x.useState(!1),{onImageUpload:d,allowedMimeTypes:u=[]}=tk(n);let{alignment:f="center",src:h,isSrcVariable:m,size:g="sm"}=e.attrs||{};const y=!!h,b=!!d&&n.isEditable&&!m&&i==="idle",w=N=>ks(this,null,function*(){if(!b||!N.target.files||N.target.files.length===0)return;const M=N.target.files[0];yield k(M)}),k=x.useCallback(N=>ks(this,null,function*(){if(b)try{s("loading");const M=yield d(N);r({src:M}),a(!1),s("loaded")}catch(M){console.error("Error uploading image:",M),s("error")}}),[d,r]),v=x.useCallback(N=>{b&&(N.preventDefault(),N.stopPropagation(),c(!0))},[d]),E=x.useCallback(N=>{b&&(N.preventDefault(),N.stopPropagation(),c(!1))},[d]),S=x.useCallback(N=>ks(this,null,function*(){var M;if(!b)return;N.preventDefault(),N.stopPropagation(),c(!1);const D=(M=N.dataTransfer)==null?void 0:M.files;if(!D||D?.length===0)return;const j=D[0];u.includes(j.type)&&(yield k(j))}),[k]);x.useEffect(()=>{var N,M,D,j;if(!h)return;s("loading");const B=(j=(D=(M=(N=n?.extensionStorage)==null?void 0:N.imageUpload)==null?void 0:M.placeholderImages)==null?void 0:D.has(h))!=null?j:!1;a(B);const F=new Image;return F.src=h,F.onload=()=>{s("loaded")},F.onerror=()=>{s("error")},()=>{F.src="",F.onload=null,F.onerror=null}},[h]);const C=E9[g];return p.jsxs(Gi,ue(H({as:"div",draggable:n.isEditable,"data-drag-handle":n.isEditable,style:{overflow:"hidden",position:"relative",lineHeight:"0px",display:"block"},className:Ce("mly-image-drop-zone",l&&"mly-drag-over")},b?{onDragOver:v,onDragLeave:E,onDrop:S}:{}),{children:[!y&&i==="idle"&&p.jsx(Zn,{status:"idle",minHeight:C,isDropZone:b}),!y&&i==="loading"&&!m&&p.jsx(Zn,{status:"loading",minHeight:C}),y&&m&&p.jsx(Zn,{status:"variable",minHeight:C}),y&&i==="loading"&&!m&&p.jsx(Zn,{status:"loading",minHeight:C}),y&&i==="error"&&!m&&p.jsx(Zn,{status:"error",minHeight:C}),b&&p.jsx("input",{type:"file",accept:"image/*",onChange:w,className:"mly:absolute mly:inset-0 mly:opacity-0",multiple:!1}),y&&i==="loaded"&&!m&&p.jsx("img",{src:h,alt:"Logo",style:H({height:C,width:C,cursor:"default",marginBottom:0},{center:{marginLeft:"auto",marginRight:"auto"},left:{marginRight:"auto"},right:{marginLeft:"auto"}}[f]||{}),draggable:n.isEditable})]}))}var v9=["sm","md","lg"],x9=["left","center","right"],w9="left",rk="sm",E9={sm:"40px",md:"48px",lg:"64px"},ik=Cp.extend({name:"logo",priority:1e3,addAttributes(){var t;return ue(H({},(t=this.parent)==null?void 0:t.call(this)),{"maily-component":{default:"logo",renderHTML:e=>({"data-maily-component":e["maily-component"]}),parseHTML:e=>e.getAttribute("data-maily-component")},size:{default:rk,parseHTML:e=>e.getAttribute("data-size"),renderHTML:e=>({"data-size":e.size})},alignment:{default:w9,parseHTML:e=>e.getAttribute("data-alignment"),renderHTML:e=>({"data-alignment":e.alignment})},showIfKey:{default:gt,parseHTML:e=>e.getAttribute("data-show-if-key")||gt,renderHTML(e){return e.showIfKey?{"data-show-if-key":e.showIfKey}:{}}},isSrcVariable:{default:!1,parseHTML:e=>e.getAttribute("data-is-src-variable")==="true",renderHTML:e=>e.isSrcVariable?{"data-is-src-variable":"true"}:{}}})},addCommands(){return{setLogoImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t}),setLogoAttributes:t=>({commands:e})=>e.updateAttributes("logo",t)}},parseHTML(){return[{tag:`img[data-maily-component="${this.name}"]`}]},addNodeView(){return qi(b9,{className:"mly:relative"})}}),k9=[{name:"Sharp",value:0},{name:"Smooth",value:8},{name:"Smoother",value:16},{name:"Rounded",value:24},{name:"Circle",value:9999}];function Id(t){const{alignment:e,onAlignmentChange:n}=t,r=x9.includes(e)?e:"left",i={left:{icon:Px,tooltip:"Align Left",onClick:()=>{n("left")}},center:{icon:Lx,tooltip:"Align Center",onClick:()=>{n("center")}},right:{icon:Bx,tooltip:"Align Right",onClick:()=>{n("right")}}},s=i[r];return p.jsxs(On,{children:[p.jsxs(Xt,{children:[p.jsx(Zt,{asChild:!0,children:p.jsx(Rn,{className:Ce("mly:flex mly:size-7 mly:items-center mly:justify-center mly:gap-1 mly:rounded-md mly:px-1.5 mly:text-sm mly:data-[state=open]:bg-soft-gray mly:hover:bg-soft-gray mly:focus-visible:relative mly:focus-visible:z-10 mly:focus-visible:outline-hidden mly:focus-visible:ring-2 mly:focus-visible:ring-gray-400 mly:focus-visible:ring-offset-2"),children:p.jsx(s.icon,{className:"mly:h-3 mly:w-3 mly:stroke-[2.5]"})})}),p.jsx(Kt,{sideOffset:8,children:"Alignment"})]}),p.jsx(xn,{className:"mly:flex mly:w-max mly:gap-0.5 mly:rounded-lg mly:p-0.5!",side:"top",sideOffset:8,align:"center",onOpenAutoFocus:o=>{o.preventDefault()},onCloseAutoFocus:o=>{o.preventDefault()},children:Object.entries(i).map(([o,a])=>p.jsx(Bn,{icon:a.icon,tooltip:a.tooltip,command:a.onClick,isActive:()=>o===r},o))})]})}var S9={title:"Button",description:"Add a call to action button to email.",searchTerms:["link","button","cta"],icon:p.jsx(b2,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setButton().run()}},C9={title:"Link Card",description:"Add a link card to email.",searchTerms:["link","button","image"],icon:p.jsx(L2,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setLinkCard().run()},render:t=>t.extensionManager.extensions.findIndex(e=>e.name==="linkCard")===-1?null:!0},_9={title:"Custom HTML",description:"Insert a custom HTML block",searchTerms:["html","code","custom"],icon:p.jsx(Fx,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setHtmlCodeBlock({language:"html"}).run()}},N9={title:"Image",description:"Full width image",searchTerms:["image"],icon:p.jsx(ip,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setImage({src:""}).run()}},T9={title:"Logo",description:"Add your brand logo",searchTerms:["image","logo"],icon:p.jsx(ip,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setLogoImage({src:""}).run()}},A9={title:"Inline Image",description:"Inline image",searchTerms:["image","inline"],icon:p.jsx(ip,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setInlineImage({src:"https://maily.to/brand/logo.png"}).command(n=>{const{tr:r,state:i,view:s,editor:o}=n,{from:a}=e,l=i.doc.nodeAt(a);if(!l)return!1;const c=ye.create(r.doc,a,a+l.nodeSize);return r.setSelection(c),!0}).run()}},M9={title:"Columns",description:"Add columns to email.",searchTerms:["layout","columns"],icon:p.jsx(Hx,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setColumns().focus(t.state.selection.head-2).run()}},O9={title:"Section",description:"Add a section to email.",searchTerms:["layout","section"],icon:p.jsx(Jx,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setSection().run()}},R9={title:"Repeat",description:"Loop over an array of items.",searchTerms:["repeat","for","loop"],icon:p.jsx(Xx,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setRepeat().run()}},I9={title:"Spacer",description:"Add space between blocks.",searchTerms:["space","gap","divider"],icon:p.jsx(x2,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setSpacer({height:"sm"}).run()}},D9={title:"Divider",description:"Add a horizontal divider.",searchTerms:["divider","line"],icon:p.jsx(g2,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setHorizontalRule().run()}},L9={title:"Bullet List",description:"Create a simple bullet list.",searchTerms:["unordered","point"],icon:p.jsx(op,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).toggleBulletList().run()}},P9={title:"Numbered List",description:"Create a list with numbering.",searchTerms:["ordered"],icon:p.jsx(sp,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).toggleOrderedList().run()}},B9={title:"Text",description:"Just start typing with plain text.",searchTerms:["p","paragraph"],icon:p.jsx(F2,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).toggleNode("paragraph","paragraph").run()}},j9={title:"Heading 1",description:"Big heading.",searchTerms:["h1","title","big","large"],icon:p.jsx(rp,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setNode("heading",{level:1}).run()}},$9={title:"Heading 2",description:"Medium heading.",searchTerms:["h2","subtitle","medium"],icon:p.jsx(Vx,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setNode("heading",{level:2}).run()}},F9={title:"Heading 3",description:"Small heading.",searchTerms:["h3","subtitle","small"],icon:p.jsx(Kx,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setNode("heading",{level:3}).run()}},H9={title:"Hard Break",description:"Add a break between lines.",searchTerms:["break","line"],icon:p.jsx(FI,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setHardBreak().run()}},z9={title:"Blockquote",description:"Add blockquote.",searchTerms:["quote","blockquote"],icon:p.jsx(j2,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).toggleBlockquote().run()}},U9={title:"Footer",description:"Add a footer text to email.",searchTerms:["footer","text"],icon:p.jsx(np,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setFooter().run()}},V9={title:"Clear Line",description:"Clear the current line.",searchTerms:["clear","line"],icon:p.jsx(Ux,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().selectParentNode().deleteSelection().run()}};function K9(t){return p.jsxs("svg",ue(H({width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),{children:[p.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.97634 1.4502H9.02405C9.70389 1.4502 10.2476 1.45019 10.687 1.48609C11.1379 1.52293 11.527 1.6003 11.8849 1.78263C12.4588 2.07504 12.9254 2.54164 13.2178 3.11553C13.4001 3.47338 13.4775 3.86253 13.5143 4.31342C13.5502 4.75277 13.5502 5.29652 13.5502 5.97637V8.02403C13.5502 8.70388 13.5502 9.24763 13.5143 9.68698C13.4775 10.1379 13.4001 10.527 13.2178 10.8849C12.9254 11.4588 12.4588 11.9254 11.8849 12.2178C11.527 12.4001 11.1379 12.4775 10.687 12.5143C10.2476 12.5502 9.70387 12.5502 9.02402 12.5502H4.97636C4.29651 12.5502 3.75276 12.5502 3.31341 12.5143C2.86252 12.4775 2.47337 12.4001 2.11552 12.2178C1.54163 11.9254 1.07504 11.4588 0.782626 10.8849C0.600293 10.527 0.522922 10.1379 0.486083 9.68698C0.450187 9.24764 0.45019 8.70389 0.450195 8.02405V5.97635C0.45019 5.29651 0.450187 4.75276 0.486083 4.31342C0.522922 3.86253 0.600293 3.47338 0.782626 3.11553C1.07504 2.54164 1.54163 2.07504 2.11552 1.78263C2.47337 1.6003 2.86252 1.52293 3.31341 1.48609C3.75276 1.45019 4.2965 1.4502 4.97634 1.4502ZM3.40298 2.58243C3.02012 2.61372 2.79184 2.67259 2.61491 2.76274C2.248 2.94969 1.94968 3.248 1.76273 3.61492C1.67258 3.79185 1.61371 4.02013 1.58243 4.40299C1.55062 4.79228 1.55019 5.29106 1.55019 6.0002V8.0002C1.55019 8.70934 1.55062 9.20812 1.58243 9.59741C1.61371 9.98028 1.67258 10.2086 1.76273 10.3855C1.94968 10.7524 2.248 11.0507 2.61491 11.2377C2.79184 11.3278 3.02012 11.3867 3.40298 11.418C3.79227 11.4498 4.29105 11.4502 5.00019 11.4502H9.00019C9.70933 11.4502 10.2081 11.4498 10.5974 11.418C10.9803 11.3867 11.2086 11.3278 11.3855 11.2377C11.7524 11.0507 12.0507 10.7524 12.2377 10.3855C12.3278 10.2086 12.3867 9.98028 12.418 9.59741C12.4498 9.20812 12.4502 8.70934 12.4502 8.0002V6.0002C12.4502 5.29106 12.4498 4.79228 12.418 4.40299C12.3867 4.02013 12.3278 3.79185 12.2377 3.61492C12.0507 3.248 11.7524 2.94969 11.3855 2.76274C11.2086 2.67259 10.9803 2.61372 10.5974 2.58243C10.2081 2.55063 9.70933 2.5502 9.00019 2.5502H5.00019C4.29105 2.5502 3.79227 2.55063 3.40298 2.58243Z",fill:"currentColor"}),p.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.1999 0.450195C4.50366 0.450195 4.7499 0.696438 4.7499 1.00019V2.75019C4.7499 3.05395 4.50366 3.30019 4.1999 3.30019C3.89614 3.30019 3.6499 3.05395 3.6499 2.75019V1.00019C3.6499 0.696438 3.89614 0.450195 4.1999 0.450195Z",fill:"currentColor"}),p.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.8 0.450195C10.1037 0.450195 10.35 0.696438 10.35 1.00019V2.75019C10.35 3.05395 10.1037 3.30019 9.8 3.30019C9.49625 3.30019 9.25 3.05395 9.25 2.75019V1.00019C9.25 0.696438 9.49625 0.450195 9.8 0.450195Z",fill:"currentColor"}),p.jsx("mask",{id:"path-4-inside-1_1046_19527",fill:"white",children:p.jsx("rect",{x:"3",y:"4",width:"8",height:"3",rx:"0.5"})}),p.jsx("rect",{x:"3",y:"4",width:"8",height:"3",rx:"0.5",stroke:"black",strokeWidth:"2",mask:"url(#path-4-inside-1_1046_19527)"}),p.jsx("rect",{x:"6.25",y:"8.25",width:"4.5",height:"0.5",rx:"0.25",stroke:"black",strokeWidth:"0.5"}),p.jsx("rect",{x:"3",y:"8",width:"2",height:"1",rx:"0.5",fill:"currentColor"})]}))}function W9(t){return p.jsxs("svg",ue(H({width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),{children:[p.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.97634 1.4502H9.02405C9.70389 1.4502 10.2476 1.45019 10.687 1.48609C11.1379 1.52293 11.527 1.6003 11.8849 1.78263C12.4588 2.07504 12.9254 2.54164 13.2178 3.11553C13.4001 3.47338 13.4775 3.86253 13.5143 4.31342C13.5502 4.75277 13.5502 5.29652 13.5502 5.97637V8.02403C13.5502 8.70388 13.5502 9.24763 13.5143 9.68698C13.4775 10.1379 13.4001 10.527 13.2178 10.8849C12.9254 11.4588 12.4588 11.9254 11.8849 12.2178C11.527 12.4001 11.1379 12.4775 10.687 12.5143C10.2476 12.5502 9.70387 12.5502 9.02402 12.5502H4.97636C4.29651 12.5502 3.75276 12.5502 3.31341 12.5143C2.86252 12.4775 2.47337 12.4001 2.11552 12.2178C1.54163 11.9254 1.07504 11.4588 0.782626 10.8849C0.600293 10.527 0.522922 10.1379 0.486083 9.68698C0.450187 9.24764 0.45019 8.70389 0.450195 8.02405V5.97635C0.45019 5.29651 0.450187 4.75276 0.486083 4.31342C0.522922 3.86253 0.600293 3.47338 0.782626 3.11553C1.07504 2.54164 1.54163 2.07504 2.11552 1.78263C2.47337 1.6003 2.86252 1.52293 3.31341 1.48609C3.75276 1.45019 4.2965 1.4502 4.97634 1.4502ZM3.40298 2.58243C3.02012 2.61372 2.79184 2.67259 2.61491 2.76274C2.248 2.94969 1.94968 3.248 1.76273 3.61492C1.67258 3.79185 1.61371 4.02013 1.58243 4.40299C1.55062 4.79228 1.55019 5.29106 1.55019 6.0002V8.0002C1.55019 8.70934 1.55062 9.20812 1.58243 9.59741C1.61371 9.98028 1.67258 10.2086 1.76273 10.3855C1.94968 10.7524 2.248 11.0507 2.61491 11.2377C2.79184 11.3278 3.02012 11.3867 3.40298 11.418C3.79227 11.4498 4.29105 11.4502 5.00019 11.4502H9.00019C9.70933 11.4502 10.2081 11.4498 10.5974 11.418C10.9803 11.3867 11.2086 11.3278 11.3855 11.2377C11.7524 11.0507 12.0507 10.7524 12.2377 10.3855C12.3278 10.2086 12.3867 9.98028 12.418 9.59741C12.4498 9.20812 12.4502 8.70934 12.4502 8.0002V6.0002C12.4502 5.29106 12.4498 4.79228 12.418 4.40299C12.3867 4.02013 12.3278 3.79185 12.2377 3.61492C12.0507 3.248 11.7524 2.94969 11.3855 2.76274C11.2086 2.67259 10.9803 2.61372 10.5974 2.58243C10.2081 2.55063 9.70933 2.5502 9.00019 2.5502H5.00019C4.29105 2.5502 3.79227 2.55063 3.40298 2.58243Z",fill:"currentColor"}),p.jsx("rect",{x:"6.25",y:"6.75",width:"4.5",height:"0.5",rx:"0.25",stroke:"black",strokeWidth:"0.5"}),p.jsx("rect",{x:"3",y:"6.5",width:"2",height:"1",rx:"0.5",fill:"currentColor"}),p.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.1999 0.450195C4.50366 0.450195 4.7499 0.696438 4.7499 1.00019V2.75019C4.7499 3.05395 4.50366 3.30019 4.1999 3.30019C3.89614 3.30019 3.6499 3.05395 3.6499 2.75019V1.00019C3.6499 0.696438 3.89614 0.450195 4.1999 0.450195Z",fill:"currentColor"}),p.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.8 0.450195C10.1037 0.450195 10.35 0.696438 10.35 1.00019V2.75019C10.35 3.05395 10.1037 3.30019 9.8 3.30019C9.49625 3.30019 9.25 3.05395 9.25 2.75019V1.00019C9.25 0.696438 9.49625 0.450195 9.8 0.450195Z",fill:"currentColor"})]}))}function G9(t){return p.jsxs("svg",ue(H({width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),{children:[p.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.97634 1.4502H9.02405C9.70389 1.4502 10.2476 1.45019 10.687 1.48609C11.1379 1.52293 11.527 1.6003 11.8849 1.78263C12.4588 2.07504 12.9254 2.54164 13.2178 3.11553C13.4001 3.47338 13.4775 3.86253 13.5143 4.31342C13.5502 4.75277 13.5502 5.29652 13.5502 5.97637V8.02403C13.5502 8.70388 13.5502 9.24763 13.5143 9.68698C13.4775 10.1379 13.4001 10.527 13.2178 10.8849C12.9254 11.4588 12.4588 11.9254 11.8849 12.2178C11.527 12.4001 11.1379 12.4775 10.687 12.5143C10.2476 12.5502 9.70387 12.5502 9.02402 12.5502H4.97636C4.29651 12.5502 3.75276 12.5502 3.31341 12.5143C2.86252 12.4775 2.47337 12.4001 2.11552 12.2178C1.54163 11.9254 1.07504 11.4588 0.782626 10.8849C0.600293 10.527 0.522922 10.1379 0.486083 9.68698C0.450187 9.24764 0.45019 8.70389 0.450195 8.02405V5.97635C0.45019 5.29651 0.450187 4.75276 0.486083 4.31342C0.522922 3.86253 0.600293 3.47338 0.782626 3.11553C1.07504 2.54164 1.54163 2.07504 2.11552 1.78263C2.47337 1.6003 2.86252 1.52293 3.31341 1.48609C3.75276 1.45019 4.2965 1.4502 4.97634 1.4502ZM3.40298 2.58243C3.02012 2.61372 2.79184 2.67259 2.61491 2.76274C2.248 2.94969 1.94968 3.248 1.76273 3.61492C1.67258 3.79185 1.61371 4.02013 1.58243 4.40299C1.55062 4.79228 1.55019 5.29106 1.55019 6.0002V8.0002C1.55019 8.70934 1.55062 9.20812 1.58243 9.59741C1.61371 9.98028 1.67258 10.2086 1.76273 10.3855C1.94968 10.7524 2.248 11.0507 2.61491 11.2377C2.79184 11.3278 3.02012 11.3867 3.40298 11.418C3.79227 11.4498 4.29105 11.4502 5.00019 11.4502H9.00019C9.70933 11.4502 10.2081 11.4498 10.5974 11.418C10.9803 11.3867 11.2086 11.3278 11.3855 11.2377C11.7524 11.0507 12.0507 10.7524 12.2377 10.3855C12.3278 10.2086 12.3867 9.98028 12.418 9.59741C12.4498 9.20812 12.4502 8.70934 12.4502 8.0002V6.0002C12.4502 5.29106 12.4498 4.79228 12.418 4.40299C12.3867 4.02013 12.3278 3.79185 12.2377 3.61492C12.0507 3.248 11.7524 2.94969 11.3855 2.76274C11.2086 2.67259 10.9803 2.61372 10.5974 2.58243C10.2081 2.55063 9.70933 2.5502 9.00019 2.5502H5.00019C4.29105 2.5502 3.79227 2.55063 3.40298 2.58243Z",fill:"currentColor"}),p.jsx("rect",{x:"4.25",y:"8.25",width:"5.5",height:"0.5",rx:"0.25",stroke:"black",strokeWidth:"0.5"}),p.jsx("rect",{x:"6",y:"6",width:"2",height:"1",rx:"0.5",fill:"currentColor"}),p.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.1999 0.450195C4.50366 0.450195 4.7499 0.696438 4.7499 1.00019V2.75019C4.7499 3.05395 4.50366 3.30019 4.1999 3.30019C3.89614 3.30019 3.6499 3.05395 3.6499 2.75019V1.00019C3.6499 0.696438 3.89614 0.450195 4.1999 0.450195Z",fill:"currentColor"}),p.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.8 0.450195C10.1037 0.450195 10.35 0.696438 10.35 1.00019V2.75019C10.35 3.05395 10.1037 3.30019 9.8 3.30019C9.49625 3.30019 9.25 3.05395 9.25 2.75019V1.00019C9.25 0.696438 9.49625 0.450195 9.8 0.450195Z",fill:"currentColor"})]}))}var q9={title:"Logo with Text (Horizontal)",description:"Logo and a text horizontally",searchTerms:["logo","text"],icon:p.jsx(W9,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().deleteRange(e).insertContent({type:"columns",attrs:{showIfKey:null,gap:8},content:[{type:"column",attrs:{columnId:"36de3eda-0677-47c3-a8b7-e071dec9ce30",width:"auto",verticalAlign:"middle"},content:[{type:"image",attrs:{src:"https://maily.to/brand/logo.png",alt:null,title:null,width:"32",height:"32",alignment:"left",externalLink:null,isExternalLinkVariable:!1,isSrcVariable:!1,showIfKey:null}}]},{type:"column",attrs:{columnId:"6feb593e-374a-4479-a1c7-872c60c2f4e0",width:"auto",verticalAlign:"bottom"},content:[{type:"heading",attrs:{textAlign:"right",level:3,showIfKey:null},content:[{type:"text",marks:[{type:"bold"}],text:"Weekly Newsletter"}]}]}]}).run()}},Y9={title:"Logo with Text (Vertical)",description:"Logo and a text vertically",searchTerms:["logo","text"],icon:p.jsx(G9,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().deleteRange(e).insertContent([{type:"image",attrs:{src:"https://maily.to/brand/logo.png",alt:null,title:null,width:"48",height:"48",alignment:"center",externalLink:null,isExternalLinkVariable:!1,isSrcVariable:!1,showIfKey:null}},{type:"spacer",attrs:{height:8,showIfKey:null}},{type:"heading",attrs:{textAlign:"center",level:2,showIfKey:null},content:[{type:"text",text:"Maily"}]}]).run()}},J9={title:"Logo with Cover Image",description:"Logo and a cover image",searchTerms:["logo","cover","image"],icon:p.jsx(K9,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{const n=new Date().toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"});t.chain().deleteRange(e).insertContent([{type:"image",attrs:{src:"https://maily.to/og-image.png",alt:null,title:null,width:600,height:314,alignment:"center",externalLink:null,isExternalLinkVariable:!1,isSrcVariable:!1,showIfKey:null}},{type:"columns",attrs:{showIfKey:null,gap:8},content:[{type:"column",attrs:{columnId:"36de3eda-0677-47c3-a8b7-e071dec9ce30",width:"auto",verticalAlign:"middle"},content:[{type:"image",attrs:{src:"https://maily.to/brand/logo.png",alt:null,title:null,width:"48",height:"48",alignment:"left",externalLink:null,isExternalLinkVariable:!1,isSrcVariable:!1,showIfKey:null}}]},{type:"column",attrs:{columnId:"6feb593e-374a-4479-a1c7-872c60c2f4e0",width:"auto",verticalAlign:"middle"},content:[{type:"paragraph",attrs:{textAlign:"right",showIfKey:null},content:[{type:"text",marks:[{type:"bold"}],text:"Weekly Newsletter"},{type:"hardBreak"},{type:"text",marks:[{type:"textStyle",attrs:{color:"#929292"}}],text:n}]}]}]}]).run()}},X9={title:"Footer Copyright",description:"Copyright text for the footer.",searchTerms:["footer","copyright"],icon:p.jsx(BI,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{const n=new Date().getFullYear();t.chain().focus().deleteRange(e).insertContent({type:"paragraph",attrs:{textAlign:"center",showIfKey:null},content:[{type:"text",marks:[{type:"textStyle",attrs:{color:"#AAAAAA"}}],text:`Maily © ${n}. All rights reserved.`}]}).run()}},Z9={title:"Footer Community Feedback CTA",description:"Community feedback CTA for the footer.",searchTerms:["footer","community","feedback","cta"],icon:p.jsx(Jx,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).insertContent([{type:"image",attrs:{src:"https://maily.to/brand/logo.png",alt:null,title:null,width:"42",height:"42",alignment:"left",externalLink:null,isExternalLinkVariable:!1,isSrcVariable:!1,showIfKey:null}},{type:"spacer",attrs:{height:16,showIfKey:null}},{type:"footer",attrs:{textAlign:null,"maily-component":"footer"},content:[{type:"text",marks:[{type:"textStyle",attrs:{color:""}}],text:"Enjoyed this month’s update?"},{type:"hardBreak"},{type:"text",marks:[{type:"textStyle",attrs:{color:""}}],text:"And, as always, we'd love your feedback – simply reply to the email or reach out via the Discord community!"}]}]).run()}},Q9={title:"Footer Company Signature",description:"Company signature for the footer.",searchTerms:["footer","company","signature"],icon:p.jsx(s2,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).insertContent([{type:"horizontalRule"},{type:"image",attrs:{src:"https://maily.to/brand/logo.png",alt:null,title:null,width:"48",height:"48",alignment:"center",externalLink:null,isExternalLinkVariable:!1,isSrcVariable:!1,showIfKey:null}},{type:"spacer",attrs:{height:16,showIfKey:null}},{type:"heading",attrs:{textAlign:"center",level:3,showIfKey:null},content:[{type:"text",text:"Maily"}]},{type:"spacer",attrs:{height:4,showIfKey:null}},{type:"footer",attrs:{textAlign:"center","maily-component":"footer"},content:[{type:"text",marks:[{type:"textStyle",attrs:{color:""}}],text:"1234 Example Street, Example, DE 19801, United States"},{type:"hardBreak"},{type:"text",marks:[{type:"link",attrs:{href:"https://maily.to",target:"_blank",rel:"noopener noreferrer nofollow",class:"mly:no-underline",isUrlVariable:!1}},{type:"textStyle",attrs:{color:"#64748b"}},{type:"underline"}],text:"VISIT COMPANY"},{type:"text",marks:[{type:"textStyle",attrs:{color:"#64748b"}}],text:" | "},{type:"text",marks:[{type:"link",attrs:{href:"https://maily.to",target:"_blank",rel:"noopener noreferrer nofollow",class:"mly:no-underline",isUrlVariable:!1}},{type:"textStyle",attrs:{color:"#64748b"}},{type:"underline"}],text:"VISIT OUR BLOG"},{type:"text",marks:[{type:"textStyle",attrs:{color:"#64748b"}}],text:" | "},{type:"text",marks:[{type:"link",attrs:{href:"https://maily.to",target:"_blank",rel:"noopener noreferrer nofollow",class:"mly:no-underline",isUrlVariable:!1}},{type:"textStyle",attrs:{color:"#64748b"}},{type:"underline"}],text:"UNSUBSCRIBE"}]},{type:"paragraph",attrs:{textAlign:"center",showIfKey:null},content:[{type:"inlineImage",attrs:{height:20,width:20,src:"https://cdn.usemaily.com/images/icons/linkedin.png",isSrcVariable:!1,alt:null,title:null,externalLink:"https://www.linkedin.com/in/arikchakma/",isExternalLinkVariable:!1}},{type:"text",text:" "},{type:"inlineImage",attrs:{height:20,width:20,src:"https://cdn.usemaily.com/images/icons/youtube.png",isSrcVariable:!1,alt:null,title:null,externalLink:"https://www.youtube.com/arikchakma",isExternalLinkVariable:!1}},{type:"text",text:" "},{type:"inlineImage",attrs:{height:20,width:20,src:"https://cdn.usemaily.com/images/icons/twitter.png",isSrcVariable:!1,alt:null,title:null,externalLink:"https://x.com/imarikchakma",isExternalLinkVariable:!1}}]}]).run()}},Wp=[{title:"Blocks",commands:[B9,j9,$9,F9,L9,P9,N9,T9,A9,M9,O9,R9,D9,I9,S9,C9,H9,z9,U9,V9]},{title:"Components",commands:[{id:"headers",title:"Headers",description:"Add pre-designed headers block",searchTerms:["header","headers"],icon:p.jsx(rp,{className:"mly:h-4 mly:w-4"}),preview:"https://cdn.usemaily.com/previews/header-preview-xyz.png",commands:[Y9,q9,J9]},{id:"footers",title:"Footers",description:"Add pre-designed footers block",searchTerms:["footers"],icon:p.jsx(np,{className:"mly:h-4 mly:w-4"}),commands:[X9,Z9,Q9]},_9]}],Dd="https://maily.to/",sk=x.createContext({placeholderUrl:Dd,blocks:Wp});function eF(t){const e=t,{children:n}=e,r=fr(e,["children"]);return p.jsx(sk.Provider,{value:r,children:n})}function ok(){const t=x.useContext(sk);if(!t)throw new Error("Missing MailyContext.Provider in the component tree");return t}var tF=x.forwardRef((t,e)=>{const{items:n,onSelectItem:r}=t,[i,s]=x.useState(0),o=x.useRef(null),a=x.useRef([]),l=c=>{const d=o.current,u=a.current[c];if(!d||!u)return;const f=d.getBoundingClientRect(),h=u.getBoundingClientRect(),m=4;h.bottom>f.bottom?d.scrollTop+=h.bottom-f.bottom+m:h.top<f.top&&(d.scrollTop+=h.top-f.top-m)};return x.useEffect(()=>{s(0),o.current&&(o.current.scrollTop=0),a.current=n.map(()=>null)},[n]),x.useEffect(()=>{l(i)},[i]),x.useImperativeHandle(e,()=>({moveUp:()=>{s((i+n.length-1)%n.length)},moveDown:()=>{s((i+1)%n.length)},select:()=>{const c=n[i];c&&r(c)}})),p.jsxs("div",{className:"mly:z-50 mly:w-64 mly:rounded-lg mly:border mly:border-gray-200 mly:bg-white mly:shadow-md mly:transition-all",children:[p.jsxs("div",{className:"mly:flex mly:items-center mly:justify-between mly:gap-2 mly:border-b mly:border-gray-200 mly:bg-soft-gray/40 mly:px-1 mly:py-1.5 mly:text-gray-500",children:[p.jsx("span",{className:"mly:text-xs mly:uppercase",children:"Variables"}),p.jsx(gl,{children:p.jsx(vs,{className:"mly:size-3 mly:stroke-[2.5]"})})]}),p.jsx("div",{ref:o,className:"mly:max-h-52 mly:overflow-y-auto mly:scrollbar-thin mly:scrollbar-track-transparent mly:scrollbar-thumb-gray-200",children:p.jsx("div",{className:"mly:flex mly:w-fit mly:min-w-full mly:flex-col mly:gap-0.5 mly:p-1",children:n?.length?n?.map((c,d)=>p.jsxs("button",{ref:u=>a.current[d]=u,onClick:()=>r(c),className:Ce("mly:flex mly:w-fit mly:min-w-full mly:items-center mly:gap-2 mly:rounded-md mly:px-2 mly:py-1 mly:text-left mly:font-mono mly:text-sm mly:text-gray-900 mly:hover:bg-soft-gray",d===i?"mly:bg-soft-gray":"mly:bg-white"),children:[p.jsx(vs,{className:"mly:size-3 mly:stroke-[2.5] mly:text-rose-600"}),c?.label||c.name]},d)):p.jsx("div",{className:"mly:flex mly:h-7 mly:w-full mly:items-center mly:gap-2 mly:rounded-md mly:px-2 mly:py-1 mly:text-left mly:font-mono mly:text-[13px] mly:text-gray-900 mly:hover:bg-soft-gray",children:"No result"})})}),p.jsxs("div",{className:"mly:flex mly:items-center mly:justify-between mly:gap-2 mly:border-t mly:border-gray-200 mly:px-1 mly:py-1.5 mly:text-gray-500",children:[p.jsxs("div",{className:"mly:flex mly:items-center mly:gap-1",children:[p.jsx(gl,{children:p.jsx(gI,{className:"mly:size-3 mly:stroke-[2.5]"})}),p.jsx(gl,{children:p.jsx(bI,{className:"mly:size-3 mly:stroke-[2.5]"})}),p.jsx("span",{className:"mly:text-xs mly:text-gray-500",children:"Navigate"})]}),p.jsx(gl,{children:p.jsx(zx,{className:"mly:size-3 mly:stroke-[2.5]"})})]})]})});function gl(t){const{className:e,children:n}=t;return p.jsx("div",{className:Ce("mly:flex mly:size-5 mly:items-center mly:justify-center mly:rounded-md mly:border mly:border-gray-200",e),children:n})}function nF(t){const{node:e,updateAttributes:n,editor:r}=t,{id:i,fallback:s,required:o,hideDefaultValue:a=!1,label:l}=e.attrs,c=x.useMemo(()=>{var d,u;return(u=(d=V1(r,"variable"))==null?void 0:d.renderVariable)!=null?u:ak},[r]);return p.jsx(Gi,{className:"react-component mly:inline-block mly:leading-none",draggable:"false",children:p.jsxs(On,{onOpenChange:d=>{r.storage.variable.popover=d},children:[p.jsx(Rn,{children:c({variable:{name:i,required:o,valid:!0,label:l},fallback:s,editor:r,from:"content-variable"})}),p.jsx(xn,{align:"start",side:"bottom",className:"mly:w-max mly:rounded-lg mly:p-0.5!",sideOffset:8,onOpenAutoFocus:d=>d.preventDefault(),onCloseAutoFocus:d=>d.preventDefault(),children:p.jsx(vn,{children:p.jsxs("div",{className:"mly:flex mly:items-stretch mly:text-midnight-gray",children:[p.jsxs("label",{className:"mly:relative",children:[p.jsx("span",{className:"mly:inline-block mly:px-2 mly:text-xs mly:text-midnight-gray",children:"Variable"}),p.jsx("input",ue(H({},Vs),{value:i??"",onChange:d=>{n({id:d.target.value})},placeholder:"ie. name...",className:"mly:h-7 mly:w-36 mly:rounded-md mly:bg-soft-gray mly:px-2 mly:text-sm mly:text-midnight-gray mly:focus:bg-soft-gray mly:focus:outline-hidden mly:disabled:cursor-not-allowed"}))]}),!a&&p.jsxs(p.Fragment,{children:[p.jsx(rt,{className:"mly:mx-1.5"}),p.jsxs("label",{className:"mly:relative",children:[p.jsx("span",{className:"mly:inline-block mly:px-2 mly:pl-1 mly:text-xs mly:text-midnight-gray",children:"Default"}),p.jsx("input",ue(H({},Vs),{value:s??"",onChange:d=>{n({fallback:d.target.value})},placeholder:"ie. John Doe...",className:"mly:h-7 mly:w-32 mly:rounded-md mly:bg-soft-gray mly:px-2 mly:pr-6 mly:text-sm mly:text-midnight-gray mly:focus:bg-soft-gray mly:focus:outline-none"})),p.jsx("div",{className:"mly:absolute mly:inset-y-0 mly:right-1 mly:flex mly:items-center",children:p.jsx(E2,{className:"mly:h-3 mly:w-3 mly:stroke-[2.5] mly:text-midnight-gray"})})]})]})]})})})]})})}var rF=t=>{const{variable:e,fallback:n,from:r}=t,{name:i,required:s,valid:o,label:a}=e,l=a||i;return r==="button-variable"?p.jsxs("div",{className:"mly:inline-grid mly:max-w-xs mly:grid-cols-[12px_1fr] mly:items-center mly:gap-1.5 mly:rounded-md mly:border mly:border-(--button-var-border-color) mly:px-2 mly:py-px mly:font-mono mly:text-xs",children:[p.jsx(vs,{className:"mly:h-3 mly:w-3 mly:shrink-0 mly:stroke-[2.5]"}),p.jsx("span",{className:"mly:min-w-0 mly:truncate mly:text-left",children:l})]}):r==="bubble-variable"?p.jsxs("div",{className:Ce("mly:inline-grid mly:h-7 mly:min-w-28 mly:max-w-xs mly:grid-cols-[12px_1fr] mly:items-center mly:gap-1.5 mly:rounded-md mly:border mly:border-gray-200 mly:px-2 mly:font-mono mly:text-sm mly:hover:bg-soft-gray",!o&&"mly:border-rose-400 mly:bg-rose-50 mly:text-rose-600 mly:hover:bg-rose-100"),children:[p.jsx(vs,{className:"mly:h-3 mly:w-3 mly:shrink-0 mly:stroke-[2.5] mly:text-rose-600"}),p.jsx("span",{className:"mly:min-w-0 mly:truncate mly:text-left",children:l})]}):p.jsxs("span",{tabIndex:-1,className:"mly:inline-flex mly:items-center mly:gap-(--variable-icon-gap) mly:rounded-full mly:border mly:border-gray-200 mly:px-1.5 mly:py-0.5 mly:leading-none",children:[p.jsx(vs,{className:"mly:size-[var(--variable-icon-size)] mly:shrink-0 mly:stroke-[2.5] mly:text-rose-600"}),l,s&&!n&&p.jsx(K2,{className:"mly:size-[var(--variable-icon-size)] mly:shrink-0 mly:stroke-[2.5]"})]})},Gp="@",iF=[],ak=rF,sF=tF,oF=new Ge("variable"),lk=dt.create({name:"variable",group:"inline",inline:!0,selectable:!0,atom:!0,addStorage(){return{popover:!1}},addOptions(){return{variables:iF,variableSuggestionsPopover:sF,renderVariable:ak,disableInput:!1,renderLabel(t){var e;const{node:n}=t;return`${(e=n.attrs.label)!=null?e:n.attrs.id}`},suggestion:{char:"@",pluginKey:oF,command:({editor:t,range:e,props:n})=>{var r,i;const s=t.view.state.selection.$to.nodeAfter;(r=s?.text)!=null&&r.startsWith(" ")&&(e.to+=1),t.chain().focus().insertContentAt(e,[{type:this.name,attrs:n},{type:"text",text:" "}]).run(),(i=window.getSelection())==null||i.collapseToEnd()},allow:({state:t,range:e})=>{const n=t.doc.resolve(e.from),r=t.schema.nodes[this.name];return!!n.parent.type.contentMatch.matchType(r)}}}},addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},fallback:{default:null,parseHTML:t=>t.getAttribute("data-fallback"),renderHTML:t=>t.fallback?{"data-fallback":t.fallback}:{}},required:{default:!0,parseHTML:t=>t.hasAttribute("data-required"),renderHTML:t=>{var e;return{"data-required":(e=t?.required)!=null?e:!0}}},hideDefaultValue:{default:!1}}},parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){return["div",He({"data-type":this.name},e),this.options.renderLabel({options:this.options,node:t})]},renderText({node:t}){return this.options.renderLabel({options:this.options,node:t})},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:i,anchor:s}=r;return i?(e.doc.nodesBetween(s-1,s,(o,a)=>{if(o.type.name===this.name)return n=!0,t.insertText(this.options.suggestion.char||"",a,a+o.nodeSize),!1}),n):!1})}},addProseMirrorPlugins(){return[ME(H({editor:this.editor},this.options.suggestion))]},addNodeView(){return qi(nF,{className:"mly:relative mly:inline-block",as:"div"})}});function Ks(t){var e,n;const{defaultValue:r="",onValueChange:i,tooltip:s,icon:o=If,editor:a,isVariable:l}=t,[c,d]=x.useState(!1),[u,f]=x.useState(!l),h=x.useRef(null),{placeholderUrl:m=Dd}=ok(),g=Ji(a),y=g?.renderVariable,b=g?.variables,w=(n=(e=g?.suggestion)==null?void 0:e.char)!=null?n:Gp,k=x.useMemo(()=>{const E=r.replace(new RegExp(w,"g"),"");return Ta(b,{query:E||"",from:"bubble-variable",editor:a}).map(S=>S.name)},[b,w,r,a]),v=p.jsx(Rn,{asChild:!0,children:p.jsx(on,{variant:"ghost",size:"sm",type:"button",className:"mly:h-7! mly:w-7!","data-state":!!r,children:p.jsx(o,{className:"mly:h-3 mly:w-3 mly:shrink-0 mly:stroke-[2.5] mly:text-midnight-gray"})})});return p.jsxs(On,{open:c,onOpenChange:E=>{d(E),E&&setTimeout(()=>{var S;(S=h.current)==null||S.focus()},0)},children:[s?p.jsxs(Xt,{children:[p.jsx(Zt,{asChild:!0,children:v}),p.jsx(Kt,{sideOffset:8,children:s})]}):v,p.jsx(xn,{align:"end",side:"top",className:"mly:w-max mly:rounded-none mly:border-none mly:bg-transparent mly:p-0! mly:shadow-none",sideOffset:8,onCloseAutoFocus:E=>E.preventDefault(),children:p.jsx("form",{onSubmit:E=>{E.preventDefault();const S=h.current;S&&(i?.(S.value),d(!1))},children:p.jsxs("div",{className:"mly:isolate mly:flex mly:rounded-lg",children:[!u&&p.jsx("div",{className:"mly:flex mly:h-8 mly:items-center mly:rounded-lg mly:border mly:border-gray-300 mly:bg-white mly:px-0.5",children:p.jsx("button",{onClick:()=>{f(!0),setTimeout(()=>{var E;(E=h.current)==null||E.focus()},0)},children:y({variable:{name:r,valid:!0},fallback:"",from:"bubble-variable",editor:a})})}),u&&p.jsxs("div",{className:"mly:relative",children:[p.jsx("div",{className:"mly:absolute mly:inset-y-0 mly:left-1.5 mly:z-10 mly:flex mly:items-center",children:p.jsx(If,{className:"mly:h-3 mly:w-3 mly:stroke-[2.5] mly:text-midnight-gray"})}),p.jsx(Aa,{editor:a,value:r,onValueChange:E=>{i?.(E)},autoCompleteOptions:k,ref:h,placeholder:m,className:"-mly:ms-px mly:block mly:h-8 mly:w-56 mly:rounded-lg mly:border mly:border-gray-300 mly:px-2 mly:py-1.5 mly:pl-6 mly:pr-6 mly:text-sm mly:shadow-sm mly:outline-hidden mly:placeholder:text-gray-400",triggerChar:w,onSelectOption:E=>{var S;const C=(S=k.includes(E))!=null?S:!1;C&&f(!1),i?.(E,C),d(!1)}})]})]})})})]})}function sh(t){const{value:e,onValueChange:n,dimension:r}=t;return p.jsxs("label",{className:"mly:relative mly:flex mly:items-center",children:[p.jsx("span",{className:"mly:absolute mly:inset-y-0 mly:left-2 mly:flex mly:items-center mly:text-xs mly:leading-none mly:text-gray-400",children:r==="width"?"W":"H"}),p.jsx("input",ue(H({},Vs),{className:"hide-number-controls mly:h-auto mly:max-w-20 mly:appearance-none mly:border-0 mly:border-none mly:p-1 mly:px-[26px] mly:text-sm mly:uppercase mly:tabular-nums mly:outline-hidden mly:focus-visible:outline-hidden",type:"number",value:e,onChange:i=>n(i.target.value)})),p.jsx("span",{className:"mly:absolute mly:inset-y-0 mly:right-1 mly:flex mly:items-center mly:text-xs mly:leading-none mly:text-gray-400",children:"PX"})]})}var aF=t=>cr({editor:t,selector:({editor:n})=>{var r,i,s,o,a,l,c,d,u,f,h,m,g,y,b,w;return{width:String(n.getAttributes("image").width),height:String(n.getAttributes("image").height),isImageActive:n.isActive("image"),isLogoActive:n.isActive("logo"),alignment:((r=n.getAttributes("image"))==null?void 0:r.alignment)||((i=n.getAttributes("logo"))==null?void 0:i.alignment),borderRadius:(s=n.getAttributes("image"))==null?void 0:s.borderRadius,logoSize:((o=n.getAttributes("logo"))==null?void 0:o.size)||rk,imageSrc:((a=n.getAttributes("image"))==null?void 0:a.src)||((l=n.getAttributes("logo"))==null?void 0:l.src)||"",isSrcVariable:(f=(u=(c=n.getAttributes("image"))==null?void 0:c.isSrcVariable)!=null?u:(d=n.getAttributes("logo"))==null?void 0:d.isSrcVariable)!=null?f:!1,imageExternalLink:((h=n.getAttributes("image"))==null?void 0:h.externalLink)||"",isExternalLinkVariable:(m=n.getAttributes("image"))==null?void 0:m.isExternalLinkVariable,lockAspectRatio:(g=n.getAttributes("image"))==null?void 0:g.lockAspectRatio,aspectRatio:(y=n.getAttributes("image"))==null?void 0:y.aspectRatio,currentShowIfKey:((b=n.getAttributes("image"))==null?void 0:b.showIfKey)||((w=n.getAttributes("logo"))==null?void 0:w.showIfKey)||""}},equalityFn:gi});function lF(t){var e,n,r,i;const{editor:s,appendTo:o}=t;if(!s)return null;const a=aF(s),l=ue(H(H({},t),o?{appendTo:o.current}:{}),{shouldShow:({editor:d})=>d.isEditable?d.isActive("logo")||d.isActive("image"):!1,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},plugins:[Wi],sticky:"popper",maxWidth:"100%"}}),{lockAspectRatio:c}=a;return p.jsx(Ir,ue(H({},l),{className:"mly:flex mly:rounded-lg mly:border mly:border-gray-200 mly:bg-white mly:p-0.5 mly:shadow-md",children:p.jsxs(vn,{children:[a.isLogoActive&&a.imageSrc&&p.jsxs(p.Fragment,{children:[p.jsx(tr,{label:"Size",tooltip:"Size",value:a.logoSize,options:v9.map(d=>({value:d,label:d})),onValueChange:d=>{s?.chain().focus().setLogoAttributes({size:d}).run()}}),p.jsx(rt,{})]}),p.jsxs("div",{className:"mly:flex mly:gap-x-0.5",children:[p.jsx(Id,{alignment:a.alignment,onAlignmentChange:d=>{a.isImageActive?s?.chain().focus().updateAttributes("image",{alignment:d}).run():s?.chain().focus().setLogoAttributes({alignment:d}).run()}}),p.jsx(Ks,{defaultValue:(e=a?.imageSrc)!=null?e:"",onValueChange:(d,u)=>{a.isLogoActive?s?.chain().setLogoAttributes({src:d,isSrcVariable:u??!1}).run():s?.chain().updateAttributes("image",{src:d,isSrcVariable:u??!1}).run()},tooltip:"Source URL",icon:Wx,editor:s,isVariable:a.isSrcVariable}),a.isImageActive&&p.jsx(Ks,{defaultValue:(n=a?.imageExternalLink)!=null?n:"",onValueChange:(d,u)=>{s?.chain().updateAttributes("image",{externalLink:d,isExternalLinkVariable:u??!1}).run()},tooltip:"External URL",editor:s,isVariable:a.isExternalLinkVariable})]}),a.isImageActive&&a.imageSrc&&p.jsxs(p.Fragment,{children:[p.jsx(rt,{}),p.jsx(tr,{label:"Border Radius",value:a?.borderRadius,options:k9.map(d=>({value:String(d.value),label:d.name})),onValueChange:d=>{s?.chain().updateAttributes("image",{borderRadius:Number(d)}).run()},tooltip:"Border Radius",className:"mly:capitalize"}),p.jsxs("div",{className:"mly:flex mly:gap-x-0.5",children:[p.jsx(sh,{dimension:"width",value:(r=a?.width)!=null?r:"",onValueChange:d=>{const u=Math.min(Number(d)||0,nk),f=Number(a.height)||0,h=Number(a.width)||0,m=a.aspectRatio&&isFinite(a.aspectRatio)&&a.aspectRatio>0,g=m?a.aspectRatio:f>0?h/f:1,y=!a.height||a.height==="auto",b=(c||y)&&d&&(m||f>0);s?.chain().updateAttributes("image",H({width:String(u)},b?{height:String(ih(u,g))}:{})).run()}}),p.jsx(sh,{dimension:"height",value:(i=a?.height)!=null?i:"",onValueChange:d=>{const u=Number(d)||0,f=Number(a.height)||0,h=Number(a.width)||0,m=a.aspectRatio&&isFinite(a.aspectRatio)&&a.aspectRatio>0,g=m?a.aspectRatio:f>0?h/f:1,y=!a.width||a.width==="auto",b=(c||y)&&d&&(m||h>0);s?.chain().updateAttributes("image",H({height:String(u)},b?{width:String(g9(u,g))}:{})).run()}}),p.jsx(Bn,{isActive:()=>c,command:()=>{const d=Number(a.width)||0,u=Number(a.height)||0,f=d/u;s?.chain().updateAttributes("image",{lockAspectRatio:!c,aspectRatio:f}).run()},icon:c?p2:f2,tooltip:"Lock Aspect Ratio"})]})]}),p.jsx(rt,{}),p.jsx(Xi,{showIfKey:a.currentShowIfKey,onShowIfKeyValueChange:d=>{s?.chain().updateAttributes(a.isLogoActive?"logo":"image",{showIfKey:d}).run()},editor:s})]})}))}var qp=20,Yp=20,ck=dt.create({name:"inlineImage",inline:!0,group:"inline",selectable:!1,addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{height:{default:qp},width:{default:Yp},src:{default:null},isSrcVariable:{default:!1,renderHTML(t){return t.isSrcVariable?{"data-is-src-variable":"true"}:{}}},alt:{default:null},title:{default:null},externalLink:{default:null,renderHTML(t){return t.externalLink?{"data-external-link":t.externalLink}:{}}},isExternalLinkVariable:{default:!1,renderHTML(t){return t.isExternalLinkVariable?{"data-is-external-link-variable":"true"}:{}}}}},parseHTML(){return[{tag:`img[data-type="${this.name}"]`}]},renderHTML({HTMLAttributes:t}){return["img",He(this.options.HTMLAttributes,t,{"data-type":this.name,class:"mly:relative",style:`display: inline; --mly-inline-image-height: ${t.height}px; --mly-inline-image-width: ${t.width}px; margin:0; vertical-align: middle;`,draggable:"false",loading:"lazy"})]},addCommands(){return{setInlineImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addProseMirrorPlugins(){return[new Ze({key:new Ge("inlineImage"),props:{handleClickOn:(t,e,n)=>{if(n.type!==this.type)return!1;const r=e,i=e+n.nodeSize;return this.editor.commands.setTextSelection({from:r,to:i}),!0}}})]}}),cF=t=>cr({editor:t,selector:({editor:n})=>{var r,i,s,o,a,l,c,d;return{height:((r=n.getAttributes("inlineImage"))==null?void 0:r.height)||qp,width:((i=n.getAttributes("inlineImage"))==null?void 0:i.width)||Yp,src:((s=n.getAttributes("inlineImage"))==null?void 0:s.src)||"",isSrcVariable:(a=(o=n.getAttributes("inlineImage"))==null?void 0:o.isSrcVariable)!=null?a:!1,imageExternalLink:((l=n.getAttributes("inlineImage"))==null?void 0:l.externalLink)||"",isExternalLinkVariable:(d=(c=n.getAttributes("inlineImage"))==null?void 0:c.isExternalLinkVariable)!=null?d:!1}},equalityFn:gi});function dF(t){var e,n;const{editor:r,appendTo:i}=t;if(!r)return null;const s=cF(r),o=ue(H(H({},t),i?{appendTo:i.current}:{}),{shouldShow:({editor:a})=>a.isEditable?a.isActive("inlineImage"):!1,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},plugins:[Wi],sticky:"popper",maxWidth:"100%"}});return p.jsx(Ir,ue(H({},o),{className:"mly:flex mly:rounded-lg mly:border mly:border-gray-200 mly:bg-white mly:p-0.5 mly:shadow-md",children:p.jsx(vn,{children:p.jsxs("div",{className:"mly:flex mly:gap-x-0.5",children:[p.jsx(Ks,{defaultValue:(e=s?.src)!=null?e:"",onValueChange:(a,l)=>{r?.chain().updateAttributes("inlineImage",{src:a,isSrcVariable:l??!1}).run()},tooltip:"Source URL",icon:Wx,editor:r,isVariable:s.isSrcVariable}),p.jsx(Ks,{defaultValue:(n=s?.imageExternalLink)!=null?n:"",onValueChange:(a,l)=>{r?.chain().updateAttributes("inlineImage",{externalLink:a,isExternalLinkVariable:l??!1}).run()},tooltip:"External URL",editor:r,isVariable:s.isExternalLinkVariable}),p.jsx(sh,{dimension:"height",value:s?.height,onValueChange:a=>{r?.chain().updateAttributes("inlineImage",{width:a||Yp,height:a||qp}).run()}})]})})}))}var uF=t=>cr({editor:t,selector:n=>{var r,i;return{each:(r=n.editor.getAttributes("repeat"))==null?void 0:r.each,currentShowIfKey:((i=n.editor.getAttributes("repeat"))==null?void 0:i.showIfKey)||"",isSectionActive:n.editor.isActive("section")}},equalityFn:gi});function fF(t){const{appendTo:e,editor:n}=t;if(!n)return null;const r=uF(n),i=x.useCallback(()=>{const g=Od(n,"repeat");return g?.getBoundingClientRect()||new DOMRect(-1e3,-1e3,0,0)},[n]),s=ue(H(H({},t),e?{appendTo:e.current}:{}),{shouldShow:({editor:g})=>{var y;const b=Rr(g,"repeat"),k=(b?(y=Ts(b?.node,v=>v.type.name==="section"))==null?void 0:y[0]:null)&&g.isActive("section");return Rd(g)||k||!g.isEditable?!1:g.isActive("repeat")},tippyOptions:{offset:[0,8],popperOptions:{modifiers:[{name:"flip",enabled:!1}]},getReferenceClientRect:i,appendTo:()=>e?.current,plugins:[Wi],sticky:"popper",maxWidth:"auto"},pluginKey:"repeatBubbleMenu"}),o=Ji(n),a=o?.variables,l=o?.renderVariable,c=x.useRef(null),[d,u]=x.useState(!1),f=r?.each||"",h=x.useMemo(()=>Ta(a,{query:f||"",editor:n,from:"repeat-variable"}).map(g=>g.name),[a,f,n]),m=f;return p.jsx(Ir,ue(H({},s),{className:"mly:flex mly:items-stretch mly:rounded-lg mly:border mly:border-gray-200 mly:bg-white mly:p-0.5 mly:shadow-md",children:p.jsxs(vn,{children:[p.jsxs("div",{className:"mly:flex mly:items-center mly:gap-1.5 mly:px-1.5 mly:text-sm mly:leading-none",children:["Repeat",p.jsxs(Xt,{children:[p.jsx(Zt,{children:p.jsx(Gx,{className:Ce("mly:size-3 mly:stroke-[2.5] mly:text-gray-500")})}),p.jsx(Kt,{sideOffset:14,className:"mly:max-w-[260px]",align:"start",children:"Ensure the selected variable is iterable, such as an array of objects."})]})]}),!d&&p.jsx("button",{onClick:()=>{u(!0),setTimeout(()=>{var g;(g=c.current)==null||g.focus()},0)},children:l({variable:{name:r?.each,valid:m},fallback:"",from:"bubble-variable",editor:n})}),d&&p.jsx("form",{onSubmit:g=>{g.preventDefault(),u(!1)},onKeyDown:g=>{g.key==="Escape"&&u(!1)},children:p.jsx(Aa,{editor:n,placeholder:"ie. payload.items",value:r?.each||"",onValueChange:g=>{n.commands.updateRepeat({each:g})},onOutsideClick:()=>{u(!1)},onSelectOption:g=>{n.commands.updateRepeat({each:g}),u(!1)},autoCompleteOptions:h,ref:c})}),p.jsx(rt,{}),p.jsx(Xi,{showIfKey:r.currentShowIfKey,onShowIfKeyValueChange:g=>{n.commands.updateRepeat({showIfKey:g})},editor:n})]})}))}function hF(t){const e=t,{topBarClassName:n}=e,r=fr(e,["topBarClassName"]);return p.jsxs("svg",ue(H({width:11,height:12,viewBox:"0 0 11 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r),{children:[p.jsx("path",{d:"M0 11H10.6667",stroke:"currentColor",strokeWidth:"1.5"}),p.jsx("path",{d:"M0.666504 9V6.33333C0.666504 3.38781 3.05432 1 5.99984 1H10.6665",strokeWidth:"1.5",className:n})]}))}function pF(t){return p.jsx("svg",ue(H({width:12,height:12,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),{children:p.jsx("path",{d:"M10.5 10.499V1.49902M1.5 10.499V1.49902M4.5 5.99902C4.5 5.53308 4.5 5.30011 4.57612 5.11634C4.67761 4.87131 4.87229 4.67664 5.11732 4.57514C5.30109 4.49902 5.53406 4.49902 6 4.49902C6.46594 4.49902 6.69891 4.49902 6.88268 4.57514C7.12771 4.67664 7.32239 4.87131 7.42388 5.11634C7.5 5.30011 7.5 5.53308 7.5 5.99902C7.5 6.46496 7.5 6.69794 7.42388 6.88171C7.32239 7.12673 7.12771 7.32141 6.88268 7.4229C6.69891 7.49902 6.46594 7.49902 6 7.49902C5.53406 7.49902 5.30109 7.49902 5.11732 7.4229C4.87229 7.32141 4.67761 7.12673 4.57612 6.88171C4.5 6.69794 4.5 6.46496 4.5 5.99902Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}))}function mF(t){return p.jsx("svg",ue(H({width:10,height:10,viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),{children:p.jsx("path",{d:"M9.50244 0.501526L9.10244 0.501526C8.54239 0.501526 8.26236 0.501526 8.04845 0.610519C7.86029 0.706392 7.70731 0.859373 7.61144 1.04754C7.50244 1.26145 7.50244 1.54147 7.50244 2.10153V7.90153C7.50244 8.46158 7.50244 8.74161 7.61144 8.95552C7.70731 9.14368 7.86029 9.29666 8.04845 9.39253C8.26236 9.50153 8.54239 9.50153 9.10244 9.50153H9.50244M0.502441 0.501527L0.902441 0.501527C1.46249 0.501527 1.74252 0.501527 1.95643 0.61052C2.14459 0.706393 2.29757 0.859374 2.39345 1.04754C2.50244 1.26145 2.50244 1.54147 2.50244 2.10153L2.50244 7.90153C2.50244 8.46158 2.50244 8.74161 2.39345 8.95552C2.29757 9.14368 2.14459 9.29666 1.95643 9.39253C1.74252 9.50153 1.46249 9.50153 0.902442 9.50153H0.502442M4.99994 7.99903V1.99903",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}))}function ma(t){const{color:e,onColorChange:n,borderColor:r,backgroundColor:i,tooltip:s,className:o,children:a,onClose:l,suggestedColors:c=[]}=t,d=f=>{queueMicrotask(()=>{n(f)})},u=p.jsx(Rn,{asChild:!0,children:a||p.jsx(on,{variant:"ghost",className:"mly:h-7 mly:w-7 mly:shrink-0",size:"sm",type:"button",children:p.jsx("div",{className:Ce("mly:h-4 mly:w-4 mly:shrink-0 mly:rounded mly:border-2 mly:border-gray-700",o),style:ue(H({},r?{borderColor:r}:{}),{backgroundColor:i||"transparent"})})})});return p.jsxs(On,{onOpenChange:f=>{f||l?.(e)},children:[s?p.jsxs(Xt,{children:[p.jsx(Zt,{asChild:!0,children:u}),p.jsx(Kt,{sideOffset:8,children:s})]}):u,p.jsx(xn,{className:"mly:w-full mly:rounded-none mly:border-0 mly:bg-transparent! mly:p-0! mly:shadow-none mly:drop-shadow-md",sideOffset:8,children:p.jsxs("div",{className:"mly:min-w-[260px] mly:rounded-xl mly:border mly:border-gray-200 mly:bg-white mly:p-4",children:[p.jsx(n3,{color:e,onChange:d,className:"mly:flex mly:w-full! mly:flex-col mly:gap-4"}),p.jsx(s3,{alpha:!0,color:e,onChange:d,className:"mly:mt-4 mly:w-full mly:min-w-0 mly:rounded-lg mly:border mly:border-gray-200 mly:bg-white mly:px-2 mly:py-1.5 mly:text-sm mly:uppercase mly:focus-visible:border-gray-400 mly:focus-visible:outline-hidden",prefixed:!0}),c.length>0&&p.jsxs("div",{children:[p.jsx("div",{className:"-mly:mx-4 mly:my-4 mly:h-px mly:bg-gray-200"}),p.jsx("h2",{className:"mly:text-xs mly:text-gray-500",children:"Recently used"}),p.jsx("div",{className:"mly:mt-2 mly:flex mly:flex-wrap mly:gap-0.5",children:c.map(f=>p.jsx(on,{variant:"ghost",size:"sm",className:"!mly:size-7 mly:shrink-0",type:"button",onClick:()=>d(f),children:p.jsx("div",{className:"mly:h-4 mly:w-4 mly:shrink-0 mly:rounded",style:{backgroundColor:f}})},f))})]})]})})]})}var gF=t=>cr({editor:t,selector:n=>{var r,i,s,o,a,l,c,d,u,f,h,m,g,y;return{currentAlignment:((r=n.editor.getAttributes("section"))==null?void 0:r.align)||"left",currentBorderRadius:Number((i=n.editor.getAttributes("section"))==null?void 0:i.borderRadius)||0,currentBackgroundColor:((s=n.editor.getAttributes("section"))==null?void 0:s.backgroundColor)||Z1,currentBorderColor:((o=n.editor.getAttributes("section"))==null?void 0:o.borderColor)||Q1,currentBorderWidth:Number((a=n.editor.getAttributes("section"))==null?void 0:a.borderWidth)||0,currentMarginTop:Number((l=n.editor.getAttributes("section"))==null?void 0:l.marginTop)||0,currentMarginRight:Number((c=n.editor.getAttributes("section"))==null?void 0:c.marginRight)||0,currentMarginBottom:Number((d=n.editor.getAttributes("section"))==null?void 0:d.marginBottom)||0,currentMarginLeft:Number((u=n.editor.getAttributes("section"))==null?void 0:u.marginLeft)||0,currentPaddingTop:Number((f=n.editor.getAttributes("section"))==null?void 0:f.paddingTop)||0,currentPaddingRight:Number((h=n.editor.getAttributes("section"))==null?void 0:h.paddingRight)||0,currentPaddingBottom:Number((m=n.editor.getAttributes("section"))==null?void 0:m.paddingBottom)||0,currentPaddingLeft:Number((g=n.editor.getAttributes("section"))==null?void 0:g.paddingLeft)||0,isColumnsActive:n.editor.isActive("columns"),currentShowIfKey:((y=n.editor.getAttributes("section"))==null?void 0:y.showIfKey)||""}},equalityFn:gi});function yF(t){const{appendTo:e,editor:n}=t;if(!n)return null;const r=x.useCallback(()=>{const a=Od(n,"section");return a?.getBoundingClientRect()||new DOMRect(-1e3,-1e3,0,0)},[n]),i=ue(H(H({},t),e?{appendTo:e.current}:{}),{shouldShow:({editor:a})=>{var l,c;const d=Rr(a,"section"),u=d?(l=Ts(d?.node,g=>g.type.name==="repeat"))==null?void 0:l[0]:null,f=d?(c=Ts(d?.node,g=>g.type.name==="inlineImage"))==null?void 0:c[0]:null,h=u&&a.isActive("repeat"),m=f&&a.isActive("inlineImage");return Rd(a)||h||m||!a.isEditable?!1:a.isActive("section")},tippyOptions:{offset:[0,8],popperOptions:{modifiers:[{name:"flip",enabled:!1}]},getReferenceClientRect:r,appendTo:()=>e?.current,plugins:[Wi],sticky:"popper",maxWidth:"auto"},pluginKey:"sectionBubbleMenu"}),s=gF(n),o=[{value:"0",label:"Sharp"},{value:"6",label:"Smooth"},{value:"9999",label:"Round"}];return p.jsx(Ir,ue(H({},i),{className:"mly:flex mly:items-stretch mly:rounded-lg mly:border mly:border-gray-200 mly:bg-white mly:p-0.5 mly:shadow-md",children:p.jsxs(vn,{children:[p.jsx(Id,{alignment:s.currentAlignment,onAlignmentChange:a=>{var l;(l=n?.commands)==null||l.updateSection({align:a})}}),p.jsx(rt,{}),p.jsxs("div",{className:"mly:flex mly:gap-x-0.5",children:[p.jsx(tr,{label:"Border Radius",value:String(s.currentBorderRadius),options:o,onValueChange:a=>{var l;(l=n?.commands)==null||l.updateSection({borderRadius:Number(a)})},tooltip:"Border Radius",className:"mly:capitalize"}),p.jsx(tr,{label:"Border Width",value:String(s.currentBorderWidth),options:[{value:"0",label:"None"},{value:"1",label:"Thin"},{value:"2",label:"Medium"},{value:"3",label:"Thick"}],onValueChange:a=>{var l;(l=n?.commands)==null||l.updateSection({borderWidth:Number(a)})},tooltip:"Border Width",className:"mly:capitalize"})]}),p.jsx(rt,{}),p.jsx(tr,{icon:pF,iconClassName:"mly:stroke-[1.2] mly:size-3.5",label:"Margin",value:String(s.currentMarginTop),options:[{value:"0",label:"None"},...pa.map(a=>({label:a.name,value:String(a.value)}))],onValueChange:a=>{var l;const c=Number(a);(l=n?.commands)==null||l.updateSection({marginTop:c,marginRight:c,marginBottom:c,marginLeft:c})},tooltip:"Margin",className:"mly:capitalize"}),p.jsx(rt,{}),p.jsx(tr,{icon:mF,iconClassName:"mly:stroke-[1]",label:"Padding",value:String(s.currentPaddingTop),options:[{value:"0",label:"None"},...pa.map(a=>({label:a.name,value:String(a.value)}))],onValueChange:a=>{var l;const c=Number(a);(l=n?.commands)==null||l.updateSection({paddingTop:c,paddingRight:c,paddingBottom:c,paddingLeft:c})},tooltip:"Padding",className:"mly:capitalize"}),p.jsx(rt,{}),p.jsxs("div",{className:"mly:flex mly:gap-x-0.5",children:[p.jsx(ma,{color:s.currentBorderColor,onColorChange:a=>{var l;(l=n?.commands)==null||l.updateSection({borderColor:a})},tooltip:"Border Color",children:p.jsx(on,{variant:"ghost",className:"mly:h-7 mly:w-7 mly:shrink-0",size:"sm",type:"button",children:p.jsx(hF,{className:"mly:size-3 mly:shrink-0",topBarClassName:"mly:stroke-midnight-gray",style:{color:s.currentBorderColor}})})}),p.jsx(ma,{color:s.currentBackgroundColor,onColorChange:a=>{var l;(l=n?.commands)==null||l.updateSection({backgroundColor:a})},backgroundColor:s.currentBackgroundColor,tooltip:"Background Color",className:"mly:rounded-full mly:border-[1.5px] mly:border-white mly:shadow"})]}),p.jsx(rt,{}),p.jsx(Bn,{icon:Qx,tooltip:"Delete Section",command:()=>{W1(n,"section")}}),p.jsx(rt,{}),p.jsx(Xi,{showIfKey:s.currentShowIfKey,onShowIfKeyValueChange:a=>{n.commands.updateSection({showIfKey:a})},editor:n}),s.isColumnsActive&&p.jsxs(p.Fragment,{children:[p.jsx(rt,{}),p.jsxs(On,{children:[p.jsxs(Rn,{className:"mly:flex mly:items-center mly:gap-1 mly:rounded-md mly:px-1.5 mly:text-sm mly:data-[state=open]:bg-soft-gray mly:hover:bg-soft-gray",children:["Column",p.jsx(NI,{className:"mly:h-3 mly:w-3"})]}),p.jsx(xn,{className:"mly:w-max mly:rounded-lg mly:p-0.5!",side:"top",sideOffset:8,align:"end",onOpenAutoFocus:a=>{a.preventDefault()},onCloseAutoFocus:a=>{a.preventDefault()},children:p.jsx(G1,{editor:n})})]})]})]})}))}var bF=t=>cr({editor:t,selector:n=>{var r;return{currentShowIfKey:((r=n.editor.getAttributes("spacer"))==null?void 0:r.showIfKey)||""}},equalityFn:gi});function vF(t){const{editor:e,appendTo:n}=t;if(!e)return null;const r=x.useMemo(()=>pa.map(o=>{const{value:a,short:l}=o;return{name:l,isActive:()=>e?.isActive("spacer",{height:a}),command:()=>{e?.chain().focus().setSpacer({height:a}).run()}}}),[e]),i=ue(H(H({},t),n?{appendTo:n.current}:{}),{shouldShow:({editor:o})=>o.isEditable?o.isActive("spacer"):!1,tippyOptions:{maxWidth:"100%",moveTransition:"mly:transform 0.15s mly:ease-out"}}),s=bF(e);return p.jsx(Ir,ue(H({},i),{className:"mly:flex mly:gap-0.5 mly:rounded-lg mly:border mly:border-gray-200 mly:bg-white mly:p-0.5 mly:shadow-md",children:p.jsxs(vn,{children:[r.map((o,a)=>p.jsx(Bn,H({className:"!mly:h-7 mly:w-7 mly:shrink-0 mly:p-0",iconClassName:"mly:w-3 mly:h-3",nameClassName:"mly:text-xs"},o),a)),p.jsx(rt,{}),p.jsx(Xi,{showIfKey:s.currentShowIfKey,onShowIfKeyValueChange:o=>{e.commands.setSpacerShowIfKey(o)},editor:e})]})}))}var Nb=8,dk=dt.create({name:"columns",group:"columns",content:"column+",defining:!0,isolating:!0,addAttributes(){return{showIfKey:{default:gt,parseHTML:t=>t.getAttribute("data-show-if-key")||gt,renderHTML(t){return t.showIfKey?{"data-show-if-key":t.showIfKey}:{}}},gap:{default:Nb,parseHTML:t=>Number(t.style.gap)||Nb,renderHTML(t){return t.gap?{style:`gap: ${t.gap}px`}:{}}}}},addCommands(){return{setColumns:()=>({commands:t})=>t.insertContent({type:this.name,attrs:{},content:[{type:"column",attrs:{columnId:Yo()},content:[{type:"paragraph"}]},{type:"column",attrs:{columnId:Yo()},content:[{type:"paragraph"}]}]}),updateColumns:t=>to(this.name,t)}},renderHTML({HTMLAttributes:t}){return["div",He(t,{"data-type":"columns",class:"mly:relative"}),0]},parseHTML(){return[{tag:'div[data-type="columns"]'}]},addKeyboardShortcuts(){return{Tab:()=>ub(this.editor,"next"),"Shift-Tab":()=>ub(this.editor,"previous")}}}),uk=DE.extend({addInputRules(){return[new va({find:/^(?:---|—-|___\s|\*\*\*\s)$/,handler:({state:t,range:e})=>{const n={},{tr:r}=t,i=e.from,s=e.to;r.insert(i-1,this.type.create(n)).delete(r.mapping.map(i),r.mapping.map(s))}})]},addOptions(){return{HTMLAttributes:{class:"mly:relative"}}}}),fk=8,hk=dt.create({name:"spacer",priority:1e3,group:"block",draggable:!0,addAttributes(){return{height:{default:fk,parseHTML:t=>Number(t.getAttribute("data-height")),renderHTML:t=>({"data-height":t.height})},showIfKey:{default:gt,parseHTML:t=>t.getAttribute("data-show-if-key")||gt,renderHTML(t){return t.showIfKey?{"data-show-if-key":t.showIfKey}:{}}}}},addCommands(){return{setSpacer:t=>({commands:e})=>e.insertContent({type:this.name,attrs:{height:t.height}}),setSpacerSize:t=>({commands:e})=>e.updateAttributes("spacer",{height:t}),setSpacerShowIfKey:t=>({commands:e})=>e.updateAttributes("spacer",{showIfKey:t}),unsetSpacer:()=>({commands:t})=>t.deleteNode("spacer")}},renderHTML({HTMLAttributes:t,node:e}){const{height:n}=e.attrs;return["div",He({"data-maily-component":this.name},this.options.HTMLAttributes,t,{class:"spacer mly:relative mly:full mly:z-50",contenteditable:!1,style:`height: ${n}px;--spacer-height: ${n}px;`})]},parseHTML(){return[{tag:`div[data-maily-component="${this.name}"]`}]}}),Si=x.forwardRef((t,e)=>{var n=t,{className:r,type:i}=n,s=fr(n,["className","type"]);return p.jsx("input",H(ue(H({},Vs),{type:i,className:Ce("mly:flex mly:h-10 mly:w-full mly:rounded-md mly:border mly:border-gray-200 mly:bg-white mly:px-3 mly:py-2 mly:text-sm mly:ring-offset-white mly:file:border-0 mly:file:bg-transparent mly:file:text-sm mly:file:font-medium mly:placeholder:text-gray-500 mly:focus-visible:outline-hidden mly:focus-visible:ring-2 mly:focus-visible:ring-gray-400 mly:focus-visible:ring-offset-2 mly:disabled:cursor-not-allowed mly:disabled:opacity-50","mly-editor",r),ref:e}),s))});Si.displayName="Input";var pk=x.forwardRef((t,e)=>{var n=t,{className:r}=n,i=fr(n,["className"]);return p.jsx("textarea",H({className:Ce("mly:flex mly:min-h-24 mly:w-full mly:rounded-md mly:border mly:border-gray-200 mly:bg-white mly:px-3 mly:py-2 mly:text-sm mly:ring-offset-white mly:file:border-0 mly:file:bg-transparent mly:file:text-sm mly:file:font-medium mly:placeholder:text-gray-500 mly:focus-visible:outline-hidden mly:focus-visible:ring-2 mly:focus-visible:ring-gray-400 mly:focus-visible:ring-offset-2 mly:disabled:cursor-not-allowed mly:disabled:opacity-50","mly-editor",r),ref:e},i))});pk.displayName="Textarea";function xF(t){const{title:e,description:n,link:r,linkTitle:i,image:s,badgeText:o,subTitle:a}=t.node.attrs,{getPos:l,editor:c}=t;return p.jsx(Gi,{className:`react-component ${t.selected&&"ProseMirror-selectednode"}`,draggable:c.isEditable,"data-drag-handle":c.isEditable,children:p.jsxs(On,{open:t.selected,children:[p.jsx(Rn,{asChild:!0,children:p.jsx("div",{tabIndex:-1,onClick:d=>{d.preventDefault();const u=l();c.commands.setNodeSelection(u)},children:p.jsxs("div",{className:"mly:no-prose mly:flex mly:flex-col mly:rounded-lg mly:border mly:border-gray-300",children:[s&&p.jsx("div",{className:"mly:relative mly:mb-1.5 mly:w-full mly:shrink-0",children:p.jsx("img",{src:s,alt:"link-card",className:"mly:no-prose mly:mb-0! mly:h-full mly:w-full mly:rounded-t-lg",draggable:c.isEditable})}),p.jsx("div",{className:"mly:flex mly:items-stretch mly:p-3",children:p.jsxs("div",{className:Ce("mly:flex mly:flex-col"),children:[p.jsxs("div",{className:"!mly:mb-1.5 mly:flex mly:items-center mly:gap-1.5",children:[p.jsx("h2",{className:"!mly:mb-0 mly:text-lg! mly:font-semibold",children:e}),o&&p.jsx("span",{className:"!mly:font-base mly:rounded-md mly:bg-yellow-200 mly:px-2 mly:py-1 mly:font-semibold mly:leading-none text-xs",children:o})," ",a&&!o&&p.jsx("span",{className:"!mly:font-base mly:font-regular mly:rounded-md mly:leading-none mly:text-gray-400 text-xs",children:a})]}),p.jsxs("p",{className:"!mly:my-0 mly:text-base! mly:text-gray-500",children:[n," ",i?p.jsx("a",{href:r,className:"mly:font-semibold",children:i}):null]})]})})]})})}),p.jsxs(xn,{align:"end",className:"mly:flex mly:w-96 mly:flex-col mly:gap-2",sideOffset:10,onOpenAutoFocus:d=>d.preventDefault(),onCloseAutoFocus:d=>d.preventDefault(),children:[p.jsxs("label",{className:"mly:w-full mly:space-y-1",children:[p.jsx("span",{className:"mly:text-xs mly:font-normal mly:text-slate-400",children:"Image"}),p.jsx(Si,{placeholder:"Add Image",type:"url",value:s,onChange:d=>{t.updateAttributes({image:d.target.value})}})]}),p.jsxs("label",{className:"mly:w-full mly:space-y-1",children:[p.jsx("span",{className:"mly:text-xs mly:font-normal mly:text-slate-400",children:"Title"}),p.jsx(Si,{placeholder:"Add title",value:e,onChange:d=>{t.updateAttributes({title:d.target.value})}})]}),p.jsxs("label",{className:"mly:w-full mly:space-y-1",children:[p.jsx("span",{className:"mly:text-xs mly:font-normal mly:text-slate-400",children:"Description"}),p.jsx(pk,{placeholder:"Add description here",value:n,onChange:d=>{t.updateAttributes({description:d.target.value})}})]}),p.jsxs("div",{className:"mly:grid mly:grid-cols-2 mly:gap-2",children:[p.jsxs("label",{className:"mly:w-full mly:space-y-1",children:[p.jsx("span",{className:"mly:text-xs mly:font-normal mly:text-slate-400",children:"Link Title"}),p.jsx(Si,{placeholder:"Add link title here",value:i,onChange:d=>{t.updateAttributes({linkTitle:d.target.value})}})]}),p.jsxs("label",{className:"mly:w-full mly:space-y-1",children:[p.jsx("span",{className:"mly:text-xs mly:font-normal mly:text-slate-400",children:"Link"}),p.jsx(Si,{placeholder:"Add link here",value:r,onChange:d=>{t.updateAttributes({link:d.target.value})}})]})]}),p.jsxs("div",{className:"mly:grid mly:grid-cols-2 mly:gap-2",children:[p.jsxs("label",{className:"mly:w-full mly:space-y-1",children:[p.jsx("span",{className:"mly:text-xs mly:font-normal mly:text-slate-400",children:"Badge Text"}),p.jsx(Si,{placeholder:"Add badge text here",value:o,onChange:d=>{t.updateAttributes({badgeText:d.target.value})}})]}),p.jsxs("label",{className:"mly:w-full mly:space-y-1",children:[p.jsx("span",{className:"mly:text-xs mly:font-normal mly:text-slate-400",children:"Sub Title"}),p.jsx(Si,{placeholder:"Add sub title here",value:a,onChange:d=>{t.updateAttributes({subTitle:d.target.value})}})]})]})]})]})})}var mk=dt.create({name:"linkCard",group:"block",atom:!0,draggable:!0,addAttributes(){return{mailyComponent:{default:"linkCard"},title:{default:""},description:{default:""},link:{default:""},linkTitle:{default:""},image:{default:""},subTitle:{default:""},badgeText:{default:""}}},parseHTML(){return[{tag:`a[data-maily-component="${this.name}"]`}]},renderHTML({HTMLAttributes:t}){return["div",He({"data-maily-component":this.name},t)]},addCommands(){return{setLinkCard:()=>({commands:t})=>t.insertContent({type:this.name,attrs:{mailyComponent:this.name}})}},addNodeView(){return qi(xF,{className:"mly:relative"})}});function wF(t){var e,n;const{value:r,onValueChange:i,isVariable:s,editor:o}=t,a=x.useRef(null),[l,c]=x.useState(!s),{placeholderUrl:d=Dd}=ok(),u=Ji(o),f=u?.variables,h=(n=(e=u?.suggestion)==null?void 0:e.char)!=null?n:Gp,m=u?.renderVariable,g=x.useMemo(()=>{const y=r.replace(new RegExp(h,"g"),"");return Ta(f,{query:y||"",from:"bubble-variable",editor:o}).map(b=>b.name)},[f,r,o]);return p.jsxs("div",{className:"mly:isolate mly:flex mly:rounded-lg",children:[!l&&p.jsx("button",{onClick:()=>{c(!0),setTimeout(()=>{var y;(y=a.current)==null||y.focus()},0)},children:m({variable:{name:r,valid:!0},fallback:"",from:"bubble-variable",editor:o})}),l&&p.jsx(Aa,{editor:o,value:r,onValueChange:y=>{i?.(y)},autoCompleteOptions:g,ref:a,placeholder:d,className:"mly:h-7 mly:w-40 mly:rounded-md mly:px-2 mly:pr-6 mly:text-sm mly:text-midnight-gray mly:hover:bg-soft-gray mly:focus:bg-soft-gray mly:focus:outline-hidden",triggerChar:h,onSelectOption:y=>{var b;const w=(b=g.includes(y))!=null?b:!1;w&&c(!1),i?.(y,w)}})]})}function EF(t){const{node:e,editor:n,getPos:r,updateAttributes:i}=t,{text:s,isTextVariable:o,alignment:a,variant:l,borderRadius:c,buttonColor:d,textColor:u,url:f,showIfKey:h="",isUrlVariable:m,paddingTop:g,paddingRight:y,paddingBottom:b,paddingLeft:w}=e.attrs,k=Ji(n),v=k?.renderVariable,E=x.useMemo(()=>({small:{paddingX:24,paddingY:6},medium:{paddingX:32,paddingY:10},large:{paddingX:40,paddingY:14}}),[]),S=x.useMemo(()=>{var C;return(C=Object.entries(E).find(([,{paddingX:N,paddingY:M}])=>y===N&&g===M))==null?void 0:C[0]},[y,g,E]);return p.jsx(Gi,{draggable:n.isEditable,"data-drag-handle":n.isEditable,"data-type":"button",style:{textAlign:a},children:p.jsxs(On,{open:t.selected&&n.isEditable,children:[p.jsx(Rn,{asChild:!0,children:p.jsx("div",{children:p.jsx("button",{className:Ce("mly:inline-flex mly:items-center mly:justify-center mly:rounded-md mly:text-sm mly:font-medium mly:ring-offset-white mly:transition-colors mly:disabled:pointer-events-none mly:disabled:opacity-50","mly:font-semibold mly:no-underline",{"mly:rounded-full!":c==="round","mly:rounded-md!":c==="smooth","mly:rounded-none!":c==="sharp"}),tabIndex:-1,style:{backgroundColor:l==="filled"?d||"var(--mly-button-background-color)":"transparent",color:u||"var(--mly-button-text-color)",borderWidth:2,borderStyle:"solid",borderColor:d||"var(--mly-button-background-color)","--button-var-border-color":u?`${u}80`:"color-mix(in srgb, var(--mly-button-text-color) 80%, transparent)",paddingTop:g||"var(--mly-button-padding-top)",paddingRight:y||"var(--mly-button-padding-right)",paddingBottom:b||"var(--mly-button-padding-bottom)",paddingLeft:w||"var(--mly-button-padding-left)"},onClick:C=>{if(C.preventDefault(),!n.isEditable)return;const N=r();n.commands.setNodeSelection(N)},children:o?v({variable:{name:s,valid:!0},fallback:s,from:"button-variable",editor:n}):s})})}),p.jsx(xn,{align:"end",side:"top",className:"mly:w-max mly:rounded-lg mly:p-0.5!",sideOffset:8,onOpenAutoFocus:C=>C.preventDefault(),onCloseAutoFocus:C=>C.preventDefault(),children:p.jsx(vn,{children:p.jsxs("div",{className:"mly:flex mly:items-stretch mly:text-midnight-gray",children:[p.jsx(wF,{value:s,onValueChange:(C,N)=>{i({text:C,isTextVariable:N??!1})},isVariable:o,editor:n}),p.jsx(rt,{}),p.jsxs("div",{className:"mly:flex mly:gap-x-0.5",children:[p.jsx(tr,{label:"Border Radius",value:c,options:RF.map(C=>({value:C,label:C})),onValueChange:C=>{i({borderRadius:C})},tooltip:"Border Radius",className:"mly:capitalize"}),p.jsx(tr,{label:"Style",value:l,options:OF.map(C=>({value:C,label:C})),onValueChange:C=>{i({variant:C})},tooltip:"Style",className:"mly:capitalize"}),p.jsx(tr,{label:"Size",value:S,options:[{value:"small",label:"Small"},{value:"medium",label:"Medium"},{value:"large",label:"Large"}],onValueChange:C=>{const{paddingX:N,paddingY:M}=E[C];i({paddingTop:M,paddingRight:N,paddingBottom:M,paddingLeft:N})},tooltip:"Size",placeholder:"Size"})]}),p.jsx(rt,{}),p.jsxs("div",{className:"mly:flex mly:gap-x-0.5",children:[p.jsx(Id,{alignment:a,onAlignmentChange:C=>{i({alignment:C})}}),p.jsx(Ks,{defaultValue:f||"",onValueChange:(C,N)=>{i({url:C,isUrlVariable:N??!1})},tooltip:"Update External Link",editor:n,isVariable:m})]}),p.jsx(rt,{}),p.jsxs("div",{className:"mly:flex mly:gap-x-0.5",children:[p.jsx(kF,{variant:l,color:d||"transparent",onChange:C=>{i({buttonColor:C})}}),p.jsx(SF,{color:u||"transparent",onChange:C=>{i({textColor:C})}})]}),p.jsx(rt,{}),p.jsx(Xi,{showIfKey:h,onShowIfKeyValueChange:C=>{i({showIfKey:C})},editor:n})]})})})]})})}function kF(t){const{color:e,onChange:n,variant:r}=t;return p.jsx(ma,{color:e,onColorChange:n,tooltip:"Background Color",children:p.jsx(on,{variant:"ghost",size:"sm",type:"button",className:"mly:size-7",children:p.jsx("div",{className:"mly:h-4 mly:w-4 mly:shrink-0 mly:rounded-full mly:shadow",style:{backgroundColor:r==="filled"?e:"transparent",borderStyle:"solid",borderWidth:2,borderColor:r==="filled"?"white":e}})})})}function SF(t){const{color:e,onChange:n}=t;return p.jsx(ma,{color:e,onColorChange:n,tooltip:"Text Color",children:p.jsx(on,{variant:"ghost",size:"sm",type:"button",className:"mly:size-7",children:p.jsxs("div",{className:"mly:flex mly:flex-col mly:items-center mly:justify-center mly:gap-px",children:[p.jsx("span",{className:"mly:font-bolder mly:font-mono mly:text-xs mly:text-midnight-gray",children:"A"}),p.jsx("div",{className:"mly:h-[2px] mly:w-3 mly:shrink-0 mly:rounded-md mly:shadow",style:{backgroundColor:e}})]})})})}var Tb="left",Ab="filled",Mb="smooth",CF=null,_F=null,NF=null,TF=null,AF=null,MF=null,OF=["filled","outline"],RF=["sharp","smooth","round"],gk=dt.create({name:"button",group:"block",atom:!0,draggable:!0,addAttributes(){return{text:{default:"Button",parseHTML:t=>t.getAttribute("data-text")||"",renderHTML:t=>({"data-text":t.text})},isTextVariable:{default:!1,parseHTML:t=>t.getAttribute("data-is-text-variable")==="true",renderHTML:t=>t.isTextVariable?{"data-is-text-variable":"true"}:{}},url:{default:"",parseHTML:t=>t.getAttribute("data-url")||"",renderHTML:t=>({"data-url":t.url})},isUrlVariable:{default:!1,parseHTML:t=>t.getAttribute("data-is-url-variable")==="true",renderHTML:t=>t.isUrlVariable?{"data-is-url-variable":"true"}:{}},alignment:{default:Tb,parseHTML:t=>t.getAttribute("data-alignment")||Tb,renderHTML:t=>({"data-alignment":t.alignment})},variant:{default:Ab,parseHTML:t=>t.getAttribute("data-variant")||Ab,renderHTML:t=>({"data-variant":t.variant})},borderRadius:{default:Mb,parseHTML:t=>t.getAttribute("data-border-radius")||Mb,renderHTML:t=>({"data-border-radius":t.borderRadius})},showIfKey:{default:gt,parseHTML:t=>t.getAttribute("data-show-if-key")||gt,renderHTML(t){return t.showIfKey?{"data-show-if-key":t.showIfKey}:{}}},buttonColor:CF,textColor:_F,paddingTop:NF,paddingRight:TF,paddingBottom:AF,paddingLeft:MF}},parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML({HTMLAttributes:t}){return["div",He(t,{"data-type":this.name})]},addCommands(){return{setButton:()=>({commands:t})=>t.insertContent({type:this.name,attrs:{},content:[]}),updateButton:t=>to(this.name,t)}},addNodeView(){return qi(EF,{contentDOMElementTag:"div",className:"mly:relative"})}}),IF=0,yk=Cp.extend({addAttributes(){var t;return ue(H({},(t=this.parent)==null?void 0:t.call(this)),{width:{default:"auto",parseHTML:e=>{var n,r,i;return e.getAttribute("width")||((i=((n=e.style)==null?void 0:n.width)||((r=e.style)==null?void 0:r.inlineSize))==null?void 0:i.replace("px",""))||null},renderHTML:({width:e})=>({width:e})},height:{default:"auto",parseHTML:e=>{var n,r,i;return e.getAttribute("height")||((i=((n=e.style)==null?void 0:n.height)||((r=e.style)==null?void 0:r.blockSize))==null?void 0:i.replace("px",""))||null},renderHTML:({height:e})=>({height:e})},alignment:{default:"center",renderHTML:({alignment:e})=>({"data-alignment":e}),parseHTML:e=>e.getAttribute("data-alignment")||"center"},externalLink:{default:null,renderHTML:({externalLink:e})=>e?{"data-external-link":e}:{},parseHTML:e=>{const n=e.getAttribute("data-external-link");return n?{externalLink:n}:null}},isExternalLinkVariable:{default:!1,parseHTML:e=>e.getAttribute("data-is-external-link-variable")==="true",renderHTML:e=>e.isExternalLinkVariable?{"data-is-external-link-variable":"true"}:{}},borderRadius:{default:IF,parseHTML:e=>Number(e.getAttribute("data-border-radius")),renderHTML:e=>({"data-border-radius":e.borderRadius})},isSrcVariable:{default:!1,parseHTML:e=>e.getAttribute("data-is-src-variable")==="true",renderHTML:e=>e.isSrcVariable?{"data-is-src-variable":"true"}:{}},aspectRatio:{default:null,parseHTML:e=>e.getAttribute("data-aspect-ratio")||null,renderHTML:e=>e?.aspectRatio?{"data-aspect-ratio":e?.aspectRatio}:{}},lockAspectRatio:{default:!0,parseHTML:e=>e.getAttribute("data-lock-aspect-ratio")==="true",renderHTML:e=>e.lockAspectRatio?{"data-lock-aspect-ratio":"true"}:{}},showIfKey:{default:gt,parseHTML:e=>e.getAttribute("data-show-if-key")||gt,renderHTML(e){return e.showIfKey?{"data-show-if-key":e.showIfKey}:{}}}})},addNodeView(){return qi(y9,{className:"mly:relative"})}});function DF(t){const{node:e,updateAttributes:n}=t;let{language:r,activeTab:i="code"}=e.attrs;i||(i="code");const s=r?`language-${r}`:"",o=x.useMemo(()=>{const l=e.content.content.reduce((m,g)=>{if(g.type.name==="text")return m+g.text;if(g.type.name==="variable"){const{id:y,fallback:b}=g?.attrs||{},w=b?`{{${y},fallback=${b}}}`:`{{${y}}}`;return m+w}return m},""),d=new DOMParser().parseFromString(l,"text/html"),u=d.querySelectorAll("style"),f=d.body;return`<style>${Array.from(u).map(m=>m.innerHTML).join(`
149
+ `)}</style>${f.innerHTML}`},[i]),a=o==="";return p.jsxs(Gi,{draggable:!1,"data-drag-handle":!1,"data-type":"htmlCodeBlock",children:[i==="code"&&p.jsx("pre",{className:"mly:my-0 mly:rounded-lg mly:border mly:border-gray-200 mly:bg-white mly:p-2 mly:text-black",children:p.jsx(Wv,{as:"code",className:Ce("is-editable",s)})}),i==="preview"&&p.jsx("div",{className:Ce("mly:not-prose mly:rounded-lg mly:border mly:border-gray-200 mly:p-2",a&&"mly:min-h-[42px]"),ref:l=>{if(!l||l?.shadowRoot)return;const c=l.attachShadow({mode:"open"}),d=new CSSStyleSheet;d.replaceSync(`
150
+ * { font-family: 'Inter', sans-serif; }
151
+ blockquote, h1, h2, h3, img, li, ol, p, ul {
152
+ margin-top: 0;
153
+ margin-bottom: 0;
154
+ }
155
+ `),c.adoptedStyleSheets=[d];const u=document.createElement("div");u.innerHTML=o,c.appendChild(u)},contentEditable:!1,onClick:()=>{a&&n({activeTab:"code"})}})]})}var LF=D5.extend({addStorage(){return{colors:new Set}}}),PF=["ltr","rtl"],jn="ltr",BF=Dp.extend({addAttributes(){var t;return ue(H({},((t=this==null?void 0:this.parent)==null?void 0:t.call(this))||{}),{textDirection:{default:jn,parseHTML:e=>e.getAttribute("data-text-direction")||e.getAttribute("dir")||jn,renderHTML(e){return!e.textDirection||e.textDirection===jn?{}:{"data-text-direction":e.textDirection,dir:e.textDirection}}},showIfKey:{default:gt,parseHTML:e=>e.getAttribute("data-show-if-key")||gt,renderHTML(e){return e.showIfKey?{"data-show-if-key":e.showIfKey}:{}}}})},addCommands(){var t;return ue(H({},(t=this.parent)==null?void 0:t.call(this)),{setTextDirection:e=>({commands:n})=>n.updateAttributes(this.name,{textDirection:e})})}}),Ob=dt.create({name:"footer",group:"block",content:"inline*",addAttributes(){return{"maily-component":{default:"footer",renderHTML:t=>({"data-maily-component":t["maily-component"]}),parseHTML:t=>t?.getAttribute("data-maily-component")},textDirection:{default:jn,parseHTML:t=>t.getAttribute("data-text-direction")||t.getAttribute("dir")||jn,renderHTML(t){return!t.textDirection||t.textDirection===jn?{}:{"data-text-direction":t.textDirection,dir:t.textDirection}}}}},addCommands(){return{setFooter:()=>({commands:t})=>t.setNode(this.name),setFooterTextDirection:t=>({commands:e})=>e.updateAttributes("footer",{textDirection:t})}},parseHTML(){return[{tag:'small[data-maily-component="footer"]'}]},renderHTML({HTMLAttributes:t}){return["small",He(this.options.HTMLAttributes,t,{class:"footer mly:block mly:text-[13px] mly:text-slate-500 mly:relative"}),0]}}),jF=Qj.extend({addAttributes(){var t;return ue(H({},(t=this.parent)==null?void 0:t.call(this)),{isUrlVariable:{default:!1}})},addCommands(){var t;return ue(H({},(t=this.parent)==null?void 0:t.call(this)),{setIsUrlVariable:e=>({chain:n})=>n().setMark("link",{isUrlVariable:e}).run()})}}),$F=Ip.extend({addAttributes(){var t;return ue(H({},((t=this==null?void 0:this.parent)==null?void 0:t.call(this))||{}),{textDirection:{default:jn,parseHTML:e=>e.getAttribute("data-text-direction")||e.getAttribute("dir")||jn,renderHTML(e){return!e.textDirection||e.textDirection===jn?{}:{"data-text-direction":e.textDirection,dir:e.textDirection}}},showIfKey:{default:gt,parseHTML:e=>e.getAttribute("data-show-if-key")||gt,renderHTML(e){return e.showIfKey?{"data-show-if-key":e.showIfKey}:{}}}})}});function FF(t){const{editor:e,getPos:n}=t;return p.jsxs(Gi,{"data-type":"repeat",draggable:e.isEditable,"data-drag-handle":e.isEditable,className:"mly:relative",children:[p.jsx(Wv,{className:"is-editable"}),p.jsxs("div",{role:"button","data-repeat-indicator":"",className:"mly:absolute mly:inset-y-0 mly:right-0 mly:flex mly:translate-x-full mly:cursor-pointer mly:flex-col mly:items-center mly:gap-1 mly:opacity-60",contentEditable:!1,onClick:()=>{e.commands.setNodeSelection(n())},children:[p.jsx(Xx,{className:"mly:size-3 mly:stroke-[2.5] mly:text-midnight-gray"}),p.jsx("div",{className:"mly:w-[1.5px] mly:grow mly:rounded-full mly:bg-rose-300"})]})]})}var bk=dt.create({name:"repeat",group:"block",content:"(block|columns)+",draggable:!0,isolating:!0,addAttributes(){return{each:{default:"items",parseHTML:t=>t.getAttribute("each")||"",renderHTML:t=>t.each?{each:t.each}:{}},isUpdatingKey:{default:!1},showIfKey:{default:gt,parseHTML:t=>t.getAttribute("data-show-if-key")||gt,renderHTML(t){return t.showIfKey?{"data-show-if-key":t.showIfKey}:{}}}}},parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML({HTMLAttributes:t}){return["div",He(t,{"data-type":this.name}),0]},addCommands(){return{setRepeat:()=>({commands:t})=>t.insertContent({type:this.name,attrs:{},content:[{type:"paragraph"}]}),updateRepeat:t=>to(this.name,t)}},addNodeView(){return qi(FF,{contentDOMElementTag:"div",className:"mly:relative"})}}),HF=ot.create({name:"maily-kit",addOptions(){return{link:{HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:"mly:no-underline"},openOnClick:!1}}},addExtensions(){const t=[h1.extend({content:"(block|columns)+"}),Cj.configure({code:{HTMLAttributes:{class:"mly:px-1 mly:relative mly:py-0.5 mly:bg-[#efefef] mly:text-sm mly:rounded-md mly:tracking-normal mly:font-normal"}},blockquote:{HTMLAttributes:{class:"mly:not-prose mly:border-l-4 mly:border-gray-300 mly:pl-4 mly:mt-4 mly:mb-4 mly:relative"}},bulletList:{HTMLAttributes:{class:"mly:relative"}},orderedList:{HTMLAttributes:{class:"mly:relative"}},heading:!1,paragraph:!1,horizontalRule:!1,dropcursor:!1,document:!1}),Nj,LF.configure({types:[Yy.name,x1.name]}),Yy.configure(),_j.configure({types:[Dp.name,Ip.name,Ob.name]}),uk,Ob,Tj,p1.configure({color:"#555",width:3,class:"ProseMirror-dropcursor"}),$F.configure({levels:[1,2,3],HTMLAttributes:{class:"mly:relative"}}),BF.configure({HTMLAttributes:{class:"mly:relative"}})];return this.options.linkCard!==!1&&t.push(mk.configure(this.options.linkCard)),this.options.repeat!==!1&&t.push(bk),this.options.section!==!1&&t.push(ek),this.options.columns!==!1&&t.push(dk),this.options.column!==!1&&t.push(R1),this.options.button!==!1&&t.push(gk),this.options.spacer!==!1&&t.push(hk),this.options.logo!==!1&&t.push(ik),this.options.image!==!1&&t.push(yk),this.options.link!==!1&&t.push(jF.configure(this.options.link)),t}}),zF=e$.configure({placeholder:({node:t})=>t.type.name==="heading"?`Heading ${t.attrs.level}`:t.type.name==="htmlCodeBlock"?"Type your HTML code...":["columns","column","section","repeat","show","blockquote"].includes(t.type.name)?"":"Write something or / to see commands",includeChildren:!0}),UF=ot.create({name:"slash-command",addOptions(){return{suggestion:{char:"/",command:({editor:t,range:e,props:n})=>{n.command({editor:t,range:e})}}}},addProseMirrorPlugins(){return[ME(H({editor:this.editor},this.options.suggestion))]}});function VF(t){var e;const{item:n,groupIndex:r,commandIndex:i,selectedGroupIndex:s,selectedCommandIndex:o,editor:a,activeCommandRef:l,selectItem:c,hoveredItemKey:d,onHover:u}=t,[f,h]=x.useState(!1),m=r===s&&i===o,g=`${r}-${i}`,y=d===g,b=n&&"commands"in n,w=!!n?.preview&&(y||m&&!d),v=typeof n.render=="function"?(e=n.render)==null?void 0:e.call(n,a):null;let E=p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"mly:flex mly:h-6 mly:w-6 mly:shrink-0 mly:items-center mly:justify-center",children:n.icon}),p.jsxs("div",{className:"mly:grow",children:[p.jsx("p",{className:"mly:font-medium",children:n.title}),p.jsx("p",{className:"mly:text-xs mly:text-gray-400",children:n.description})]}),b&&p.jsx("span",{className:"mly:block mly:px-1 mly:text-gray-400",children:p.jsx(CI,{className:"mly:size-3.5 mly:stroke-[2.5]"})})]});v!==null&&v!==!0&&(E=v);const S=x.useRef(0),C=x.useCallback(()=>{window.clearTimeout(S.current);const N=200;S.current=window.setTimeout(()=>{h(!0),S.current=0},N)},[h]);return x.useEffect(()=>{w?C():(window.clearTimeout(S.current),S.current=0,h(!1))},[w]),x.useEffect(()=>()=>{S.current&&(window.clearTimeout(S.current),S.current=0)},[]),p.jsxs(Xt,{open:f,children:[p.jsx(Zt,{asChild:!0,children:p.jsx("button",{className:Ce("mly:flex mly:w-full mly:items-center mly:gap-2 mly:rounded-md mly:px-2 mly:py-1 mly:text-left mly:text-sm mly:text-gray-900 mly:hover:bg-gray-100 mly:hover:text-gray-900",m?"mly:bg-gray-100 mly:text-gray-900":"mly:bg-transparent"),onClick:()=>c(r,i),onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),type:"button",ref:m?l:null,children:E})}),p.jsx(Kt,{side:"right",sideOffset:10,className:"mly:w-52 mly:rounded-lg mly:border-none mly:p-1 mly:shadow",children:typeof n.preview=="function"?n?.preview(a):p.jsxs(p.Fragment,{children:[p.jsx("figure",{className:"mly:relative mly:aspect-[2.5] mly:w-full mly:overflow-hidden mly:rounded-md mly:border mly:border-gray-200",children:p.jsx("img",{src:n?.preview,alt:n?.title,className:"mly:absolute mly:inset-0 mly:h-full mly:w-full mly:object-cover"})}),p.jsx("p",{className:"mly:mt-2 mly:px-0.5 mly:text-gray-500",children:n.description})]})})]},`${r}-${i}`)}function KF(t){const{groups:e,query:n,editor:r}=t,i=[...e];let s=n?.toLowerCase();const o=s.match(/^([^.]+)\./);if(o){const[l,c]=o,d=WF(e,c);if(d){const u=s.slice(l.length),f=d.commands.filter(h=>!u||Il(h,u));return f.length?[ue(H({},d),{commands:f})]:[]}}return i.map(l=>ue(H({},l),{commands:l.commands.flatMap(c=>qF({item:c,search:s,editor:r}))})).filter(l=>l.commands.length>0)}function WF(t,e){return t.flatMap(n=>n.commands).find(n=>{var r;return"commands"in n&&((r=n.id)==null?void 0:r.toLowerCase())===e.toLowerCase()})}function Ju(t,e){return t?t.toLowerCase().includes(e.toLowerCase()):!1}function Il(t,e){var n,r;return Ju(t.title,e)||Ju(t.description,e)||((r=(n=t.searchTerms)==null?void 0:n.some(i=>Ju(i,e)))!=null?r:!1)}function GF(t){return"commands"in t&&Array.isArray(t.commands)&&!!t.id}function qF(t){var e,n,r,i;const{item:s,search:o,editor:a}=t;if(((e=s?.render)==null?void 0:e.call(s,a))===null)return[];const c=o.length>0;if(GF(s)){const d=ue(H({},s),{command:h=>{const{editor:m,range:g}=h;m.chain().focus().insertContentAt(g,`/${s.id}.`).run()}});return Il(d,o)?[d]:((r=(n=d?.commands)==null?void 0:n.some(h=>Il(h,o)))!=null?r:!1)?(i=d?.commands)!=null?i:[]:[]}return!c||Il(s,o)?[s]:[]}var YF=x.forwardRef((t,e)=>{const{items:n,command:r,editor:i,range:s,query:o}=t,[a,l]=x.useState(0),[c,d]=x.useState(0),[u,f]=x.useState(null),h=x.useRef(""),m=x.useRef(0),g=x.useRef(0),y=x.useCallback((k,v)=>{const E=n[k].commands[v];E&&r(E)},[r]);x.useImperativeHandle(e,()=>({onKeyDown:({event:k})=>{var v,E,S,C;if(["ArrowUp","ArrowDown","Enter","ArrowLeft","ArrowRight"].includes(k.key)){let M=c,D=a;switch(k.key){case"ArrowLeft":k.preventDefault();const j=n?.[a];return j&&"id"in j?(i.chain().focus().insertContentAt(s,`/${h.current}`).run(),setTimeout(()=>{l(m.current),d(g.current)},0),!0):!1;case"ArrowRight":k.preventDefault();const F=(E=(v=n?.[a])==null?void 0:v.commands)==null?void 0:E[c];return F&&"commands"in F?(y(a,c),h.current=o,m.current=a,g.current=c,!0):!1;case"Enter":return n.length?(y(a,c),h.current=o,m.current=a,g.current=c,!0):!1;case"ArrowUp":return n.length?(M=c-1,D=a,M<0&&(D=a-1,M=((S=n[D])==null?void 0:S.commands.length)-1||0),D<0&&(D=n.length-1,M=((C=n[D])==null?void 0:C.commands.length)-1||0),l(D),d(M),!0):!1;case"ArrowDown":if(!n.length)return!1;const q=n[a].commands;return M=c+1,D=a,q.length-1<M&&(M=0,D=a+1),n.length-1<D&&(D=0),l(D),d(M),!0;default:return!1}}}}));const b=x.useRef(null),w=x.useRef(null);return x.useLayoutEffect(()=>{const k=b?.current,v=w?.current;if(!k||!v)return;const{offsetTop:E,offsetHeight:S}=v;k.style.transition="none",k.scrollTop=E-S},[a,c,b,w]),x.useEffect(()=>{l(0),d(0)},[n]),x.useEffect(()=>()=>{h.current="",m.current=0,g.current=0},[]),!n||n.length===0?null:p.jsx(vn,{children:p.jsxs("div",{className:"mly:z-50 mly:w-72 mly:overflow-hidden mly:rounded-md mly:border mly:border-gray-200 mly:bg-white mly:shadow-md mly:transition-all",children:[p.jsx("div",{id:"slash-command",ref:b,className:"mly:no-scrollbar mly:h-auto mly:max-h-[330px] mly:overflow-y-auto",children:n.map((k,v)=>p.jsxs(x.Fragment,{children:[p.jsx("span",{className:Ce("mly:block mly:border-b mly:border-gray-200 mly:bg-soft-gray mly:p-2 mly:text-xs mly:uppercase mly:text-gray-400",v>0?"mly:border-t":""),children:k.title}),p.jsx("div",{className:"mly:space-y-0.5 mly:p-1",children:k.commands.map((E,S)=>{const C=`${v}-${S}`;return p.jsx(VF,{item:E,groupIndex:v,commandIndex:S,selectedGroupIndex:a,selectedCommandIndex:c,selectItem:()=>y(v,S),editor:i,activeCommandRef:w,hoveredItemKey:u,onHover:N=>f(N?C:null)},C)})})]},v))}),p.jsx("div",{className:"mly:border-t mly:border-gray-200 mly:px-1 mly:py-3 mly:pl-4",children:p.jsxs("div",{className:"mly:flex mly:items-center",children:[p.jsxs("p",{className:"mly:text-center mly:text-xs mly:text-gray-400",children:[p.jsx("kbd",{className:"mly:rounded mly:border mly:border-gray-200 mly:p-1 mly:px-2 mly:font-medium",children:"↑"}),p.jsx("kbd",{className:"mly:ml-1 mly:rounded mly:border mly:border-gray-200 mly:p-1 mly:px-2 mly:font-medium",children:"↓"})," ","to navigate"]}),p.jsx("span",{"aria-hidden":"true",className:"mly:select-none mly:px-1",children:"·"}),p.jsxs("p",{className:"mly:text-center mly:text-xs mly:text-gray-400",children:[p.jsx("kbd",{className:"mly:rounded mly:border mly:border-gray-200 mly:p-1 mly:px-1.5 mly:font-medium",children:"Enter"})," ","to select"]})]})})]})})});function JF(t=Wp){return{items:({query:e,editor:n})=>KF({query:e,editor:n,groups:t}),allow:({editor:e})=>!e.isActive("htmlCodeBlock"),render:()=>{let e,n=null;return{onStart:r=>{e=new zh(YF,{props:r,editor:r.editor}),n=mi("body",{getReferenceClientRect:r.clientRect,appendTo:()=>document.body,content:e.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"top-start"})},onUpdate:r=>{var i;const s=n?.[0];!s||(i=s?.state)!=null&&i.isDestroyed||(e?.updateProps(r),s.setProps({getReferenceClientRect:r.clientRect}))},onKeyDown:r=>{var i,s;if(r.event.key==="Escape"){const o=n?.[0];return(i=o?.state)!=null&&i.isDestroyed||o?.destroy(),e?.destroy(),!0}return(s=e?.ref)==null?void 0:s.onKeyDown(r)},onExit:()=>{if(!n||!n?.[0]||!e)return;const r=n?.[0];r.state.isDestroyed||r.destroy(),e?.destroy()}}}}}var vk=x.forwardRef((t,e)=>{var n;const{items:r=[],editor:i}=t,s=x.useRef(null),o=(n=Ji(i))==null?void 0:n.variableSuggestionsPopover;return x.useImperativeHandle(e,()=>({onKeyDown:({event:a})=>{if(!s.current)return!1;const{moveUp:l,moveDown:c,select:d}=s.current||{};return a.key==="ArrowUp"?(a.preventDefault(),l(),!0):a.key==="ArrowDown"?(a.preventDefault(),c(),!0):a.key==="Enter"?(d(),!0):!1}})),p.jsx(o,{items:r,onSelectItem:a=>{var l,c;t.command({id:a.name,required:(l=a.required)!=null?l:!0,hideDefaultValue:(c=a?.hideDefaultValue)!=null?c:!1,label:a?.label})},ref:s})});vk.displayName="VariableList";function XF(t=Gp){return{char:t,items:({query:e,editor:n})=>{var r;const i=(r=K1(n))==null?void 0:r.variables;return Ta(i,{query:e,editor:n,from:"content-variable"})},render:()=>{let e,n=null;return{onStart:r=>{e=new zh(vk,{props:r,editor:r.editor}),r.clientRect&&(n=mi("body",{getReferenceClientRect:r.clientRect,appendTo:()=>document.body,content:e.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"}))},onUpdate(r){var i;e.updateProps(r),r.clientRect&&((i=n?.[0])==null||i.setProps({getReferenceClientRect:r.clientRect}))},onKeyDown(r){var i;return r.event.key==="Escape"?(n?.[0].hide(),!0):(i=e.ref)==null?void 0:i.onKeyDown(r)},onExit(){!n||!n?.[0]||!e||(n?.[0].destroy(),e.destroy())}}}}}var xk=O5(_5);xk.register("html",YE);var wk=o4.extend({name:"htmlCodeBlock",content:"(text|variable)*",addAttributes(){var t;return ue(H({},(t=this.parent)==null?void 0:t.call(this)),{activeTab:"code",showIfKey:{default:gt,parseHTML:e=>e.getAttribute("data-show-if-key")||gt,renderHTML(e){return e.showIfKey?{"data-show-if-key":e.showIfKey}:{}}}})},addNodeView(){return qi(DF,{className:"mly:relative",attrs:({node:t})=>{var e;return{"data-active-tab":((e=t?.attrs)==null?void 0:e.activeTab)||"code"}}})},addCommands(){return{setHtmlCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleHtmlCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t),updateHtmlCodeBlock:t=>to(this.name,t)}},addKeyboardShortcuts(){var t;return ue(H({},(t=this.parent)==null?void 0:t.call(this)),{"Mod-a":({editor:e})=>{const{selection:n}=e.state,r=n.$anchor;if(r.node(r.depth).type.name!==this.name)return!1;let s=r.depth;for(let d=s;d>0;d--)if(r.node(d).type.name===this.name){s=d;break}const o=r.before(s)+1,a=r.after(s)-1,l=e.state.doc.resolve(o),c=e.state.doc.resolve(a);if(l&&c){const d=e.state.tr.setSelection(ye.between(l,c));return e.view.dispatch(d),!0}return!1}})}}).configure({lowlight:xk}),ZF=(t,e)=>[uk.name,Cp.name,hk.name,yk.name,lk.name,mk.name,ik.name,gk.name,wk.name,ck.name].some(r=>t.isActive(r));function QF(t){return p.jsxs("svg",ue(H({xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},t),{children:[p.jsx("path",{d:"M11 5h6"}),p.jsx("path",{d:"M11 5v14"}),p.jsx("path",{d:"M15 5v14"}),p.jsx("path",{d:"M6 18l-3-3 3-3"}),p.jsx("path",{d:"M3 15h5"})]}))}function eH(t){return p.jsxs("svg",ue(H({xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},t),{children:[p.jsx("path",{d:"M8 5h6"}),p.jsx("path",{d:"M10 5v14"}),p.jsx("path",{d:"M14 5v14"}),p.jsx("path",{d:"M18 18l3-3-3-3"}),p.jsx("path",{d:"M16 15h5"})]}))}function tH(t){const{direction:e,onDirectionChange:n}=t,r=PF.includes(e)?e:"ltr",i={ltr:{icon:QF,tooltip:"Left to Right",onClick:()=>{n("ltr")}},rtl:{icon:eH,tooltip:"Right to Left",onClick:()=>{n("rtl")}}},s=i[r];return p.jsxs(On,{children:[p.jsxs(Xt,{children:[p.jsx(Zt,{asChild:!0,children:p.jsx(Rn,{className:Ce("mly:flex mly:size-7 mly:items-center mly:justify-center mly:gap-1 mly:rounded-md mly:px-1.5 mly:text-sm mly:data-[state=open]:bg-soft-gray mly:hover:bg-soft-gray mly:focus-visible:relative mly:focus-visible:z-10 mly:focus-visible:outline-hidden mly:focus-visible:ring-2 mly:focus-visible:ring-gray-400 mly:focus-visible:ring-offset-2"),children:p.jsx(s.icon,{className:"mly:h-3 mly:w-3 mly:stroke-[2.5]"})})}),p.jsx(Kt,{sideOffset:8,children:"Text Direction"})]}),p.jsx(xn,{className:"mly:flex mly:w-max mly:gap-0.5 mly:rounded-lg mly:p-0.5!",side:"top",sideOffset:8,align:"center",onOpenAutoFocus:o=>{o.preventDefault()},onCloseAutoFocus:o=>{o.preventDefault()},children:Object.entries(i).map(([o,a])=>p.jsx(Bn,{icon:a.icon,tooltip:a.tooltip,command:a.onClick,isActive:()=>o===r},o))})]})}var nH="#374151",rH=t=>cr({editor:t,selector:n=>{var r,i,s,o,a,l,c,d,u,f,h,m;return{currentTextColor:n.editor.getAttributes("textStyle").color||nH,linkUrl:(r=n.editor)==null?void 0:r.getAttributes("link").href,textAlign:(i=n.editor)!=null&&i.isActive({textAlign:"left"})?"left":(s=n.editor)!=null&&s.isActive({textAlign:"center"})?"center":(o=n.editor)!=null&&o.isActive({textAlign:"right"})?"right":(a=n.editor)!=null&&a.isActive({textAlign:"justify"})?"justify":"left",textDirection:((l=n.editor.getAttributes("paragraph"))==null?void 0:l.textDirection)||((c=n.editor.getAttributes("heading"))==null?void 0:c.textDirection)||((d=n.editor.getAttributes("footer"))==null?void 0:d.textDirection)||jn,isFooterActive:n.editor.isActive("footer"),footerTextDirection:((u=n.editor.getAttributes("footer"))==null?void 0:u.textDirection)||jn,isListActive:n.editor.isActive("bulletList")||n.editor.isActive("orderedList"),isUrlVariable:(f=n.editor.getAttributes("link").isUrlVariable)!=null?f:!1,isHeadingActive:n.editor.isActive("heading"),headingShowIfKey:((h=n.editor.getAttributes("heading"))==null?void 0:h.showIfKey)||"",isParagraphActive:n.editor.isActive("paragraph"),paragraphShowIfKey:((m=n.editor.getAttributes("paragraph"))==null?void 0:m.showIfKey)||""}},equalityFn:gi});function Ek(t){var e,n,r,i;const{editor:s,showListMenu:o=!0}=t,a=rH(s),l=s?.storage.color.colors,c=(r=(n=(e=Array?.from(l))==null?void 0:e.reverse())==null?void 0:n.slice(0,6))!=null?r:[],d=[{name:"bold",isActive:()=>s?.isActive("bold"),command:()=>s?.chain().focus().toggleBold().run(),icon:jx,tooltip:"Bold"},{name:"italic",isActive:()=>s?.isActive("italic"),command:()=>s?.chain().focus().toggleItalic().run(),icon:qx,tooltip:"Italic"},{name:"underline",isActive:()=>s?.isActive("underline"),command:()=>s?.chain().focus().toggleUnderline().run(),icon:ew,tooltip:"Underline"},{name:"strike",isActive:()=>s?.isActive("strike"),command:()=>s?.chain().focus().toggleStrike().run(),icon:Zx,tooltip:"Strikethrough"},{name:"code",isActive:()=>s?.isActive("code"),command:()=>s?.chain().focus().toggleCode().run(),icon:MI,tooltip:"Code"}];return p.jsxs(p.Fragment,{children:[d.map((u,f)=>p.jsx(Bn,H({},u),f)),p.jsx(Id,{alignment:a.textAlign,onAlignmentChange:u=>{s?.chain().focus().setTextAlign(u).run()}}),p.jsx(tH,{direction:a.textDirection,onDirectionChange:u=>{a.isFooterActive?s?.chain().focus().setFooterTextDirection(u).run():a.isHeadingActive?s?.chain().focus().updateAttributes("heading",{textDirection:u}).run():s?.chain().focus().setTextDirection(u).run()}}),!a.isListActive&&o&&p.jsxs(p.Fragment,{children:[p.jsx(Bn,{icon:op,command:()=>{s.chain().focus().toggleBulletList().run()},tooltip:"Bullet List"}),p.jsx(Bn,{icon:sp,command:()=>{s.chain().focus().toggleOrderedList().run()},tooltip:"Ordered List"})]}),p.jsx(Ks,{defaultValue:(i=a?.linkUrl)!=null?i:"",onValueChange:(u,f)=>{if(!u){s?.chain().focus().extendMarkRange("link").unsetLink().unsetUnderline().run();return}s?.chain().extendMarkRange("link").setLink({href:u}).setIsUrlVariable(f??!1).setUnderline().run()},tooltip:"External URL",editor:s,isVariable:a.isUrlVariable}),p.jsx(rt,{}),p.jsx(ma,{color:a.currentTextColor,onColorChange:u=>{s?.chain().setColor(u).run()},tooltip:"Text Color",suggestedColors:c,children:p.jsx(on,{variant:"ghost",size:"sm",type:"button",className:"mly:h-7 mly:w-7 mly:shrink-0 mly:p-0",children:p.jsxs("div",{className:"mly:flex mly:flex-col mly:items-center mly:justify-center mly:gap-px",children:[p.jsx("span",{className:"mly:font-bolder mly:font-mono mly:text-xs mly:text-slate-700",children:"A"}),p.jsx("div",{className:"mly:h-[2px] mly:w-3",style:{backgroundColor:a.currentTextColor}})]})})})]})}var iH=t=>t.type==="option",sH=t=>t.type==="category";function oH(t){const{options:e}=t,n=x.useMemo(()=>e.find(i=>i.type==="option"&&i.isActive()),[e]),{icon:r=Yx}=n||{};return p.jsxs(On,{children:[p.jsxs(Xt,{children:[p.jsx(Zt,{asChild:!0,children:p.jsxs(Rn,{className:Ce("mly:flex mly:aspect-square mly:h-7 mly:items-center mly:justify-center mly:gap-1 mly:rounded-md mly:px-1.5 mly:text-sm mly:data-[state=open]:bg-soft-gray mly:hover:bg-soft-gray mly:focus-visible:relative mly:focus-visible:z-10 mly:focus-visible:outline-hidden mly:focus-visible:ring-2 mly:focus-visible:ring-gray-400 mly:focus-visible:ring-offset-2"),children:[p.jsx(r,{className:"mly:h-3 mly:w-3 mly:shrink-0 mly:stroke-[2.5]"}),p.jsx($x,{className:"mly:h-3 mly:w-3 mly:shrink-0 mly:stroke-[2.5]"})]})}),p.jsx(Kt,{sideOffset:8,children:"Turn into"})]}),p.jsx(xn,{align:"start",side:"bottom",sideOffset:8,className:"mly:flex mly:w-[160px] mly:flex-col mly:rounded-md mly:p-1",children:e.map((i,s)=>{if(iH(i))return p.jsxs(on,{onClick:i.onClick,variant:"ghost",className:"mly:mb-0.5 mly:h-auto mly:justify-start mly:gap-2 mly:rounded! mly:px-2 mly:py-1 mly:text-sm mly:font-normal mly:text-midnight-gray",children:[p.jsx(i.icon,{className:"mly:size-[15px] mly:shrink-0"}),i.label]},i.id);if(sH(i))return p.jsx("label",{className:Ce("mly:px-2 mly:text-xs mly:font-medium mly:text-midnight-gray/60",s===0?"mly:mb-2 mly:mt-1":"mly:my-2"),children:i.label},i.id)})})]})}function aH(t){return cr({editor:t,selector:({editor:e})=>[{type:"category",label:"Hierarchy",id:"hierarchy"},{icon:Yx,onClick:()=>e.chain().focus().liftListItem("listItem").setParagraph().run(),id:"paragraph",disabled:()=>!e.can().setParagraph(),isActive:()=>e.isActive("paragraph")&&!e.isActive("orderedList")&&!e.isActive("bulletList")&&!e.isActive("taskList"),label:"Paragraph",type:"option"},{icon:rp,onClick:()=>e.chain().focus().liftListItem("listItem").setHeading({level:1}).run(),id:"heading1",disabled:()=>!e.can().setHeading({level:1}),isActive:()=>e.isActive("heading",{level:1}),label:"Heading 1",type:"option"},{icon:Vx,onClick:()=>e.chain().focus().liftListItem("listItem").setHeading({level:2}).run(),id:"heading2",disabled:()=>!e.can().setHeading({level:2}),isActive:()=>e.isActive("heading",{level:2}),label:"Heading 2",type:"option"},{icon:Kx,onClick:()=>e.chain().focus().liftListItem("listItem").setHeading({level:3}).run(),id:"heading3",disabled:()=>!e.can().setHeading({level:3}),isActive:()=>e.isActive("heading",{level:3}),label:"Heading 3",type:"option"},{id:"footer",type:"option",label:"Footer",icon:np,onClick:()=>{e.chain().focus().liftListItem("listItem").setFooter().run()},disabled:()=>!e.can().setFooter(),isActive:()=>e.isActive("footer")},{type:"category",label:"Lists",id:"lists"},{icon:op,onClick:()=>e.chain().focus().toggleBulletList().run(),id:"bulletList",disabled:()=>!e.can().toggleBulletList(),isActive:()=>e.isActive("bulletList"),label:"Bullet list",type:"option"},{icon:sp,onClick:()=>e.chain().focus().toggleOrderedList().run(),id:"orderedList",disabled:()=>!e.can().toggleOrderedList(),isActive:()=>e.isActive("orderedList"),label:"Numbered list",type:"option"}]})}function lH(t){const{editor:e,appendTo:n}=t;if(!e)return null;const r=ue(H(H({},t),n?{appendTo:n.current}:{}),{pluginKey:"text-menu",shouldShow:({editor:s,from:o,view:a})=>{var l;if(!a||s.view.dragging)return!1;const c=a.domAtPos(o||0).node,u=a.nodeDOM(o||0)||c;if(ZF(s)||!s.isEditable)return!1;const h=[bk.name,ek.name,dk.name,R1.name].some(m=>s.isActive(m))&&((l=u?.classList)==null?void 0:l.contains("ProseMirror-selectednode"));return Rd(s)&&!h},tippyOptions:{popperOptions:{placement:"top-start",modifiers:[{name:"preventOverflow",options:{boundary:"viewport",padding:8}},{name:"flip",options:{fallbackPlacements:["bottom-start","top-end","bottom-end"]}}]},maxWidth:"100%"}}),i=aH(e);return p.jsx(Ir,ue(H({},r),{className:"mly:flex mly:gap-0.5 mly:rounded-lg mly:border mly:border-gray-200 mly:bg-white mly:p-0.5 mly:shadow-md",children:p.jsxs(vn,{children:[p.jsx(oH,{options:i}),p.jsx(rt,{className:"mly:mx-0"}),p.jsx(Ek,{editor:e})]})}))}function cH(t){const{editor:e,appendTo:n}=t;if(!e)return null;const r=ue(H({},t),{pluginKey:"variable-menu",shouldShow:({editor:i})=>{var s;return i.isActive("variable")&&!((s=i.storage.variable)!=null&&s.popover)},tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},plugins:[Wi],sticky:"popper",maxWidth:"100%",appendTo:()=>n?.current||"parent",placement:"top-start"}});return p.jsx(Ir,ue(H({},r),{className:"mly:flex mly:gap-0.5 mly:rounded-lg mly:border mly:border-slate-200 mly:bg-white mly:p-0.5 mly:shadow-md",children:p.jsx(vn,{children:p.jsx(Ek,{showListMenu:!1,editor:e})})}))}var dH=ot.create({name:"selection",addProseMirrorPlugins(){const{editor:t}=this;return[new Ze({key:new Ge("selection"),props:{decorations(e){return e.selection.empty||t.isFocused===!0?null:nt.create(e.doc,[jt.inline(e.selection.from,e.selection.to,{class:"selection mly:bg-blue-200 mly:inline mly:py-1"})])}}})]}});function uH(t){const{blocks:e,extensions:n=[]}=t;return[...[HF,UF.configure({suggestion:JF(e)}),lk.configure({suggestion:XF()}),wk,ck,zF,dH].filter(i=>!n.some(s=>s.name===i.name)),...n]}function Rb(t){var e,n;const r=[t];for(;r.length;){const i=r.pop();if(i){if(i.type==="for"&&(i.type="repeat"),i.type==="spacer"){let s=(e=i.attrs)==null?void 0:e.height;typeof s=="string"&&["sm","md","lg","xl"].includes(s)&&(s=((n=pa.find(o=>o.short===s))==null?void 0:n.value)||fk),i.attrs=ue(H({},i.attrs),{height:s})}i.content&&r.push(...i.content)}}return t}function fH(t){const{config:{wrapClassName:e="",contentClassName:n="",bodyClassName:r="",hasMenuBar:i=!0,hideContextMenu:s=!1,spellCheck:o=!1,autofocus:a="end",immediatelyRender:l=!1}={},onCreate:c,onUpdate:d,extensions:u,contentHtml:f,contentJson:h,blocks:m=Wp,editable:g=!0,placeholderUrl:y=Dd,scrollThreshold:b=40,scrollMargin:w=40}=t,k=x.useMemo(()=>{if(h){const S=h?.type==="doc"?h:{type:"doc",content:h};return Rb(S)}else return f||{type:"doc",content:[{type:"paragraph",content:[]}]}},[f,h,Rb]),v=x.useRef(null),E=jM({editorProps:{scrollThreshold:b,scrollMargin:w,attributes:{class:Ce("mly:prose mly:w-full",n),spellCheck:o?"true":"false"}},immediatelyRender:l,onCreate:({editor:S})=>{c?.(S)},onUpdate:({editor:S})=>{d?.(S)},extensions:uH({extensions:u,blocks:m}),content:k,autofocus:a,editable:g});return E?p.jsx(eF,{placeholderUrl:y,children:p.jsxs("div",{id:"mly-editor",className:Ce("mly-editor mly:antialiased",E.isEditable?"mly-editable":"mly-not-editable",e),ref:v,children:[i&&p.jsx(n9,{config:t.config,editor:E}),p.jsxs("div",{className:Ce("mly:mt-4 mly:rounded mly:border mly:border-gray-200 mly:bg-white mly:p-4",r),children:[p.jsx(lH,{editor:E,appendTo:v}),p.jsx(lF,{editor:E,appendTo:v}),p.jsx(vF,{editor:E,appendTo:v}),p.jsx(AM,{editor:E}),p.jsx(yF,{editor:E,appendTo:v}),p.jsx(q$,{editor:E,appendTo:v}),!s&&p.jsx(t9,{editor:E}),p.jsx(cH,{editor:E,appendTo:v}),p.jsx(fF,{editor:E,appendTo:v}),p.jsx(i9,{editor:E,appendTo:v}),p.jsx(dF,{editor:E,appendTo:v})]})]})}):null}function Ib({value:t,onChange:e,paths:n,className:r,placeholder:i}){const s=K.useRef(null),[o,a]=K.useState(null),l=K.useMemo(()=>{if(!o)return[];const f=o.query.toLowerCase();return n.filter(h=>h.path.toLowerCase().includes(f)).slice(0,8)},[o,n]);function c(f,h){if(e(f),h==null){a(null);return}const m=f.slice(0,h),g=m.lastIndexOf("{{");if(g===-1||m.slice(g).includes("}}")){a(null);return}const y=m.slice(g+2).trimStart();if(/[{}]/.test(y)){a(null);return}a({anchor:g,query:y,selected:0})}function d(f){if(!o)return;const h=s.current,m=h?.selectionStart??t.length,g=t.slice(0,o.anchor),y=t.slice(m),b=`{{${f.path}}}`,w=`${g}${b}${y}`;e(w),a(null),requestAnimationFrame(()=>{const k=g.length+b.length;h?.setSelectionRange(k,k),h?.focus()})}function u(f){!o||l.length===0||(f.key==="ArrowDown"?(f.preventDefault(),a({...o,selected:(o.selected+1)%l.length})):f.key==="ArrowUp"?(f.preventDefault(),a({...o,selected:(o.selected-1+l.length)%l.length})):f.key==="Enter"||f.key==="Tab"?(f.preventDefault(),d(l[Math.min(o.selected,l.length-1)])):f.key==="Escape"&&(f.preventDefault(),a(null)))}return p.jsxs("div",{style:{position:"relative"},children:[p.jsx("input",{ref:s,className:r??"input",value:t,placeholder:i,onChange:f=>c(f.target.value,f.target.selectionStart),onKeyDown:u,onBlur:()=>setTimeout(()=>a(null),150),onClick:f=>c(t,f.target.selectionStart)}),o&&l.length>0&&p.jsx("div",{className:"card",role:"listbox",style:{position:"absolute",top:"100%",left:0,right:0,zIndex:40,marginTop:4,maxHeight:240,overflow:"auto",padding:4,boxShadow:"0 8px 24px rgba(0,0,0,0.18)"},children:l.map((f,h)=>p.jsxs("div",{role:"option","aria-selected":h===o.selected,onMouseDown:m=>{m.preventDefault(),d(f)},onMouseEnter:()=>a({...o,selected:h}),style:{display:"flex",justifyContent:"space-between",gap:12,padding:"6px 8px",borderRadius:4,cursor:"pointer",background:h===o.selected?"var(--bg-sunken)":"transparent"},children:[p.jsx("span",{className:"mono text-xs",children:`{{${f.path}}}`}),p.jsx("span",{className:"text-xs subtle",children:f.type})]},f.path))})]})}const hH=[{path:"unsubscribeUrl",type:"string",description:"One-click unsubscribe link (required in marketing templates)"},{path:"event",type:"object",description:"Properties of the event that triggered the flow run, e.g. event.accountId"},{path:"senderAddress",type:"string",description:"Configured postal address (CAN-SPAM)"},{path:"contact.email",type:"string"},{path:"contact.externalId",type:"string"},{path:"contact.timezone",type:"string"},{path:"contact.locale",type:"string"}],pH=5;function mH(t){if(!t)return[];const e=[];return oh(t,"",e,0),e}function oh(t,e,n,r){if(!t||typeof t!="object"||r>pH)return;const i=t,s=i.anyOf??i.oneOf;if(Array.isArray(s)){const o=s.some(c=>c&&c.type==="null"),a=s.find(c=>c&&(c.type==="object"||c.properties));if(a){e&&n.push({path:e,type:o?"object | null":"object",description:i.description}),oh(a,e,n,r);return}const l=s.map(c=>Dl(c)).filter(Boolean);e&&n.push({path:e,type:Array.from(new Set(l)).join(" | "),description:i.description});return}if(i.type==="object"||i.properties){if(e&&!i.properties){n.push({path:e,type:"object",description:i.description});return}for(const[o,a]of Object.entries(i.properties??{})){const l=e?`${e}.${o}`:o,c=a;c&&(c.type==="object"||c.properties||Array.isArray(c.anyOf??c.oneOf))?oh(c,l,n,r+1):n.push({path:l,type:Dl(c),description:c?.description})}return}e&&n.push({path:e,type:Dl(i),description:i.description})}function Dl(t){if(!t||typeof t!="object")return"unknown";if(t.type==="array"){const e=Dl(t.items);return e==="unknown"?"array":`${e}[]`}return Array.isArray(t.type)?t.type.join(" | "):t.enum?t.enum.map(e=>JSON.stringify(e)).join(" | "):typeof t.type=="string"?t.type:"unknown"}const gH={type:"doc",content:[{type:"paragraph"}]};function _H({slug:t}){const{data:e,loading:n,error:r,refetch:i}=ch(()=>kn.template(t),[t]);return p.jsx(Uk,{loading:n&&!e,error:r,empty:!e,emptyLabel:"Template not found.",retry:i,children:e&&p.jsx(yH,{tpl:e,slug:t,refetch:i})})}function yH({tpl:t,slug:e,refetch:n}){const[r,i]=K.useState("design"),[s,o]=K.useState(gH),[a,l]=K.useState(t.draft?.subject??t.subject??""),[c,d]=K.useState(t.draft?.preheader??t.preheader??""),[u,f]=K.useState(t.draft?.fromName??t.fromName??""),[h,m]=K.useState(t.draft?.fromEmail??t.fromEmail??""),[g,y]=K.useState(t.draft?.replyTo??t.replyTo??""),[b,w]=K.useState(t.bodyFormat??"multipart"),[k,v]=K.useState(!1),[E,S]=K.useState(""),[C,N]=K.useState(!1),M=K.useRef(null),D=K.useRef(!1),[j,B]=K.useState(!1),{data:F}=ch(()=>kn.varsSchema(),[]),G=K.useMemo(()=>[...mH(F?.schema??null),...hH],[F]),[q,W]=K.useState(null),[A,T]=K.useState(null),[P,Y]=K.useState([]),[te,pe]=K.useState(void 0),[Q,X]=K.useState(null),[ne,Ee]=K.useState(!1),[be,Be]=K.useState(!1),[Ie,Le]=K.useState(""),[ze,Pe]=K.useState(null),[je,ut]=K.useState(!1);async function bt(I){Ee(!0);try{const re=await kn.previewTemplate(e,{useDraft:!0,contactId:I});W(re),T(null)}catch(re){T(String(re?.message??re))}finally{Ee(!1)}}async function ge(){T(null),S("Generating preview…");try{let I=P;if(I.length===0){const re=await kn.contacts();I=re.contacts,Y(re.contacts),pe(re.nextCursor)}I.length>0?(X(0),await bt(String(I[0].externalId))):(X(null),await bt()),S("")}catch(I){T(String(I?.message??I)),S("")}}const at=K.useCallback(async I=>{if(ne||I<0)return;let re=P;if(I>=re.length){if(!te)return;const Re=await kn.contacts(te);if(re=[...re,...Re.contacts],Y(re),pe(Re.nextCursor),I>=re.length)return}X(I),await bt(String(re[I].externalId))},[ne,P,te,e]);K.useEffect(()=>{if(!q||Q==null)return;function I(re){re.key==="ArrowRight"?(re.preventDefault(),at(Q+1)):re.key==="ArrowLeft"&&(re.preventDefault(),at(Q-1))}return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[q,Q,at]);async function st(){if(!(!Ie.trim()||je)){ut(!0),Pe("Sending…");try{const I=Q!=null&&P[Q]?String(P[Q].externalId):void 0;await kn.sendTestTemplate(e,{to:Ie.trim(),contactId:I}),Pe(`Sent test to ${Ie.trim()}`)}catch(I){Pe(`Failed: ${I?.message??I}`)}finally{ut(!1)}}}const de=t.kind??"marketing",At=t.name??e,Fe=t.slug??e,Me=t.body?.mjml??t.draft?.mjml??"",Mt=t.body?.plainText??"",qe=bH(e,{subject:a,preheader:c,editorJson:j?s:null,fromEmail:h||t.fromEmail,kind:de}),en=(qe.data?.errors.length??0)>0;K.useEffect(()=>{if(D.current)return;D.current=!0;const I=t.draft?.editorJson??t.body?.editorJson;I&&(o(I),B(!0))},[t]);async function Ot(){S("Saving draft…"),await kn.updateTemplateDraft(e,{subject:a,preheader:c,...j?{editorJson:s}:Me?{mjml:Me}:{},fromName:u||void 0,fromEmail:h||void 0,replyTo:g||void 0,bodyFormat:b})}async function U(){N(!0);try{await Ot(),S("Publishing…");const I=await kn.publishTemplate(e);S(`Published v${I.version}`),v(!1),n()}catch(I){S(`Error: ${I?.message??String(I)}`)}finally{N(!1)}}return p.jsxs(p.Fragment,{children:[p.jsx(Vk,{title:At,desc:p.jsxs(p.Fragment,{children:[p.jsxs("span",{className:"mono",children:["templates/",Fe]})," · ",p.jsx("span",{className:"pill "+(de==="transactional"?"blue":"neutral"),style:{marginLeft:4},children:de})]}),actions:p.jsxs(p.Fragment,{children:[p.jsxs("button",{className:"btn",onClick:ge,children:[p.jsx(yl.Eye,{size:14}),"Preview"]}),p.jsxs("button",{className:"btn",onClick:()=>{Be(!0),Pe(null)},children:[p.jsx(yl.Send,{size:14}),"Test send"]}),p.jsxs("button",{className:"btn btn-primary",disabled:C||en,onClick:U,title:en?"Resolve content-lint errors before publishing.":void 0,children:[p.jsx(yl.Rocket,{size:14}),"Publish"]}),qe.data&&p.jsx("span",{className:"text-xs subtle",style:{marginLeft:8},children:p.jsx(kk,{data:qe.data})}),E&&p.jsx("span",{className:"text-xs subtle",style:{marginLeft:8},children:E})]})}),p.jsxs("div",{className:"split split-asym",style:{gap:16},children:[p.jsxs("div",{className:"card",style:{overflow:"hidden"},children:[p.jsxs("div",{className:"card-head",children:[p.jsxs("div",{className:"seg",children:[p.jsx("span",{className:"seg-item"+(r==="design"?" active":""),onClick:()=>i("design"),children:"Design"}),p.jsx("span",{className:"seg-item"+(r==="source"?" active":""),onClick:()=>i("source"),children:"MJML"}),p.jsx("span",{className:"seg-item"+(r==="plaintext"?" active":""),onClick:()=>i("plaintext"),children:"Plain text"})]}),p.jsx("div",{className:"card-actions",children:p.jsx("span",{className:"text-xs subtle",children:k?"Unsaved changes":E.startsWith("Published")||E==="Saved"?E:""})})]}),p.jsxs("div",{style:{padding:16},children:[p.jsxs("div",{className:"field",children:[p.jsx("label",{className:"field-label",children:"Subject"}),p.jsx(Ib,{value:a,paths:G,onChange:I=>{l(I),v(!0)}})]}),p.jsxs("div",{className:"field",children:[p.jsx("label",{className:"field-label",children:"Preheader"}),p.jsx(Ib,{value:c,paths:G,onChange:I=>{d(I),v(!0)}})]})]}),r==="design"&&p.jsx("div",{className:"maily-host",style:{padding:16,background:"var(--bg-sunken)",minHeight:480},children:p.jsx(fH,{contentJson:s,onCreate:I=>{M.current=I},onUpdate:I=>{M.current=I,o(I.getJSON()),B(!0),v(!0)},config:{hasMenuBar:!0,contentClassName:"mly-content",wrapClassName:"mly-wrap",bodyClassName:"mly-body",spellCheck:!0}})}),r==="source"&&p.jsx("pre",{className:"code",style:{margin:16,padding:16,maxHeight:520,overflow:"auto",whiteSpace:"pre-wrap"},children:Me||"/* No MJML stored for this template (Maily-authored). Switch to Design to edit. */"}),r==="plaintext"&&p.jsx("pre",{className:"code",style:{margin:16,padding:16,maxHeight:520,overflow:"auto",whiteSpace:"pre-wrap"},children:Mt||"/* Plain text is auto-derived on publish. */"})]}),p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[p.jsx(xH,{lint:qe}),p.jsx(vH,{paths:G,hasSchema:!!F?.schema}),p.jsx(wH,{slug:e,refetchTemplate:n}),p.jsxs("div",{className:"card",children:[p.jsx("div",{className:"card-head",children:p.jsx("span",{className:"card-title",children:"Sender"})}),p.jsxs("div",{className:"card-body",children:[p.jsxs("div",{className:"field",children:[p.jsx("label",{className:"field-label",children:"From name"}),p.jsx("input",{className:"input",value:u,placeholder:"(default from mailer config)",onChange:I=>{f(I.target.value),v(!0)}})]}),p.jsxs("div",{className:"field",children:[p.jsx("label",{className:"field-label",children:"From email"}),p.jsx("input",{className:"input",value:h,placeholder:"(default from mailer config)",onChange:I=>{m(I.target.value),v(!0)}})]}),p.jsxs("div",{className:"field",children:[p.jsx("label",{className:"field-label",children:"Reply-to"}),p.jsx("input",{className:"input",value:g,placeholder:"(same as From)",onChange:I=>{y(I.target.value),v(!0)}})]}),p.jsxs("div",{className:"field",style:{marginBottom:0},children:[p.jsx("label",{className:"field-label",children:"Body format"}),p.jsxs("select",{className:"select",value:b,onChange:I=>{w(I.target.value),v(!0)},children:[p.jsx("option",{value:"multipart",children:"HTML + plain text"}),p.jsx("option",{value:"text_only",children:"Plain text only"})]}),p.jsx("div",{className:"text-xs subtle",style:{marginTop:4},children:b==="text_only"?"Sends the text part alone, so it reads as if typed by a person. No opens or clicks can be recorded.":"Standard: HTML with a plain-text alternative. Opens and clicks are tracked."})]})]})]})]})]}),q&&p.jsxs(Zu,{onClose:()=>{W(null),X(null)},title:"Preview",children:[Q!=null&&P.length>0&&p.jsxs("div",{className:"hstack",style:{gap:8,alignItems:"center",marginBottom:10},children:[p.jsx("button",{className:"btn btn-xs",disabled:ne||Q===0,onClick:()=>at(Q-1),title:"Previous contact (←)",children:"←"}),p.jsx("span",{className:"text-xs mono",children:q.contact?.email??P[Q]?.email}),p.jsxs("span",{className:"text-xs subtle",children:[Q+1," / ",P.length,te?"+":""]}),p.jsx("button",{className:"btn btn-xs",disabled:ne,onClick:()=>at(Q+1),title:"Next contact (→)",children:"→"}),ne&&p.jsx("span",{className:"text-xs subtle",children:"Rendering…"})]}),p.jsx("div",{className:"text-sm f500",children:q.subject}),p.jsx("div",{className:"text-xs subtle",style:{marginBottom:8},children:q.preheader}),p.jsx("iframe",{title:"preview",sandbox:"",srcDoc:q.html,style:{width:"100%",minHeight:480,border:"1px solid var(--border)",borderRadius:6,background:"#fff"}})]}),A&&p.jsx(Zu,{onClose:()=>T(null),title:"Preview failed",children:p.jsx("div",{className:"text-sm",style:{color:"var(--red-fg)"},children:A})}),be&&p.jsx(Zu,{onClose:()=>Be(!1),title:"Send test email",children:p.jsxs("div",{className:"vstack",style:{gap:12},children:[p.jsxs("div",{className:"field",style:{marginBottom:0},children:[p.jsx("label",{className:"field-label",children:"To"}),p.jsx("input",{className:"input",type:"email",placeholder:"you@example.com",value:Ie,onChange:I=>Le(I.target.value)}),p.jsx("div",{className:"field-hint",children:"Uses the published version (publish first if you want to test recent edits)."})]}),ze&&p.jsx("div",{className:"text-xs",children:ze}),p.jsxs("div",{className:"hstack",style:{gap:8},children:[p.jsx("button",{className:"btn btn-primary",onClick:st,disabled:!Ie.trim()||je,children:je?"Sending…":"Send"}),p.jsx("button",{className:"btn",onClick:()=>Be(!1),children:"Close"})]})]})})]})}function bH(t,e){const[n,r]=K.useState({data:null,loading:!1,error:null}),i=JSON.stringify(e),s=K.useRef(e);return s.current=e,K.useEffect(()=>{const o=new AbortController;r(l=>({...l,loading:!0}));const a=setTimeout(async()=>{try{const l=await kn.lintTemplate(t,s.current,o.signal);r({data:l,loading:!1,error:null})}catch(l){if(l?.name==="AbortError")return;r(c=>({data:c.data,loading:!1,error:String(l?.message??l)}))}},500);return()=>{o.abort(),clearTimeout(a)}},[i,t]),n}function vH({paths:t,hasSchema:e}){const[n,r]=K.useState(null);function i(s){navigator.clipboard?.writeText(`{{${s}}}`),r(s),setTimeout(()=>r(o=>o===s?null:o),1200)}return p.jsxs("div",{className:"card",children:[p.jsxs("div",{className:"card-head",children:[p.jsx("span",{className:"card-title",children:"Variables"}),p.jsx("span",{className:"card-sub",children:e?"Click to copy":"Built-ins only"})]}),p.jsxs("div",{className:"card-body",style:{padding:0},children:[!e&&p.jsxs("div",{className:"text-xs subtle",style:{padding:12},children:["No ",p.jsx("code",{children:"varsAdapter"})," configured — define one with ",p.jsx("code",{children:"defineVars()"})," in ",p.jsx("code",{children:"Mailer.init"})," to expose host data (","{{user.name}}",", …) to templates."]}),p.jsx("div",{style:{maxHeight:280,overflow:"auto"},children:t.map(s=>p.jsxs("div",{onClick:()=>i(s.path),title:s.description??`{{${s.path}}}`,style:{display:"flex",justifyContent:"space-between",gap:12,cursor:"pointer",padding:"6px 12px",borderTop:"1px solid var(--border)"},children:[p.jsx("span",{className:"mono text-xs",children:n===s.path?"Copied!":`{{${s.path}}}`}),p.jsx("span",{className:"text-xs subtle",children:s.type})]},s.path))})]})]})}function kk({data:t}){const{errors:e,warnings:n,infos:r}=t;return e.length+n.length+r.length===0?p.jsxs("span",{style:{color:"var(--green-fg)"},children:[p.jsx("span",{className:"dot"}),"Lint: clean"]}):p.jsxs("span",{className:"hstack",style:{gap:6},children:[e.length>0&&p.jsxs("span",{style:{color:"var(--red-fg)"},children:[e.length," error",e.length===1?"":"s"]}),n.length>0&&p.jsxs("span",{style:{color:"var(--amber-fg)"},children:[n.length," warning",n.length===1?"":"s"]}),r.length>0&&p.jsxs("span",{style:{color:"var(--fg-muted)"},children:[r.length," info"]})]})}function xH({lint:t}){const e=t.data;return p.jsxs("div",{className:"card",children:[p.jsxs("div",{className:"card-head",children:[p.jsx("span",{className:"card-title",children:"Issues"}),p.jsx("span",{className:"card-sub",children:t.loading&&!e?"Checking…":e?p.jsx(kk,{data:e}):"—"})]}),p.jsxs("div",{className:"card-body",style:{padding:0},children:[t.error&&p.jsx("div",{className:"text-xs",style:{padding:12,color:"var(--red-fg)"},children:t.error}),e&&e.compileFailed&&p.jsx("div",{className:"text-xs",style:{padding:12,color:"var(--red-fg)"},children:"Template compile failed — see error below."}),e&&p.jsxs("div",{style:{maxHeight:360,overflow:"auto"},children:[e.errors.map(n=>p.jsx(Xu,{issue:n},`e-${n.rule}`)),e.warnings.map(n=>p.jsx(Xu,{issue:n},`w-${n.rule}`)),e.infos.map(n=>p.jsx(Xu,{issue:n},`n-${n.rule}`)),e.errors.length===0&&e.warnings.length===0&&e.infos.length===0&&p.jsx("div",{className:"text-xs subtle",style:{padding:12},children:"No issues."})]})]})]})}function Xu({issue:t}){const e=t.severity==="error"?"var(--red-fg)":t.severity==="warning"?"var(--amber-fg)":"var(--fg-muted)";return p.jsxs("div",{style:{padding:"8px 12px",borderTop:"1px solid var(--border)",display:"grid",gap:4},children:[p.jsxs("div",{className:"text-xs",style:{color:e,fontWeight:500},children:[t.severity.toUpperCase()," · ",t.rule]}),p.jsx("div",{className:"text-xs",children:t.message}),t.hint&&p.jsx("div",{className:"text-xs subtle",children:t.hint})]})}function wH({slug:t,refetchTemplate:e}){const{data:n,refetch:r}=ch(()=>kn.mailTesterStatus(t),[t]),[i,s]=K.useState(!1),[o,a]=K.useState(null),[l,c]=K.useState(null),[d,u]=K.useState(null),f=K.useRef(r),h=K.useRef(e);f.current=r,h.current=e,K.useEffect(()=>{if(!o)return;let w=!1,k=0;const v=30,E=setInterval(async()=>{k++;try{const S=await kn.fetchMailTesterResult(t,o.checkId);if(w)return;S.status==="ready"&&S.score?(u(S.score),a(null),s(!1),f.current(),h.current()):k>=v&&(c("Timed out waiting for Mail-Tester to score the message. It may still be processing — refresh to check."),a(null),s(!1))}catch(S){if(w)return;c(String(S?.message??S)),a(null),s(!1)}},3e3);return()=>{w=!0,clearInterval(E)}},[o,t]);async function m(){s(!0),c(null),u(null);try{const w=await kn.startMailTesterCheck(t);if(w.status==="ready"&&w.score){u(w.score),s(!1),r();return}w.checkId&&w.contentKey?a({checkId:w.checkId,contentKey:w.contentKey}):(c("Unexpected response from server."),s(!1))}catch(w){c(String(w?.message??w)),s(!1)}}const g=d??n?.score??null,y=n?.minScore??8,b=g!=null&&g.score<y;return p.jsxs("div",{className:"card",children:[p.jsxs("div",{className:"card-head",children:[p.jsx("span",{className:"card-title",children:"Deliverability check"}),p.jsx("span",{className:"card-sub",children:n?n.configured?g?`Cached for ${n.cacheHours}h after each check`:"Run a Mail-Tester check before publishing":"Mail-Tester not configured":"Loading…"}),n?.configured&&p.jsx("div",{className:"card-actions",children:p.jsx("button",{className:"btn btn-xs",disabled:i,onClick:m,children:i?o?"Waiting for score…":"Sending…":g?"Re-run check":"Run check"})})]}),p.jsxs("div",{className:"card-body",style:{display:"grid",gap:10},children:[!n?.configured&&p.jsxs("div",{className:"text-xs subtle",children:["Set ",p.jsx("code",{children:"mailer.config.mailTester.apiKey"})," to enable. Mail-Tester runs SpamAssassin + DNS auth checks + content red-flag scoring against a real receipt of this template."]}),l&&p.jsx("div",{className:"text-xs",style:{color:"var(--red-fg)"},children:l}),n?.configured&&n.requireScore&&!g&&p.jsxs("div",{className:"text-xs",style:{color:"var(--amber-fg)"},children:[p.jsx("code",{children:"requireScore"})," is on — publish is blocked until this exact content has a score. Editing the subject or body after a check invalidates it."]}),g&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"hstack",style:{gap:16,alignItems:"baseline"},children:[p.jsxs("div",{children:[p.jsx("div",{className:"text-xs subtle",children:"Score"}),p.jsxs("div",{style:{fontSize:28,fontWeight:600,color:b?"var(--red-fg)":g.score>=9?"var(--green-fg)":"var(--amber-fg)"},children:[g.score.toFixed(1)," ",p.jsx("span",{className:"text-xs subtle",children:"/ 10"})]})]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-xs subtle",children:"Threshold"}),p.jsx("div",{className:"text-sm mono",children:y.toFixed(1)})]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-xs subtle",children:"Checked"}),p.jsx("div",{className:"text-xs",children:new Date(g.fetchedAt).toLocaleString()})]})]}),b&&p.jsxs("div",{className:"text-xs",style:{color:"var(--red-fg)"},children:["Score below threshold — publish will be blocked. Address the feedback below or override with ",p.jsx("code",{children:"bypassMailTester: true"})," on the publish call."]}),g.feedback.length>0&&p.jsxs("div",{style:{display:"grid",gap:6,marginTop:4},children:[g.feedback.slice(0,12).map((w,k)=>p.jsxs("div",{className:"text-xs",style:{display:"grid",gap:2},children:[p.jsxs("div",{style:{color:w.severity==="error"?"var(--red-fg)":w.severity==="warning"?"var(--amber-fg)":"var(--fg-muted)",fontWeight:500},children:[w.severity.toUpperCase()," · ",w.category]}),p.jsx("div",{children:w.message})]},k)),g.feedback.length>12&&p.jsxs("div",{className:"text-xs subtle",children:["+ ",g.feedback.length-12," more items in raw report"]})]})]})]})]})}function Zu({title:t,onClose:e,children:n}){const r=K.useId(),i=K.useRef(null);return K.useEffect(()=>{const s=i.current;function o(a){if(a.key==="Escape"){e();return}if(a.key!=="Tab"||!s)return;const l=s.querySelectorAll('a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])');if(l.length===0)return;const c=l[0],d=l[l.length-1],u=document.activeElement;a.shiftKey&&(u===c||!s.contains(u))?(a.preventDefault(),d.focus()):!a.shiftKey&&u===d&&(a.preventDefault(),c.focus())}return document.addEventListener("keydown",o),i.current?.focus(),()=>document.removeEventListener("keydown",o)},[e]),p.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":r,onClick:e,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.45)",display:"grid",placeItems:"center",zIndex:50},children:p.jsxs("div",{ref:i,tabIndex:-1,onClick:s=>s.stopPropagation(),className:"card",style:{width:"min(680px, 90vw)",maxHeight:"85vh",overflow:"auto",padding:0},children:[p.jsxs("div",{className:"card-head",children:[p.jsx("span",{className:"card-title",id:r,children:t}),p.jsx("span",{className:"grow"}),p.jsx("button",{className:"icon-btn","aria-label":"Close",onClick:e,children:p.jsx(yl.X,{size:14})})]}),p.jsx("div",{className:"card-body",children:n})]})})}export{_H as TemplateEditor};
156
+ //# sourceMappingURL=template-editor-CKQLM0Me.js.map