mailery 0.3.2 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,502 +0,0 @@
1
- var rk=Object.defineProperty;var ik=(t,e,n)=>e in t?rk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var sa=(t,e,n)=>ik(t,typeof e!="symbol"?e+"":e,n);import{r as x,R as fe,a as Tf,b as Qy,g as eb,j as p,c as Af,u as ok,L as sk,d as xd,P as ak,I as Ro}from"./index-B1Mp8lSz.js";function ut(t){this.content=t}ut.prototype={constructor:ut,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),o=r.content.slice();return i==-1?o.push(n||t,e):(o[i+1]=e,n&&(o[i]=n)),new ut(o)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new ut(n)},addToStart:function(t,e){return new ut([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new ut(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),o=r.find(t);return i.splice(o==-1?i.length:o,0,e,n),new ut(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=ut.from(t),t.size?new ut(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=ut.from(t),t.size?new ut(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=ut.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}};ut.from=function(t){if(t instanceof ut)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new ut(e)};function tb(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),o=e.child(r);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)n++;return n}if(i.content.size||o.content.size){let s=tb(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function nb(t,e,n,r){for(let i=t.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:r};let s=t.child(--i),a=e.child(--o),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let c=0,u=Math.min(s.text.length,a.text.length);for(;c<u&&s.text[s.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let c=nb(s.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class P{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,o){for(let s=0,a=0;a<n;s++){let l=this.content[s],c=a+l.nodeSize;if(c>e&&r(l,i+a,o||null,s)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,i+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let o="",s=!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&&(s?s=!1:o+=r),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new P(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 o=0,s=0;s<n;o++){let a=this.content[o],l=s+a.nodeSize;l>e&&((s<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,n-s-1))),r.push(a),i+=a.nodeSize),s=l}return new P(r,i)}cutByIndex(e,n){return e==n?P.empty:e==0&&n==this.content.length?this:new P(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new P(i,o)}addToStart(e){return new P([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new P(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 tb(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return nb(this,e,n,r)}findIndex(e){if(e==0)return aa(0,e);if(e==this.size)return aa(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),o=r+i.nodeSize;if(o>=e)return o==e?aa(n+1,o):aa(n,r);r=o}}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 P.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new P(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return P.empty;let n,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(n||(n=e.slice(0,i)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new P(n||e,r)}static from(e){if(!e)return P.empty;if(e instanceof P)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new P([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}P.empty=new P([],0);const du={index:0,offset:0};function aa(t,e){return du.index=t,du.offset=e,du}function sl(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(!sl(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!sl(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Le=class wd{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))n||(n=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(o)}}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&&sl(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 wd.none;if(e instanceof wd)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};Le.none=[];class al extends Error{}class Y{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=ib(this.content,e+this.openStart,n);return r&&new Y(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Y(rb(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 Y.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 Y(P.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new Y(e,r,i)}}Y.empty=new Y(P.empty,0,0);function rb(t,e,n){let{index:r,offset:i}=t.findIndex(e),o=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(i==e||o.isText){if(a!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,o.copy(rb(o.content,e-i-1,n-i-1)))}function ib(t,e,n,r){let{index:i,offset:o}=t.findIndex(e),s=t.maybeChild(i);if(o==e||s.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=ib(s.content,e-o-1,n,s);return a&&t.replaceChild(i,s.copy(a))}function lk(t,e,n){if(n.openStart>t.depth)throw new al("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new al("Inconsistent open depths");return ob(t,e,n,0)}function ob(t,e,n,r){let i=t.index(r),o=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let s=ob(t,e,n,r+1);return o.copy(o.content.replaceChild(i,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,a=s.content;return Zr(s,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:s,end:a}=ck(n,t);return Zr(o,ab(t,s,a,e,r))}else return Zr(o,ll(t,e,r))}function sb(t,e){if(!e.type.compatibleContent(t.type))throw new al("Cannot join "+e.type.name+" onto "+t.type.name)}function Ed(t,e,n){let r=t.node(n);return sb(r,e.node(n)),r}function Xr(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 Uo(t,e,n,r){let i=(e||t).node(n),o=0,s=e?e.index(n):i.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(Xr(t.nodeAfter,r),o++));for(let a=o;a<s;a++)Xr(i.child(a),r);e&&e.depth==n&&e.textOffset&&Xr(e.nodeBefore,r)}function Zr(t,e){return t.type.checkContent(e),t.copy(e)}function ab(t,e,n,r,i){let o=t.depth>i&&Ed(t,e,i+1),s=r.depth>i&&Ed(n,r,i+1),a=[];return Uo(null,t,i,a),o&&s&&e.index(i)==n.index(i)?(sb(o,s),Xr(Zr(o,ab(t,e,n,r,i+1)),a)):(o&&Xr(Zr(o,ll(t,e,i+1)),a),Uo(e,n,i,a),s&&Xr(Zr(s,ll(n,r,i+1)),a)),Uo(r,null,i,a),new P(a)}function ll(t,e,n){let r=[];if(Uo(null,t,n,r),t.depth>n){let i=Ed(t,e,n+1);Xr(Zr(i,ll(t,e,n+1)),r)}return Uo(e,null,n,r),new P(r)}function ck(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let o=n-1;o>=0;o--)i=e.node(o).copy(P.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class as{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 o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Le.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 o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive===!1&&(!i||!o[s].isInSet(i.marks))&&(o=o[s--].removeFromSet(o));return o}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 o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].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 ls(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,o=n;for(let s=e;;){let{index:a,offset:l}=s.content.findIndex(o),c=o-l;if(r.push(s,a,i+l),!c||(s=s.child(a),s.isText))break;o=c-1,i+=l+1}return new as(n,r,o)}static resolveCached(e,n){let r=vp.get(e);if(r)for(let o=0;o<r.elts.length;o++){let s=r.elts[o];if(s.pos==n)return s}else vp.set(e,r=new uk);let i=r.elts[r.i]=as.resolve(e,n);return r.i=(r.i+1)%dk,i}}class uk{constructor(){this.elts=[],this.i=0}}const dk=12,vp=new WeakMap;class ls{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 fk=Object.create(null);let Er=class kd{constructor(e,n,r,i=Le.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||P.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&&sl(this.attrs,n||e.defaultAttrs||fk)&&Le.sameSet(this.marks,r||Le.none)}copy(e=null){return e==this.content?this:new kd(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new kd(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 Y.empty;let i=this.resolve(e),o=this.resolve(n),s=r?0:i.sharedDepth(n),a=i.start(s),c=i.node(s).content.cut(i.pos-a,o.pos-a);return new Y(c,i.depth-s,o.depth-s)}replace(e,n,r){return lk(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 as.resolveCached(this,e)}resolveNoCache(e){return as.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,o=>(r.isInSet(o.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()+")"),lb(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=P.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=i;l<o;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 o=this.contentMatchAt(e).matchType(r),s=o&&o.matchFragment(this.content,n);return s?s.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=Le.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(!Le.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=P.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};Er.prototype.text=void 0;class cl extends Er{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):lb(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 cl(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new cl(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 lb(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class si{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new hk(e,n);if(r.next==null)return si.empty;let i=cb(r);r.next&&r.err("Unexpected trailing text");let o=xk(vk(i));return wk(o,r),o}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 o=n;i&&o<r;o++)i=i.matchType(e.child(o).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 o(s,a){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return P.from(a.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let f=o(d,a.concat(u));if(f)return f}}return null}return o(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(),o=i.match;if(o.matchType(e)){let s=[];for(let a=i;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:a,next:l}=o.next[s];!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 o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)o+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return o}).join(`
2
- `)}}si.empty=new si(!0);class hk{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 cb(t){let e=[];do e.push(pk(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function pk(t){let e=[];do e.push(mk(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function mk(t){let e=bk(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=gk(t,e);else break;return e}function xp(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function gk(t,e){let n=xp(t),r=n;return t.eat(",")&&(t.next!="}"?r=xp(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function yk(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let o in n){let s=n[o];s.isInGroup(e)&&i.push(s)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function bk(t){if(t.eat("(")){let e=cb(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=yk(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 vk(t){let e=[[]];return i(o(t,0),n()),e;function n(){return e.push([])-1}function r(s,a,l){let c={term:l,to:a};return e[s].push(c),c}function i(s,a){s.forEach(l=>l.to=a)}function o(s,a){if(s.type=="choice")return s.exprs.reduce((l,c)=>l.concat(o(c,a)),[]);if(s.type=="seq")for(let l=0;;l++){let c=o(s.exprs[l],a);if(l==s.exprs.length-1)return c;i(c,a=n())}else if(s.type=="star"){let l=n();return r(a,l),i(o(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return i(o(s.expr,a),l),i(o(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(a)].concat(o(s.expr,a));if(s.type=="range"){let l=a;for(let c=0;c<s.min;c++){let u=n();i(o(s.expr,l),u),l=u}if(s.max==-1)i(o(s.expr,l),l);else for(let c=s.min;c<s.max;c++){let u=n();r(l,u),i(o(s.expr,l),u),l=u}return[r(l)]}else{if(s.type=="name")return[r(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function ub(t,e){return e-t}function wp(t,e){let n=[];return r(e),n.sort(ub);function r(i){let o=t[i];if(o.length==1&&!o[0].term)return r(o[0].to);n.push(i);for(let s=0;s<o.length;s++){let{term:a,to:l}=o[s];!a&&n.indexOf(l)==-1&&r(l)}}}function xk(t){let e=Object.create(null);return n(wp(t,0));function n(r){let i=[];r.forEach(s=>{t[s].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<i.length;u++)i[u][0]==a&&(c=i[u][1]);wp(t,l).forEach(u=>{c||i.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let o=e[r.join(",")]=new si(r.indexOf(t.length-1)>-1);for(let s=0;s<i.length;s++){let a=i[s][1].sort(ub);o.next.push({type:i[s][0],next:e[a.join(",")]||n(a)})}return o}}function wk(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],o=!i.validEnd,s=[];for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];s.push(l.name),o&&!(l.isText||l.hasRequiredAttrs())&&(o=!1),r.indexOf(c)==-1&&r.push(c)}o&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function db(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 fb(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let o=t[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function hb(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 o=t[i];o.validate&&o.validate(e[i])}}function pb(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new kk(t,r,e[r]);return n}let Ep=class mb{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=pb(e,r.attrs),this.defaultAttrs=db(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==si.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:fb(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Er(this,this.computeAttrs(e),P.from(n),Le.setFrom(r))}createChecked(e=null,n,r){return n=P.from(n),this.checkContent(n),new Er(this,this.computeAttrs(e),n,Le.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=P.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let i=this.contentMatch.matchFragment(n),o=i&&i.fillBefore(P.empty,!0);return o?new Er(this,e,n.append(o),Le.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){hb(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:Le.none:e}static compile(e,n){let r=Object.create(null);e.forEach((o,s)=>r[o]=new mb(o,n,s));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 o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function Ek(t,e,n){let r=n.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${o}`)}}class kk{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Ek(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class gc{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=pb(e,i.attrs),this.excluded=null;let o=db(this.attrs);this.instance=o?new Le(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Le(this,fb(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new gc(o,i++,n,s)),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){hb(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}let gb=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=ut.from(e.nodes),n.marks=ut.from(e.marks||{}),this.nodes=Ep.compile(this.spec.nodes,this),this.marks=gc.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 o=this.nodes[i],s=o.spec.content||"",a=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=si.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=a=="_"?null:a?kp(this,a.split(" ")):a==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:kp(this,s.split(" "))}this.nodeFromJSON=i=>Er.fromJSON(this,i),this.markFromJSON=i=>Le.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 Ep){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 cl(r,r.defaultAttrs,e,Le.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 kp(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],o=t.marks[i],s=o;if(o)n.push(o);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(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function Ck(t){return t.tag!=null}function Sk(t){return t.style!=null}let Vo=class Cd{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(Ck(i))this.tags.push(i);else if(Sk(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,n={}){let r=new Sp(this,n,!1);return r.addAll(e,Le.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Sp(this,n,!0);return r.addAll(e,Le.none,n.from,n.to),Y.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(Tk(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||n.matchesContext(o.context))){if(o.getAttrs){let s=o.getAttrs(e);if(s===!1)continue;o.attrs=s||void 0}return o}}}matchStyle(e,n,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let s=this.styles[o],a=s.style;if(!(a.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let n=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s<n.length;s++){let a=n[s];if((a.priority==null?50:a.priority)<o)break}n.splice(s,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(s=>{r(s=_p(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=_p(s)),s.node||s.ignore||s.mark||(s.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Cd(e,Cd.schemaRules(e)))}};const yb={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},_k={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},bb={ol:!0,ul:!0},cs=1,Sd=2,Wo=4;function Cp(t,e,n){return e!=null?(e?cs:0)|(e==="full"?Sd:0):t&&t.whitespace=="pre"?cs|Sd:n&~Wo}class la{constructor(e,n,r,i,o,s){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=Le.none,this.match=o||(s&Wo?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(P.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&cs)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let n=P.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(P.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&&!yb.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Sp{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,o,s=Cp(null,n.preserveWhitespace,0)|(r?Wo:0);i?o=new la(i.type,i.attrs,Le.none,!0,n.topMatch||i.type.contentMatch,s):r?o=new la(null,null,Le.none,!0,null,s):o=new la(e.schema.topNodeType,null,Le.none,!0,null,s),this.nodes=[o],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,o=i.options&Sd?"full":this.localPreserveWS||(i.options&cs)>0,{schema:s}=this.parser;if(o==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)if(o==="full")r=r.replace(/\r\n?/g,`
3
- `);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(s.linebreakReplacement.create(),n,!0),a[l]&&this.insertNode(s.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(s.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),a;bb.hasOwnProperty(s)&&this.parser.normalizeLists&&Nk(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:_k.hasOwnProperty(s))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,u=this.needsBlock;if(yb.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),c=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(o),this.needsBlock=u}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 o=this.parser.matchedStyles[i],s=r.getPropertyValue(o);if(s)for(let a=void 0;;){let l=this.parser.matchStyle(o,s,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 o,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(s,n.attrs||null,r,n.preserveWhitespace);l&&(o=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(s&&s.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)}o&&this.sync(a)&&this.open--}addAll(e,n,r,i){let o=r||0;for(let s=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];s!=a;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s,n);this.findAtPoint(e,o)}findPlace(e,n,r){let i,o;for(let s=this.open,a=0;s>=0;s--){let l=this.nodes[s],c=l.findWrapping(e);if(c&&(!i||i.length>c.length+a)&&(i=c,o=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!i)return null;this.sync(o);for(let s=0;s<i.length;s++)n=this.enterInner(i[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(n=this.enterInner(o,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let s=Le.none;for(let a of i.concat(e.marks))(o.type?o.type.allowsMarkType(a.type):Np(a.type,e.type))&&(s=a.addToSet(s));return o.content.push(e.mark(s)),!0}return!1}enter(e,n,r,i){let o=this.findPlace(e.create(n),r,!1);return o&&(o=this.enterInner(e,n,r,!0,i)),o}enterInner(e,n,r,i=!1,o){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let a=Cp(e,o,s.options);s.options&Wo&&s.content.length==0&&(a|=Wo);let l=Le.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):Np(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new la(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|=cs)}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),o=-(r?r.depth+1:0)+(i?0:1),s=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=o;l--)if(s(a-1,l))return!0;return!1}else{let u=l>0||l==0&&i?this.nodes[l].type:r&&l>=o?r.node(l-o).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return s(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 Nk(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&bb.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function Tk(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function _p(t){let e={};for(let n in t)e[n]=t[n];return e}function Np(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let o=[],s=a=>{o.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||o.indexOf(u)<0&&s(u))return!0}};if(s(i.contentMatch))return!0}}class hi{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=fu(n).createDocumentFragment());let i=r,o=[];return e.forEach(s=>{if(o.length||s.marks.length){let a=0,l=0;for(;a<o.length&&l<s.marks.length;){let c=s.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(o[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<o.length;)i=o.pop()[1];for(;l<s.marks.length;){let c=s.marks[l++],u=this.serializeMark(c,s.isInline,n);u&&(o.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=Va(fu(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 o=this.serializeMark(e.marks[i],e.isInline,n);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&Va(fu(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return Va(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new hi(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Tp(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Tp(e.marks)}}function Tp(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function fu(t){return t.document||window.document}const Ap=new WeakMap;function Ak(t){let e=Ap.get(t);return e===void 0&&Ap.set(t,e=Mk(t)),e}function Mk(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 Va(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],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=Ak(r))&&o.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 s=i.indexOf(" ");s>0&&(n=i.slice(0,s),i=i.slice(s+1));let a,l=n?t.createElementNS(n,i):t.createElement(i),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)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}=Va(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 vb=65535,xb=Math.pow(2,16);function Ok(t,e){return t+e*xb}function Mp(t){return t&vb}function Rk(t){return(t-(t&vb))/xb}const wb=1,Eb=2,Wa=4,kb=8;class _d{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&kb)>0}get deletedBefore(){return(this.delInfo&(wb|Wa))>0}get deletedAfter(){return(this.delInfo&(Eb|Wa))>0}get deletedAcross(){return(this.delInfo&Wa)>0}}class jt{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&jt.empty)return jt.empty}recover(e){let n=0,r=Mp(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+Rk(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,o=this.inverted?2:1,s=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+o],u=this.ranges[a+s],d=l+c;if(e<=d){let f=c?e==l?-1:e==d?1:n:n,h=l+i+(f<0?0:u);if(r)return h;let m=e==(n<0?l:d)?null:Ok(a/3,e-l),g=e==l?Eb:e==d?wb:Wa;return(n<0?e!=l:e!=d)&&(g|=kb),new _d(h,g,m)}i+=u-c}return r?e+i:new _d(e+i,0,null)}touches(e,n){let r=0,i=Mp(n),o=this.inverted?2:1,s=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+o],u=l+c;if(e<=u&&a==i*3)return!0;r+=this.ranges[a+s]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],a=s-(this.inverted?o:0),l=s+(this.inverted?0:o),c=this.ranges[i+n],u=this.ranges[i+r];e(a,a+c,l,l+u),o+=u-c}}invert(){return new jt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?jt.empty:new jt(e<0?[0,-e,0]:[0,0,e])}}jt.empty=new jt([]);class us{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 us(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 us;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 o=this.from;o<this.to;o++){let s=this._maps[o],a=s.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(o);if(l!=null&&l>o&&l<this.to){o=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new _d(e,i,null)}}const hu=Object.create(null);class wt{getMap(){return jt.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=hu[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 hu)throw new RangeError("Duplicate use of step JSON ID "+e);return hu[e]=n,n.prototype.jsonID=e,n}}class Ze{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Ze(e,null)}static fail(e){return new Ze(null,e)}static fromReplace(e,n,r,i){try{return Ze.ok(e.replace(n,r,i))}catch(o){if(o instanceof al)return Ze.fail(o.message);throw o}}}function Mf(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let o=t.child(i);o.content.size&&(o=o.copy(Mf(o.content,e,o))),o.isInline&&(o=e(o,n,i)),r.push(o)}return P.fromArray(r)}class gr 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)),o=new Y(Mf(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return Ze.fromReplace(e,this.from,this.to,o)}invert(){return new kn(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 gr(n.pos,r.pos,this.mark)}merge(e){return e instanceof gr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new gr(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 gr(n.from,n.to,e.markFromJSON(n.mark))}}wt.jsonID("addMark",gr);class kn 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 Y(Mf(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Ze.fromReplace(e,this.from,this.to,r)}invert(){return new gr(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 kn(n.pos,r.pos,this.mark)}merge(e){return e instanceof kn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new kn(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 kn(n.from,n.to,e.markFromJSON(n.mark))}}wt.jsonID("removeMark",kn);class yr extends wt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Ze.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Ze.fromReplace(e,this.pos,this.pos+1,new Y(P.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 yr(this.pos,n.marks[i]);return new yr(this.pos,this.mark)}}return new ai(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new yr(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 yr(n.pos,e.markFromJSON(n.mark))}}wt.jsonID("addNodeMark",yr);class ai extends wt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Ze.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Ze.fromReplace(e,this.pos,this.pos+1,new Y(P.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new yr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new ai(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 ai(n.pos,e.markFromJSON(n.mark))}}wt.jsonID("removeNodeMark",ai);class Xe 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&&Nd(e,this.from,this.to)?Ze.fail("Structure replace would overwrite content"):Ze.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new jt([this.from,this.to-this.from,this.slice.size])}invert(e){return new Xe(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&&Xe.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new Xe(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Xe)||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?Y.empty:new Y(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Xe(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?Y.empty:new Y(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Xe(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 Xe(n.from,n.to,Y.fromJSON(e,n.slice),!!n.structure)}}Xe.MAP_BIAS=1;wt.jsonID("replace",Xe);class rt extends wt{constructor(e,n,r,i,o,s,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=a}apply(e){if(this.structure&&(Nd(e,this.from,this.gapFrom)||Nd(e,this.gapTo,this.to)))return Ze.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Ze.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Ze.fromReplace(e,this.from,this.to,r):Ze.fail("Content does not fit in gap")}getMap(){return new jt([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 rt(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),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||o>r.pos?null:new rt(n.pos,r.pos,i,o,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 rt(n.from,n.to,n.gapFrom,n.gapTo,Y.fromJSON(e,n.slice),n.insert,!!n.structure)}}wt.jsonID("replaceAround",rt);function Nd(t,e,n){let r=t.resolve(e),i=n-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function Ik(t,e,n,r){let i=[],o=[],s,a;t.doc.nodesBetween(e,n,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+l.nodeSize,n),m=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(m)||(s&&s.to==f&&s.mark.eq(d[g])?s.to=h:i.push(s=new kn(f,h,d[g])));a&&a.to==f?a.to=h:o.push(a=new gr(f,h,r))}}),i.forEach(l=>t.step(l)),o.forEach(l=>t.step(l))}function Dk(t,e,n,r){let i=[],o=0;t.doc.nodesBetween(e,n,(s,a)=>{if(!s.isInline)return;o++;let l=null;if(r instanceof gc){let c=s.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let c=Math.min(a+s.nodeSize,n);for(let u=0;u<l.length;u++){let d=l[u],f;for(let h=0;h<i.length;h++){let m=i[h];m.step==o-1&&d.eq(i[h].style)&&(f=m)}f?(f.to=c,f.step=o):i.push({style:d,from:Math.max(a,e),to:c,step:o})}}}),i.forEach(s=>t.step(new kn(s.from,s.to,s.style)))}function Of(t,e,n,r=n.contentMatch,i=!0){let o=t.doc.nodeAt(e),s=[],a=e+1;for(let l=0;l<o.childCount;l++){let c=o.child(l),u=a+c.nodeSize,d=r.matchType(c.type);if(!d)s.push(new Xe(a,u,Y.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new kn(a,u,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 Y(P.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new Xe(a+f.index,a+f.index+f[0].length,m))}}a=u}if(!r.validEnd){let l=r.fillBefore(P.empty,!0);t.replace(a,a,new Y(l,0,0))}for(let l=s.length-1;l>=0;l--)t.step(s[l])}function Lk(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function vo(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,o=0;;--r){let s=t.$from.node(r),a=t.$from.index(r)+i,l=t.$to.indexAfter(r)-o;if(r<t.depth&&s.canReplace(a,l,n))return r;if(r==0||s.type.spec.isolating||!Lk(s,a,l))break;a&&(i=1),l<s.childCount&&(o=1)}return null}function Pk(t,e,n){let{$from:r,$to:i,depth:o}=e,s=r.before(o+1),a=i.after(o+1),l=s,c=a,u=P.empty,d=0;for(let m=o,g=!1;m>n;m--)g||r.index(m)>0?(g=!0,u=P.from(r.node(m).copy(u)),d++):l--;let f=P.empty,h=0;for(let m=o,g=!1;m>n;m--)g||i.after(m+1)<i.end(m)?(g=!0,f=P.from(i.node(m).copy(f)),h++):c++;t.step(new rt(l,c,s,a,new Y(u.append(f),d,h),u.size-d,!0))}function Rf(t,e,n=null,r=t){let i=Bk(t,e),o=i&&$k(r,e);return o?i.map(Op).concat({type:e,attrs:n}).concat(o.map(Op)):null}function Op(t){return{type:t,attrs:null}}function Bk(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.contentMatchAt(r).findWrapping(e);if(!o)return null;let s=o.length?o[0]:e;return n.canReplaceWith(r,i,s)?o:null}function $k(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.child(r),s=e.contentMatch.findWrapping(o.type);if(!s)return null;let l=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;l&&c<i;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:s}function jk(t,e,n){let r=P.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let a=n[s].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=P.from(n[s].type.create(n[s].attrs,r))}let i=e.start,o=e.end;t.step(new rt(i,o,i,o,new Y(r,0,0),n.length,!0))}function Fk(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,n,(s,a)=>{let l=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,l)&&Hk(t.doc,t.mapping.slice(o).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&&Sb(t,s,a,o),Of(t,t.mapping.slice(o).map(a,1),r,void 0,c===null);let u=t.mapping.slice(o),d=u.map(a,1),f=u.map(a+s.nodeSize,1);return t.step(new rt(d,f,d+1,f-1,new Y(P.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&Cb(t,s,a,o),!1}})}function Cb(t,e,n,r){e.forEach((i,o)=>{if(i.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(i.text);){let l=t.mapping.slice(r).map(n+1+o+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function Sb(t,e,n,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+o);t.replaceWith(s,s+1,e.type.schema.text(`
5
- `))}})}function Hk(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function zk(t,e,n,r,i){let o=t.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let s=n.create(r,null,i||o.marks);if(o.isLeaf)return t.replaceWith(e,e+o.nodeSize,s);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new rt(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new Y(P.from(s),0,0),1,!0))}function Gn(t,e,n=1,r){let i=t.resolve(e),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=n-2;c>o;c--,u--){let d=i.node(c),f=i.index(c);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),m=r&&r[u+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!g.type.validContent(h))return!1}let a=i.indexAfter(o),l=r&&r[0];return i.node(o).canReplaceWith(a,a,l?l.type:i.node(o+1).type)}function Uk(t,e,n=1,r){let i=t.doc.resolve(e),o=P.empty,s=P.empty;for(let a=i.depth,l=i.depth-n,c=n-1;a>l;a--,c--){o=P.from(i.node(a).copy(o));let u=r&&r[c];s=P.from(u?u.type.create(u.attrs,s):i.node(a).copy(s))}t.step(new Xe(e,e,new Y(o.append(s),n,n),!0))}function Rr(t,e){let n=t.resolve(e),r=n.index();return _b(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Vk(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 o=e.child(i),s=o.type==r?t.type.schema.nodes.text:o.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(o.marks))return!1}return n.validEnd}function _b(t,e){return!!(t&&e&&!t.isLeaf&&Vk(t,e))}function yc(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let o,s,a=r.index(i);if(i==r.depth?(o=r.nodeBefore,s=r.nodeAfter):n>0?(o=r.node(i+1),a++,s=r.node(i).maybeChild(a)):(o=r.node(i).maybeChild(a-1),s=r.node(i+1)),o&&!o.isTextblock&&_b(o,s)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function Wk(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,o=t.doc.resolve(e-n),s=o.node().type;if(i&&s.inlineContent){let u=s.whitespace=="pre",d=!!s.contentMatch.matchType(i);u&&!d?r=!1:!u&&d&&(r=!0)}let a=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);Sb(t,u.node(),u.before(),a)}s.inlineContent&&Of(t,e+n-1,s,o.node().contentMatchAt(o.index()),r==null);let l=t.mapping.slice(a),c=l.map(e-n);if(t.step(new Xe(c,l.map(e+n,-1),Y.empty,!0)),r===!0){let u=t.doc.resolve(c);Cb(t,u.node(),u.before(),t.steps.length)}return t}function Kk(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 o=r.index(i);if(r.node(i).canReplaceWith(o,o,n))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,n))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function Nb(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let o=0;o<n.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(n.openStart==0&&n.size?2:1);o++)for(let s=r.depth;s>=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(a>0?1:0),c=r.node(s),u=!1;if(o==1)u=c.canReplace(l,l,i);else{let d=c.contentMatchAt(l).findWrapping(i.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function bc(t,e,n=e,r=Y.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),o=t.resolve(n);return Tb(i,o,r)?new Xe(e,n,r):new Gk(i,o,r).fit()}function Tb(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Gk{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=P.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=P.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 o=this.placed,s=r.depth,a=i.depth;for(;s&&a&&o.childCount==1;)o=o.firstChild.content,s--,a--;let l=new Y(o,s,a);return e>-1?new rt(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new Xe(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 o=n.firstChild;if(n.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}n=o.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=pu(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(n==1&&(s?c.matchType(s.type)||(d=c.fillBefore(P.from(s),!1)):o&&l.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:a,parent:o,inject:d};if(n==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:o,wrap:u};if(o&&c.matchType(o.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=pu(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new Y(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=pu(e,n);if(i.childCount<=1&&n>0){let o=e.size-n<=n+i.size;this.unplaced=new Y($o(e,n-1,1),n-1,o?n-1:r)}else this.unplaced=new Y($o(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let g=0;g<o.length;g++)this.openFrontierNode(o[g]);let s=this.unplaced,a=r?r.content:s.content,l=s.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[n];if(i){for(let g=0;g<i.childCount;g++)u.push(i.child(g));d=d.matchFragment(i)}let h=a.size+e-(s.content.size-s.openEnd);for(;c<a.childCount;){let g=a.child(c),y=d.matchType(g.type);if(!y)break;c++,(c>1||l==0||g.content.size)&&(d=y,u.push(Ab(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=jo(this.placed,n,P.from(u)),this.frontier[n].match=d,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?Y.empty:new Y($o(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new Y($o(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!mu(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],o=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=mu(e,n,i,r,o);if(s){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=mu(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:o?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=jo(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=jo(this.placed,this.depth,P.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(P.empty,!0);n.childCount&&(this.placed=jo(this.placed,this.frontier.length,n))}}function $o(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy($o(t.firstChild.content,e-1,n)))}function jo(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(jo(t.lastChild.content,e-1,n)))}function pu(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Ab(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Ab(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(P.empty,!0)))),t.copy(r)}function mu(t,e,n,r,i){let o=t.node(e),s=i?t.indexAfter(e):t.index(e);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let a=r.fillBefore(o.content,!0,s);return a&&!qk(n,o.content,s)?a:null}function qk(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function Yk(t){return t.spec.defining||t.spec.definingForContent}function Jk(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),o=t.doc.resolve(n);if(Tb(i,o,r))return t.step(new Xe(e,n,r));let s=Ob(i,o);s[s.length-1]==0&&s.pop();let a=-(i.depth+1);s.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;s.indexOf(f)>-1?a=f:i.before(f)==h&&s.splice(1,0,-f)}let l=s.indexOf(a),c=[],u=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=u-1;f>=0;f--){let h=c[f],m=Yk(h.type);if(m&&!h.sameMarkup(i.node(Math.abs(a)-1)))u=f;else if(m||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+u+1)%(r.openStart+1),m=c[h];if(m)for(let g=0;g<s.length;g++){let y=s[(g+l)%s.length],b=!0;y<0&&(b=!1,y=-y);let w=i.node(y-1),E=i.index(y-1);if(w.canReplaceWith(E,E,m.type,m.marks))return t.replace(i.before(y),b?o.after(y):n,new Y(Mb(r.content,0,r.openStart,h),h,r.openEnd))}}let d=t.steps.length;for(let f=s.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let h=s[f];h<0||(e=i.before(h),n=o.after(h))}}function Mb(t,e,n,r,i){if(e<n){let o=t.firstChild;t=t.replaceChild(0,o.copy(Mb(o.content,e+1,n,r,o)))}if(e>r){let o=i.contentMatchAt(0),s=o.fillBefore(t).append(t);t=s.append(o.matchFragment(s).fillBefore(P.empty,!0))}return t}function Xk(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=Kk(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new Y(P.from(r),0,0))}function Zk(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 s=r.sharedDepth(n),a=!1;for(let l=r.depth;l>s;l--)r.node(l).type.spec.isolating&&(a=!0);for(let l=i.depth;l>s;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 o=Ob(r,i);for(let s=0;s<o.length;s++){let a=o[s],l=s==o.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 s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&i.end(s)-n!=i.depth-s&&r.start(s-1)==i.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),i.index(s-1)))return t.delete(r.before(s),n);t.delete(e,n)}function Ob(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let o=t.start(i);if(o<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;(o==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&n.push(i)}return n}class Hi 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 Ze.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Ze.fromReplace(e,this.pos,this.pos+1,new Y(P.from(i),0,n.isLeaf?0:1))}getMap(){return jt.empty}invert(e){return new Hi(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 Hi(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 Hi(n.pos,n.attr,n.value)}}wt.jsonID("attr",Hi);class ds 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 Ze.ok(r)}getMap(){return jt.empty}invert(e){return new ds(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 ds(n.attr,n.value)}}wt.jsonID("docAttr",ds);let Yi=class extends Error{};Yi=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Yi.prototype=Object.create(Error.prototype);Yi.prototype.constructor=Yi;Yi.prototype.name="TransformError";class Rb{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new us}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Yi(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((o,s,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=Y.empty){let i=bc(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new Y(P.from(r),0,0))}delete(e,n){return this.replace(e,n,Y.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return Jk(this,e,n,r),this}replaceRangeWith(e,n,r){return Xk(this,e,n,r),this}deleteRange(e,n){return Zk(this,e,n),this}lift(e,n){return Pk(this,e,n),this}join(e,n=1){return Wk(this,e,n),this}wrap(e,n){return jk(this,e,n),this}setBlockType(e,n=e,r,i=null){return Fk(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return zk(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new Hi(e,n,r)),this}setDocAttribute(e,n){return this.step(new ds(e,n)),this}addNodeMark(e,n){return this.step(new yr(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 Le)n.isInSet(r.marks)&&this.step(new ai(e,n));else{let i=r.marks,o,s=[];for(;o=n.isInSet(i);)s.push(new ai(e,o)),i=o.removeFromSet(i);for(let a=s.length-1;a>=0;a--)this.step(s[a])}return this}split(e,n=1,r){return Uk(this,e,n,r),this}addMark(e,n,r){return Ik(this,e,n,r),this}removeMark(e,n,r){return Dk(this,e,n,r),this}clearIncompatible(e,n,r){return Of(this,e,n,r),this}}const gu=Object.create(null);class ge{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Ib(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=Y.empty){let r=n.content.lastChild,i=null;for(let a=0;a<n.openEnd;a++)i=r,r=r.lastChild;let o=e.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:c}=s[a],u=e.mapping.slice(o);e.replaceRange(u.map(l.pos),u.map(c.pos),a?Y.empty:n),a==0&&Dp(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:a}=i[o],l=e.mapping.slice(r),c=l.map(s.pos),u=l.map(a.pos);o?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),Dp(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new ue(e):Ri(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let s=n<0?Ri(e.node(0),e.node(o),e.before(o+1),e.index(o),n,r):Ri(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Ht(e.node(0))}static atStart(e){return Ri(e,e,0,0,1)||new Ht(e)}static atEnd(e){return Ri(e,e,e.content.size,e.childCount,-1)||new Ht(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=gu[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 gu)throw new RangeError("Duplicate use of selection JSON ID "+e);return gu[e]=n,n.prototype.jsonID=e,n}getBookmark(){return ue.between(this.$anchor,this.$head).getBookmark()}}ge.prototype.visible=!0;class Ib{constructor(e,n){this.$from=e,this.$to=n}}let Rp=!1;function Ip(t){!Rp&&!t.parent.inlineContent&&(Rp=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class ue extends ge{constructor(e,n=e){Ip(e),Ip(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 ge.near(r);let i=e.resolve(n.map(this.anchor));return new ue(i.parent.inlineContent?i:r,r)}replace(e,n=Y.empty){if(super.replace(e,n),n==Y.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof ue&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new vc(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 ue(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 o=ge.findFrom(n,r,!0)||ge.findFrom(n,-r,!0);if(o)n=o.$head;else return ge.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(ge.findFrom(e,-r,!0)||ge.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new ue(e,n)}}ge.jsonID("text",ue);class vc{constructor(e,n){this.anchor=e,this.head=n}map(e){return new vc(e.map(this.anchor),e.map(this.head))}resolve(e){return ue.between(e.resolve(this.anchor),e.resolve(this.head))}}class se extends ge{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),o=e.resolve(i);return r?ge.near(o):new se(o)}content(){return new Y(P.from(this.node),0,0)}eq(e){return e instanceof se&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new If(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new se(e.resolve(n.anchor))}static create(e,n){return new se(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}se.prototype.visible=!1;ge.jsonID("node",se);class If{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new vc(r,r):new If(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&se.isSelectable(r)?new se(n):ge.near(n)}}class Ht extends ge{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=Y.empty){if(n==Y.empty){e.delete(0,e.doc.content.size);let r=ge.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ht(e)}map(e){return new Ht(e)}eq(e){return e instanceof Ht}getBookmark(){return Qk}}ge.jsonID("all",Ht);const Qk={map(){return this},resolve(t){return new Ht(t)}};function Ri(t,e,n,r,i,o=!1){if(e.inlineContent)return ue.create(t,n);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let a=e.child(s);if(a.isAtom){if(!o&&se.isSelectable(a))return se.create(t,n-(i<0?a.nodeSize:0))}else{let l=Ri(t,a,n+i,i<0?a.childCount:0,i,o);if(l)return l}n+=a.nodeSize*i}return null}function Dp(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof Xe||i instanceof rt))return;let o=t.mapping.maps[r],s;o.forEach((a,l,c,u)=>{s==null&&(s=u)}),t.setSelection(ge.near(t.doc.resolve(s),n))}const Lp=1,ca=2,Pp=4;let eC=class extends Rb{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|Lp)&~ca,this.storedMarks=null,this}get selectionSet(){return(this.updated&Lp)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ca,this}ensureMarks(e){return Le.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&ca)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~ca,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)||Le.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 o=this.storedMarks;if(!o){let s=this.doc.resolve(n);o=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,o)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(ge.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|=Pp,this}get scrolledIntoView(){return(this.updated&Pp)>0}};function Bp(t,e){return!e||!t?t:t.bind(e)}class Fo{constructor(e,n,r){this.name=e,this.init=Bp(n.init,r),this.apply=Bp(n.apply,r)}}const tC=[new Fo("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Fo("selection",{init(t,e){return t.selection||ge.atStart(e.doc)},apply(t){return t.selection}}),new Fo("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Fo("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class yu{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=tC.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 Fo(r.key,r.spec.state,r))})}}class ji{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 o=!1;for(let s=0;s<this.config.plugins.length;s++){let a=this.config.plugins[s];if(a.spec.appendTransaction){let l=i?i[s].n:0,c=i?i[s].state:this,u=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<s?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),o=!0}i&&(i[s]={state:r,n:n.length})}}if(!o)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new ji(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];n[o.name]=o.apply(e,this[o.name],this,n)}return n}get tr(){return new eC(this)}static create(e){let n=new yu(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new ji(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 yu(this.schema,e.plugins),r=n.fields,i=new ji(n);for(let o=0;o<r.length;o++){let s=r[o].name;i[s]=this.hasOwnProperty(s)?this[s]:r[o].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],o=i.spec.state;o&&o.toJSON&&(n[r]=o.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 yu(e.schema,e.plugins),o=new ji(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=Er.fromJSON(e.schema,n.doc);else if(s.name=="selection")o.selection=ge.fromJSON(o.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(o.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==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){o[s.name]=c.fromJSON.call(l,e,n[a],o);return}}o[s.name]=s.init(e,o)}}),o}}function Db(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Db(i,e,{})),n[r]=i}return n}class $e{constructor(e){this.spec=e,this.props={},e.props&&Db(e.props,this,this.props),this.key=e.key?e.key.key:Lb("plugin")}getState(e){return e[this.key]}}const bu=Object.create(null);function Lb(t){return t in bu?t+"$"+ ++bu[t]:(bu[t]=0,t+"$")}class Pe{constructor(e="key"){this.key=Lb(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const dt=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Ji=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Td=null;const Un=function(t,e,n){let r=Td||(Td=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},nC=function(){Td=null},li=function(t,e,n,r){return n&&($p(t,e,n,r,-1)||$p(t,e,n,r,1))},rC=/^(img|br|input|textarea|hr)$/i;function $p(t,e,n,r,i){for(var o;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Xt(t))){let s=t.parentNode;if(!s||s.nodeType!=1||Vs(t)||rC.test(t.nodeName)||t.contentEditable=="false")return!1;e=dt(t)+(i<0?0:1),t=s}else if(t.nodeType==1){let s=t.childNodes[e+(i<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((o=s.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)e+=i;else return!1;else t=s,e=i<0?Xt(t):0}else return!1}}function Xt(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function iC(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=Xt(t)}else if(t.parentNode&&!Vs(t))e=dt(t),t=t.parentNode;else return null}}function oC(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&&!Vs(t))e=dt(t)+1,t=t.parentNode;else return null}}function sC(t,e,n){for(let r=e==0,i=e==Xt(t);r||i;){if(t==n)return!0;let o=dt(t);if(t=t.parentNode,!t)return!1;r=r&&o==0,i=i&&o==Xt(t)}}function Vs(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 xc=function(t){return t.focusNode&&li(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Kr(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function aC(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function lC(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Xt(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Xt(r.startContainer),r.startOffset)}}}const An=typeof navigator<"u"?navigator:null,jp=typeof document<"u"?document:null,Ir=An&&An.userAgent||"",Ad=/Edge\/(\d+)/.exec(Ir),Pb=/MSIE \d/.exec(Ir),Md=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ir),It=!!(Pb||Md||Ad),kr=Pb?document.documentMode:Md?+Md[1]:Ad?+Ad[1]:0,Zt=!It&&/gecko\/(\d+)/i.test(Ir);Zt&&+(/Firefox\/(\d+)/.exec(Ir)||[0,0])[1];const Od=!It&&/Chrome\/(\d+)/.exec(Ir),ht=!!Od,Bb=Od?+Od[1]:0,vt=!It&&!!An&&/Apple Computer/.test(An.vendor),Xi=vt&&(/Mobile\/\w+/.test(Ir)||!!An&&An.maxTouchPoints>2),Jt=Xi||(An?/Mac/.test(An.platform):!1),$b=An?/Win/.test(An.platform):!1,Vn=/Android \d/.test(Ir),Ws=!!jp&&"webkitFontSmoothing"in jp.documentElement.style,cC=Ws?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function uC(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 Bn(t,e){return typeof t=="number"?t:t[e]}function dC(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 Fp(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,o=t.dom.ownerDocument;for(let s=n||t.dom;s;){if(s.nodeType!=1){s=Ji(s);continue}let a=s,l=a==o.body,c=l?uC(o):dC(a),u=0,d=0;if(e.top<c.top+Bn(r,"top")?d=-(c.top-e.top+Bn(i,"top")):e.bottom>c.bottom-Bn(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+Bn(i,"top")-c.top:e.bottom-c.bottom+Bn(i,"bottom")),e.left<c.left+Bn(r,"left")?u=-(c.left-e.left+Bn(i,"left")):e.right>c.right-Bn(r,"right")&&(u=e.right-c.right+Bn(i,"right")),u||d)if(l)o.defaultView.scrollBy(u,d);else{let h=a.scrollLeft,m=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let g=a.scrollLeft-h,y=a.scrollTop-m;e={left:e.left-g,top:e.top-y,right:e.right-g,bottom:e.bottom-y}}let f=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(f))break;s=f=="absolute"?s.offsetParent:Ji(s)}}function fC(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let a=t.root.elementFromPoint(o,s);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:jb(t.dom)}}function jb(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Ji(r));return e}function hC({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Fb(n,r==0?0:r-e)}function Fb(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:o}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=o&&(r.scrollLeft=o)}}let ki=null;function pC(t){if(t.setActive)return t.setActive();if(ki)return t.focus(ki);let e=jb(t);t.focus(ki==null?{get preventScroll(){return ki={preventScroll:!0},!0}}:void 0),ki||(ki=!1,Fb(e,0))}function Hb(t,e){let n,r=2e8,i,o=0,s=e.top,a=e.top,l,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=Un(u).getClientRects();else continue;for(let h=0;h<f.length;h++){let m=f[h];if(m.top<=s&&m.bottom>=a){s=Math.max(m.bottom,s),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=u,r=g,i=g&&n.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&g&&(o=d+(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=u,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)&&(o=d+1)}}return!n&&l&&(n=l,i=c,r=0),n&&n.nodeType==3?mC(n,i):!n||r&&n.nodeType==1?{node:t,offset:o}:Hb(n,i)}function mC(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let o=0;o<n;o++){r.setEnd(t,o+1),r.setStart(t,o);let s=ar(r,1);if(s.top!=s.bottom&&Df(e,s)){i={node:t,offset:o+(e.left>=(s.left+s.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function Df(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function gC(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function yC(t,e,n){let{node:r,offset:i}=Hb(e,n),o=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();o=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,i,o)}function bC(t,e,n,r){let i=-1;for(let o=e,s=!1;o!=t.dom;){let a=t.docView.nearestDesc(o,!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)&&(!s&&l.left>r.left||l.top>r.top?i=a.posBefore:(!s&&l.right<r.left||l.bottom<r.top)&&(i=a.posAfter),s=!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;o=a.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function zb(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)),o=i;;){let s=t.childNodes[o];if(s.nodeType==1){let a=s.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(Df(e,c))return zb(s,e,c)}}if((o=(o+1)%r)==i)break}return t}function vC(t,e){let n=t.dom.ownerDocument,r,i=0,o=lC(n,e.left,e.top);o&&({node:r,offset:i}=o);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=t.dom.getBoundingClientRect();if(!Df(e,c)||(s=zb(t.dom,e,c),!s))return null}if(vt)for(let c=s;r&&c;c=Ji(c))c.draggable&&(r=void 0);if(s=gC(s,e),r){if(Zt&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let u=r.childNodes[i],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}let c;Ws&&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=bC(t,r,i,e))}a==null&&(a=yC(t,s,e));let l=t.docView.nearestDesc(s,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Hp(t){return t.top<t.bottom||t.left<t.right}function ar(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Hp(r))return r}return Array.prototype.find.call(n,Hp)||t.getBoundingClientRect()}const xC=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Ub(t,e,n){let{node:r,offset:i,atom:o}=t.docView.domFromPos(e,n<0?-1:1),s=Ws||Zt;if(r.nodeType==3)if(s&&(xC.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let l=ar(Un(r,i,i),n);if(Zt&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=ar(Un(r,i-1,i-1),-1);if(c.top==l.top){let u=ar(Un(r,i,i+1),-1);if(u.top!=l.top)return Io(u,u.left<c.left)}}return l}else{let l=i,c=i,u=n<0?1:-1;return n<0&&!i?(c++,u=-1):n>=0&&i==r.nodeValue.length?(l--,u=1):n<0?l--:c++,Io(ar(Un(r,l,c),u),u<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==Xt(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return vu(l.getBoundingClientRect(),!1)}if(o==null&&i<Xt(r)){let l=r.childNodes[i];if(l.nodeType==1)return vu(l.getBoundingClientRect(),!0)}return vu(r.getBoundingClientRect(),n>=0)}if(o==null&&i&&(n<0||i==Xt(r))){let l=r.childNodes[i-1],c=l.nodeType==3?Un(l,Xt(l)-(s?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return Io(ar(c,1),!1)}if(o==null&&i<Xt(r)){let l=r.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?Un(l,0,s?0:1):l.nodeType==1?l:null:null;if(c)return Io(ar(c,-1),!0)}return Io(ar(r.nodeType==3?Un(r):r,-n),n>=0)}function Io(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 vu(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 Vb(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 wC(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return Vb(t,e,()=>{let{node:o}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(o,!0);if(!a)break;if(a.node.isBlock){o=a.contentDOM||a.dom;break}o=a.dom.parentNode}let s=Ub(t,i.pos,1);for(let a=o.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=Un(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(n=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const EC=/[\u0590-\u08ac]/;function kC(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,a=t.domSelection();return a?!EC.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?o:s:Vb(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=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(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return f!=null&&(a.caretBidiLevel=f),y}):r.pos==r.start()||r.pos==r.end()}let zp=null,Up=null,Vp=!1;function CC(t,e,n){return zp==e&&Up==n?Vp:(zp=e,Up=n,Vp=n=="up"||n=="down"?wC(t,e,n):kC(t,e,n))}const Qt=0,Wp=1,qr=2,Mn=3;class Ks{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Qt,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 o,s;if(e==this.contentDOM)o=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.previousSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(s)+s.size:this.posAtStart}else{let o,s;if(e==this.contentDOM)o=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(s):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>dt(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 o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.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 o=this.getDesc(i),s;if(o&&(!n||o.node))if(r&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return o}}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 o=this.getDesc(i);if(o)return o.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],o=r+i.size;if(r==e&&o!=r){for(;!i.border&&i.children.length;)for(let s=0;s<i.children.length;s++){let a=i.children[s];if(a.size){i=a;break}}return i}if(e<o)return i.descAt(e-r-i.border);r=o}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let s=this.children[r],a=o+s.size;if(a>e||s instanceof Kb){i=e-o;break}o=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof Wb&&o.side>=0;r--);if(n<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&n&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,n):{node:this.contentDOM,offset:o?dt(o.dom)+1:0}}else{let o,s=!0;for(;o=r<this.children.length?this.children[r]:null,!(!o||o.dom.parentNode==this.contentDOM);r++,s=!1);return o&&s&&!o.border&&!o.domAtom?o.domFromPos(0,n):{node:this.contentDOM,offset:o?dt(o.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,o=-1;for(let s=r,a=0;;a++){let l=this.children[a],c=s+l.size;if(i==-1&&e<=c){let u=s+l.border;if(e>=u&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,u);e=s;for(let d=a;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=dt(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 u=a+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){o=dt(d.dom);break}n+=d.size}o==-1&&(o=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:o}}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 o=Math.min(e,n),s=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(o>m&&s<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(),u=r.domSelectionRange(),d=!1;if((Zt||vt)&&e==n){let{node:h,offset:m}=a;if(h.nodeType==3){if(d=!!(m&&h.nodeValue[m-1]==`
6
- `),d&&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:dt(y)+1});break}let b=g.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let g=h.childNodes[m-1];d=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(Zt&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(i=!0)}if(!(i||d&&vt)&&li(a.node,a.offset,u.anchorNode,u.anchorOffset)&&li(l.node,l.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==n)&&!(d&&Zt)){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 o=this.children[i],s=r+o.size;if(r==s?e<=s&&n>=r:e<s&&n>r){let a=r+o.border,l=s-o.border;if(e>=a&&n<=l){this.dirty=e==r||n==s?qr:Wp,e==a&&n==l&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=Mn:o.markDirty(e-a,n-a);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?qr:Mn}r=s}this.dirty=qr}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?qr:Wp;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Wb extends Ks{constructor(e,n,r,i){let o,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!n.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,o=this}matchesWidget(e){return this.dirty==Qt&&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 SC extends Ks{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 ci extends Ks{constructor(e,n,r,i,o){super(e,[],r,i),this.mark=n,this.spec=o}static create(e,n,r,i){let o=i.nodeViews[n.type.name],s=o&&o(n,i,r);return(!s||!s.dom)&&(s=hi.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new ci(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Mn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Mn&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Qt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Qt}}slice(e,n,r){let i=ci.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;n<s&&(o=Id(o,n,s,r)),e>0&&(o=Id(o,0,e,r));for(let a=0;a<o.length;a++)o[a].parent=i;return i.children=o,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Cr extends Ks{constructor(e,n,r,i,o,s,a,l,c){super(e,[],o,s),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,n,r,i,o,s){let a=o.nodeViews[n.type.name],l,c=a&&a(n,o,()=>{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},r,i),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=hi.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=Yb(u,r,n),c?l=new _C(e,n,r,i,u,d||null,f,c,o,s+1):n.isText?new wc(e,n,r,i,u,f,o):new Cr(e,n,r,i,u,d||null,f,o,s+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=()=>P.empty)}return e}matchesNode(e,n,r){return this.dirty==Qt&&e.eq(this.node)&&ul(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,o=e.composing?this.localCompositionInfo(e,n):null,s=o&&o.pos>-1?o:null,a=o&&o.pos<0,l=new TC(this,s&&s.node,e);OC(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e,u):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?Le.none:this.node.child(u).marks,r,e,u),l.placeWidget(c,e,i)},(c,u,d,f)=>{l.syncToMarks(c.marks,r,e,f);let h;l.findNodeMatch(c,u,d,f)||a&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(h=l.findIndexWithChild(o.node))>-1&&l.updateNodeAt(c,u,d,h,e)||l.updateNextNode(c,u,d,e,f,i)||l.addNode(c,u,d,e,i),i+=c.nodeSize}),l.syncToMarks([],r,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==qr)&&(s&&this.protectLocalComposition(e,s),Gb(this.contentDOM,this.children,e),Xi&&RC(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof ue)||r<n||i>n+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let s=o.nodeValue,a=IC(this.node.content,s,r-n,i-n);return a<0?null:{node:o,pos:a,text:s}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let o=n;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new SC(this,o,n,i);e.input.compositionNodes.push(s),this.children=Id(this.children,r,r+i.length,e,s)}update(e,n,r,i){return this.dirty==Mn||!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=Qt}updateOuterDeco(e){if(ul(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=qb(this.dom,this.nodeDOM,Rd(this.outerDeco,this.node,n),Rd(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 Kp(t,e,n,r,i){Yb(r,e,t);let o=new Cr(void 0,t,e,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class wc extends Cr{constructor(e,n,r,i,o,s,a){super(e,n,r,i,o,null,s,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==Mn||this.dirty!=Qt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Qt||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=Qt,!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),o=document.createTextNode(i.text);return new wc(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Mn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Kb extends Ks{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Qt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class _C extends Cr{constructor(e,n,r,i,o,s,a,l,c,u){super(e,n,r,i,o,s,a,c,u),this.spec=l}update(e,n,r,i){if(this.dirty==Mn)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,n,r);return o&&this.updateInner(e,n,r,i),o}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 Gb(t,e,n){let r=t.firstChild,i=!1;for(let o=0;o<e.length;o++){let s=e[o],a=s.dom;if(a.parentNode==t){for(;a!=r;)r=Gp(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(a,r);if(s instanceof ci){let l=r?r.previousSibling:t.lastChild;Gb(s.contentDOM,s.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=Gp(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const Ko=function(t){t&&(this.nodeName=t)};Ko.prototype=Object.create(null);const Yr=[new Ko];function Rd(t,e,n){if(t.length==0)return Yr;let r=n?Yr[0]:new Ko,i=[r];for(let o=0;o<t.length;o++){let s=t[o].type.attrs;if(s){s.nodeName&&i.push(r=new Ko(s.nodeName));for(let a in s){let l=s[a];l!=null&&(n&&i.length==1&&i.push(r=new Ko(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 qb(t,e,n,r){if(n==Yr&&r==Yr)return e;let i=e;for(let o=0;o<r.length;o++){let s=r[o],a=n[o];if(o){let l;a&&a.nodeName==s.nodeName&&i!=t&&(l=i.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||(l=document.createElement(s.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=Yr[0]),i=l}NC(i,a||Yr[0],s)}return i}function NC(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 o=0;o<r.length;o++)i.indexOf(r[o])==-1&&t.classList.remove(r[o]);for(let o=0;o<i.length;o++)r.indexOf(i[o])==-1&&t.classList.add(i[o]);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 Yb(t,e,n){return qb(t,t,Yr,Rd(e,n,t.nodeType!=1))}function ul(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 Gp(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class TC{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=AC(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 o=0,s=this.stack.length>>1,a=Math.min(s,e.length);for(;o<a&&(o==s-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<s;)this.destroyRest(),this.top.dirty=Qt,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let l=-1,c=this.top.children.length;i<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let u=this.index;u<c;u++){let d=this.top.children[u];if(d.matchesMark(e[s])&&!this.isLocked(d.dom)){l=u;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let u=ci.create(this.top,e[s],n,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,r,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))o=this.top.children.indexOf(s,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)){o=a;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(e,n,r,i,o){let s=this.top.children[i];return s.dirty==Mn&&s.dom==s.contentDOM&&(s.dirty=qr),s.update(e,n,r,o)?(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,o,s){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Cr){let c=this.preMatch.matched.get(l);if(c!=null&&c!=o)return!1;let u=l.dom,d,f=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=Mn&&ul(n,l.outerDeco));if(!f&&l.update(e,n,r,i))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(l,e,n,r,i,s)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=qr,d.updateChildren(i,s+1),d.dirty=Qt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,o,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!ul(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=Cr.create(this.top,n,r,i,o,s);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,o){let s=Cr.create(this.top,e,n,r,i,o);s.contentDOM&&s.updateChildren(i,o+1),this.top.children.splice(this.index++,0,s),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 o=new Wb(this.top,e,n,r);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof ci;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof wc)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((vt||ht)&&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 Kb(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 AC(t,e){let n=e,r=n.children.length,i=t.childCount,o=new Map,s=[];e:for(;i>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof ci)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,o.set(a,i),s.push(a)}}return{index:i,matched:o,matches:s.reverse()}}function MC(t,e){return t.type.side-e.type.side}function OC(t,e,n,r){let i=e.locals(t),o=0;if(i.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,i,e.forChild(o,u),c),o+=u.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let u,d;for(;s<i.length&&i[s].to==o;){let y=i[s++];y.widget&&(u?(d||(d=[u])).push(y):u=y)}if(u)if(d){d.sort(MC);for(let y=0;y<d.length;y++)n(d[y],c,!!l)}else n(u,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<=o&&a.splice(y--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)a.push(i[s++]);let m=o+f.nodeSize;if(f.isText){let y=m;s<i.length&&i[s].from<y&&(y=i[s].from);for(let b=0;b<a.length;b++)a[b].to<y&&(y=a[b].to);y<m&&(l=f.cut(y-o),f=f.cut(0,y-o),m=y,h=-1)}else for(;s<i.length&&i[s].to<m;)s++;let g=f.isInline&&!f.isLeaf?a.filter(y=>!y.inline):a.slice();r(f,g,e.forChild(o,f),h),o=m}}function RC(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 IC(t,e,n,r){for(let i=0,o=0;i<t.childCount&&o<=r;){let s=t.child(i++),a=o;if(o+=s.nodeSize,!s.isText)continue;let l=s.text;for(;i<t.childCount;){let c=t.child(i++);if(o+=c.nodeSize,!c.isText)break;l+=c.text}if(o>=n){if(o>=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 Id(t,e,n,r,i){let o=[];for(let s=0,a=0;s<t.length;s++){let l=t[s],c=a,u=a+=l.size;c>=n||u<=e?o.push(l):(c<e&&o.push(l.slice(0,e-c,r)),i&&(o.push(i),i=void 0),u>n&&o.push(l.slice(n-c,l.size,r)))}return o}function Lf(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),o=i&&i.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,c;if(xc(n)){for(l=s;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&se.isSelectable(d)&&i.parent&&!(d.isInline&&sC(n.focusNode,n.focusOffset,i.dom))){let f=i.posBefore;c=new se(s==f?a:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=s,f=s;for(let h=0;h<n.rangeCount;h++){let m=n.getRangeAt(h);d=Math.min(d,t.docView.posFromDOM(m.startContainer,m.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(d<0)return null;[l,s]=f==t.state.selection.anchor?[f,d]:[d,f],a=r.resolve(s)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let u=r.resolve(l);if(!c){let d=e=="pointer"||t.state.selection.head<a.pos&&!o?1:-1;c=Pf(t,u,a,d)}return c}function Jb(t){return t.editable?t.hasFocus():Zb(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function qn(t,e=!1){let n=t.state.selection;if(Xb(t,n),!!Jb(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&ht){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&li(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)LC(t);else{let{anchor:r,head:i}=n,o,s;qp&&!(n instanceof ue)&&(n.$from.parent.inlineContent||(o=Yp(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=Yp(t,n.to))),t.docView.setSelection(r,i,t,e),qp&&(o&&Jp(o),s&&Jp(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&DC(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const qp=vt||ht&&Bb<63;function Yp(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(vt&&i&&i.contentEditable=="false")return xu(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return xu(i);if(o)return xu(o)}}function xu(t){return t.contentEditable="true",vt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Jp(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function DC(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(()=>{(!Jb(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function LC(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,dt(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&It&&kr<=11&&(n.disabled=!0,n.disabled=!1)}function Xb(t,e){if(e instanceof se){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Xp(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Xp(t)}function Xp(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Pf(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||ue.between(e,n,r)}function Zp(t){return t.editable&&!t.hasFocus()?!1:Zb(t)}function Zb(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 PC(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return li(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Dd(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return o&&ge.findFrom(o,e)}function ur(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Qp(t,e,n){let r=t.state.selection;if(r instanceof ue)if(n.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=t.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return ur(t,new ue(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Dd(t.state,e);return i&&i instanceof se?ur(t,i):!1}else if(!(Jt&&n.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let a=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=t.docView.descAt(a))&&!s.contentDOM?se.isSelectable(o)?ur(t,new se(e<0?t.state.doc.resolve(i.pos-o.nodeSize):i)):Ws?ur(t,new ue(t.state.doc.resolve(e<0?a:a+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof se&&r.node.isInline)return ur(t,new ue(e>0?r.$to:r.$from));{let i=Dd(t.state,e);return i?ur(t,i):!1}}}function dl(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Go(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Ci(t,e){return e<0?BC(t):$C(t)}function BC(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,o,s=!1;for(Zt&&n.nodeType==1&&r<dl(n)&&Go(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Go(a,-1))i=n,o=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(Qb(n))break;{let a=n.previousSibling;for(;a&&Go(a,-1);)i=n.parentNode,o=dt(a),a=a.previousSibling;if(a)n=a,r=dl(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?Ld(t,n,r):i&&Ld(t,i,o)}function $C(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=dl(n),o,s;for(;;)if(r<i){if(n.nodeType!=1)break;let a=n.childNodes[r];if(Go(a,1))o=n,s=++r;else break}else{if(Qb(n))break;{let a=n.nextSibling;for(;a&&Go(a,1);)o=a.parentNode,s=dt(a)+1,a=a.nextSibling;if(a)n=a,r=0,i=dl(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}o&&Ld(t,o,s)}function Qb(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function jC(t,e){for(;t&&e==t.childNodes.length&&!Vs(t);)e=dt(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 FC(t,e){for(;t&&!e&&!Vs(t);)e=dt(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 Ld(t,e,n){if(e.nodeType!=3){let o,s;(s=jC(e,n))?(e=s,n=0):(o=FC(e,n))&&(e=o,n=o.nodeValue.length)}let r=t.domSelection();if(!r)return;if(xc(r)){let o=document.createRange();o.setEnd(e,n),o.setStart(e,n),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&qn(t)},50)}function em(t,e){let n=t.state.doc.resolve(e);if(!(ht||$b)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let o=t.coordsAtPos(e-1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(e<n.end()){let o=t.coordsAtPos(e+1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function tm(t,e,n){let r=t.state.selection;if(r instanceof ue&&!r.empty||n.indexOf("s")>-1||Jt&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=Dd(t.state,e);if(s&&s instanceof se)return ur(t,s)}if(!i.parent.inlineContent){let s=e<0?i:o,a=r instanceof Ht?ge.near(s,e):ge.findFrom(s,e);return a?ur(t,a):!1}return!1}function nm(t,e){if(!(t.state.selection instanceof ue))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 o=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let s=t.state.tr;return e<0?s.delete(n.pos-o.nodeSize,n.pos):s.delete(n.pos,n.pos+o.nodeSize),t.dispatch(s),!0}return!1}function rm(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function HC(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;rm(t,r,"true"),setTimeout(()=>rm(t,r,"false"),20)}return!1}function zC(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function UC(t,e){let n=e.keyCode,r=zC(e);if(n==8||Jt&&n==72&&r=="c")return nm(t,-1)||Ci(t,-1);if(n==46&&!e.shiftKey||Jt&&n==68&&r=="c")return nm(t,1)||Ci(t,1);if(n==13||n==27)return!0;if(n==37||Jt&&n==66&&r=="c"){let i=n==37?em(t,t.state.selection.from)=="ltr"?-1:1:-1;return Qp(t,i,r)||Ci(t,i)}else if(n==39||Jt&&n==70&&r=="c"){let i=n==39?em(t,t.state.selection.from)=="ltr"?1:-1:1;return Qp(t,i,r)||Ci(t,i)}else{if(n==38||Jt&&n==80&&r=="c")return tm(t,-1,r)||Ci(t,-1);if(n==40||Jt&&n==78&&r=="c")return HC(t)||tm(t,1,r)||Ci(t,1);if(r==(Jt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Bf(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let s=t.someProp("clipboardSerializer")||hi.fromSchema(t.state.schema),a=o0(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=i0[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let m=a.createElement(u[h]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${o}${d?` -${d}`:""} ${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 e0(t,e,n,r,i){let o=i.parent.type.spec.code,s,a;if(!n&&!e)return null;let l=!!e&&(r||o||!n);if(l){if(t.someProp("transformPastedText",f=>{e=f(e,o||r,t)}),o)return a=new Y(P.from(t.state.schema.text(e.replace(/\r\n?/g,`
9
- `))),0,0),t.someProp("transformPasted",f=>{a=f(a,t,!0)}),a;let d=t.someProp("clipboardTextParser",f=>f(e,i,r,t));if(d)a=d;else{let f=i.marks(),{schema:h}=t.state,m=hi.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=s.appendChild(document.createElement("p"));g&&y.appendChild(m.serializeNode(h.text(g,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),s=GC(n),Ws&&qC(s);let c=s&&s.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=s.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;s=f}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||Vo.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||u),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!VC.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)a=YC(im(a,+u[1],+u[2]),u[4]);else if(a=Y.maxOpen(WC(a.content,i),!0),a.openStart||a.openEnd){let d=0,f=0;for(let h=a.content.firstChild;d<a.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=a.content.lastChild;f<a.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);a=im(a,d,f)}return t.someProp("transformPasted",d=>{a=d(a,t,l)}),a}const VC=/^(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 WC(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)),o,s=[];if(t.forEach(a=>{if(!s)return;let l=i.findWrapping(a.type),c;if(!l)return s=null;if(c=s.length&&o.length&&n0(l,o,a,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=r0(s[s.length-1],o.length));let u=t0(a,l);s.push(u),i=i.matchType(u.type),o=l}}),s)return P.from(s)}return t}function t0(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,P.from(t));return t}function n0(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let o=n0(t,e,n,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(P.from(t0(n,t,i+1))))}}function r0(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,r0(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(P.empty,!0);return t.copy(n.append(r))}function Pd(t,e,n,r,i,o){let s=e<0?t.firstChild:t.lastChild,a=s.content;return t.childCount>1&&(o=0),i<r-1&&(a=Pd(a,e,n,r,i+1,o)),i>=n&&(a=e<0?s.contentMatchAt(0).fillBefore(a,o<=i).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(P.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function im(t,e,n){return e<t.openStart&&(t=new Y(Pd(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new Y(Pd(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const i0={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 om=null;function o0(){return om||(om=document.implementation.createHTMLDocument("title"))}let wu=null;function KC(t){let e=window.trustedTypes;return e?(wu||(wu=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),wu.createHTML(t)):t}function GC(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=o0().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&i0[r[1].toLowerCase()])&&(t=i.map(o=>"<"+o+">").join("")+t+i.map(o=>"</"+o+">").reverse().join("")),n.innerHTML=KC(t),i)for(let o=0;o<i.length;o++)n=n.querySelector(i[o])||n;return n}function qC(t){let e=t.querySelectorAll(ht?"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 YC(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:o,openEnd:s}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=P.from(l.create(r[a+1],i)),o++,s++}return new Y(i,o,s)}const St={},_t={},JC={touchstart:!0,touchmove:!0};class XC{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 ZC(t){for(let e in St){let n=St[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{eS(t,r)&&!$f(t,r)&&(t.editable||!(r.type in _t))&&n(t,r)},JC[e]?{passive:!0}:void 0)}vt&&t.dom.addEventListener("input",()=>null),Bd(t)}function br(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function QC(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 Bd(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>$f(t,r))})}function $f(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function eS(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 tS(t,e){!$f(t,e)&&St[e.type]&&(t.editable||!(e.type in _t))&&St[e.type](t,e)}_t.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!a0(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Vn&&ht&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Xi&&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,Kr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||UC(t,n)?n.preventDefault():br(t,"key")};_t.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};_t.keypress=(t,e)=>{let n=e;if(a0(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Jt&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof ue)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),o=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,i,o))&&t.dispatch(o()),n.preventDefault()}};function Ec(t){return{left:t.clientX,top:t.clientY}}function nS(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function jf(t,e,n,r,i){if(r==-1)return!1;let o=t.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(t.someProp(e,a=>s>o.depth?a(t,n,o.nodeAfter,o.before(s),i,!0):a(t,n,o.node(s),o.before(s),i,!1)))return!0;return!1}function zi(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 rS(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&se.isSelectable(r)?(zi(t,new se(n)),!0):!1}function iS(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof se&&(r=n.node);let o=t.state.doc.resolve(e);for(let s=o.depth+1;s>0;s--){let a=s>o.depth?o.nodeAfter:o.node(s);if(se.isSelectable(a)){r&&n.$from.depth>0&&s>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?i=o.before(n.$from.depth):i=o.before(s);break}}return i!=null?(zi(t,se.create(t.state.doc,i)),!0):!1}function oS(t,e,n,r,i){return jf(t,"handleClickOn",e,n,r)||t.someProp("handleClick",o=>o(t,e,r))||(i?iS(t,n):rS(t,n))}function sS(t,e,n,r){return jf(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function aS(t,e,n,r){return jf(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||lS(t,n,r)}function lS(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(zi(t,ue.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let s=o>i.depth?i.nodeAfter:i.node(o),a=i.before(o);if(s.inlineContent)zi(t,ue.create(r,a+1,a+1+s.content.size));else if(se.isSelectable(s))zi(t,se.create(r,a));else continue;return!0}}function Ff(t){return fl(t)}const s0=Jt?"metaKey":"ctrlKey";St.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Ff(t),i=Date.now(),o="singleClick";i-t.input.lastClick.time<500&&nS(n,t.input.lastClick)&&!n[s0]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?o="doubleClick":t.input.lastClick.type=="doubleClick"&&(o="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o,button:n.button};let s=t.posAtCoords(Ec(n));s&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new cS(t,s,n,!!r)):(o=="doubleClick"?sS:aS)(t,s.pos,s.inside,n)?n.preventDefault():br(t,"pointer"))};class cS{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[s0],this.allowDefault=r.shiftKey;let o,s;if(n.inside>-1)o=e.state.doc.nodeAt(n.inside),s=n.inside;else{let u=e.state.doc.resolve(n.pos);o=u.parent,s=u.depth?u.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&&(o.type.spec.draggable&&o.type.spec.selectable!==!1||c instanceof se&&c.from<=s&&c.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Zt&&!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)),br(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(()=>qn(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(Ec(e))),this.updateAllowDefault(e),this.allowDefault||!n?br(this.view,"pointer"):oS(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||vt&&this.mightDrag&&!this.mightDrag.node.isAtom||ht&&!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)?(zi(this.view,ge.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):br(this.view,"pointer")}move(e){this.updateAllowDefault(e),br(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)}}St.touchstart=t=>{t.input.lastTouch=Date.now(),Ff(t),br(t,"pointer")};St.touchmove=t=>{t.input.lastTouch=Date.now(),br(t,"pointer")};St.contextmenu=t=>Ff(t);function a0(t,e){return t.composing?!0:vt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const uS=Vn?5e3:-1;_t.compositionstart=_t.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof ue&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||ht&&$b&&dS(t)))t.markCursor=t.state.storedMarks||n.marks(),fl(t,!0),t.markCursor=null;else if(fl(t,!e.selection.empty),Zt&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){let a=t.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else i=s,o=-1}}t.input.composing=!0}l0(t,uS)};function dS(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"}_t.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++,l0(t,20))};function l0(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>fl(t),e))}function c0(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=hS());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function fS(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=iC(e.focusNode,e.focusOffset),r=oC(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,o=t.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function hS(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function fl(t,e=!1){if(!(Vn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),c0(t),e||t.docView&&t.docView.dirty){let n=Lf(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 pS(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 fs=It&&kr<15||Xi&&cC<604;St.copy=_t.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let o=fs?null:n.clipboardData,s=r.content(),{dom:a,text:l}=Bf(t,s);o?(n.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",l)):pS(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function mS(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function gS(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?hs(t,r.value,null,i,e):hs(t,r.textContent,r.innerHTML,i,e)},50)}function hs(t,e,n,r,i){let o=e0(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,i,o||Y.empty)))return!0;if(!o)return!1;let s=mS(o),a=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(o);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," "):""}_t.paste=(t,e)=>{let n=e;if(t.composing&&!Vn)return;let r=fs?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&hs(t,u0(r),r.getData("text/html"),i,n)?n.preventDefault():gS(t,n)};class d0{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const yS=Jt?"altKey":"ctrlKey";function f0(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[yS]}St.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,o=i.empty?null:t.posAtCoords(Ec(n)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof se?i.to-1:i.to))){if(r&&r.mightDrag)s=se.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(s=se.create(t.state.doc,d.posBefore))}}let a=(s||t.state.selection).content(),{dom:l,text:c,slice:u}=Bf(t,a);(!n.dataTransfer.files.length||!ht||Bb>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(fs?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",fs||n.dataTransfer.setData("text/plain",c),t.dragging=new d0(u,f0(t,n),s)};St.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};_t.dragover=_t.dragenter=(t,e)=>e.preventDefault();_t.drop=(t,e)=>{try{bS(t,e,t.dragging)}finally{t.dragging=null}};function bS(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Ec(e));if(!r)return;let i=t.state.doc.resolve(r.pos),o=n&&n.slice;o?t.someProp("transformPasted",h=>{o=h(o,t,!1)}):o=e0(t,u0(e.dataTransfer),fs?null:e.dataTransfer.getData("text/html"),!1,i);let s=!!(n&&f0(t,e));if(t.someProp("handleDrop",h=>h(t,e,o||Y.empty,s))){e.preventDefault();return}if(!o)return;e.preventDefault();let a=o?Nb(t.state.doc,i.pos,o):i.pos;a==null&&(a=i.pos);let l=t.state.tr;if(s){let{node:h}=n;h?h.replace(l):l.deleteSelection()}let c=l.mapping.map(a),u=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,d=l.doc;if(u?l.replaceRangeWith(c,c,o.content.firstChild):l.replaceRange(c,c,o),l.doc.eq(d))return;let f=l.doc.resolve(c);if(u&&se.isSelectable(o.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(o.content.firstChild))l.setSelection(new se(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(Pf(t,f,l.doc.resolve(h)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}St.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())&&qn(t)},20))};St.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)};St.beforeinput=(t,e)=>{if(ht&&Vn&&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",o=>o(t,Kr(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 _t)St[t]=_t[t];function ps(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 hl{constructor(e,n){this.toDOM=e,this.spec=n||Qr,this.side=this.spec.side||0}map(e,n,r,i){let{pos:o,deleted:s}=e.mapResult(n.from+i,this.side<0?-1:1);return s?null:new pt(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof hl&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&ps(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Sr{constructor(e,n){this.attrs=e,this.spec=n||Qr}map(e,n,r,i){let o=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new pt(o,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Sr&&ps(this.attrs,e.attrs)&&ps(this.spec,e.spec)}static is(e){return e.type instanceof Sr}destroy(){}}class Hf{constructor(e,n){this.attrs=e,this.spec=n||Qr}map(e,n,r,i){let o=e.mapResult(n.from+i,1);if(o.deleted)return null;let s=e.mapResult(n.to+i,-1);return s.deleted||s.pos<=o.pos?null:new pt(o.pos-r,s.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),o;return i==n.from&&!(o=e.child(r)).isText&&i+o.nodeSize==n.to}eq(e){return this==e||e instanceof Hf&&ps(this.attrs,e.attrs)&&ps(this.spec,e.spec)}destroy(){}}class pt{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new pt(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 pt(e,e,new hl(n,r))}static inline(e,n,r,i){return new pt(e,n,new Sr(r,i))}static node(e,n,r,i){return new pt(e,n,new Hf(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Sr}get widget(){return this.type instanceof hl}}const Ii=[],Qr={};class He{constructor(e,n){this.local=e.length?e:Ii,this.children=n.length?n:Ii}static create(e,n){return n.length?pl(n,e,0,Qr):yt}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,o){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=n&&a.to>=e&&(!o||o(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let a=this.children[s]+1;this.children[s+2].findInner(e-a,n-a,r,i+a,o)}}map(e,n,r){return this==yt||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Qr)}mapInner(e,n,r,i,o){let s;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,i);l&&l.type.valid(n,l)?(s||(s=[])).push(l):o.onRemove&&o.onRemove(this.local[a].spec)}return this.children.length?vS(this.children,s||[],e,n,r,i,o):s?new He(s.sort(ei),Ii):yt}add(e,n){return n.length?this==yt?He.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,o=0;e.forEach((a,l)=>{let c=l+r,u;if(u=p0(n,a,c)){for(i||(i=this.children.slice());o<i.length&&i[o]<l;)o+=3;i[o]==l?i[o+2]=i[o+2].addInner(a,u,c+1):i.splice(o,0,l,l+a.nodeSize,pl(u,a,c+1,Qr)),o+=3}});let s=h0(o?m0(n):n,-r);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||s.splice(a--,1);return new He(s.length?this.local.concat(s).sort(ei):this.local,i||this.children)}remove(e){return e.length==0||this==yt?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let s,a=r[o]+n,l=r[o+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>a&&d.to<l&&(e[u]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[o+2].removeInner(s,a+1);c!=yt?r[o+2]=c:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,s;o<e.length;o++)if(s=e[o])for(let a=0;a<i.length;a++)i[a].eq(s,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 He(i,r):yt}forChild(e,n){if(this==yt)return this;if(n.isLeaf)return He.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 o=e+1,s=o+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<s&&l.to>o&&l.type instanceof Sr){let c=Math.max(o,l.from)-o,u=Math.min(s,l.to)-o;c<u&&(i||(i=[])).push(l.copy(c,u))}}if(i){let a=new He(i.sort(ei),Ii);return r?new hr([a,r]):a}return r||yt}eq(e){if(this==e)return!0;if(!(e instanceof He)||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 zf(this.localsInner(e))}localsInner(e){if(this==yt)return Ii;if(e.inlineContent||!this.local.some(Sr.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Sr||n.push(this.local[r]);return n}forEachSet(e){e(this)}}He.empty=new He([],[]);He.removeOverlap=zf;const yt=He.empty;class hr{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Qr));return hr.from(r)}forChild(e,n){if(n.isLeaf)return He.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,n);o!=yt&&(o instanceof hr?r=r.concat(o.members):r.push(o))}return hr.from(r)}eq(e){if(!(e instanceof hr)||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 o=this.members[i].localsInner(e);if(o.length)if(!n)n=o;else{r&&(n=n.slice(),r=!1);for(let s=0;s<o.length;s++)n.push(o[s])}}return n?zf(r?n:n.sort(ei)):Ii}static from(e){switch(e.length){case 0:return yt;case 1:return e[0];default:return new hr(e.every(n=>n instanceof He)?e:e.reduce((n,r)=>n.concat(r instanceof He?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function vS(t,e,n,r,i,o,s){let a=t.slice();for(let c=0,u=o;c<n.maps.length;c++){let d=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+u-d)continue;let E=a[b]+u-d;h>=E?a[b+1]=f<=E?-2:-1:f>=u&&y&&(a[b]+=y,a[b+1]+=y)}d+=y}),u=n.maps[c].map(u,-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 u=n.map(t[c]+o),d=u-i;if(d<0||d>=r.content.size){l=!0;continue}let f=n.map(t[c+1]+o,-1),h=f-i,{index:m,offset:g}=r.content.findIndex(d),y=r.maybeChild(m);if(y&&g==d&&g+y.nodeSize==h){let b=a[c+2].mapInner(n,y,u+1,t[c]+o+1,s);b!=yt?(a[c]=d,a[c+1]=h,a[c+2]=b):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=xS(a,t,e,n,i,o,s),u=pl(c,r,0,s);e=u.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<a.length&&a[f]<h;)f+=3;a.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new He(e.sort(ei),a)}function h0(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 pt(i.from+e,i.to+e,i.type))}return n}function xS(t,e,n,r,i,o,s){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(r,i,c);d?n.push(d):s.onRemove&&s.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+o+1);return n}function p0(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let o=0,s;o<t.length;o++)(s=t[o])&&s.from>n&&s.to<r&&((i||(i=[])).push(s),t[o]=null);return i}function m0(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function pl(t,e,n,r){let i=[],o=!1;e.forEach((a,l)=>{let c=p0(t,a,l+n);if(c){o=!0;let u=pl(c,a,n+l+1,r);u!=yt&&i.push(l,l+a.nodeSize,u)}});let s=h0(o?m0(t):t,-n).sort(ei);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||i.length?new He(s,i):yt}function ei(t,e){return t.from-e.from||t.to-e.to}function zf(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 o=e[i];if(o.from==r.from){o.to!=r.to&&(e==t&&(e=t.slice()),e[i]=o.copy(o.from,r.to),sm(e,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,o.from),sm(e,i,r.copy(o.from,r.to)));break}}}return e}function sm(t,e,n){for(;e<t.length&&ei(n,t[e])>0;)e++;t.splice(e,0,n)}function Eu(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=yt&&e.push(r)}),t.cursorWrapper&&e.push(He.create(t.state.doc,[t.cursorWrapper.deco])),hr.from(e)}const wS={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},ES=It&&kr<=11;class kS{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 CS{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new kS,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]);It&&kr<=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()}),ES&&(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,wS)),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(Zp(this.view)){if(this.suppressingSelectionUpdates)return qn(this.view);if(It&&kr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&li(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 o=e.focusNode;o;o=Ji(o))n.add(o);for(let o=e.anchorNode;o;o=Ji(o))if(n.has(o)){r=o;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)&&Zp(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,a=!1,l=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],l);d&&(o=o<0?d.from:Math.min(d.from,o),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(a=!0))}if(l.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of l)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;for(;d&&d.nodeType==1;){if(d.contentEditable=="false"){u.parentNode.removeChild(u);break}d=d.firstChild}}}else if(Zt&&l.length){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||NS(e,d)!=h)&&f.remove()}}}let c=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&xc(r)&&(c=Lf(e))&&c.eq(ge.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,qn(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),SS(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,TS(e,l)),this.handleDOMChange(o,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||qn(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 u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,o=e.nextSibling;if(It&&kr<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(o=f)}let s=i&&i.parentNode==e.target?dt(i)+1:0,a=r.localPosFromDOM(e.target,s,-1),l=o&&o.parentNode==e.target?dt(o):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 am=new WeakMap,lm=!1;function SS(t){if(!am.has(t)&&(am.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Zt,lm)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."),lm=!0}}function cm(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return li(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function _S(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return cm(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?cm(t,n):null}function NS(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 TS(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let o of e)if(((n=o.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let s=o.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let a=s;for(;;){let l=a.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;a=l}a.insertBefore(o,a.firstChild),r==o&&t.domSelection().collapse(o,i)}else o.parentNode.removeChild(o)}}function AS(t,e,n){let{node:r,fromOffset:i,toOffset:o,from:s,to:a}=t.docView.parseRange(e,n),l=t.domSelectionRange(),c,u=l.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],xc(l)||c.push({node:l.focusNode,offset:l.focusOffset})),ht&&t.input.lastKeyCode===8)for(let y=o;y>i;y--){let b=r.childNodes[y-1],w=b.pmViewDesc;if(b.nodeName=="BR"&&!w){o=y;break}if(!w||w.size)break}let d=t.state.doc,f=t.someProp("domParser")||Vo.fromSchema(t.state.schema),h=d.resolve(s),m=null,g=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:o,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:MS,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+s,head:b+s}}return{doc:g,sel:m,from:s,to:a}}function MS(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 OS=/^(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 RS(t,e,n,r,i){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let S=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,N=Lf(t,S);if(N&&!t.state.selection.eq(N)){if(ht&&Vn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",D=>D(t,Kr(13,"Enter"))))return;let M=t.state.tr.setSelection(N);S=="pointer"?M.setMeta("pointer",!0):S=="key"&&M.scrollIntoView(),o&&M.setMeta("composition",o),t.dispatch(M)}return}let s=t.state.doc.resolve(e),a=s.sharedDepth(n);e=s.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,c=AS(t,e,n),u=t.state.doc,d=u.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=LS(d.content,c.doc.content,c.from,f,h);if(m&&t.input.domChangeCount++,(Xi&&t.input.lastIOSEnter>Date.now()-225||Vn)&&i.some(S=>S.nodeType==1&&!OS.test(S.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",S=>S(t,Kr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(r&&l instanceof ue&&!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 S=um(t,t.state.doc,c.sel);if(S&&!S.eq(t.state.selection)){let N=t.state.tr.setSelection(S);o&&N.setMeta("composition",o),t.dispatch(N)}}return}t.state.selection.from<t.state.selection.to&&m.start==m.endB&&t.state.selection instanceof ue&&(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)),It&&kr<=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=u.resolve(m.start),w=g.sameParent(y)&&g.parent.inlineContent&&b.end()>=m.endA;if((Xi&&t.input.lastIOSEnter>Date.now()-225&&(!w||i.some(S=>S.nodeName=="DIV"||S.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",S=>S(t,Kr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&DS(u,m.start,m.endA,g,y)&&t.someProp("handleKeyDown",S=>S(t,Kr(8,"Backspace")))){Vn&&ht&&t.domObserver.suppressSelectionUpdates();return}ht&&m.endB==m.start&&(t.input.lastChromeDelete=Date.now()),Vn&&!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(S){return S(t,Kr(13,"Enter"))})},20));let E=m.start,v=m.endA,k=S=>{let N=S||t.state.tr.replace(E,v,c.doc.slice(m.start-c.from,m.endB-c.from));if(c.sel){let M=um(t,N.doc,c.sel);M&&!(ht&&t.composing&&M.empty&&(m.start!=m.endB||t.input.lastChromeDelete<Date.now()-100)&&(M.head==E||M.head==N.mapping.map(v)-1)||It&&M.empty&&M.head==E)&&N.setSelection(M)}return o&&N.setMeta("composition",o),N.scrollIntoView()},C;if(w)if(g.pos==y.pos){It&&kr<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>qn(t),20));let S=k(t.state.tr.delete(E,v)),N=u.resolve(m.start).marksAcross(u.resolve(m.endA));N&&S.ensureMarks(N),t.dispatch(S)}else if(m.endA==m.endB&&(C=IS(g.parent.content.cut(g.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,m.endA-b.start())))){let S=k(t.state.tr);C.type=="add"?S.addMark(E,v,C.mark):S.removeMark(E,v,C.mark),t.dispatch(S)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let S=g.parent.textBetween(g.parentOffset,y.parentOffset),N=()=>k(t.state.tr.insertText(S,E,v));t.someProp("handleTextInput",M=>M(t,E,v,S,N))||t.dispatch(N())}else t.dispatch(k());else t.dispatch(k())}function um(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Pf(t,e.resolve(n.anchor),e.resolve(n.head))}function IS(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,o=r,s,a,l;for(let u=0;u<r.length;u++)i=r[u].removeFromSet(i);for(let u=0;u<n.length;u++)o=n[u].removeFromSet(o);if(i.length==1&&o.length==0)a=i[0],s="add",l=u=>u.mark(a.addToSet(u.marks));else if(i.length==0&&o.length==1)a=o[0],s="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(l(e.child(u)));if(P.from(c).eq(t))return{mark:a,type:s}}function DS(t,e,n,r,i){if(n-e<=i.pos-r.pos||ku(r,!0,!1)<i.pos)return!1;let o=t.resolve(e);if(!r.parent.isTextblock){let a=o.nodeAfter;return a!=null&&n==e+a.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=t.resolve(ku(o,!0,!0));return!s.parent.isTextblock||s.pos>n||ku(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function ku(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 o=t.node(r).maybeChild(t.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function LS(t,e,n,r,i){let o=t.findDiffStart(e,n);if(o==null)return null;let{a:s,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let l=Math.max(0,o-Math.min(s,a));r-=s+l-o}if(s<o&&t.size<e.size){let l=r<=o&&r>=s?o-r:0;o-=l,o&&o<e.size&&dm(e.textBetween(o-1,o+1))&&(o+=l?1:-1),a=o+(a-s),s=o}else if(a<o){let l=r<=o&&r>=a?o-r:0;o-=l,o&&o<t.size&&dm(t.textBetween(o-1,o+1))&&(o+=l?1:-1),s=o+(s-a),a=o}return{start:o,endA:s,endB:a}}function dm(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 g0{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 XC,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(gm),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=pm(this),hm(this),this.nodeViews=mm(this),this.docView=Kp(this.state.doc,fm(this),Eu(this),this.dom,this),this.domObserver=new CS(this,(r,i,o,s)=>RS(this,r,i,o,s)),this.domObserver.start(),ZC(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&&Bd(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(gm),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,o=!1,s=!1;e.storedMarks&&this.composing&&(c0(this),s=!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=mm(this);BS(h,this.nodeViews)&&(this.nodeViews=h,o=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Bd(this),this.editable=pm(this),hm(this);let l=Eu(this),c=fm(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=o||!this.docView.matchesNode(e.doc,c,l);(d||!e.selection.eq(i.selection))&&(s=!0);let f=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&fC(this);if(s){this.domObserver.stop();let h=d&&(It||ht)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&PS(i.selection,e.selection);if(d){let m=ht?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=fS(this)),(o||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Kp(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())&&PC(this))?qn(this,h):(Xb(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),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&hC(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 se){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Fp(this,n.getBoundingClientRect(),e)}else Fp(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 o=r.from+(this.state.doc.content.size-n.doc.content.size);(o>0&&o<this.state.doc.content.size&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new d0(e.slice,e.move,i<0?void 0:se.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 s=0;s<this.directPlugins.length;s++){let a=this.directPlugins[s].props[e];if(a!=null&&(i=n?n(a):a))return i}let o=this.state.plugins;if(o)for(let s=0;s<o.length;s++){let a=o[s].props[e];if(a!=null&&(i=n?n(a):a))return i}}hasFocus(){if(It){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&&pC(this.dom),qn(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 vC(this,e)}coordsAtPos(e,n=1){return Ub(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 CC(this,n||this.state,e)}pasteHTML(e,n){return hs(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return hs(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Bf(this,e)}destroy(){this.docView&&(QC(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Eu(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,nC())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return tS(this,e)}domSelectionRange(){let e=this.domSelection();return e?vt&&this.root.nodeType===11&&aC(this.dom.ownerDocument)==this.dom&&_S(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}g0.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function fm(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"),[pt.node(0,t.state.doc.content.size,e)]}function hm(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:pt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function pm(t){return!t.someProp("editable",e=>e(t.state)===!1)}function PS(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 mm(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 BS(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 gm(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 _r={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:"'"},ml={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},$S=typeof navigator<"u"&&/Mac/.test(navigator.platform),jS=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var ft=0;ft<10;ft++)_r[48+ft]=_r[96+ft]=String(ft);for(var ft=1;ft<=24;ft++)_r[ft+111]="F"+ft;for(var ft=65;ft<=90;ft++)_r[ft]=String.fromCharCode(ft+32),ml[ft]=String.fromCharCode(ft);for(var Cu in _r)ml.hasOwnProperty(Cu)||(ml[Cu]=_r[Cu]);function FS(t){var e=$S&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||jS&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?ml:_r)[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 HS=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),zS=typeof navigator<"u"&&/Win/.test(navigator.platform);function US(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,o,s;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))s=!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))o=!0;else if(/^mod$/i.test(l))HS?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),s&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function VS(t){let e=Object.create(null);for(let n in t)e[US(n)]=t[n];return e}function Su(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 WS(t){return new $e({props:{handleKeyDown:y0(t)}})}function y0(t){let e=VS(t);return function(n,r){let i=FS(r),o,s=e[Su(i,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[Su(i,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(zS&&r.ctrlKey&&r.altKey)&&(o=_r[r.keyCode])&&o!=i){let a=e[Su(o,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}const Uf=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function b0(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const v0=(t,e,n)=>{let r=b0(t,n);if(!r)return!1;let i=Vf(r);if(!i){let s=r.blockRange(),a=s&&vo(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)}let o=i.nodeBefore;if(T0(t,i,e,-1))return!0;if(r.parent.content.size==0&&(Zi(o,"end")||se.isSelectable(o)))for(let s=r.depth;;s--){let a=bc(t.doc,r.before(s),r.after(s),Y.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(Zi(o,"end")?ge.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):se.create(l.doc,i.pos-o.nodeSize)),e(l.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},KS=(t,e,n)=>{let r=b0(t,n);if(!r)return!1;let i=Vf(r);return i?x0(t,i,e):!1},GS=(t,e,n)=>{let r=E0(t,n);if(!r)return!1;let i=Wf(r);return i?x0(t,i,e):!1};function x0(t,e,n){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let s=e.nodeAfter,a=s,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let c=bc(t.doc,o,l,Y.empty);if(!c||c.from!=o||c instanceof Xe&&c.slice.size>=l-o)return!1;if(n){let u=t.tr.step(c);u.setSelection(ue.create(u.doc,o)),n(u.scrollIntoView())}return!0}function Zi(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 w0=(t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;o=Vf(r)}let s=o&&o.nodeBefore;return!s||!se.isSelectable(s)?!1:(e&&e(t.tr.setSelection(se.create(t.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function Vf(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 E0(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const k0=(t,e,n)=>{let r=E0(t,n);if(!r)return!1;let i=Wf(r);if(!i)return!1;let o=i.nodeAfter;if(T0(t,i,e,1))return!0;if(r.parent.content.size==0&&(Zi(o,"start")||se.isSelectable(o))){let s=bc(t.doc,r.before(),r.after(),Y.empty);if(s&&s.slice.size<s.to-s.from){if(e){let a=t.tr.step(s);a.setSelection(Zi(o,"start")?ge.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):se.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},C0=(t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;o=Wf(r)}let s=o&&o.nodeAfter;return!s||!se.isSelectable(s)?!1:(e&&e(t.tr.setSelection(se.create(t.doc,o.pos)).scrollIntoView()),!0)};function Wf(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 qS=(t,e)=>{let n=t.selection,r=n instanceof se,i;if(r){if(n.node.isTextblock||!Rr(t.doc,n.from))return!1;i=n.from}else if(i=yc(t.doc,n.from,-1),i==null)return!1;if(e){let o=t.tr.join(i);r&&o.setSelection(se.create(o.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},YS=(t,e)=>{let n=t.selection,r;if(n instanceof se){if(n.node.isTextblock||!Rr(t.doc,n.to))return!1;r=n.to}else if(r=yc(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},JS=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),o=i&&vo(i);return o==null?!1:(e&&e(t.tr.lift(i,o).scrollIntoView()),!0)},S0=(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 Kf(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 XS=(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),o=n.indexAfter(-1),s=Kf(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,s.createAndFill());l.setSelection(ge.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},_0=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Ht||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=Kf(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let s=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=t.tr.insert(s,o.createAndFill());a.setSelection(ue.create(a.doc,s+1)),e(a.scrollIntoView())}return!0},N0=(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 o=n.before();if(Gn(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),i=r&&vo(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function ZS(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof se&&e.selection.node.isBlock)return!r.parentOffset||!Gn(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let o=[],s,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=Kf(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),o.unshift(l&&a?{type:a}:null),s=h;break}else{if(h==1)return!1;o.unshift(null)}let u=e.tr;(e.selection instanceof ue||e.selection instanceof Ht)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=Gn(u.doc,d,o.length,o);if(f||(o[0]=a?{type:a}:null,f=Gn(u.doc,d,o.length,o)),!f)return!1;if(u.split(d,o.length,o),!l&&c&&r.node(s).type!=a){let h=u.mapping.map(r.before(s)),m=u.doc.resolve(h);a&&r.node(s-1).canReplaceWith(m.index(),m.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(s)),a)}return n&&n(u.scrollIntoView()),!0}}const QS=ZS(),e_=(t,e)=>{let{$from:n,to:r}=t.selection,i,o=n.sharedDepth(r);return o==0?!1:(i=n.before(o),e&&e(t.tr.setSelection(se.create(t.doc,i))),!0)};function t_(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||Rr(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function T0(t,e,n,r){let i=e.nodeBefore,o=e.nodeAfter,s,a,l=i.type.spec.isolating||o.type.spec.isolating;if(!l&&t_(t,e,n))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(a=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&a.matchType(s[0]||o.type).validEnd){if(n){let h=e.pos+o.nodeSize,m=P.empty;for(let b=s.length-1;b>=0;b--)m=P.from(s[b].create(null,m));m=P.from(i.copy(m));let g=t.tr.step(new rt(e.pos-1,h,e.pos,h,new Y(m,1,0),s.length,!0)),y=g.doc.resolve(h+2*s.length);y.nodeAfter&&y.nodeAfter.type==i.type&&Rr(g.doc,y.pos)&&g.join(y.pos),n(g.scrollIntoView())}return!0}let u=o.type.spec.isolating||r>0&&l?null:ge.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&vo(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(c&&Zi(o,"start",!0)&&Zi(i,"end")){let h=i,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let g=o,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(n){let b=P.empty;for(let E=m.length-1;E>=0;E--)b=P.from(m[E].copy(b));let w=t.tr.step(new rt(e.pos-m.length,e.pos+o.nodeSize,e.pos+y,e.pos+o.nodeSize-y,new Y(b,m.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function A0(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(n&&n(e.tr.setSelection(ue.create(e.doc,t<0?i.start(o):i.end(o)))),!0):!1}}const n_=A0(-1),r_=A0(1);function i_(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),a=s&&Rf(s,t,e);return a?(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0):!1}}function ym(t,e=null){return function(n,r){let i=!1;for(let o=0;o<n.selection.ranges.length&&!i;o++){let{$from:{pos:s},$to:{pos:a}}=n.selection.ranges[o];n.doc.nodesBetween(s,a,(l,c)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)i=!0;else{let u=n.doc.resolve(c),d=u.index();i=u.parent.canReplaceWith(d,d+1,t)}})}if(!i)return!1;if(r){let o=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[s];o.setBlockType(a,l,t,e)}r(o.scrollIntoView())}return!0}}function Gf(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}Gf(Uf,v0,w0);Gf(Uf,k0,C0);Gf(S0,_0,N0,QS);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function o_(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o);if(!s)return!1;let a=r?n.tr:null;return s_(a,s,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function s_(t,e,n,r=null){let i=!1,o=e,s=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=s.resolve(e.start-2);o=new ls(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new ls(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=Rf(o,n,r,e);return a?(t&&a_(t,e,a,i,n),!0):!1}function a_(t,e,n,r,i){let o=P.empty;for(let u=n.length-1;u>=0;u--)o=P.from(n[u].type.create(n[u].attrs,o));t.step(new rt(e.start-(r?2:0),e.end,e.start,e.end,new Y(o,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==i&&(s=u+1);let a=n.length-s,l=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&Gn(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return t}function l_(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,s=>s.childCount>0&&s.firstChild.type==t);return o?n?r.node(o.depth-1).type==t?c_(e,n,t,o):u_(e,n,o):!0:!1}}function c_(t,e,n,r){let i=t.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new rt(o-1,s,o,s,new Y(P.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new ls(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const a=vo(r);if(a==null)return!1;i.lift(r,a);let l=i.doc.resolve(i.mapping.map(o,-1)-1);return Rr(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function u_(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 o=r.doc.resolve(n.start),s=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==i.childCount,c=o.node(-1),u=o.index(-1);if(!c.canReplace(u+(a?0:1),u+1,s.content.append(l?P.empty:P.from(i))))return!1;let d=o.pos,f=d+s.nodeSize;return r.step(new rt(d-(a?1:0),f+(l?1:0),d+1,f-1,new Y((a?P.empty:P.from(i.copy(P.empty))).append(l?P.empty:P.from(i.copy(P.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function d_(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==t);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let a=o.parent,l=a.child(s-1);if(l.type!=t)return!1;if(n){let c=l.lastChild&&l.lastChild.type==a.type,u=P.from(c?t.create():null),d=new Y(P.from(t.create(null,P.from(a.type.create(null,u)))),c?3:1,0),f=o.start,h=o.end;n(e.tr.step(new rt(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}function kc(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:o}=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 o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}}}class Cc{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:o}=r,s=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...u)=>{const d=l(...u)(s);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(o),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:i,state:o}=this,{view:s}=i,a=[],l=!!e,c=e||o.tr,u=()=>(!l&&n&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(c),a.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(r).map(([f,h])=>[f,(...g)=>{const y=this.buildProps(c,n),b=h(...g)(y);return a.push(b),d}])),run:u};return d}createCan(e){const{rawCommands:n,state:r}=this,i=!1,o=e||r.tr,s=this.buildProps(o,i);return{...Object.fromEntries(Object.entries(n).map(([l,c])=>[l,(...u)=>c(...u)({...s,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:o}=this,{view:s}=i,a={tr:e,editor:i,view:s,state:kc({state:o,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,(...u)=>c(...u)(a)]))}};return a}}class f_{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 ee(t,e,n){return t.config[e]===void 0&&t.parent?ee(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?ee(t.parent,e,n):null}):t.config[e]}function Sc(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 M0(t){const e=[],{nodeExtensions:n,markExtensions:r}=Sc(t),i=[...n,...r],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage,extensions:i},l=ee(s,"addGlobalAttributes",a);if(!l)return;l().forEach(u=>{u.types.forEach(d=>{Object.entries(u.attributes).forEach(([f,h])=>{e.push({type:d,name:f,attribute:{...o,...h}})})})})}),i.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage},l=ee(s,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([u,d])=>{const f={...o,...d};typeof(f==null?void 0:f.default)=="function"&&(f.default=f.default()),f!=null&&f.isRequired&&(f==null?void 0:f.default)===void 0&&delete f.default,e.push({type:s.name,name:u,attribute:f})})}),e}function ot(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 Ne(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){const a=o?String(o).split(" "):[],l=r[i]?r[i].split(" "):[],c=a.filter(u=>!l.includes(u));r[i]=[...l,...c].join(" ")}else if(i==="style"){const a=o?o.split(";").map(u=>u.trim()).filter(Boolean):[],l=r[i]?r[i].split(";").map(u=>u.trim()).filter(Boolean):[],c=new Map;l.forEach(u=>{const[d,f]=u.split(":").map(h=>h.trim());c.set(d,f)}),a.forEach(u=>{const[d,f]=u.split(":").map(h=>h.trim());c.set(d,f)}),r[i]=Array.from(c.entries()).map(([u,d])=>`${u}: ${d}`).join("; ")}else r[i]=o}),r},{})}function gl(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)=>Ne(n,r),{})}function O0(t){return typeof t=="function"}function xe(t,e=void 0,...n){return O0(t)?e?t.bind(e)(...n):t(...n):t}function h_(t={}){return Object.keys(t).length===0&&t.constructor===Object}function p_(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function bm(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((o,s)=>{const a=s.attribute.parseHTML?s.attribute.parseHTML(n):p_(n.getAttribute(s.name));return a==null?o:{...o,[s.name]:a}},{});return{...r,...i}}}}function vm(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&h_(n)?!1:n!=null))}function m_(t,e){var n;const r=M0(t),{nodeExtensions:i,markExtensions:o}=Sc(t),s=(n=i.find(c=>ee(c,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(i.map(c=>{const u=r.filter(b=>b.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((b,w)=>{const E=ee(w,"extendNodeSchema",d);return{...b,...E?E(c):{}}},{}),h=vm({...f,content:xe(ee(c,"content",d)),marks:xe(ee(c,"marks",d)),group:xe(ee(c,"group",d)),inline:xe(ee(c,"inline",d)),atom:xe(ee(c,"atom",d)),selectable:xe(ee(c,"selectable",d)),draggable:xe(ee(c,"draggable",d)),code:xe(ee(c,"code",d)),whitespace:xe(ee(c,"whitespace",d)),linebreakReplacement:xe(ee(c,"linebreakReplacement",d)),defining:xe(ee(c,"defining",d)),isolating:xe(ee(c,"isolating",d)),attrs:Object.fromEntries(u.map(b=>{var w;return[b.name,{default:(w=b==null?void 0:b.attribute)===null||w===void 0?void 0:w.default}]}))}),m=xe(ee(c,"parseHTML",d));m&&(h.parseDOM=m.map(b=>bm(b,u)));const g=ee(c,"renderHTML",d);g&&(h.toDOM=b=>g({node:b,HTMLAttributes:gl(b,u)}));const y=ee(c,"renderText",d);return y&&(h.toText=y),[c.name,h]})),l=Object.fromEntries(o.map(c=>{const u=r.filter(y=>y.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((y,b)=>{const w=ee(b,"extendMarkSchema",d);return{...y,...w?w(c):{}}},{}),h=vm({...f,inclusive:xe(ee(c,"inclusive",d)),excludes:xe(ee(c,"excludes",d)),group:xe(ee(c,"group",d)),spanning:xe(ee(c,"spanning",d)),code:xe(ee(c,"code",d)),attrs:Object.fromEntries(u.map(y=>{var b;return[y.name,{default:(b=y==null?void 0:y.attribute)===null||b===void 0?void 0:b.default}]}))}),m=xe(ee(c,"parseHTML",d));m&&(h.parseDOM=m.map(y=>bm(y,u)));const g=ee(c,"renderHTML",d);return g&&(h.toDOM=y=>g({mark:y,HTMLAttributes:gl(y,u)})),[c.name,h]}));return new gb({topNode:s,nodes:a,marks:l})}function _u(t,e){return e.nodes[t]||e.marks[t]||null}function xm(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function qf(t,e){const n=hi.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}const g_=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,o,s,a)=>{var l,c;const u=((c=(l=i.type.spec).toText)===null||c===void 0?void 0:c.call(l,{node:i,pos:o,parent:s,index:a}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?u:u.slice(0,Math.max(0,r-o))}),n};function Yf(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class Gs{constructor(e){this.find=e.find,this.handler=e.handler}}const y_=(t,e)=>{if(Yf(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 ua(t){var e;const{editor:n,from:r,to:i,text:o,rules:s,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 u=!1;const d=g_(c)+o;return s.forEach(f=>{if(u)return;const h=y_(d,f.find);if(!h)return;const m=l.state.tr,g=kc({state:l.state,transaction:m}),y={from:r-(h[0].length-o.length),to:i},{commands:b,chain:w,can:E}=new Cc({editor:n,state:g});f.handler({state:g,range:y,match:h,commands:b,chain:w,can:E})===null||!m.steps.length||(m.setMeta(a,{transform:m,from:r,to:i,text:o}),l.dispatch(m),u=!0)}),u}function b_(t){const{editor:e,rules:n}=t,r=new $e({state:{init(){return null},apply(i,o,s){const a=i.getMeta(r);if(a)return a;const l=i.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:u}=l;typeof u=="string"?u=u:u=qf(P.from(u),s.schema);const{from:d}=l,f=d+u.length;ua({editor:e,from:d,to:f,text:u,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,s,a){return ua({editor:e,from:o,to:s,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&ua({editor:e,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:s}=i.state.selection;return s?ua({editor:e,from:s.pos,to:s.pos,text:`
11
- `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function v_(t){return Object.prototype.toString.call(t).slice(8,-1)}function da(t){return v_(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function _c(t,e){const n={...t};return da(t)&&da(e)&&Object.keys(e).forEach(r=>{da(e[r])&&da(t[r])?n[r]=_c(t[r],e[r]):n[r]=e[r]}),n}class dn{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=xe(ee(this,"addOptions",{name:this.name}))),this.storage=xe(ee(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new dn(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>_c(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new dn(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=xe(ee(n,"addOptions",{name:n.name})),n.storage=xe(ee(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 s=i.marks();if(!!!s.find(c=>(c==null?void 0:c.type.name)===n.name))return!1;const l=s.find(c=>(c==null?void 0:c.type.name)===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}function x_(t){return typeof t=="number"}class w_{constructor(e){this.find=e.find,this.handler=e.handler}}const E_=(t,e,n)=>{if(Yf(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const o=[i.text];return o.index=i.index,o.input=t,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function k_(t){const{editor:e,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:a}=t,{commands:l,chain:c,can:u}=new Cc({editor:e,state:n}),d=[];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,"");E_(b,o.find,s).forEach(E=>{if(E.index===void 0)return;const v=g+E.index+1,k=v+E[0].length,C={from:n.tr.mapping.map(v),to:n.tr.mapping.map(k)},S=o.handler({state:n,range:C,match:E,commands:l,chain:c,can:u,pasteEvent:s,dropEvent:a});d.push(S)})}),d.every(h=>h!==null)}let fa=null;const C_=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 S_(t){const{editor:e,rules:n}=t;let r=null,i=!1,o=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:u,from:d,to:f,rule:h,pasteEvt:m})=>{const g=u.tr,y=kc({state:u,transaction:g});if(!(!k_({editor:e,state:y,from:Math.max(d-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 s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return n.map(u=>new $e({view(d){const f=m=>{var g;r=!((g=d.dom.parentElement)===null||g===void 0)&&g.contains(m.target)?d.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:(d,f)=>{if(o=r===d.dom.parentElement,a=f,!o){const h=fa;h!=null&&h.isEditable&&setTimeout(()=>{const m=h.state.selection;m&&h.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(d,f)=>{var h;const m=(h=f.clipboardData)===null||h===void 0?void 0:h.getData("text/html");return s=f,i=!!(m!=null&&m.includes("data-pm-slice")),!1}}},appendTransaction:(d,f,h)=>{const m=d[0],g=m.getMeta("uiEvent")==="paste"&&!i,y=m.getMeta("uiEvent")==="drop"&&!o,b=m.getMeta("applyPasteRules"),w=!!b;if(!g&&!y&&!w)return;if(w){let{text:k}=b;typeof k=="string"?k=k:k=qf(P.from(k),h.schema);const{from:C}=b,S=C+k.length,N=C_(k);return l({rule:u,state:h,from:C,to:{b:S},pasteEvt:N})}const E=f.doc.content.findDiffStart(h.doc.content),v=f.doc.content.findDiffEnd(h.doc.content);if(!(!x_(E)||!v||E===v.b))return l({rule:u,state:h,from:E,to:v,pasteEvt:s})}}))}function __(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}class Fi{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=Fi.resolve(e),this.schema=m_(this.extensions,n),this.setupExtensions()}static resolve(e){const n=Fi.sort(Fi.flatten(e)),r=__(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=ee(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((r,i)=>{const o=ee(r,"priority")||100,s=ee(i,"priority")||100;return o>s?-1:o<s?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:_u(n.name,this.schema)},i=ee(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,n=Fi.sort([...this.extensions].reverse()),r=[],i=[],o=n.map(s=>{const a={name:s.name,options:s.options,storage:s.storage,editor:e,type:_u(s.name,this.schema)},l=[],c=ee(s,"addKeyboardShortcuts",a);let u={};if(s.type==="mark"&&ee(s,"exitable",a)&&(u.ArrowRight=()=>dn.handleExit({editor:e,mark:s})),c){const g=Object.fromEntries(Object.entries(c()).map(([y,b])=>[y,()=>b({editor:e})]));u={...u,...g}}const d=WS(u);l.push(d);const f=ee(s,"addInputRules",a);xm(s,e.options.enableInputRules)&&f&&r.push(...f());const h=ee(s,"addPasteRules",a);xm(s,e.options.enablePasteRules)&&h&&i.push(...h());const m=ee(s,"addProseMirrorPlugins",a);if(m){const g=m();l.push(...g)}return l}).flat();return[b_({editor:e,rules:r}),...S_({editor:e,rules:i}),...o]}get attributes(){return M0(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=Sc(this.extensions);return Object.fromEntries(n.filter(r=>!!ee(r,"addNodeView")).map(r=>{const i=this.attributes.filter(l=>l.type===r.name),o={name:r.name,options:r.options,storage:r.storage,editor:e,type:ot(r.name,this.schema)},s=ee(r,"addNodeView",o);if(!s)return[];const a=(l,c,u,d,f)=>{const h=gl(l,i);return s()({node:l,view:c,getPos:u,decorations:d,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:_u(e.name,this.schema)};e.type==="mark"&&(!((n=xe(ee(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const i=ee(e,"onBeforeCreate",r),o=ee(e,"onCreate",r),s=ee(e,"onUpdate",r),a=ee(e,"onSelectionUpdate",r),l=ee(e,"onTransaction",r),c=ee(e,"onFocus",r),u=ee(e,"onBlur",r),d=ee(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),s&&this.editor.on("update",s),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}}class Ve{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=xe(ee(this,"addOptions",{name:this.name}))),this.storage=xe(ee(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ve(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>_c(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Ve({...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=xe(ee(n,"addOptions",{name:n.name})),n.storage=xe(ee(n,"addStorage",{name:n.name,options:n.options})),n}}function R0(t,e,n){const{from:r,to:i}=e,{blockSeparator:o=`
12
-
13
- `,textSerializers:s={}}=n||{};let a="";return t.nodesBetween(r,i,(l,c,u,d)=>{var f;l.isBlock&&c>r&&(a+=o);const h=s==null?void 0:s[l.type.name];if(h)return u&&(a+=h({node:l,pos:c,parent:u,index:d,range:e})),!1;l.isText&&(a+=(f=l==null?void 0:l.text)===null||f===void 0?void 0:f.slice(Math.max(r,c)-c,i-c))}),a}function I0(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const N_=Ve.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new $e({key:new Pe("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:o}=i,s=Math.min(...o.map(u=>u.$from.pos)),a=Math.max(...o.map(u=>u.$to.pos)),l=I0(n);return R0(r,{from:s,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),T_=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),A_=(t=!1)=>({commands:e})=>e.setContent("",t),M_=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:o,$to:s})=>{t.doc.nodesBetween(o.pos,s.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(l)),f=c.resolve(u.map(l+a.nodeSize)),h=d.blockRange(f);if(!h)return;const m=vo(h);if(a.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,g)}(m||m===0)&&e.lift(h,m)})}),!0},O_=t=>e=>t(e),R_=()=>({state:t,dispatch:e})=>_0(t,e),I_=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,o=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const s=r.mapping.map(e);return r.insert(s,o.content),r.setSelection(new ue(r.doc.resolve(Math.max(s-1,0)))),!0},D_=()=>({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 o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(e){const a=i.before(o),l=i.after(o);t.delete(a,l).scrollIntoView()}return!0}return!1},L_=t=>({tr:e,state:n,dispatch:r})=>{const i=ot(t,n.schema),o=e.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===i){if(r){const l=o.before(s),c=o.after(s);e.delete(l,c).scrollIntoView()}return!0}return!1},P_=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},B_=()=>({state:t,dispatch:e})=>Uf(t,e),$_=()=>({commands:t})=>t.keyboardShortcut("Enter"),j_=()=>({state:t,dispatch:e})=>XS(t,e);function yl(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:Yf(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function D0(t,e,n={}){return t.find(r=>r.type===e&&yl(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function wm(t,e,n={}){return!!D0(t,e,n)}function Jf(t,e,n){var r;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(u=>u.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(u=>u.type===e)||(n=n||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!D0([...i.node.marks],e,n)))return;let s=i.index,a=t.start()+i.offset,l=s+1,c=a+i.node.nodeSize;for(;s>0&&wm([...t.parent.child(s-1).marks],e,n);)s-=1,a-=t.parent.child(s).nodeSize;for(;l<t.parent.childCount&&wm([...t.parent.child(l).marks],e,n);)c+=t.parent.child(l).nodeSize,l+=1;return{from:a,to:c}}function Dr(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 F_=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const o=Dr(t,r.schema),{doc:s,selection:a}=n,{$from:l,from:c,to:u}=a;if(i){const d=Jf(l,o,e);if(d&&d.from<=c&&d.to>=u){const f=ue.create(s,d.from,d.to);n.setSelection(f)}}return!0},H_=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 Nc(t){return t instanceof ue}function Wn(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function L0(t,e=null){if(!e)return null;const n=ge.atStart(t),r=ge.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,o=r.to;return e==="all"?ue.create(t,Wn(0,i,o),Wn(t.content.size,i,o)):ue.create(t,Wn(e,i,o),Wn(e,i,o))}function $d(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function ms(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function z_(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const U_=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const s=()=>{(ms()||$d())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),z_()&&!ms()&&!$d()&&r.dom.focus({preventScroll:!0}))})};if(r.hasFocus()&&t===null||t===!1)return!0;if(o&&t===null&&!Nc(n.state.selection))return s(),!0;const a=L0(i.doc,t)||n.state.selection,l=n.state.selection.eq(a);return o&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},V_=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),W_=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),P0=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&&P0(r)}return t};function ha(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return P0(n)}function gs(t,e,n){if(t instanceof Er||t instanceof P)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 P.fromArray(t.map(a=>e.nodeFromJSON(a)));const s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",o),gs("",e,n)}if(i){if(n.errorOnInvalidContent){let s=!1,a="";const l=new gb({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=>(s=!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&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const o=Vo.fromSchema(e);return n.slice?o.parseSlice(ha(t),n.parseOptions).content:o.parse(ha(t),n.parseOptions)}return gs("",e,n)}function K_(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof Xe||i instanceof rt))return;const o=t.mapping.maps[r];let s=0;o.forEach((a,l,c,u)=>{s===0&&(s=u)}),t.setSelection(ge.near(t.doc.resolve(s),n))}const G_=t=>!("type"in t),q_=(t,e,n)=>({tr:r,dispatch:i,editor:o})=>{var s;if(i){n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const l=y=>{o.emit("contentError",{editor:o,error:y,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{gs(e,o.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(y){l(y)}try{a=gs(e,o.schema,{parseOptions:c,errorOnInvalidContent:(s=n.errorOnInvalidContent)!==null&&s!==void 0?s:o.options.enableContentCheck})}catch(y){return l(y),!1}let{from:u,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,h=!0;if((G_(a)?a:[a]).forEach(y=>{y.check(),f=f?y.isText&&y.marks.length===0:!1,h=h?y.isBlock:!1}),u===d&&h){const{parent:y}=r.doc.resolve(u);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(u-=1,d+=1)}let g;if(f){if(Array.isArray(e))g=e.map(y=>y.text||"").join("");else if(e instanceof P){let y="";e.forEach(b=>{b.text&&(y+=b.text)}),g=y}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,u,d)}else g=a,r.replaceWith(u,d,g);n.updateSelection&&K_(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:g}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:g})}return!0},Y_=()=>({state:t,dispatch:e})=>qS(t,e),J_=()=>({state:t,dispatch:e})=>YS(t,e),X_=()=>({state:t,dispatch:e})=>v0(t,e),Z_=()=>({state:t,dispatch:e})=>k0(t,e),Q_=()=>({state:t,dispatch:e,tr:n})=>{try{const r=yc(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},eN=()=>({state:t,dispatch:e,tr:n})=>{try{const r=yc(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},tN=()=>({state:t,dispatch:e})=>KS(t,e),nN=()=>({state:t,dispatch:e})=>GS(t,e);function B0(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function rN(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,o,s;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))s=!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))o=!0;else if(/^mod$/i.test(l))ms()||B0()?s=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),o&&(n=`Shift-${n}`),n}const iN=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const o=rN(t).split(/-(?!$)/),s=o.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,a))});return l==null||l.steps.forEach(c=>{const u=c.map(r.mapping);u&&i&&r.maybeStep(u)}),!0};function ys(t,e,n={}){const{from:r,to:i,empty:o}=t.selection,s=e?ot(e,t.schema):null,a=[];t.doc.nodesBetween(r,i,(d,f)=>{if(d.isText)return;const h=Math.max(r,f),m=Math.min(i,f+d.nodeSize);a.push({node:d,from:h,to:m})});const l=i-r,c=a.filter(d=>s?s.name===d.node.type.name:!0).filter(d=>yl(d.node.attrs,n,{strict:!1}));return o?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=l}const oN=(t,e={})=>({state:n,dispatch:r})=>{const i=ot(t,n.schema);return ys(n,i,e)?JS(n,r):!1},sN=()=>({state:t,dispatch:e})=>N0(t,e),aN=t=>({state:e,dispatch:n})=>{const r=ot(t,e.schema);return l_(r)(e,n)},lN=()=>({state:t,dispatch:e})=>S0(t,e);function Tc(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Em(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 cN=(t,e)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null;const a=Tc(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(o=ot(t,r.schema)),a==="mark"&&(s=Dr(t,r.schema)),i&&n.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,u)=>{o&&o===c.type&&n.setNodeMarkup(u,void 0,Em(c.attrs,e)),s&&c.marks.length&&c.marks.forEach(d=>{s===d.type&&n.addMark(u,u+c.nodeSize,s.create(Em(d.attrs,e)))})})}),!0):!1},uN=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),dN=()=>({tr:t,dispatch:e})=>{if(e){const n=new Ht(t.doc);t.setSelection(n)}return!0},fN=()=>({state:t,dispatch:e})=>w0(t,e),hN=()=>({state:t,dispatch:e})=>C0(t,e),pN=()=>({state:t,dispatch:e})=>e_(t,e),mN=()=>({state:t,dispatch:e})=>r_(t,e),gN=()=>({state:t,dispatch:e})=>n_(t,e);function jd(t,e,n={},r={}){return gs(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const yN=(t,e=!1,n={},r={})=>({editor:i,tr:o,dispatch:s,commands:a})=>{var l,c;const{doc:u}=o;if(n.preserveWhitespace!=="full"){const d=jd(t,i.schema,n,{errorOnInvalidContent:(l=r.errorOnInvalidContent)!==null&&l!==void 0?l:i.options.enableContentCheck});return s&&o.replaceWith(0,u.content.size,d).setMeta("preventUpdate",!e),!0}return s&&o.setMeta("preventUpdate",!e),a.insertContentAt({from:0,to:u.content.size},t,{parseOptions:n,errorOnInvalidContent:(c=r.errorOnInvalidContent)!==null&&c!==void 0?c:i.options.enableContentCheck})};function $0(t,e){const n=Dr(e,t.schema),{from:r,to:i,empty:o}=t.selection,s=[];o?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,l=>{s.push(...l.marks)});const a=s.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function bN(t,e){const n=new Rb(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function vN(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 Qi(t,e){const n=[];return t.descendants((r,i)=>{e(r)&&n.push({node:r,pos:i})}),n}function xN(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,o)=>{n(i)&&r.push({node:i,pos:o})}),r}function wN(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 qs(t){return e=>wN(e.$from,t)}function EN(t,e){const n={from:0,to:t.content.size};return R0(t,n,e)}function kN(t,e){const n=ot(e,t.schema),{from:r,to:i}=t.selection,o=[];t.doc.nodesBetween(r,i,a=>{o.push(a)});const s=o.reverse().find(a=>a.type.name===n.name);return s?{...s.attrs}:{}}function j0(t,e){const n=Tc(typeof e=="string"?e:e.name,t.schema);return n==="node"?kN(t,e):n==="mark"?$0(t,e):{}}function CN(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 SN(t){const e=CN(t);return e.length===1?e:e.filter((n,r)=>!e.filter((o,s)=>s!==r).some(o=>n.oldRange.from>=o.oldRange.from&&n.oldRange.to<=o.oldRange.to&&n.newRange.from>=o.newRange.from&&n.newRange.to<=o.newRange.to))}function _N(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,o)=>{const s=[];if(i.ranges.length)i.forEach((a,l)=>{s.push({from:a,to:l})});else{const{from:a,to:l}=n[o];if(a===void 0||l===void 0)return;s.push({from:a,to:l})}s.forEach(({from:a,to:l})=>{const c=e.slice(o).map(a,-1),u=e.slice(o).map(l),d=e.invert().map(c,-1),f=e.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),SN(r)}function Xf(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const o=n.resolve(t),s=Jf(o,i.type);s&&r.push({mark:i,...s})}):n.nodesBetween(t,e,(i,o)=>{!i||(i==null?void 0:i.nodeSize)===void 0||r.push(...i.marks.map(s=>({from:o,to:o+i.nodeSize,mark:s})))}),r}function Ka(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(o=>o.type===e&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}function Fd(t,e,n={}){const{empty:r,ranges:i}=t.selection,o=e?Dr(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>o?o.name===d.type.name:!0).find(d=>yl(d.attrs,n,{strict:!1}));let s=0;const a=[];if(i.forEach(({$from:d,$to:f})=>{const h=d.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),E=w-b;s+=E,a.push(...g.marks.map(v=>({mark:v,from:b,to:w})))})}),s===0)return!1;const l=a.filter(d=>o?o.name===d.mark.type.name:!0).filter(d=>yl(d.mark.attrs,n,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),c=a.filter(d=>o?d.mark.type!==o&&d.mark.type.excludes(o):!0).reduce((d,f)=>d+f.to-f.from,0);return(l>0?l+c:l)>=s}function NN(t,e,n={}){if(!e)return ys(t,null,n)||Fd(t,null,n);const r=Tc(e,t.schema);return r==="node"?ys(t,e,n):r==="mark"?Fd(t,e,n):!1}function km(t,e){const{nodeExtensions:n}=Sc(e),r=n.find(s=>s.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},o=xe(ee(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function Ac(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(o=>{i!==!1&&(Ac(o,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function F0(t){return t instanceof se}function TN(t,e,n){const i=t.state.doc.content.size,o=Wn(e,0,i),s=Wn(n,0,i),a=t.coordsAtPos(o),l=t.coordsAtPos(s,-1),c=Math.min(a.top,l.top),u=Math.max(a.bottom,l.bottom),d=Math.min(a.left,l.left),f=Math.max(a.right,l.right),h=f-d,m=u-c,b={top:c,bottom:u,left:d,right:f,width:h,height:m,x:d,y:c};return{...b,toJSON:()=>b}}function AN(t,e,n){var r;const{selection:i}=e;let o=null;if(Nc(i)&&(o=i.$cursor),o){const a=(r=t.storedMarks)!==null&&r!==void 0?r:o.marks();return!!n.isInSet(a)||!a.some(l=>l.type.excludes(n))}const{ranges:s}=i;return s.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,(u,d,f)=>{if(c)return!1;if(u.isInline){const h=!f||f.type.allowsMarkType(n),m=!!n.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(n));c=h&&m}return!c}),c})}const MN=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:o}=n,{empty:s,ranges:a}=o,l=Dr(t,r.schema);if(i)if(s){const c=$0(r,l);n.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,h)=>{const m=Math.max(h,u),g=Math.min(h+f.nodeSize,d);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 AN(r,n,l)},ON=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),RN=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const o=ot(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:a})=>ym(o,{...s,...e})(n)?!0:a.clearNodes()).command(({state:a})=>ym(o,{...s,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},IN=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=Wn(t,0,r.content.size),o=se.create(r,i);e.setSelection(o)}return!0},DN=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:o}=typeof t=="number"?{from:t,to:t}:t,s=ue.atStart(r).from,a=ue.atEnd(r).to,l=Wn(i,s,a),c=Wn(o,s,a),u=ue.create(r,l,c);e.setSelection(u)}return!0},LN=t=>({state:e,dispatch:n})=>{const r=ot(t,e.schema);return d_(r)(e,n)};function Cm(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e==null?void 0:e.includes(i.type.name));t.tr.ensureMarks(r)}}const PN=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:o,doc:s}=e,{$from:a,$to:l}=o,c=i.extensionManager.attributes,u=Ka(c,a.node().type.name,a.node().attrs);if(o instanceof se&&o.node.isBlock)return!a.parentOffset||!Gn(s,a.pos)?!1:(r&&(t&&Cm(n,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,f=a.depth===0?void 0:vN(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,m=Gn(e.doc,e.mapping.map(a.pos),1,h);if(!h&&!m&&Gn(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(m=!0,h=f?[{type:f,attrs:u}]:void 0),r){if(m&&(o instanceof ue&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,h),f&&!d&&!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&&Cm(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return m},BN=(t,e={})=>({tr:n,state:r,dispatch:i,editor:o})=>{var s;const a=ot(t,r.schema),{$from:l,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return!1;const d=l.node(-1);if(d.type!==a)return!1;const f=o.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=P.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=P.from(l.node(N).copy(b));const E=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,v={...Ka(f,l.node().type.name,l.node().attrs),...e},k=((s=a.contentMatch.defaultType)===null||s===void 0?void 0:s.createAndFill(v))||void 0;b=b.append(P.from(a.createAndFill(null,k)||void 0));const C=l.before(l.depth-(w-1));n.replace(C,l.after(-E),new Y(b,4-w,0));let S=-1;n.doc.nodesBetween(C,n.doc.content.size,(N,M)=>{if(S>-1)return!1;N.isTextblock&&N.content.size===0&&(S=M+1)}),S>-1&&n.setSelection(ue.near(n.doc.resolve(S))),n.scrollIntoView()}return!0}const h=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,m={...Ka(f,d.type.name,d.attrs),...e},g={...Ka(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(!Gn(n.doc,l.pos,2))return!1;if(i){const{selection:b,storedMarks:w}=r,{splittableMarks:E}=o.extensionManager,v=w||b.$to.parentOffset&&b.$from.marks();if(n.split(l.pos,2,y).scrollIntoView(),!v||!i)return!0;const k=v.filter(C=>E.includes(C.type.name));n.ensureMarks(k)}return!0},Nu=(t,e)=>{const n=qs(s=>s.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==null?void 0:i.type)&&Rr(t.doc,n.pos)&&t.join(n.pos),!0},Tu=(t,e)=>{const n=qs(s=>s.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==null?void 0:i.type)&&Rr(t.doc,r)&&t.join(r),!0},$N=(t,e,n,r={})=>({editor:i,tr:o,state:s,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=i.extensionManager,h=ot(t,s.schema),m=ot(e,s.schema),{selection:g,storedMarks:y}=s,{$from:b,$to:w}=g,E=b.blockRange(w),v=y||g.$to.parentOffset&&g.$from.marks();if(!E)return!1;const k=qs(C=>km(C.type.name,d))(g);if(E.depth>=1&&k&&E.depth-k.depth<=1){if(k.node.type===h)return c.liftListItem(m);if(km(k.node.type.name,d)&&h.validContent(k.node.content)&&a)return l().command(()=>(o.setNodeMarkup(k.pos,h),!0)).command(()=>Nu(o,h)).command(()=>Tu(o,h)).run()}return!n||!v||!a?l().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>Nu(o,h)).command(()=>Tu(o,h)).run():l().command(()=>{const C=u().wrapInList(h,r),S=v.filter(N=>f.includes(N.type.name));return o.ensureMarks(S),C?!0:c.clearNodes()}).wrapInList(h,r).command(()=>Nu(o,h)).command(()=>Tu(o,h)).run()},jN=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=n,s=Dr(t,r.schema);return Fd(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},FN=(t,e,n={})=>({state:r,commands:i})=>{const o=ot(t,r.schema),s=ot(e,r.schema),a=ys(r,o,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?i.setNode(s,l):i.setNode(o,{...l,...n})},HN=(t,e={})=>({state:n,commands:r})=>{const i=ot(t,n.schema);return ys(n,i,e)?r.lift(i):r.wrapIn(i,e)},zN=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let o;if(i.spec.isInputRules&&(o=i.getState(t))){if(e){const s=t.tr,a=o.transform;for(let l=a.steps.length-1;l>=0;l-=1)s.step(a.steps[l].invert(a.docs[l]));if(o.text){const l=s.doc.resolve(o.from).marks();s.replaceWith(o.from,o.to,t.schema.text(o.text,l))}else s.delete(o.from,o.to)}return!0}}return!1},UN=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(o=>{t.removeMark(o.$from.pos,o.$to.pos)}),!0},VN=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:s=!1}=e,{selection:a}=n,l=Dr(t,r.schema),{$from:c,empty:u,ranges:d}=a;if(!i)return!0;if(u&&s){let{from:f,to:h}=a;const m=(o=c.marks().find(y=>y.type===l))===null||o===void 0?void 0:o.attrs,g=Jf(c,l,m);g&&(f=g.from,h=g.to),n.removeMark(f,h,l)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,l)});return n.removeStoredMark(l),!0},WN=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null;const a=Tc(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(o=ot(t,r.schema)),a==="mark"&&(s=Dr(t,r.schema)),i&&n.selection.ranges.forEach(l=>{const c=l.$from.pos,u=l.$to.pos;let d,f,h,m;n.selection.empty?r.doc.nodesBetween(c,u,(g,y)=>{o&&o===g.type&&(h=Math.max(y,c),m=Math.min(y+g.nodeSize,u),d=y,f=g)}):r.doc.nodesBetween(c,u,(g,y)=>{y<c&&o&&o===g.type&&(h=Math.max(y,c),m=Math.min(y+g.nodeSize,u),d=y,f=g),y>=c&&y<=u&&(o&&o===g.type&&n.setNodeMarkup(y,void 0,{...g.attrs,...e}),s&&g.marks.length&&g.marks.forEach(b=>{if(s===b.type){const w=Math.max(y,c),E=Math.min(y+g.nodeSize,u);n.addMark(w,E,s.create({...b.attrs,...e}))}}))}),f&&(d!==void 0&&n.setNodeMarkup(d,void 0,{...f.attrs,...e}),s&&f.marks.length&&f.marks.forEach(g=>{s===g.type&&n.addMark(h,m,s.create({...g.attrs,...e}))}))}),!0):!1},KN=(t,e={})=>({state:n,dispatch:r})=>{const i=ot(t,n.schema);return i_(i,e)(n,r)},GN=(t,e={})=>({state:n,dispatch:r})=>{const i=ot(t,n.schema);return o_(i,e)(n,r)};var qN=Object.freeze({__proto__:null,blur:T_,clearContent:A_,clearNodes:M_,command:O_,createParagraphNear:R_,cut:I_,deleteCurrentNode:D_,deleteNode:L_,deleteRange:P_,deleteSelection:B_,enter:$_,exitCode:j_,extendMarkRange:F_,first:H_,focus:U_,forEach:V_,insertContent:W_,insertContentAt:q_,joinBackward:X_,joinDown:J_,joinForward:Z_,joinItemBackward:Q_,joinItemForward:eN,joinTextblockBackward:tN,joinTextblockForward:nN,joinUp:Y_,keyboardShortcut:iN,lift:oN,liftEmptyBlock:sN,liftListItem:aN,newlineInCode:lN,resetAttributes:cN,scrollIntoView:uN,selectAll:dN,selectNodeBackward:fN,selectNodeForward:hN,selectParentNode:pN,selectTextblockEnd:mN,selectTextblockStart:gN,setContent:yN,setMark:MN,setMeta:ON,setNode:RN,setNodeSelection:IN,setTextSelection:DN,sinkListItem:LN,splitBlock:PN,splitListItem:BN,toggleList:$N,toggleMark:jN,toggleNode:FN,toggleWrap:HN,undoInputRule:zN,unsetAllMarks:UN,unsetMark:VN,updateAttributes:WN,wrapIn:KN,wrapInList:GN});const YN=Ve.create({name:"commands",addCommands(){return{...qN}}}),JN=Ve.create({name:"drop",addProseMirrorPlugins(){return[new $e({key:new Pe("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),XN=Ve.create({name:"editable",addProseMirrorPlugins(){return[new $e({key:new Pe("editable"),props:{editable:()=>this.editor.options.editable}})]}}),ZN=new Pe("focusEvents"),QN=Ve.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new $e({key:ZN,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}}}})]}}),eT=Ve.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:u,$anchor:d}=l,{pos:f,parent:h}=d,m=d.parent.isTextblock&&f>0?a.doc.resolve(f-1):d,g=m.parent.type.spec.isolating,y=d.pos-d.parentOffset,b=g&&m.parent.childCount===1?y===d.pos:ge.atStart(c).from===f;return!u||!h.type.isTextblock||h.textContent.length||!b||b&&d.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.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},o={...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 ms()||B0()?o:i},addProseMirrorPlugins(){return[new $e({key:new Pe("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:o,from:s,to:a}=e.selection,l=ge.atStart(e.doc).from,c=ge.atEnd(e.doc).to;if(o||!(s===l&&a===c)||!Ac(n.doc))return;const f=n.tr,h=kc({state:n,transaction:f}),{commands:m}=new Cc({editor:this.editor,state:h});if(m.clearNodes(),!!f.steps.length)return f}})]}}),tT=Ve.create({name:"paste",addProseMirrorPlugins(){return[new $e({key:new Pe("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),nT=Ve.create({name:"tabindex",addProseMirrorPlugins(){return[new $e({key:new Pe("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Gr{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 Gr(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 Gr(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 Gr(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,s=this.pos+r+(o?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(s);if(!i&&a.depth<=this.depth)return;const l=new Gr(a,this.editor,i,i?n:null);i&&(l.actualDepth=this.depth+1),e.push(new Gr(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 o=i.node.attrs,s=Object.keys(n);for(let a=0;a<s.length;a+=1){const l=s[a];if(o[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 o=Object.keys(n);return this.children.forEach(s=>{r&&i.length>0||(s.node.type.name===e&&o.every(l=>n[l]===s.node.attrs[l])&&i.push(s),!(r&&i.length>0)&&(i=i.concat(s.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 rT=`.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 iT(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 oT extends f_{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=iT(rT,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=O0(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(o=>{const s=typeof o=="string"?`${o}$`:o.key;r=r.filter(a=>!a.key.startsWith(s))}),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?[XN,N_.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),YN,QN,eT,nT,JN,tT].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o==null?void 0:o.type));this.extensionManager=new Fi(i,this)}createCommandManager(){this.commandManager=new Cc({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let n;try{n=jd(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(s){if(!(s instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(s.message))throw s;this.emit("contentError",{editor:this,error:s,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(a=>a.name!=="collaboration"),this.createExtensionManager()}}),n=jd(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const r=L0(n,this.options.autofocus);this.view=new g0(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:ji.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 o=this.view.dom;o.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(s=>{var a;return(a=this.capturedTransaction)===null||a===void 0?void 0:a.step(s)});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"),o=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),o&&this.emit("blur",{editor:this,event:o.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return j0(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,i=typeof e=="string"?n:e;return NN(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return qf(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
88
-
89
- `,textSerializers:r={}}=e||{};return EN(this.state.doc,{blockSeparator:n,textSerializers:{...I0(this.schema),...r}})}get isEmpty(){return Ac(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 Gr(n,this)}get $doc(){return this.$pos(0)}}function eo(t){return new Gs({find:t.find,handler:({state:e,range:n,match:r})=>{const i=xe(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:o}=e,s=r[r.length-1],a=r[0];if(s){const l=a.search(/\S/),c=n.from+a.indexOf(s),u=c+s.length;if(Xf(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;u<n.to&&o.delete(u,n.to),c>n.from&&o.delete(n.from+l,c);const f=n.from+l+s.length;o.addMark(n.from+l,f,t.type.create(i||{})),o.removeStoredMark(t.type)}}})}function H0(t){return new Gs({find:t.find,handler:({state:e,range:n,match:r})=>{const i=xe(t.getAttributes,void 0,r)||{},{tr:o}=e,s=n.from;let a=n.to;const l=t.type.create(i);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=s+c;u>a?u=a:a=u+r[1].length;const d=r[0][r[0].length-1];o.insertText(d,s+r[0].length-1),o.replaceWith(u,a,l)}else if(r[0]){const c=t.type.isInline?s:s-1;o.insert(c,t.type.create(i)).delete(o.mapping.map(s),o.mapping.map(a))}o.scrollIntoView()}})}function Hd(t){return new Gs({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),o=xe(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,o)}})}function bs(t){return new Gs({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const o=xe(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),l=s.doc.resolve(n.from).blockRange(),c=l&&Rf(l,t.type,o);if(!c)return null;if(s.wrap(l,c),t.keepMarks&&t.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:h}=t.editor.extensionManager,m=f||d.$to.parentOffset&&d.$from.marks();if(m){const g=m.filter(y=>h.includes(y.type.name));s.ensureMarks(g)}}if(t.keepAttributes){const d=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(d,o).run()}const u=s.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&Rr(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&s.join(n.from-1)}})}let qe=class zd{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=xe(ee(this,"addOptions",{name:this.name}))),this.storage=xe(ee(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new zd(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>_c(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new zd(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=xe(ee(n,"addOptions",{name:n.name})),n.storage=xe(ee(n,"addStorage",{name:n.name,options:n.options})),n}};class sT{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,o,s,a,l;const{view:c}=this.editor,u=e.target,d=u.nodeType===3?(n=u.parentElement)===null||n===void 0?void 0:n.closest("[data-drag-handle]"):u.closest("[data-drag-handle]");if(!this.dom||!((r=this.contentDOM)===null||r===void 0)&&r.contains(u)||!d)return;let f=0,h=0;if(this.dom!==d){const w=this.dom.getBoundingClientRect(),E=d.getBoundingClientRect(),v=(i=e.offsetX)!==null&&i!==void 0?i:(o=e.nativeEvent)===null||o===void 0?void 0:o.offsetX,k=(s=e.offsetY)!==null&&s!==void 0?s:(a=e.nativeEvent)===null||a===void 0?void 0:a.offsetY;f=E.x-w.x+v,h=E.y-w.y+k}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=se.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 o=e.type.startsWith("drag"),s=e.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(r.tagName)||r.isContentEditable)&&!s&&!o)return!0;const{isEditable:l}=this.editor,{isDragging:c}=this,u=!!this.node.type.spec.draggable,d=se.isSelectable(this.node),f=e.type==="copy",h=e.type==="paste",m=e.type==="cut",g=e.type==="mousedown";if(!u&&d&&o&&e.target===this.dom&&e.preventDefault(),u&&o&&!c&&e.target===this.dom)return e.preventDefault(),!1;if(u&&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||s||f||h||m||g&&d)}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"&&(ms()||$d())&&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 ui(t){return new w_({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const o=xe(t.getAttributes,void 0,r,i);if(o===!1||o===null)return null;const{tr:s}=e,a=r[r.length-1],l=r[0];let c=n.to;if(a){const u=l.search(/\S/),d=n.from+l.indexOf(a),f=d+a.length;if(Xf(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>d).length)return null;f<n.to&&s.delete(f,n.to),d>n.from&&s.delete(n.from+u,d),c=n.from+u+a.length,s.addMark(n.from+u,c,t.type.create(o||{})),s.removeStoredMark(t.type)}}})}function aT(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof se){const o=r.index();return r.parent.canReplaceWith(o,o+1,e)}let i=r.depth;for(;i>=0;){const o=r.index(i);if(r.node(i).contentMatchAt(o).matchType(e))return!0;i-=1}return!1}function lT(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var Dt="top",tn="bottom",nn="right",Lt="left",Zf="auto",Ys=[Dt,tn,nn,Lt],to="start",vs="end",cT="clippingParents",z0="viewport",Do="popper",uT="reference",Sm=Ys.reduce(function(t,e){return t.concat([e+"-"+to,e+"-"+vs])},[]),U0=[].concat(Ys,[Zf]).reduce(function(t,e){return t.concat([e,e+"-"+to,e+"-"+vs])},[]),dT="beforeRead",fT="read",hT="afterRead",pT="beforeMain",mT="main",gT="afterMain",yT="beforeWrite",bT="write",vT="afterWrite",xT=[dT,fT,hT,pT,mT,gT,yT,bT,vT];function On(t){return t?(t.nodeName||"").toLowerCase():null}function Ut(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function di(t){var e=Ut(t).Element;return t instanceof e||t instanceof Element}function en(t){var e=Ut(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function Qf(t){if(typeof ShadowRoot>"u")return!1;var e=Ut(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function wT(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},i=e.attributes[n]||{},o=e.elements[n];!en(o)||!On(o)||(Object.assign(o.style,r),Object.keys(i).forEach(function(s){var a=i[s];a===!1?o.removeAttribute(s):o.setAttribute(s,a===!0?"":a)}))})}function ET(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],o=e.attributes[r]||{},s=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),a=s.reduce(function(l,c){return l[c]="",l},{});!en(i)||!On(i)||(Object.assign(i.style,a),Object.keys(o).forEach(function(l){i.removeAttribute(l)}))})}}const V0={name:"applyStyles",enabled:!0,phase:"write",fn:wT,effect:ET,requires:["computeStyles"]};function _n(t){return t.split("-")[0]}var ti=Math.max,bl=Math.min,no=Math.round;function Ud(){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 W0(){return!/^((?!chrome|android).)*safari/i.test(Ud())}function ro(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),i=1,o=1;e&&en(t)&&(i=t.offsetWidth>0&&no(r.width)/t.offsetWidth||1,o=t.offsetHeight>0&&no(r.height)/t.offsetHeight||1);var s=di(t)?Ut(t):window,a=s.visualViewport,l=!W0()&&n,c=(r.left+(l&&a?a.offsetLeft:0))/i,u=(r.top+(l&&a?a.offsetTop:0))/o,d=r.width/i,f=r.height/o;return{width:d,height:f,top:u,right:c+d,bottom:u+f,left:c,x:c,y:u}}function eh(t){var e=ro(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 K0(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&Qf(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Yn(t){return Ut(t).getComputedStyle(t)}function kT(t){return["table","td","th"].indexOf(On(t))>=0}function Lr(t){return((di(t)?t.ownerDocument:t.document)||window.document).documentElement}function Mc(t){return On(t)==="html"?t:t.assignedSlot||t.parentNode||(Qf(t)?t.host:null)||Lr(t)}function _m(t){return!en(t)||Yn(t).position==="fixed"?null:t.offsetParent}function CT(t){var e=/firefox/i.test(Ud()),n=/Trident/i.test(Ud());if(n&&en(t)){var r=Yn(t);if(r.position==="fixed")return null}var i=Mc(t);for(Qf(i)&&(i=i.host);en(i)&&["html","body"].indexOf(On(i))<0;){var o=Yn(i);if(o.transform!=="none"||o.perspective!=="none"||o.contain==="paint"||["transform","perspective"].indexOf(o.willChange)!==-1||e&&o.willChange==="filter"||e&&o.filter&&o.filter!=="none")return i;i=i.parentNode}return null}function Js(t){for(var e=Ut(t),n=_m(t);n&&kT(n)&&Yn(n).position==="static";)n=_m(n);return n&&(On(n)==="html"||On(n)==="body"&&Yn(n).position==="static")?e:n||CT(t)||e}function th(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function qo(t,e,n){return ti(t,bl(e,n))}function ST(t,e,n){var r=qo(t,e,n);return r>n?n:r}function G0(){return{top:0,right:0,bottom:0,left:0}}function q0(t){return Object.assign({},G0(),t)}function Y0(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var _T=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,q0(typeof e!="number"?e:Y0(e,Ys))};function NT(t){var e,n=t.state,r=t.name,i=t.options,o=n.elements.arrow,s=n.modifiersData.popperOffsets,a=_n(n.placement),l=th(a),c=[Lt,nn].indexOf(a)>=0,u=c?"height":"width";if(!(!o||!s)){var d=_T(i.padding,n),f=eh(o),h=l==="y"?Dt:Lt,m=l==="y"?tn:nn,g=n.rects.reference[u]+n.rects.reference[l]-s[l]-n.rects.popper[u],y=s[l]-n.rects.reference[l],b=Js(o),w=b?l==="y"?b.clientHeight||0:b.clientWidth||0:0,E=g/2-y/2,v=d[h],k=w-f[u]-d[m],C=w/2-f[u]/2+E,S=qo(v,C,k),N=l;n.modifiersData[r]=(e={},e[N]=S,e.centerOffset=S-C,e)}}function TT(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)||K0(e.elements.popper,i)&&(e.elements.arrow=i))}const AT={name:"arrow",enabled:!0,phase:"main",fn:NT,effect:TT,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function io(t){return t.split("-")[1]}var MT={top:"auto",right:"auto",bottom:"auto",left:"auto"};function OT(t,e){var n=t.x,r=t.y,i=e.devicePixelRatio||1;return{x:no(n*i)/i||0,y:no(r*i)/i||0}}function Nm(t){var e,n=t.popper,r=t.popperRect,i=t.placement,o=t.variation,s=t.offsets,a=t.position,l=t.gpuAcceleration,c=t.adaptive,u=t.roundOffsets,d=t.isFixed,f=s.x,h=f===void 0?0:f,m=s.y,g=m===void 0?0:m,y=typeof u=="function"?u({x:h,y:g}):{x:h,y:g};h=y.x,g=y.y;var b=s.hasOwnProperty("x"),w=s.hasOwnProperty("y"),E=Lt,v=Dt,k=window;if(c){var C=Js(n),S="clientHeight",N="clientWidth";if(C===Ut(n)&&(C=Lr(n),Yn(C).position!=="static"&&a==="absolute"&&(S="scrollHeight",N="scrollWidth")),C=C,i===Dt||(i===Lt||i===nn)&&o===vs){v=tn;var M=d&&C===k&&k.visualViewport?k.visualViewport.height:C[S];g-=M-r.height,g*=l?1:-1}if(i===Lt||(i===Dt||i===tn)&&o===vs){E=nn;var D=d&&C===k&&k.visualViewport?k.visualViewport.width:C[N];h-=D-r.width,h*=l?1:-1}}var H=Object.assign({position:a},c&&MT),$=u===!0?OT({x:h,y:g},Ut(n)):{x:h,y:g};if(h=$.x,g=$.y,l){var z;return Object.assign({},H,(z={},z[v]=w?"0":"",z[E]=b?"0":"",z.transform=(k.devicePixelRatio||1)<=1?"translate("+h+"px, "+g+"px)":"translate3d("+h+"px, "+g+"px, 0)",z))}return Object.assign({},H,(e={},e[v]=w?g+"px":"",e[E]=b?h+"px":"",e.transform="",e))}function RT(t){var e=t.state,n=t.options,r=n.gpuAcceleration,i=r===void 0?!0:r,o=n.adaptive,s=o===void 0?!0:o,a=n.roundOffsets,l=a===void 0?!0:a,c={placement:_n(e.placement),variation:io(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,Nm(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Nm(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 IT={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:RT,data:{}};var pa={passive:!0};function DT(t){var e=t.state,n=t.instance,r=t.options,i=r.scroll,o=i===void 0?!0:i,s=r.resize,a=s===void 0?!0:s,l=Ut(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&c.forEach(function(u){u.addEventListener("scroll",n.update,pa)}),a&&l.addEventListener("resize",n.update,pa),function(){o&&c.forEach(function(u){u.removeEventListener("scroll",n.update,pa)}),a&&l.removeEventListener("resize",n.update,pa)}}const LT={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:DT,data:{}};var PT={left:"right",right:"left",bottom:"top",top:"bottom"};function Ga(t){return t.replace(/left|right|bottom|top/g,function(e){return PT[e]})}var BT={start:"end",end:"start"};function Tm(t){return t.replace(/start|end/g,function(e){return BT[e]})}function nh(t){var e=Ut(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function rh(t){return ro(Lr(t)).left+nh(t).scrollLeft}function $T(t,e){var n=Ut(t),r=Lr(t),i=n.visualViewport,o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;var c=W0();(c||!c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:a+rh(t),y:l}}function jT(t){var e,n=Lr(t),r=nh(t),i=(e=t.ownerDocument)==null?void 0:e.body,o=ti(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),s=ti(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-r.scrollLeft+rh(t),l=-r.scrollTop;return Yn(i||n).direction==="rtl"&&(a+=ti(n.clientWidth,i?i.clientWidth:0)-o),{width:o,height:s,x:a,y:l}}function ih(t){var e=Yn(t),n=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function J0(t){return["html","body","#document"].indexOf(On(t))>=0?t.ownerDocument.body:en(t)&&ih(t)?t:J0(Mc(t))}function Yo(t,e){var n;e===void 0&&(e=[]);var r=J0(t),i=r===((n=t.ownerDocument)==null?void 0:n.body),o=Ut(r),s=i?[o].concat(o.visualViewport||[],ih(r)?r:[]):r,a=e.concat(s);return i?a:a.concat(Yo(Mc(s)))}function Vd(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function FT(t,e){var n=ro(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 Am(t,e,n){return e===z0?Vd($T(t,n)):di(e)?FT(e,n):Vd(jT(Lr(t)))}function HT(t){var e=Yo(Mc(t)),n=["absolute","fixed"].indexOf(Yn(t).position)>=0,r=n&&en(t)?Js(t):t;return di(r)?e.filter(function(i){return di(i)&&K0(i,r)&&On(i)!=="body"}):[]}function zT(t,e,n,r){var i=e==="clippingParents"?HT(t):[].concat(e),o=[].concat(i,[n]),s=o[0],a=o.reduce(function(l,c){var u=Am(t,c,r);return l.top=ti(u.top,l.top),l.right=bl(u.right,l.right),l.bottom=bl(u.bottom,l.bottom),l.left=ti(u.left,l.left),l},Am(t,s,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function X0(t){var e=t.reference,n=t.element,r=t.placement,i=r?_n(r):null,o=r?io(r):null,s=e.x+e.width/2-n.width/2,a=e.y+e.height/2-n.height/2,l;switch(i){case Dt:l={x:s,y:e.y-n.height};break;case tn:l={x:s,y:e.y+e.height};break;case nn:l={x:e.x+e.width,y:a};break;case Lt:l={x:e.x-n.width,y:a};break;default:l={x:e.x,y:e.y}}var c=i?th(i):null;if(c!=null){var u=c==="y"?"height":"width";switch(o){case to:l[c]=l[c]-(e[u]/2-n[u]/2);break;case vs:l[c]=l[c]+(e[u]/2-n[u]/2);break}}return l}function xs(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=r===void 0?t.placement:r,o=n.strategy,s=o===void 0?t.strategy:o,a=n.boundary,l=a===void 0?cT:a,c=n.rootBoundary,u=c===void 0?z0:c,d=n.elementContext,f=d===void 0?Do:d,h=n.altBoundary,m=h===void 0?!1:h,g=n.padding,y=g===void 0?0:g,b=q0(typeof y!="number"?y:Y0(y,Ys)),w=f===Do?uT:Do,E=t.rects.popper,v=t.elements[m?w:f],k=zT(di(v)?v:v.contextElement||Lr(t.elements.popper),l,u,s),C=ro(t.elements.reference),S=X0({reference:C,element:E,placement:i}),N=Vd(Object.assign({},E,S)),M=f===Do?N:C,D={top:k.top-M.top+b.top,bottom:M.bottom-k.bottom+b.bottom,left:k.left-M.left+b.left,right:M.right-k.right+b.right},H=t.modifiersData.offset;if(f===Do&&H){var $=H[i];Object.keys(D).forEach(function(z){var L=[nn,tn].indexOf(z)>=0?1:-1,K=[Dt,tn].indexOf(z)>=0?"y":"x";D[z]+=$[K]*L})}return D}function UT(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=n.boundary,o=n.rootBoundary,s=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,c=l===void 0?U0:l,u=io(r),d=u?a?Sm:Sm.filter(function(m){return io(m)===u}):Ys,f=d.filter(function(m){return c.indexOf(m)>=0});f.length===0&&(f=d);var h=f.reduce(function(m,g){return m[g]=xs(t,{placement:g,boundary:i,rootBoundary:o,padding:s})[_n(g)],m},{});return Object.keys(h).sort(function(m,g){return h[m]-h[g]})}function VT(t){if(_n(t)===Zf)return[];var e=Ga(t);return[Tm(t),e,Tm(e)]}function WT(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var i=n.mainAxis,o=i===void 0?!0:i,s=n.altAxis,a=s===void 0?!0:s,l=n.fallbackPlacements,c=n.padding,u=n.boundary,d=n.rootBoundary,f=n.altBoundary,h=n.flipVariations,m=h===void 0?!0:h,g=n.allowedAutoPlacements,y=e.options.placement,b=_n(y),w=b===y,E=l||(w||!m?[Ga(y)]:VT(y)),v=[y].concat(E).reduce(function(W,J){return W.concat(_n(J)===Zf?UT(e,{placement:J,boundary:u,rootBoundary:d,padding:c,flipVariations:m,allowedAutoPlacements:g}):J)},[]),k=e.rects.reference,C=e.rects.popper,S=new Map,N=!0,M=v[0],D=0;D<v.length;D++){var H=v[D],$=_n(H),z=io(H)===to,L=[Dt,tn].indexOf($)>=0,K=L?"width":"height",A=xs(e,{placement:H,boundary:u,rootBoundary:d,altBoundary:f,padding:c}),T=L?z?nn:Lt:z?tn:Dt;k[K]>C[K]&&(T=Ga(T));var _=Ga(T),I=[];if(o&&I.push(A[$]<=0),a&&I.push(A[T]<=0,A[_]<=0),I.every(function(W){return W})){M=H,N=!1;break}S.set(H,I)}if(N)for(var j=m?3:1,G=function(J){var me=v.find(function(pe){var Me=S.get(pe);if(Me)return Me.slice(0,J).every(function(ke){return ke})});if(me)return M=me,"break"},ie=j;ie>0;ie--){var ae=G(ie);if(ae==="break")break}e.placement!==M&&(e.modifiersData[r]._skip=!0,e.placement=M,e.reset=!0)}}const KT={name:"flip",enabled:!0,phase:"main",fn:WT,requiresIfExists:["offset"],data:{_skip:!1}};function Mm(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 Om(t){return[Dt,nn,tn,Lt].some(function(e){return t[e]>=0})}function GT(t){var e=t.state,n=t.name,r=e.rects.reference,i=e.rects.popper,o=e.modifiersData.preventOverflow,s=xs(e,{elementContext:"reference"}),a=xs(e,{altBoundary:!0}),l=Mm(s,r),c=Mm(a,i,o),u=Om(l),d=Om(c);e.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}const qT={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:GT};function YT(t,e,n){var r=_n(t),i=[Lt,Dt].indexOf(r)>=0?-1:1,o=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,s=o[0],a=o[1];return s=s||0,a=(a||0)*i,[Lt,nn].indexOf(r)>=0?{x:a,y:s}:{x:s,y:a}}function JT(t){var e=t.state,n=t.options,r=t.name,i=n.offset,o=i===void 0?[0,0]:i,s=U0.reduce(function(u,d){return u[d]=YT(d,e.rects,o),u},{}),a=s[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]=s}const XT={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:JT};function ZT(t){var e=t.state,n=t.name;e.modifiersData[n]=X0({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})}const QT={name:"popperOffsets",enabled:!0,phase:"read",fn:ZT,data:{}};function eA(t){return t==="x"?"y":"x"}function tA(t){var e=t.state,n=t.options,r=t.name,i=n.mainAxis,o=i===void 0?!0:i,s=n.altAxis,a=s===void 0?!1:s,l=n.boundary,c=n.rootBoundary,u=n.altBoundary,d=n.padding,f=n.tether,h=f===void 0?!0:f,m=n.tetherOffset,g=m===void 0?0:m,y=xs(e,{boundary:l,rootBoundary:c,padding:d,altBoundary:u}),b=_n(e.placement),w=io(e.placement),E=!w,v=th(b),k=eA(v),C=e.modifiersData.popperOffsets,S=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),H=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,$={x:0,y:0};if(C){if(o){var z,L=v==="y"?Dt:Lt,K=v==="y"?tn:nn,A=v==="y"?"height":"width",T=C[v],_=T+y[L],I=T-y[K],j=h?-N[A]/2:0,G=w===to?S[A]:N[A],ie=w===to?-N[A]:-S[A],ae=e.elements.arrow,W=h&&ae?eh(ae):{width:0,height:0},J=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:G0(),me=J[L],pe=J[K],Me=qo(0,S[A],W[A]),ke=E?S[A]/2-j-Me-me-D.mainAxis:G-Me-me-D.mainAxis,Se=E?-S[A]/2+j+Me+pe+D.mainAxis:ie+Me+pe+D.mainAxis,Ie=e.elements.arrow&&Js(e.elements.arrow),Te=Ie?v==="y"?Ie.clientTop||0:Ie.clientLeft||0:0,Ce=(z=H==null?void 0:H[v])!=null?z:0,We=T+ke-Ce-Te,Be=T+Se-Ce,ce=qo(h?bl(_,We):_,T,h?ti(I,Be):I);C[v]=ce,$[v]=ce-T}if(a){var Ye,X=v==="x"?Dt:Lt,ne=v==="x"?tn:nn,_e=C[k],le=k==="y"?"height":"width",we=_e+y[X],Je=_e-y[ne],lt=[Dt,Lt].indexOf(b)!==-1,Kt=(Ye=H==null?void 0:H[k])!=null?Ye:0,V=lt?we:_e-S[le]-N[le]-Kt+D.altAxis,O=lt?_e+S[le]+N[le]-Kt-D.altAxis:Je,B=h&&lt?ST(V,_e,O):qo(h?V:we,_e,h?O:Je);C[k]=B,$[k]=B-_e}e.modifiersData[r]=$}}const nA={name:"preventOverflow",enabled:!0,phase:"main",fn:tA,requiresIfExists:["offset"]};function rA(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function iA(t){return t===Ut(t)||!en(t)?nh(t):rA(t)}function oA(t){var e=t.getBoundingClientRect(),n=no(e.width)/t.offsetWidth||1,r=no(e.height)/t.offsetHeight||1;return n!==1||r!==1}function sA(t,e,n){n===void 0&&(n=!1);var r=en(e),i=en(e)&&oA(e),o=Lr(e),s=ro(t,i,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((On(e)!=="body"||ih(o))&&(a=iA(e)),en(e)?(l=ro(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):o&&(l.x=rh(o))),{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function aA(t){var e=new Map,n=new Set,r=[];t.forEach(function(o){e.set(o.name,o)});function i(o){n.add(o.name);var s=[].concat(o.requires||[],o.requiresIfExists||[]);s.forEach(function(a){if(!n.has(a)){var l=e.get(a);l&&i(l)}}),r.push(o)}return t.forEach(function(o){n.has(o.name)||i(o)}),r}function lA(t){var e=aA(t);return xT.reduce(function(n,r){return n.concat(e.filter(function(i){return i.phase===r}))},[])}function cA(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function uA(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 Rm={placement:"bottom",modifiers:[],strategy:"absolute"};function Im(){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 dA(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,r=n===void 0?[]:n,i=e.defaultOptions,o=i===void 0?Rm:i;return function(a,l,c){c===void 0&&(c=o);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},Rm,o),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},d=[],f=!1,h={state:u,setOptions:function(b){var w=typeof b=="function"?b(u.options):b;g(),u.options=Object.assign({},o,u.options,w),u.scrollParents={reference:di(a)?Yo(a):a.contextElement?Yo(a.contextElement):[],popper:Yo(l)};var E=lA(uA([].concat(r,u.options.modifiers)));return u.orderedModifiers=E.filter(function(v){return v.enabled}),m(),h.update()},forceUpdate:function(){if(!f){var b=u.elements,w=b.reference,E=b.popper;if(Im(w,E)){u.rects={reference:sA(w,Js(E),u.options.strategy==="fixed"),popper:eh(E)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(D){return u.modifiersData[D.name]=Object.assign({},D.data)});for(var v=0;v<u.orderedModifiers.length;v++){if(u.reset===!0){u.reset=!1,v=-1;continue}var k=u.orderedModifiers[v],C=k.fn,S=k.options,N=S===void 0?{}:S,M=k.name;typeof C=="function"&&(u=C({state:u,options:N,name:M,instance:h})||u)}}}},update:cA(function(){return new Promise(function(y){h.forceUpdate(),y(u)})}),destroy:function(){g(),f=!0}};if(!Im(a,l))return h;h.setOptions(c).then(function(y){!f&&c.onFirstUpdate&&c.onFirstUpdate(y)});function m(){u.orderedModifiers.forEach(function(y){var b=y.name,w=y.options,E=w===void 0?{}:w,v=y.effect;if(typeof v=="function"){var k=v({state:u,name:b,instance:h,options:E}),C=function(){};d.push(k||C)}})}function g(){d.forEach(function(y){return y()}),d=[]}return h}}var fA=[LT,QT,IT,V0,XT,KT,nA,AT,qT],hA=dA({defaultModifiers:fA}),pA="tippy-box",Z0="tippy-content",mA="tippy-backdrop",Q0="tippy-arrow",ev="tippy-svg-arrow",Vr={passive:!0,capture:!0},tv=function(){return document.body};function Au(t,e,n){if(Array.isArray(t)){var r=t[e];return r??(Array.isArray(n)?n[e]:n)}return t}function oh(t,e){var n={}.toString.call(t);return n.indexOf("[object")===0&&n.indexOf(e+"]")>-1}function nv(t,e){return typeof t=="function"?t.apply(void 0,e):t}function Dm(t,e){if(e===0)return t;var n;return function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)}}function gA(t){return t.split(/\s+/).filter(Boolean)}function Di(t){return[].concat(t)}function Lm(t,e){t.indexOf(e)===-1&&t.push(e)}function yA(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function bA(t){return t.split("-")[0]}function vl(t){return[].slice.call(t)}function Pm(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function Jo(){return document.createElement("div")}function Oc(t){return["Element","Fragment"].some(function(e){return oh(t,e)})}function vA(t){return oh(t,"NodeList")}function xA(t){return oh(t,"MouseEvent")}function wA(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function EA(t){return Oc(t)?[t]:vA(t)?vl(t):Array.isArray(t)?t:vl(document.querySelectorAll(t))}function Mu(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function Bm(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function kA(t){var e,n=Di(t),r=n[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function CA(t,e){var n=e.clientX,r=e.clientY;return t.every(function(i){var o=i.popperRect,s=i.popperState,a=i.props,l=a.interactiveBorder,c=bA(s.placement),u=s.modifiersData.offset;if(!u)return!0;var d=c==="bottom"?u.top.y:0,f=c==="top"?u.bottom.y:0,h=c==="right"?u.left.x:0,m=c==="left"?u.right.x:0,g=o.top-r+d>l,y=r-o.bottom-f>l,b=o.left-n+h>l,w=n-o.right-m>l;return g||y||b||w})}function Ou(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){t[r](i,n)})}function $m(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 xn={isTouch:!1},jm=0;function SA(){xn.isTouch||(xn.isTouch=!0,window.performance&&document.addEventListener("mousemove",rv))}function rv(){var t=performance.now();t-jm<20&&(xn.isTouch=!1,document.removeEventListener("mousemove",rv)),jm=t}function _A(){var t=document.activeElement;if(wA(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function NA(){document.addEventListener("touchstart",SA,Vr),window.addEventListener("blur",_A)}var TA=typeof window<"u"&&typeof document<"u",AA=TA?!!window.msCrypto:!1,MA={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},OA={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},an=Object.assign({appendTo:tv,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},MA,OA),RA=Object.keys(an),IA=function(e){var n=Object.keys(e);n.forEach(function(r){an[r]=e[r]})};function iv(t){var e=t.plugins||[],n=e.reduce(function(r,i){var o=i.name,s=i.defaultValue;if(o){var a;r[o]=t[o]!==void 0?t[o]:(a=an[o])!=null?a:s}return r},{});return Object.assign({},t,n)}function DA(t,e){var n=e?Object.keys(iv(Object.assign({},an,{plugins:e}))):RA,r=n.reduce(function(i,o){var s=(t.getAttribute("data-tippy-"+o)||"").trim();if(!s)return i;if(o==="content")i[o]=s;else try{i[o]=JSON.parse(s)}catch{i[o]=s}return i},{});return r}function Fm(t,e){var n=Object.assign({},e,{content:nv(e.content,[t])},e.ignoreAttributes?{}:DA(t,e.plugins));return n.aria=Object.assign({},an.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 LA=function(){return"innerHTML"};function Wd(t,e){t[LA()]=e}function Hm(t){var e=Jo();return t===!0?e.className=Q0:(e.className=ev,Oc(t)?e.appendChild(t):Wd(e,t)),e}function zm(t,e){Oc(e.content)?(Wd(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Wd(t,e.content):t.textContent=e.content)}function Kd(t){var e=t.firstElementChild,n=vl(e.children);return{box:e,content:n.find(function(r){return r.classList.contains(Z0)}),arrow:n.find(function(r){return r.classList.contains(Q0)||r.classList.contains(ev)}),backdrop:n.find(function(r){return r.classList.contains(mA)})}}function ov(t){var e=Jo(),n=Jo();n.className=pA,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=Jo();r.className=Z0,r.setAttribute("data-state","hidden"),zm(r,t.props),e.appendChild(n),n.appendChild(r),i(t.props,t.props);function i(o,s){var a=Kd(e),l=a.box,c=a.content,u=a.arrow;s.theme?l.setAttribute("data-theme",s.theme):l.removeAttribute("data-theme"),typeof s.animation=="string"?l.setAttribute("data-animation",s.animation):l.removeAttribute("data-animation"),s.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof s.maxWidth=="number"?s.maxWidth+"px":s.maxWidth,s.role?l.setAttribute("role",s.role):l.removeAttribute("role"),(o.content!==s.content||o.allowHTML!==s.allowHTML)&&zm(c,t.props),s.arrow?u?o.arrow!==s.arrow&&(l.removeChild(u),l.appendChild(Hm(s.arrow))):l.appendChild(Hm(s.arrow)):u&&l.removeChild(u)}return{popper:e,onUpdate:i}}ov.$$tippy=!0;var PA=1,ma=[],Ru=[];function BA(t,e){var n=Fm(t,Object.assign({},an,iv(Pm(e)))),r,i,o,s=!1,a=!1,l=!1,c=!1,u,d,f,h=[],m=Dm(We,n.interactiveDebounce),g,y=PA++,b=null,w=yA(n.plugins),E={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},v={id:y,reference:t,popper:Jo(),popperInstance:b,props:n,state:E,plugins:w,clearDelayTimeouts:V,setProps:O,setContent:B,show:q,hide:de,hideWithInteractivity:Oe,enable:lt,disable:Kt,unmount:Pt,destroy:Oo};if(!n.render)return v;var k=n.render(v),C=k.popper,S=k.onUpdate;C.setAttribute("data-tippy-root",""),C.id="tippy-"+v.id,v.popper=C,t._tippy=v,C._tippy=v;var N=w.map(function(R){return R.fn(v)}),M=t.hasAttribute("aria-expanded");return Ie(),j(),T(),_("onCreate",[v]),n.showOnCreate&&we(),C.addEventListener("mouseenter",function(){v.props.interactive&&v.state.isVisible&&v.clearDelayTimeouts()}),C.addEventListener("mouseleave",function(){v.props.interactive&&v.props.trigger.indexOf("mouseenter")>=0&&L().addEventListener("mousemove",m)}),v;function D(){var R=v.props.touch;return Array.isArray(R)?R:[R,0]}function H(){return D()[0]==="hold"}function $(){var R;return!!((R=v.props.render)!=null&&R.$$tippy)}function z(){return g||t}function L(){var R=z().parentNode;return R?kA(R):document}function K(){return Kd(C)}function A(R){return v.state.isMounted&&!v.state.isVisible||xn.isTouch||u&&u.type==="focus"?0:Au(v.props.delay,R?0:1,an.delay)}function T(R){R===void 0&&(R=!1),C.style.pointerEvents=v.props.interactive&&!R?"":"none",C.style.zIndex=""+v.props.zIndex}function _(R,re,he){if(he===void 0&&(he=!0),N.forEach(function(Ee){Ee[R]&&Ee[R].apply(Ee,re)}),he){var Ae;(Ae=v.props)[R].apply(Ae,re)}}function I(){var R=v.props.aria;if(R.content){var re="aria-"+R.content,he=C.id,Ae=Di(v.props.triggerTarget||t);Ae.forEach(function(Ee){var kt=Ee.getAttribute(re);if(v.state.isVisible)Ee.setAttribute(re,kt?kt+" "+he:he);else{var Gt=kt&&kt.replace(he,"").trim();Gt?Ee.setAttribute(re,Gt):Ee.removeAttribute(re)}})}}function j(){if(!(M||!v.props.aria.expanded)){var R=Di(v.props.triggerTarget||t);R.forEach(function(re){v.props.interactive?re.setAttribute("aria-expanded",v.state.isVisible&&re===z()?"true":"false"):re.removeAttribute("aria-expanded")})}}function G(){L().removeEventListener("mousemove",m),ma=ma.filter(function(R){return R!==m})}function ie(R){if(!(xn.isTouch&&(l||R.type==="mousedown"))){var re=R.composedPath&&R.composedPath()[0]||R.target;if(!(v.props.interactive&&$m(C,re))){if(Di(v.props.triggerTarget||t).some(function(he){return $m(he,re)})){if(xn.isTouch||v.state.isVisible&&v.props.trigger.indexOf("click")>=0)return}else _("onClickOutside",[v,R]);v.props.hideOnClick===!0&&(v.clearDelayTimeouts(),v.hide(),a=!0,setTimeout(function(){a=!1}),v.state.isMounted||me())}}}function ae(){l=!0}function W(){l=!1}function J(){var R=L();R.addEventListener("mousedown",ie,!0),R.addEventListener("touchend",ie,Vr),R.addEventListener("touchstart",W,Vr),R.addEventListener("touchmove",ae,Vr)}function me(){var R=L();R.removeEventListener("mousedown",ie,!0),R.removeEventListener("touchend",ie,Vr),R.removeEventListener("touchstart",W,Vr),R.removeEventListener("touchmove",ae,Vr)}function pe(R,re){ke(R,function(){!v.state.isVisible&&C.parentNode&&C.parentNode.contains(C)&&re()})}function Me(R,re){ke(R,re)}function ke(R,re){var he=K().box;function Ae(Ee){Ee.target===he&&(Ou(he,"remove",Ae),re())}if(R===0)return re();Ou(he,"remove",d),Ou(he,"add",Ae),d=Ae}function Se(R,re,he){he===void 0&&(he=!1);var Ae=Di(v.props.triggerTarget||t);Ae.forEach(function(Ee){Ee.addEventListener(R,re,he),h.push({node:Ee,eventType:R,handler:re,options:he})})}function Ie(){H()&&(Se("touchstart",Ce,{passive:!0}),Se("touchend",Be,{passive:!0})),gA(v.props.trigger).forEach(function(R){if(R!=="manual")switch(Se(R,Ce),R){case"mouseenter":Se("mouseleave",Be);break;case"focus":Se(AA?"focusout":"blur",ce);break;case"focusin":Se("focusout",ce);break}})}function Te(){h.forEach(function(R){var re=R.node,he=R.eventType,Ae=R.handler,Ee=R.options;re.removeEventListener(he,Ae,Ee)}),h=[]}function Ce(R){var re,he=!1;if(!(!v.state.isEnabled||Ye(R)||a)){var Ae=((re=u)==null?void 0:re.type)==="focus";u=R,g=R.currentTarget,j(),!v.state.isVisible&&xA(R)&&ma.forEach(function(Ee){return Ee(R)}),R.type==="click"&&(v.props.trigger.indexOf("mouseenter")<0||s)&&v.props.hideOnClick!==!1&&v.state.isVisible?he=!0:we(R),R.type==="click"&&(s=!he),he&&!Ae&&Je(R)}}function We(R){var re=R.target,he=z().contains(re)||C.contains(re);if(!(R.type==="mousemove"&&he)){var Ae=le().concat(C).map(function(Ee){var kt,Gt=Ee._tippy,wi=(kt=Gt.popperInstance)==null?void 0:kt.state;return wi?{popperRect:Ee.getBoundingClientRect(),popperState:wi,props:n}:null}).filter(Boolean);CA(Ae,R)&&(G(),Je(R))}}function Be(R){var re=Ye(R)||v.props.trigger.indexOf("click")>=0&&s;if(!re){if(v.props.interactive){v.hideWithInteractivity(R);return}Je(R)}}function ce(R){v.props.trigger.indexOf("focusin")<0&&R.target!==z()||v.props.interactive&&R.relatedTarget&&C.contains(R.relatedTarget)||Je(R)}function Ye(R){return xn.isTouch?H()!==R.type.indexOf("touch")>=0:!1}function X(){ne();var R=v.props,re=R.popperOptions,he=R.placement,Ae=R.offset,Ee=R.getReferenceClientRect,kt=R.moveTransition,Gt=$()?Kd(C).arrow:null,wi=Ee?{getBoundingClientRect:Ee,contextElement:Ee.contextElement||z()}:t,bp={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(ia){var Ei=ia.state;if($()){var nk=K(),uu=nk.box;["placement","reference-hidden","escaped"].forEach(function(oa){oa==="placement"?uu.setAttribute("data-placement",Ei.placement):Ei.attributes.popper["data-popper-"+oa]?uu.setAttribute("data-"+oa,""):uu.removeAttribute("data-"+oa)}),Ei.attributes.popper={}}}},Fr=[{name:"offset",options:{offset:Ae}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!kt}},bp];$()&&Gt&&Fr.push({name:"arrow",options:{element:Gt,padding:3}}),Fr.push.apply(Fr,(re==null?void 0:re.modifiers)||[]),v.popperInstance=hA(wi,C,Object.assign({},re,{placement:he,onFirstUpdate:f,modifiers:Fr}))}function ne(){v.popperInstance&&(v.popperInstance.destroy(),v.popperInstance=null)}function _e(){var R=v.props.appendTo,re,he=z();v.props.interactive&&R===tv||R==="parent"?re=he.parentNode:re=nv(R,[he]),re.contains(C)||re.appendChild(C),v.state.isMounted=!0,X()}function le(){return vl(C.querySelectorAll("[data-tippy-root]"))}function we(R){v.clearDelayTimeouts(),R&&_("onTrigger",[v,R]),J();var re=A(!0),he=D(),Ae=he[0],Ee=he[1];xn.isTouch&&Ae==="hold"&&Ee&&(re=Ee),re?r=setTimeout(function(){v.show()},re):v.show()}function Je(R){if(v.clearDelayTimeouts(),_("onUntrigger",[v,R]),!v.state.isVisible){me();return}if(!(v.props.trigger.indexOf("mouseenter")>=0&&v.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(R.type)>=0&&s)){var re=A(!1);re?i=setTimeout(function(){v.state.isVisible&&v.hide()},re):o=requestAnimationFrame(function(){v.hide()})}}function lt(){v.state.isEnabled=!0}function Kt(){v.hide(),v.state.isEnabled=!1}function V(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(o)}function O(R){if(!v.state.isDestroyed){_("onBeforeUpdate",[v,R]),Te();var re=v.props,he=Fm(t,Object.assign({},re,Pm(R),{ignoreAttributes:!0}));v.props=he,Ie(),re.interactiveDebounce!==he.interactiveDebounce&&(G(),m=Dm(We,he.interactiveDebounce)),re.triggerTarget&&!he.triggerTarget?Di(re.triggerTarget).forEach(function(Ae){Ae.removeAttribute("aria-expanded")}):he.triggerTarget&&t.removeAttribute("aria-expanded"),j(),T(),S&&S(re,he),v.popperInstance&&(X(),le().forEach(function(Ae){requestAnimationFrame(Ae._tippy.popperInstance.forceUpdate)})),_("onAfterUpdate",[v,R])}}function B(R){v.setProps({content:R})}function q(){var R=v.state.isVisible,re=v.state.isDestroyed,he=!v.state.isEnabled,Ae=xn.isTouch&&!v.props.touch,Ee=Au(v.props.duration,0,an.duration);if(!(R||re||he||Ae)&&!z().hasAttribute("disabled")&&(_("onShow",[v],!1),v.props.onShow(v)!==!1)){if(v.state.isVisible=!0,$()&&(C.style.visibility="visible"),T(),J(),v.state.isMounted||(C.style.transition="none"),$()){var kt=K(),Gt=kt.box,wi=kt.content;Mu([Gt,wi],0)}f=function(){var Fr;if(!(!v.state.isVisible||c)){if(c=!0,C.offsetHeight,C.style.transition=v.props.moveTransition,$()&&v.props.animation){var cu=K(),ia=cu.box,Ei=cu.content;Mu([ia,Ei],Ee),Bm([ia,Ei],"visible")}I(),j(),Lm(Ru,v),(Fr=v.popperInstance)==null||Fr.forceUpdate(),_("onMount",[v]),v.props.animation&&$()&&Me(Ee,function(){v.state.isShown=!0,_("onShown",[v])})}},_e()}}function de(){var R=!v.state.isVisible,re=v.state.isDestroyed,he=!v.state.isEnabled,Ae=Au(v.props.duration,1,an.duration);if(!(R||re||he)&&(_("onHide",[v],!1),v.props.onHide(v)!==!1)){if(v.state.isVisible=!1,v.state.isShown=!1,c=!1,s=!1,$()&&(C.style.visibility="hidden"),G(),me(),T(!0),$()){var Ee=K(),kt=Ee.box,Gt=Ee.content;v.props.animation&&(Mu([kt,Gt],Ae),Bm([kt,Gt],"hidden"))}I(),j(),v.props.animation?$()&&pe(Ae,v.unmount):v.unmount()}}function Oe(R){L().addEventListener("mousemove",m),Lm(ma,m),m(R)}function Pt(){v.state.isVisible&&v.hide(),v.state.isMounted&&(ne(),le().forEach(function(R){R._tippy.unmount()}),C.parentNode&&C.parentNode.removeChild(C),Ru=Ru.filter(function(R){return R!==v}),v.state.isMounted=!1,_("onHidden",[v]))}function Oo(){v.state.isDestroyed||(v.clearDelayTimeouts(),v.unmount(),Te(),delete t._tippy,v.state.isDestroyed=!0,_("onDestroy",[v]))}}function Pr(t,e){e===void 0&&(e={});var n=an.plugins.concat(e.plugins||[]);NA();var r=Object.assign({},e,{plugins:n}),i=EA(t),o=i.reduce(function(s,a){var l=a&&BA(a,r);return l&&s.push(l),s},[]);return Oc(t)?o[0]:o}Pr.defaultProps=an;Pr.setDefaultProps=IA;Pr.currentInput=xn;Object.assign({},V0,{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 pi={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 o(c){return e.props.sticky===!0||e.props.sticky===c}var s=null,a=null;function l(){var c=o("reference")?i().getBoundingClientRect():null,u=o("popper")?r.getBoundingClientRect():null;(c&&Um(s,c)||u&&Um(a,u))&&e.popperInstance&&e.popperInstance.update(),s=c,a=u,e.state.isMounted&&requestAnimationFrame(l)}return{onMount:function(){e.props.sticky&&l()}}}};function Um(t,e){return t&&e?t.top!==e.top||t.right!==e.right||t.bottom!==e.bottom||t.left!==e.left:!0}Pr.setDefaultProps({render:ov});class $A{constructor({editor:e,element:n,view:r,tippyOptions:i={},updateDelay:o=250,shouldShow:s}){this.preventHide=!1,this.shouldShow=({view:a,state:l,from:c,to:u})=>{const{doc:d,selection:f}=l,{empty:h}=f,m=!d.textBetween(c,u).length&&Nc(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!=null&&a.relatedTarget&&(!((l=this.element.parentNode)===null||l===void 0)&&l.contains(a.relatedTarget))||(a==null?void 0:a.relatedTarget)!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=a=>{this.blurHandler({event:a})},this.handleDebouncedUpdate=(a,l)=>{const c=!(l!=null&&l.selection.eq(a.state.selection)),u=!(l!=null&&l.doc.eq(a.state.doc));!c&&!u||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(a,c,u,l)},this.updateDelay))},this.updateHandler=(a,l,c,u)=>{var d,f,h;const{state:m,composing:g}=a,{selection:y}=m;if(g||!l&&!c)return;this.createTooltip();const{ranges:w}=y,E=Math.min(...w.map(C=>C.$from.pos)),v=Math.max(...w.map(C=>C.$to.pos));if(!((d=this.shouldShow)===null||d===void 0?void 0:d.call(this,{editor:this.editor,element:this.element,view:a,state:m,oldState:u,from:E,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(F0(m.selection)){let C=a.nodeDOM(E);if(C){const S=C.dataset.nodeViewWrapper?C:C.querySelector("[data-node-view-wrapper]");if(S&&(C=S.firstChild),C)return C.getBoundingClientRect()}}return TN(a,E,v)})}),this.show()},this.editor=e,this.element=n,this.view=r,this.updateDelay=o,s&&(this.shouldShow=s),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=Pr(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 o=!(n!=null&&n.selection.eq(e.state.selection)),s=!(n!=null&&n.doc.eq(e.state.doc));this.updateHandler(e,o,s,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 sv=t=>new $e({key:typeof t.pluginKey=="string"?new Pe(t.pluginKey):t.pluginKey,view:e=>new $A({view:e,...t})});Ve.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[sv({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});function jA(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var av={exports:{}},Iu={};/**
90
- * @license React
91
- * use-sync-external-store-shim.production.min.js
92
- *
93
- * Copyright (c) Facebook, Inc. and its affiliates.
94
- *
95
- * This source code is licensed under the MIT license found in the
96
- * LICENSE file in the root directory of this source tree.
97
- */var Vm;function FA(){if(Vm)return Iu;Vm=1;var t=fe;function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function a(d,f){var h=f(),m=r({inst:{value:h,getSnapshot:f}}),g=m[0].inst,y=m[1];return o(function(){g.value=h,g.getSnapshot=f,l(g)&&y({inst:g})},[d,h,f]),i(function(){return l(g)&&y({inst:g}),d(function(){l(g)&&y({inst:g})})},[d]),s(h),h}function l(d){var f=d.getSnapshot;d=d.value;try{var h=f();return!n(d,h)}catch{return!0}}function c(d,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return Iu.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,Iu}av.exports=FA();var sh=av.exports;const HA=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},zA=({contentComponent:t})=>{const e=sh.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return fe.createElement(fe.Fragment,null,Object.values(e))};function UA(){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]:Qy.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 VA extends fe.Component{constructor(e){var n;super(e),this.editorContentRef=fe.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=UA(),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 fe.createElement(fe.Fragment,null,fe.createElement("div",{ref:HA(n,this.editorContentRef),...r}),(e==null?void 0:e.contentComponent)&&fe.createElement(zA,{contentComponent:e.contentComponent}))}}const WA=x.forwardRef((t,e)=>{const n=fe.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return fe.createElement(VA,{key:n,innerRef:e,...t})}),KA=fe.memo(WA);var GA=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,o;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(o=Object.keys(e),r=o.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=r;i--!==0;){var s=o[i];if(!(s==="_owner"&&e.$$typeof)&&!t(e[s],n[s]))return!1}return!0}return e!==e&&n!==n},qA=jA(GA),lv={exports:{}},Du={};/**
98
- * @license React
99
- * use-sync-external-store-shim/with-selector.production.min.js
100
- *
101
- * Copyright (c) Facebook, Inc. and its affiliates.
102
- *
103
- * This source code is licensed under the MIT license found in the
104
- * LICENSE file in the root directory of this source tree.
105
- */var Wm;function YA(){if(Wm)return Du;Wm=1;var t=fe,e=sh;function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,o=t.useRef,s=t.useEffect,a=t.useMemo,l=t.useDebugValue;return Du.useSyncExternalStoreWithSelector=function(c,u,d,f,h){var m=o(null);if(m.current===null){var g={hasValue:!1,value:null};m.current=g}else g=m.current;m=a(function(){function b(C){if(!w){if(w=!0,E=C,C=f(C),h!==void 0&&g.hasValue){var S=g.value;if(h(S,C))return v=S}return v=C}if(S=v,r(E,C))return S;var N=f(C);return h!==void 0&&h(S,N)?S:(E=C,v=N)}var w=!1,E,v,k=d===void 0?null:d;return[function(){return b(u())},k===null?void 0:function(){return b(k())}]},[u,d,f,h]);var y=i(c,m[0],m[1]);return s(function(){g.hasValue=!0,g.value=y},[y]),l(y),y},Du}lv.exports=YA();var JA=lv.exports;const XA=typeof window<"u"?x.useLayoutEffect:x.useEffect;class ZA{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 In(t){var e;const[n]=x.useState(()=>new ZA(t.editor)),r=JA.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!==null&&e!==void 0?e:qA);return XA(()=>n.watch(t.editor),[t.editor,n]),x.useDebugValue(r),r}const QA=!1,Gd=typeof window>"u",eM=Gd||!!(typeof window<"u"&&window.next);class ah{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?Gd||eM?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var i,o;return(o=(i=this.options.current).onBeforeCreate)===null||o===void 0?void 0:o.call(i,...r)},onBlur:(...r)=>{var i,o;return(o=(i=this.options.current).onBlur)===null||o===void 0?void 0:o.call(i,...r)},onCreate:(...r)=>{var i,o;return(o=(i=this.options.current).onCreate)===null||o===void 0?void 0:o.call(i,...r)},onDestroy:(...r)=>{var i,o;return(o=(i=this.options.current).onDestroy)===null||o===void 0?void 0:o.call(i,...r)},onFocus:(...r)=>{var i,o;return(o=(i=this.options.current).onFocus)===null||o===void 0?void 0:o.call(i,...r)},onSelectionUpdate:(...r)=>{var i,o;return(o=(i=this.options.current).onSelectionUpdate)===null||o===void 0?void 0:o.call(i,...r)},onTransaction:(...r)=>{var i,o;return(o=(i=this.options.current).onTransaction)===null||o===void 0?void 0:o.call(i,...r)},onUpdate:(...r)=>{var i,o;return(o=(i=this.options.current).onUpdate)===null||o===void 0?void 0:o.call(i,...r)},onContentError:(...r)=>{var i,o;return(o=(i=this.options.current).onContentError)===null||o===void 0?void 0:o.call(i,...r)},onDrop:(...r)=>{var i,o;return(o=(i=this.options.current).onDrop)===null||o===void 0?void 0:o.call(i,...r)},onPaste:(...r)=>{var i,o;return(o=(i=this.options.current).onPaste)===null||o===void 0?void 0:o.call(i,...r)}};return new oT(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,o)=>{var s;return i===((s=n.extensions)===null||s===void 0?void 0:s[o])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?ah.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 tM(t={},e=[]){const n=x.useRef(t);n.current=t;const[r]=x.useState(()=>new ah(n)),i=sh.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return x.useDebugValue(i),x.useEffect(r.onRender(e)),In({editor:i,selector:({transactionNumber:o})=>t.shouldRerenderOnTransaction===!1?null:t.immediatelyRender&&o===0?0:o+1}),i}const cv=x.createContext({editor:null});cv.Consumer;const nM=()=>x.useContext(cv),nr=t=>{const[e,n]=x.useState(null),{editor:r}=nM();return x.useEffect(()=>{var i;if(!e||!((i=t.editor)===null||i===void 0)&&i.isDestroyed||r!=null&&r.isDestroyed)return;const{pluginKey:o="bubbleMenu",editor:s,tippyOptions:a={},updateDelay:l,shouldShow:c=null}=t,u=s||r;if(!u){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const d=sv({updateDelay:l,editor:u,element:e,pluginKey:o,shouldShow:c,tippyOptions:a});return u.registerPlugin(d),()=>{u.unregisterPlugin(o)}},[t.editor,r,e]),fe.createElement("div",{ref:n,className:t.className,style:{visibility:"hidden"}},t.children)},uv=x.createContext({onDragStart:void 0}),dv=()=>x.useContext(uv),fv=t=>{const e=t.as||"div",{nodeViewContentRef:n}=dv();return fe.createElement(e,{...t,ref:n,"data-node-view-content":"",style:{whiteSpace:"pre-wrap",...t.style}})},mi=fe.forwardRef((t,e)=>{const{onDragStart:n}=dv(),r=t.as||"div";return fe.createElement(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function Km(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function Gm(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function rM(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function iM(t){if(Km(t)||Gm(t))return!0;if(rM(t)){const e=t.type;if(e)return Km(e)||Gm(e)}return!1}function oM(){try{if(x.version)return parseInt(x.version.split(".")[0],10)>=19}catch{}return!1}class lh{constructor(e,{editor:n,props:r={},as:i="div",className:o=""}){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"),o&&this.element.classList.add(...o.split(" ")),this.editor.isInitialized?Tf.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.render()})}render(){var e;const n=this.component,r=this.props,i=this.editor,o=oM(),s=iM(n),a={...r};a.ref&&!(o||s)&&delete a.ref,!a.ref&&(o||s)&&(a.ref=l=>{this.ref=l}),this.reactElement=fe.createElement(n,{...a}),(e=i==null?void 0: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==null?void 0:n.contentComponent)===null||e===void 0||e.removeRenderer(this.id)}updateAttributes(e){Object.keys(e).forEach(n=>{this.element.setAttribute(n,e[n])})}}class sM extends sT{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=u=>u.charAt(0).toUpperCase()+u.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))}},o=this.component,s=x.memo(c=>fe.createElement(uv.Provider,{value:i},x.createElement(o,c)));s.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 lh(s,{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=o=>{this.renderer.updateProps(o),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const o=this.node,s=this.decorations,a=this.innerDecorations;return this.node=e,this.decorations=n,this.innerDecorations=r,this.options.update({oldNode:o,oldDecorations:s,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=gl(this.node,n);e=this.options.attrs({node:this.node,HTMLAttributes:r})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}}function gi(t,e){return n=>n.editor.contentComponent?new sM(t,n,e):{}}const ct=[];for(let t=0;t<256;++t)ct.push((t+256).toString(16).slice(1));function aM(t,e=0){return(ct[t[e+0]]+ct[t[e+1]]+ct[t[e+2]]+ct[t[e+3]]+"-"+ct[t[e+4]]+ct[t[e+5]]+"-"+ct[t[e+6]]+ct[t[e+7]]+"-"+ct[t[e+8]]+ct[t[e+9]]+"-"+ct[t[e+10]]+ct[t[e+11]]+ct[t[e+12]]+ct[t[e+13]]+ct[t[e+14]]+ct[t[e+15]]).toLowerCase()}let Lu;const lM=new Uint8Array(16);function cM(){if(!Lu){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Lu=crypto.getRandomValues.bind(crypto)}return Lu(lM)}const uM=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),qm={randomUUID:uM};function ws(t,e,n){var i;if(qm.randomUUID&&!t)return qm.randomUUID();t=t||{};const r=t.random??((i=t.rng)==null?void 0:i.call(t))??cM();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,aM(r)}var dM=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,o;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(o=Object.keys(e),r=o.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=r;i--!==0;){var s=o[i];if(!t(e[s],n[s]))return!1}return!0}return e!==e&&n!==n};const Br=eb(dM);function hv(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=hv(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function fM(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=hv(t))&&(r&&(r+=" "),r+=e);return r}function At(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function Ym(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function ch(...t){return e=>{let n=!1;const r=t.map(i=>{const o=Ym(i,e);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i<r.length;i++){const o=r[i];typeof o=="function"?o():Ym(t[i],null)}}}}function Dn(...t){return x.useCallback(ch(...t),t)}function uh(t,e=[]){let n=[];function r(o,s){const a=x.createContext(s),l=n.length;n=[...n,s];const c=d=>{var b;const{scope:f,children:h,...m}=d,g=((b=f==null?void 0:f[t])==null?void 0:b[l])||a,y=x.useMemo(()=>m,Object.values(m));return p.jsx(g.Provider,{value:y,children:h})};c.displayName=o+"Provider";function u(d,f){var g;const h=((g=f==null?void 0:f[t])==null?void 0:g[l])||a,m=x.useContext(h);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${o}\``)}return[c,u]}const i=()=>{const o=n.map(s=>x.createContext(s));return function(a){const l=(a==null?void 0:a[t])||o;return x.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[r,hM(i,...e)]}function hM(...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(o){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(o)[`__scope${c}`];return{...a,...d}},{});return x.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}function pv(t){const e=pM(t),n=x.forwardRef((r,i)=>{const{children:o,...s}=r,a=x.Children.toArray(o),l=a.find(gM);if(l){const c=l.props.children,u=a.map(d=>d===l?x.Children.count(c)>1?x.Children.only(null):x.isValidElement(c)?c.props.children:null:d);return p.jsx(e,{...s,ref:i,children:x.isValidElement(c)?x.cloneElement(c,void 0,u):null})}return p.jsx(e,{...s,ref:i,children:o})});return n.displayName=`${t}.Slot`,n}function pM(t){const e=x.forwardRef((n,r)=>{const{children:i,...o}=n;if(x.isValidElement(i)){const s=bM(i),a=yM(o,i.props);return i.type!==x.Fragment&&(a.ref=r?ch(r,s):s),x.cloneElement(i,a)}return x.Children.count(i)>1?x.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var mv=Symbol("radix.slottable");function mM(t){const e=({children:n})=>p.jsx(p.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=mv,e}function gM(t){return x.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===mv}function yM(t,e){const n={...e};for(const r in e){const i=t[r],o=e[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...t,...n}}function bM(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var vM=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],pn=vM.reduce((t,e)=>{const n=pv(`Primitive.${e}`),r=x.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function xM(t,e){t&&Tf.flushSync(()=>t.dispatchEvent(e))}function oo(t){const e=x.useRef(t);return x.useEffect(()=>{e.current=t}),x.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function wM(t,e=globalThis==null?void 0:globalThis.document){const n=oo(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 EM="DismissableLayer",qd="dismissableLayer.update",kM="dismissableLayer.pointerDownOutside",CM="dismissableLayer.focusOutside",Jm,gv=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),dh=x.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:s,onDismiss:a,...l}=t,c=x.useContext(gv),[u,d]=x.useState(null),f=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=x.useState({}),m=Dn(e,S=>d(S)),g=Array.from(c.layers),[y]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),b=g.indexOf(y),w=u?g.indexOf(u):-1,E=c.layersWithOutsidePointerEventsDisabled.size>0,v=w>=b,k=NM(S=>{const N=S.target,M=[...c.branches].some(D=>D.contains(N));!v||M||(i==null||i(S),s==null||s(S),S.defaultPrevented||a==null||a())},f),C=TM(S=>{const N=S.target;[...c.branches].some(D=>D.contains(N))||(o==null||o(S),s==null||s(S),S.defaultPrevented||a==null||a())},f);return wM(S=>{w===c.layers.size-1&&(r==null||r(S),!S.defaultPrevented&&a&&(S.preventDefault(),a()))},f),x.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(Jm=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),Xm(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Jm)}},[u,f,n,c]),x.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),Xm())},[u,c]),x.useEffect(()=>{const S=()=>h({});return document.addEventListener(qd,S),()=>document.removeEventListener(qd,S)},[]),p.jsx(pn.div,{...l,ref:m,style:{pointerEvents:E?v?"auto":"none":void 0,...t.style},onFocusCapture:At(t.onFocusCapture,C.onFocusCapture),onBlurCapture:At(t.onBlurCapture,C.onBlurCapture),onPointerDownCapture:At(t.onPointerDownCapture,k.onPointerDownCapture)})});dh.displayName=EM;var SM="DismissableLayerBranch",_M=x.forwardRef((t,e)=>{const n=x.useContext(gv),r=x.useRef(null),i=Dn(e,r);return x.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),p.jsx(pn.div,{...t,ref:i})});_M.displayName=SM;function NM(t,e=globalThis==null?void 0:globalThis.document){const n=oo(t),r=x.useRef(!1),i=x.useRef(()=>{});return x.useEffect(()=>{const o=a=>{if(a.target&&!r.current){let l=function(){yv(kM,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},s=window.setTimeout(()=>{e.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(s),e.removeEventListener("pointerdown",o),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function TM(t,e=globalThis==null?void 0:globalThis.document){const n=oo(t),r=x.useRef(!1);return x.useEffect(()=>{const i=o=>{o.target&&!r.current&&yv(CM,n,{originalEvent:o},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Xm(){const t=new CustomEvent(qd);document.dispatchEvent(t)}function yv(t,e,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?xM(i,o):i.dispatchEvent(o)}var Nr=globalThis!=null&&globalThis.document?x.useLayoutEffect:()=>{},AM=Af[" useId ".trim().toString()]||(()=>{}),MM=0;function bv(t){const[e,n]=x.useState(AM());return Nr(()=>{n(r=>r??String(MM++))},[t]),t||(e?`radix-${e}`:"")}const OM=["top","right","bottom","left"],Tr=Math.min,$t=Math.max,xl=Math.round,ga=Math.floor,Nn=t=>({x:t,y:t}),RM={left:"right",right:"left",bottom:"top",top:"bottom"};function Yd(t,e,n){return $t(t,Tr(e,n))}function Jn(t,e){return typeof t=="function"?t(e):t}function Xn(t){return t.split("-")[0]}function xo(t){return t.split("-")[1]}function fh(t){return t==="x"?"y":"x"}function hh(t){return t==="y"?"height":"width"}function Cn(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function ph(t){return fh(Cn(t))}function IM(t,e,n){n===void 0&&(n=!1);const r=xo(t),i=ph(t),o=hh(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=wl(s)),[s,wl(s)]}function DM(t){const e=wl(t);return[Jd(t),e,Jd(e)]}function Jd(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const Zm=["left","right"],Qm=["right","left"],LM=["top","bottom"],PM=["bottom","top"];function BM(t,e,n){switch(t){case"top":case"bottom":return n?e?Qm:Zm:e?Zm:Qm;case"left":case"right":return e?LM:PM;default:return[]}}function $M(t,e,n,r){const i=xo(t);let o=BM(Xn(t),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),e&&(o=o.concat(o.map(Jd)))),o}function wl(t){const e=Xn(t);return RM[e]+t.slice(e.length)}function jM(t){return{top:0,right:0,bottom:0,left:0,...t}}function vv(t){return typeof t!="number"?jM(t):{top:t,right:t,bottom:t,left:t}}function El(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 eg(t,e,n){let{reference:r,floating:i}=t;const o=Cn(e),s=ph(e),a=hh(s),l=Xn(e),c=o==="y",u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[a]/2-i[a]/2;let h;switch(l){case"top":h={x:u,y:r.y-i.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-i.width,y:d};break;default:h={x:r.x,y:r.y}}switch(xo(e)){case"start":h[s]-=f*(n&&c?-1:1);break;case"end":h[s]+=f*(n&&c?-1:1);break}return h}async function FM(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=Jn(e,t),m=vv(h),y=a[f?d==="floating"?"reference":"floating":d],b=El(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(y)))==null||n?y:y.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),w=d==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,E=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),v=await(o.isElement==null?void 0:o.isElement(E))?await(o.getScale==null?void 0:o.getScale(E))||{x:1,y:1}:{x:1,y:1},k=El(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:E,strategy:l}):w);return{top:(b.top-k.top+m.top)/v.y,bottom:(k.bottom-b.bottom+m.bottom)/v.y,left:(b.left-k.left+m.left)/v.x,right:(k.right-b.right+m.right)/v.x}}const HM=50,zM=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=s.detectOverflow?s:{...s,detectOverflow:FM},l=await(s.isRTL==null?void 0:s.isRTL(e));let c=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:d}=eg(c,r,l),f=r,h=0;const m={};for(let g=0;g<o.length;g++){const y=o[g];if(!y)continue;const{name:b,fn:w}=y,{x:E,y:v,data:k,reset:C}=await w({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:c,platform:a,elements:{reference:t,floating:e}});u=E??u,d=v??d,m[b]={...m[b],...k},C&&h<HM&&(h++,typeof C=="object"&&(C.placement&&(f=C.placement),C.rects&&(c=C.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:i}):C.rects),{x:u,y:d}=eg(c,f,l)),g=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},UM=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=Jn(t,e)||{};if(c==null)return{};const d=vv(u),f={x:n,y:r},h=ph(i),m=hh(h),g=await s.getDimensions(c),y=h==="y",b=y?"top":"left",w=y?"bottom":"right",E=y?"clientHeight":"clientWidth",v=o.reference[m]+o.reference[h]-f[h]-o.floating[m],k=f[h]-o.reference[h],C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let S=C?C[E]:0;(!S||!await(s.isElement==null?void 0:s.isElement(C)))&&(S=a.floating[E]||o.floating[m]);const N=v/2-k/2,M=S/2-g[m]/2-1,D=Tr(d[b],M),H=Tr(d[w],M),$=D,z=S-g[m]-H,L=S/2-g[m]/2+N,K=Yd($,L,z),A=!l.arrow&&xo(i)!=null&&L!==K&&o.reference[m]/2-(L<$?D:H)-g[m]/2<0,T=A?L<$?L-$:L-z:0;return{[h]:f[h]+T,data:{[h]:K,centerOffset:L-K-T,...A&&{alignmentOffset:T}},reset:A}}}),VM=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...y}=Jn(t,e);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const b=Xn(i),w=Cn(a),E=Xn(a)===a,v=await(l.isRTL==null?void 0:l.isRTL(c.floating)),k=f||(E||!g?[wl(a)]:DM(a)),C=m!=="none";!f&&C&&k.push(...$M(a,g,m,v));const S=[a,...k],N=await l.detectOverflow(e,y),M=[];let D=((r=o.flip)==null?void 0:r.overflows)||[];if(u&&M.push(N[b]),d){const L=IM(i,s,v);M.push(N[L[0]],N[L[1]])}if(D=[...D,{placement:i,overflows:M}],!M.every(L=>L<=0)){var H,$;const L=(((H=o.flip)==null?void 0:H.index)||0)+1,K=S[L];if(K&&(!(d==="alignment"?w!==Cn(K):!1)||D.every(_=>Cn(_.placement)===w?_.overflows[0]>0:!0)))return{data:{index:L,overflows:D},reset:{placement:K}};let A=($=D.filter(T=>T.overflows[0]<=0).sort((T,_)=>T.overflows[1]-_.overflows[1])[0])==null?void 0:$.placement;if(!A)switch(h){case"bestFit":{var z;const T=(z=D.filter(_=>{if(C){const I=Cn(_.placement);return I===w||I==="y"}return!0}).map(_=>[_.placement,_.overflows.filter(I=>I>0).reduce((I,j)=>I+j,0)]).sort((_,I)=>_[1]-I[1])[0])==null?void 0:z[0];T&&(A=T);break}case"initialPlacement":A=a;break}if(i!==A)return{reset:{placement:A}}}return{}}}};function tg(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function ng(t){return OM.some(e=>t[e]>=0)}const WM=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:i="referenceHidden",...o}=Jn(t,e);switch(i){case"referenceHidden":{const s=await r.detectOverflow(e,{...o,elementContext:"reference"}),a=tg(s,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:ng(a)}}}case"escaped":{const s=await r.detectOverflow(e,{...o,altBoundary:!0}),a=tg(s,n.floating);return{data:{escapedOffsets:a,escaped:ng(a)}}}default:return{}}}}},xv=new Set(["left","top"]);async function KM(t,e){const{placement:n,platform:r,elements:i}=t,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=Xn(n),a=xo(n),l=Cn(n)==="y",c=xv.has(s)?-1:1,u=o&&l?-1:1,d=Jn(e,t);let{mainAxis:f,crossAxis:h,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof m=="number"&&(h=a==="end"?m*-1:m),l?{x:h*u,y:f*c}:{x:f*c,y:h*u}}const GM=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:o,placement:s,middlewareData:a}=e,l=await KM(e,t);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},qM=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i,platform:o}=e,{mainAxis:s=!0,crossAxis:a=!1,limiter:l={fn:b=>{let{x:w,y:E}=b;return{x:w,y:E}}},...c}=Jn(t,e),u={x:n,y:r},d=await o.detectOverflow(e,c),f=Cn(Xn(i)),h=fh(f);let m=u[h],g=u[f];if(s){const b=h==="y"?"top":"left",w=h==="y"?"bottom":"right",E=m+d[b],v=m-d[w];m=Yd(E,m,v)}if(a){const b=f==="y"?"top":"left",w=f==="y"?"bottom":"right",E=g+d[b],v=g-d[w];g=Yd(E,g,v)}const y=l.fn({...e,[h]:m,[f]:g});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[h]:s,[f]:a}}}}}},YM=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:o,middlewareData:s}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=Jn(t,e),u={x:n,y:r},d=Cn(i),f=fh(d);let h=u[f],m=u[d];const g=Jn(a,e),y=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){const E=f==="y"?"height":"width",v=o.reference[f]-o.floating[E]+y.mainAxis,k=o.reference[f]+o.reference[E]-y.mainAxis;h<v?h=v:h>k&&(h=k)}if(c){var b,w;const E=f==="y"?"width":"height",v=xv.has(Xn(i)),k=o.reference[d]-o.floating[E]+(v&&((b=s.offset)==null?void 0:b[d])||0)+(v?0:y.crossAxis),C=o.reference[d]+o.reference[E]+(v?0:((w=s.offset)==null?void 0:w[d])||0)-(v?y.crossAxis:0);m<k?m=k:m>C&&(m=C)}return{[f]:h,[d]:m}}}},JM=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:o,platform:s,elements:a}=e,{apply:l=()=>{},...c}=Jn(t,e),u=await s.detectOverflow(e,c),d=Xn(i),f=xo(i),h=Cn(i)==="y",{width:m,height:g}=o.floating;let y,b;d==="top"||d==="bottom"?(y=d,b=f===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(b=d,y=f==="end"?"top":"bottom");const w=g-u.top-u.bottom,E=m-u.left-u.right,v=Tr(g-u[y],w),k=Tr(m-u[b],E),C=!e.middlewareData.shift;let S=v,N=k;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(N=E),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(S=w),C&&!f){const D=$t(u.left,0),H=$t(u.right,0),$=$t(u.top,0),z=$t(u.bottom,0);h?N=m-2*(D!==0||H!==0?D+H:$t(u.left,u.right)):S=g-2*($!==0||z!==0?$+z:$t(u.top,u.bottom))}await l({...e,availableWidth:N,availableHeight:S});const M=await s.getDimensions(a.floating);return m!==M.width||g!==M.height?{reset:{rects:!0}}:{}}}};function Rc(){return typeof window<"u"}function wo(t){return wv(t)?(t.nodeName||"").toLowerCase():"#document"}function zt(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Ln(t){var e;return(e=(wv(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function wv(t){return Rc()?t instanceof Node||t instanceof zt(t).Node:!1}function fn(t){return Rc()?t instanceof Element||t instanceof zt(t).Element:!1}function rr(t){return Rc()?t instanceof HTMLElement||t instanceof zt(t).HTMLElement:!1}function rg(t){return!Rc()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof zt(t).ShadowRoot}function Xs(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 XM(t){return/^(table|td|th)$/.test(wo(t))}function Ic(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const ZM=/transform|translate|scale|rotate|perspective|filter/,QM=/paint|layout|strict|content/,Hr=t=>!!t&&t!=="none";let Pu;function mh(t){const e=fn(t)?hn(t):t;return Hr(e.transform)||Hr(e.translate)||Hr(e.scale)||Hr(e.rotate)||Hr(e.perspective)||!gh()&&(Hr(e.backdropFilter)||Hr(e.filter))||ZM.test(e.willChange||"")||QM.test(e.contain||"")}function eO(t){let e=Ar(t);for(;rr(e)&&!so(e);){if(mh(e))return e;if(Ic(e))return null;e=Ar(e)}return null}function gh(){return Pu==null&&(Pu=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Pu}function so(t){return/^(html|body|#document)$/.test(wo(t))}function hn(t){return zt(t).getComputedStyle(t)}function Dc(t){return fn(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Ar(t){if(wo(t)==="html")return t;const e=t.assignedSlot||t.parentNode||rg(t)&&t.host||Ln(t);return rg(e)?e.host:e}function Ev(t){const e=Ar(t);return so(e)?t.ownerDocument?t.ownerDocument.body:t.body:rr(e)&&Xs(e)?e:Ev(e)}function Es(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=Ev(t),o=i===((r=t.ownerDocument)==null?void 0:r.body),s=zt(i);if(o){const a=Xd(s);return e.concat(s,s.visualViewport||[],Xs(i)?i:[],a&&n?Es(a):[])}else return e.concat(i,Es(i,[],n))}function Xd(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function kv(t){const e=hn(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=rr(t),o=i?t.offsetWidth:n,s=i?t.offsetHeight:r,a=xl(n)!==o||xl(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function yh(t){return fn(t)?t:t.contextElement}function Ui(t){const e=yh(t);if(!rr(e))return Nn(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:o}=kv(e);let s=(o?xl(n.width):n.width)/r,a=(o?xl(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const tO=Nn(0);function Cv(t){const e=zt(t);return!gh()||!e.visualViewport?tO:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function nO(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==zt(t)?!1:e}function fi(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),o=yh(t);let s=Nn(1);e&&(r?fn(r)&&(s=Ui(r)):s=Ui(t));const a=nO(o,n,r)?Cv(o):Nn(0);let l=(i.left+a.x)/s.x,c=(i.top+a.y)/s.y,u=i.width/s.x,d=i.height/s.y;if(o){const f=zt(o),h=r&&fn(r)?zt(r):r;let m=f,g=Xd(m);for(;g&&r&&h!==m;){const y=Ui(g),b=g.getBoundingClientRect(),w=hn(g),E=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,u*=y.x,d*=y.y,l+=E,c+=v,m=zt(g),g=Xd(m)}}return El({width:u,height:d,x:l,y:c})}function Lc(t,e){const n=Dc(t).scrollLeft;return e?e.left+n:fi(Ln(t)).left+n}function Sv(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-Lc(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function rO(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const o=i==="fixed",s=Ln(r),a=e?Ic(e.floating):!1;if(r===s||a&&o)return n;let l={scrollLeft:0,scrollTop:0},c=Nn(1);const u=Nn(0),d=rr(r);if((d||!d&&!o)&&((wo(r)!=="body"||Xs(s))&&(l=Dc(r)),d)){const h=fi(r);c=Ui(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}const f=s&&!d&&!o?Sv(s,l):Nn(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-l.scrollTop*c.y+u.y+f.y}}function iO(t){return Array.from(t.getClientRects())}function oO(t){const e=Ln(t),n=Dc(t),r=t.ownerDocument.body,i=$t(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=$t(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Lc(t);const a=-n.scrollTop;return hn(r).direction==="rtl"&&(s+=$t(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}const ig=25;function sO(t,e){const n=zt(t),r=Ln(t),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;const u=gh();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const c=Lc(r);if(c<=0){const u=r.ownerDocument,d=u.body,f=getComputedStyle(d),h=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,m=Math.abs(r.clientWidth-d.clientWidth-h);m<=ig&&(o-=m)}else c<=ig&&(o+=c);return{width:o,height:s,x:a,y:l}}function aO(t,e){const n=fi(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,o=rr(t)?Ui(t):Nn(1),s=t.clientWidth*o.x,a=t.clientHeight*o.y,l=i*o.x,c=r*o.y;return{width:s,height:a,x:l,y:c}}function og(t,e,n){let r;if(e==="viewport")r=sO(t,n);else if(e==="document")r=oO(Ln(t));else if(fn(e))r=aO(e,n);else{const i=Cv(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return El(r)}function _v(t,e){const n=Ar(t);return n===e||!fn(n)||so(n)?!1:hn(n).position==="fixed"||_v(n,e)}function lO(t,e){const n=e.get(t);if(n)return n;let r=Es(t,[],!1).filter(a=>fn(a)&&wo(a)!=="body"),i=null;const o=hn(t).position==="fixed";let s=o?Ar(t):t;for(;fn(s)&&!so(s);){const a=hn(s),l=mh(s);!l&&a.position==="fixed"&&(i=null),(o?!l&&!i:!l&&a.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||Xs(s)&&!l&&_v(t,s))?r=r.filter(u=>u!==s):i=a,s=Ar(s)}return e.set(t,r),r}function cO(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const s=[...n==="clippingAncestors"?Ic(e)?[]:lO(e,this._c):[].concat(n),r],a=og(e,s[0],i);let l=a.top,c=a.right,u=a.bottom,d=a.left;for(let f=1;f<s.length;f++){const h=og(e,s[f],i);l=$t(h.top,l),c=Tr(h.right,c),u=Tr(h.bottom,u),d=$t(h.left,d)}return{width:c-d,height:u-l,x:d,y:l}}function uO(t){const{width:e,height:n}=kv(t);return{width:e,height:n}}function dO(t,e,n){const r=rr(e),i=Ln(e),o=n==="fixed",s=fi(t,!0,o,e);let a={scrollLeft:0,scrollTop:0};const l=Nn(0);function c(){l.x=Lc(i)}if(r||!r&&!o)if((wo(e)!=="body"||Xs(i))&&(a=Dc(e)),r){const h=fi(e,!0,o,e);l.x=h.x+e.clientLeft,l.y=h.y+e.clientTop}else i&&c();o&&!r&&i&&c();const u=i&&!r&&!o?Sv(i,a):Nn(0),d=s.left+a.scrollLeft-l.x-u.x,f=s.top+a.scrollTop-l.y-u.y;return{x:d,y:f,width:s.width,height:s.height}}function Bu(t){return hn(t).position==="static"}function sg(t,e){if(!rr(t)||hn(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Ln(t)===n&&(n=n.ownerDocument.body),n}function Nv(t,e){const n=zt(t);if(Ic(t))return n;if(!rr(t)){let i=Ar(t);for(;i&&!so(i);){if(fn(i)&&!Bu(i))return i;i=Ar(i)}return n}let r=sg(t,e);for(;r&&XM(r)&&Bu(r);)r=sg(r,e);return r&&so(r)&&Bu(r)&&!mh(r)?n:r||eO(t)||n}const fO=async function(t){const e=this.getOffsetParent||Nv,n=this.getDimensions,r=await n(t.floating);return{reference:dO(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function hO(t){return hn(t).direction==="rtl"}const pO={convertOffsetParentRelativeRectToViewportRelativeRect:rO,getDocumentElement:Ln,getClippingRect:cO,getOffsetParent:Nv,getElementRects:fO,getClientRects:iO,getDimensions:uO,getScale:Ui,isElement:fn,isRTL:hO};function Tv(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function mO(t,e){let n=null,r;const i=Ln(t);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const c=t.getBoundingClientRect(),{left:u,top:d,width:f,height:h}=c;if(a||e(),!f||!h)return;const m=ga(d),g=ga(i.clientWidth-(u+f)),y=ga(i.clientHeight-(d+h)),b=ga(u),E={rootMargin:-m+"px "+-g+"px "+-y+"px "+-b+"px",threshold:$t(0,Tr(1,l))||1};let v=!0;function k(C){const S=C[0].intersectionRatio;if(S!==l){if(!v)return s();S?s(!1,S):r=setTimeout(()=>{s(!1,1e-7)},1e3)}S===1&&!Tv(c,t.getBoundingClientRect())&&s(),v=!1}try{n=new IntersectionObserver(k,{...E,root:i.ownerDocument})}catch{n=new IntersectionObserver(k,E)}n.observe(t)}return s(!0),o}function gO(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=yh(t),u=i||o?[...c?Es(c):[],...e?Es(e):[]]:[];u.forEach(b=>{i&&b.addEventListener("scroll",n,{passive:!0}),o&&b.addEventListener("resize",n)});const d=c&&a?mO(c,n):null;let f=-1,h=null;s&&(h=new ResizeObserver(b=>{let[w]=b;w&&w.target===c&&h&&e&&(h.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var E;(E=h)==null||E.observe(e)})),n()}),c&&!l&&h.observe(c),e&&h.observe(e));let m,g=l?fi(t):null;l&&y();function y(){const b=fi(t);g&&!Tv(g,b)&&n(),g=b,m=requestAnimationFrame(y)}return n(),()=>{var b;u.forEach(w=>{i&&w.removeEventListener("scroll",n),o&&w.removeEventListener("resize",n)}),d==null||d(),(b=h)==null||b.disconnect(),h=null,l&&cancelAnimationFrame(m)}}const yO=GM,bO=qM,vO=VM,xO=JM,wO=WM,ag=UM,EO=YM,kO=(t,e,n)=>{const r=new Map,i={platform:pO,...n},o={...i.platform,_c:r};return zM(t,e,{...i,platform:o})};var CO=typeof document<"u",SO=function(){},qa=CO?x.useLayoutEffect:SO;function kl(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(!kl(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 o=i[r];if(!(o==="_owner"&&t.$$typeof)&&!kl(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function Av(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function lg(t,e){const n=Av(t);return Math.round(e*n)/n}function $u(t){const e=x.useRef(t);return qa(()=>{e.current=t}),e}function _O(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=t,[u,d]=x.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[f,h]=x.useState(r);kl(f,r)||h(r);const[m,g]=x.useState(null),[y,b]=x.useState(null),w=x.useCallback(_=>{_!==C.current&&(C.current=_,g(_))},[]),E=x.useCallback(_=>{_!==S.current&&(S.current=_,b(_))},[]),v=o||m,k=s||y,C=x.useRef(null),S=x.useRef(null),N=x.useRef(u),M=l!=null,D=$u(l),H=$u(i),$=$u(c),z=x.useCallback(()=>{if(!C.current||!S.current)return;const _={placement:e,strategy:n,middleware:f};H.current&&(_.platform=H.current),kO(C.current,S.current,_).then(I=>{const j={...I,isPositioned:$.current!==!1};L.current&&!kl(N.current,j)&&(N.current=j,Tf.flushSync(()=>{d(j)}))})},[f,e,n,H,$]);qa(()=>{c===!1&&N.current.isPositioned&&(N.current.isPositioned=!1,d(_=>({..._,isPositioned:!1})))},[c]);const L=x.useRef(!1);qa(()=>(L.current=!0,()=>{L.current=!1}),[]),qa(()=>{if(v&&(C.current=v),k&&(S.current=k),v&&k){if(D.current)return D.current(v,k,z);z()}},[v,k,z,D,M]);const K=x.useMemo(()=>({reference:C,floating:S,setReference:w,setFloating:E}),[w,E]),A=x.useMemo(()=>({reference:v,floating:k}),[v,k]),T=x.useMemo(()=>{const _={position:n,left:0,top:0};if(!A.floating)return _;const I=lg(A.floating,u.x),j=lg(A.floating,u.y);return a?{..._,transform:"translate("+I+"px, "+j+"px)",...Av(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:I,top:j}},[n,a,A.floating,u.x,u.y]);return x.useMemo(()=>({...u,update:z,refs:K,elements:A,floatingStyles:T}),[u,z,K,A,T])}const NO=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?ag({element:r.current,padding:i}).fn(n):{}:r?ag({element:r,padding:i}).fn(n):{}}}},TO=(t,e)=>{const n=yO(t);return{name:n.name,fn:n.fn,options:[t,e]}},AO=(t,e)=>{const n=bO(t);return{name:n.name,fn:n.fn,options:[t,e]}},MO=(t,e)=>({fn:EO(t).fn,options:[t,e]}),OO=(t,e)=>{const n=vO(t);return{name:n.name,fn:n.fn,options:[t,e]}},RO=(t,e)=>{const n=xO(t);return{name:n.name,fn:n.fn,options:[t,e]}},IO=(t,e)=>{const n=wO(t);return{name:n.name,fn:n.fn,options:[t,e]}},DO=(t,e)=>{const n=NO(t);return{name:n.name,fn:n.fn,options:[t,e]}};var LO="Arrow",Mv=x.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...o}=t;return p.jsx(pn.svg,{...o,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"})})});Mv.displayName=LO;var PO=Mv;function BO(t){const[e,n]=x.useState(void 0);return Nr(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let s,a;if("borderBoxSize"in o){const l=o.borderBoxSize,c=Array.isArray(l)?l[0]:l;s=c.inlineSize,a=c.blockSize}else s=t.offsetWidth,a=t.offsetHeight;n({width:s,height:a})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var bh="Popper",[Ov,Pc]=uh(bh),[$O,Rv]=Ov(bh),Iv=t=>{const{__scopePopper:e,children:n}=t,[r,i]=x.useState(null);return p.jsx($O,{scope:e,anchor:r,onAnchorChange:i,children:n})};Iv.displayName=bh;var Dv="PopperAnchor",Lv=x.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,o=Rv(Dv,n),s=x.useRef(null),a=Dn(e,s),l=x.useRef(null);return x.useEffect(()=>{const c=l.current;l.current=(r==null?void 0:r.current)||s.current,c!==l.current&&o.onAnchorChange(l.current)}),r?null:p.jsx(pn.div,{...i,ref:a})});Lv.displayName=Dv;var vh="PopperContent",[jO,FO]=Ov(vh),Pv=x.forwardRef((t,e)=>{var pe,Me,ke,Se,Ie,Te;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:o="center",alignOffset:s=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:h="optimized",onPlaced:m,...g}=t,y=Rv(vh,n),[b,w]=x.useState(null),E=Dn(e,Ce=>w(Ce)),[v,k]=x.useState(null),C=BO(v),S=(C==null?void 0:C.width)??0,N=(C==null?void 0:C.height)??0,M=r+(o!=="center"?"-"+o:""),D=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},H=Array.isArray(c)?c:[c],$=H.length>0,z={padding:D,boundary:H.filter(zO),altBoundary:$},{refs:L,floatingStyles:K,placement:A,isPositioned:T,middlewareData:_}=_O({strategy:"fixed",placement:M,whileElementsMounted:(...Ce)=>gO(...Ce,{animationFrame:h==="always"}),elements:{reference:y.anchor},middleware:[TO({mainAxis:i+N,alignmentAxis:s}),l&&AO({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?MO():void 0,...z}),l&&OO({...z}),RO({...z,apply:({elements:Ce,rects:We,availableWidth:Be,availableHeight:ce})=>{const{width:Ye,height:X}=We.reference,ne=Ce.floating.style;ne.setProperty("--radix-popper-available-width",`${Be}px`),ne.setProperty("--radix-popper-available-height",`${ce}px`),ne.setProperty("--radix-popper-anchor-width",`${Ye}px`),ne.setProperty("--radix-popper-anchor-height",`${X}px`)}}),v&&DO({element:v,padding:a}),UO({arrowWidth:S,arrowHeight:N}),f&&IO({strategy:"referenceHidden",...z})]}),[I,j]=jv(A),G=oo(m);Nr(()=>{T&&(G==null||G())},[T,G]);const ie=(pe=_.arrow)==null?void 0:pe.x,ae=(Me=_.arrow)==null?void 0:Me.y,W=((ke=_.arrow)==null?void 0:ke.centerOffset)!==0,[J,me]=x.useState();return Nr(()=>{b&&me(window.getComputedStyle(b).zIndex)},[b]),p.jsx("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...K,transform:T?K.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:J,"--radix-popper-transform-origin":[(Se=_.transformOrigin)==null?void 0:Se.x,(Ie=_.transformOrigin)==null?void 0:Ie.y].join(" "),...((Te=_.hide)==null?void 0:Te.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:p.jsx(jO,{scope:n,placedSide:I,onArrowChange:k,arrowX:ie,arrowY:ae,shouldHideArrow:W,children:p.jsx(pn.div,{"data-side":I,"data-align":j,...g,ref:E,style:{...g.style,animation:T?void 0:"none"}})})})});Pv.displayName=vh;var Bv="PopperArrow",HO={top:"bottom",right:"left",bottom:"top",left:"right"},$v=x.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,o=FO(Bv,r),s=HO[o.placedSide];return p.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:p.jsx(PO,{...i,ref:n,style:{...i.style,display:"block"}})})});$v.displayName=Bv;function zO(t){return t!==null}var UO=t=>({name:"transformOrigin",options:t,fn(e){var y,b,w;const{placement:n,rects:r,middlewareData:i}=e,s=((y=i.arrow)==null?void 0:y.centerOffset)!==0,a=s?0:t.arrowWidth,l=s?0:t.arrowHeight,[c,u]=jv(n),d={start:"0%",center:"50%",end:"100%"}[u],f=(((b=i.arrow)==null?void 0:b.x)??0)+a/2,h=(((w=i.arrow)==null?void 0:w.y)??0)+l/2;let m="",g="";return c==="bottom"?(m=s?d:`${f}px`,g=`${-l}px`):c==="top"?(m=s?d:`${f}px`,g=`${r.floating.height+l}px`):c==="right"?(m=`${-l}px`,g=s?d:`${h}px`):c==="left"&&(m=`${r.floating.width+l}px`,g=s?d:`${h}px`),{data:{x:m,y:g}}}});function jv(t){const[e,n="center"]=t.split("-");return[e,n]}var Fv=Iv,xh=Lv,Hv=Pv,zv=$v,VO="Portal",Uv=x.forwardRef((t,e)=>{var a;const{container:n,...r}=t,[i,o]=x.useState(!1);Nr(()=>o(!0),[]);const s=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?Qy.createPortal(p.jsx(pn.div,{...r,ref:e}),s):null});Uv.displayName=VO;function WO(t,e){return x.useReducer((n,r)=>e[n][r]??n,t)}var Bc=t=>{const{present:e,children:n}=t,r=KO(e),i=typeof n=="function"?n({present:r.isPresent}):x.Children.only(n),o=Dn(r.ref,GO(i));return typeof n=="function"||r.isPresent?x.cloneElement(i,{ref:o}):null};Bc.displayName="Presence";function KO(t){const[e,n]=x.useState(),r=x.useRef(null),i=x.useRef(t),o=x.useRef("none"),s=t?"mounted":"unmounted",[a,l]=WO(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const c=ya(r.current);o.current=a==="mounted"?c:"none"},[a]),Nr(()=>{const c=r.current,u=i.current;if(u!==t){const f=o.current,h=ya(c);t?l("MOUNT"):h==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&f!==h?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),Nr(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=h=>{const g=ya(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=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},f=h=>{h.target===e&&(o.current=ya(r.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:x.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function ya(t){return(t==null?void 0:t.animationName)||"none"}function GO(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var qO=Af[" useInsertionEffect ".trim().toString()]||Nr;function Vv({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,o,s]=YO({defaultProp:e,onChange:n}),a=t!==void 0,l=a?t:i;{const u=x.useRef(t!==void 0);x.useEffect(()=>{const d=u.current;d!==a&&console.warn(`${r} is changing from ${d?"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.`),u.current=a},[a,r])}const c=x.useCallback(u=>{var d;if(a){const f=JO(u)?u(t):u;f!==t&&((d=s.current)==null||d.call(s,f))}else o(u)},[a,t,o,s]);return[l,c]}function YO({defaultProp:t,onChange:e}){const[n,r]=x.useState(t),i=x.useRef(n),o=x.useRef(e);return qO(()=>{o.current=e},[e]),x.useEffect(()=>{var s;i.current!==n&&((s=o.current)==null||s.call(o,n),i.current=n)},[n,i]),[n,r,o]}function JO(t){return typeof t=="function"}var XO=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"}),ZO="VisuallyHidden",Wv=x.forwardRef((t,e)=>p.jsx(pn.span,{...t,ref:e,style:{...XO,...t.style}}));Wv.displayName=ZO;var QO=Wv,[$c]=uh("Tooltip",[Pc]),jc=Pc(),Kv="TooltipProvider",eR=700,Zd="tooltip.open",[tR,wh]=$c(Kv),Gv=t=>{const{__scopeTooltip:e,delayDuration:n=eR,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:o}=t,s=x.useRef(!0),a=x.useRef(!1),l=x.useRef(0);return x.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),p.jsx(tR,{scope:e,isOpenDelayedRef:s,delayDuration:n,onOpen:x.useCallback(()=>{window.clearTimeout(l.current),s.current=!1},[]),onClose:x.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:x.useCallback(c=>{a.current=c},[]),disableHoverableContent:i,children:o})};Gv.displayName=Kv;var ks="Tooltip",[nR,Fc]=$c(ks),qv=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:i,onOpenChange:o,disableHoverableContent:s,delayDuration:a}=t,l=wh(ks,t.__scopeTooltip),c=jc(e),[u,d]=x.useState(null),f=bv(),h=x.useRef(0),m=s??l.disableHoverableContent,g=a??l.delayDuration,y=x.useRef(!1),[b,w]=Vv({prop:r,defaultProp:i??!1,onChange:S=>{S?(l.onOpen(),document.dispatchEvent(new CustomEvent(Zd))):l.onClose(),o==null||o(S)},caller:ks}),E=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]),k=x.useCallback(()=>{window.clearTimeout(h.current),h.current=0,w(!1)},[w]),C=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(Fv,{...c,children:p.jsx(nR,{scope:e,contentId:f,open:b,stateAttribute:E,trigger:u,onTriggerChange:d,onTriggerEnter:x.useCallback(()=>{l.isOpenDelayedRef.current?C():v()},[l.isOpenDelayedRef,C,v]),onTriggerLeave:x.useCallback(()=>{m?k():(window.clearTimeout(h.current),h.current=0)},[k,m]),onOpen:v,onClose:k,disableHoverableContent:m,children:n})})};qv.displayName=ks;var Qd="TooltipTrigger",Yv=x.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=Fc(Qd,n),o=wh(Qd,n),s=jc(n),a=x.useRef(null),l=Dn(e,a,i.onTriggerChange),c=x.useRef(!1),u=x.useRef(!1),d=x.useCallback(()=>c.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),p.jsx(xh,{asChild:!0,...s,children:p.jsx(pn.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:At(t.onPointerMove,f=>{f.pointerType!=="touch"&&!u.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:At(t.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:At(t.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:At(t.onFocus,()=>{c.current||i.onOpen()}),onBlur:At(t.onBlur,i.onClose),onClick:At(t.onClick,i.onClose)})})});Yv.displayName=Qd;var rR="TooltipPortal",[NH,iR]=$c(rR,{forceMount:void 0}),ao="TooltipContent",Jv=x.forwardRef((t,e)=>{const n=iR(ao,t.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...o}=t,s=Fc(ao,t.__scopeTooltip);return p.jsx(Bc,{present:r||s.open,children:s.disableHoverableContent?p.jsx(Xv,{side:i,...o,ref:e}):p.jsx(oR,{side:i,...o,ref:e})})}),oR=x.forwardRef((t,e)=>{const n=Fc(ao,t.__scopeTooltip),r=wh(ao,t.__scopeTooltip),i=x.useRef(null),o=Dn(e,i),[s,a]=x.useState(null),{trigger:l,onClose:c}=n,u=i.current,{onPointerInTransitChange:d}=r,f=x.useCallback(()=>{a(null),d(!1)},[d]),h=x.useCallback((m,g)=>{const y=m.currentTarget,b={x:m.clientX,y:m.clientY},w=uR(b,y.getBoundingClientRect()),E=dR(b,w),v=fR(g.getBoundingClientRect()),k=pR([...E,...v]);a(k),d(!0)},[d]);return x.useEffect(()=>()=>f(),[f]),x.useEffect(()=>{if(l&&u){const m=y=>h(y,u),g=y=>h(y,l);return l.addEventListener("pointerleave",m),u.addEventListener("pointerleave",g),()=>{l.removeEventListener("pointerleave",m),u.removeEventListener("pointerleave",g)}}},[l,u,h,f]),x.useEffect(()=>{if(s){const m=g=>{const y=g.target,b={x:g.clientX,y:g.clientY},w=(l==null?void 0:l.contains(y))||(u==null?void 0:u.contains(y)),E=!hR(b,s);w?f():E&&(f(),c())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[l,u,s,c,f]),p.jsx(Xv,{...t,ref:o})}),[sR,aR]=$c(ks,{isInside:!1}),lR=mM("TooltipContent"),Xv=x.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:o,onPointerDownOutside:s,...a}=t,l=Fc(ao,n),c=jc(n),{onClose:u}=l;return x.useEffect(()=>(document.addEventListener(Zd,u),()=>document.removeEventListener(Zd,u)),[u]),x.useEffect(()=>{if(l.trigger){const d=f=>{const h=f.target;h!=null&&h.contains(l.trigger)&&u()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[l.trigger,u]),p.jsx(dh,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:p.jsxs(Hv,{"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(lR,{children:r}),p.jsx(sR,{scope:n,isInside:!0,children:p.jsx(QO,{id:l.contentId,role:"tooltip",children:i||r})})]})})});Jv.displayName=ao;var Zv="TooltipArrow",cR=x.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=jc(n);return aR(Zv,n).isInside?null:p.jsx(zv,{...i,...r,ref:e})});cR.displayName=Zv;function uR(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),i=Math.abs(e.right-t.x),o=Math.abs(e.left-t.x);switch(Math.min(n,r,i,o)){case o:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function dR(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 fR(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 hR(t,e){const{x:n,y:r}=t;let i=!1;for(let o=0,s=e.length-1;o<e.length;s=o++){const a=e[o],l=e[s],c=a.x,u=a.y,d=l.x,f=l.y;u>r!=f>r&&n<(d-c)*(r-u)/(f-u)+c&&(i=!i)}return i}function pR(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),mR(e)}function mR(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 o=e[e.length-1],s=e[e.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.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 o=n[n.length-1],s=n[n.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.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 gR=Gv,yR=qv,bR=Yv,Qv=Jv;/**
106
- * @license lucide-react v0.483.0 - ISC
107
- *
108
- * This source code is licensed under the ISC license.
109
- * See the LICENSE file in the root directory of this source tree.
110
- */const vR=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ex=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();/**
111
- * @license lucide-react v0.483.0 - ISC
112
- *
113
- * This source code is licensed under the ISC license.
114
- * See the LICENSE file in the root directory of this source tree.
115
- */var xR={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"};/**
116
- * @license lucide-react v0.483.0 - ISC
117
- *
118
- * This source code is licensed under the ISC license.
119
- * See the LICENSE file in the root directory of this source tree.
120
- */const wR=x.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:o,iconNode:s,...a},l)=>x.createElement("svg",{ref:l,...xR,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:ex("lucide",i),...a},[...s.map(([c,u])=>x.createElement(c,u)),...Array.isArray(o)?o:[o]]));/**
121
- * @license lucide-react v0.483.0 - ISC
122
- *
123
- * This source code is licensed under the ISC license.
124
- * See the LICENSE file in the root directory of this source tree.
125
- */const te=(t,e)=>{const n=x.forwardRef(({className:r,...i},o)=>x.createElement(wR,{ref:o,iconNode:e,className:ex(`lucide-${vR(t)}`,r),...i}));return n.displayName=`${t}`,n};/**
126
- * @license lucide-react v0.483.0 - ISC
127
- *
128
- * This source code is licensed under the ISC license.
129
- * See the LICENSE file in the root directory of this source tree.
130
- */const ER=[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],tx=te("AlignCenter",ER);/**
131
- * @license lucide-react v0.483.0 - ISC
132
- *
133
- * This source code is licensed under the ISC license.
134
- * See the LICENSE file in the root directory of this source tree.
135
- */const kR=[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],nx=te("AlignLeft",kR);/**
136
- * @license lucide-react v0.483.0 - ISC
137
- *
138
- * This source code is licensed under the ISC license.
139
- * See the LICENSE file in the root directory of this source tree.
140
- */const CR=[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],rx=te("AlignRight",CR);/**
141
- * @license lucide-react v0.483.0 - ISC
142
- *
143
- * This source code is licensed under the ISC license.
144
- * See the LICENSE file in the root directory of this source tree.
145
- */const SR=[["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"}]],_R=te("AlignVerticalDistributeCenter",SR);/**
146
- * @license lucide-react v0.483.0 - ISC
147
- *
148
- * This source code is licensed under the ISC license.
149
- * See the LICENSE file in the root directory of this source tree.
150
- */const NR=[["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"}]],TR=te("AlignVerticalDistributeEnd",NR);/**
151
- * @license lucide-react v0.483.0 - ISC
152
- *
153
- * This source code is licensed under the ISC license.
154
- * See the LICENSE file in the root directory of this source tree.
155
- */const AR=[["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"}]],MR=te("AlignVerticalDistributeStart",AR);/**
156
- * @license lucide-react v0.483.0 - ISC
157
- *
158
- * This source code is licensed under the ISC license.
159
- * See the LICENSE file in the root directory of this source tree.
160
- */const OR=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],RR=te("ArrowDown",OR);/**
161
- * @license lucide-react v0.483.0 - ISC
162
- *
163
- * This source code is licensed under the ISC license.
164
- * See the LICENSE file in the root directory of this source tree.
165
- */const IR=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],DR=te("ArrowUp",IR);/**
166
- * @license lucide-react v0.483.0 - ISC
167
- *
168
- * This source code is licensed under the ISC license.
169
- * See the LICENSE file in the root directory of this source tree.
170
- */const LR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]],PR=te("Ban",LR);/**
171
- * @license lucide-react v0.483.0 - ISC
172
- *
173
- * This source code is licensed under the ISC license.
174
- * See the LICENSE file in the root directory of this source tree.
175
- */const BR=[["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"}]],ix=te("Bold",BR);/**
176
- * @license lucide-react v0.483.0 - ISC
177
- *
178
- * This source code is licensed under the ISC license.
179
- * See the LICENSE file in the root directory of this source tree.
180
- */const $R=[["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"}]],Vi=te("Braces",$R);/**
181
- * @license lucide-react v0.483.0 - ISC
182
- *
183
- * This source code is licensed under the ISC license.
184
- * See the LICENSE file in the root directory of this source tree.
185
- */const jR=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ox=te("ChevronDown",jR);/**
186
- * @license lucide-react v0.483.0 - ISC
187
- *
188
- * This source code is licensed under the ISC license.
189
- * See the LICENSE file in the root directory of this source tree.
190
- */const FR=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],HR=te("ChevronRight",FR);/**
191
- * @license lucide-react v0.483.0 - ISC
192
- *
193
- * This source code is licensed under the ISC license.
194
- * See the LICENSE file in the root directory of this source tree.
195
- */const zR=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],UR=te("ChevronUp",zR);/**
196
- * @license lucide-react v0.483.0 - ISC
197
- *
198
- * This source code is licensed under the ISC license.
199
- * See the LICENSE file in the root directory of this source tree.
200
- */const VR=[["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"}]],sx=te("CodeXml",VR);/**
201
- * @license lucide-react v0.483.0 - ISC
202
- *
203
- * This source code is licensed under the ISC license.
204
- * See the LICENSE file in the root directory of this source tree.
205
- */const WR=[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]],KR=te("Code",WR);/**
206
- * @license lucide-react v0.483.0 - ISC
207
- *
208
- * This source code is licensed under the ISC license.
209
- * See the LICENSE file in the root directory of this source tree.
210
- */const GR=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],ax=te("Columns2",GR);/**
211
- * @license lucide-react v0.483.0 - ISC
212
- *
213
- * This source code is licensed under the ISC license.
214
- * See the LICENSE file in the root directory of this source tree.
215
- */const qR=[["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"}]],YR=te("Columns3",qR);/**
216
- * @license lucide-react v0.483.0 - ISC
217
- *
218
- * This source code is licensed under the ISC license.
219
- * See the LICENSE file in the root directory of this source tree.
220
- */const JR=[["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"}]],XR=te("Copy",JR);/**
221
- * @license lucide-react v0.483.0 - ISC
222
- *
223
- * This source code is licensed under the ISC license.
224
- * See the LICENSE file in the root directory of this source tree.
225
- */const ZR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M14.83 14.83a4 4 0 1 1 0-5.66",key:"1i56pz"}]],QR=te("Copyright",ZR);/**
226
- * @license lucide-react v0.483.0 - ISC
227
- *
228
- * This source code is licensed under the ISC license.
229
- * See the LICENSE file in the root directory of this source tree.
230
- */const e2=[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]],lx=te("CornerDownLeft",e2);/**
231
- * @license lucide-react v0.483.0 - ISC
232
- *
233
- * This source code is licensed under the ISC license.
234
- * See the LICENSE file in the root directory of this source tree.
235
- */const t2=[["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"}]],n2=te("Divide",t2);/**
236
- * @license lucide-react v0.483.0 - ISC
237
- *
238
- * This source code is licensed under the ISC license.
239
- * See the LICENSE file in the root directory of this source tree.
240
- */const r2=[["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"}]],cx=te("Eraser",r2);/**
241
- * @license lucide-react v0.483.0 - ISC
242
- *
243
- * This source code is licensed under the ISC license.
244
- * See the LICENSE file in the root directory of this source tree.
245
- */const i2=[["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"}]],o2=te("Eye",i2);/**
246
- * @license lucide-react v0.483.0 - ISC
247
- *
248
- * This source code is licensed under the ISC license.
249
- * See the LICENSE file in the root directory of this source tree.
250
- */const s2=[["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"}]],Eh=te("Footprints",s2);/**
251
- * @license lucide-react v0.483.0 - ISC
252
- *
253
- * This source code is licensed under the ISC license.
254
- * See the LICENSE file in the root directory of this source tree.
255
- */const a2=[["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"}]],l2=te("Grab",a2);/**
256
- * @license lucide-react v0.483.0 - ISC
257
- *
258
- * This source code is licensed under the ISC license.
259
- * See the LICENSE file in the root directory of this source tree.
260
- */const c2=[["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"}]],u2=te("GripVertical",c2);/**
261
- * @license lucide-react v0.483.0 - ISC
262
- *
263
- * This source code is licensed under the ISC license.
264
- * See the LICENSE file in the root directory of this source tree.
265
- */const d2=[["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"}]],kh=te("Heading1",d2);/**
266
- * @license lucide-react v0.483.0 - ISC
267
- *
268
- * This source code is licensed under the ISC license.
269
- * See the LICENSE file in the root directory of this source tree.
270
- */const f2=[["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"}]],ux=te("Heading2",f2);/**
271
- * @license lucide-react v0.483.0 - ISC
272
- *
273
- * This source code is licensed under the ISC license.
274
- * See the LICENSE file in the root directory of this source tree.
275
- */const h2=[["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"}]],dx=te("Heading3",h2);/**
276
- * @license lucide-react v0.483.0 - ISC
277
- *
278
- * This source code is licensed under the ISC license.
279
- * See the LICENSE file in the root directory of this source tree.
280
- */const p2=[["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"}]],fx=te("ImageDown",p2);/**
281
- * @license lucide-react v0.483.0 - ISC
282
- *
283
- * This source code is licensed under the ISC license.
284
- * See the LICENSE file in the root directory of this source tree.
285
- */const m2=[["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"}]],g2=te("ImageOff",m2);/**
286
- * @license lucide-react v0.483.0 - ISC
287
- *
288
- * This source code is licensed under the ISC license.
289
- * See the LICENSE file in the root directory of this source tree.
290
- */const y2=[["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"}]],Ch=te("Image",y2);/**
291
- * @license lucide-react v0.483.0 - ISC
292
- *
293
- * This source code is licensed under the ISC license.
294
- * See the LICENSE file in the root directory of this source tree.
295
- */const b2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],hx=te("Info",b2);/**
296
- * @license lucide-react v0.483.0 - ISC
297
- *
298
- * This source code is licensed under the ISC license.
299
- * See the LICENSE file in the root directory of this source tree.
300
- */const v2=[["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"}]],px=te("Italic",v2);/**
301
- * @license lucide-react v0.483.0 - ISC
302
- *
303
- * This source code is licensed under the ISC license.
304
- * See the LICENSE file in the root directory of this source tree.
305
- */const x2=[["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"}]],w2=te("LayoutTemplate",x2);/**
306
- * @license lucide-react v0.483.0 - ISC
307
- *
308
- * This source code is licensed under the ISC license.
309
- * See the LICENSE file in the root directory of this source tree.
310
- */const E2=[["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"}]],ef=te("Link",E2);/**
311
- * @license lucide-react v0.483.0 - ISC
312
- *
313
- * This source code is licensed under the ISC license.
314
- * See the LICENSE file in the root directory of this source tree.
315
- */const k2=[["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"}]],Sh=te("ListOrdered",k2);/**
316
- * @license lucide-react v0.483.0 - ISC
317
- *
318
- * This source code is licensed under the ISC license.
319
- * See the LICENSE file in the root directory of this source tree.
320
- */const C2=[["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"}]],_h=te("List",C2);/**
321
- * @license lucide-react v0.483.0 - ISC
322
- *
323
- * This source code is licensed under the ISC license.
324
- * See the LICENSE file in the root directory of this source tree.
325
- */const S2=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],_2=te("LoaderCircle",S2);/**
326
- * @license lucide-react v0.483.0 - ISC
327
- *
328
- * This source code is licensed under the ISC license.
329
- * See the LICENSE file in the root directory of this source tree.
330
- */const N2=[["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"}]],T2=te("LockOpen",N2);/**
331
- * @license lucide-react v0.483.0 - ISC
332
- *
333
- * This source code is licensed under the ISC license.
334
- * See the LICENSE file in the root directory of this source tree.
335
- */const A2=[["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"}]],M2=te("Lock",A2);/**
336
- * @license lucide-react v0.483.0 - ISC
337
- *
338
- * This source code is licensed under the ISC license.
339
- * See the LICENSE file in the root directory of this source tree.
340
- */const O2=[["path",{d:"M5 12h14",key:"1ays0h"}]],R2=te("Minus",O2);/**
341
- * @license lucide-react v0.483.0 - ISC
342
- *
343
- * This source code is licensed under the ISC license.
344
- * See the LICENSE file in the root directory of this source tree.
345
- */const I2=[["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"}]],D2=te("MousePointer",I2);/**
346
- * @license lucide-react v0.483.0 - ISC
347
- *
348
- * This source code is licensed under the ISC license.
349
- * See the LICENSE file in the root directory of this source tree.
350
- */const L2=[["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"}]],P2=te("MoveVertical",L2);/**
351
- * @license lucide-react v0.483.0 - ISC
352
- *
353
- * This source code is licensed under the ISC license.
354
- * See the LICENSE file in the root directory of this source tree.
355
- */const B2=[["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"}]],$2=te("Pencil",B2);/**
356
- * @license lucide-react v0.483.0 - ISC
357
- *
358
- * This source code is licensed under the ISC license.
359
- * See the LICENSE file in the root directory of this source tree.
360
- */const j2=[["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"}]],mx=te("Pilcrow",j2);/**
361
- * @license lucide-react v0.483.0 - ISC
362
- *
363
- * This source code is licensed under the ISC license.
364
- * See the LICENSE file in the root directory of this source tree.
365
- */const F2=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],H2=te("Plus",F2);/**
366
- * @license lucide-react v0.483.0 - ISC
367
- *
368
- * This source code is licensed under the ISC license.
369
- * See the LICENSE file in the root directory of this source tree.
370
- */const z2=[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]],gx=te("RectangleHorizontal",z2);/**
371
- * @license lucide-react v0.483.0 - ISC
372
- *
373
- * This source code is licensed under the ISC license.
374
- * See the LICENSE file in the root directory of this source tree.
375
- */const U2=[["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"}]],yx=te("Repeat2",U2);/**
376
- * @license lucide-react v0.483.0 - ISC
377
- *
378
- * This source code is licensed under the ISC license.
379
- * See the LICENSE file in the root directory of this source tree.
380
- */const V2=[["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"}]],W2=te("SeparatorHorizontal",V2);/**
381
- * @license lucide-react v0.483.0 - ISC
382
- *
383
- * This source code is licensed under the ISC license.
384
- * See the LICENSE file in the root directory of this source tree.
385
- */const K2=[["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"}]],G2=te("SlidersVertical",K2);/**
386
- * @license lucide-react v0.483.0 - ISC
387
- *
388
- * This source code is licensed under the ISC license.
389
- * See the LICENSE file in the root directory of this source tree.
390
- */const q2=[["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]],Y2=te("Space",q2);/**
391
- * @license lucide-react v0.483.0 - ISC
392
- *
393
- * This source code is licensed under the ISC license.
394
- * See the LICENSE file in the root directory of this source tree.
395
- */const J2=[["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"}]],X2=te("SquareArrowUpRight",J2);/**
396
- * @license lucide-react v0.483.0 - ISC
397
- *
398
- * This source code is licensed under the ISC license.
399
- * See the LICENSE file in the root directory of this source tree.
400
- */const Z2=[["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"}]],bx=te("Strikethrough",Z2);/**
401
- * @license lucide-react v0.483.0 - ISC
402
- *
403
- * This source code is licensed under the ISC license.
404
- * See the LICENSE file in the root directory of this source tree.
405
- */const Q2=[["path",{d:"M17 6H3",key:"16j9eg"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 18H8",key:"1wfozv"}],["path",{d:"M3 12v6",key:"fv4c87"}]],eI=te("TextQuote",Q2);/**
406
- * @license lucide-react v0.483.0 - ISC
407
- *
408
- * This source code is licensed under the ISC license.
409
- * See the LICENSE file in the root directory of this source tree.
410
- */const tI=[["path",{d:"M17 6.1H3",key:"wptmhv"}],["path",{d:"M21 12.1H3",key:"1j38uz"}],["path",{d:"M15.1 18H3",key:"1nb16a"}]],nI=te("Text",tI);/**
411
- * @license lucide-react v0.483.0 - ISC
412
- *
413
- * This source code is licensed under the ISC license.
414
- * See the LICENSE file in the root directory of this source tree.
415
- */const rI=[["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"}]],iI=te("Trash2",rI);/**
416
- * @license lucide-react v0.483.0 - ISC
417
- *
418
- * This source code is licensed under the ISC license.
419
- * See the LICENSE file in the root directory of this source tree.
420
- */const oI=[["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"}]],vx=te("Trash",oI);/**
421
- * @license lucide-react v0.483.0 - ISC
422
- *
423
- * This source code is licensed under the ISC license.
424
- * See the LICENSE file in the root directory of this source tree.
425
- */const sI=[["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"}]],aI=te("TriangleAlert",sI);/**
426
- * @license lucide-react v0.483.0 - ISC
427
- *
428
- * This source code is licensed under the ISC license.
429
- * See the LICENSE file in the root directory of this source tree.
430
- */const lI=[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]],xx=te("Underline",lI);/**
431
- * @license lucide-react v0.483.0 - ISC
432
- *
433
- * This source code is licensed under the ISC license.
434
- * See the LICENSE file in the root directory of this source tree.
435
- */const cI=[["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"}]],uI=te("View",cI);var dI=Symbol.for("react.lazy"),Cl=Af[" use ".trim().toString()];function fI(t){return typeof t=="object"&&t!==null&&"then"in t}function wx(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===dI&&"_payload"in t&&fI(t._payload)}function hI(t){const e=mI(t),n=x.forwardRef((r,i)=>{let{children:o,...s}=r;wx(o)&&typeof Cl=="function"&&(o=Cl(o._payload));const a=x.Children.toArray(o),l=a.find(yI);if(l){const c=l.props.children,u=a.map(d=>d===l?x.Children.count(c)>1?x.Children.only(null):x.isValidElement(c)?c.props.children:null:d);return p.jsx(e,{...s,ref:i,children:x.isValidElement(c)?x.cloneElement(c,void 0,u):null})}return p.jsx(e,{...s,ref:i,children:o})});return n.displayName=`${t}.Slot`,n}var pI=hI("Slot");function mI(t){const e=x.forwardRef((n,r)=>{let{children:i,...o}=n;if(wx(i)&&typeof Cl=="function"&&(i=Cl(i._payload)),x.isValidElement(i)){const s=vI(i),a=bI(o,i.props);return i.type!==x.Fragment&&(a.ref=r?ch(r,s):s),x.cloneElement(i,a)}return x.Children.count(i)>1?x.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var gI=Symbol("radix.slottable");function yI(t){return x.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===gI}function bI(t,e){const n={...e};for(const r in e){const i=t[r],o=e[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...t,...n}}function vI(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var ju=0;function xI(){x.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??cg()),document.body.insertAdjacentElement("beforeend",t[1]??cg()),ju++,()=>{ju===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),ju--}},[])}function cg(){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 Fu="focusScope.autoFocusOnMount",Hu="focusScope.autoFocusOnUnmount",ug={bubbles:!1,cancelable:!0},wI="FocusScope",Ex=x.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...s}=t,[a,l]=x.useState(null),c=oo(i),u=oo(o),d=x.useRef(null),f=Dn(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(E){if(h.paused||!a)return;const v=E.target;a.contains(v)?d.current=v:lr(d.current,{select:!0})},y=function(E){if(h.paused||!a)return;const v=E.relatedTarget;v!==null&&(a.contains(v)||lr(d.current,{select:!0}))},b=function(E){if(document.activeElement===document.body)for(const k of E)k.removedNodes.length>0&&lr(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){fg.add(h);const g=document.activeElement;if(!a.contains(g)){const b=new CustomEvent(Fu,ug);a.addEventListener(Fu,c),a.dispatchEvent(b),b.defaultPrevented||(EI(NI(kx(a)),{select:!0}),document.activeElement===g&&lr(a))}return()=>{a.removeEventListener(Fu,c),setTimeout(()=>{const b=new CustomEvent(Hu,ug);a.addEventListener(Hu,u),a.dispatchEvent(b),b.defaultPrevented||lr(g??document.body,{select:!0}),a.removeEventListener(Hu,u),fg.remove(h)},0)}}},[a,c,u,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,[E,v]=kI(w);E&&v?!g.shiftKey&&b===v?(g.preventDefault(),n&&lr(E,{select:!0})):g.shiftKey&&b===E&&(g.preventDefault(),n&&lr(v,{select:!0})):b===w&&g.preventDefault()}},[n,r,h.paused]);return p.jsx(pn.div,{tabIndex:-1,...s,ref:f,onKeyDown:m})});Ex.displayName=wI;function EI(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(lr(r,{select:e}),document.activeElement!==n)return}function kI(t){const e=kx(t),n=dg(e,t),r=dg(e.reverse(),t);return[n,r]}function kx(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 dg(t,e){for(const n of t)if(!CI(n,{upTo:e}))return n}function CI(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 SI(t){return t instanceof HTMLInputElement&&"select"in t}function lr(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&SI(t)&&e&&t.select()}}var fg=_I();function _I(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=hg(t,e),t.unshift(e)},remove(e){var n;t=hg(t,e),(n=t[0])==null||n.resume()}}}function hg(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function NI(t){return t.filter(e=>e.tagName!=="A")}var TI=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Si=new WeakMap,ba=new WeakMap,va={},zu=0,Cx=function(t){return t&&(t.host||Cx(t.parentNode))},AI=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=Cx(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})},MI=function(t,e,n,r){var i=AI(e,Array.isArray(t)?t:[t]);va[n]||(va[n]=new WeakMap);var o=va[n],s=[],a=new Set,l=new Set(i),c=function(d){!d||a.has(d)||(a.add(d),c(d.parentNode))};i.forEach(c);var u=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(f){if(a.has(f))u(f);else try{var h=f.getAttribute(r),m=h!==null&&h!=="false",g=(Si.get(f)||0)+1,y=(o.get(f)||0)+1;Si.set(f,g),o.set(f,y),s.push(f),g===1&&m&&ba.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 u(e),a.clear(),zu++,function(){s.forEach(function(d){var f=Si.get(d)-1,h=o.get(d)-1;Si.set(d,f),o.set(d,h),f||(ba.has(d)||d.removeAttribute(r),ba.delete(d)),h||d.removeAttribute(n)}),zu--,zu||(Si=new WeakMap,Si=new WeakMap,ba=new WeakMap,va={})}},OI=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=TI(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),MI(r,i,n,"aria-hidden")):function(){return null}},wn=function(){return wn=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},wn.apply(this,arguments)};function Sx(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 RI(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}var Ya="right-scroll-bar-position",Ja="width-before-scroll-bar",II="with-scroll-bars-hidden",DI="--removed-body-scroll-bar-size";function Uu(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function LI(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 PI=typeof window<"u"?x.useLayoutEffect:x.useEffect,pg=new WeakMap;function BI(t,e){var n=LI(null,function(r){return t.forEach(function(i){return Uu(i,r)})});return PI(function(){var r=pg.get(n);if(r){var i=new Set(r),o=new Set(t),s=n.current;i.forEach(function(a){o.has(a)||Uu(a,null)}),o.forEach(function(a){i.has(a)||Uu(a,s)})}pg.set(n,t)},[t]),n}function $I(t){return t}function jI(t,e){e===void 0&&(e=$I);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(o){var s=e(o,r);return n.push(s),function(){n=n.filter(function(a){return a!==s})}},assignSyncMedium:function(o){for(r=!0;n.length;){var s=n;n=[],s.forEach(o)}n={push:function(a){return o(a)},filter:function(){return n}}},assignMedium:function(o){r=!0;var s=[];if(n.length){var a=n;n=[],a.forEach(o),s=n}var l=function(){var u=s;s=[],u.forEach(o)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(u){s.push(u),c()},filter:function(u){return s=s.filter(u),n}}}};return i}function FI(t){t===void 0&&(t={});var e=jI(null);return e.options=wn({async:!0,ssr:!1},t),e}var _x=function(t){var e=t.sideCar,n=Sx(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,wn({},n))};_x.isSideCarExport=!0;function HI(t,e){return t.useMedium(e),_x}var Nx=FI(),Vu=function(){},Hc=x.forwardRef(function(t,e){var n=x.useRef(null),r=x.useState({onScrollCapture:Vu,onWheelCapture:Vu,onTouchMoveCapture:Vu}),i=r[0],o=r[1],s=t.forwardProps,a=t.children,l=t.className,c=t.removeScrollBar,u=t.enabled,d=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,E=t.gapMode,v=Sx(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),k=f,C=BI([n,e]),S=wn(wn({},v),i);return x.createElement(x.Fragment,null,u&&x.createElement(k,{sideCar:Nx,removeScrollBar:c,shards:d,noRelative:h,noIsolation:m,inert:g,setCallbacks:o,allowPinchZoom:!!y,lockRef:n,gapMode:E}),s?x.cloneElement(x.Children.only(a),wn(wn({},S),{ref:C})):x.createElement(w,wn({},S,{className:l,ref:C}),a))});Hc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Hc.classNames={fullWidth:Ja,zeroRight:Ya};var zI=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function UI(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=zI();return e&&t.setAttribute("nonce",e),t}function VI(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function WI(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var KI=function(){var t=0,e=null;return{add:function(n){t==0&&(e=UI())&&(VI(e,n),WI(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},GI=function(){var t=KI();return function(e,n){x.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},Tx=function(){var t=GI(),e=function(n){var r=n.styles,i=n.dynamic;return t(r,i),null};return e},qI={left:0,top:0,right:0,gap:0},Wu=function(t){return parseInt(t||"",10)||0},YI=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[Wu(n),Wu(r),Wu(i)]},JI=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return qI;var e=YI(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])}},XI=Tx(),Wi="data-scroll-locked",ZI=function(t,e,n,r){var i=t.left,o=t.top,s=t.right,a=t.gap;return n===void 0&&(n="margin"),`
436
- .`.concat(II,` {
437
- overflow: hidden `).concat(r,`;
438
- padding-right: `).concat(a,"px ").concat(r,`;
439
- }
440
- body[`).concat(Wi,`] {
441
- overflow: hidden `).concat(r,`;
442
- overscroll-behavior: contain;
443
- `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
444
- padding-left: `.concat(i,`px;
445
- padding-top: `).concat(o,`px;
446
- padding-right: `).concat(s,`px;
447
- margin-left:0;
448
- margin-top:0;
449
- margin-right: `).concat(a,"px ").concat(r,`;
450
- `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
451
- }
452
-
453
- .`).concat(Ya,` {
454
- right: `).concat(a,"px ").concat(r,`;
455
- }
456
-
457
- .`).concat(Ja,` {
458
- margin-right: `).concat(a,"px ").concat(r,`;
459
- }
460
-
461
- .`).concat(Ya," .").concat(Ya,` {
462
- right: 0 `).concat(r,`;
463
- }
464
-
465
- .`).concat(Ja," .").concat(Ja,` {
466
- margin-right: 0 `).concat(r,`;
467
- }
468
-
469
- body[`).concat(Wi,`] {
470
- `).concat(DI,": ").concat(a,`px;
471
- }
472
- `)},mg=function(){var t=parseInt(document.body.getAttribute(Wi)||"0",10);return isFinite(t)?t:0},QI=function(){x.useEffect(function(){return document.body.setAttribute(Wi,(mg()+1).toString()),function(){var t=mg()-1;t<=0?document.body.removeAttribute(Wi):document.body.setAttribute(Wi,t.toString())}},[])},eD=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;QI();var o=x.useMemo(function(){return JI(i)},[i]);return x.createElement(XI,{styles:ZI(o,!e,i,n?"":"!important")})},tf=!1;if(typeof window<"u")try{var xa=Object.defineProperty({},"passive",{get:function(){return tf=!0,!0}});window.addEventListener("test",xa,xa),window.removeEventListener("test",xa,xa)}catch{tf=!1}var _i=tf?{passive:!1}:!1,tD=function(t){return t.tagName==="TEXTAREA"},Ax=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!tD(t)&&n[e]==="visible")},nD=function(t){return Ax(t,"overflowY")},rD=function(t){return Ax(t,"overflowX")},gg=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=Mx(t,r);if(i){var o=Ox(t,r),s=o[1],a=o[2];if(s>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},iD=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},oD=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},Mx=function(t,e){return t==="v"?nD(e):rD(e)},Ox=function(t,e){return t==="v"?iD(e):oD(e)},sD=function(t,e){return t==="h"&&e==="rtl"?-1:1},aD=function(t,e,n,r,i){var o=sD(t,window.getComputedStyle(e).direction),s=o*r,a=n.target,l=e.contains(a),c=!1,u=s>0,d=0,f=0;do{if(!a)break;var h=Ox(t,a),m=h[0],g=h[1],y=h[2],b=g-y-o*m;(m||b)&&Mx(t,a)&&(d+=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(u&&Math.abs(d)<1||!u&&Math.abs(f)<1)&&(c=!0),c},wa=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},yg=function(t){return[t.deltaX,t.deltaY]},bg=function(t){return t&&"current"in t?t.current:t},lD=function(t,e){return t[0]===e[0]&&t[1]===e[1]},cD=function(t){return`
473
- .block-interactivity-`.concat(t,` {pointer-events: none;}
474
- .allow-interactivity-`).concat(t,` {pointer-events: all;}
475
- `)},uD=0,Ni=[];function dD(t){var e=x.useRef([]),n=x.useRef([0,0]),r=x.useRef(),i=x.useState(uD++)[0],o=x.useState(Tx)[0],s=x.useRef(t);x.useEffect(function(){s.current=t},[t]),x.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var g=RI([t.lockRef.current],(t.shards||[]).map(bg),!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!s.current.allowPinchZoom;var b=wa(g),w=n.current,E="deltaX"in g?g.deltaX:w[0]-b[0],v="deltaY"in g?g.deltaY:w[1]-b[1],k,C=g.target,S=Math.abs(E)>Math.abs(v)?"h":"v";if("touches"in g&&S==="h"&&C.type==="range")return!1;var N=window.getSelection(),M=N&&N.anchorNode,D=M?M===C||M.contains(C):!1;if(D)return!1;var H=gg(S,C);if(!H)return!0;if(H?k=S:(k=S==="v"?"h":"v",H=gg(S,C)),!H)return!1;if(!r.current&&"changedTouches"in g&&(E||v)&&(r.current=k),!k)return!0;var $=r.current||k;return aD($,y,g,$==="h"?E:v)},[]),l=x.useCallback(function(g){var y=g;if(!(!Ni.length||Ni[Ni.length-1]!==o)){var b="deltaY"in y?yg(y):wa(y),w=e.current.filter(function(k){return k.name===y.type&&(k.target===y.target||y.target===k.shadowParent)&&lD(k.delta,b)})[0];if(w&&w.should){y.cancelable&&y.preventDefault();return}if(!w){var E=(s.current.shards||[]).map(bg).filter(Boolean).filter(function(k){return k.contains(y.target)}),v=E.length>0?a(y,E[0]):!s.current.noIsolation;v&&y.cancelable&&y.preventDefault()}}},[]),c=x.useCallback(function(g,y,b,w){var E={name:g,delta:y,target:b,should:w,shadowParent:fD(b)};e.current.push(E),setTimeout(function(){e.current=e.current.filter(function(v){return v!==E})},1)},[]),u=x.useCallback(function(g){n.current=wa(g),r.current=void 0},[]),d=x.useCallback(function(g){c(g.type,yg(g),g.target,a(g,t.lockRef.current))},[]),f=x.useCallback(function(g){c(g.type,wa(g),g.target,a(g,t.lockRef.current))},[]);x.useEffect(function(){return Ni.push(o),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",l,_i),document.addEventListener("touchmove",l,_i),document.addEventListener("touchstart",u,_i),function(){Ni=Ni.filter(function(g){return g!==o}),document.removeEventListener("wheel",l,_i),document.removeEventListener("touchmove",l,_i),document.removeEventListener("touchstart",u,_i)}},[]);var h=t.removeScrollBar,m=t.inert;return x.createElement(x.Fragment,null,m?x.createElement(o,{styles:cD(i)}):null,h?x.createElement(eD,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function fD(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const hD=HI(Nx,dD);var Rx=x.forwardRef(function(t,e){return x.createElement(Hc,wn({},t,{ref:e,sideCar:hD}))});Rx.classNames=Hc.classNames;var zc="Popover",[Ix]=uh(zc,[Pc]),Zs=Pc(),[pD,$r]=Ix(zc),Dx=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:s=!1}=t,a=Zs(e),l=x.useRef(null),[c,u]=x.useState(!1),[d,f]=Vv({prop:r,defaultProp:i??!1,onChange:o,caller:zc});return p.jsx(Fv,{...a,children:p.jsx(pD,{scope:e,contentId:bv(),triggerRef:l,open:d,onOpenChange:f,onOpenToggle:x.useCallback(()=>f(h=>!h),[f]),hasCustomAnchor:c,onCustomAnchorAdd:x.useCallback(()=>u(!0),[]),onCustomAnchorRemove:x.useCallback(()=>u(!1),[]),modal:s,children:n})})};Dx.displayName=zc;var Lx="PopoverAnchor",mD=x.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=$r(Lx,n),o=Zs(n),{onCustomAnchorAdd:s,onCustomAnchorRemove:a}=i;return x.useEffect(()=>(s(),()=>a()),[s,a]),p.jsx(xh,{...o,...r,ref:e})});mD.displayName=Lx;var Px="PopoverTrigger",Bx=x.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=$r(Px,n),o=Zs(n),s=Dn(e,i.triggerRef),a=p.jsx(pn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":zx(i.open),...r,ref:s,onClick:At(t.onClick,i.onOpenToggle)});return i.hasCustomAnchor?a:p.jsx(xh,{asChild:!0,...o,children:a})});Bx.displayName=Px;var Nh="PopoverPortal",[gD,yD]=Ix(Nh,{forceMount:void 0}),$x=t=>{const{__scopePopover:e,forceMount:n,children:r,container:i}=t,o=$r(Nh,e);return p.jsx(gD,{scope:e,forceMount:n,children:p.jsx(Bc,{present:n||o.open,children:p.jsx(Uv,{asChild:!0,container:i,children:r})})})};$x.displayName=Nh;var lo="PopoverContent",jx=x.forwardRef((t,e)=>{const n=yD(lo,t.__scopePopover),{forceMount:r=n.forceMount,...i}=t,o=$r(lo,t.__scopePopover);return p.jsx(Bc,{present:r||o.open,children:o.modal?p.jsx(vD,{...i,ref:e}):p.jsx(xD,{...i,ref:e})})});jx.displayName=lo;var bD=pv("PopoverContent.RemoveScroll"),vD=x.forwardRef((t,e)=>{const n=$r(lo,t.__scopePopover),r=x.useRef(null),i=Dn(e,r),o=x.useRef(!1);return x.useEffect(()=>{const s=r.current;if(s)return OI(s)},[]),p.jsx(Rx,{as:bD,allowPinchZoom:!0,children:p.jsx(Fx,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:At(t.onCloseAutoFocus,s=>{var a;s.preventDefault(),o.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:At(t.onPointerDownOutside,s=>{const a=s.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;o.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:At(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),xD=x.forwardRef((t,e)=>{const n=$r(lo,t.__scopePopover),r=x.useRef(!1),i=x.useRef(!1);return p.jsx(Fx,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var s,a;(s=t.onCloseAutoFocus)==null||s.call(t,o),o.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),o.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:o=>{var l,c;(l=t.onInteractOutside)==null||l.call(t,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const s=o.target;((c=n.triggerRef.current)==null?void 0:c.contains(s))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),Fx=x.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...d}=t,f=$r(lo,n),h=Zs(n);return xI(),p.jsx(Ex,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:p.jsx(dh,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>f.onOpenChange(!1),children:p.jsx(Hv,{"data-state":zx(f.open),role:"dialog",id:f.contentId,...h,...d,ref:e,style:{...d.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)"}})})})}),Hx="PopoverClose",wD=x.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=$r(Hx,n);return p.jsx(pn.button,{type:"button",...r,ref:e,onClick:At(t.onClick,()=>i.onOpenChange(!1))})});wD.displayName=Hx;var ED="PopoverArrow",kD=x.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=Zs(n);return p.jsx(zv,{...i,...r,ref:e})});kD.displayName=ED;function zx(t){return t?"open":"closed"}var CD=Dx,SD=Bx,_D=$x,Ux=jx;const Tn=()=>new Map,nf=t=>{const e=Tn();return t.forEach((n,r)=>{e.set(r,n)}),e},Eo=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r},ND=(t,e)=>{const n=[];for(const[r,i]of t)n.push(e(i,r));return n},TD=(t,e)=>{for(const[n,r]of t)if(e(r,n))return!0;return!1},co=()=>new Set,Ku=t=>t[t.length-1],uo=Array.from,Th=(t,e)=>{for(let n=0;n<t.length;n++)if(!e(t[n],n,t))return!1;return!0},Vx=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1},AD=(t,e)=>{const n=new Array(t);for(let r=0;r<t;r++)n[r]=e(r,n);return n},Uc=Array.isArray;class MD{constructor(){this._observers=Tn()}on(e,n){return Eo(this._observers,e,co).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 uo((this._observers.get(e)||Tn()).values()).forEach(r=>r(...n))}destroy(){this._observers=Tn()}}const Zn=Math.floor,Xa=Math.abs,Wx=(t,e)=>t<e?t:e,ko=(t,e)=>t>e?t:e,OD=t=>t!==0?t<0:1/t<0,vg=1,xg=2,Gu=4,qu=8,RD=32,Kx=64,Sl=128,ID=31,wg=63,Xo=127,DD=2147483647,Eg=Number.MAX_SAFE_INTEGER,kg=Number.MIN_SAFE_INTEGER,LD=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&Zn(t)===t),PD=String.fromCharCode,BD=t=>t.toLowerCase(),$D=/^\s*/g,jD=t=>t.replace($D,""),FD=/([A-Z])/g,Cg=(t,e)=>jD(t.replace(FD,n=>`${e}${BD(n)}`)),HD=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},Cs=typeof TextEncoder<"u"?new TextEncoder:null,zD=t=>Cs.encode(t),UD=Cs?zD:HD;let Yu=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Yu&&Yu.decode(new Uint8Array).length===1&&(Yu=null);const VD=(t,e)=>AD(e,()=>t).join("");class Qs{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const Ah=()=>new Qs,WD=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},Kn=t=>{const e=new Uint8Array(WD(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},KD=(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(ko(n,e)*2),t.cpos=0)},nt=(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},rf=nt,De=(t,e)=>{for(;e>Xo;)nt(t,Sl|Xo&e),e=Zn(e/128);nt(t,Xo&e)},Mh=(t,e)=>{const n=OD(e);for(n&&(e=-e),nt(t,(e>wg?Sl:0)|(n?Kx:0)|wg&e),e=Zn(e/64);e>0;)nt(t,(e>Xo?Sl:0)|Xo&e),e=Zn(e/128)},of=new Uint8Array(3e4),GD=of.length/3,qD=(t,e)=>{if(e.length<GD){const n=Cs.encodeInto(e,of).written||0;De(t,n);for(let r=0;r<n;r++)nt(t,of[r])}else Bt(t,UD(e))},YD=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;De(t,r);for(let i=0;i<r;i++)nt(t,n.codePointAt(i))},Ki=Cs&&Cs.encodeInto?qD:YD,Oh=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=Wx(n-r,e.length),o=e.length-i;t.cbuf.set(e.subarray(0,i),r),t.cpos+=i,o>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(ko(n*2,o)),t.cbuf.set(e.subarray(i)),t.cpos=o)},Bt=(t,e)=>{De(t,e.byteLength),Oh(t,e)},Rh=(t,e)=>{KD(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},JD=(t,e)=>Rh(t,4).setFloat32(0,e,!1),XD=(t,e)=>Rh(t,8).setFloat64(0,e,!1),ZD=(t,e)=>Rh(t,8).setBigInt64(0,e,!1),Sg=new DataView(new ArrayBuffer(4)),QD=t=>(Sg.setFloat32(0,t),Sg.getFloat32(0)===t),Ss=(t,e)=>{switch(typeof e){case"string":nt(t,119),Ki(t,e);break;case"number":LD(e)&&Xa(e)<=DD?(nt(t,125),Mh(t,e)):QD(e)?(nt(t,124),JD(t,e)):(nt(t,123),XD(t,e));break;case"bigint":nt(t,122),ZD(t,e);break;case"object":if(e===null)nt(t,126);else if(Uc(e)){nt(t,117),De(t,e.length);for(let n=0;n<e.length;n++)Ss(t,e[n])}else if(e instanceof Uint8Array)nt(t,116),Bt(t,e);else{nt(t,118);const n=Object.keys(e);De(t,n.length);for(let r=0;r<n.length;r++){const i=n[r];Ki(t,i),Ss(t,e[i])}}break;case"boolean":nt(t,e?120:121);break;default:nt(t,127)}};class _g extends Qs{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&De(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const Ng=t=>{t.count>0&&(Mh(t.encoder,t.count===1?t.s:-t.s),t.count>1&&De(t.encoder,t.count-2))};class Za{constructor(){this.encoder=new Qs,this.s=0,this.count=0}write(e){this.s===e?this.count++:(Ng(this),this.count=1,this.s=e)}toUint8Array(){return Ng(this),Kn(this.encoder)}}const Tg=t=>{if(t.count>0){const e=t.diff*2+(t.count===1?0:1);Mh(t.encoder,e),t.count>1&&De(t.encoder,t.count-2)}};class Ju{constructor(){this.encoder=new Qs,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(Tg(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return Tg(this),Kn(this.encoder)}}class eL{constructor(){this.sarr=[],this.s="",this.lensE=new Za}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 Qs;return this.sarr.push(this.s),this.s="",Ki(e,this.sarr.join("")),Oh(e,this.lensE.toUint8Array()),Kn(e)}}const Mr=t=>new Error(t),ln=()=>{throw Mr("Method unimplemented")},Rn=()=>{throw Mr("Unexpected case")},tL=crypto.getRandomValues.bind(crypto),Gx=()=>tL(new Uint32Array(1))[0],nL="10000000-1000-4000-8000"+-1e11,rL=()=>nL.replace(/[018]/g,t=>(t^Gx()&15>>t/4).toString(16)),Ag=t=>new Promise(t);Promise.all.bind(Promise);const Mg=t=>t===void 0?null:t;class iL{constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let qx=new iL,oL=!0;try{typeof localStorage<"u"&&localStorage&&(qx=localStorage,oL=!1)}catch{}const sL=qx,_s=Symbol("Equality"),Yx=(t,e)=>{var n;return t===e||!!((n=t==null?void 0:t[_s])!=null&&n.call(t,e))||!1},aL=t=>typeof t=="object",lL=Object.assign,cL=Object.keys,uL=(t,e)=>{for(const n in t)e(t[n],n)},_l=t=>cL(t).length,dL=t=>{for(const e in t)return!1;return!0},ea=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},Ih=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),fL=(t,e)=>t===e||_l(t)===_l(e)&&ea(t,(n,r)=>(n!==void 0||Ih(e,r))&&Yx(e[r],n)),hL=Object.freeze,Jx=t=>{for(const e in t){const n=t[e];(typeof n=="object"||typeof n=="function")&&Jx(t[e])}return hL(t)},Dh=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&Dh(t,e,n+1)}},Qa=(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[_s]!=null)return t[_s](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)||!Qa(t.get(n),e.get(n)))return!1;break}case void 0:case Object:if(_l(t)!==_l(e))return!1;for(const n in t)if(!Ih(t,n)||!Qa(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(!Qa(t[n],e[n]))return!1;break;default:return!1}return!0},pL=(t,e)=>e.includes(t);var Xx={};const Ns=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]";let mn;const mL=()=>{if(mn===void 0)if(Ns){mn=Tn();const t=process.argv;let e=null;for(let n=0;n<t.length;n++){const r=t[n];r[0]==="-"?(e!==null&&mn.set(e,""),e=r):e!==null&&(mn.set(e,r),e=null)}e!==null&&mn.set(e,"")}else typeof location=="object"?(mn=Tn(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){const[e,n]=t.split("=");mn.set(`--${Cg(e,"-")}`,n),mn.set(`-${Cg(e,"-")}`,n)}})):mn=Tn();return mn},sf=t=>mL().has(t),Nl=t=>Mg(Ns?Xx[t.toUpperCase().replaceAll("-","_")]:sL.getItem(t)),Zx=t=>sf("--"+t)||Nl(t)!==null,gL=Zx("production"),yL=Ns&&pL(Xx.FORCE_COLOR,["true","1","2"]),bL=yL||!sf("--no-colors")&&!Zx("no-color")&&(!Ns||process.stdout.isTTY)&&(!Ns||sf("--color")||Nl("COLORTERM")!==null||(Nl("TERM")||"").includes("color"));class vL{constructor(e,n){this.left=e,this.right=n}}const $n=(t,e)=>new vL(t,e),Og=t=>t.next()>=.5,Xu=(t,e,n)=>Zn(t.next()*(n+1-e)+e),Qx=(t,e,n)=>Zn(t.next()*(n+1-e)+e),Lh=(t,e,n)=>Qx(t,e,n),xL=t=>PD(Lh(t,97,122)),wL=(t,e=0,n=20)=>{const r=Lh(t,e,n);let i="";for(let o=0;o<r;o++)i+=xL(t);return i},Zu=(t,e)=>e[Lh(t,0,e.length-1)],EL=Symbol("0schema");class kL{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(VD(" ",(this._rerrs.length-n)*2)+`${r.path!=null?`[${r.path}] `:""}${r.has} doesn't match ${r.expected}. ${r.message}`)}return e.join(`
476
- `)}}const af=(t,e)=>t===e?!0:t==null||e==null||t.constructor!==e.constructor?!1:t[_s]?Yx(t,e):Uc(t)?Th(t,n=>Vx(e,r=>af(n,r))):aL(t)?ea(t,(n,r)=>af(n,e[r])):!1;class Et{extends(e){let[n,r]=[this.shape,e.shape];return this.constructor._dilutes&&([r,n]=[n,r]),af(n,r)}equals(e){return this.constructor===e.constructor&&Qa(this.shape,e.shape)}[EL](){return!0}[_s](e){return this.equals(e)}validate(e){return this.check(e)}check(e,n){ln()}get nullable(){return Co(this,qc)}get optional(){return new nw(this)}cast(e){return Rg(e,this),e}expect(e){return Rg(e,this),e}}sa(Et,"_dilutes",!1);class Ph extends Et{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n=void 0){const r=(e==null?void 0:e.constructor)===this.shape&&(this._c==null||this._c(e));return!r&&(n==null||n.extend(null,this.shape.name,e==null?void 0:e.constructor.name,(e==null?void 0:e.constructor)!==this.shape?"Constructor match failed":"Check failed")),r}}const et=(t,e=null)=>new Ph(t,e);et(Ph);class Bh extends Et{constructor(e){super(),this.shape=e}check(e,n){const r=this.shape(e);return!r&&(n==null||n.extend(null,"custom prop",e==null?void 0:e.constructor.name,"failed to check custom prop")),r}}const at=t=>new Bh(t);et(Bh);class Vc extends Et{constructor(e){super(),this.shape=e}check(e,n){const r=this.shape.some(i=>i===e);return!r&&(n==null||n.extend(null,this.shape.join(" | "),e.toString())),r}}const Wc=(...t)=>new Vc(t),ew=et(Vc),CL=RegExp.escape||(t=>t.replace(/[().|&,$^[\]]/g,e=>"\\"+e)),tw=t=>{if(fo.check(t))return[CL(t)];if(ew.check(t))return t.shape.map(e=>e+"");if(dw.check(t))return["[+-]?\\d+.?\\d*"];if(fw.check(t))return[".*"];if(Al.check(t))return t.shape.map(tw).flat(1);Rn()};class SL extends Et{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(tw).map(n=>`(${n.join("|")})`).join("")+"$")}check(e,n){const r=this._r.exec(e)!=null;return!r&&(n==null||n.extend(null,this._r.toString(),e.toString(),"String doesn't match string template.")),r}}et(SL);const _L=Symbol("optional");class nw extends Et{constructor(e){super(),this.shape=e}check(e,n){const r=e===void 0||this.shape.check(e);return!r&&(n==null||n.extend(null,"undefined (optional)","()")),r}get[_L](){return!0}}const NL=et(nw);class TL extends Et{check(e,n){return n==null||n.extend(null,"never",typeof e),!1}}et(TL);const mc=class mc extends Et{constructor(e,n=!1){super(),this.shape=e,this._isPartial=n}get partial(){return new mc(this.shape,!0)}check(e,n){return e==null?(n==null||n.extend(null,"object","null"),!1):ea(this.shape,(r,i)=>{const o=this._isPartial&&!Ih(e,i)||r.check(e[i],n);return!o&&(n==null||n.extend(i.toString(),r.toString(),typeof e[i],"Object property does not match")),o})}};sa(mc,"_dilutes",!0);let Tl=mc;const AL=t=>new Tl(t),ML=et(Tl),OL=at(t=>t!=null&&(t.constructor===Object||t.constructor==null));class rw extends Et{constructor(e,n){super(),this.shape={keys:e,values:n}}check(e,n){return e!=null&&ea(e,(r,i)=>{const o=this.shape.keys.check(i,n);return!o&&(n==null||n.extend(i+"","Record",typeof e,o?"Key doesn't match schema":"Value doesn't match value")),o&&this.shape.values.check(r,n)})}}const iw=(t,e)=>new rw(t,e),RL=et(rw);class ow extends Et{constructor(e){super(),this.shape=e}check(e,n){return e!=null&&ea(this.shape,(r,i)=>{const o=r.check(e[i],n);return!o&&(n==null||n.extend(i.toString(),"Tuple",typeof r)),o})}}const IL=(...t)=>new ow(t);et(ow);class sw extends Et{constructor(e){super(),this.shape=e.length===1?e[0]:new Kc(e)}check(e,n){const r=Uc(e)&&Th(e,i=>this.shape.check(i));return!r&&(n==null||n.extend(null,"Array","")),r}}const aw=(...t)=>new sw(t),DL=et(sw),LL=at(t=>Uc(t));class lw extends Et{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==null||n.extend(null,this.shape.name,e==null?void 0:e.constructor.name)),r}}const PL=(t,e=null)=>new lw(t,e);et(lw);const BL=PL(Et);class $L extends Et{constructor(e){super(),this.len=e.length-1,this.args=IL(...e.slice(-1)),this.res=e[this.len]}check(e,n){const r=e.constructor===Function&&e.length<=this.len;return!r&&(n==null||n.extend(null,"function",typeof e)),r}}const jL=et($L),FL=at(t=>typeof t=="function");class HL extends Et{constructor(e){super(),this.shape=e}check(e,n){const r=Th(this.shape,i=>i.check(e,n));return!r&&(n==null||n.extend(null,"Intersectinon",typeof e)),r}}et(HL,t=>t.shape.length>0);class Kc extends Et{constructor(e){super(),this.shape=e}check(e,n){const r=Vx(this.shape,i=>i.check(e,n));return n==null||n.extend(null,"Union",typeof e),r}}sa(Kc,"_dilutes",!0);const Co=(...t)=>t.findIndex(e=>Al.check(e))>=0?Co(...t.map(e=>Ts(e)).map(e=>Al.check(e)?e.shape:[e]).flat(1)):t.length===1?t[0]:new Kc(t),Al=et(Kc),cw=()=>!0,Ml=at(cw),zL=et(Bh,t=>t.shape===cw),$h=at(t=>typeof t=="bigint"),UL=at(t=>t===$h),uw=at(t=>typeof t=="symbol");at(t=>t===uw);const Gi=at(t=>typeof t=="number"),dw=at(t=>t===Gi),fo=at(t=>typeof t=="string"),fw=at(t=>t===fo),Gc=at(t=>typeof t=="boolean"),VL=at(t=>t===Gc),hw=Wc(void 0);et(Vc,t=>t.shape.length===1&&t.shape[0]===void 0);Wc(void 0);const qc=Wc(null),WL=et(Vc,t=>t.shape.length===1&&t.shape[0]===null);et(Uint8Array);et(Ph,t=>t.shape===Uint8Array);const KL=Co(Gi,fo,qc,hw,$h,Gc,uw);(()=>{const t=aw(Ml),e=iw(fo,Ml),n=Co(Gi,fo,qc,Gc,t,e);return t.shape=n,e.shape.values=n,n})();const Ts=t=>{if(BL.check(t))return t;if(OL.check(t)){const e={};for(const n in t)e[n]=Ts(t[n]);return AL(e)}else{if(LL.check(t))return Co(...t.map(Ts));if(KL.check(t))return Wc(t);if(FL.check(t))return et(t)}Rn()},Rg=gL?()=>{}:(t,e)=>{const n=new kL;if(!e.check(t,n))throw Mr(`Expected value to be of type ${e.constructor.name}.
477
- ${n.toString()}`)};class GL{constructor(e){this.patterns=[],this.$state=e}if(e,n){return this.patterns.push({if:Ts(e),h:n}),this}else(e){return this.if(Ml,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 Mr("Unhandled pattern")}}}const qL=t=>new GL(t),pw=qL(Ml).if(dw,(t,e)=>Xu(e,kg,Eg)).if(fw,(t,e)=>wL(e)).if(VL,(t,e)=>Og(e)).if(UL,(t,e)=>BigInt(Xu(e,kg,Eg))).if(Al,(t,e)=>Ti(e,Zu(e,t.shape))).if(ML,(t,e)=>{const n={};for(const r in t.shape){let i=t.shape[r];if(NL.check(i)){if(Og(e))continue;i=i.shape}n[r]=pw(i,e)}return n}).if(DL,(t,e)=>{const n=[],r=Qx(e,0,42);for(let i=0;i<r;i++)n.push(Ti(e,t.shape));return n}).if(ew,(t,e)=>Zu(e,t.shape)).if(WL,(t,e)=>null).if(jL,(t,e)=>{const n=Ti(e,t.res);return()=>n}).if(zL,(t,e)=>Ti(e,Zu(e,[Gi,fo,qc,hw,$h,Gc,aw(Gi),iw(Co("a","b","c"),Gi)]))).if(RL,(t,e)=>{const n={},r=Xu(e,0,3);for(let i=0;i<r;i++){const o=Ti(e,t.shape.keys),s=Ti(e,t.shape.values);n[o]=s}return n}).done(),Ti=(t,e)=>pw(Ts(e),t),Yc=typeof document<"u"?document:{};at(t=>t.nodeType===QL);typeof DOMParser<"u"&&new DOMParser;at(t=>t.nodeType===JL);at(t=>t.nodeType===XL);const YL=t=>ND(t,(e,n)=>`${n}:${e};`).join(""),JL=Yc.ELEMENT_NODE,XL=Yc.TEXT_NODE,ZL=Yc.DOCUMENT_NODE,QL=Yc.DOCUMENT_FRAGMENT_NODE;at(t=>t.nodeType===ZL);const ir=Symbol,mw=ir(),gw=ir(),eP=ir(),tP=ir(),nP=ir(),yw=ir(),rP=ir(),jh=ir(),iP=ir(),oP=t=>{var i;t.length===1&&((i=t[0])==null?void 0:i.constructor)===Function&&(t=t[0]());const e=[],n=[];let r=0;for(;r<t.length;r++){const o=t[r];if(o===void 0)break;if(o.constructor===String||o.constructor===Number)e.push(o);else if(o.constructor===Object)break}for(r>0&&n.push(e.join(""));r<t.length;r++){const o=t[r];o instanceof Symbol||n.push(o)}return n},sP={[mw]:$n("font-weight","bold"),[gw]:$n("font-weight","normal"),[eP]:$n("color","blue"),[nP]:$n("color","green"),[tP]:$n("color","grey"),[yw]:$n("color","red"),[rP]:$n("color","purple"),[jh]:$n("color","orange"),[iP]:$n("color","black")},aP=t=>{var s;t.length===1&&((s=t[0])==null?void 0:s.constructor)===Function&&(t=t[0]());const e=[],n=[],r=Tn();let i=[],o=0;for(;o<t.length;o++){const a=t[o],l=sP[a];if(l!==void 0)r.set(l.left,l.right);else{if(a===void 0)break;if(a.constructor===String||a.constructor===Number){const c=YL(r);o>0||c.length>0?(e.push("%c"+a),n.push(c)):e.push(a)}else break}}for(o>0&&(i=n,i.unshift(e.join("")));o<t.length;o++){const a=t[o];a instanceof Symbol||i.push(a)}return i},bw=bL?aP:oP,lP=(...t)=>{console.log(...bw(t)),vw.forEach(e=>e.print(t))},cP=(...t)=>{console.warn(...bw(t)),t.unshift(jh),vw.forEach(e=>e.print(t))},vw=co(),xw=t=>({[Symbol.iterator](){return this},next:t}),uP=(t,e)=>xw(()=>{let n;do n=t.next();while(!n.done&&!e(n.value));return n}),Qu=(t,e)=>xw(()=>{const{done:n,value:r}=t.next();return{done:n,value:n?void 0:e(r)}});class ww{constructor(e,n){this.clock=e,this.len=n}}class dP{constructor(){this.clients=new Map}}const Ew=(t,e,n)=>e.clients.forEach((r,i)=>{const o=t.doc.store.clients.get(i);if(o!=null){const s=o[o.length-1],a=s.id.clock+s.length;for(let l=0,c=r[l];l<r.length&&c.clock<a;c=r[++l])Aw(t,o,c.clock,c.len,n)}}),fP=(t,e)=>{let n=0,r=t.length-1;for(;n<=r;){const i=Zn((n+r)/2),o=t[i],s=o.clock;if(s<=e){if(e<s+o.len)return i;n=i+1}else r=i-1}return null},kw=(t,e)=>{const n=t.clients.get(e.client);return n!==void 0&&fP(n,e.clock)!==null},Cw=t=>{t.clients.forEach(e=>{e.sort((i,o)=>i.clock-o.clock);let n,r;for(n=1,r=1;n<e.length;n++){const i=e[r-1],o=e[n];i.clock+i.len>=o.clock?e[r-1]=new ww(i.clock,ko(i.len,o.clock+o.len-i.clock)):(r<n&&(e[r]=o),r++)}e.length=r})},Sw=(t,e,n,r)=>{Eo(t.clients,e,()=>[]).push(new ww(n,r))},hP=(t,e)=>{De(t.restEncoder,e.clients.size),uo(e.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{t.resetDsCurVal(),De(t.restEncoder,n);const i=r.length;De(t.restEncoder,i);for(let o=0;o<i;o++){const s=r[o];t.writeDsClock(s.clock),t.writeDsLen(s.len)}})},_w=Gx;class ta extends MD{constructor({guid:e=rL(),collectionid:n=null,gc:r=!0,gcFilter:i=()=>!0,meta:o=null,autoLoad:s=!1,shouldLoad:a=!0}={}){super(),this.gc=r,this.gcFilter=i,this.clientID=_w(),this.guid=e,this.collectionid=n,this.share=new Map,this.store=new EP,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=a,this.autoLoad=s,this.meta=o,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=Ag(c=>{this.on("load",()=>{this.isLoaded=!0,c(this)})});const l=()=>Ag(c=>{const u=d=>{(d===void 0||d===!0)&&(this.off("sync",u),c())};this.on("sync",u)});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&&Fe(e.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(uo(this.subdocs).map(e=>e.guid))}transact(e,n=null){return Fe(this,e,n)}get(e,n=gt){const r=Eo(this.share,e,()=>{const o=new n;return o._integrate(this,null),o}),i=r.constructor;if(n!==gt&&i!==n)if(i===gt){const o=new n;o._map=r._map,r._map.forEach(s=>{for(;s!==null;s=s.left)s.parent=o}),o._start=r._start;for(let s=o._start;s!==null;s=s.right)s.parent=o;return o._length=r._length,this.share.set(e,o),o._integrate(this,null),o}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,Zo)}getText(e=""){return this.get(e,Rs)}getMap(e=""){return this.get(e,Dl)}getXmlElement(e=""){return this.get(e,Is)}getXmlFragment(e=""){return this.get(e,ho)}toJSON(){const e={};return this.share.forEach((n,r)=>{e[r]=n.toJSON()}),e}destroy(){this.isDestroyed=!0,uo(this.subdocs).forEach(n=>n.destroy());const e=this._item;if(e!==null){this._item=null;const n=e.content;n.doc=new ta({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=e,Fe(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 pP{constructor(){this.restEncoder=Ah()}toUint8Array(){return Kn(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){De(this.restEncoder,e)}writeDsLen(e){De(this.restEncoder,e)}}class mP extends pP{writeLeftID(e){De(this.restEncoder,e.client),De(this.restEncoder,e.clock)}writeRightID(e){De(this.restEncoder,e.client),De(this.restEncoder,e.clock)}writeClient(e){De(this.restEncoder,e)}writeInfo(e){rf(this.restEncoder,e)}writeString(e){Ki(this.restEncoder,e)}writeParentInfo(e){De(this.restEncoder,e?1:0)}writeTypeRef(e){De(this.restEncoder,e)}writeLen(e){De(this.restEncoder,e)}writeAny(e){Ss(this.restEncoder,e)}writeBuf(e){Bt(this.restEncoder,e)}writeJSON(e){Ki(this.restEncoder,JSON.stringify(e))}writeKey(e){Ki(this.restEncoder,e)}}class gP{constructor(){this.restEncoder=Ah(),this.dsCurrVal=0}toUint8Array(){return Kn(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const n=e-this.dsCurrVal;this.dsCurrVal=e,De(this.restEncoder,n)}writeDsLen(e){e===0&&Rn(),De(this.restEncoder,e-1),this.dsCurrVal+=e}}class yP extends gP{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new Ju,this.clientEncoder=new Za,this.leftClockEncoder=new Ju,this.rightClockEncoder=new Ju,this.infoEncoder=new _g(rf),this.stringEncoder=new eL,this.parentInfoEncoder=new _g(rf),this.typeRefEncoder=new Za,this.lenEncoder=new Za}toUint8Array(){const e=Ah();return De(e,0),Bt(e,this.keyClockEncoder.toUint8Array()),Bt(e,this.clientEncoder.toUint8Array()),Bt(e,this.leftClockEncoder.toUint8Array()),Bt(e,this.rightClockEncoder.toUint8Array()),Bt(e,Kn(this.infoEncoder)),Bt(e,this.stringEncoder.toUint8Array()),Bt(e,Kn(this.parentInfoEncoder)),Bt(e,this.typeRefEncoder.toUint8Array()),Bt(e,this.lenEncoder.toUint8Array()),Oh(e,Kn(this.restEncoder)),Kn(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){Ss(this.restEncoder,e)}writeBuf(e){Bt(this.restEncoder,e)}writeJSON(e){Ss(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 bP=(t,e,n,r)=>{r=ko(r,e[0].id.clock);const i=Qn(e,r);De(t.restEncoder,e.length-i),t.writeClient(n),De(t.restEncoder,r);const o=e[i];o.write(t,r-o.id.clock);for(let s=i+1;s<e.length;s++)e[s].write(t,0)},vP=(t,e,n)=>{const r=new Map;n.forEach((i,o)=>{Ot(e,o)>i&&r.set(o,i)}),Fh(e).forEach((i,o)=>{n.has(o)||r.set(o,0)}),De(t.restEncoder,r.size),uo(r.entries()).sort((i,o)=>o[0]-i[0]).forEach(([i,o])=>{bP(t,e.clients.get(i),i,o)})},xP=(t,e)=>vP(t,e.doc.store,e.beforeState);class wP{constructor(){this.l=[]}}const Ig=()=>new wP,Dg=(t,e)=>t.l.push(e),Lg=(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.")},Nw=(t,e,n)=>Dh(t.l,[e,n]);class el{constructor(e,n){this.client=e,this.clock=n}}const Ea=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,Ue=(t,e)=>new el(t,e),As=t=>{for(const[e,n]of t.doc.share.entries())if(n===t)return e;throw Rn()};class Ol{constructor(e,n,r,i=0){this.type=e,this.tname=n,this.item=r,this.assoc=i}}const ka=(t,e,n)=>{let r=null,i=null;return t._item===null?i=As(t):r=Ue(t._item.id.client,t._item.id.clock),new Ol(r,i,e,n)},ed=(t,e,n=0)=>{let r=t._start;if(n<0){if(e===0)return ka(t,null,n);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return ka(t,Ue(r.id.client,r.id.clock+e),n);e-=r.length}if(r.right===null&&n<0)return ka(t,r.lastId,n);r=r.right}return ka(t,null,n)},Li=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!kw(e.ds,t.id),lf=(t,e)=>{const n=Eo(t.meta,lf,co),r=t.doc.store;n.has(e)||(e.sv.forEach((i,o)=>{i<Ot(r,o)&&Or(t,Ue(o,i))}),Ew(t,e.ds,i=>{}),n.add(e))};class EP{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const Fh=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},Ot=(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},Tw=(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 Rn()}n.push(e)},Qn=(t,e)=>{let n=0,r=t.length-1,i=t[r],o=i.id.clock;if(o===e)return r;let s=Zn(e/(o+i.length-1)*r);for(;n<=r;){if(i=t[s],o=i.id.clock,o<=e){if(e<o+i.length)return s;n=s+1}else r=s-1;s=Zn((n+r)/2)}throw Rn()},kP=(t,e)=>{const n=t.clients.get(e.client);return n[Qn(n,e.clock)]},td=kP,cf=(t,e,n)=>{const r=Qn(e,n),i=e[r];return i.id.clock<n&&i instanceof Ft?(e.splice(r+1,0,Gw(t,i,n-i.id.clock)),r+1):r},Or=(t,e)=>{const n=t.doc.store.clients.get(e.client);return n[cf(t,n,e.clock)]},Pg=(t,e,n)=>{const r=e.clients.get(n.client),i=Qn(r,n.clock),o=r[i];return n.clock!==o.id.clock+o.length-1&&o.constructor!==pr&&r.splice(i+1,0,Gw(t,o,n.clock-o.id.clock+1)),o},CP=(t,e,n)=>{const r=t.clients.get(e.id.client);r[Qn(r,e.id.clock)]=n},Aw=(t,e,n,r,i)=>{if(r===0)return;const o=n+r;let s=cf(t,e,n),a;do a=e[s++],o<a.id.clock+a.length&&cf(t,e,o),i(a);while(s<e.length&&e[s].id.clock<o)};class SP{constructor(e,n,r){this.doc=e,this.deleteSet=new dP,this.beforeState=Fh(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 Bg=(t,e)=>e.deleteSet.clients.size===0&&!TD(e.afterState,(n,r)=>e.beforeState.get(r)!==n)?!1:(Cw(e.deleteSet),xP(t,e),hP(t,e.deleteSet),!0),$g=(t,e,n)=>{const r=e._item;(r===null||r.id.clock<(t.beforeState.get(r.id.client)||0)&&!r.deleted)&&Eo(t.changed,e,co).add(n)},tl=(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 Ft&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}const o=e-i;return o&&t.splice(e+1-o,o),o},_P=(t,e,n)=>{for(const[r,i]of t.clients.entries()){const o=e.clients.get(r);for(let s=i.length-1;s>=0;s--){const a=i[s],l=a.clock+a.len;for(let c=Qn(o,a.clock),u=o[c];c<o.length&&u.id.clock<l;u=o[++c]){const d=o[c];if(a.clock+a.len<=d.id.clock)break;d instanceof Ft&&d.deleted&&!d.keep&&n(d)&&d.gc(e,!1)}}}},NP=(t,e)=>{t.clients.forEach((n,r)=>{const i=e.clients.get(r);for(let o=n.length-1;o>=0;o--){const s=n[o],a=Wx(i.length-1,1+Qn(i,s.clock+s.len-1));for(let l=a,c=i[l];l>0&&c.id.clock>=s.clock;c=i[l])l-=1+tl(i,l)}})},Mw=(t,e)=>{if(e<t.length){const n=t[e],r=n.doc,i=r.store,o=n.deleteSet,s=n._mergeStructs;try{Cw(o),n.afterState=Fh(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(u=>u.target._item===null||!u.target._item.deleted),l.forEach(u=>{u.currentTarget=c,u._path=null}),l.sort((u,d)=>u.path.length-d.path.length),a.push(()=>{Nw(c._dEH,l,n)}))}),a.push(()=>r.emit("afterTransaction",[n,r])),a.push(()=>{n._needFormattingCleanup&&jP(n)})}),Dh(a,[])}finally{r.gc&&_P(o,i,r.gcFilter),NP(o,i),n.afterState.forEach((u,d)=>{const f=n.beforeState.get(d)||0;if(f!==u){const h=i.clients.get(d),m=ko(Qn(h,f),1);for(let g=h.length-1;g>=m;)g-=1+tl(h,g)}});for(let u=s.length-1;u>=0;u--){const{client:d,clock:f}=s[u].id,h=i.clients.get(d),m=Qn(h,f);m+1<h.length&&tl(h,m+1)>1||m>0&&tl(h,m)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(lP(jh,mw,"[yjs] ",gw,yw,"Changed the client-id because another client seems to be using it."),r.clientID=_w()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const u=new mP;Bg(u,n)&&r.emit("update",[u.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const u=new yP;Bg(u,n)&&r.emit("updateV2",[u.toUint8Array(),n.origin,r,n])}const{subdocsAdded:a,subdocsLoaded:l,subdocsRemoved:c}=n;(a.size>0||c.size>0||l.size>0)&&(a.forEach(u=>{u.clientID=r.clientID,u.collectionid==null&&(u.collectionid=r.collectionid),r.subdocs.add(u)}),c.forEach(u=>r.subdocs.delete(u)),r.emit("subdocs",[{loaded:l,added:a,removed:c},r,n]),c.forEach(u=>u.destroy())),t.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,t])):Mw(t,e+1)}}},Fe=(t,e,n=null,r=!0)=>{const i=t._transactionCleanups;let o=!1,s=null;t._transaction===null&&(o=!0,t._transaction=new SP(t,n,r),i.push(t._transaction),i.length===1&&t.emit("beforeAllTransactions",[t]),t.emit("beforeTransaction",[t._transaction,t]));try{s=e(t._transaction)}finally{if(o){const a=t._transaction===i[0];t._transaction=null,a&&Mw(i,0)}}return s},jg="You must not compute changes after the event-handler fired.";class Jc{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=TP(this.currentTarget,this.target))}deletes(e){return kw(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Mr(jg);const e=new Map,n=this.target;this.transaction.changed.get(n).forEach(i=>{if(i!==null){const o=n._map.get(i);let s,a;if(this.adds(o)){let l=o.left;for(;l!==null&&this.adds(l);)l=l.left;if(this.deletes(o))if(l!==null&&this.deletes(l))s="delete",a=Ku(l.content.getContent());else return;else l!==null&&this.deletes(l)?(s="update",a=Ku(l.content.getContent())):(s="add",a=void 0)}else if(this.deletes(o))s="delete",a=Ku(o.content.getContent());else return;e.set(i,{action:s,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 Mr(jg);const n=this.target,r=co(),i=co(),o=[];if(e={added:r,deleted:i,delta:o,keys:this.keys},this.transaction.changed.get(n).has(null)){let a=null;const l=()=>{a&&o.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 TP=(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},bt=()=>{cP("Invalid access: Add Yjs type to a document before reading data.")},Ow=80;let Hh=0;class AP{constructor(e,n){e.marker=!0,this.p=e,this.index=n,this.timestamp=Hh++}}const MP=t=>{t.timestamp=Hh++},Rw=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=Hh++},OP=(t,e,n)=>{if(t.length>=Ow){const r=t.reduce((i,o)=>i.timestamp<o.timestamp?i:o);return Rw(r,e,n),r}else{const r=new AP(e,n);return t.push(r),r}},Xc=(t,e)=>{if(t._start===null||e===0||t._searchMarker===null)return null;const n=t._searchMarker.length===0?null:t._searchMarker.reduce((o,s)=>Xa(e-o.index)<Xa(e-s.index)?o:s);let r=t._start,i=0;for(n!==null&&(r=n.p,i=n.index,MP(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&&Xa(n.index-i)<r.parent.length/Ow?(Rw(n,r,i),n):OP(t._searchMarker,r,i)},Ms=(t,e,n)=>{for(let r=t.length-1;r>=0;r--){const i=t[r];if(n>0){let o=i.p;for(o.marker=!1;o&&(o.deleted||!o.countable);)o=o.left,o&&!o.deleted&&o.countable&&(i.index-=o.length);if(o===null||o.marker===!0){t.splice(r,1);continue}i.p=o,o.marker=!0}(e<i.index||n>0&&e===i.index)&&(i.index=ko(e,i.index+n))}},Zc=(t,e,n)=>{const r=t,i=e.changedParentTypes;for(;Eo(i,t,()=>[]).push(n),t._item!==null;)t=t._item.parent;Nw(r._eH,n,e)};class gt{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=Ig(),this._dEH=Ig(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,n){this.doc=e,this._item=n}_copy(){throw ln()}clone(){throw ln()}_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){Dg(this._eH,e)}observeDeep(e){Dg(this._dEH,e)}unobserve(e){Lg(this._eH,e)}unobserveDeep(e){Lg(this._dEH,e)}toJSON(){}}const Iw=(t,e,n)=>{t.doc??bt(),e<0&&(e=t._length+e),n<0&&(n=t._length+n);let r=n-e;const i=[];let o=t._start;for(;o!==null&&r>0;){if(o.countable&&!o.deleted){const s=o.content.getContent();if(s.length<=e)e-=s.length;else{for(let a=e;a<s.length&&r>0;a++)i.push(s[a]),r--;e=0}}o=o.right}return i},Dw=t=>{t.doc??bt();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},Os=(t,e)=>{let n=0,r=t._start;for(t.doc??bt();r!==null;){if(r.countable&&!r.deleted){const i=r.content.getContent();for(let o=0;o<i.length;o++)e(i[o],n++,t)}r=r.right}},Lw=(t,e)=>{const n=[];return Os(t,(r,i)=>{n.push(e(r,i,t))}),n},RP=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}}}},Pw=(t,e)=>{t.doc??bt();const n=Xc(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}},Rl=(t,e,n,r)=>{let i=n;const o=t.doc,s=o.clientID,a=o.store,l=n===null?e._start:n.right;let c=[];const u=()=>{c.length>0&&(i=new Ft(Ue(s,Ot(a,s)),i,i&&i.lastId,l,l&&l.id,e,null,new po(c)),i.integrate(t,0),c=[])};r.forEach(d=>{if(d===null)c.push(d);else switch(d.constructor){case Number:case Object:case Boolean:case Array:case String:c.push(d);break;default:switch(u(),d.constructor){case Uint8Array:case ArrayBuffer:i=new Ft(Ue(s,Ot(a,s)),i,i&&i.lastId,l,l&&l.id,e,null,new Qc(new Uint8Array(d))),i.integrate(t,0);break;case ta:i=new Ft(Ue(s,Ot(a,s)),i,i&&i.lastId,l,l&&l.id,e,null,new eu(d)),i.integrate(t,0);break;default:if(d instanceof gt)i=new Ft(Ue(s,Ot(a,s)),i,i&&i.lastId,l,l&&l.id,e,null,new jr(d)),i.integrate(t,0);else throw new Error("Unexpected content type in insert operation")}}}),u()},Bw=()=>Mr("Length exceeded!"),$w=(t,e,n,r)=>{if(n>e._length)throw Bw();if(n===0)return e._searchMarker&&Ms(e._searchMarker,n,r.length),Rl(t,e,null,r);const i=n,o=Xc(e,n);let s=e._start;for(o!==null&&(s=o.p,n-=o.index,n===0&&(s=s.prev,n+=s&&s.countable&&!s.deleted?s.length:0));s!==null;s=s.right)if(!s.deleted&&s.countable){if(n<=s.length){n<s.length&&Or(t,Ue(s.id.client,s.id.clock+n));break}n-=s.length}return e._searchMarker&&Ms(e._searchMarker,i,r.length),Rl(t,e,s,r)},IP=(t,e,n)=>{let i=(e._searchMarker||[]).reduce((o,s)=>s.index>o.index?s:o,{index:0,p:e._start}).p;if(i)for(;i.right;)i=i.right;return Rl(t,e,i,n)},jw=(t,e,n,r)=>{if(r===0)return;const i=n,o=r,s=Xc(e,n);let a=e._start;for(s!==null&&(a=s.p,n-=s.index);a!==null&&n>0;a=a.right)!a.deleted&&a.countable&&(n<a.length&&Or(t,Ue(a.id.client,a.id.clock+n)),n-=a.length);for(;r>0&&a!==null;)a.deleted||(r<a.length&&Or(t,Ue(a.id.client,a.id.clock+r)),a.delete(t),r-=a.length),a=a.right;if(r>0)throw Bw();e._searchMarker&&Ms(e._searchMarker,i,-o+r)},Il=(t,e,n)=>{const r=e._map.get(n);r!==void 0&&r.delete(t)},zh=(t,e,n,r)=>{const i=e._map.get(n)||null,o=t.doc,s=o.clientID;let a;if(r==null)a=new po([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:a=new po([r]);break;case Uint8Array:a=new Qc(r);break;case ta:a=new eu(r);break;default:if(r instanceof gt)a=new jr(r);else throw new Error("Unexpected content type")}new Ft(Ue(s,Ot(o.store,s)),i,i&&i.lastId,null,null,e,n,a).integrate(t,0)},Uh=(t,e)=>{t.doc??bt();const n=t._map.get(e);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},Fw=t=>{const e={};return t.doc??bt(),t._map.forEach((n,r)=>{n.deleted||(e[r]=n.content.getContent()[n.length-1])}),e},Hw=(t,e)=>{t.doc??bt();const n=t._map.get(e);return n!==void 0&&!n.deleted},DP=(t,e)=>{const n={};return t._map.forEach((r,i)=>{let o=r;for(;o!==null&&(!e.sv.has(o.id.client)||o.id.clock>=(e.sv.get(o.id.client)||0));)o=o.left;o!==null&&Li(o,e)&&(n[i]=o.content.getContent()[o.length-1])}),n},Ca=t=>(t.doc??bt(),uP(t._map.entries(),e=>!e[1].deleted));class LP extends Jc{}class Zo extends gt{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const n=new Zo;return n.push(e),n}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Zo}clone(){const e=new Zo;return e.insert(0,this.toArray().map(n=>n instanceof gt?n.clone():n)),e}get length(){return this.doc??bt(),this._length}_callObserver(e,n){super._callObserver(e,n),Zc(this,e,new LP(this,e))}insert(e,n){this.doc!==null?Fe(this.doc,r=>{$w(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}push(e){this.doc!==null?Fe(this.doc,n=>{IP(n,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,n=1){this.doc!==null?Fe(this.doc,r=>{jw(r,this,e,n)}):this._prelimContent.splice(e,n)}get(e){return Pw(this,e)}toArray(){return Dw(this)}slice(e=0,n=this.length){return Iw(this,e,n)}toJSON(){return this.map(e=>e instanceof gt?e.toJSON():e)}map(e){return Lw(this,e)}forEach(e){Os(this,e)}[Symbol.iterator](){return RP(this)}_write(e){e.writeTypeRef(WP)}}class PP extends Jc{constructor(e,n,r){super(e,n),this.keysChanged=r}}class Dl extends gt{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 Dl}clone(){const e=new Dl;return this.forEach((n,r)=>{e.set(r,n instanceof gt?n.clone():n)}),e}_callObserver(e,n){Zc(this,e,new PP(this,e,n))}toJSON(){this.doc??bt();const e={};return this._map.forEach((n,r)=>{if(!n.deleted){const i=n.content.getContent()[n.length-1];e[r]=i instanceof gt?i.toJSON():i}}),e}get size(){return[...Ca(this)].length}keys(){return Qu(Ca(this),e=>e[0])}values(){return Qu(Ca(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return Qu(Ca(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??bt(),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?Fe(this.doc,n=>{Il(n,this,e)}):this._prelimContent.delete(e)}set(e,n){return this.doc!==null?Fe(this.doc,r=>{zh(r,this,e,n)}):this._prelimContent.set(e,n),n}get(e){return Uh(this,e)}has(e){return Hw(this,e)}clear(){this.doc!==null?Fe(this.doc,e=>{this.forEach(function(n,r,i){Il(e,i,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(KP)}}const vr=(t,e)=>t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&fL(t,e);class uf{constructor(e,n,r,i){this.left=e,this.right=n,this.index=r,this.currentAttributes=i}forward(){switch(this.right===null&&Rn(),this.right.content.constructor){case st:this.right.deleted||So(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}}const Fg=(t,e,n)=>{for(;e.right!==null&&n>0;){switch(e.right.content.constructor){case st:e.right.deleted||So(e.currentAttributes,e.right.content);break;default:e.right.deleted||(n<e.right.length&&Or(t,Ue(e.right.id.client,e.right.id.clock+n)),e.index+=e.right.length,n-=e.right.length);break}e.left=e.right,e.right=e.right.right}return e},Sa=(t,e,n,r)=>{const i=new Map,o=r?Xc(e,n):null;if(o){const s=new uf(o.p.left,o.p,o.index,i);return Fg(t,s,n-o.index)}else{const s=new uf(null,e._start,0,i);return Fg(t,s,n)}},zw=(t,e,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===st&&vr(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,o=i.clientID;r.forEach((s,a)=>{const l=n.left,c=n.right,u=new Ft(Ue(o,Ot(i.store,o)),l,l&&l.lastId,c,c&&c.id,e,null,new st(a,s));u.integrate(t,0),n.right=u,n.forward()})},So=(t,e)=>{const{key:n,value:r}=e;r===null?t.delete(n):t.set(n,r)},Uw=(t,e)=>{for(;t.right!==null;){if(!(t.right.deleted||t.right.content.constructor===st&&vr(e[t.right.content.key]??null,t.right.content.value)))break;t.forward()}},Vw=(t,e,n,r)=>{const i=t.doc,o=i.clientID,s=new Map;for(const a in r){const l=r[a],c=n.currentAttributes.get(a)??null;if(!vr(c,l)){s.set(a,c);const{left:u,right:d}=n;n.right=new Ft(Ue(o,Ot(i.store,o)),u,u&&u.lastId,d,d&&d.id,e,null,new st(a,l)),n.right.integrate(t,0),n.forward()}}return s},nd=(t,e,n,r,i)=>{n.currentAttributes.forEach((f,h)=>{i[h]===void 0&&(i[h]=null)});const o=t.doc,s=o.clientID;Uw(n,i);const a=Vw(t,e,n,i),l=r.constructor===String?new er(r):r instanceof gt?new jr(r):new _o(r);let{left:c,right:u,index:d}=n;e._searchMarker&&Ms(e._searchMarker,n.index,l.getLength()),u=new Ft(Ue(s,Ot(o.store,s)),c,c&&c.lastId,u,u&&u.id,e,null,l),u.integrate(t,0),n.right=u,n.index=d,n.forward(),zw(t,e,n,a)},Hg=(t,e,n,r,i)=>{const o=t.doc,s=o.clientID;Uw(n,i);const a=Vw(t,e,n,i);e:for(;n.right!==null&&(r>0||a.size>0&&(n.right.deleted||n.right.content.constructor===st));){if(!n.right.deleted)switch(n.right.content.constructor){case st:{const{key:l,value:c}=n.right.content,u=i[l];if(u!==void 0){if(vr(u,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&&Or(t,Ue(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+=`
478
- `;n.right=new Ft(Ue(s,Ot(o.store,s)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new er(l)),n.right.integrate(t,0),n.forward()}zw(t,e,n,a)},Ww=(t,e,n,r,i)=>{let o=e;const s=Tn();for(;o&&(!o.countable||o.deleted);){if(!o.deleted&&o.content.constructor===st){const c=o.content;s.set(c.key,c)}o=o.right}let a=0,l=!1;for(;e!==o;){if(n===e&&(l=!0),!e.deleted){const c=e.content;switch(c.constructor){case st:{const{key:u,value:d}=c,f=r.get(u)??null;(s.get(u)!==c||f===d)&&(e.delete(t),a++,!l&&(i.get(u)??null)===d&&f!==d&&(f===null?i.delete(u):i.set(u,f))),!l&&!e.deleted&&So(i,c);break}}}e=e.right}return a},BP=(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===st){const r=e.content.key;n.has(r)?e.delete(t):n.add(r)}e=e.left}},$P=t=>{let e=0;return Fe(t.doc,n=>{let r=t._start,i=t._start,o=Tn();const s=nf(o);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case st:So(s,i.content);break;default:e+=Ww(n,r,i,o,s),o=nf(s),r=i;break}i=i.right}}),e},jP=t=>{const e=new Set,n=t.doc;for(const[r,i]of t.afterState.entries()){const o=t.beforeState.get(r)||0;i!==o&&Aw(t,n.store.clients.get(r),o,i,s=>{!s.deleted&&s.content.constructor===st&&s.constructor!==pr&&e.add(s.parent)})}Fe(n,r=>{Ew(t,t.deleteSet,i=>{if(i instanceof pr||!i.parent._hasFormatting||e.has(i.parent))return;const o=i.parent;i.content.constructor===st?e.add(o):BP(r,i)});for(const i of e)$P(i)})},zg=(t,e,n)=>{const r=n,i=nf(e.currentAttributes),o=e.right;for(;n>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case jr:case _o:case er:n<e.right.length&&Or(t,Ue(e.right.id.client,e.right.id.clock+n)),n-=e.right.length,e.right.delete(t);break}e.forward()}o&&Ww(t,o,e.right,i,e.currentAttributes);const s=(e.left||e.right).parent;return s._searchMarker&&Ms(s._searchMarker,e.index,-r+n),e};class FP extends Jc{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=[];Fe(e,r=>{const i=new Map,o=new Map;let s=this.target._start,a=null;const l={};let c="",u=0,d=0;const f=()=>{if(a!==null){let h=null;switch(a){case"delete":d>0&&(h={delete:d}),d=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":u>0&&(h={retain:u},dL(l)||(h.attributes=lL({},l))),u=0;break}h&&n.push(h),a=null}};for(;s!==null;){switch(s.content.constructor){case jr:case _o:this.adds(s)?this.deletes(s)||(f(),a="insert",c=s.content.getContent()[0],f()):this.deletes(s)?(a!=="delete"&&(f(),a="delete"),d+=1):s.deleted||(a!=="retain"&&(f(),a="retain"),u+=1);break;case er:this.adds(s)?this.deletes(s)||(a!=="insert"&&(f(),a="insert"),c+=s.content.str):this.deletes(s)?(a!=="delete"&&(f(),a="delete"),d+=s.length):s.deleted||(a!=="retain"&&(f(),a="retain"),u+=s.length);break;case st:{const{key:h,value:m}=s.content;if(this.adds(s)){if(!this.deletes(s)){const g=i.get(h)??null;vr(g,m)?m!==null&&s.delete(r):(a==="retain"&&f(),vr(m,o.get(h)??null)?delete l[h]:l[h]=m)}}else if(this.deletes(s)){o.set(h,m);const g=i.get(h)??null;vr(g,m)||(a==="retain"&&f(),l[h]=g)}else if(!s.deleted){o.set(h,m);const g=l[h];g!==void 0&&(vr(g,m)?g!==null&&s.delete(r):(a==="retain"&&f(),m===null?delete l[h]:l[h]=m))}s.deleted||(a==="insert"&&f(),So(i,s.content));break}}s=s.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 Rs extends gt{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??bt(),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 Rs}clone(){const e=new Rs;return e.applyDelta(this.toDelta()),e}_callObserver(e,n){super._callObserver(e,n);const r=new FP(this,e,n);Zc(this,e,r),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??bt();let e="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===er&&(e+=n.content.str),n=n.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:n=!0}={}){this.doc!==null?Fe(this.doc,r=>{const i=new uf(null,this._start,0,new Map);for(let o=0;o<e.length;o++){const s=e[o];if(s.insert!==void 0){const a=!n&&typeof s.insert=="string"&&o===e.length-1&&i.right===null&&s.insert.slice(-1)===`
479
- `?s.insert.slice(0,-1):s.insert;(typeof a!="string"||a.length>0)&&nd(r,this,i,a,s.attributes||{})}else s.retain!==void 0?Hg(r,this,i,s.retain,s.attributes||{}):s.delete!==void 0&&zg(r,i,s.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,n,r){this.doc??bt();const i=[],o=new Map,s=this.doc;let a="",l=this._start;function c(){if(a.length>0){const d={};let f=!1;o.forEach((m,g)=>{f=!0,d[g]=m});const h={insert:a};f&&(h.attributes=d),i.push(h),a=""}}const u=()=>{for(;l!==null;){if(Li(l,e)||n!==void 0&&Li(l,n))switch(l.content.constructor){case er:{const d=o.get("ychange");e!==void 0&&!Li(l,e)?(d===void 0||d.user!==l.id.client||d.type!=="removed")&&(c(),o.set("ychange",r?r("removed",l.id):{type:"removed"})):n!==void 0&&!Li(l,n)?(d===void 0||d.user!==l.id.client||d.type!=="added")&&(c(),o.set("ychange",r?r("added",l.id):{type:"added"})):d!==void 0&&(c(),o.delete("ychange")),a+=l.content.str;break}case jr:case _o:{c();const d={insert:l.content.getContent()[0]};if(o.size>0){const f={};d.attributes=f,o.forEach((h,m)=>{f[m]=h})}i.push(d);break}case st:Li(l,e)&&(c(),So(o,l.content));break}l=l.right}c()};return e||n?Fe(s,d=>{e&&lf(d,e),n&&lf(d,n),u()},"cleanup"):u(),i}insert(e,n,r){if(n.length<=0)return;const i=this.doc;i!==null?Fe(i,o=>{const s=Sa(o,this,e,!r);r||(r={},s.currentAttributes.forEach((a,l)=>{r[l]=a})),nd(o,this,s,n,r)}):this._pending.push(()=>this.insert(e,n,r))}insertEmbed(e,n,r){const i=this.doc;i!==null?Fe(i,o=>{const s=Sa(o,this,e,!r);nd(o,this,s,n,r||{})}):this._pending.push(()=>this.insertEmbed(e,n,r||{}))}delete(e,n){if(n===0)return;const r=this.doc;r!==null?Fe(r,i=>{zg(i,Sa(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?Fe(i,o=>{const s=Sa(o,this,e,!1);s.right!==null&&Hg(o,this,s,n,r)}):this._pending.push(()=>this.format(e,n,r))}removeAttribute(e){this.doc!==null?Fe(this.doc,n=>{Il(n,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,n){this.doc!==null?Fe(this.doc,r=>{zh(r,this,e,n)}):this._pending.push(()=>this.setAttribute(e,n))}getAttribute(e){return Uh(this,e)}getAttributes(){return Fw(this)}_write(e){e.writeTypeRef(GP)}}class rd{constructor(e,n=()=>!0){this._filter=n,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??bt()}[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===Is||n.constructor===ho)&&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 ho extends gt{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 ho}clone(){const e=new ho;return e.insert(0,this.toArray().map(n=>n instanceof gt?n.clone():n)),e}get length(){return this.doc??bt(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new rd(this,e)}querySelector(e){e=e.toUpperCase();const r=new rd(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),uo(new rd(this,n=>n.nodeName&&n.nodeName.toUpperCase()===e))}_callObserver(e,n){Zc(this,e,new HP(this,n,e))}toString(){return Lw(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),Os(this,o=>{i.insertBefore(o.toDOM(e,n,r),null)}),i}insert(e,n){this.doc!==null?Fe(this.doc,r=>{$w(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}insertAfter(e,n){if(this.doc!==null)Fe(this.doc,r=>{const i=e&&e instanceof gt?e._item:e;Rl(r,this,i,n)});else{const r=this._prelimContent,i=e===null?0:r.findIndex(o=>o===e)+1;if(i===0&&e!==null)throw Mr("Reference item not found");r.splice(i,0,...n)}}delete(e,n=1){this.doc!==null?Fe(this.doc,r=>{jw(r,this,e,n)}):this._prelimContent.splice(e,n)}toArray(){return Dw(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return Pw(this,e)}slice(e=0,n=this.length){return Iw(this,e,n)}forEach(e){Os(this,e)}_write(e){e.writeTypeRef(YP)}}class Is extends ho{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 Is(this.nodeName)}clone(){const e=new Is(this.nodeName),n=this.getAttributes();return uL(n,(r,i)=>{e.setAttribute(i,r)}),e.insert(0,this.toArray().map(r=>r instanceof gt?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 o=this.nodeName.toLocaleLowerCase(),s=n.length>0?" "+n.join(" "):"";return`<${o}${s}>${super.toString()}</${o}>`}removeAttribute(e){this.doc!==null?Fe(this.doc,n=>{Il(n,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,n){this.doc!==null?Fe(this.doc,r=>{zh(r,this,e,n)}):this._prelimAttrs.set(e,n)}getAttribute(e){return Uh(this,e)}hasAttribute(e){return Hw(this,e)}getAttributes(e){return e?DP(this,e):Fw(this)}toDOM(e=document,n={},r){const i=e.createElement(this.nodeName),o=this.getAttributes();for(const s in o){const a=o[s];typeof a=="string"&&i.setAttribute(s,a)}return Os(this,s=>{i.appendChild(s.toDOM(e,n,r))}),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(qP),e.writeKey(this.nodeName)}}class HP extends Jc{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 Ds extends Rs{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 Ds}clone(){const e=new Ds;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 o=[];for(const s in e.attributes[i])o.push({key:s,value:e.attributes[i][s]});o.sort((s,a)=>s.key<a.key?-1:1),n.push({nodeName:i,attrs:o})}n.sort((i,o)=>i.nodeName<o.nodeName?-1:1);let r="";for(let i=0;i<n.length;i++){const o=n[i];r+=`<${o.nodeName}`;for(let s=0;s<o.attrs.length;s++){const a=o.attrs[s];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(JP)}}class Kw{constructor(e,n){this.id=e,this.length=n}get deleted(){throw ln()}mergeWith(e){return!1}write(e,n,r){throw ln()}integrate(e,n){throw ln()}}const zP=0;class pr extends Kw{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),Tw(e.doc.store,this)}write(e,n){e.writeInfo(zP),e.writeLen(this.length-n)}getMissing(e,n){return null}}class Qc{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new Qc(this.content)}splice(e){throw ln()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeBuf(this.content)}getRef(){return 3}}class Ll{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new Ll(this.len)}splice(e){const n=new Ll(this.len-e);return this.len=e,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,n){Sw(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 UP=(t,e)=>new ta({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class eu{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 eu(UP(this.doc.guid,this.opts))}splice(e){throw ln()}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 _o{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new _o(this.embed)}splice(e){throw ln()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeJSON(this.embed)}getRef(){return 5}}class st{constructor(e,n){this.key=e,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new st(this.key,this.value)}splice(e){throw ln()}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 VP=Nl("node_env")==="development";class po{constructor(e){this.arr=e,VP&&Jx(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new po(this.arr)}splice(e){const n=new po(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 o=this.arr[i];e.writeAny(o)}}getRef(){return 8}}class er{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new er(this.str)}splice(e){const n=new er(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 WP=0,KP=1,GP=2,qP=3,YP=4,JP=6;class jr{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new jr(this.type._copy())}splice(e){throw ln()}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 Gw=(t,e,n)=>{const{client:r,clock:i}=e.id,o=new Ft(Ue(r,i+n),e,Ue(r,i+n-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(n));return e.deleted&&o.markDeleted(),e.keep&&(o.keep=!0),e.redone!==null&&(o.redone=Ue(e.redone.client,e.redone.clock+n)),e.right=o,o.right!==null&&(o.right.left=o),t._mergeStructs.push(o),o.parentSub!==null&&o.right===null&&o.parent._map.set(o.parentSub,o),e.length=n,o};let Ft=class df extends Kw{constructor(e,n,r,i,o,s,a,l){super(e,l.getLength()),this.origin=r,this.left=n,this.right=i,this.rightOrigin=o,this.parent=s,this.parentSub=a,this.redone=null,this.content=l,this.info=this.content.isCountable()?xg:0}set marker(e){(this.info&qu)>0!==e&&(this.info^=qu)}get marker(){return(this.info&qu)>0}get keep(){return(this.info&vg)>0}set keep(e){this.keep!==e&&(this.info^=vg)}get countable(){return(this.info&xg)>0}get deleted(){return(this.info&Gu)>0}set deleted(e){this.deleted!==e&&(this.info^=Gu)}markDeleted(){this.info|=Gu}getMissing(e,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Ot(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Ot(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===el&&this.id.client!==this.parent.client&&this.parent.clock>=Ot(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=Pg(e,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=Or(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===pr||this.right&&this.right.constructor===pr)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===df?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===df&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===el){const r=td(n,this.parent);r.constructor===pr?this.parent=null:this.parent=r.content.type}return null}integrate(e,n){if(n>0&&(this.id.clock+=n,this.left=Pg(e,e.doc.store,Ue(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 o=new Set,s=new Set;for(;i!==null&&i!==this.right;){if(s.add(i),o.add(i),Ea(this.origin,i.origin)){if(i.id.client<this.id.client)r=i,o.clear();else if(Ea(this.rightOrigin,i.rightOrigin))break}else if(i.origin!==null&&s.has(td(e.doc.store,i.origin)))o.has(td(e.doc.store,i.origin))||(r=i,o.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),Tw(e.doc.store,this),this.content.integrate(e,this),$g(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new pr(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:Ue(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&Ea(e.origin,this.lastId)&&this.right===e&&Ea(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(),Sw(e.deleteSet,this.id.client,this.id.clock,this.length),$g(e,n,this.parentSub),this.content.delete(e)}}gc(e,n){if(!this.deleted)throw Rn();this.content.gc(e),n?CP(e,this,new pr(this.id,this.length)):this.content=new Ll(this.length)}write(e,n){const r=n>0?Ue(this.id.client,this.id.clock+n-1):this.origin,i=this.rightOrigin,o=this.parentSub,s=this.content.getRef()&ID|(r===null?0:Sl)|(i===null?0:Kx)|(o===null?0:RD);if(e.writeInfo(s),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=As(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===el?(e.writeParentInfo(!1),e.writeLeftID(a)):Rn();o!==null&&e.writeString(o)}this.content.write(e,n)}};const qw=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},Yw="__ $YJS$ __";qw[Yw]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");qw[Yw]=!0;const XP=new Pe("y-sync");new Pe("y-undo");new Pe("yjs-cursor");const ZP=(t,e,n)=>{if(t===0)return ed(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 Ds){if(r._length>=t)return ed(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 Ol(r._item===null?null:r._item.id,r._item===null?As(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 Ol(r._item===null?null:r._item.id,r._item===null?As(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 Rn();if(t===0&&r.constructor!==Ds&&r!==e)return QP(r._item.parent,r._item)}return ed(e,e._length,e.length===0?-1:0)},QP=(t,e)=>{let n=null,r=null;return t._item===null?r=As(t):n=Ue(t._item.id.client,t._item.id.clock),new Ol(n,r,e.id)},eB=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Vh=qe.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",Ne(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[H0({find:eB,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}});function tB(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:s,$position:a}=t,l=r&&!i,c=lT(n),u=new RegExp(`\\s${c}$`),d=s?"^":"",f=i?"":c,h=l?new RegExp(`${d}${c}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${d}(?:^)?${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(`^[${o==null?void 0:o.join("")}\0]?$`).test(b);if(o!==null&&!w)return null;const E=g+y.index;let v=E+y[0].length;return l&&u.test(m.slice(v-1,v+1))&&(y[0]+=" ",v+=1),E<a.pos&&v>=a.pos?{range:{from:E,to:v},query:y[0].slice(n.length),text:y[0]}:null}const nB=new Pe("suggestion");function Jw({pluginKey:t=nB,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:o=[" "],startOfLine:s=!1,decorationTag:a="span",decorationClass:l="suggestion",decorationContent:c="",decorationEmptyClass:u="is-empty",command:d=()=>null,items:f=()=>[],render:h=()=>({}),allow:m=()=>!0,findSuggestionMatch:g=tB}){let y;const b=h==null?void 0:h(),w=new $e({key:t,view(){return{update:async(E,v)=>{var k,C,S,N,M,D,H;const $=(k=this.key)===null||k===void 0?void 0:k.getState(v),z=(C=this.key)===null||C===void 0?void 0:C.getState(E.state),L=$.active&&z.active&&$.range.from!==z.range.from,K=!$.active&&z.active,A=$.active&&!z.active,T=!K&&!A&&$.query!==z.query,_=K||L&&T,I=T||L,j=A||L&&T;if(!_&&!I&&!j)return;const G=j&&!_?$:z,ie=E.dom.querySelector(`[data-decoration-id="${G.decorationId}"]`);y={editor:e,range:G.range,query:G.query,text:G.text,items:[],command:ae=>d({editor:e,range:G.range,props:ae}),decorationNode:ie,clientRect:ie?()=>{var ae;const{decorationId:W}=(ae=this.key)===null||ae===void 0?void 0:ae.getState(e.state),J=E.dom.querySelector(`[data-decoration-id="${W}"]`);return(J==null?void 0:J.getBoundingClientRect())||null}:null},_&&((S=b==null?void 0:b.onBeforeStart)===null||S===void 0||S.call(b,y)),I&&((N=b==null?void 0:b.onBeforeUpdate)===null||N===void 0||N.call(b,y)),(I||_)&&(y.items=await f({editor:e,query:G.query})),j&&((M=b==null?void 0:b.onExit)===null||M===void 0||M.call(b,y)),I&&((D=b==null?void 0:b.onUpdate)===null||D===void 0||D.call(b,y)),_&&((H=b==null?void 0:b.onStart)===null||H===void 0||H.call(b,y))},destroy:()=>{var E;y&&((E=b==null?void 0:b.onExit)===null||E===void 0||E.call(b,y))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(E,v,k,C){const{isEditable:S}=e,{composing:N}=e.view,{selection:M}=E,{empty:D,from:H}=M,$={...v};if($.composing=N,S&&(D||e.view.composing)){(H<v.range.from||H>v.range.to)&&!N&&!v.composing&&($.active=!1);const z=g({char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:s,$position:M.$from}),L=`id_${Math.floor(Math.random()*4294967295)}`;z&&m({editor:e,state:C,range:z.range,isActive:v.active})?($.active=!0,$.decorationId=v.decorationId?v.decorationId:L,$.range=z.range,$.query=z.query,$.text=z.text):$.active=!1}else $.active=!1;return $.active||($.decorationId=null,$.range={from:0,to:0},$.query=null,$.text=null),$}},props:{handleKeyDown(E,v){var k;const{active:C,range:S}=w.getState(E.state);return C&&((k=b==null?void 0:b.onKeyDown)===null||k===void 0?void 0:k.call(b,{view:E,event:v,range:S}))||!1},decorations(E){const{active:v,range:k,decorationId:C,query:S}=w.getState(E);if(!v)return null;const N=!(S!=null&&S.length),M=[l];return N&&M.push(u),He.create(E.doc,[pt.inline(k.from,k.to,{nodeName:a,class:M.join(" "),"data-decoration-id":C,"data-decoration-content":c})])}}});return w}function No(){return(No=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 tu(t,e){if(t==null)return{};var n,r,i={},o=Object.keys(t);for(r=0;r<o.length;r++)e.indexOf(n=o[r])>=0||(i[n]=t[n]);return i}function ni(t){var e=x.useRef(t),n=x.useRef(function(r){e.current&&e.current(r)});return e.current=t,n.current}var Ls=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t<e?e:t},Qo=function(t){return"touches"in t},ff=function(t){return t&&t.ownerDocument.defaultView||self},Ug=function(t,e,n){var r=t.getBoundingClientRect(),i=Qo(e)?function(o,s){for(var a=0;a<o.length;a++)if(o[a].identifier===s)return o[a];return o[0]}(e.touches,n):e;return{left:Ls((i.pageX-(r.left+ff(t).pageXOffset))/r.width),top:Ls((i.pageY-(r.top+ff(t).pageYOffset))/r.height)}},Vg=function(t){!Qo(t)&&t.preventDefault()},Xw=fe.memo(function(t){var e=t.onMove,n=t.onKey,r=t.onEnd,i=tu(t,["onMove","onKey","onEnd"]),o=x.useRef(null),s=ni(e),a=ni(n),l=ni(r),c=x.useRef(null),u=x.useRef(!1),d=x.useMemo(function(){var y=function(E){Vg(E),(Qo(E)?E.touches.length>0:E.buttons>0)&&o.current?s(Ug(o.current,E,c.current)):(w(!1),l())},b=function(){w(!1),l()};function w(E){var v=u.current,k=ff(o.current),C=E?k.addEventListener:k.removeEventListener;C(v?"touchmove":"mousemove",y),C(v?"touchend":"mouseup",b)}return[function(E){var v=E.nativeEvent,k=o.current;if(k&&(Vg(v),!function(S,N){return N&&!Qo(S)}(v,u.current)&&k)){if(Qo(v)){u.current=!0;var C=v.changedTouches||[];C.length&&(c.current=C[0].identifier)}k.focus(),s(Ug(k,v,c.current)),w(!0)}},function(E){var v=E.which||E.keyCode;v<37||v>40||(E.preventDefault(),a({left:v===39?.05:v===37?-.05:0,top:v===40?.05:v===38?-.05:0}))},function(E){var v=E.which||E.keyCode;v>=37&&v<=40&&l()},w]},[a,s,l]),f=d[0],h=d[1],m=d[2],g=d[3];return x.useEffect(function(){return g},[g]),fe.createElement("div",No({},i,{onTouchStart:f,onMouseDown:f,className:"react-colorful__interactive",ref:o,onKeyDown:h,onKeyUp:m,tabIndex:0,role:"slider"}))}),Wh=function(t){return t.filter(Boolean).join(" ")},Zw=function(t){var e=t.color,n=t.left,r=t.top,i=r===void 0?.5:r,o=Wh(["react-colorful__pointer",t.className]);return fe.createElement("div",{className:o,style:{top:100*i+"%",left:100*n+"%"}},fe.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:e}}))},mt=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n},rB=function(t){return lB(hf(t))},hf=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?mt(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?mt(parseInt(t.substring(6,8),16)/255,2):1}},iB=function(t){return aB(sB(t))},oB=function(t){var e=t.s,n=t.v,r=t.a,i=(200-e)*n/100;return{h:mt(t.h),s:mt(i>0&&i<200?e*n/100/(i<=100?i:200-i)*100:0),l:mt(i/2),a:mt(r,2)}},pf=function(t){var e=oB(t);return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},sB=function(t){var e=t.h,n=t.s,r=t.v,i=t.a;e=e/360*6,n/=100,r/=100;var o=Math.floor(e),s=r*(1-n),a=r*(1-(e-o)*n),l=r*(1-(1-e+o)*n),c=o%6;return{r:mt(255*[r,a,s,s,l,r][c]),g:mt(255*[l,r,r,a,s,s][c]),b:mt(255*[s,s,l,r,r,a][c]),a:mt(i,2)}},_a=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},aB=function(t){var e=t.r,n=t.g,r=t.b,i=t.a,o=i<1?_a(mt(255*i)):"";return"#"+_a(e)+_a(n)+_a(r)+o},lB=function(t){var e=t.r,n=t.g,r=t.b,i=t.a,o=Math.max(e,n,r),s=o-Math.min(e,n,r),a=s?o===e?(n-r)/s:o===n?2+(r-e)/s:4+(e-n)/s:0;return{h:mt(60*(a<0?a+6:a)),s:mt(o?s/o*100:0),v:mt(o/255*100),a:i}},cB=fe.memo(function(t){var e=t.hue,n=t.onChange,r=t.onChangeEnd,i=Wh(["react-colorful__hue",t.className]);return fe.createElement("div",{className:i},fe.createElement(Xw,{onMove:function(o){n({h:360*o.left})},onKey:function(o){n({h:Ls(e+360*o.left,0,360)})},onEnd:r,"aria-label":"Hue","aria-valuenow":mt(e),"aria-valuemax":"360","aria-valuemin":"0"},fe.createElement(Zw,{className:"react-colorful__hue-pointer",left:e/360,color:pf({h:e,s:100,v:100,a:1})})))}),uB=fe.memo(function(t){var e=t.hsva,n=t.onChange,r=t.onChangeEnd,i={backgroundColor:pf({h:e.h,s:100,v:100,a:1})};return fe.createElement("div",{className:"react-colorful__saturation",style:i},fe.createElement(Xw,{onMove:function(o){n({s:100*o.left,v:100-100*o.top})},onKey:function(o){n({s:Ls(e.s+100*o.left,0,100),v:Ls(e.v-100*o.top,0,100)})},onEnd:r,"aria-label":"Color","aria-valuetext":"Saturation "+mt(e.s)+"%, Brightness "+mt(e.v)+"%"},fe.createElement(Zw,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:pf(e)})))}),Qw=function(t,e){if(t===e)return!0;for(var n in t)if(t[n]!==e[n])return!1;return!0},dB=function(t,e){return t.toLowerCase()===e.toLowerCase()||Qw(hf(t),hf(e))};function fB(t,e,n,r){var i=ni(n),o=ni(r),s=x.useState(function(){return t.toHsva(e)}),a=s[0],l=s[1],c=x.useRef({color:e,hsva:a}),u=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),u.current=!1}},[e,t]),x.useEffect(function(){var h;Qw(a,c.current.hsva)||t.equal(h=t.fromHsva(a),c.current.color)||(c.current={hsva:a,color:h},i(h),u.current=!0)},[a,t,i]);var d=x.useCallback(function(h){l(function(m){return Object.assign({},m,h)})},[]),f=x.useCallback(function(){u.current&&(u.current=!1,o(c.current.color))},[o]);return[a,d,f]}var hB=typeof window<"u"?x.useLayoutEffect:x.useEffect,pB=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},Wg=new Map,mB=function(t){hB(function(){var e=t.current?t.current.ownerDocument:document;if(e!==void 0&&!Wg.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}`,Wg.set(e,n);var r=pB();r&&n.setAttribute("nonce",r),e.head.appendChild(n)}},[])},gB=function(t){var e=t.className,n=t.colorModel,r=t.color,i=r===void 0?n.defaultColor:r,o=t.onChange,s=t.onChangeEnd,a=tu(t,["className","colorModel","color","onChange","onChangeEnd"]),l=x.useRef(null);mB(l);var c=fB(n,i,o,s),u=c[0],d=c[1],f=c[2],h=Wh(["react-colorful",e]);return fe.createElement("div",No({},a,{ref:l,className:h}),fe.createElement(uB,{hsva:u,onChange:d,onChangeEnd:f}),fe.createElement(cB,{hue:u.h,onChange:d,onChangeEnd:f,className:"react-colorful__last-control"}))},yB={defaultColor:"000",toHsva:rB,fromHsva:function(t){return iB({h:t.h,s:t.s,v:t.v,a:1})},equal:dB},bB=function(t){return fe.createElement(gB,No({},t,{colorModel:yB}))},vB=/^#?([0-9A-F]{3,8})$/i,xB=function(t){var e=t.color,n=e===void 0?"":e,r=t.onChange,i=t.onBlur,o=t.escape,s=t.validate,a=t.format,l=t.process,c=tu(t,["color","onChange","onBlur","escape","validate","format","process"]),u=x.useState(function(){return o(n)}),d=u[0],f=u[1],h=ni(r),m=ni(i),g=x.useCallback(function(b){var w=o(b.target.value);f(w),s(w)&&h(l?l(w):w)},[o,l,s,h]),y=x.useCallback(function(b){s(b.target.value)||f(o(n)),m(b)},[n,o,s,m]);return x.useEffect(function(){f(o(n))},[n,o]),fe.createElement("input",No({},c,{value:a?a(d):d,spellCheck:"false",onChange:g,onBlur:y}))},Kg=function(t){return"#"+t},wB=function(t){var e=t.prefixed,n=t.alpha,r=tu(t,["prefixed","alpha"]),i=x.useCallback(function(s){return s.replace(/([^0-9A-F]+)/gi,"").substring(0,n?8:6)},[n]),o=x.useCallback(function(s){return function(a,l){var c=vB.exec(a),u=c?c[1].length:0;return u===3||u===6||!!l&&u===4||!!l&&u===8}(s,n)},[n]);return fe.createElement(xB,No({},r,{escape:i,format:e?Kg:void 0,process:Kg,validate:o}))};const e1=qe.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Ne(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!aT(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$from:r,$to:i}=n,o=t();return r.parentOffset===0?o.insertContentAt({from:Math.max(r.pos-1,0),to:i.pos},{type:this.name}):F0(n)?o.insertContentAt(i.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:s,dispatch:a})=>{var l;if(a){const{$to:c}=s.selection,u=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?s.setSelection(ue.create(s.doc,c.pos+1)):c.nodeAfter.isBlock?s.setSelection(se.create(s.doc,c.pos)):s.setSelection(ue.create(s.doc,c.pos));else{const d=(l=c.parent.type.contentMatch.defaultType)===null||l===void 0?void 0:l.create();d&&(s.insert(u,d),s.setSelection(ue.create(s.doc,u+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[H0({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),EB=/^```([a-z]+)?[\s\n]$/,kB=/^~~~([a-z]+)?[\s\n]$/,t1=qe.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,o=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(s=>s.startsWith(n)).map(s=>s.replace(n,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Ne(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 o=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith(`
480
-
481
- `);return!o||!s?!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:o}=n;if(!o||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(ge.near(r.resolve(a))),!0)):t.commands.exitCode()}}},addInputRules(){return[Hd({find:EB,type:this.type,getAttributes:t=>({language:t[1]})}),Hd({find:kB,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new $e({key:new Pe("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,o=i==null?void 0:i.mode;if(!n||!o)return!1;const{tr:s,schema:a}=t.state,l=a.text(n.replace(/\r\n?/g,`
482
- `));return s.replaceSelectionWith(this.type.create({language:o},l)),s.selection.$from.parent.type!==this.type&&s.setSelection(ue.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}});function CB(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function n1(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)&&n1(n)}),t}let Gg=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function r1(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function xr(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 SB="</span>",qg=t=>!!t.scope,_B=(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}`};let NB=class{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=r1(e)}openNode(e){if(!qg(e))return;const n=_B(e.scope,{prefix:this.classPrefix});this.span(n)}closeNode(e){qg(e)&&(this.buffer+=SB)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}};const Yg=(t={})=>{const e={children:[]};return Object.assign(e,t),e};let TB=class i1{constructor(){this.rootNode=Yg(),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=Yg({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=>{i1._collapse(n)}))}},AB=class extends TB{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 NB(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function Ps(t){return t?typeof t=="string"?t:t.source:null}function o1(t){return yi("(?=",t,")")}function MB(t){return yi("(?:",t,")*")}function OB(t){return yi("(?:",t,")?")}function yi(...t){return t.map(n=>Ps(n)).join("")}function RB(t){const e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function Kh(...t){return"("+(RB(t).capture?"":"?:")+t.map(r=>Ps(r)).join("|")+")"}function s1(t){return new RegExp(t.toString()+"|").exec("").length-1}function IB(t,e){const n=t&&t.exec(e);return n&&n.index===0}const DB=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Gh(t,{joinWith:e}){let n=0;return t.map(r=>{n+=1;const i=n;let o=Ps(r),s="";for(;o.length>0;){const a=DB.exec(o);if(!a){s+=o;break}s+=o.substring(0,a.index),o=o.substring(a.index+a[0].length),a[0][0]==="\\"&&a[1]?s+="\\"+String(Number(a[1])+i):(s+=a[0],a[0]==="("&&n++)}return s}).map(r=>`(${r})`).join(e)}const LB=/\b\B/,a1="[a-zA-Z]\\w*",qh="[a-zA-Z_]\\w*",l1="\\b\\d+(\\.\\d+)?",c1="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",u1="\\b(0b[01]+)",PB="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",BB=(t={})=>{const e=/^#![ ]*\//;return t.binary&&(t.begin=yi(e,/.*\b/,t.binary,/\b.*/)),xr({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},t)},Bs={begin:"\\\\[\\s\\S]",relevance:0},$B={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Bs]},jB={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Bs]},FB={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/},nu=function(t,e,n={}){const r=xr({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=Kh("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},HB=nu("//","$"),zB=nu("/\\*","\\*/"),UB=nu("#","$"),VB={scope:"number",begin:l1,relevance:0},WB={scope:"number",begin:c1,relevance:0},KB={scope:"number",begin:u1,relevance:0},GB={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Bs,{begin:/\[/,end:/\]/,relevance:0,contains:[Bs]}]},qB={scope:"title",begin:a1,relevance:0},YB={scope:"title",begin:qh,relevance:0},JB={begin:"\\.\\s*"+qh,relevance:0},XB=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 Na=Object.freeze({__proto__:null,APOS_STRING_MODE:$B,BACKSLASH_ESCAPE:Bs,BINARY_NUMBER_MODE:KB,BINARY_NUMBER_RE:u1,COMMENT:nu,C_BLOCK_COMMENT_MODE:zB,C_LINE_COMMENT_MODE:HB,C_NUMBER_MODE:WB,C_NUMBER_RE:c1,END_SAME_AS_BEGIN:XB,HASH_COMMENT_MODE:UB,IDENT_RE:a1,MATCH_NOTHING_RE:LB,METHOD_GUARD:JB,NUMBER_MODE:VB,NUMBER_RE:l1,PHRASAL_WORDS_MODE:FB,QUOTE_STRING_MODE:jB,REGEXP_MODE:GB,RE_STARTERS_RE:PB,SHEBANG:BB,TITLE_MODE:qB,UNDERSCORE_IDENT_RE:qh,UNDERSCORE_TITLE_MODE:YB});function ZB(t,e){t.input[t.index-1]==="."&&e.ignoreMatch()}function QB(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className)}function e3(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=ZB,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0))}function t3(t,e){Array.isArray(t.illegal)&&(t.illegal=Kh(...t.illegal))}function n3(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 r3(t,e){t.relevance===void 0&&(t.relevance=1)}const i3=(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,o1(n.begin)),t.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},t.relevance=0,delete n.beforeMatch},o3=["of","and","for","in","not","or","if","then","parent","list","value"],s3="keyword";function d1(t,e,n=s3){const r=Object.create(null);return typeof t=="string"?i(n,t.split(" ")):Array.isArray(t)?i(n,t):Object.keys(t).forEach(function(o){Object.assign(r,d1(t[o],e,o))}),r;function i(o,s){e&&(s=s.map(a=>a.toLowerCase())),s.forEach(function(a){const l=a.split("|");r[l[0]]=[o,a3(l[0],l[1])]})}}function a3(t,e){return e?Number(e):l3(t)?0:1}function l3(t){return o3.includes(t.toLowerCase())}const Jg={},ri=t=>{console.error(t)},Xg=(t,...e)=>{console.log(`WARN: ${t}`,...e)},Ai=(t,e)=>{Jg[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),Jg[`${t}/${e}`]=!0)},Pl=new Error;function f1(t,e,{key:n}){let r=0;const i=t[n],o={},s={};for(let a=1;a<=e.length;a++)s[a+r]=i[a],o[a+r]=!0,r+=s1(e[a-1]);t[n]=s,t[n]._emit=o,t[n]._multi=!0}function c3(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw ri("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Pl;if(typeof t.beginScope!="object"||t.beginScope===null)throw ri("beginScope must be object"),Pl;f1(t,t.begin,{key:"beginScope"}),t.begin=Gh(t.begin,{joinWith:""})}}function u3(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw ri("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Pl;if(typeof t.endScope!="object"||t.endScope===null)throw ri("endScope must be object"),Pl;f1(t,t.end,{key:"endScope"}),t.end=Gh(t.end,{joinWith:""})}}function d3(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope)}function f3(t){d3(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),c3(t),u3(t)}function h3(t){function e(s,a){return new RegExp(Ps(s),"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+=s1(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const a=this.regexes.map(l=>l[1]);this.matcherRe=e(Gh(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((d,f)=>f>0&&d!==void 0),u=this.matchIndexes[c];return l.splice(0,c),Object.assign(l,u)}}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,u])=>l.addRule(c,u)),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 u=this.getMatcher(0);u.lastIndex=this.lastIndex+1,c=u.exec(a)}return c&&(this.regexIndex+=c.position+1,this.regexIndex===this.count&&this.considerAll()),c}}function i(s){const a=new r;return s.contains.forEach(l=>a.addRule(l.begin,{rule:l,type:"begin"})),s.terminatorEnd&&a.addRule(s.terminatorEnd,{type:"end"}),s.illegal&&a.addRule(s.illegal,{type:"illegal"}),a}function o(s,a){const l=s;if(s.isCompiled)return l;[QB,n3,f3,i3].forEach(u=>u(s,a)),t.compilerExtensions.forEach(u=>u(s,a)),s.__beforeBegin=null,[e3,t3,r3].forEach(u=>u(s,a)),s.isCompiled=!0;let c=null;return typeof s.keywords=="object"&&s.keywords.$pattern&&(s.keywords=Object.assign({},s.keywords),c=s.keywords.$pattern,delete s.keywords.$pattern),c=c||/\w+/,s.keywords&&(s.keywords=d1(s.keywords,t.case_insensitive)),l.keywordPatternRe=e(c,!0),a&&(s.begin||(s.begin=/\B|\b/),l.beginRe=e(l.begin),!s.end&&!s.endsWithParent&&(s.end=/\B|\b/),s.end&&(l.endRe=e(l.end)),l.terminatorEnd=Ps(l.end)||"",s.endsWithParent&&a.terminatorEnd&&(l.terminatorEnd+=(s.end?"|":"")+a.terminatorEnd)),s.illegal&&(l.illegalRe=e(s.illegal)),s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map(function(u){return p3(u==="self"?s:u)})),s.contains.forEach(function(u){o(u,l)}),s.starts&&o(s.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=xr(t.classNameAliases||{}),o(t)}function h1(t){return t?t.endsWithParent||h1(t.starts):!1}function p3(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return xr(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:h1(t)?xr(t,{starts:t.starts?xr(t.starts):null}):Object.isFrozen(t)?xr(t):t}var m3="11.10.0";let g3=class extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}};const id=r1,Zg=xr,Qg=Symbol("nomatch"),y3=7,p1=function(t){const e=Object.create(null),n=Object.create(null),r=[];let i=!0;const o="Could not find the language '{}', did you forget to load/include a language module?",s={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:AB};function l(T){return a.noHighlightRe.test(T)}function c(T){let _=T.className+" ";_+=T.parentNode?T.parentNode.className:"";const I=a.languageDetectRe.exec(_);if(I){const j=M(I[1]);return j||(Xg(o.replace("{}",I[1])),Xg("Falling back to no-highlight mode for this block.",T)),j?I[1]:"no-highlight"}return _.split(/\s+/).find(j=>l(j)||M(j))}function u(T,_,I){let j="",G="";typeof _=="object"?(j=T,I=_.ignoreIllegals,G=_.language):(Ai("10.7.0","highlight(lang, code, ...args) has been deprecated."),Ai("10.7.0",`Please use highlight(code, options) instead.
483
- https://github.com/highlightjs/highlight.js/issues/2277`),G=T,j=_),I===void 0&&(I=!0);const ie={code:j,language:G};K("before:highlight",ie);const ae=ie.result?ie.result:d(ie.language,ie.code,I);return ae.code=ie.code,K("after:highlight",ae),ae}function d(T,_,I,j){const G=Object.create(null);function ie(O,B){return O.keywords[B]}function ae(){if(!ne.keywords){le.addText(we);return}let O=0;ne.keywordPatternRe.lastIndex=0;let B=ne.keywordPatternRe.exec(we),q="";for(;B;){q+=we.substring(O,B.index);const de=ce.case_insensitive?B[0].toLowerCase():B[0],Oe=ie(ne,de);if(Oe){const[Pt,Oo]=Oe;if(le.addText(q),q="",G[de]=(G[de]||0)+1,G[de]<=y3&&(Je+=Oo),Pt.startsWith("_"))q+=B[0];else{const R=ce.classNameAliases[Pt]||Pt;me(B[0],R)}}else q+=B[0];O=ne.keywordPatternRe.lastIndex,B=ne.keywordPatternRe.exec(we)}q+=we.substring(O),le.addText(q)}function W(){if(we==="")return;let O=null;if(typeof ne.subLanguage=="string"){if(!e[ne.subLanguage]){le.addText(we);return}O=d(ne.subLanguage,we,!0,_e[ne.subLanguage]),_e[ne.subLanguage]=O._top}else O=h(we,ne.subLanguage.length?ne.subLanguage:null);ne.relevance>0&&(Je+=O.relevance),le.__addSublanguage(O._emitter,O.language)}function J(){ne.subLanguage!=null?W():ae(),we=""}function me(O,B){O!==""&&(le.startScope(B),le.addText(O),le.endScope())}function pe(O,B){let q=1;const de=B.length-1;for(;q<=de;){if(!O._emit[q]){q++;continue}const Oe=ce.classNameAliases[O[q]]||O[q],Pt=B[q];Oe?me(Pt,Oe):(we=Pt,ae(),we=""),q++}}function Me(O,B){return O.scope&&typeof O.scope=="string"&&le.openNode(ce.classNameAliases[O.scope]||O.scope),O.beginScope&&(O.beginScope._wrap?(me(we,ce.classNameAliases[O.beginScope._wrap]||O.beginScope._wrap),we=""):O.beginScope._multi&&(pe(O.beginScope,B),we="")),ne=Object.create(O,{parent:{value:ne}}),ne}function ke(O,B,q){let de=IB(O.endRe,q);if(de){if(O["on:end"]){const Oe=new Gg(O);O["on:end"](B,Oe),Oe.isMatchIgnored&&(de=!1)}if(de){for(;O.endsParent&&O.parent;)O=O.parent;return O}}if(O.endsWithParent)return ke(O.parent,B,q)}function Se(O){return ne.matcher.regexIndex===0?(we+=O[0],1):(V=!0,0)}function Ie(O){const B=O[0],q=O.rule,de=new Gg(q),Oe=[q.__beforeBegin,q["on:begin"]];for(const Pt of Oe)if(Pt&&(Pt(O,de),de.isMatchIgnored))return Se(B);return q.skip?we+=B:(q.excludeBegin&&(we+=B),J(),!q.returnBegin&&!q.excludeBegin&&(we=B)),Me(q,O),q.returnBegin?0:B.length}function Te(O){const B=O[0],q=_.substring(O.index),de=ke(ne,O,q);if(!de)return Qg;const Oe=ne;ne.endScope&&ne.endScope._wrap?(J(),me(B,ne.endScope._wrap)):ne.endScope&&ne.endScope._multi?(J(),pe(ne.endScope,O)):Oe.skip?we+=B:(Oe.returnEnd||Oe.excludeEnd||(we+=B),J(),Oe.excludeEnd&&(we=B));do ne.scope&&le.closeNode(),!ne.skip&&!ne.subLanguage&&(Je+=ne.relevance),ne=ne.parent;while(ne!==de.parent);return de.starts&&Me(de.starts,O),Oe.returnEnd?0:B.length}function Ce(){const O=[];for(let B=ne;B!==ce;B=B.parent)B.scope&&O.unshift(B.scope);O.forEach(B=>le.openNode(B))}let We={};function Be(O,B){const q=B&&B[0];if(we+=O,q==null)return J(),0;if(We.type==="begin"&&B.type==="end"&&We.index===B.index&&q===""){if(we+=_.slice(B.index,B.index+1),!i){const de=new Error(`0 width match regex (${T})`);throw de.languageName=T,de.badRule=We.rule,de}return 1}if(We=B,B.type==="begin")return Ie(B);if(B.type==="illegal"&&!I){const de=new Error('Illegal lexeme "'+q+'" for mode "'+(ne.scope||"<unnamed>")+'"');throw de.mode=ne,de}else if(B.type==="end"){const de=Te(B);if(de!==Qg)return de}if(B.type==="illegal"&&q==="")return 1;if(Kt>1e5&&Kt>B.index*3)throw new Error("potential infinite loop, way more iterations than matches");return we+=q,q.length}const ce=M(T);if(!ce)throw ri(o.replace("{}",T)),new Error('Unknown language: "'+T+'"');const Ye=h3(ce);let X="",ne=j||Ye;const _e={},le=new a.__emitter(a);Ce();let we="",Je=0,lt=0,Kt=0,V=!1;try{if(ce.__emitTokens)ce.__emitTokens(_,le);else{for(ne.matcher.considerAll();;){Kt++,V?V=!1:ne.matcher.considerAll(),ne.matcher.lastIndex=lt;const O=ne.matcher.exec(_);if(!O)break;const B=_.substring(lt,O.index),q=Be(B,O);lt=O.index+q}Be(_.substring(lt))}return le.finalize(),X=le.toHTML(),{language:T,value:X,relevance:Je,illegal:!1,_emitter:le,_top:ne}}catch(O){if(O.message&&O.message.includes("Illegal"))return{language:T,value:id(_),illegal:!0,relevance:0,_illegalBy:{message:O.message,index:lt,context:_.slice(lt-100,lt+100),mode:O.mode,resultSoFar:X},_emitter:le};if(i)return{language:T,value:id(_),illegal:!1,relevance:0,errorRaised:O,_emitter:le,_top:ne};throw O}}function f(T){const _={value:id(T),illegal:!1,relevance:0,_top:s,_emitter:new a.__emitter(a)};return _._emitter.addText(T),_}function h(T,_){_=_||a.languages||Object.keys(e);const I=f(T),j=_.filter(M).filter(H).map(J=>d(J,T,!1));j.unshift(I);const G=j.sort((J,me)=>{if(J.relevance!==me.relevance)return me.relevance-J.relevance;if(J.language&&me.language){if(M(J.language).supersetOf===me.language)return 1;if(M(me.language).supersetOf===J.language)return-1}return 0}),[ie,ae]=G,W=ie;return W.secondBest=ae,W}function m(T,_,I){const j=_&&n[_]||I;T.classList.add("hljs"),T.classList.add(`language-${j}`)}function g(T){let _=null;const I=c(T);if(l(I))return;if(K("before:highlightElement",{el:T,language:I}),T.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",T);return}if(T.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(T)),a.throwUnescapedHTML))throw new g3("One of your code blocks includes unescaped HTML.",T.innerHTML);_=T;const j=_.textContent,G=I?u(j,{language:I,ignoreIllegals:!0}):h(j);T.innerHTML=G.value,T.dataset.highlighted="yes",m(T,I,G.language),T.result={language:G.language,re:G.relevance,relevance:G.relevance},G.secondBest&&(T.secondBest={language:G.secondBest.language,relevance:G.secondBest.relevance}),K("after:highlightElement",{el:T,result:G,text:j})}function y(T){a=Zg(a,T)}const b=()=>{v(),Ai("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function w(){v(),Ai("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let E=!1;function v(){if(document.readyState==="loading"){E=!0;return}document.querySelectorAll(a.cssSelector).forEach(g)}function k(){E&&v()}typeof window<"u"&&window.addEventListener&&window.addEventListener("DOMContentLoaded",k,!1);function C(T,_){let I=null;try{I=_(t)}catch(j){if(ri("Language definition for '{}' could not be registered.".replace("{}",T)),i)ri(j);else throw j;I=s}I.name||(I.name=T),e[T]=I,I.rawDefinition=_.bind(null,t),I.aliases&&D(I.aliases,{languageName:T})}function S(T){delete e[T];for(const _ of Object.keys(n))n[_]===T&&delete n[_]}function N(){return Object.keys(e)}function M(T){return T=(T||"").toLowerCase(),e[T]||e[n[T]]}function D(T,{languageName:_}){typeof T=="string"&&(T=[T]),T.forEach(I=>{n[I.toLowerCase()]=_})}function H(T){const _=M(T);return _&&!_.disableAutodetect}function $(T){T["before:highlightBlock"]&&!T["before:highlightElement"]&&(T["before:highlightElement"]=_=>{T["before:highlightBlock"](Object.assign({block:_.el},_))}),T["after:highlightBlock"]&&!T["after:highlightElement"]&&(T["after:highlightElement"]=_=>{T["after:highlightBlock"](Object.assign({block:_.el},_))})}function z(T){$(T),r.push(T)}function L(T){const _=r.indexOf(T);_!==-1&&r.splice(_,1)}function K(T,_){const I=T;r.forEach(function(j){j[I]&&j[I](_)})}function A(T){return Ai("10.7.0","highlightBlock will be removed entirely in v12.0"),Ai("10.7.0","Please use highlightElement now."),g(T)}Object.assign(t,{highlight:u,highlightAuto:h,highlightAll:v,highlightElement:g,highlightBlock:A,configure:y,initHighlighting:b,initHighlightingOnLoad:w,registerLanguage:C,unregisterLanguage:S,listLanguages:N,getLanguage:M,registerAliases:D,autoDetection:H,inherit:Zg,addPlugin:z,removePlugin:L}),t.debugMode=function(){i=!1},t.safeMode=function(){i=!0},t.versionString=m3,t.regex={concat:yi,lookahead:o1,either:Kh,optional:OB,anyNumberOfTimes:MB};for(const T in Na)typeof Na[T]=="object"&&n1(Na[T]);return Object.assign(t,Na),t},mo=p1({});mo.newInstance=()=>p1({});var b3=mo;mo.HighlightJS=mo;mo.default=mo;var v3=CB(b3);function m1(t,e=[]){return t.map(n=>{const r=[...e,...n.properties?n.properties.className:[]];return n.children?m1(n.children,r):{text:n.value,classes:r}}).flat()}function ey(t){return t.value||t.children||[]}function x3(t){return!!v3.getLanguage(t)}function ty({doc:t,name:e,lowlight:n,defaultLanguage:r}){const i=[];return Qi(t,o=>o.type.name===e).forEach(o=>{var s;let a=o.pos+1;const l=o.node.attrs.language||r,c=n.listLanguages(),u=l&&(c.includes(l)||x3(l)||!((s=n.registered)===null||s===void 0)&&s.call(n,l))?ey(n.highlight(l,o.node.textContent)):ey(n.highlightAuto(o.node.textContent));m1(u).forEach(d=>{const f=a+d.text.length;if(d.classes.length){const h=pt.inline(a,f,{class:d.classes.join(" ")});i.push(h)}a=f})}),He.create(t,i)}function w3(t){return typeof t=="function"}function E3({name:t,lowlight:e,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(i=>w3(e[i])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const r=new $e({key:new Pe("lowlight"),state:{init:(i,{doc:o})=>ty({doc:o,name:t,lowlight:e,defaultLanguage:n}),apply:(i,o,s,a)=>{const l=s.selection.$head.parent.type.name,c=a.selection.$head.parent.type.name,u=Qi(s.doc,f=>f.type.name===t),d=Qi(a.doc,f=>f.type.name===t);return i.docChanged&&([l,c].includes(t)||d.length!==u.length||i.steps.some(f=>f.from!==void 0&&f.to!==void 0&&u.some(h=>h.pos>=f.from&&h.pos+h.node.nodeSize<=f.to)))?ty({doc:i.doc,name:t,lowlight:e,defaultLanguage:n}):o.map(i.mapping,i.doc)}},props:{decorations(i){return r.getState(i)}}});return r}const k3=t1.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))||[],E3({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}});function g1(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]+;/},o={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},s=t.inherit(o,{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:[o,l,a,s,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[o,s,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 C3(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",s="(?!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})"/})]},u={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},d={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},k={className:"function.dispatch",relevance:0,keywords:{_hint:b},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},C=[k,d,a,n,t.C_BLOCK_COMMENT_MODE,u,c],S={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:v,contains:C.concat([{begin:/\(/,end:/\)/,keywords:v,contains:C.concat(["self"]),relevance:0}]),relevance:0},N={className:"function",begin:"("+s+"[\\*&\\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,u]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,c,u,a,{begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,c,u,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,d]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:v,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(S,N,k,C,[d,{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 S3(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=C3(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 _3(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]},o=t.inherit(t.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),s={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:/'/},u={match:/\\'/},d={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"],E=["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"],k=["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,...E,"set","shopt",...v,...k]},contains:[h,t.SHEBANG(),m,d,o,s,b,a,l,c,u,n]}}function N3(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",s="("+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})"/})]},u={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},d={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=[d,a,n,t.C_BLOCK_COMMENT_MODE,u,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},E={begin:"("+s+"[\\*&\\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,u,a,{begin:/\(/,end:/\)/,keywords:y,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,c,u,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,d]};return{name:"C",aliases:["h"],keywords:y,disableAutodetect:!0,illegal:"</",contains:[].concat(w,E,b,[d,{begin:t.IDENT_RE+"::",keywords:y},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},t.TITLE_MODE]}]),exports:{preprocessor:d,strings:c,keywords:y}}}function T3(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",s="(?!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})"/})]},u={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},d={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},k={className:"function.dispatch",relevance:0,keywords:{_hint:b},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},C=[k,d,a,n,t.C_BLOCK_COMMENT_MODE,u,c],S={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:v,contains:C.concat([{begin:/\(/,end:/\)/,keywords:v,contains:C.concat(["self"]),relevance:0}]),relevance:0},N={className:"function",begin:"("+s+"[\\*&\\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,u]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,c,u,a,{begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,c,u,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,d]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:v,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(S,N,k,C,[d,{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 A3(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"],o=["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"],s={keyword:i.concat(o),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},u={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},d=t.inherit(u,{illegal:/\n/}),f={className:"subst",begin:/\{/,end:/\}/,keywords:s},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,u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,l,t.C_BLOCK_COMMENT_MODE],h.contains=[y,m,d,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,l,t.inherit(t.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const b={variants:[c,g,m,u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},w={begin:"<",end:">",contains:[{beginKeywords:"in out"},a]},E=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:s,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:"("+E+"\\s+)+"+t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:s,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:s,relevance:0,contains:[b,l,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},v]}}const M3=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_-]*/}}),O3=["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"],R3=["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"],I3=[...O3,...R3],D3=["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(),L3=["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(),P3=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),B3=["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 $3(t){const e=t.regex,n=M3(t),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",o=/@-?\w[\w]*(-\w+)*/,s="[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:"\\."+s,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+L3.join("|")+")"},{begin:":(:)?("+P3.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+B3.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:o},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:D3.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+I3.join("|")+")\\b"}]}}function j3(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 F3(t){const o={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:o,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:o,illegal:/["']/}]}]}}function H3(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 z3(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:/\$\{(.*?)\}/}]},o={className:"literal",begin:/\bon|off|true|false|yes|no\b/},s={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},a={begin:/\[/,end:/\]/,contains:[r,o,i,s,n,"self"],relevance:0},l=/[A-Za-z0-9_-]+/,c=/"(\\"|[^"])*"/,u=/'[^']*'/,d=e.either(l,c,u),f=e.concat(d,"(\\s*\\.\\s*",d,")*",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,o,i,s,n]}}]}}var Pi="[0-9](_*[0-9])*",Ta=`\\.(${Pi})`,Aa="[0-9a-fA-F](_*[0-9a-fA-F])*",ny={className:"number",variants:[{begin:`(\\b(${Pi})((${Ta})|\\.)?|(${Ta}))[eE][+-]?(${Pi})[fFdD]?\\b`},{begin:`\\b(${Pi})((${Ta})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Ta})[fFdD]?\\b`},{begin:`\\b(${Pi})[fFdD]\\b`},{begin:`\\b0[xX]((${Aa})\\.?|(${Aa})?\\.(${Aa}))[pP][+-]?(${Pi})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Aa})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function y1(t,e,n){return n===-1?"":t.replace(e,r=>y1(t,e,n-1))}function U3(t){const e=t.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+y1("(?:<"+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"]}]},u={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:[u,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,ny,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},ny,c]}}const ry="[A-Za-z$_][0-9A-Za-z$_]*",V3=["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"],W3=["true","false","null","undefined","NaN","Infinity"],b1=["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"],v1=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],x1=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],K3=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],G3=[].concat(x1,b1,v1);function q3(t){const e=t.regex,n=(_,{after:I})=>{const j="</"+_[0].slice(1);return _.input.indexOf(j,I)!==-1},r=ry,i={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(_,I)=>{const j=_[0].length+_.index,G=_.input[j];if(G==="<"||G===","){I.ignoreMatch();return}G===">"&&(n(_,{after:j})||I.ignoreMatch());let ie;const ae=_.input.substring(j);if(ie=ae.match(/^\s*=/)){I.ignoreMatch();return}if((ie=ae.match(/^\s+extends\s+/))&&ie.index===0){I.ignoreMatch();return}}},a={$pattern:ry,keyword:V3,literal:W3,built_in:G3,"variable.language":K3},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\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]},E=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,h,m,g,y,{match:/\$\d+/},d];f.contains=E.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(E)});const v=[].concat(w,f.contains),k=v.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(v)}]),C={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:k},S={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:{_:[...b1,...v1]}},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:[C],illegal:/%/},H={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function $(_){return e.concat("(?!",_.join("|"),")")}const z={match:e.concat(/\b/,$([...x1,"super","import"].map(_=>`${_}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},L={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},K={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},C]},A="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",T={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(A)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[C]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:k,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+/},d,N,{scope:"attr",match:r+e.lookahead(":"),relevance:0},T,{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:A,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:k}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:o},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.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:[C,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},L,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[C]},z,H,S,K,{match:/\$[(.]/}]}}function Y3(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 Bi="[0-9](_*[0-9])*",Ma=`\\.(${Bi})`,Oa="[0-9a-fA-F](_*[0-9a-fA-F])*",J3={className:"number",variants:[{begin:`(\\b(${Bi})((${Ma})|\\.)?|(${Ma}))[eE][+-]?(${Bi})[fFdD]?\\b`},{begin:`\\b(${Bi})((${Ma})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Ma})[fFdD]?\\b`},{begin:`\\b(${Bi})[fFdD]\\b`},{begin:`\\b0[xX]((${Oa})\\.?|(${Oa})?\\.(${Oa}))[pP][+-]?(${Bi})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Oa})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function X3(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]},o={className:"variable",begin:"\\$"+t.UNDERSCORE_IDENT_RE},s={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[o,i]},{begin:"'",end:"'",illegal:/\n/,contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[t.BACKSLASH_ESCAPE,o,i]}]};i.contains.push(s);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(s,{className:"string"}),"self"]}]},c=J3,u=t.COMMENT("/\\*","\\*/",{contains:[t.C_BLOCK_COMMENT_MODE]}),d={variants:[{className:"type",begin:t.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},f=d;return f.variants[1].contains=[d],d.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,u,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:[d,t.C_LINE_COMMENT_MODE,u],relevance:0},t.C_LINE_COMMENT_MODE,u,a,l,s,t.C_NUMBER_MODE]},u]},{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]},s,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
484
- `},c]}}const Z3=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_-]*/}}),Q3=["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"],e4=["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"],t4=[...Q3,...e4],n4=["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(),w1=["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(),E1=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),r4=["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(),i4=w1.concat(E1).sort().reverse();function o4(t){const e=Z3(t),n=i4,r="and or not only",i="[\\w-]+",o="("+i+"|@\\{"+i+"\\})",s=[],a=[],l=function(E){return{className:"string",begin:"~?"+E+".*?"+E}},c=function(E,v,k){return{className:E,begin:v,relevance:k}},u={$pattern:/[a-z-]+/,keyword:r,attribute:n4.join(" ")},d={begin:"\\(",end:"\\)",contains:a,keywords:u,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,d,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:s}),h={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(a)},m={begin:o+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+r4.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:u,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:o,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("+t4.join("|")+")\\b",className:"selector-tag"},e.CSS_NUMBER_MODE,c("selector-tag",o,0),c("selector-id","#"+o),c("selector-class","\\."+o,0),c("selector-tag","&",0),e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+w1.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+E1.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:f},{begin:"!important"},e.FUNCTION_DISPATCH]},w={begin:i+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[b]};return s.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:s}}function s4(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 a4(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*(?=[:+?]?=)"},o={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},s={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,o,s]}}function l4(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}]},o={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},s={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}/}]},u={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},d=t.inherit(c,{contains:[]}),f=t.inherit(u,{contains:[]});c.contains.push(f),u.contains.push(d);let h=[n,l];return[c,u,d,f].forEach(b=>{b.contains=b.contains.concat(h)}),h=h.concat(c,u),{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,o,c,u,{className:"quote",begin:"^>\\s+",contains:h,end:"$"},i,r,l,s,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function c4(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 u4(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(" ")},o={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:i},s={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},u=[t.BACKSLASH_ESCAPE,o,l],d=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],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}),s,{className:"string",contains:u,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(...d,{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(...d,{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 o.contains=m,s.contains=m,{name:"Perl",aliases:["pl","pm"],keywords:i,contains:m}}function d4(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),o=e.concat(/[A-Z]+/,n),s={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}),u=t.inherit(t.QUOTE_STRING_MODE,{illegal:null,contains:t.QUOTE_STRING_MODE.contains.concat(l)}),d={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:t.QUOTE_STRING_MODE.contains.concat(l),"on:begin":(L,K)=>{K.data._beginMatch=L[1]||L[2]},"on:end":(L,K)=>{K.data._beginMatch!==L[1]&&K.ignoreMatch()}},f=t.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),h=`[
485
- ]`,m={scope:"string",variants:[u,c,d,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:(L=>{const K=[];return L.forEach(A=>{K.push(A),A.toLowerCase()===A?K.push(A.toUpperCase()):K.push(A.toLowerCase())}),K})(y),built_in:w},k=L=>L.map(K=>K.replace(/\|\d+$/,"")),C={variants:[{match:[/new/,e.concat(h,"+"),e.concat("(?!",k(w).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},S=e.concat(r,"\\b(?!\\()"),N={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),S],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,e.concat(/::/,e.lookahead(/(?!class\b)/)),S],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,s,N,t.C_BLOCK_COMMENT_MODE,m,g,C]},H={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",k(b).join("\\b|"),"|",k(w).join("\\b|"),"\\b)"),r,e.concat(h,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[D]};D.contains.push(H);const $=[M,N,t.C_BLOCK_COMMENT_MODE,m,g,C],z={begin:e.concat(/#\[\s*\\?/,e.either(i,o)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:y,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:y,keyword:["new","array"]},contains:["self",...$]},...$,{scope:"meta",variants:[{match:i},{match:o}]}]};return{case_insensitive:!1,keywords:v,contains:[z,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/},s,H,N,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},C,{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",z,s,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 f4(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 h4(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function p4(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:/#/},u={begin:/\{\{/,relevance:0},d={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,u,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,l,u,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,u,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,u,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,d,t.HASH_COMMENT_MODE]}]};return c.contains=[d,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"},d,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,d]}]}}function m4(t){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function g4(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=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,o=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:[o,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:o},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function y4(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+)*/),s={"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)],u={className:"subst",begin:/#\{/,end:/\}/,keywords:s},d={className:"string",contains:[t.BACKSLASH_ESCAPE,u],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,u]})]}]},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:s}]},C=[d,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:s},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:s},{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:[d,{begin:n}],relevance:0},m,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:s},{begin:"("+t.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[t.BACKSLASH_ESCAPE,u],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);u.contains=C,g.contains=C;const D=[{begin:/^\s*=>/,starts:{end:"$",contains:C}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:s,contains:C}}];return c.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:s,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(D).concat(c).concat(C)}}function b4(t){const e=t.regex,n=/(r#)?/,r=e.concat(n,t.UNDERSCORE_IDENT_RE),i=e.concat(n,t.IDENT_RE),o={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,e.lookahead(/\s*\(/))},s="([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!"],u=["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:u,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_]+)"+s},{begin:"\\b0o([0-7_]+)"+s},{begin:"\\b0x([A-Fa-f0-9_]+)"+s},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+s}],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:u}},{className:"punctuation",begin:"->"},o]}}const v4=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_-]*/}}),x4=["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"],w4=["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"],E4=[...x4,...w4],k4=["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(),C4=["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(),S4=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),_4=["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 N4(t){const e=v4(t),n=S4,r=C4,i="@[a-z-]+",o="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("+E4.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("+_4.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:o,attribute:k4.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 T4(t){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function A4(t){const e=t.regex,n=t.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},o=["true","false","unknown"],s=["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"],u=["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"],d=["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=u,m=[...c,...l].filter(k=>!u.includes(k)),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(k){return e.concat(/\b/,e.either(...k.map(C=>C.replace(/\s+/,"\\s+"))),/\b/)}const E={scope:"keyword",match:w(f),relevance:0};function v(k,{exceptions:C,when:S}={}){const N=S;return C=C||[],k.map(M=>M.match(/\|\d+$/)||C.includes(M)?M:N(M)?`${M}|0`:M)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:v(m,{when:k=>k.length<3}),literal:o,type:a,built_in:d},contains:[{scope:"type",match:w(s)},E,b,g,r,i,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,y]}}function k1(t){return t?typeof t=="string"?t:t.source:null}function Lo(t){return Re("(?=",t,")")}function Re(...t){return t.map(n=>k1(n)).join("")}function M4(t){const e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function Ct(...t){return"("+(M4(t).capture?"":"?:")+t.map(r=>k1(r)).join("|")+")"}const Yh=t=>Re(/\b/,t,/\w$/.test(t)?/\b/:/\B/),O4=["Protocol","Type"].map(Yh),iy=["init","self"].map(Yh),R4=["Any","Self"],od=["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"],oy=["false","nil","true"],I4=["assignment","associativity","higherThan","left","lowerThan","none","right"],D4=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],sy=["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"],C1=Ct(/[/=\-+!*%<>&|^~?]/,/[\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]/),S1=Ct(C1,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),sd=Re(C1,S1,"*"),_1=Ct(/[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]/),Bl=Ct(_1,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),gn=Re(_1,Bl,"*"),Ra=Re(/[A-Z]/,Bl,"*"),L4=["attached","autoclosure",Re(/convention\(/,Ct("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Re(/objc\(/,gn,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],P4=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function B4(t){const e={match:/\s+/,relevance:0},n=t.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[t.C_LINE_COMMENT_MODE,n],i={match:[/\./,Ct(...O4,...iy)],className:{2:"keyword"}},o={match:Re(/\./,Ct(...od)),relevance:0},s=od.filter(ce=>typeof ce=="string").concat(["_|0"]),a=od.filter(ce=>typeof ce!="string").concat(R4).map(Yh),l={variants:[{className:"keyword",match:Ct(...a,...iy)}]},c={$pattern:Ct(/\b\w+/,/#\w+/),keyword:s.concat(D4),literal:oy},u=[i,o,l],d={match:Re(/\./,Ct(...sy)),relevance:0},f={className:"built_in",match:Re(/\b/,Ct(...sy),/(?=\()/)},h=[d,f],m={match:/->/,relevance:0},g={className:"operator",relevance:0,variants:[{match:sd},{match:`\\.(\\.|${S1})+`}]},y=[m,g],b="([0-9]_*)+",w="([0-9a-fA-F]_*)+",E={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=(ce="")=>({className:"subst",variants:[{match:Re(/\\/,ce,/[0\\tnr"']/)},{match:Re(/\\/,ce,/u\{[0-9a-fA-F]{1,8}\}/)}]}),k=(ce="")=>({className:"subst",match:Re(/\\/,ce,/[\t ]*(?:[\r\n]|\r\n)/)}),C=(ce="")=>({className:"subst",label:"interpol",begin:Re(/\\/,ce,/\(/),end:/\)/}),S=(ce="")=>({begin:Re(ce,/"""/),end:Re(/"""/,ce),contains:[v(ce),k(ce),C(ce)]}),N=(ce="")=>({begin:Re(ce,/"/),end:Re(/"/,ce),contains:[v(ce),C(ce)]}),M={className:"string",variants:[S(),S("#"),S("##"),S("###"),N(),N("#"),N("##"),N("###")]},D=[t.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[t.BACKSLASH_ESCAPE]}],H={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:D},$=ce=>{const Ye=Re(ce,/\//),X=Re(/\//,ce);return{begin:Ye,end:X,contains:[...D,{scope:"comment",begin:`#(?!.*${X})`,end:/$/}]}},z={scope:"regexp",variants:[$("###"),$("##"),$("#"),H]},L={match:Re(/`/,gn,/`/)},K={className:"variable",match:/\$\d+/},A={className:"variable",match:`\\$${Bl}+`},T=[L,K,A],_={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:P4,contains:[...y,E,M]}]}},I={scope:"keyword",match:Re(/@/,Ct(...L4),Lo(Ct(/\(/,/\s+/)))},j={scope:"meta",match:Re(/@/,gn)},G=[_,I,j],ie={match:Lo(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Re(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Bl,"+")},{className:"type",match:Ra,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Re(/\s+&\s+/,Lo(Ra)),relevance:0}]},ae={begin:/</,end:/>/,keywords:c,contains:[...r,...u,...G,m,ie]};ie.contains.push(ae);const W={match:Re(gn,/\s*:/),keywords:"_|0",relevance:0},J={begin:/\(/,end:/\)/,relevance:0,keywords:c,contains:["self",W,...r,z,...u,...h,...y,E,M,...T,...G,ie]},me={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,ie]},pe={begin:Ct(Lo(Re(gn,/\s*:/)),Lo(Re(gn,/\s+/,gn,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:gn}]},Me={begin:/\(/,end:/\)/,keywords:c,contains:[pe,...r,...u,...y,E,M,...G,ie,J],endsParent:!0,illegal:/["']/},ke={match:[/(func|macro)/,/\s+/,Ct(L.match,gn,sd)],className:{1:"keyword",3:"title.function"},contains:[me,Me,e],illegal:[/\[/,/%/]},Se={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[me,Me,e],illegal:/\[|%/},Ie={match:[/operator/,/\s+/,sd],className:{1:"keyword",3:"title"}},Te={begin:[/precedencegroup/,/\s+/,Ra],className:{1:"keyword",3:"title"},contains:[ie],keywords:[...I4,...oy],end:/}/},Ce={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},We={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},Be={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,gn,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:c,contains:[me,...u,{begin:/:/,end:/\{/,keywords:c,contains:[{scope:"title.class.inherited",match:Ra},...u],relevance:0}]};for(const ce of M.variants){const Ye=ce.contains.find(ne=>ne.label==="interpol");Ye.keywords=c;const X=[...u,...h,...y,E,M,...T];Ye.contains=[...X,{begin:/\(/,end:/\)/,contains:["self",...X]}]}return{name:"Swift",keywords:c,contains:[...r,ke,Se,Ce,We,Be,Ie,Te,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},z,...u,...h,...y,E,M,...T,...G,ie,J]}}const $l="[A-Za-z$_][0-9A-Za-z$_]*",N1=["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"],T1=["true","false","null","undefined","NaN","Infinity"],A1=["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"],M1=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],O1=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],R1=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],I1=[].concat(O1,A1,M1);function $4(t){const e=t.regex,n=(_,{after:I})=>{const j="</"+_[0].slice(1);return _.input.indexOf(j,I)!==-1},r=$l,i={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(_,I)=>{const j=_[0].length+_.index,G=_.input[j];if(G==="<"||G===","){I.ignoreMatch();return}G===">"&&(n(_,{after:j})||I.ignoreMatch());let ie;const ae=_.input.substring(j);if(ie=ae.match(/^\s*=/)){I.ignoreMatch();return}if((ie=ae.match(/^\s+extends\s+/))&&ie.index===0){I.ignoreMatch();return}}},a={$pattern:$l,keyword:N1,literal:T1,built_in:I1,"variable.language":R1},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\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]},E=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,h,m,g,y,{match:/\$\d+/},d];f.contains=E.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(E)});const v=[].concat(w,f.contains),k=v.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(v)}]),C={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:k},S={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:{_:[...A1,...M1]}},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:[C],illegal:/%/},H={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function $(_){return e.concat("(?!",_.join("|"),")")}const z={match:e.concat(/\b/,$([...O1,"super","import"].map(_=>`${_}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},L={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},K={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},C]},A="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",T={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(A)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[C]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:k,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+/},d,N,{scope:"attr",match:r+e.lookahead(":"),relevance:0},T,{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:A,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:k}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:o},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.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:[C,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},L,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[C]},z,H,S,K,{match:/\$[(.]/}]}}function j4(t){const e=t.regex,n=$4(t),r=$l,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],o={begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},s={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:$l,keyword:N1.concat(l),literal:T1,built_in:I1.concat(i),"variable.language":R1},u={className:"meta",begin:"@"+r},d=(g,y,b)=>{const w=g.contains.findIndex(E=>E.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(u);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([u,o,s,h]),d(n,"shebang",t.SHEBANG()),d(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 F4(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}/,o=/\d{4}-\d{1,2}-\d{1,2}/,s=/(\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(o,i),/ *#/)},{begin:e.concat(/# */,a,/ *#/)},{begin:e.concat(/# */,s,/ *#/)},{begin:e.concat(/# */,e.either(o,i),/ +/,e.either(s,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])|[%&])?/}]},u={className:"label",begin:/^\w+:/},d=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,u,d,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 H4(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"}},o={className:"variable",begin:/\$[\w_]+/},s={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"}},o,s,i,t.QUOTE_STRING_MODE,l,c,a]}}function z4(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:/\}/}]},o={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},s={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,i]},a=t.inherit(s,{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,o,s],b=[...y];return b.pop(),b.push(a),h.contains=b,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:y}}const U4={arduino:S3,bash:_3,c:N3,cpp:T3,csharp:A3,css:$3,diff:j3,go:F3,graphql:H3,ini:z3,java:U3,javascript:q3,json:Y3,kotlin:X3,less:o4,lua:s4,makefile:a4,markdown:l4,objectivec:c4,perl:u4,php:d4,"php-template":f4,plaintext:h4,python:p4,"python-repl":m4,r:g4,ruby:y4,rust:b4,scss:N4,shell:T4,sql:A4,swift:B4,typescript:j4,vbnet:F4,wasm:H4,xml:g1,yaml:z4};function D1(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)&&D1(n)}),t}class ay{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function L1(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function wr(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 V4="</span>",ly=t=>!!t.scope,W4=(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 K4{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=L1(e)}openNode(e){if(!ly(e))return;const n=W4(e.scope,{prefix:this.classPrefix});this.span(n)}closeNode(e){ly(e)&&(this.buffer+=V4)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}}const cy=(t={})=>{const e={children:[]};return Object.assign(e,t),e};class Jh{constructor(){this.rootNode=cy(),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=cy({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=>{Jh._collapse(n)}))}}class G4 extends Jh{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 K4(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function $s(t){return t?typeof t=="string"?t:t.source:null}function P1(t){return bi("(?=",t,")")}function q4(t){return bi("(?:",t,")*")}function Y4(t){return bi("(?:",t,")?")}function bi(...t){return t.map(n=>$s(n)).join("")}function J4(t){const e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function Xh(...t){return"("+(J4(t).capture?"":"?:")+t.map(r=>$s(r)).join("|")+")"}function B1(t){return new RegExp(t.toString()+"|").exec("").length-1}function X4(t,e){const n=t&&t.exec(e);return n&&n.index===0}const Z4=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Zh(t,{joinWith:e}){let n=0;return t.map(r=>{n+=1;const i=n;let o=$s(r),s="";for(;o.length>0;){const a=Z4.exec(o);if(!a){s+=o;break}s+=o.substring(0,a.index),o=o.substring(a.index+a[0].length),a[0][0]==="\\"&&a[1]?s+="\\"+String(Number(a[1])+i):(s+=a[0],a[0]==="("&&n++)}return s}).map(r=>`(${r})`).join(e)}const Q4=/\b\B/,$1="[a-zA-Z]\\w*",Qh="[a-zA-Z_]\\w*",j1="\\b\\d+(\\.\\d+)?",F1="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",H1="\\b(0b[01]+)",e5="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",t5=(t={})=>{const e=/^#![ ]*\//;return t.binary&&(t.begin=bi(e,/.*\b/,t.binary,/\b.*/)),wr({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},t)},js={begin:"\\\\[\\s\\S]",relevance:0},n5={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[js]},r5={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[js]},i5={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/},ru=function(t,e,n={}){const r=wr({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=Xh("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:bi(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},o5=ru("//","$"),s5=ru("/\\*","\\*/"),a5=ru("#","$"),l5={scope:"number",begin:j1,relevance:0},c5={scope:"number",begin:F1,relevance:0},u5={scope:"number",begin:H1,relevance:0},d5={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[js,{begin:/\[/,end:/\]/,relevance:0,contains:[js]}]},f5={scope:"title",begin:$1,relevance:0},h5={scope:"title",begin:Qh,relevance:0},p5={begin:"\\.\\s*"+Qh,relevance:0},m5=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 Ia=Object.freeze({__proto__:null,APOS_STRING_MODE:n5,BACKSLASH_ESCAPE:js,BINARY_NUMBER_MODE:u5,BINARY_NUMBER_RE:H1,COMMENT:ru,C_BLOCK_COMMENT_MODE:s5,C_LINE_COMMENT_MODE:o5,C_NUMBER_MODE:c5,C_NUMBER_RE:F1,END_SAME_AS_BEGIN:m5,HASH_COMMENT_MODE:a5,IDENT_RE:$1,MATCH_NOTHING_RE:Q4,METHOD_GUARD:p5,NUMBER_MODE:l5,NUMBER_RE:j1,PHRASAL_WORDS_MODE:i5,QUOTE_STRING_MODE:r5,REGEXP_MODE:d5,RE_STARTERS_RE:e5,SHEBANG:t5,TITLE_MODE:f5,UNDERSCORE_IDENT_RE:Qh,UNDERSCORE_TITLE_MODE:h5});function g5(t,e){t.input[t.index-1]==="."&&e.ignoreMatch()}function y5(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className)}function b5(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=g5,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0))}function v5(t,e){Array.isArray(t.illegal)&&(t.illegal=Xh(...t.illegal))}function x5(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 w5(t,e){t.relevance===void 0&&(t.relevance=1)}const E5=(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=bi(n.beforeMatch,P1(n.begin)),t.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},t.relevance=0,delete n.beforeMatch},k5=["of","and","for","in","not","or","if","then","parent","list","value"],C5="keyword";function z1(t,e,n=C5){const r=Object.create(null);return typeof t=="string"?i(n,t.split(" ")):Array.isArray(t)?i(n,t):Object.keys(t).forEach(function(o){Object.assign(r,z1(t[o],e,o))}),r;function i(o,s){e&&(s=s.map(a=>a.toLowerCase())),s.forEach(function(a){const l=a.split("|");r[l[0]]=[o,S5(l[0],l[1])]})}}function S5(t,e){return e?Number(e):_5(t)?0:1}function _5(t){return k5.includes(t.toLowerCase())}const uy={},ii=t=>{console.error(t)},dy=(t,...e)=>{console.log(`WARN: ${t}`,...e)},Mi=(t,e)=>{uy[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),uy[`${t}/${e}`]=!0)},jl=new Error;function U1(t,e,{key:n}){let r=0;const i=t[n],o={},s={};for(let a=1;a<=e.length;a++)s[a+r]=i[a],o[a+r]=!0,r+=B1(e[a-1]);t[n]=s,t[n]._emit=o,t[n]._multi=!0}function N5(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw ii("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),jl;if(typeof t.beginScope!="object"||t.beginScope===null)throw ii("beginScope must be object"),jl;U1(t,t.begin,{key:"beginScope"}),t.begin=Zh(t.begin,{joinWith:""})}}function T5(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw ii("skip, excludeEnd, returnEnd not compatible with endScope: {}"),jl;if(typeof t.endScope!="object"||t.endScope===null)throw ii("endScope must be object"),jl;U1(t,t.end,{key:"endScope"}),t.end=Zh(t.end,{joinWith:""})}}function A5(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope)}function M5(t){A5(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),N5(t),T5(t)}function O5(t){function e(s,a){return new RegExp($s(s),"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+=B1(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const a=this.regexes.map(l=>l[1]);this.matcherRe=e(Zh(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((d,f)=>f>0&&d!==void 0),u=this.matchIndexes[c];return l.splice(0,c),Object.assign(l,u)}}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,u])=>l.addRule(c,u)),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 u=this.getMatcher(0);u.lastIndex=this.lastIndex+1,c=u.exec(a)}return c&&(this.regexIndex+=c.position+1,this.regexIndex===this.count&&this.considerAll()),c}}function i(s){const a=new r;return s.contains.forEach(l=>a.addRule(l.begin,{rule:l,type:"begin"})),s.terminatorEnd&&a.addRule(s.terminatorEnd,{type:"end"}),s.illegal&&a.addRule(s.illegal,{type:"illegal"}),a}function o(s,a){const l=s;if(s.isCompiled)return l;[y5,x5,M5,E5].forEach(u=>u(s,a)),t.compilerExtensions.forEach(u=>u(s,a)),s.__beforeBegin=null,[b5,v5,w5].forEach(u=>u(s,a)),s.isCompiled=!0;let c=null;return typeof s.keywords=="object"&&s.keywords.$pattern&&(s.keywords=Object.assign({},s.keywords),c=s.keywords.$pattern,delete s.keywords.$pattern),c=c||/\w+/,s.keywords&&(s.keywords=z1(s.keywords,t.case_insensitive)),l.keywordPatternRe=e(c,!0),a&&(s.begin||(s.begin=/\B|\b/),l.beginRe=e(l.begin),!s.end&&!s.endsWithParent&&(s.end=/\B|\b/),s.end&&(l.endRe=e(l.end)),l.terminatorEnd=$s(l.end)||"",s.endsWithParent&&a.terminatorEnd&&(l.terminatorEnd+=(s.end?"|":"")+a.terminatorEnd)),s.illegal&&(l.illegalRe=e(s.illegal)),s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map(function(u){return R5(u==="self"?s:u)})),s.contains.forEach(function(u){o(u,l)}),s.starts&&o(s.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=wr(t.classNameAliases||{}),o(t)}function V1(t){return t?t.endsWithParent||V1(t.starts):!1}function R5(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return wr(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:V1(t)?wr(t,{starts:t.starts?wr(t.starts):null}):Object.isFrozen(t)?wr(t):t}var I5="11.11.1";class D5 extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}}const ad=L1,fy=wr,hy=Symbol("nomatch"),L5=7,W1=function(t){const e=Object.create(null),n=Object.create(null),r=[];let i=!0;const o="Could not find the language '{}', did you forget to load/include a language module?",s={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:G4};function l(A){return a.noHighlightRe.test(A)}function c(A){let T=A.className+" ";T+=A.parentNode?A.parentNode.className:"";const _=a.languageDetectRe.exec(T);if(_){const I=N(_[1]);return I||(dy(o.replace("{}",_[1])),dy("Falling back to no-highlight mode for this block.",A)),I?_[1]:"no-highlight"}return T.split(/\s+/).find(I=>l(I)||N(I))}function u(A,T,_){let I="",j="";typeof T=="object"?(I=A,_=T.ignoreIllegals,j=T.language):(Mi("10.7.0","highlight(lang, code, ...args) has been deprecated."),Mi("10.7.0",`Please use highlight(code, options) instead.
486
- https://github.com/highlightjs/highlight.js/issues/2277`),j=A,I=T),_===void 0&&(_=!0);const G={code:I,language:j};L("before:highlight",G);const ie=G.result?G.result:d(G.language,G.code,_);return ie.code=G.code,L("after:highlight",ie),ie}function d(A,T,_,I){const j=Object.create(null);function G(V,O){return V.keywords[O]}function ie(){if(!X.keywords){_e.addText(le);return}let V=0;X.keywordPatternRe.lastIndex=0;let O=X.keywordPatternRe.exec(le),B="";for(;O;){B+=le.substring(V,O.index);const q=Be.case_insensitive?O[0].toLowerCase():O[0],de=G(X,q);if(de){const[Oe,Pt]=de;if(_e.addText(B),B="",j[q]=(j[q]||0)+1,j[q]<=L5&&(we+=Pt),Oe.startsWith("_"))B+=O[0];else{const Oo=Be.classNameAliases[Oe]||Oe;J(O[0],Oo)}}else B+=O[0];V=X.keywordPatternRe.lastIndex,O=X.keywordPatternRe.exec(le)}B+=le.substring(V),_e.addText(B)}function ae(){if(le==="")return;let V=null;if(typeof X.subLanguage=="string"){if(!e[X.subLanguage]){_e.addText(le);return}V=d(X.subLanguage,le,!0,ne[X.subLanguage]),ne[X.subLanguage]=V._top}else V=h(le,X.subLanguage.length?X.subLanguage:null);X.relevance>0&&(we+=V.relevance),_e.__addSublanguage(V._emitter,V.language)}function W(){X.subLanguage!=null?ae():ie(),le=""}function J(V,O){V!==""&&(_e.startScope(O),_e.addText(V),_e.endScope())}function me(V,O){let B=1;const q=O.length-1;for(;B<=q;){if(!V._emit[B]){B++;continue}const de=Be.classNameAliases[V[B]]||V[B],Oe=O[B];de?J(Oe,de):(le=Oe,ie(),le=""),B++}}function pe(V,O){return V.scope&&typeof V.scope=="string"&&_e.openNode(Be.classNameAliases[V.scope]||V.scope),V.beginScope&&(V.beginScope._wrap?(J(le,Be.classNameAliases[V.beginScope._wrap]||V.beginScope._wrap),le=""):V.beginScope._multi&&(me(V.beginScope,O),le="")),X=Object.create(V,{parent:{value:X}}),X}function Me(V,O,B){let q=X4(V.endRe,B);if(q){if(V["on:end"]){const de=new ay(V);V["on:end"](O,de),de.isMatchIgnored&&(q=!1)}if(q){for(;V.endsParent&&V.parent;)V=V.parent;return V}}if(V.endsWithParent)return Me(V.parent,O,B)}function ke(V){return X.matcher.regexIndex===0?(le+=V[0],1):(Kt=!0,0)}function Se(V){const O=V[0],B=V.rule,q=new ay(B),de=[B.__beforeBegin,B["on:begin"]];for(const Oe of de)if(Oe&&(Oe(V,q),q.isMatchIgnored))return ke(O);return B.skip?le+=O:(B.excludeBegin&&(le+=O),W(),!B.returnBegin&&!B.excludeBegin&&(le=O)),pe(B,V),B.returnBegin?0:O.length}function Ie(V){const O=V[0],B=T.substring(V.index),q=Me(X,V,B);if(!q)return hy;const de=X;X.endScope&&X.endScope._wrap?(W(),J(O,X.endScope._wrap)):X.endScope&&X.endScope._multi?(W(),me(X.endScope,V)):de.skip?le+=O:(de.returnEnd||de.excludeEnd||(le+=O),W(),de.excludeEnd&&(le=O));do X.scope&&_e.closeNode(),!X.skip&&!X.subLanguage&&(we+=X.relevance),X=X.parent;while(X!==q.parent);return q.starts&&pe(q.starts,V),de.returnEnd?0:O.length}function Te(){const V=[];for(let O=X;O!==Be;O=O.parent)O.scope&&V.unshift(O.scope);V.forEach(O=>_e.openNode(O))}let Ce={};function We(V,O){const B=O&&O[0];if(le+=V,B==null)return W(),0;if(Ce.type==="begin"&&O.type==="end"&&Ce.index===O.index&&B===""){if(le+=T.slice(O.index,O.index+1),!i){const q=new Error(`0 width match regex (${A})`);throw q.languageName=A,q.badRule=Ce.rule,q}return 1}if(Ce=O,O.type==="begin")return Se(O);if(O.type==="illegal"&&!_){const q=new Error('Illegal lexeme "'+B+'" for mode "'+(X.scope||"<unnamed>")+'"');throw q.mode=X,q}else if(O.type==="end"){const q=Ie(O);if(q!==hy)return q}if(O.type==="illegal"&&B==="")return le+=`
487
- `,1;if(lt>1e5&&lt>O.index*3)throw new Error("potential infinite loop, way more iterations than matches");return le+=B,B.length}const Be=N(A);if(!Be)throw ii(o.replace("{}",A)),new Error('Unknown language: "'+A+'"');const ce=O5(Be);let Ye="",X=I||ce;const ne={},_e=new a.__emitter(a);Te();let le="",we=0,Je=0,lt=0,Kt=!1;try{if(Be.__emitTokens)Be.__emitTokens(T,_e);else{for(X.matcher.considerAll();;){lt++,Kt?Kt=!1:X.matcher.considerAll(),X.matcher.lastIndex=Je;const V=X.matcher.exec(T);if(!V)break;const O=T.substring(Je,V.index),B=We(O,V);Je=V.index+B}We(T.substring(Je))}return _e.finalize(),Ye=_e.toHTML(),{language:A,value:Ye,relevance:we,illegal:!1,_emitter:_e,_top:X}}catch(V){if(V.message&&V.message.includes("Illegal"))return{language:A,value:ad(T),illegal:!0,relevance:0,_illegalBy:{message:V.message,index:Je,context:T.slice(Je-100,Je+100),mode:V.mode,resultSoFar:Ye},_emitter:_e};if(i)return{language:A,value:ad(T),illegal:!1,relevance:0,errorRaised:V,_emitter:_e,_top:X};throw V}}function f(A){const T={value:ad(A),illegal:!1,relevance:0,_top:s,_emitter:new a.__emitter(a)};return T._emitter.addText(A),T}function h(A,T){T=T||a.languages||Object.keys(e);const _=f(A),I=T.filter(N).filter(D).map(W=>d(W,A,!1));I.unshift(_);const j=I.sort((W,J)=>{if(W.relevance!==J.relevance)return J.relevance-W.relevance;if(W.language&&J.language){if(N(W.language).supersetOf===J.language)return 1;if(N(J.language).supersetOf===W.language)return-1}return 0}),[G,ie]=j,ae=G;return ae.secondBest=ie,ae}function m(A,T,_){const I=T&&n[T]||_;A.classList.add("hljs"),A.classList.add(`language-${I}`)}function g(A){let T=null;const _=c(A);if(l(_))return;if(L("before:highlightElement",{el:A,language:_}),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 D5("One of your code blocks includes unescaped HTML.",A.innerHTML);T=A;const I=T.textContent,j=_?u(I,{language:_,ignoreIllegals:!0}):h(I);A.innerHTML=j.value,A.dataset.highlighted="yes",m(A,_,j.language),A.result={language:j.language,re:j.relevance,relevance:j.relevance},j.secondBest&&(A.secondBest={language:j.secondBest.language,relevance:j.secondBest.relevance}),L("after:highlightElement",{el:A,result:j,text:I})}function y(A){a=fy(a,A)}const b=()=>{v(),Mi("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function w(){v(),Mi("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let E=!1;function v(){function A(){v()}if(document.readyState==="loading"){E||window.addEventListener("DOMContentLoaded",A,!1),E=!0;return}document.querySelectorAll(a.cssSelector).forEach(g)}function k(A,T){let _=null;try{_=T(t)}catch(I){if(ii("Language definition for '{}' could not be registered.".replace("{}",A)),i)ii(I);else throw I;_=s}_.name||(_.name=A),e[A]=_,_.rawDefinition=T.bind(null,t),_.aliases&&M(_.aliases,{languageName:A})}function C(A){delete e[A];for(const T of Object.keys(n))n[T]===A&&delete n[T]}function S(){return Object.keys(e)}function N(A){return A=(A||"").toLowerCase(),e[A]||e[n[A]]}function M(A,{languageName:T}){typeof A=="string"&&(A=[A]),A.forEach(_=>{n[_.toLowerCase()]=T})}function D(A){const T=N(A);return T&&!T.disableAutodetect}function H(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 $(A){H(A),r.push(A)}function z(A){const T=r.indexOf(A);T!==-1&&r.splice(T,1)}function L(A,T){const _=A;r.forEach(function(I){I[_]&&I[_](T)})}function K(A){return Mi("10.7.0","highlightBlock will be removed entirely in v12.0"),Mi("10.7.0","Please use highlightElement now."),g(A)}Object.assign(t,{highlight:u,highlightAuto:h,highlightAll:v,highlightElement:g,highlightBlock:K,configure:y,initHighlighting:b,initHighlightingOnLoad:w,registerLanguage:k,unregisterLanguage:C,listLanguages:S,getLanguage:N,registerAliases:M,autoDetection:D,inherit:fy,addPlugin:$,removePlugin:z}),t.debugMode=function(){i=!1},t.safeMode=function(){i=!0},t.versionString=I5,t.regex={concat:bi,lookahead:P1,either:Xh,optional:Y4,anyNumberOfTimes:q4};for(const A in Ia)typeof Ia[A]=="object"&&D1(Ia[A]);return Object.assign(t,Ia),t},go=W1({});go.newInstance=()=>W1({});var P5=go;go.HighlightJS=go;go.default=go;const B5=eb(P5),py={},$5="hljs-";function j5(t){const e=B5.newInstance();return t&&o(t),{highlight:n,highlightAuto:r,listLanguages:i,register:o,registerAlias:s,registered:a};function n(l,c,u){const d=u||py,f=typeof d.prefix=="string"?d.prefix:$5;if(!e.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");e.configure({__emitter:F5,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 d=(c||py).subset||i();let f=-1,h=0,m;for(;++f<d.length;){const g=d[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 o(l,c){if(typeof l=="string")e.registerLanguage(l,c);else{let u;for(u in l)Object.hasOwn(l,u)&&e.registerLanguage(u,l[u])}}function s(l,c){if(typeof l=="string")e.registerAliases(typeof c=="string"?c:[...c],{languageName:l});else{let u;for(u in l)if(Object.hasOwn(l,u)){const d=l[u];e.registerAliases(typeof d=="string"?d:[...d],{languageName:u})}}}function a(l){return!!e.getLanguage(l)}}class F5{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(s,a){return a?s+"_".repeat(a):n.options.classPrefix+s}),i=this.stack[this.stack.length-1],o={type:"element",tagName:"span",properties:{className:r},children:[]};i.children.push(o),this.stack.push(o)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const H5=t=>{if(!t.children.length)return;const e=t.querySelectorAll("span");e&&e.forEach(n=>{var r,i;const o=n.getAttribute("style"),s=(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",`${s};${o}`)})},my=dn.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&H5(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",Ne(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(o=>!!o))||t.removeMark(r,r+n.nodeSize,this.type)}),!0}}}}),z5=Ve.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()}}}),U5=/^\s*>\s$/,V5=qe.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",Ne(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[bs({find:U5,type:this.type})]}}),W5=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,K5=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,G5=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,q5=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Y5=dn.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",Ne(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[eo({find:W5,type:this.type}),eo({find:G5,type:this.type})]},addPasteRules(){return[ui({find:K5,type:this.type}),ui({find:q5,type:this.type})]}}),J5="listItem",gy="textStyle",yy=/^\s*([-+*])\s$/,X5=qe.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",Ne(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(J5,this.editor.getAttributes(gy)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=bs({find:yy,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=bs({find:yy,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(gy),editor:this.editor})),[t]}}),Z5=/(^|[^`])`([^`]+)`(?!`)/,Q5=/(^|[^`])`([^`]+)`(?!`)/g,e$=dn.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Ne(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[eo({find:Z5,type:this.type})]},addPasteRules(){return[ui({find:Q5,type:this.type})]}}),K1=qe.create({name:"doc",topNode:!0,content:"block+"});function t$(t={}){return new $e({view(e){return new n$(e,t)}})}class n${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 o=s=>{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}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,o=i.getBoundingClientRect(),s=o.width/i.offsetWidth,a=o.height/i.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let m=h.getBoundingClientRect(),g=d?m.bottom:m.top;d&&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 d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*s;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.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,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=l.getBoundingClientRect(),f=d.width/l.offsetWidth,h=d.height/l.offsetHeight;c=d.left-l.scrollLeft*f,u=d.top-l.scrollTop*h}this.element.style.left=(r.left-c)/s+"px",this.element.style.top=(r.top-u)/a+"px",this.element.style.width=(r.right-r.left)/s+"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,o=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!o){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=Nb(this.editorView.state.doc,s,this.editorView.dragging.slice);a!=null&&(s=a)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const G1=Ve.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[t$(this.options)]}});class Ge extends ge{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Ge.valid(r)?new Ge(r):ge.near(r)}content(){return Y.empty}eq(e){return e instanceof Ge&&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 Ge(e.resolve(n.pos))}getBookmark(){return new ep(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!r$(e)||!i$(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&&Ge.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let a=e.node(s);if(n>0?e.indexAfter(s)<a.childCount:e.index(s)>0){o=a.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=n;let l=e.doc.resolve(i);if(Ge.valid(l))return l}for(;;){let s=n>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!se.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*n),r=!1;continue e}break}o=s,i+=n;let a=e.doc.resolve(i);if(Ge.valid(a))return a}return null}}}Ge.prototype.visible=!1;Ge.findFrom=Ge.findGapCursorFrom;ge.jsonID("gapcursor",Ge);class ep{constructor(e){this.pos=e}map(e){return new ep(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Ge.valid(n)?new Ge(n):ge.near(n)}}function q1(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function r$(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||q1(i.type))return!0;if(i.inlineContent)return!1}}return!0}function i$(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||q1(i.type))return!0;if(i.inlineContent)return!1}}return!0}function o$(){return new $e({props:{decorations:c$,createSelectionBetween(t,e,n){return e.pos==n.pos&&Ge.valid(n)?new Ge(n):null},handleClick:a$,handleKeyDown:s$,handleDOMEvents:{beforeinput:l$}}})}const s$=y0({ArrowLeft:Da("horiz",-1),ArrowRight:Da("horiz",1),ArrowUp:Da("vert",-1),ArrowDown:Da("vert",1)});function Da(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,a=e>0?s.$to:s.$from,l=s.empty;if(s instanceof ue){if(!o.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=Ge.findGapCursorFrom(a,e,l);return c?(i&&i(r.tr.setSelection(new Ge(c))),!0):!1}}function a$(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Ge.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&se.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Ge(r))),!0)}function l$(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Ge))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=P.empty;for(let s=r.length-1;s>=0;s--)i=P.from(r[s].createAndFill(null,i));let o=t.state.tr.replace(n.pos,n.pos,new Y(i,0,0));return o.setSelection(ue.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function c$(t){if(!(t.selection instanceof Ge))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",He.create(t.doc,[pt.widget(t.selection.head,e,{key:"gapcursor"})])}const u$=Ve.create({name:"gapCursor",addProseMirrorPlugins(){return[o$()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=xe(ee(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),d$=qe.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",Ne(this.options.HTMLAttributes,t)]},renderText(){return`
488
- `},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:o}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:a}=r.extensionManager,l=o||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&s){const d=l.filter(f=>a.includes(f.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),tp=qe.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]}`,Ne(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=>Hd({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Fl=200,it=function(){};it.prototype.append=function(e){return e.length?(e=it.from(e),!this.length&&e||e.length<Fl&&this.leafAppend(e)||this.length<Fl&&e.leafPrepend(this)||this.appendInner(e)):this};it.prototype.prepend=function(e){return e.length?it.from(e).append(this):this};it.prototype.appendInner=function(e){return new f$(this,e)};it.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?it.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};it.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};it.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)};it.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},n,r),i};it.from=function(e){return e instanceof it?e:e&&e.length?new Y1(e):it.empty};var Y1=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,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,a){for(var l=o;l<s;l++)if(i(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,s,a){for(var l=o-1;l>=s;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Fl)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Fl)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}(it);it.empty=new Y1([]);var f$=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,o,s){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(o,a),s)===!1||o>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,o)-a,s+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(o,a)-a,s+a)===!1||o<a&&this.left.forEachInvertedInner(r,Math.min(i,a),o,s)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},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}(it);const h$=500;class sn{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,o;n&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,a,l,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){i||(i=this.remapping(r,f+1),o=i.maps.length),o--,u.push(d);return}if(i){u.push(new yn(d.map));let h=d.step.map(i.slice(o)),m;h&&s.maybeStep(h).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],c.push(new yn(m,void 0,void 0,c.length+u.length))),o--,m&&i.appendMap(m,o)}else s.maybeStep(d.step);if(d.selection)return a=i?d.selection.map(i.slice(o)):d.selection,l=new sn(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:a}}addTransform(e,n,r,i){let o=[],s=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new yn(e.mapping.maps[u],d,n),h;(h=l&&l.merge(f))&&(f=h,u?o.pop():a=a.slice(0,a.length-1)),o.push(f),n&&(s++,n=void 0),i||(l=f)}let c=s-r.depth;return c>m$&&(a=p$(a,c),s-=c),new sn(a.append(o),s)}remapping(e,n){let r=new us;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new sn(this.items.append(e.map(n=>new yn(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),o=e.mapping,s=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},i);let l=n;this.items.forEach(f=>{let h=o.getMirror(--l);if(h==null)return;s=Math.min(s,h);let m=o.maps[h];if(f.step){let g=e.steps[h].invert(e.docs[h]),y=f.selection&&f.selection.map(o.slice(l+1,h));y&&a++,r.push(new yn(m,g,y))}else r.push(new yn(m))},i);let c=[];for(let f=n;f<s;f++)c.push(new yn(o.maps[f]));let u=this.items.slice(0,i).append(c).append(r),d=new sn(u,a);return d.emptyItemCount()>h$&&(d=d.compress(this.items.length-r.length)),d}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=[],o=0;return this.items.forEach((s,a)=>{if(a>=e)i.push(s),s.selection&&o++;else if(s.step){let l=s.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=s.selection&&s.selection.map(n.slice(r));u&&o++;let d=new yn(c.invert(),l,u),f,h=i.length-1;(f=i.length&&i[h].merge(d))?i[h]=f:i.push(d)}}else s.map&&r--},this.items.length,0),new sn(it.from(i.reverse()),o)}}sn.empty=new sn(it.empty,0);function p$(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class yn{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 yn(n.getMap().invert(),n,this.selection)}}}class dr{constructor(e,n,r,i,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const m$=20;function g$(t,e,n,r){let i=n.getMeta(oi),o;if(i)return i.historyState;n.getMeta(v$)&&(t=new dr(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(oi))return s.getMeta(oi).redo?new dr(t.done.addTransform(n,void 0,r,nl(e)),t.undone,by(n.mapping.maps),t.prevTime,t.prevComposition):new dr(t.done,t.undone.addTransform(n,void 0,r,nl(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!y$(n,t.prevRanges)),c=s?ld(t.prevRanges,n.mapping):by(n.mapping.maps);return new dr(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,nl(e)),sn.empty,c,n.time,a??t.prevComposition)}else return(o=n.getMeta("rebased"))?new dr(t.done.rebased(n,o),t.undone.rebased(n,o),ld(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new dr(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),ld(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function y$(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(n=!0)}),n}function by(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,o,s)=>e.push(o,s));return e}function ld(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),o=e.map(t[r+1],-1);i<=o&&n.push(i,o)}return n}function b$(t,e,n){let r=nl(e),i=oi.get(e).spec.config,o=(n?t.undone:t.done).popEvent(e,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),a=(n?t.done:t.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),l=new dr(n?a:o.remaining,n?o.remaining:a,null,0,-1);return o.transform.setSelection(s).setMeta(oi,{redo:n,historyState:l})}let cd=!1,vy=null;function nl(t){let e=t.plugins;if(vy!=e){cd=!1,vy=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){cd=!0;break}}return cd}const oi=new Pe("history"),v$=new Pe("closeHistory");function x$(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new $e({key:oi,state:{init(){return new dr(sn.empty,sn.empty,null,0,-1)},apply(e,n,r){return g$(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?X1:r=="historyRedo"?Z1:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function J1(t,e){return(n,r)=>{let i=oi.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let o=b$(i,n,t);o&&r(e?o.scrollIntoView():o)}return!0}}const X1=J1(!1,!0),Z1=J1(!0,!0),w$=Ve.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>X1(t,e),redo:()=>({state:t,dispatch:e})=>Z1(t,e)}},addProseMirrorPlugins(){return[x$(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()}}}),E$=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,k$=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,C$=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,S$=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,_$=dn.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Ne(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[eo({find:E$,type:this.type}),eo({find:C$,type:this.type})]},addPasteRules(){return[ui({find:k$,type:this.type}),ui({find:S$,type:this.type})]}}),Q1=qe.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Ne(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)}}}),N$="listItem",xy="textStyle",wy=/^(\d+)\.\s$/,T$=qe.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",Ne(this.options.HTMLAttributes,n),0]:["ol",Ne(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(N$,this.editor.getAttributes(xy)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=bs({find:wy,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=bs({find:wy,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(xy)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),np=qe.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),A$=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,M$=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,O$=dn.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Ne(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[eo({find:A$,type:this.type})]},addPasteRules(){return[ui({find:M$,type:this.type})]}}),R$=qe.create({name:"text",group:"inline"}),I$=Ve.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(Y5.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(V5.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(X5.configure(this.options.bulletList)),this.options.code!==!1&&t.push(e$.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(t1.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(K1.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(G1.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(u$.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(d$.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(tp.configure(this.options.heading)),this.options.history!==!1&&t.push(w$.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(e1.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(_$.configure(this.options.italic)),this.options.listItem!==!1&&t.push(Q1.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(T$.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(np.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(O$.configure(this.options.strike)),this.options.text!==!1&&t.push(R$.configure(this.options.text)),t}}),D$=Ve.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")}}}),L$=dn.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",Ne(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()}}}),P$=Ve.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new $e({key:new Pe("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:i}=e,o=[];if(!n||!r)return He.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((l,c)=>{if(l.isText)return;if(!(i>=c&&i<=c+l.nodeSize-1))return!1;s+=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"&&s-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";o.push(pt.node(c,c+l.nodeSize,{class:this.options.className}))}),He.create(t,o)}}})]}}),B$="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",$$="ελ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",mf="numeric",gf="ascii",yf="alpha",es="asciinumeric",Ho="alphanumeric",bf="domain",eE="emoji",j$="scheme",F$="slashscheme",ud="whitespace";function H$(t,e){return t in e||(e[t]=[]),e[t]}function Jr(t,e,n){e[mf]&&(e[es]=!0,e[Ho]=!0),e[gf]&&(e[es]=!0,e[yf]=!0),e[es]&&(e[Ho]=!0),e[yf]&&(e[Ho]=!0),e[Ho]&&(e[bf]=!0),e[eE]&&(e[bf]=!0);for(const r in e){const i=H$(r,n);i.indexOf(t)<0&&i.push(t)}}function z$(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Mt(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Mt.groups={};Mt.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],o=e.jr[r][1];if(o&&i.test(t))return o}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||Mt.groups;let i;return e&&e.j?i=e:(i=new Mt(e),n&&r&&Jr(e,n,r)),this.jr.push([t,i]),i},ts(t,e,n,r){let i=this;const o=t.length;if(!o)return i;for(let s=0;s<o-1;s++)i=i.tt(t[s]);return i.tt(t[o-1],e,n,r)},tt(t,e,n,r){r=r||Mt.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const o=e;let s,a=i.go(t);if(a?(s=new Mt,Object.assign(s.j,a.j),s.jr.push.apply(s.jr,a.jr),s.jd=a.jd,s.t=a.t):s=new Mt,o){if(r)if(s.t&&typeof s.t=="string"){const l=Object.assign(z$(s.t,r),n);Jr(o,l,r)}else n&&Jr(o,n,r);s.t=o}return i.j[t]=s,s}};const be=(t,e,n,r,i)=>t.ta(e,n,r,i),Ke=(t,e,n,r,i)=>t.tr(e,n,r,i),Ey=(t,e,n,r,i)=>t.ts(e,n,r,i),F=(t,e,n,r,i)=>t.tt(e,n,r,i),zn="WORD",vf="UWORD",tE="ASCIINUMERICAL",nE="ALPHANUMERICAL",Fs="LOCALHOST",xf="TLD",wf="UTLD",rl="SCHEME",$i="SLASH_SCHEME",rp="NUM",Ef="WS",ip="NL",ts="OPENBRACE",ns="CLOSEBRACE",Hl="OPENBRACKET",zl="CLOSEBRACKET",Ul="OPENPAREN",Vl="CLOSEPAREN",Wl="OPENANGLEBRACKET",Kl="CLOSEANGLEBRACKET",Gl="FULLWIDTHLEFTPAREN",ql="FULLWIDTHRIGHTPAREN",Yl="LEFTCORNERBRACKET",Jl="RIGHTCORNERBRACKET",Xl="LEFTWHITECORNERBRACKET",Zl="RIGHTWHITECORNERBRACKET",Ql="FULLWIDTHLESSTHAN",ec="FULLWIDTHGREATERTHAN",tc="AMPERSAND",nc="APOSTROPHE",rc="ASTERISK",fr="AT",ic="BACKSLASH",oc="BACKTICK",sc="CARET",mr="COLON",op="COMMA",ac="DOLLAR",bn="DOT",lc="EQUALS",sp="EXCLAMATION",Yt="HYPHEN",rs="PERCENT",cc="PIPE",uc="PLUS",dc="POUND",is="QUERY",ap="QUOTE",rE="FULLWIDTHMIDDLEDOT",lp="SEMI",vn="SLASH",ss="TILDE",fc="UNDERSCORE",iE="EMOJI",hc="SYM";var oE=Object.freeze({__proto__:null,ALPHANUMERICAL:nE,AMPERSAND:tc,APOSTROPHE:nc,ASCIINUMERICAL:tE,ASTERISK:rc,AT:fr,BACKSLASH:ic,BACKTICK:oc,CARET:sc,CLOSEANGLEBRACKET:Kl,CLOSEBRACE:ns,CLOSEBRACKET:zl,CLOSEPAREN:Vl,COLON:mr,COMMA:op,DOLLAR:ac,DOT:bn,EMOJI:iE,EQUALS:lc,EXCLAMATION:sp,FULLWIDTHGREATERTHAN:ec,FULLWIDTHLEFTPAREN:Gl,FULLWIDTHLESSTHAN:Ql,FULLWIDTHMIDDLEDOT:rE,FULLWIDTHRIGHTPAREN:ql,HYPHEN:Yt,LEFTCORNERBRACKET:Yl,LEFTWHITECORNERBRACKET:Xl,LOCALHOST:Fs,NL:ip,NUM:rp,OPENANGLEBRACKET:Wl,OPENBRACE:ts,OPENBRACKET:Hl,OPENPAREN:Ul,PERCENT:rs,PIPE:cc,PLUS:uc,POUND:dc,QUERY:is,QUOTE:ap,RIGHTCORNERBRACKET:Jl,RIGHTWHITECORNERBRACKET:Zl,SCHEME:rl,SEMI:lp,SLASH:vn,SLASH_SCHEME:$i,SYM:hc,TILDE:ss,TLD:xf,UNDERSCORE:fc,UTLD:wf,UWORD:vf,WORD:zn,WS:Ef});const jn=/[a-z]/,Po=new RegExp("\\p{L}","u"),dd=new RegExp("\\p{Emoji}","u"),Fn=/\d/,fd=/\s/,ky="\r",hd=`
489
- `,U$="️",V$="‍",pd="";let La=null,Pa=null;function W$(t=[]){const e={};Mt.groups=e;const n=new Mt;La==null&&(La=Cy(B$)),Pa==null&&(Pa=Cy($$)),F(n,"'",nc),F(n,"{",ts),F(n,"}",ns),F(n,"[",Hl),F(n,"]",zl),F(n,"(",Ul),F(n,")",Vl),F(n,"<",Wl),F(n,">",Kl),F(n,"(",Gl),F(n,")",ql),F(n,"「",Yl),F(n,"」",Jl),F(n,"『",Xl),F(n,"』",Zl),F(n,"<",Ql),F(n,">",ec),F(n,"&",tc),F(n,"*",rc),F(n,"@",fr),F(n,"`",oc),F(n,"^",sc),F(n,":",mr),F(n,",",op),F(n,"$",ac),F(n,".",bn),F(n,"=",lc),F(n,"!",sp),F(n,"-",Yt),F(n,"%",rs),F(n,"|",cc),F(n,"+",uc),F(n,"#",dc),F(n,"?",is),F(n,'"',ap),F(n,"/",vn),F(n,";",lp),F(n,"~",ss),F(n,"_",fc),F(n,"\\",ic),F(n,"・",rE);const r=Ke(n,Fn,rp,{[mf]:!0});Ke(r,Fn,r);const i=Ke(r,jn,tE,{[es]:!0}),o=Ke(r,Po,nE,{[Ho]:!0}),s=Ke(n,jn,zn,{[gf]:!0});Ke(s,Fn,i),Ke(s,jn,s),Ke(i,Fn,i),Ke(i,jn,i);const a=Ke(n,Po,vf,{[yf]:!0});Ke(a,jn),Ke(a,Fn,o),Ke(a,Po,a),Ke(o,Fn,o),Ke(o,jn),Ke(o,Po,o);const l=F(n,hd,ip,{[ud]:!0}),c=F(n,ky,Ef,{[ud]:!0}),u=Ke(n,fd,Ef,{[ud]:!0});F(n,pd,u),F(c,hd,l),F(c,pd,u),Ke(c,fd,u),F(u,ky),F(u,hd),Ke(u,fd,u),F(u,pd,u);const d=Ke(n,dd,iE,{[eE]:!0});F(d,"#"),Ke(d,dd,d),F(d,U$,d);const f=F(d,V$);F(f,"#"),Ke(f,dd,d);const h=[[jn,s],[Fn,i]],m=[[jn,null],[Po,a],[Fn,o]];for(let g=0;g<La.length;g++)or(n,La[g],xf,zn,h);for(let g=0;g<Pa.length;g++)or(n,Pa[g],wf,vf,m);Jr(xf,{tld:!0,ascii:!0},e),Jr(wf,{utld:!0,alpha:!0},e),or(n,"file",rl,zn,h),or(n,"mailto",rl,zn,h),or(n,"http",$i,zn,h),or(n,"https",$i,zn,h),or(n,"ftp",$i,zn,h),or(n,"ftps",$i,zn,h),Jr(rl,{scheme:!0,ascii:!0},e),Jr($i,{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]?{[j$]:!0}:{[F$]:!0};y.indexOf("-")>=0?w[bf]=!0:jn.test(y)?Fn.test(y)?w[es]=!0:w[gf]=!0:w[mf]=!0,Ey(n,y,y,w)}return Ey(n,"localhost",Fs,{ascii:!0}),n.jd=new Mt(hc),{start:n,tokens:Object.assign({groups:e},oE)}}function sE(t,e){const n=K$(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,i=[];let o=0,s=0;for(;s<r;){let a=t,l=null,c=0,u=null,d=-1,f=-1;for(;s<r&&(l=a.go(n[s]));)a=l,a.accepts()?(d=0,f=0,u=a):d>=0&&(d+=n[s].length,f++),c+=n[s].length,o+=n[s].length,s++;o-=d,s-=f,c-=d,i.push({t:u.t,v:e.slice(o-c,o),s:o-c,e:o})}return i}function K$(t){const e=[],n=t.length;let r=0;for(;r<n;){let i=t.charCodeAt(r),o,s=i<55296||i>56319||r+1===n||(o=t.charCodeAt(r+1))<56320||o>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}function or(t,e,n,r,i){let o;const s=e.length;for(let a=0;a<s-1;a++){const l=e[a];t.j[l]?o=t.j[l]:(o=new Mt(r),o.jr=i.slice(),t.j[l]=o),t=o}return o=new Mt(n),o.jr=i.slice(),t.j[e[s-1]]=o,o}function Cy(t){const e=[],n=[];let r=0,i="0123456789";for(;r<t.length;){let o=0;for(;i.indexOf(t[r+o])>=0;)o++;if(o>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+o),10);s>0;s--)n.pop();r+=o}else n.push(t[r]),r++}return e}const Hs={defaultProtocol:"http",events:null,format:Sy,formatHref:Sy,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function cp(t,e=null){let n=Object.assign({},Hs);t&&(n=Object.assign(n,t instanceof cp?t.o:t));const r=n.ignoreTags,i=[];for(let o=0;o<r.length;o++)i.push(r[o].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=i}cp.prototype={o:Hs,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]:Hs[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 Sy(t){return t}function aE(t,e){this.t="token",this.v=t,this.tk=e}aE.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=Hs.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),o=this.toFormattedString(t),s={},a=t.get("className",n,e),l=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return s.href=r,a&&(s.class=a),l&&(s.target=l),c&&(s.rel=c),u&&Object.assign(s,u),{tagName:i,attributes:s,content:o,eventListeners:d}}};function iu(t,e){class n extends aE{constructor(i,o){super(i,o),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const _y=iu("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Ny=iu("text"),G$=iu("nl"),Ba=iu("url",{isLink:!0,toHref(t=Hs.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Fs&&t[1].t===mr}}),qt=t=>new Mt(t);function q$({groups:t}){const e=t.domain.concat([tc,rc,fr,ic,oc,sc,ac,lc,Yt,rp,rs,cc,uc,dc,vn,hc,ss,fc]),n=[nc,mr,op,bn,sp,rs,is,ap,lp,Wl,Kl,ts,ns,zl,Hl,Ul,Vl,Gl,ql,Yl,Jl,Xl,Zl,Ql,ec],r=[tc,nc,rc,ic,oc,sc,ac,lc,Yt,ts,ns,rs,cc,uc,dc,is,vn,hc,ss,fc],i=qt(),o=F(i,ss);be(o,r,o),be(o,t.domain,o);const s=qt(),a=qt(),l=qt();be(i,t.domain,s),be(i,t.scheme,a),be(i,t.slashscheme,l),be(s,r,o),be(s,t.domain,s);const c=F(s,fr);F(o,fr,c),F(a,fr,c),F(l,fr,c);const u=F(o,bn);be(u,r,o),be(u,t.domain,o);const d=qt();be(c,t.domain,d),be(d,t.domain,d);const f=F(d,bn);be(f,t.domain,d);const h=qt(_y);be(f,t.tld,h),be(f,t.utld,h),F(c,Fs,h);const m=F(d,Yt);F(m,Yt,m),be(m,t.domain,d),be(h,t.domain,d),F(h,bn,f),F(h,Yt,m);const g=F(h,mr);be(g,t.numeric,_y);const y=F(s,Yt),b=F(s,bn);F(y,Yt,y),be(y,t.domain,s),be(b,r,o),be(b,t.domain,s);const w=qt(Ba);be(b,t.tld,w),be(b,t.utld,w),be(w,t.domain,s),be(w,r,o),F(w,bn,b),F(w,Yt,y),F(w,fr,c);const E=F(w,mr),v=qt(Ba);be(E,t.numeric,v);const k=qt(Ba),C=qt();be(k,e,k),be(k,n,C),be(C,e,k),be(C,n,C),F(w,vn,k),F(v,vn,k);const S=F(a,mr),N=F(l,mr),M=F(N,vn),D=F(M,vn);be(a,t.domain,s),F(a,bn,b),F(a,Yt,y),be(l,t.domain,s),F(l,bn,b),F(l,Yt,y),be(S,t.domain,k),F(S,vn,k),F(S,is,k),be(D,t.domain,k),be(D,e,k),F(D,vn,k);const H=[[ts,ns],[Hl,zl],[Ul,Vl],[Wl,Kl],[Gl,ql],[Yl,Jl],[Xl,Zl],[Ql,ec]];for(let $=0;$<H.length;$++){const[z,L]=H[$],K=F(k,z);F(C,z,K),F(K,L,k);const A=qt(Ba);be(K,e,A);const T=qt();be(K,n),be(A,e,A),be(A,n,T),be(T,e,A),be(T,n,T),F(A,L,k),F(T,L,k)}return F(i,Fs,w),F(i,ip,G$),{start:i,tokens:oE}}function Y$(t,e,n){let r=n.length,i=0,o=[],s=[];for(;i<r;){let a=t,l=null,c=null,u=0,d=null,f=-1;for(;i<r&&!(l=a.go(n[i].t));)s.push(n[i++]);for(;i<r&&(c=l||a.go(n[i].t));)l=null,a=c,a.accepts()?(f=0,d=a):f>=0&&f++,i++,u++;if(f<0)i-=u,i<r&&(s.push(n[i]),i++);else{s.length>0&&(o.push(md(Ny,e,s)),s=[]),i-=f,u-=f;const h=d.t,m=n.slice(i-u,i);o.push(md(h,e,m))}}return s.length>0&&o.push(md(Ny,e,s)),o}function md(t,e,n){const r=n[0].s,i=n[n.length-1].e,o=e.slice(r,i);return new t(o,n)}const J$=typeof console<"u"&&console&&console.warn||(()=>{}),X$="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",je={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Z$(){return Mt.groups={},je.scanner=null,je.parser=null,je.tokenQueue=[],je.pluginQueue=[],je.customSchemes=[],je.initialized=!1,je}function Ty(t,e=!1){if(je.initialized&&J$(`linkifyjs: already initialized - will not register custom scheme "${t}" ${X$}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
490
- 1. Must only contain digits, lowercase ASCII letters or "-"
491
- 2. Cannot start or end with "-"
492
- 3. "-" cannot repeat`);je.customSchemes.push([t,e])}function Q$(){je.scanner=W$(je.customSchemes);for(let t=0;t<je.tokenQueue.length;t++)je.tokenQueue[t][1]({scanner:je.scanner});je.parser=q$(je.scanner.tokens);for(let t=0;t<je.pluginQueue.length;t++)je.pluginQueue[t][1]({scanner:je.scanner,parser:je.parser});return je.initialized=!0,je}function up(t){return je.initialized||Q$(),Y$(je.parser.start,t,sE(je.scanner.start,t))}up.scan=sE;function lE(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 cp(n),i=up(t),o=[];for(let s=0;s<i.length;s++){const a=i[s];a.isLink&&(!e||a.t===e)&&r.check(a)&&o.push(a.toFormattedObject(r))}return o}const dp="[\0-   ᠎ -\u2029  ]",e9=new RegExp(dp),t9=new RegExp(`${dp}$`),n9=new RegExp(dp,"g");function r9(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function i9(t){return new $e({key:new Pe("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),o=e.some(c=>c.getMeta("preventAutolink"));if(!i||o)return;const{tr:s}=r,a=bN(n.doc,[...e]);if(_N(a).forEach(({newRange:c})=>{const u=xN(r.doc,c,h=>h.isTextblock);let d,f;if(u.length>1)d=u[0],f=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){const h=r.doc.textBetween(c.from,c.to," "," ");if(!t9.test(h))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){const h=f.split(e9).filter(Boolean);if(h.length<=0)return!1;const m=h[h.length-1],g=d.pos+f.lastIndexOf(m);if(!m)return!1;const y=up(m).map(b=>b.toObject(t.defaultProtocol));if(!r9(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=>{Xf(b.from,b.to,r.doc).some(w=>w.mark.type===t.type)||s.addMark(b.from,b.to,t.type.create({href:b.href}))})}}),!!s.steps.length)return s}})}function o9(t){return new $e({key:new Pe("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,o;if(r.button!==0||!e.editable)return!1;let s=r.target;const a=[];for(;s.nodeName!=="DIV";)a.push(s),s=s.parentNode;if(!a.find(f=>f.nodeName==="A"))return!1;const l=j0(e.state,t.type.name),c=r.target,u=(i=c==null?void 0:c.href)!==null&&i!==void 0?i:l.href,d=(o=c==null?void 0:c.target)!==null&&o!==void 0?o:l.target;return c&&u?(window.open(u,d),!0):!1}}})}function s9(t){return new $e({key:new Pe("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:i}=e,{selection:o}=i,{empty:s}=o;if(s)return!1;let a="";r.content.forEach(c=>{a+=c.textContent});const l=lE(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 zr(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(n9,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const a9=dn.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){Ty(t);return}Ty(t.scheme,t.optionalSlashes)})},onDestroy(){Z$()},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)=>!!zr(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=>!!zr(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=>!!zr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Ne(this.options.HTMLAttributes,t),0]:["a",Ne(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!zr(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=>!!zr(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[ui({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=lE(t).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:s=>!!zr(s,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(o=>e.push({text:o.value,data:{href:o.href},index:o.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(i9({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!zr(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(o9({type:this.type})),this.options.linkOnPaste&&t.push(s9({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),l9=Ve.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new $e({key:new Pe("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,i=[];if(!n)return null;const o=this.editor.isEmpty;return t.descendants((s,a)=>{const l=r>=a&&r<=a+s.nodeSize,c=!s.isLeaf&&Ac(s);if((l||!this.options.showOnlyCurrent)&&c){const u=[this.options.emptyNodeClass];o&&u.push(this.options.emptyEditorClass);const d=pt.node(a,a+s.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:a,hasAnchor:l}):this.options.placeholder});i.push(d)}return this.options.includeChildren}),He.create(t,i)}}})]}});var c9=Object.defineProperty,u9=Object.defineProperties,d9=Object.getOwnPropertyDescriptors,pc=Object.getOwnPropertySymbols,cE=Object.prototype.hasOwnProperty,uE=Object.prototype.propertyIsEnumerable,Ay=(t,e,n)=>e in t?c9(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,U=(t,e)=>{for(var n in e||(e={}))cE.call(e,n)&&Ay(t,n,e[n]);if(pc)for(var n of pc(e))uE.call(e,n)&&Ay(t,n,e[n]);return t},oe=(t,e)=>u9(t,d9(e)),Pn=(t,e)=>{var n={};for(var r in t)cE.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&pc)for(var r of pc(t))e.indexOf(r)<0&&uE.call(t,r)&&(n[r]=t[r]);return n},qi=(t,e,n)=>new Promise((r,i)=>{var o=l=>{try{a(n.next(l))}catch(c){i(c)}},s=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(o,s);a((n=n.apply(t,e)).next())});function ou(t,e){const{view:n,state:{selection:{from:r}}}=t,i=document.querySelectorAll(".has-focus"),o=i.length,a=i[o-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 su(t){const{state:{doc:e,selection:n,selection:{empty:r,from:i,to:o}}}=t,s=!e.textBetween(i,o).length&&Nc(n);return!(r||s||!t.isEditable)}function To(t,e){return({commands:n})=>n.command(({tr:r,state:i,dispatch:o})=>{if(o){let s=null;if(r.selection.ranges.forEach(a=>{i.doc.nodesBetween(a.$from.pos,a.$to.pos,(l,c)=>{l.type.name===t&&(s=c)})}),s!==null){const a=i.doc.nodeAt(s);if(a)r.setNodeMarkup(s,null,U(U({},a.attrs),e));else for(const[l,c]of Object.entries(e))r.setNodeAttribute(s,l,c)}t==="button"&&r.setSelection(r.selection)}return!0})}var il="auto",My="top",dE=qe.create({name:"column",content:"block+",isolating:!0,addAttributes(){return{columnId:{default:null,parseHTML:t=>t.getAttribute("data-column-id")||ws(),renderHTML:t=>t.columnId?{"data-column-id":t.columnId}:{"data-column-id":ws()}},width:{default:il,parseHTML:t=>t.style.width.replace(/['"]+/g,"")||il,renderHTML:t=>!t.width||t.width===il?{}:{style:`width: ${t.width}%;max-width:${t.width}%`}},verticalAlign:{default:My,parseHTML:t=>{var e;return((e=t==null?void 0:t.style)==null?void 0:e.verticalAlign)||"top"},renderHTML:t=>{const{verticalAlign:e}=t;if(!e||e===My)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",Ne(t,{"data-type":"column",class:"hide-scrollbars"}),0]},parseHTML(){return[{tag:'div[data-type="column"]'}]}});function f9(t){var e,n;return((n=(e=tr(t,"columns"))==null?void 0:e.node)==null?void 0:n.childCount)||0}function tr(t,e){const{state:n}=t.view;return qs(r=>r.type.name===e)(n.selection)}function Oy(t,e){const n=tr(t,"columns"),r=tr(t,"column");if(!n||!r)return!1;const{state:i,dispatch:o}=t.view,s=n.node;let a=0;s.content.forEach((f,h,m)=>{var g,y,b;f.eq(r.node)&&((g=f==null?void 0: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>=s.childCount)return!1;let c=n.pos;s.content.forEach((f,h,m)=>{m<l&&(c+=f.nodeSize)});const u=i.tr.setTime(Date.now()),d=ue.near(u.doc.resolve(c));return u.setSelection(d),o(u),!0}function h9(t,e,n="auto"){const{node:r,pos:i=0}=tr(t,"columns")||{};if(!r)return!1;const{state:o,dispatch:s}=t.view,{tr:a}=o,{selection:l}=o,c=i+r.nodeSize,u={from:l.from-i,to:l.to-i},d=[];r.content.forEach((g,y,b)=>{var w;d.push(g.type.create(oe(U({},g==null?void 0:g.attrs),{width:b===e?n:(w=g==null?void 0:g.attrs)==null?void 0:w.width}),g.content))});const f=r.copy(P.from(d)),h=a.replaceWith(i,c,f),m=ue.create(h.doc,i+u.from,i+u.to);return s(h.setSelection(m)),!0}function p9(t,e=-1){const{node:n,pos:r=0}=tr(t,"columns")||{};if(!n)return!1;const i=e<0?n.childCount:e,{state:o}=t.view,s=o.schema.nodes.column.create({width:il,columnId:ws()},o.schema.nodes.paragraph.create(null)),a=[];n.content.forEach((f,h,m)=>{a.push(f),m===i&&a.push(s)}),e===-1&&a.push(s);const l=n.copy(P.from(a)),c=o.tr.replaceWith(r,r+n.nodeSize,l),u=r+a.slice(0,i).reduce((f,h)=>f+h.nodeSize,0),d=ue.near(c.doc.resolve(u));return c.setSelection(d),t.view.dispatch(c),!0}function m9(t,e=-1){const{node:n,pos:r=0}=tr(t,"columns")||{};if(!n)return!1;const{state:i,dispatch:o}=t.view,{tr:s}=i,a=[];n.content.forEach((h,m,g)=>{g!==e&&a.push(h)}),e===-1&&a.pop();const l=n.copy(P.from(a)),c=s.replaceWith(r,r+n.nodeSize,l),u=e===n.childCount-1?e-1:e,d=r+a.slice(0,u).reduce((h,m)=>h+m.nodeSize,0),f=ue.near(c.doc.resolve(d));return c.setSelection(f),o(c),!0}function g9(t){const{node:e,pos:n=0}=tr(t,"columns")||{};if(!e)return[];const r=[];return e.content.forEach(i=>{const{columnId:o,width:s}=i.attrs;r.push({id:o,width:s})}),r}var y9=t=>In({editor:t,selector:n=>{var r,i,o;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:f9(n.editor),columnWidths:g9(n.editor).map(s=>s.width),currentColumnsGap:((o=n.editor.getAttributes("columns"))==null?void 0:o.gap)||0}},equalityFn:Br}),fp="-",b9=t=>{const e=x9(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:s=>{const a=s.split(fp);return a[0]===""&&a.length!==1&&a.shift(),fE(a,e)||v9(s)},getConflictingClassGroupIds:(s,a)=>{const l=n[s]||[];return a&&r[s]?[...l,...r[s]]:l}}},fE=(t,e)=>{var n;if(t.length===0)return e.classGroupId;const r=t[0],i=e.nextPart.get(r),o=i?fE(t.slice(1),i):void 0;if(o)return o;if(e.validators.length===0)return;const s=t.join(fp);return(n=e.validators.find(({validator:a})=>a(s)))==null?void 0:n.classGroupId},Ry=/^\[(.+)\]$/,v9=t=>{if(Ry.test(t)){const e=Ry.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},x9=t=>{const{theme:e,classGroups:n}=t,r={nextPart:new Map,validators:[]};for(const i in n)kf(n[i],r,i,e);return r},kf=(t,e,n,r)=>{t.forEach(i=>{if(typeof i=="string"){const o=i===""?e:Iy(e,i);o.classGroupId=n;return}if(typeof i=="function"){if(w9(i)){kf(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([o,s])=>{kf(s,Iy(e,o),n,r)})})},Iy=(t,e)=>{let n=t;return e.split(fp).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},w9=t=>t.isThemeGetter,E9=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const i=(o,s)=>{n.set(o,s),e++,e>t&&(e=0,r=n,n=new Map)};return{get(o){let s=n.get(o);if(s!==void 0)return s;if((s=r.get(o))!==void 0)return i(o,s),s},set(o,s){n.has(o)?n.set(o,s):i(o,s)}}},Cf="!",Sf=":",k9=Sf.length,C9=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=i=>{const o=[];let s=0,a=0,l=0,c;for(let m=0;m<i.length;m++){let g=i[m];if(s===0&&a===0){if(g===Sf){o.push(i.slice(l,m)),l=m+k9;continue}if(g==="/"){c=m;continue}}g==="["?s++:g==="]"?s--:g==="("?a++:g===")"&&a--}const u=o.length===0?i:i.substring(l),d=S9(u),f=d!==u,h=c&&c>l?c-l:void 0;return{modifiers:o,hasImportantModifier:f,baseClassName:d,maybePostfixModifierPosition:h}};if(e){const i=e+Sf,o=r;r=s=>s.startsWith(i)?o(s.substring(i.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:s,maybePostfixModifierPosition:void 0}}if(n){const i=r;r=o=>n({className:o,parseClassName:i})}return r},S9=t=>t.endsWith(Cf)?t.substring(0,t.length-1):t.startsWith(Cf)?t.substring(1):t,_9=t=>{const e=Object.fromEntries(t.orderSensitiveModifiers.map(r=>[r,!0]));return r=>{if(r.length<=1)return r;const i=[];let o=[];return r.forEach(s=>{s[0]==="["||e[s]?(i.push(...o.sort(),s),o=[]):o.push(s)}),i.push(...o.sort()),i}},N9=t=>U({cache:E9(t.cacheSize),parseClassName:C9(t),sortModifiers:_9(t)},b9(t)),T9=/\s+/,A9=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:o}=e,s=[],a=t.trim().split(T9);let l="";for(let c=a.length-1;c>=0;c-=1){const u=a[c],{isExternal:d,modifiers:f,hasImportantModifier:h,baseClassName:m,maybePostfixModifierPosition:g}=n(u);if(d){l=u+(l.length>0?" "+l:l);continue}let y=!!g,b=r(y?m.substring(0,g):m);if(!b){if(!y){l=u+(l.length>0?" "+l:l);continue}if(b=r(m),!b){l=u+(l.length>0?" "+l:l);continue}y=!1}const w=o(f).join(":"),E=h?w+Cf:w,v=E+b;if(s.includes(v))continue;s.push(v);const k=i(b,y);for(let C=0;C<k.length;++C){const S=k[C];s.push(E+S)}l=u+(l.length>0?" "+l:l)}return l};function M9(){let t=0,e,n,r="";for(;t<arguments.length;)(e=arguments[t++])&&(n=hE(e))&&(r&&(r+=" "),r+=n);return r}var hE=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=hE(t[r]))&&(n&&(n+=" "),n+=e);return n};function Dy(t,...e){let n,r,i,o=s;function s(l){const c=e.reduce((u,d)=>d(u),t());return n=N9(c),r=n.cache.get,i=n.cache.set,o=a,a(l)}function a(l){const c=r(l);if(c)return c;const u=A9(l,n);return i(l,u),u}return function(){return o(M9.apply(null,arguments))}}var tt=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},pE=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,mE=/^\((?:(\w[\w-]*):)?(.+)\)$/i,O9=/^\d+\/\d+$/,R9=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,I9=/\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$/,D9=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,L9=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,P9=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Oi=t=>O9.test(t),ve=t=>!!t&&!Number.isNaN(Number(t)),sr=t=>!!t&&Number.isInteger(Number(t)),gd=t=>t.endsWith("%")&&ve(t.slice(0,-1)),Hn=t=>R9.test(t),B9=()=>!0,$9=t=>I9.test(t)&&!D9.test(t),gE=()=>!1,j9=t=>L9.test(t),F9=t=>P9.test(t),H9=t=>!Z(t)&&!Q(t),z9=t=>Ao(t,vE,gE),Z=t=>pE.test(t),Ur=t=>Ao(t,xE,$9),yd=t=>Ao(t,G9,ve),Ly=t=>Ao(t,yE,gE),U9=t=>Ao(t,bE,F9),$a=t=>Ao(t,wE,j9),Q=t=>mE.test(t),Bo=t=>Mo(t,xE),V9=t=>Mo(t,q9),Py=t=>Mo(t,yE),W9=t=>Mo(t,vE),K9=t=>Mo(t,bE),ja=t=>Mo(t,wE,!0),Ao=(t,e,n)=>{const r=pE.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Mo=(t,e,n=!1)=>{const r=mE.exec(t);return r?r[1]?e(r[1]):n:!1},yE=t=>t==="position"||t==="percentage",bE=t=>t==="image"||t==="url",vE=t=>t==="length"||t==="size"||t==="bg-size",xE=t=>t==="length",G9=t=>t==="number",q9=t=>t==="family-name",wE=t=>t==="shadow",By=()=>{const t=tt("color"),e=tt("font"),n=tt("text"),r=tt("font-weight"),i=tt("tracking"),o=tt("leading"),s=tt("breakpoint"),a=tt("container"),l=tt("spacing"),c=tt("radius"),u=tt("shadow"),d=tt("inset-shadow"),f=tt("text-shadow"),h=tt("drop-shadow"),m=tt("blur"),g=tt("perspective"),y=tt("aspect"),b=tt("ease"),w=tt("animate"),E=()=>["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"],k=()=>[...v(),Q,Z],C=()=>["auto","hidden","clip","visible","scroll"],S=()=>["auto","contain","none"],N=()=>[Q,Z,l],M=()=>[Oi,"full","auto",...N()],D=()=>[sr,"none","subgrid",Q,Z],H=()=>["auto",{span:["full",sr,Q,Z]},sr,Q,Z],$=()=>[sr,"auto",Q,Z],z=()=>["auto","min","max","fr",Q,Z],L=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],K=()=>["start","end","center","stretch","center-safe","end-safe"],A=()=>["auto",...N()],T=()=>[Oi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...N()],_=()=>[t,Q,Z],I=()=>[...v(),Py,Ly,{position:[Q,Z]}],j=()=>["no-repeat",{repeat:["","x","y","space","round"]}],G=()=>["auto","cover","contain",W9,z9,{size:[Q,Z]}],ie=()=>[gd,Bo,Ur],ae=()=>["","none","full",c,Q,Z],W=()=>["",ve,Bo,Ur],J=()=>["solid","dashed","dotted","double"],me=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],pe=()=>[ve,gd,Py,Ly],Me=()=>["","none",m,Q,Z],ke=()=>["none",ve,Q,Z],Se=()=>["none",ve,Q,Z],Ie=()=>[ve,Q,Z],Te=()=>[Oi,"full",...N()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Hn],breakpoint:[Hn],color:[B9],container:[Hn],"drop-shadow":[Hn],ease:["in","out","in-out"],font:[H9],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Hn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Hn],shadow:[Hn],spacing:["px",ve],text:[Hn],"text-shadow":[Hn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Oi,Z,Q,y]}],container:["container"],columns:[{columns:[ve,Z,Q,a]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"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:k()}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],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:[sr,"auto",Q,Z]}],basis:[{basis:[Oi,"full","auto",a,...N()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ve,Oi,"auto","initial","none",Z]}],grow:[{grow:["",ve,Q,Z]}],shrink:[{shrink:["",ve,Q,Z]}],order:[{order:[sr,"first","last","none",Q,Z]}],"grid-cols":[{"grid-cols":D()}],"col-start-end":[{col:H()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":D()}],"row-start-end":[{row:H()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":z()}],"auto-rows":[{"auto-rows":z()}],gap:[{gap:N()}],"gap-x":[{"gap-x":N()}],"gap-y":[{"gap-y":N()}],"justify-content":[{justify:[...L(),"normal"]}],"justify-items":[{"justify-items":[...K(),"normal"]}],"justify-self":[{"justify-self":["auto",...K()]}],"align-content":[{content:["normal",...L()]}],"align-items":[{items:[...K(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...K(),{baseline:["","last"]}]}],"place-content":[{"place-content":L()}],"place-items":[{"place-items":[...K(),"baseline"]}],"place-self":[{"place-self":["auto",...K()]}],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:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":N()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":N()}],"space-y-reverse":["space-y-reverse"],size:[{size:T()}],w:[{w:[a,"screen",...T()]}],"min-w":[{"min-w":[a,"screen","none",...T()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[s]},...T()]}],h:[{h:["screen","lh",...T()]}],"min-h":[{"min-h":["screen","lh","none",...T()]}],"max-h":[{"max-h":["screen","lh",...T()]}],"font-size":[{text:["base",n,Bo,Ur]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Q,yd]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",gd,Z]}],"font-family":[{font:[V9,Z,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,Q,Z]}],"line-clamp":[{"line-clamp":[ve,"none",Q,yd]}],leading:[{leading:[o,...N()]}],"list-image":[{"list-image":["none",Q,Z]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Q,Z]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:_()}],"text-color":[{text:_()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...J(),"wavy"]}],"text-decoration-thickness":[{decoration:[ve,"from-font","auto",Q,Ur]}],"text-decoration-color":[{decoration:_()}],"underline-offset":[{"underline-offset":[ve,"auto",Q,Z]}],"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",Q,Z]}],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",Q,Z]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:I()}],"bg-repeat":[{bg:j()}],"bg-size":[{bg:G()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},sr,Q,Z],radial:["",Q,Z],conic:[sr,Q,Z]},K9,U9]}],"bg-color":[{bg:_()}],"gradient-from-pos":[{from:ie()}],"gradient-via-pos":[{via:ie()}],"gradient-to-pos":[{to:ie()}],"gradient-from":[{from:_()}],"gradient-via":[{via:_()}],"gradient-to":[{to:_()}],rounded:[{rounded:ae()}],"rounded-s":[{"rounded-s":ae()}],"rounded-e":[{"rounded-e":ae()}],"rounded-t":[{"rounded-t":ae()}],"rounded-r":[{"rounded-r":ae()}],"rounded-b":[{"rounded-b":ae()}],"rounded-l":[{"rounded-l":ae()}],"rounded-ss":[{"rounded-ss":ae()}],"rounded-se":[{"rounded-se":ae()}],"rounded-ee":[{"rounded-ee":ae()}],"rounded-es":[{"rounded-es":ae()}],"rounded-tl":[{"rounded-tl":ae()}],"rounded-tr":[{"rounded-tr":ae()}],"rounded-br":[{"rounded-br":ae()}],"rounded-bl":[{"rounded-bl":ae()}],"border-w":[{border:W()}],"border-w-x":[{"border-x":W()}],"border-w-y":[{"border-y":W()}],"border-w-s":[{"border-s":W()}],"border-w-e":[{"border-e":W()}],"border-w-t":[{"border-t":W()}],"border-w-r":[{"border-r":W()}],"border-w-b":[{"border-b":W()}],"border-w-l":[{"border-l":W()}],"divide-x":[{"divide-x":W()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":W()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...J(),"hidden","none"]}],"divide-style":[{divide:[...J(),"hidden","none"]}],"border-color":[{border:_()}],"border-color-x":[{"border-x":_()}],"border-color-y":[{"border-y":_()}],"border-color-s":[{"border-s":_()}],"border-color-e":[{"border-e":_()}],"border-color-t":[{"border-t":_()}],"border-color-r":[{"border-r":_()}],"border-color-b":[{"border-b":_()}],"border-color-l":[{"border-l":_()}],"divide-color":[{divide:_()}],"outline-style":[{outline:[...J(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ve,Q,Z]}],"outline-w":[{outline:["",ve,Bo,Ur]}],"outline-color":[{outline:_()}],shadow:[{shadow:["","none",u,ja,$a]}],"shadow-color":[{shadow:_()}],"inset-shadow":[{"inset-shadow":["none",d,ja,$a]}],"inset-shadow-color":[{"inset-shadow":_()}],"ring-w":[{ring:W()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:_()}],"ring-offset-w":[{"ring-offset":[ve,Ur]}],"ring-offset-color":[{"ring-offset":_()}],"inset-ring-w":[{"inset-ring":W()}],"inset-ring-color":[{"inset-ring":_()}],"text-shadow":[{"text-shadow":["none",f,ja,$a]}],"text-shadow-color":[{"text-shadow":_()}],opacity:[{opacity:[ve,Q,Z]}],"mix-blend":[{"mix-blend":[...me(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":me()}],"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":[ve]}],"mask-image-linear-from-pos":[{"mask-linear-from":pe()}],"mask-image-linear-to-pos":[{"mask-linear-to":pe()}],"mask-image-linear-from-color":[{"mask-linear-from":_()}],"mask-image-linear-to-color":[{"mask-linear-to":_()}],"mask-image-t-from-pos":[{"mask-t-from":pe()}],"mask-image-t-to-pos":[{"mask-t-to":pe()}],"mask-image-t-from-color":[{"mask-t-from":_()}],"mask-image-t-to-color":[{"mask-t-to":_()}],"mask-image-r-from-pos":[{"mask-r-from":pe()}],"mask-image-r-to-pos":[{"mask-r-to":pe()}],"mask-image-r-from-color":[{"mask-r-from":_()}],"mask-image-r-to-color":[{"mask-r-to":_()}],"mask-image-b-from-pos":[{"mask-b-from":pe()}],"mask-image-b-to-pos":[{"mask-b-to":pe()}],"mask-image-b-from-color":[{"mask-b-from":_()}],"mask-image-b-to-color":[{"mask-b-to":_()}],"mask-image-l-from-pos":[{"mask-l-from":pe()}],"mask-image-l-to-pos":[{"mask-l-to":pe()}],"mask-image-l-from-color":[{"mask-l-from":_()}],"mask-image-l-to-color":[{"mask-l-to":_()}],"mask-image-x-from-pos":[{"mask-x-from":pe()}],"mask-image-x-to-pos":[{"mask-x-to":pe()}],"mask-image-x-from-color":[{"mask-x-from":_()}],"mask-image-x-to-color":[{"mask-x-to":_()}],"mask-image-y-from-pos":[{"mask-y-from":pe()}],"mask-image-y-to-pos":[{"mask-y-to":pe()}],"mask-image-y-from-color":[{"mask-y-from":_()}],"mask-image-y-to-color":[{"mask-y-to":_()}],"mask-image-radial":[{"mask-radial":[Q,Z]}],"mask-image-radial-from-pos":[{"mask-radial-from":pe()}],"mask-image-radial-to-pos":[{"mask-radial-to":pe()}],"mask-image-radial-from-color":[{"mask-radial-from":_()}],"mask-image-radial-to-color":[{"mask-radial-to":_()}],"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":[ve]}],"mask-image-conic-from-pos":[{"mask-conic-from":pe()}],"mask-image-conic-to-pos":[{"mask-conic-to":pe()}],"mask-image-conic-from-color":[{"mask-conic-from":_()}],"mask-image-conic-to-color":[{"mask-conic-to":_()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:I()}],"mask-repeat":[{mask:j()}],"mask-size":[{mask:G()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Q,Z]}],filter:[{filter:["","none",Q,Z]}],blur:[{blur:Me()}],brightness:[{brightness:[ve,Q,Z]}],contrast:[{contrast:[ve,Q,Z]}],"drop-shadow":[{"drop-shadow":["","none",h,ja,$a]}],"drop-shadow-color":[{"drop-shadow":_()}],grayscale:[{grayscale:["",ve,Q,Z]}],"hue-rotate":[{"hue-rotate":[ve,Q,Z]}],invert:[{invert:["",ve,Q,Z]}],saturate:[{saturate:[ve,Q,Z]}],sepia:[{sepia:["",ve,Q,Z]}],"backdrop-filter":[{"backdrop-filter":["","none",Q,Z]}],"backdrop-blur":[{"backdrop-blur":Me()}],"backdrop-brightness":[{"backdrop-brightness":[ve,Q,Z]}],"backdrop-contrast":[{"backdrop-contrast":[ve,Q,Z]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ve,Q,Z]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ve,Q,Z]}],"backdrop-invert":[{"backdrop-invert":["",ve,Q,Z]}],"backdrop-opacity":[{"backdrop-opacity":[ve,Q,Z]}],"backdrop-saturate":[{"backdrop-saturate":[ve,Q,Z]}],"backdrop-sepia":[{"backdrop-sepia":["",ve,Q,Z]}],"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",Q,Z]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ve,"initial",Q,Z]}],ease:[{ease:["linear","initial",b,Q,Z]}],delay:[{delay:[ve,Q,Z]}],animate:[{animate:["none",w,Q,Z]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,Q,Z]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:ke()}],"rotate-x":[{"rotate-x":ke()}],"rotate-y":[{"rotate-y":ke()}],"rotate-z":[{"rotate-z":ke()}],scale:[{scale:Se()}],"scale-x":[{"scale-x":Se()}],"scale-y":[{"scale-y":Se()}],"scale-z":[{"scale-z":Se()}],"scale-3d":["scale-3d"],skew:[{skew:Ie()}],"skew-x":[{"skew-x":Ie()}],"skew-y":[{"skew-y":Ie()}],transform:[{transform:[Q,Z,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Te()}],"translate-x":[{"translate-x":Te()}],"translate-y":[{"translate-y":Te()}],"translate-z":[{"translate-z":Te()}],"translate-none":["translate-none"],accent:[{accent:_()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:_()}],"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",Q,Z]}],"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",Q,Z]}],fill:[{fill:["none",..._()]}],"stroke-w":[{stroke:[ve,Bo,Ur,yd]}],stroke:[{stroke:["none",..._()]}],"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"]}},Y9=(t,{cacheSize:e,prefix:n,experimentalParseClassName:r,extend:i={},override:o={}})=>(zo(t,"cacheSize",e),zo(t,"prefix",n),zo(t,"experimentalParseClassName",r),Fa(t.theme,o.theme),Fa(t.classGroups,o.classGroups),Fa(t.conflictingClassGroups,o.conflictingClassGroups),Fa(t.conflictingClassGroupModifiers,o.conflictingClassGroupModifiers),zo(t,"orderSensitiveModifiers",o.orderSensitiveModifiers),Ha(t.theme,i.theme),Ha(t.classGroups,i.classGroups),Ha(t.conflictingClassGroups,i.conflictingClassGroups),Ha(t.conflictingClassGroupModifiers,i.conflictingClassGroupModifiers),EE(t,i,"orderSensitiveModifiers"),t),zo=(t,e,n)=>{n!==void 0&&(t[e]=n)},Fa=(t,e)=>{if(e)for(const n in e)zo(t,n,e[n])},Ha=(t,e)=>{if(e)for(const n in e)EE(t,e,n)},EE=(t,e,n)=>{const r=e[n];r!==void 0&&(t[n]=t[n]?t[n].concat(r):r)},J9=(t,...e)=>typeof t=="function"?Dy(By,t,...e):Dy(()=>Y9(By(),t),...e),X9=J9({prefix:"mly"});function ye(...t){return X9(fM(t))}function ze(t){const{type:e="vertical",className:n}=t;return p.jsx("div",{className:ye("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 Vt=gR,Nt=yR,Tt=bR,xt=x.forwardRef((t,e)=>{var n=t,{className:r,sideOffset:i=4}=n,o=Pn(n,["className","sideOffset"]);return p.jsx(Qv,U({ref:e,sideOffset:i,className:ye("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)},o))});xt.displayName=Qv.displayName;var Rt=x.forwardRef((t,e)=>{var n=t,{className:r,variant:i="default",size:o="default",asChild:s=!1}=n,a=Pn(n,["className","variant","size","asChild"]);const l=s?pI:"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 ",u={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"},d={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=ye("mly-editor",c,u[i],d[o],r);return p.jsx(l,U({className:f,ref:e},a))});Rt.displayName="BaseButton";function cn(t){var e;const{tooltip:n}=t,r=p.jsx(Rt,oe(U({variant:"ghost",size:"sm"},t.command?{onClick:t.command}:{}),{"data-state":(e=t==null?void 0:t.isActive)==null?void 0:e.call(t),className:ye("mly:size-7! mly:px-2.5 mly:disabled:cursor-not-allowed",t==null?void 0:t.className),type:"button",disabled:t.disbabled,children:t.icon?p.jsx(t.icon,{className:ye("mly:h-3 mly:w-3 mly:shrink-0 mly:stroke-[2.5]",t==null?void 0:t.iconClassName)}):p.jsx("span",{className:ye("mly:text-sm mly:font-medium mly:text-slate-600",t==null?void 0:t.nameClassName),children:t.name})}));return n?p.jsxs(Nt,{children:[p.jsx(Tt,{asChild:!0,children:r}),p.jsx(xt,{sideOffset:8,children:n})]}):r}function Z9(t){const{alignment:e="top",onAlignmentChange:n}=t,r={top:{icon:MR,tooltip:"Align Top",onClick:()=>{n("middle")}},middle:{icon:_R,tooltip:"Align Center",onClick:()=>{n("bottom")}},bottom:{icon:TR,tooltip:"Align Bottom",onClick:()=>{n("top")}}}[e];return p.jsx(cn,{icon:r.icon,tooltip:r.tooltip,command:r.onClick})}function kE(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 CE(t){return kE(t,"variable")}function vi(t){return x.useMemo(()=>CE(t),[t])}function na(t,e){const{query:n}=e,r=n.toLowerCase();let i=[];if(Array.isArray(t))return i=t.filter(o=>o.name.toLowerCase().startsWith(r)),n.length>0&&!i.some(o=>o.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}'.
493
-
494
- You can check out the documentation for more information: https://github.com/arikchakma/maily.to/blob/main/packages/core/readme.md`)}var rn=CD,on=SD,Wt=x.forwardRef((t,e)=>{var n=t,{className:r,align:i="center",sideOffset:o=4,portal:s=!1}=n,a=Pn(n,["className","align","sideOffset","portal"]);const l=p.jsx(Ux,U({ref:e,align:i,sideOffset:o,className:ye("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 s?p.jsx(_D,{children:l}):l});Wt.displayName=Ux.displayName;var yo=Object.freeze({autoComplete:"off","data-1p-ignore":!0,"data-form-type":"other"});function Q9(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 ra=x.forwardRef((t,e)=>{var n;const r=t,{value:i="",onValueChange:o,className:s,onOutsideClick:a,onSelectOption:l,autoCompleteOptions:c=[],triggerChar:u="",editor:d}=r,f=Pn(r,["value","onValueChange","className","onOutsideClick","onSelectOption","autoCompleteOptions","triggerChar","editor"]),h=x.useRef(null),m=x.useRef(null),g=(n=vi(d))==null?void 0:n.variableSuggestionsPopover;Q9(h,()=>{a==null||a()});const y=i.startsWith(u);return p.jsxs("div",{className:ye("mly:relative"),ref:h,children:[p.jsxs("label",{className:"mly:relative",children:[p.jsx("input",oe(U(oe(U({},yo),{placeholder:"e.g. items",type:"text"}),f),{ref:e,value:i,onChange:b=>{o(b.target.value)},className:ye("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",s),onKeyDown:b=>{if(!m.current||!y)return;const{moveUp:w,moveDown:E,select:v}=m.current;b.key==="ArrowDown"?(b.preventDefault(),E()):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(lx,{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==null||l(b.name)},ref:m})})]})});ra.displayName="InputAutocomplete";function ej(t){const{showIfKey:e="",onShowIfKeyValueChange:n,editor:r}=t,i=vi(r),o=i==null?void 0:i.variables,s=i==null?void 0:i.renderVariable,[a,l]=x.useState(!1),c=x.useRef(null),u=x.useMemo(()=>na(o,{query:e||"",from:"bubble-variable",editor:r}).map(f=>f.name),[o,e,r]),d=e||u.includes(e);return p.jsxs(rn,{onOpenChange:f=>{f||l(!1)},children:[p.jsxs(Nt,{children:[p.jsx(Tt,{asChild:!0,children:p.jsx(on,{className:ye("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(o2,{className:"mly:h-3 mly:w-3 mly:stroke-[2.5]"})})}),p.jsx(xt,{sideOffset:8,children:"Show block conditionally"})]}),p.jsxs(Wt,{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(Nt,{children:[p.jsx(Tt,{children:p.jsx(hx,{className:ye("mly:size-3 mly:stroke-[2.5] mly:text-gray-500")})}),p.jsx(xt,{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:s({variable:{name:e,valid:!!d},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(ra,{editor:r,value:e||"",onValueChange:f=>{n==null||n(f)},onOutsideClick:()=>{l(!1)},onSelectOption:f=>{n==null||n(f),l(!1)},autoCompleteOptions:u,ref:c})})]})]})}var xi=x.memo(ej);function tj(t){const{columnsCount:e=2,onColumnsCountChange:n,columnWidths:r,onColumnWidthChange:i}=t;return p.jsxs(rn,{children:[p.jsx(on,{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(G2,{className:"mly:h-3 mly:w-3 mly:stroke-[2.5]"})}),p.jsxs(Wt,{className:"mly:w-[300px] mly:rounded-lg mly:p-0.5!",side:"top",sideOffset:8,align:"center",onOpenAutoFocus:o=>{o.preventDefault()},onCloseAutoFocus:o=>{o.preventDefault()},children:[p.jsxs("div",{className:"mly:grid mly:grid-cols-2 mly:gap-1",children:[p.jsxs($y,{onClick:()=>n(2),isActive:e===2,children:[p.jsx(ax,{className:"mly:h-4 mly:w-4 mly:stroke-[2.5]"}),p.jsx("span",{children:"2 Columns"})]}),p.jsxs($y,{onClick:()=>n(3),isActive:e===3,children:[p.jsx(YR,{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((o,s)=>{const a=r[s]==="auto"?"":r[s],l=e===2?s===0?"Left":"Right":s===0?"Left":s===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",oe(U({},yo),{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 u=c.target.value;i==null||i(s,u)}})),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:"%"})]})]},s)})})]})]})}function $y(t){const{onClick:e,isActive:n=!1,children:r}=t;return p.jsx("button",{className:ye("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 Sn(t){const{label:e,options:n,value:r,onValueChange:i,tooltip:o,className:s,icon:a,iconClassName:l,placeholder:c}=t,u=`mly${x.useId()}`,d=p.jsxs("div",{className:"mly:relative",children:[p.jsx("label",{htmlFor:u,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:ye("mly:size-3",l)})}),p.jsxs("select",{id:u,className:ye("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",s),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(ox,{size:16,strokeWidth:2,"aria-hidden":"true",role:"img"})})]});return o?p.jsxs(Nt,{children:[p.jsx(Tt,{asChild:!0,children:d}),p.jsx(xt,{sideOffset:8,children:o})]}):d}function SE(t,e){const{state:n}=t.view,r=qs(l=>l.type.name===e)(n.selection);if(!r)return;const i=r.pos,o=i+r.node.nodeSize,{tr:s}=n,a=s.delete(i,o);t.view.dispatch(a)}var zs=[{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 _E(t){const{editor:e}=t;if(!e)return null;const n=y9(e),r=n.columnsCount;return p.jsx(Vt,{children:p.jsxs("div",{className:"mly:flex mly:items-stretch",children:[n.isColumnActive&&p.jsxs(p.Fragment,{children:[p.jsx(tj,{columnsCount:r,columnWidths:n.columnWidths,onColumnsCountChange:i=>{i>r?p9(e):m9(e)},onColumnWidthChange:(i,o)=>{h9(e,i,o)}}),p.jsx(ze,{})]}),p.jsx(Z9,{alignment:n.currentVerticalAlignment,onAlignmentChange:i=>{e.commands.updateColumn({verticalAlign:i})}}),p.jsx(ze,{}),p.jsx(Sn,{icon:Y2,label:"Columns Gap",value:n.currentColumnsGap,options:[{value:"0",label:"None"},...zs.map(i=>({label:i.name,value:String(i.value)}))],onValueChange:i=>{e.commands.updateColumns({gap:+i})},tooltip:"Columns Gap"}),p.jsx(ze,{}),p.jsx(cn,{icon:vx,tooltip:"Delete Columns",command:()=>{SE(e,"columns")}}),p.jsx(ze,{}),p.jsx(xi,{showIfKey:n.currentShowIfKey,onShowIfKeyValueChange:i=>{e.commands.updateColumns({showIfKey:i})},editor:e})]})})}function nj(t){const{appendTo:e,editor:n}=t;if(!n)return null;const r=x.useCallback(()=>{const o=ou(n,"columns");return(o==null?void 0:o.getBoundingClientRect())||new DOMRect(-1e3,-1e3,0,0)},[n]),i=oe(U(U({},t),e?{appendTo:e.current}:{}),{shouldShow:({editor:o})=>su(o)||o.isActive("section")||o.isActive("repeat")||!o.isEditable?!1:o.isActive("columns"),tippyOptions:{offset:[0,8],popperOptions:{modifiers:[{name:"flip",enabled:!1}]},getReferenceClientRect:r,appendTo:()=>e==null?void 0:e.current,plugins:[pi],sticky:"popper",maxWidth:"auto"},pluginKey:"columnsBubbleMenu"});return p.jsx(nr,oe(U({},i),{className:"mly:rounded-lg mly:border mly:border-gray-200 mly:bg-white mly:p-0.5 mly:shadow-md",children:p.jsx(_E,{editor:n})}))}function hp(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 o=new ls(t,e,n),s=o.depth===0?0:i.resolve(o.start).posAtIndex(0);return o.parent.forEach((a,l)=>{const c=s+l,u=c+a.nodeSize;if(c<o.start||c>=o.end)return;const d=new Ib(i.resolve(c),i.resolve(u));r.push(d)}),r}var rj=class NE{constructor(e,n){this.anchor=e,this.head=n}map(e){return new NE(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return new TE(n,r)}},TE=class cr extends ge{constructor(e,n,r,i=1){const{doc:o}=e,s=e===n,a=e.pos===o.content.size&&n.pos===o.content.size,l=s&&!a?o.resolve(n.pos+(i>0?1:-1)):n,c=s&&a?o.resolve(e.pos-(i>0?1:-1)):e,u=hp(c.min(l),c.max(l),r);super(l.pos>=e.pos?u[0].$from:u[u.length-1].$to,l.pos>=e.pos?u[u.length-1].$to:u[0].$from,u),this.depth=r}get $to(){return this.ranges[this.ranges.length-1].$to}eq(e){return e instanceof cr&&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 cr(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),o=i[0].$from,s=i[i.length-1].$to;return new cr(o,s,this.depth)}const n=this.ranges[0],r=e.resolve(Math.max(0,n.$from.pos-1));return new cr(this.$anchor,r,this.depth)}extendForwards(){const{doc:e}=this.$from;if(this.isBackwards&&this.ranges.length>1){const i=this.ranges.slice(1),o=i[0].$from,s=i[i.length-1].$to;return new cr(s,o,this.depth)}const n=this.ranges[this.ranges.length-1],r=e.resolve(Math.min(e.content.size,n.$to.pos+1));return new cr(this.$anchor,r,this.depth)}static fromJSON(e,n){return new cr(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r,i,o=1){return new this(e.resolve(n),e.resolve(r),i,o)}getBookmark(){return new rj(this.anchor,this.head)}};function ij(t){const e=t.cloneNode(!0),n=[t,...Array.from(t.getElementsByTagName("*"))],r=[e,...Array.from(e.getElementsByTagName("*"))];return n.forEach((i,o)=>{const s=r[o];s instanceof HTMLElement&&i instanceof HTMLElement&&(s.style.cssText=function(a){let l="";const c=getComputedStyle(a);for(let u=0;u<c.length;u+=1)l+=`${c[u]}:${c.getPropertyValue(c[u])};`;return l}(i))}),e}function za(t,e){return window.getComputedStyle(t)[e]}function oj(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function jy(t){t.parentNode!==null&&t.parentNode!==void 0&&t.parentNode.removeChild(t)}var AE=t=>{const{x:e,y:n,direction:r,editor:i}=t;let o=null,s=null,a=null,l=e;for(;s===null&&l<window.innerWidth&&l>0;){const c=document.elementsFromPoint(l,n),u=c.findIndex(f=>f.classList.contains("ProseMirror")),d=c.slice(0,u);if(d.length>0){const f=d[0];if(o=f,a=i.view.posAtDOM(f,0),a>=0){s=i.state.doc.nodeAt(Math.max(a-1,0)),(s===null||s.isText)&&(s=i.state.doc.nodeAt(Math.max(a-1,0))),s||(s=i.state.doc.nodeAt(Math.max(a,0)));break}}r==="left"?l-=1:l+=1}return{resultElement:o,resultNode:s,pos:a!==null?a:null}};function sj(t,e){const{doc:n}=e.view.state,r=AE({editor:e,x:t.clientX,y:t.clientY,direction:"right"});if(!r.resultNode||r.pos===null)return[];const i=t.clientX,o=function(u,d,f){const h=parseInt(za(u.dom,"paddingLeft"),10),m=parseInt(za(u.dom,"paddingRight"),10),g=parseInt(za(u.dom,"borderLeftWidth"),10),y=parseInt(za(u.dom,"borderLeftWidth"),10),b=u.dom.getBoundingClientRect();return{left:oj(d,b.left+h+g,b.right-m-y),top:f}}(e.view,i,t.clientY),s=e.view.posAtCoords(o);if(!s)return[];const{pos:a}=s;if(!n.resolve(a).parent)return[];const l=n.resolve(r.pos),c=n.resolve(r.pos+1);return hp(l,c,0)}var Fy=(t,e)=>{const n=t.resolve(e),{depth:r}=n;return r===0?e:n.pos-n.parentOffset-1},Hy=(t,e)=>{const n=t.nodeAt(e),r=t.resolve(e);let{depth:i}=r,o=n;for(;i>0;){const s=r.node(i);i-=1,i===0&&(o=s)}return o},bd=(t,e)=>{const n=XP.getState(t);return n?ZP(e,n.type,n.binding.mapping):null},zy=(t,e)=>{let n=e;for(;n&&n.parentNode&&n.parentNode!==t.dom;)n=n.parentNode;return n},ME=new Pe("dragHandle");function aj(t){const{pluginKey:e=ME,element:n,editor:r,tippyOptions:i,onNodeChange:o}=t,s=document.createElement("div");let a=null,l=!1,c=null,u=-1;return n.addEventListener("dragstart",d=>{const{view:f}=r;if(!d.dataTransfer)return;const{empty:h,$from:m,$to:g}=f.state.selection,y=sj(d,r),b=hp(m,g,0),w=b.some(D=>y.find(H=>H.$from===D.$from&&H.$to===D.$to)),E=h||!w?y:b;if(!E.length)return;const{tr:v}=f.state,k=document.createElement("div"),C=E[0].$from.pos,S=E[E.length-1].$to.pos,N=TE.create(f.state.doc,C,S),M=N.content();E.forEach(D=>{const H=ij(f==null?void 0:f.nodeDOM(D.$from.pos));k.append(H)}),k.style.position="absolute",k.style.top="-10000px",document.body.append(k),d.dataTransfer.clearData(),d.dataTransfer.setDragImage(k,0,0),f.dragging={slice:M,move:!0},v.setSelection(N),f.dispatch(v),document.addEventListener("drop",()=>jy(k),{once:!0}),setTimeout(()=>{n&&(n.style.pointerEvents="none")},0)}),n.addEventListener("dragend",()=>{n&&(n.style.pointerEvents="auto")}),new $e({key:typeof e=="string"?new Pe(e):e,state:{init:()=>({locked:!1}),apply(d,f,h,m){const g=d.getMeta("lockDragHandle"),y=d.getMeta("hideDragHandle");if(g!==void 0&&(l=g),y&&a)return a==null||a.hide(),l=!1,c=null,u=-1,o==null||o({editor:r,node:null,pos:-1}),f;if(d.docChanged&&u!==-1&&n&&a){const b=d.mapping.map(u);b!==u&&(u=b,bd(m,u))}return f}},view:d=>{var f;return n.draggable=!0,n.style.pointerEvents="auto",(f=r.view.dom.parentElement)===null||f===void 0||f.appendChild(s),s.appendChild(n),s.style.pointerEvents="none",s.style.position="absolute",s.style.top="0",s.style.left="0",a=Pr(d.dom,oe(U({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:s,content:n})),{update(h,m){if(!n||!a||(n.draggable=!l,d.state.doc.eq(m.doc)||u===-1))return;let g=d.nodeDOM(u);if(g=zy(d,g),g===d.dom||(g==null?void 0:g.nodeType)!==1)return;const y=d.posAtDOM(g,0),b=Hy(r.state.doc,y);if(b!==c){const w=Fy(r.state.doc,y);c=b,u=w,bd(d.state,u),o==null||o({editor:r,node:c,pos:u}),a.setProps({getReferenceClientRect:()=>g==null?void 0:g.getBoundingClientRect()}),a.show()}},destroy(){a==null||a.destroy(),n&&jy(s)}}},props:{handleDOMEvents:{mouseleave:(d,f)=>(l||f.target&&!s.contains(f==null?void 0:f.relatedTarget)&&(a==null||a.hide(),c=null,u=-1,o==null||o({editor:r,node:null,pos:-1})),!1),mousemove(d,f){if(!n||!a||l)return!1;const h=AE({x:f.clientX,y:f.clientY,direction:"right",editor:r});if(!h.resultElement)return!1;let m=h.resultElement;if(m=zy(d,m),m===d.dom||(m==null?void 0:m.nodeType)!==1)return!1;const g=d.posAtDOM(m,0),y=Hy(r.state.doc,g);if(y!==c){const b=Fy(r.state.doc,g);c=y,u=b,bd(d.state,u),o==null||o({editor:r,node:c,pos:u}),a.setProps({getReferenceClientRect:()=>m.getBoundingClientRect()}),a.show()}return!1}}}})}function lj(t){const{className:e="drag-handle",children:n,editor:r,pluginKey:i=ME,onNodeChange:o,tippyOptions:s={}}=t,[a,l]=x.useState(null),c=x.useRef(null);return x.useEffect(()=>a?r.isDestroyed?()=>{c.current=null}:(c.current||(c.current=aj({editor:r,element:a,pluginKey:i,tippyOptions:s,onNodeChange:o}),r.registerPlugin(c.current)),()=>{r.unregisterPlugin(i),c.current=null}):()=>{c.current=null},[a,r,o,i]),p.jsx("div",{className:e,ref:l,children:n})}function cj(t){const{editor:e}=t,[n,r]=x.useState(!1),[i,o]=x.useState(null),[s,a]=x.useState(-1),l=x.useCallback(f=>{f.node&&o(f.node),a(f.pos)},[a,o]);function c(){e.commands.setNodeSelection(s);const{$anchor:f}=e.state.selection,h=f.node(1)||e.state.selection.node;e.chain().setMeta("hideDragHandle",!0).insertContentAt(s+((i==null?void 0:i.nodeSize)||0),h.toJSON()).run(),r(!1)}function u(){e.chain().setMeta("hideDragHandle",!0).setNodeSelection(s).deleteSelection().run(),r(!1)}function d(){var f;if(s!==-1){const h=(i==null?void 0:i.nodeSize)||0,m=s+h,g=(i==null?void 0:i.type.name)==="paragraph"&&((f=i==null?void 0:i.content)==null?void 0:f.size)===0,y=g?s+2:m+2;e.chain().command(({dispatch:b,tr:w,state:E})=>b?(g?w.insertText("/",s,s+1):w.insert(m,E.schema.nodes.paragraph.create(null,[E.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(lj,{pluginKey:"ContentMenu",editor:e,tippyOptions:{offset:[2,0],zIndex:99},onNodeChange:l,className:ye(e.isEditable?"mly:visible":"mly:hidden"),children:p.jsx(Vt,{children:p.jsxs("div",{className:"mly:flex mly:items-center mly:pr-1.5",children:[p.jsxs(Nt,{children:[p.jsx(Tt,{asChild:!0,children:p.jsx(Rt,{variant:"ghost",size:"icon",className:"mly:size-5! mly:cursor-grab mly:text-gray-500 mly:hover:text-black",onClick:d,type:"button",children:p.jsx(H2,{className:"mly:size-3.5 mly:shrink-0"})})}),p.jsx(xt,{sideOffset:8,children:"Add new node"})]}),p.jsxs(rn,{open:n,onOpenChange:r,children:[p.jsxs("div",{className:"mly:relative mly:flex mly:flex-col",children:[p.jsxs(Nt,{children:[p.jsx(Tt,{asChild:!0,children:p.jsx(Rt,{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(s)},type:"button",children:p.jsx(u2,{className:"mly:size-3.5 mly:shrink-0"})})}),p.jsx(xt,{sideOffset:8,children:"Node actions"})]}),p.jsx(on,{className:"mly:absolute mly:left-0 mly:top-0 mly:z-0 mly:h-5 mly:w-5"})]}),p.jsxs(Wt,{align:"start",side:"bottom",sideOffset:8,className:"mly:flex mly:w-max mly:flex-col mly:rounded-md mly:p-1",children:[p.jsxs(Rt,{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(XR,{className:"mly:size-[15px] mly:shrink-0"}),"Duplicate"]}),p.jsx(ze,{type:"horizontal"}),p.jsxs(Rt,{onClick:u,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(iI,{className:"mly:size-[15px] mly:shrink-0"}),"Delete"]})]})]})]})})})}var uj=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:ix},{name:"italic",command:()=>e.chain().focus().toggleItalic().run(),isActive:()=>e.isActive("italic"),group:"mark",icon:px},{name:"underline",command:()=>e.chain().focus().toggleUnderline().run(),isActive:()=>e.isActive("underline"),group:"mark",icon:xx},{name:"strike",command:()=>e.chain().focus().toggleStrike().run(),isActive:()=>e.isActive("strike"),group:"mark",icon:bx},{name:"delete-line",command:()=>e.chain().focus().selectParentNode().deleteSelection().run(),isActive:()=>!1,group:"mark",icon:cx},{name:"divider",command:()=>e.chain().focus().setHorizontalRule().run(),isActive:()=>e.isActive("horizontalRule"),group:"custom",icon:W2},{name:"link",command:()=>{const o=e.getAttributes("link").href,s=window.prompt("URL",o);if(s!==null){if(s===""){e.chain().focus().extendMarkRange("link").unsetLink().run();return}e.chain().focus().extendMarkRange("link").setLink({href:s}).run()}},isActive:()=>e.isActive("link"),group:"custom",icon:ef},{name:"left",command:()=>e.chain().focus().setTextAlign("left").run(),isActive:()=>e.isActive({textAlign:"left"}),group:"alignment",icon:nx},{name:"center",command:()=>e.chain().focus().setTextAlign("center").run(),isActive:()=>e.isActive({textAlign:"center"}),group:"alignment",icon:tx},{name:"right",command:()=>e.chain().focus().setTextAlign("right").run(),isActive:()=>e.isActive({textAlign:"right"}),group:"alignment",icon:rx}],[e]),i=x.useMemo(()=>r.reduce((o,s)=>(o.includes(s.group)||o.push(s.group),o),[]),[r]);return e?p.jsx("div",{className:`mly:flex mly:items-center mly:gap-3 ${n==null?void 0:n.toolbarClassName}`,children:i.map((o,s)=>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===o).map((a,l)=>p.jsx(cn,U({},a),l))},s))}):null},dj=t=>In({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:Br});function fj(t){const{appendTo:e,editor:n}=t;if(!n)return null;const r=dj(n),i=x.useCallback(()=>{const a=ou(n,"htmlCodeBlock");return(a==null?void 0:a.getBoundingClientRect())||new DOMRect(-1e3,-1e3,0,0)},[n]),o=oe(U(U({},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==null?void 0:e.current,plugins:[pi],sticky:"popper",maxWidth:"auto"},pluginKey:"htmlCodeBlockBubbleMenu"}),{activeTab:s="code"}=r;return p.jsx(nr,oe(U({},o),{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(Vt,{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(Nt,{children:[p.jsx(Tt,{asChild:!0,children:p.jsx("button",{className:ye("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",s==="code"&&"mly:bg-white"),disabled:s==="code",onClick:()=>{var a;(a=n==null?void 0:n.commands)==null||a.updateHtmlCodeBlock({activeTab:"code"})},children:p.jsx(sx,{className:"mly:size-3 mly:shrink-0 mly:stroke-[2.5]"})})}),p.jsx(xt,{sideOffset:8,children:"HTML Code"})]}),p.jsxs(Nt,{children:[p.jsx(Tt,{asChild:!0,children:p.jsx("button",{className:ye("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",s==="preview"&&"mly:bg-white"),disabled:s==="preview",onClick:()=>{var a;(a=n==null?void 0:n.commands)==null||a.updateHtmlCodeBlock({activeTab:"preview"})},children:p.jsx(uI,{className:"mly:size-3 mly:shrink-0 mly:stroke-[2.5]"})})}),p.jsx(xt,{sideOffset:8,children:"Preview"})]})]}),p.jsx(ze,{}),p.jsx(xi,{showIfKey:r.currentShowIfKey,onShowIfKeyValueChange:a=>{n.commands.updateHtmlCodeBlock({showIfKey:a})},editor:n})]})}))}var OE="#f7f7f7",Uy="left",hj=2,RE="#e2e2e2",pj=0,mj=0,gj=0,yj=0,bj=0,vj=0,xj=0,wj=0,Qe=null,IE=qe.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==null?void 0: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:OE,parseHTML:t=>t.style.backgroundColor,renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor};--bg-color: ${t.backgroundColor}`}:{}},align:{default:Uy,parseHTML:t=>t.getAttribute("align")||Uy,renderHTML(t){return t.align?{align:t.align}:{}}},borderWidth:{default:hj,parseHTML:t=>{var e,n;return Number((n=(e=t==null?void 0: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:RE,parseHTML:t=>t.style.borderColor,renderHTML:t=>t.borderColor?{style:`border-color: ${t.borderColor}`}:{}},paddingTop:{default:bj,parseHTML:t=>{var e,n;return Number((n=(e=t==null?void 0: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:vj,parseHTML:t=>{var e,n;return Number((n=(e=t==null?void 0: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:xj,parseHTML:t=>{var e,n;return Number((n=(e=t==null?void 0: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:wj,parseHTML:t=>{var e,n;return Number((n=(e=t==null?void 0: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:pj,parseHTML:t=>{var e,n;return Number((n=(e=t==null?void 0:t.style)==null?void 0:e.marginTop)==null?void 0:n.replace(/['"]+/g,""))||0},renderHTML:t=>t.marginTop?{marginTop:t.marginTop}:{}},marginRight:{default:mj,parseHTML:t=>{var e,n;return Number((n=(e=t==null?void 0:t.style)==null?void 0:e.marginRight)==null?void 0:n.replace(/['"]+/g,""))||0},renderHTML:t=>t.marginRight?{marginRight:t.marginRight}:{}},marginBottom:{default:gj,parseHTML:t=>{var e,n;return Number((n=(e=t==null?void 0:t.style)==null?void 0:e.marginBottom)==null?void 0:n.replace(/['"]+/g,""))||0},renderHTML:t=>t.marginBottom?{marginBottom:t.marginBottom}:{}},marginLeft:{default:yj,parseHTML:t=>{var e,n;return Number((n=(e=t==null?void 0:t.style)==null?void 0:e.marginLeft)==null?void 0:n.replace(/['"]+/g,""))||0},renderHTML:t=>t.marginLeft?{marginLeft:t.marginLeft}:{}},showIfKey:{default:Qe,parseHTML:t=>t.getAttribute("data-show-if-key")||Qe,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",Ne(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 Ej(t){const{editor:e,onImageUpload:n,allowedMimeTypes:r}=t;function i(o,s,a){var l,c,u;const d=URL.createObjectURL(s),{tr:f,schema:h}=o.state,m=h.nodes.image.create({src:d,isSrcVariable:!1,alt:s.name,externalLink:"",isExternalLinkVariable:!1});(u=(c=(l=e==null?void 0:e.extensionStorage)==null?void 0:l.imageUpload)==null?void 0:c.placeholderImages)==null||u.add(d);const g=a!==void 0?o.state.doc.resolve(a):o.state.selection.$head,y=f.insert(g.pos,m);o.dispatch(y),n==null||n(s).then(b=>{const w=o.state.tr,E=v=>v.type.name==="image"&&v.attrs.src===d;o.state.doc.descendants((v,k)=>{if(E(v))return w.setNodeMarkup(k,void 0,oe(U({},v.attrs),{src:b})),!1}),o.dispatch(w)}).catch(b=>{console.error("Image upload failed",b)}).finally(()=>{e.extensionStorage.imageUpload.placeholderImages.delete(d),URL.revokeObjectURL(d)})}return new $e({key:new Pe("imageUpload"),props:{handleDrop:(o,s)=>{var a,l;if(!n||!((l=(a=s.dataTransfer)==null?void 0:a.files)!=null&&l.length))return!1;const c=Array.from(s.dataTransfer.files).filter(d=>r==null?void 0:r.includes(d.type));if(c.length===0)return!1;const u=o.posAtCoords({left:s.clientX,top:s.clientY});return u?(s.preventDefault(),s.stopPropagation(),c.forEach(d=>i(o,d,u.pos)),!0):!1},handlePaste:(o,s)=>{var a,l;if(!n||!((l=(a=s.clipboardData)==null?void 0:a.files)!=null&&l.length))return!1;const c=Array.from(s.clipboardData.files).filter(u=>r==null?void 0:r.includes(u.type));return c.length===0?!1:(s.preventDefault(),s.stopPropagation(),c.forEach(u=>i(o,u)),!0)}}})}Ve.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?[Ej({editor:this.editor,allowedMimeTypes:this.options.allowedMimeTypes,onImageUpload:this.options.onImageUpload})]:[]}});function DE(t){return x.useMemo(()=>{const e=t.extensionManager.extensions.find(n=>n.name==="imageUpload");return(e==null?void 0:e.options)||{}},[t])}var kj=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 Vy(t,e){return t/e}function _f(t,e){return t<=0||e<=0?0:t/e}function Cj(t,e){return t*e}var Wy=20,LE=600,Ky=400;function Sj(t){const{node:e,updateAttributes:n,selected:r,editor:i}=t,[o,s]=x.useState("idle"),[a,l]=x.useState(!1),{onImageUpload:c,allowedMimeTypes:u=[]}=DE(i),d=x.useRef(null),f=x.useRef(null),[h,m]=x.useState(),[g,y]=x.useState(!1),b=kj(W=>{const J=document.querySelector(".ProseMirror-selectednode");if(!f.current||!J||!r)return;const me=Math.max(J.offsetWidth,LE);W.preventDefault();const pe=W.currentTarget.dataset.direction||"--",Me=W.clientX,ke=W.clientY,Se=f.current.width,Ie=f.current.height;let Te=Se,Ce=Ie;const We=pe[1]==="w"?-1:1,Be=pe[0]==="n"?-1:1,ce=()=>{window.removeEventListener("mousemove",Ye),window.removeEventListener("mouseup",ce);const X=Vy(Te,Ce);n({width:Te,height:Ce,aspectRatio:X}),m(void 0)},Ye=X=>{if(Te=Math.max(Se+We*(X.clientX-Me),Wy),Ce=Math.max(Ie+Be*(X.clientY-ke),Wy),Te>me&&(Te=me),Ce>Ky&&(Ce=Ky),e.attrs.lockAspectRatio){const ne=e.attrs.aspectRatio&&isFinite(e.attrs.aspectRatio)&&e.attrs.aspectRatio>0?e.attrs.aspectRatio:Se/Ie;Ce=_f(Te,ne)}if(m({width:Te,height:Ce}),!X.buttons)return ce()};window.addEventListener("mousemove",Ye),window.addEventListener("mouseup",ce)}),w=x.useCallback(W=>a?null:p.jsx("div",{role:"button",tabIndex:0,onMouseDown:b,"data-direction":W,className:"mly:bg-rose-500",style:oe(U(U({position:"absolute",height:"10px",width:"10px"},{n:{top:0},s:{bottom:0}}[W[0]]),{w:{left:0},e:{right:0}}[W[1]]),{cursor:`${W}-resize`})}),[b,a]);let{alignment:E="center",width:v,height:k,src:C,borderRadius:S}=e.attrs||{};const N=e.attrs||{},{externalLink:M,isExternalLinkVariable:D,isSrcVariable:H,showIfKey:$,aspectRatio:z,borderRadius:L,lockAspectRatio:K}=N,A=Pn(N,["externalLink","isExternalLinkVariable","isSrcVariable","showIfKey","aspectRatio","borderRadius","lockAspectRatio"]),T=!!A.src,_=!!c&&i.isEditable&&!T&&!H&&o==="idle",I=W=>qi(this,null,function*(){if(!_||!W.target.files||W.target.files.length===0)return;const J=W.target.files[0];yield j(J)}),j=x.useCallback(W=>qi(this,null,function*(){if(_)try{s("loading");const J=yield c(W);n({src:J}),l(!1),s("loaded")}catch(J){console.error("Error uploading image:",J),s("error")}}),[c,n]);x.useEffect(()=>{var W,J,me,pe;if(!C||H)return;s("loading");const Me=(pe=(me=(J=(W=i==null?void 0:i.extensionStorage)==null?void 0:W.imageUpload)==null?void 0:J.placeholderImages)==null?void 0:me.has(C))!=null?pe:!1;l(Me);const ke=new Image;return ke.src=C,ke.onload=()=>{s("loaded");const{naturalWidth:Se,naturalHeight:Ie}=ke,Te=d==null?void 0:d.current;if(!Te||v!=="auto"||!Se)return;const Ce=Te.offsetWidth,We=Vy(Se,Ie),Be=Math.min(_f(Ce,We),Ie);n({width:Math.min(Ce,Se),height:Math.min(Be,Ie),aspectRatio:We})},ke.onerror=()=>{s("error")},()=>{ke.src="",ke.onload=null,ke.onerror=null}},[C]);const G=x.useCallback(W=>{_&&(W.preventDefault(),W.stopPropagation(),y(!0))},[c]),ie=x.useCallback(W=>{_&&(W.preventDefault(),W.stopPropagation(),y(!1))},[c]),ae=x.useCallback(W=>qi(this,null,function*(){var J;if(!_)return;W.preventDefault(),W.stopPropagation(),y(!1);const me=(J=W.dataTransfer)==null?void 0:J.files;if(!me||(me==null?void 0:me.length)===0)return;const pe=me[0];u.includes(pe.type)&&(yield j(pe))}),[j]);return p.jsxs(mi,oe(U({as:"div",draggable:i.isEditable,"data-drag-handle":i.isEditable,className:ye("mly-image-drop-zone",g&&"mly-drag-over"),style:U(oe(U({},T&&o==="loaded"?U({width:v&&v!=="auto"?`${v}px`:void 0,height:k&&k!=="auto"?`${k}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"}}[E]||{}),ref:d},_?{onDragOver:G,onDragLeave:ie,onDrop:ae}:{}),{children:[!T&&o==="idle"&&p.jsx(En,{status:"idle",minHeight:k,isDropZone:_}),!T&&o==="loading"&&!H&&p.jsx(En,{status:"loading",minHeight:k}),T&&H&&p.jsx(En,{status:"variable",minHeight:k}),T&&o==="loading"&&!H&&p.jsx(En,{status:"loading",minHeight:k}),T&&o==="error"&&!H&&p.jsx(En,{status:"error",minHeight:k}),_&&p.jsx("input",{type:"file",accept:"image/*",onChange:I,className:"mly:absolute mly:inset-0 mly:opacity-0",multiple:!1}),T&&o==="loaded"&&!H&&p.jsxs(p.Fragment,{children:[p.jsx("img",oe(U({},A),{ref:f,style:oe(U({},h),{cursor:"default",objectFit:"fill",marginBottom:0,borderRadius:S,width:h!=null&&h.width?`${h.width}px`:v&&v!=="auto"?`${v}px`:"auto",height:h!=null&&h.height?`${h.height}px`:k&&k!=="auto"?`${k}px`:"auto"}),draggable:i.isEditable,className:ye(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((W,J)=>p.jsx("div",{className:"mly:bg-rose-500",style:U({position:"absolute"},W)},J)),w("nw"),w("ne"),w("sw"),w("se")]})]})]}))}function En(t){const e=t,{status:n,minHeight:r,className:i,style:o,isDropZone:s}=e,a=Pn(e,["status","minHeight","className","style","isDropZone"]);return p.jsxs("div",oe(U({},a),{className:ye("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:U(U({},r?{minHeight:r}:{}),o),children:[n==="idle"&&!s&&p.jsxs(p.Fragment,{children:[p.jsx(g2,{className:"mly:size-4 mly:stroke-[2.5]"}),p.jsx("span",{children:"No image selected"})]}),n==="idle"&&s&&p.jsxs(p.Fragment,{children:[p.jsx(l2,{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(_2,{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(PR,{className:"mly:size-4 mly:stroke-[2.5]"}),p.jsx("span",{children:"Error loading image"})]}),n==="variable"&&p.jsxs(p.Fragment,{children:[p.jsx(Vi,{className:"mly:size-4 mly:stroke-[2.5]"}),p.jsx("span",{children:"Variable Image URL"})]})]}))}function _j(t){const{node:e,editor:n,updateAttributes:r}=t,[i,o]=x.useState("idle"),[s,a]=x.useState(!1),[l,c]=x.useState(!1),{onImageUpload:u,allowedMimeTypes:d=[]}=DE(n);let{alignment:f="center",src:h,isSrcVariable:m,size:g="sm"}=e.attrs||{};const y=!!h,b=!!u&&n.isEditable&&!m&&i==="idle",w=N=>qi(this,null,function*(){if(!b||!N.target.files||N.target.files.length===0)return;const M=N.target.files[0];yield E(M)}),E=x.useCallback(N=>qi(this,null,function*(){if(b)try{o("loading");const M=yield u(N);r({src:M}),a(!1),o("loaded")}catch(M){console.error("Error uploading image:",M),o("error")}}),[u,r]),v=x.useCallback(N=>{b&&(N.preventDefault(),N.stopPropagation(),c(!0))},[u]),k=x.useCallback(N=>{b&&(N.preventDefault(),N.stopPropagation(),c(!1))},[u]),C=x.useCallback(N=>qi(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==null?void 0:D.length)===0)return;const H=D[0];d.includes(H.type)&&(yield E(H))}),[E]);x.useEffect(()=>{var N,M,D,H;if(!h)return;o("loading");const $=(H=(D=(M=(N=n==null?void 0:n.extensionStorage)==null?void 0:N.imageUpload)==null?void 0:M.placeholderImages)==null?void 0:D.has(h))!=null?H:!1;a($);const z=new Image;return z.src=h,z.onload=()=>{o("loaded")},z.onerror=()=>{o("error")},()=>{z.src="",z.onload=null,z.onerror=null}},[h]);const S=Mj[g];return p.jsxs(mi,oe(U({as:"div",draggable:n.isEditable,"data-drag-handle":n.isEditable,style:{overflow:"hidden",position:"relative",lineHeight:"0px",display:"block"},className:ye("mly-image-drop-zone",l&&"mly-drag-over")},b?{onDragOver:v,onDragLeave:k,onDrop:C}:{}),{children:[!y&&i==="idle"&&p.jsx(En,{status:"idle",minHeight:S,isDropZone:b}),!y&&i==="loading"&&!m&&p.jsx(En,{status:"loading",minHeight:S}),y&&m&&p.jsx(En,{status:"variable",minHeight:S}),y&&i==="loading"&&!m&&p.jsx(En,{status:"loading",minHeight:S}),y&&i==="error"&&!m&&p.jsx(En,{status:"error",minHeight:S}),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:U({height:S,width:S,cursor:"default",marginBottom:0},{center:{marginLeft:"auto",marginRight:"auto"},left:{marginRight:"auto"},right:{marginLeft:"auto"}}[f]||{}),draggable:n.isEditable})]}))}var Nj=["sm","md","lg"],Tj=["left","center","right"],Aj="left",PE="sm",Mj={sm:"40px",md:"48px",lg:"64px"},BE=Vh.extend({name:"logo",priority:1e3,addAttributes(){var t;return oe(U({},(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:PE,parseHTML:e=>e.getAttribute("data-size"),renderHTML:e=>({"data-size":e.size})},alignment:{default:Aj,parseHTML:e=>e.getAttribute("data-alignment"),renderHTML:e=>({"data-alignment":e.alignment})},showIfKey:{default:Qe,parseHTML:e=>e.getAttribute("data-show-if-key")||Qe,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 gi(_j,{className:"mly:relative"})}}),Oj=[{name:"Sharp",value:0},{name:"Smooth",value:8},{name:"Smoother",value:16},{name:"Rounded",value:24},{name:"Circle",value:9999}];function au(t){const{alignment:e,onAlignmentChange:n}=t,r=Tj.includes(e)?e:"left",i={left:{icon:nx,tooltip:"Align Left",onClick:()=>{n("left")}},center:{icon:tx,tooltip:"Align Center",onClick:()=>{n("center")}},right:{icon:rx,tooltip:"Align Right",onClick:()=>{n("right")}}},o=i[r];return p.jsxs(rn,{children:[p.jsxs(Nt,{children:[p.jsx(Tt,{asChild:!0,children:p.jsx(on,{className:ye("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(o.icon,{className:"mly:h-3 mly:w-3 mly:stroke-[2.5]"})})}),p.jsx(xt,{sideOffset:8,children:"Alignment"})]}),p.jsx(Wt,{className:"mly:flex mly:w-max mly:gap-0.5 mly:rounded-lg mly:p-0.5!",side:"top",sideOffset:8,align:"center",onOpenAutoFocus:s=>{s.preventDefault()},onCloseAutoFocus:s=>{s.preventDefault()},children:Object.entries(i).map(([s,a])=>p.jsx(cn,{icon:a.icon,tooltip:a.tooltip,command:a.onClick,isActive:()=>s===r},s))})]})}var Rj={title:"Button",description:"Add a call to action button to email.",searchTerms:["link","button","cta"],icon:p.jsx(D2,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setButton().run()}},Ij={title:"Link Card",description:"Add a link card to email.",searchTerms:["link","button","image"],icon:p.jsx(X2,{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},Dj={title:"Custom HTML",description:"Insert a custom HTML block",searchTerms:["html","code","custom"],icon:p.jsx(sx,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setHtmlCodeBlock({language:"html"}).run()}},Lj={title:"Image",description:"Full width image",searchTerms:["image"],icon:p.jsx(Ch,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setImage({src:""}).run()}},Pj={title:"Logo",description:"Add your brand logo",searchTerms:["image","logo"],icon:p.jsx(Ch,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setLogoImage({src:""}).run()}},Bj={title:"Inline Image",description:"Inline image",searchTerms:["image","inline"],icon:p.jsx(Ch,{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:o,editor:s}=n,{from:a}=e,l=i.doc.nodeAt(a);if(!l)return!1;const c=ue.create(r.doc,a,a+l.nodeSize);return r.setSelection(c),!0}).run()}},$j={title:"Columns",description:"Add columns to email.",searchTerms:["layout","columns"],icon:p.jsx(ax,{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()}},jj={title:"Section",description:"Add a section to email.",searchTerms:["layout","section"],icon:p.jsx(gx,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setSection().run()}},Fj={title:"Repeat",description:"Loop over an array of items.",searchTerms:["repeat","for","loop"],icon:p.jsx(yx,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setRepeat().run()}},Hj={title:"Spacer",description:"Add space between blocks.",searchTerms:["space","gap","divider"],icon:p.jsx(P2,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setSpacer({height:"sm"}).run()}},zj={title:"Divider",description:"Add a horizontal divider.",searchTerms:["divider","line"],icon:p.jsx(R2,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setHorizontalRule().run()}},Uj={title:"Bullet List",description:"Create a simple bullet list.",searchTerms:["unordered","point"],icon:p.jsx(_h,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).toggleBulletList().run()}},Vj={title:"Numbered List",description:"Create a list with numbering.",searchTerms:["ordered"],icon:p.jsx(Sh,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).toggleOrderedList().run()}},Wj={title:"Text",description:"Just start typing with plain text.",searchTerms:["p","paragraph"],icon:p.jsx(nI,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).toggleNode("paragraph","paragraph").run()}},Kj={title:"Heading 1",description:"Big heading.",searchTerms:["h1","title","big","large"],icon:p.jsx(kh,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setNode("heading",{level:1}).run()}},Gj={title:"Heading 2",description:"Medium heading.",searchTerms:["h2","subtitle","medium"],icon:p.jsx(ux,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setNode("heading",{level:2}).run()}},qj={title:"Heading 3",description:"Small heading.",searchTerms:["h3","subtitle","small"],icon:p.jsx(dx,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setNode("heading",{level:3}).run()}},Yj={title:"Hard Break",description:"Add a break between lines.",searchTerms:["break","line"],icon:p.jsx(n2,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setHardBreak().run()}},Jj={title:"Blockquote",description:"Add blockquote.",searchTerms:["quote","blockquote"],icon:p.jsx(eI,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).toggleBlockquote().run()}},Xj={title:"Footer",description:"Add a footer text to email.",searchTerms:["footer","text"],icon:p.jsx(Eh,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setFooter().run()}},Zj={title:"Clear Line",description:"Clear the current line.",searchTerms:["clear","line"],icon:p.jsx(cx,{className:"mly:h-4 mly:w-4"}),command:({editor:t,range:e})=>{t.chain().focus().selectParentNode().deleteSelection().run()}};function Qj(t){return p.jsxs("svg",oe(U({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 eF(t){return p.jsxs("svg",oe(U({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 tF(t){return p.jsxs("svg",oe(U({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 nF={title:"Logo with Text (Horizontal)",description:"Logo and a text horizontally",searchTerms:["logo","text"],icon:p.jsx(eF,{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()}},rF={title:"Logo with Text (Vertical)",description:"Logo and a text vertically",searchTerms:["logo","text"],icon:p.jsx(tF,{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()}},iF={title:"Logo with Cover Image",description:"Logo and a cover image",searchTerms:["logo","cover","image"],icon:p.jsx(Qj,{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()}},oF={title:"Footer Copyright",description:"Copyright text for the footer.",searchTerms:["footer","copyright"],icon:p.jsx(QR,{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()}},sF={title:"Footer Community Feedback CTA",description:"Community feedback CTA for the footer.",searchTerms:["footer","community","feedback","cta"],icon:p.jsx(gx,{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()}},aF={title:"Footer Company Signature",description:"Company signature for the footer.",searchTerms:["footer","company","signature"],icon:p.jsx(w2,{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()}},pp=[{title:"Blocks",commands:[Wj,Kj,Gj,qj,Uj,Vj,Lj,Pj,Bj,$j,jj,Fj,zj,Hj,Rj,Ij,Yj,Jj,Xj,Zj]},{title:"Components",commands:[{id:"headers",title:"Headers",description:"Add pre-designed headers block",searchTerms:["header","headers"],icon:p.jsx(kh,{className:"mly:h-4 mly:w-4"}),preview:"https://cdn.usemaily.com/previews/header-preview-xyz.png",commands:[rF,nF,iF]},{id:"footers",title:"Footers",description:"Add pre-designed footers block",searchTerms:["footers"],icon:p.jsx(Eh,{className:"mly:h-4 mly:w-4"}),commands:[oF,sF,aF]},Dj]}],lu="https://maily.to/",$E=x.createContext({placeholderUrl:lu,blocks:pp});function lF(t){const e=t,{children:n}=e,r=Pn(e,["children"]);return p.jsx($E.Provider,{value:r,children:n})}function jE(){const t=x.useContext($E);if(!t)throw new Error("Missing MailyContext.Provider in the component tree");return t}var cF=x.forwardRef((t,e)=>{const{items:n,onSelectItem:r}=t,[i,o]=x.useState(0),s=x.useRef(null),a=x.useRef([]),l=c=>{const u=s.current,d=a.current[c];if(!u||!d)return;const f=u.getBoundingClientRect(),h=d.getBoundingClientRect(),m=4;h.bottom>f.bottom?u.scrollTop+=h.bottom-f.bottom+m:h.top<f.top&&(u.scrollTop+=h.top-f.top-m)};return x.useEffect(()=>{o(0),s.current&&(s.current.scrollTop=0),a.current=n.map(()=>null)},[n]),x.useEffect(()=>{l(i)},[i]),x.useImperativeHandle(e,()=>({moveUp:()=>{o((i+n.length-1)%n.length)},moveDown:()=>{o((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(Ua,{children:p.jsx(Vi,{className:"mly:size-3 mly:stroke-[2.5]"})})]}),p.jsx("div",{ref:s,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!=null&&n.length?n==null?void 0:n.map((c,u)=>p.jsxs("button",{ref:d=>a.current[u]=d,onClick:()=>r(c),className:ye("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",u===i?"mly:bg-soft-gray":"mly:bg-white"),children:[p.jsx(Vi,{className:"mly:size-3 mly:stroke-[2.5] mly:text-rose-600"}),(c==null?void 0:c.label)||c.name]},u)):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(Ua,{children:p.jsx(RR,{className:"mly:size-3 mly:stroke-[2.5]"})}),p.jsx(Ua,{children:p.jsx(DR,{className:"mly:size-3 mly:stroke-[2.5]"})}),p.jsx("span",{className:"mly:text-xs mly:text-gray-500",children:"Navigate"})]}),p.jsx(Ua,{children:p.jsx(lx,{className:"mly:size-3 mly:stroke-[2.5]"})})]})]})});function Ua(t){const{className:e,children:n}=t;return p.jsx("div",{className:ye("mly:flex mly:size-5 mly:items-center mly:justify-center mly:rounded-md mly:border mly:border-gray-200",e),children:n})}function uF(t){const{node:e,updateAttributes:n,editor:r}=t,{id:i,fallback:o,required:s,hideDefaultValue:a=!1,label:l}=e.attrs,c=x.useMemo(()=>{var u,d;return(d=(u=kE(r,"variable"))==null?void 0:u.renderVariable)!=null?d:FE},[r]);return p.jsx(mi,{className:"react-component mly:inline-block mly:leading-none",draggable:"false",children:p.jsxs(rn,{onOpenChange:u=>{r.storage.variable.popover=u},children:[p.jsx(on,{children:c({variable:{name:i,required:s,valid:!0,label:l},fallback:o,editor:r,from:"content-variable"})}),p.jsx(Wt,{align:"start",side:"bottom",className:"mly:w-max mly:rounded-lg mly:p-0.5!",sideOffset:8,onOpenAutoFocus:u=>u.preventDefault(),onCloseAutoFocus:u=>u.preventDefault(),children:p.jsx(Vt,{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",oe(U({},yo),{value:i??"",onChange:u=>{n({id:u.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(ze,{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",oe(U({},yo),{value:o??"",onChange:u=>{n({fallback:u.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($2,{className:"mly:h-3 mly:w-3 mly:stroke-[2.5] mly:text-midnight-gray"})})]})]})]})})})]})})}var dF=t=>{const{variable:e,fallback:n,from:r}=t,{name:i,required:o,valid:s,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(Vi,{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:ye("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",!s&&"mly:border-rose-400 mly:bg-rose-50 mly:text-rose-600 mly:hover:bg-rose-100"),children:[p.jsx(Vi,{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(Vi,{className:"mly:size-[var(--variable-icon-size)] mly:shrink-0 mly:stroke-[2.5] mly:text-rose-600"}),l,o&&!n&&p.jsx(aI,{className:"mly:size-[var(--variable-icon-size)] mly:shrink-0 mly:stroke-[2.5]"})]})},mp="@",fF=[],FE=dF,hF=cF,pF=new Pe("variable"),HE=qe.create({name:"variable",group:"inline",inline:!0,selectable:!0,atom:!0,addStorage(){return{popover:!1}},addOptions(){return{variables:fF,variableSuggestionsPopover:hF,renderVariable:FE,disableInput:!1,renderLabel(t){var e;const{node:n}=t;return`${(e=n.attrs.label)!=null?e:n.attrs.id}`},suggestion:{char:"@",pluginKey:pF,command:({editor:t,range:e,props:n})=>{var r,i;const o=t.view.state.selection.$to.nodeAfter;((r=o==null?void 0:o.text)==null?void 0: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==null?void 0:t.required)!=null?e:!0}}},hideDefaultValue:{default:!1}}},parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){return["div",Ne({"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:o}=r;return i?(e.doc.nodesBetween(o-1,o,(s,a)=>{if(s.type.name===this.name)return n=!0,t.insertText(this.options.suggestion.char||"",a,a+s.nodeSize),!1}),n):!1})}},addProseMirrorPlugins(){return[Jw(U({editor:this.editor},this.options.suggestion))]},addNodeView(){return gi(uF,{className:"mly:relative mly:inline-block",as:"div"})}});function bo(t){var e,n;const{defaultValue:r="",onValueChange:i,tooltip:o,icon:s=ef,editor:a,isVariable:l}=t,[c,u]=x.useState(!1),[d,f]=x.useState(!l),h=x.useRef(null),{placeholderUrl:m=lu}=jE(),g=vi(a),y=g==null?void 0:g.renderVariable,b=g==null?void 0:g.variables,w=(n=(e=g==null?void 0:g.suggestion)==null?void 0:e.char)!=null?n:mp,E=x.useMemo(()=>{const k=r.replace(new RegExp(w,"g"),"");return na(b,{query:k||"",from:"bubble-variable",editor:a}).map(C=>C.name)},[b,w,r,a]),v=p.jsx(on,{asChild:!0,children:p.jsx(Rt,{variant:"ghost",size:"sm",type:"button",className:"mly:h-7! mly:w-7!","data-state":!!r,children:p.jsx(s,{className:"mly:h-3 mly:w-3 mly:shrink-0 mly:stroke-[2.5] mly:text-midnight-gray"})})});return p.jsxs(rn,{open:c,onOpenChange:k=>{u(k),k&&setTimeout(()=>{var C;(C=h.current)==null||C.focus()},0)},children:[o?p.jsxs(Nt,{children:[p.jsx(Tt,{asChild:!0,children:v}),p.jsx(xt,{sideOffset:8,children:o})]}):v,p.jsx(Wt,{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:k=>k.preventDefault(),children:p.jsx("form",{onSubmit:k=>{k.preventDefault();const C=h.current;C&&(i==null||i(C.value),u(!1))},children:p.jsxs("div",{className:"mly:isolate mly:flex mly:rounded-lg",children:[!d&&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 k;(k=h.current)==null||k.focus()},0)},children:y({variable:{name:r,valid:!0},fallback:"",from:"bubble-variable",editor:a})})}),d&&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(ef,{className:"mly:h-3 mly:w-3 mly:stroke-[2.5] mly:text-midnight-gray"})}),p.jsx(ra,{editor:a,value:r,onValueChange:k=>{i==null||i(k)},autoCompleteOptions:E,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:k=>{var C;const S=(C=E.includes(k))!=null?C:!1;S&&f(!1),i==null||i(k,S),u(!1)}})]})]})})})]})}function Nf(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",oe(U({},yo),{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 mF=t=>In({editor:t,selector:({editor:n})=>{var r,i,o,s,a,l,c,u,d,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:(o=n.getAttributes("image"))==null?void 0:o.borderRadius,logoSize:((s=n.getAttributes("logo"))==null?void 0:s.size)||PE,imageSrc:((a=n.getAttributes("image"))==null?void 0:a.src)||((l=n.getAttributes("logo"))==null?void 0:l.src)||"",isSrcVariable:(f=(d=(c=n.getAttributes("image"))==null?void 0:c.isSrcVariable)!=null?d:(u=n.getAttributes("logo"))==null?void 0:u.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:Br});function gF(t){var e,n,r,i;const{editor:o,appendTo:s}=t;if(!o)return null;const a=mF(o),l=oe(U(U({},t),s?{appendTo:s.current}:{}),{shouldShow:({editor:u})=>u.isEditable?u.isActive("logo")||u.isActive("image"):!1,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},plugins:[pi],sticky:"popper",maxWidth:"100%"}}),{lockAspectRatio:c}=a;return p.jsx(nr,oe(U({},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(Vt,{children:[a.isLogoActive&&a.imageSrc&&p.jsxs(p.Fragment,{children:[p.jsx(Sn,{label:"Size",tooltip:"Size",value:a.logoSize,options:Nj.map(u=>({value:u,label:u})),onValueChange:u=>{o==null||o.chain().focus().setLogoAttributes({size:u}).run()}}),p.jsx(ze,{})]}),p.jsxs("div",{className:"mly:flex mly:gap-x-0.5",children:[p.jsx(au,{alignment:a.alignment,onAlignmentChange:u=>{a.isImageActive?o==null||o.chain().focus().updateAttributes("image",{alignment:u}).run():o==null||o.chain().focus().setLogoAttributes({alignment:u}).run()}}),p.jsx(bo,{defaultValue:(e=a==null?void 0:a.imageSrc)!=null?e:"",onValueChange:(u,d)=>{a.isLogoActive?o==null||o.chain().setLogoAttributes({src:u,isSrcVariable:d??!1}).run():o==null||o.chain().updateAttributes("image",{src:u,isSrcVariable:d??!1}).run()},tooltip:"Source URL",icon:fx,editor:o,isVariable:a.isSrcVariable}),a.isImageActive&&p.jsx(bo,{defaultValue:(n=a==null?void 0:a.imageExternalLink)!=null?n:"",onValueChange:(u,d)=>{o==null||o.chain().updateAttributes("image",{externalLink:u,isExternalLinkVariable:d??!1}).run()},tooltip:"External URL",editor:o,isVariable:a.isExternalLinkVariable})]}),a.isImageActive&&a.imageSrc&&p.jsxs(p.Fragment,{children:[p.jsx(ze,{}),p.jsx(Sn,{label:"Border Radius",value:a==null?void 0:a.borderRadius,options:Oj.map(u=>({value:String(u.value),label:u.name})),onValueChange:u=>{o==null||o.chain().updateAttributes("image",{borderRadius:Number(u)}).run()},tooltip:"Border Radius",className:"mly:capitalize"}),p.jsxs("div",{className:"mly:flex mly:gap-x-0.5",children:[p.jsx(Nf,{dimension:"width",value:(r=a==null?void 0:a.width)!=null?r:"",onValueChange:u=>{const d=Math.min(Number(u)||0,LE),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)&&u&&(m||f>0);o==null||o.chain().updateAttributes("image",U({width:String(d)},b?{height:String(_f(d,g))}:{})).run()}}),p.jsx(Nf,{dimension:"height",value:(i=a==null?void 0:a.height)!=null?i:"",onValueChange:u=>{const d=Number(u)||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)&&u&&(m||h>0);o==null||o.chain().updateAttributes("image",U({height:String(d)},b?{width:String(Cj(d,g))}:{})).run()}}),p.jsx(cn,{isActive:()=>c,command:()=>{const u=Number(a.width)||0,d=Number(a.height)||0,f=u/d;o==null||o.chain().updateAttributes("image",{lockAspectRatio:!c,aspectRatio:f}).run()},icon:c?M2:T2,tooltip:"Lock Aspect Ratio"})]})]}),p.jsx(ze,{}),p.jsx(xi,{showIfKey:a.currentShowIfKey,onShowIfKeyValueChange:u=>{o==null||o.chain().updateAttributes(a.isLogoActive?"logo":"image",{showIfKey:u}).run()},editor:o})]})}))}var gp=20,yp=20,zE=qe.create({name:"inlineImage",inline:!0,group:"inline",selectable:!1,addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{height:{default:gp},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",Ne(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 $e({key:new Pe("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}}})]}}),yF=t=>In({editor:t,selector:({editor:n})=>{var r,i,o,s,a,l,c,u;return{height:((r=n.getAttributes("inlineImage"))==null?void 0:r.height)||gp,width:((i=n.getAttributes("inlineImage"))==null?void 0:i.width)||yp,src:((o=n.getAttributes("inlineImage"))==null?void 0:o.src)||"",isSrcVariable:(a=(s=n.getAttributes("inlineImage"))==null?void 0:s.isSrcVariable)!=null?a:!1,imageExternalLink:((l=n.getAttributes("inlineImage"))==null?void 0:l.externalLink)||"",isExternalLinkVariable:(u=(c=n.getAttributes("inlineImage"))==null?void 0:c.isExternalLinkVariable)!=null?u:!1}},equalityFn:Br});function bF(t){var e,n;const{editor:r,appendTo:i}=t;if(!r)return null;const o=yF(r),s=oe(U(U({},t),i?{appendTo:i.current}:{}),{shouldShow:({editor:a})=>a.isEditable?a.isActive("inlineImage"):!1,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},plugins:[pi],sticky:"popper",maxWidth:"100%"}});return p.jsx(nr,oe(U({},s),{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(Vt,{children:p.jsxs("div",{className:"mly:flex mly:gap-x-0.5",children:[p.jsx(bo,{defaultValue:(e=o==null?void 0:o.src)!=null?e:"",onValueChange:(a,l)=>{r==null||r.chain().updateAttributes("inlineImage",{src:a,isSrcVariable:l??!1}).run()},tooltip:"Source URL",icon:fx,editor:r,isVariable:o.isSrcVariable}),p.jsx(bo,{defaultValue:(n=o==null?void 0:o.imageExternalLink)!=null?n:"",onValueChange:(a,l)=>{r==null||r.chain().updateAttributes("inlineImage",{externalLink:a,isExternalLinkVariable:l??!1}).run()},tooltip:"External URL",editor:r,isVariable:o.isExternalLinkVariable}),p.jsx(Nf,{dimension:"height",value:o==null?void 0:o.height,onValueChange:a=>{r==null||r.chain().updateAttributes("inlineImage",{width:a||yp,height:a||gp}).run()}})]})})}))}var vF=t=>In({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:Br});function xF(t){const{appendTo:e,editor:n}=t;if(!n)return null;const r=vF(n),i=x.useCallback(()=>{const g=ou(n,"repeat");return(g==null?void 0:g.getBoundingClientRect())||new DOMRect(-1e3,-1e3,0,0)},[n]),o=oe(U(U({},t),e?{appendTo:e.current}:{}),{shouldShow:({editor:g})=>{var y;const b=tr(g,"repeat"),E=(b?(y=Qi(b==null?void 0:b.node,v=>v.type.name==="section"))==null?void 0:y[0]:null)&&g.isActive("section");return su(g)||E||!g.isEditable?!1:g.isActive("repeat")},tippyOptions:{offset:[0,8],popperOptions:{modifiers:[{name:"flip",enabled:!1}]},getReferenceClientRect:i,appendTo:()=>e==null?void 0:e.current,plugins:[pi],sticky:"popper",maxWidth:"auto"},pluginKey:"repeatBubbleMenu"}),s=vi(n),a=s==null?void 0:s.variables,l=s==null?void 0:s.renderVariable,c=x.useRef(null),[u,d]=x.useState(!1),f=(r==null?void 0:r.each)||"",h=x.useMemo(()=>na(a,{query:f||"",editor:n,from:"repeat-variable"}).map(g=>g.name),[a,f,n]),m=f;return p.jsx(nr,oe(U({},o),{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(Vt,{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(Nt,{children:[p.jsx(Tt,{children:p.jsx(hx,{className:ye("mly:size-3 mly:stroke-[2.5] mly:text-gray-500")})}),p.jsx(xt,{sideOffset:14,className:"mly:max-w-[260px]",align:"start",children:"Ensure the selected variable is iterable, such as an array of objects."})]})]}),!u&&p.jsx("button",{onClick:()=>{d(!0),setTimeout(()=>{var g;(g=c.current)==null||g.focus()},0)},children:l({variable:{name:r==null?void 0:r.each,valid:m},fallback:"",from:"bubble-variable",editor:n})}),u&&p.jsx("form",{onSubmit:g=>{g.preventDefault(),d(!1)},onKeyDown:g=>{g.key==="Escape"&&d(!1)},children:p.jsx(ra,{editor:n,placeholder:"ie. payload.items",value:(r==null?void 0:r.each)||"",onValueChange:g=>{n.commands.updateRepeat({each:g})},onOutsideClick:()=>{d(!1)},onSelectOption:g=>{n.commands.updateRepeat({each:g}),d(!1)},autoCompleteOptions:h,ref:c})}),p.jsx(ze,{}),p.jsx(xi,{showIfKey:r.currentShowIfKey,onShowIfKeyValueChange:g=>{n.commands.updateRepeat({showIfKey:g})},editor:n})]})}))}function wF(t){const e=t,{topBarClassName:n}=e,r=Pn(e,["topBarClassName"]);return p.jsxs("svg",oe(U({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 EF(t){return p.jsx("svg",oe(U({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 kF(t){return p.jsx("svg",oe(U({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 Us(t){const{color:e,onColorChange:n,borderColor:r,backgroundColor:i,tooltip:o,className:s,children:a,onClose:l,suggestedColors:c=[]}=t,u=f=>{queueMicrotask(()=>{n(f)})},d=p.jsx(on,{asChild:!0,children:a||p.jsx(Rt,{variant:"ghost",className:"mly:h-7 mly:w-7 mly:shrink-0",size:"sm",type:"button",children:p.jsx("div",{className:ye("mly:h-4 mly:w-4 mly:shrink-0 mly:rounded mly:border-2 mly:border-gray-700",s),style:oe(U({},r?{borderColor:r}:{}),{backgroundColor:i||"transparent"})})})});return p.jsxs(rn,{onOpenChange:f=>{f||l==null||l(e)},children:[o?p.jsxs(Nt,{children:[p.jsx(Tt,{asChild:!0,children:d}),p.jsx(xt,{sideOffset:8,children:o})]}):d,p.jsx(Wt,{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(bB,{color:e,onChange:u,className:"mly:flex mly:w-full! mly:flex-col mly:gap-4"}),p.jsx(wB,{alpha:!0,color:e,onChange:u,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(Rt,{variant:"ghost",size:"sm",className:"!mly:size-7 mly:shrink-0",type:"button",onClick:()=>u(f),children:p.jsx("div",{className:"mly:h-4 mly:w-4 mly:shrink-0 mly:rounded",style:{backgroundColor:f}})},f))})]})]})})]})}var CF=t=>In({editor:t,selector:n=>{var r,i,o,s,a,l,c,u,d,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:((o=n.editor.getAttributes("section"))==null?void 0:o.backgroundColor)||OE,currentBorderColor:((s=n.editor.getAttributes("section"))==null?void 0:s.borderColor)||RE,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((u=n.editor.getAttributes("section"))==null?void 0:u.marginBottom)||0,currentMarginLeft:Number((d=n.editor.getAttributes("section"))==null?void 0:d.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:Br});function SF(t){const{appendTo:e,editor:n}=t;if(!n)return null;const r=x.useCallback(()=>{const a=ou(n,"section");return(a==null?void 0:a.getBoundingClientRect())||new DOMRect(-1e3,-1e3,0,0)},[n]),i=oe(U(U({},t),e?{appendTo:e.current}:{}),{shouldShow:({editor:a})=>{var l,c;const u=tr(a,"section"),d=u?(l=Qi(u==null?void 0:u.node,g=>g.type.name==="repeat"))==null?void 0:l[0]:null,f=u?(c=Qi(u==null?void 0:u.node,g=>g.type.name==="inlineImage"))==null?void 0:c[0]:null,h=d&&a.isActive("repeat"),m=f&&a.isActive("inlineImage");return su(a)||h||m||!a.isEditable?!1:a.isActive("section")},tippyOptions:{offset:[0,8],popperOptions:{modifiers:[{name:"flip",enabled:!1}]},getReferenceClientRect:r,appendTo:()=>e==null?void 0:e.current,plugins:[pi],sticky:"popper",maxWidth:"auto"},pluginKey:"sectionBubbleMenu"}),o=CF(n),s=[{value:"0",label:"Sharp"},{value:"6",label:"Smooth"},{value:"9999",label:"Round"}];return p.jsx(nr,oe(U({},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(Vt,{children:[p.jsx(au,{alignment:o.currentAlignment,onAlignmentChange:a=>{var l;(l=n==null?void 0:n.commands)==null||l.updateSection({align:a})}}),p.jsx(ze,{}),p.jsxs("div",{className:"mly:flex mly:gap-x-0.5",children:[p.jsx(Sn,{label:"Border Radius",value:String(o.currentBorderRadius),options:s,onValueChange:a=>{var l;(l=n==null?void 0:n.commands)==null||l.updateSection({borderRadius:Number(a)})},tooltip:"Border Radius",className:"mly:capitalize"}),p.jsx(Sn,{label:"Border Width",value:String(o.currentBorderWidth),options:[{value:"0",label:"None"},{value:"1",label:"Thin"},{value:"2",label:"Medium"},{value:"3",label:"Thick"}],onValueChange:a=>{var l;(l=n==null?void 0:n.commands)==null||l.updateSection({borderWidth:Number(a)})},tooltip:"Border Width",className:"mly:capitalize"})]}),p.jsx(ze,{}),p.jsx(Sn,{icon:EF,iconClassName:"mly:stroke-[1.2] mly:size-3.5",label:"Margin",value:String(o.currentMarginTop),options:[{value:"0",label:"None"},...zs.map(a=>({label:a.name,value:String(a.value)}))],onValueChange:a=>{var l;const c=Number(a);(l=n==null?void 0:n.commands)==null||l.updateSection({marginTop:c,marginRight:c,marginBottom:c,marginLeft:c})},tooltip:"Margin",className:"mly:capitalize"}),p.jsx(ze,{}),p.jsx(Sn,{icon:kF,iconClassName:"mly:stroke-[1]",label:"Padding",value:String(o.currentPaddingTop),options:[{value:"0",label:"None"},...zs.map(a=>({label:a.name,value:String(a.value)}))],onValueChange:a=>{var l;const c=Number(a);(l=n==null?void 0:n.commands)==null||l.updateSection({paddingTop:c,paddingRight:c,paddingBottom:c,paddingLeft:c})},tooltip:"Padding",className:"mly:capitalize"}),p.jsx(ze,{}),p.jsxs("div",{className:"mly:flex mly:gap-x-0.5",children:[p.jsx(Us,{color:o.currentBorderColor,onColorChange:a=>{var l;(l=n==null?void 0:n.commands)==null||l.updateSection({borderColor:a})},tooltip:"Border Color",children:p.jsx(Rt,{variant:"ghost",className:"mly:h-7 mly:w-7 mly:shrink-0",size:"sm",type:"button",children:p.jsx(wF,{className:"mly:size-3 mly:shrink-0",topBarClassName:"mly:stroke-midnight-gray",style:{color:o.currentBorderColor}})})}),p.jsx(Us,{color:o.currentBackgroundColor,onColorChange:a=>{var l;(l=n==null?void 0:n.commands)==null||l.updateSection({backgroundColor:a})},backgroundColor:o.currentBackgroundColor,tooltip:"Background Color",className:"mly:rounded-full mly:border-[1.5px] mly:border-white mly:shadow"})]}),p.jsx(ze,{}),p.jsx(cn,{icon:vx,tooltip:"Delete Section",command:()=>{SE(n,"section")}}),p.jsx(ze,{}),p.jsx(xi,{showIfKey:o.currentShowIfKey,onShowIfKeyValueChange:a=>{n.commands.updateSection({showIfKey:a})},editor:n}),o.isColumnsActive&&p.jsxs(p.Fragment,{children:[p.jsx(ze,{}),p.jsxs(rn,{children:[p.jsxs(on,{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(UR,{className:"mly:h-3 mly:w-3"})]}),p.jsx(Wt,{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(_E,{editor:n})})]})]})]})}))}var _F=t=>In({editor:t,selector:n=>{var r;return{currentShowIfKey:((r=n.editor.getAttributes("spacer"))==null?void 0:r.showIfKey)||""}},equalityFn:Br});function NF(t){const{editor:e,appendTo:n}=t;if(!e)return null;const r=x.useMemo(()=>zs.map(s=>{const{value:a,short:l}=s;return{name:l,isActive:()=>e==null?void 0:e.isActive("spacer",{height:a}),command:()=>{e==null||e.chain().focus().setSpacer({height:a}).run()}}}),[e]),i=oe(U(U({},t),n?{appendTo:n.current}:{}),{shouldShow:({editor:s})=>s.isEditable?s.isActive("spacer"):!1,tippyOptions:{maxWidth:"100%",moveTransition:"mly:transform 0.15s mly:ease-out"}}),o=_F(e);return p.jsx(nr,oe(U({},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(Vt,{children:[r.map((s,a)=>p.jsx(cn,U({className:"!mly:h-7 mly:w-7 mly:shrink-0 mly:p-0",iconClassName:"mly:w-3 mly:h-3",nameClassName:"mly:text-xs"},s),a)),p.jsx(ze,{}),p.jsx(xi,{showIfKey:o.currentShowIfKey,onShowIfKeyValueChange:s=>{e.commands.setSpacerShowIfKey(s)},editor:e})]})}))}var Gy=8,UE=qe.create({name:"columns",group:"columns",content:"column+",defining:!0,isolating:!0,addAttributes(){return{showIfKey:{default:Qe,parseHTML:t=>t.getAttribute("data-show-if-key")||Qe,renderHTML(t){return t.showIfKey?{"data-show-if-key":t.showIfKey}:{}}},gap:{default:Gy,parseHTML:t=>Number(t.style.gap)||Gy,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:ws()},content:[{type:"paragraph"}]},{type:"column",attrs:{columnId:ws()},content:[{type:"paragraph"}]}]}),updateColumns:t=>To(this.name,t)}},renderHTML({HTMLAttributes:t}){return["div",Ne(t,{"data-type":"columns",class:"mly:relative"}),0]},parseHTML(){return[{tag:'div[data-type="columns"]'}]},addKeyboardShortcuts(){return{Tab:()=>Oy(this.editor,"next"),"Shift-Tab":()=>Oy(this.editor,"previous")}}}),VE=e1.extend({addInputRules(){return[new Gs({find:/^(?:---|—-|___\s|\*\*\*\s)$/,handler:({state:t,range:e})=>{const n={},{tr:r}=t,i=e.from,o=e.to;r.insert(i-1,this.type.create(n)).delete(r.mapping.map(i),r.mapping.map(o))}})]},addOptions(){return{HTMLAttributes:{class:"mly:relative"}}}}),WE=8,KE=qe.create({name:"spacer",priority:1e3,group:"block",draggable:!0,addAttributes(){return{height:{default:WE,parseHTML:t=>Number(t.getAttribute("data-height")),renderHTML:t=>({"data-height":t.height})},showIfKey:{default:Qe,parseHTML:t=>t.getAttribute("data-show-if-key")||Qe,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",Ne({"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}"]`}]}}),Wr=x.forwardRef((t,e)=>{var n=t,{className:r,type:i}=n,o=Pn(n,["className","type"]);return p.jsx("input",U(oe(U({},yo),{type:i,className:ye("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}),o))});Wr.displayName="Input";var GE=x.forwardRef((t,e)=>{var n=t,{className:r}=n,i=Pn(n,["className"]);return p.jsx("textarea",U({className:ye("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))});GE.displayName="Textarea";function TF(t){const{title:e,description:n,link:r,linkTitle:i,image:o,badgeText:s,subTitle:a}=t.node.attrs,{getPos:l,editor:c}=t;return p.jsx(mi,{className:`react-component ${t.selected&&"ProseMirror-selectednode"}`,draggable:c.isEditable,"data-drag-handle":c.isEditable,children:p.jsxs(rn,{open:t.selected,children:[p.jsx(on,{asChild:!0,children:p.jsx("div",{tabIndex:-1,onClick:u=>{u.preventDefault();const d=l();c.commands.setNodeSelection(d)},children:p.jsxs("div",{className:"mly:no-prose mly:flex mly:flex-col mly:rounded-lg mly:border mly:border-gray-300",children:[o&&p.jsx("div",{className:"mly:relative mly:mb-1.5 mly:w-full mly:shrink-0",children:p.jsx("img",{src:o,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:ye("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}),s&&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:s})," ",a&&!s&&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(Wt,{align:"end",className:"mly:flex mly:w-96 mly:flex-col mly:gap-2",sideOffset:10,onOpenAutoFocus:u=>u.preventDefault(),onCloseAutoFocus:u=>u.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(Wr,{placeholder:"Add Image",type:"url",value:o,onChange:u=>{t.updateAttributes({image:u.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(Wr,{placeholder:"Add title",value:e,onChange:u=>{t.updateAttributes({title:u.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(GE,{placeholder:"Add description here",value:n,onChange:u=>{t.updateAttributes({description:u.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(Wr,{placeholder:"Add link title here",value:i,onChange:u=>{t.updateAttributes({linkTitle:u.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(Wr,{placeholder:"Add link here",value:r,onChange:u=>{t.updateAttributes({link:u.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(Wr,{placeholder:"Add badge text here",value:s,onChange:u=>{t.updateAttributes({badgeText:u.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(Wr,{placeholder:"Add sub title here",value:a,onChange:u=>{t.updateAttributes({subTitle:u.target.value})}})]})]})]})]})})}var qE=qe.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",Ne({"data-maily-component":this.name},t)]},addCommands(){return{setLinkCard:()=>({commands:t})=>t.insertContent({type:this.name,attrs:{mailyComponent:this.name}})}},addNodeView(){return gi(TF,{className:"mly:relative"})}});function AF(t){var e,n;const{value:r,onValueChange:i,isVariable:o,editor:s}=t,a=x.useRef(null),[l,c]=x.useState(!o),{placeholderUrl:u=lu}=jE(),d=vi(s),f=d==null?void 0:d.variables,h=(n=(e=d==null?void 0:d.suggestion)==null?void 0:e.char)!=null?n:mp,m=d==null?void 0:d.renderVariable,g=x.useMemo(()=>{const y=r.replace(new RegExp(h,"g"),"");return na(f,{query:y||"",from:"bubble-variable",editor:s}).map(b=>b.name)},[f,r,s]);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:s})}),l&&p.jsx(ra,{editor:s,value:r,onValueChange:y=>{i==null||i(y)},autoCompleteOptions:g,ref:a,placeholder:u,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==null||i(y,w)}})]})}function MF(t){const{node:e,editor:n,getPos:r,updateAttributes:i}=t,{text:o,isTextVariable:s,alignment:a,variant:l,borderRadius:c,buttonColor:u,textColor:d,url:f,showIfKey:h="",isUrlVariable:m,paddingTop:g,paddingRight:y,paddingBottom:b,paddingLeft:w}=e.attrs,E=vi(n),v=E==null?void 0:E.renderVariable,k=x.useMemo(()=>({small:{paddingX:24,paddingY:6},medium:{paddingX:32,paddingY:10},large:{paddingX:40,paddingY:14}}),[]),C=x.useMemo(()=>{var S;return(S=Object.entries(k).find(([,{paddingX:N,paddingY:M}])=>y===N&&g===M))==null?void 0:S[0]},[y,g,k]);return p.jsx(mi,{draggable:n.isEditable,"data-drag-handle":n.isEditable,"data-type":"button",style:{textAlign:a},children:p.jsxs(rn,{open:t.selected&&n.isEditable,children:[p.jsx(on,{asChild:!0,children:p.jsx("div",{children:p.jsx("button",{className:ye("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"?u||"var(--mly-button-background-color)":"transparent",color:d||"var(--mly-button-text-color)",borderWidth:2,borderStyle:"solid",borderColor:u||"var(--mly-button-background-color)","--button-var-border-color":d?`${d}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:S=>{if(S.preventDefault(),!n.isEditable)return;const N=r();n.commands.setNodeSelection(N)},children:s?v({variable:{name:o,valid:!0},fallback:o,from:"button-variable",editor:n}):o})})}),p.jsx(Wt,{align:"end",side:"top",className:"mly:w-max mly:rounded-lg mly:p-0.5!",sideOffset:8,onOpenAutoFocus:S=>S.preventDefault(),onCloseAutoFocus:S=>S.preventDefault(),children:p.jsx(Vt,{children:p.jsxs("div",{className:"mly:flex mly:items-stretch mly:text-midnight-gray",children:[p.jsx(AF,{value:o,onValueChange:(S,N)=>{i({text:S,isTextVariable:N??!1})},isVariable:s,editor:n}),p.jsx(ze,{}),p.jsxs("div",{className:"mly:flex mly:gap-x-0.5",children:[p.jsx(Sn,{label:"Border Radius",value:c,options:FF.map(S=>({value:S,label:S})),onValueChange:S=>{i({borderRadius:S})},tooltip:"Border Radius",className:"mly:capitalize"}),p.jsx(Sn,{label:"Style",value:l,options:jF.map(S=>({value:S,label:S})),onValueChange:S=>{i({variant:S})},tooltip:"Style",className:"mly:capitalize"}),p.jsx(Sn,{label:"Size",value:C,options:[{value:"small",label:"Small"},{value:"medium",label:"Medium"},{value:"large",label:"Large"}],onValueChange:S=>{const{paddingX:N,paddingY:M}=k[S];i({paddingTop:M,paddingRight:N,paddingBottom:M,paddingLeft:N})},tooltip:"Size",placeholder:"Size"})]}),p.jsx(ze,{}),p.jsxs("div",{className:"mly:flex mly:gap-x-0.5",children:[p.jsx(au,{alignment:a,onAlignmentChange:S=>{i({alignment:S})}}),p.jsx(bo,{defaultValue:f||"",onValueChange:(S,N)=>{i({url:S,isUrlVariable:N??!1})},tooltip:"Update External Link",editor:n,isVariable:m})]}),p.jsx(ze,{}),p.jsxs("div",{className:"mly:flex mly:gap-x-0.5",children:[p.jsx(OF,{variant:l,color:u||"transparent",onChange:S=>{i({buttonColor:S})}}),p.jsx(RF,{color:d||"transparent",onChange:S=>{i({textColor:S})}})]}),p.jsx(ze,{}),p.jsx(xi,{showIfKey:h,onShowIfKeyValueChange:S=>{i({showIfKey:S})},editor:n})]})})})]})})}function OF(t){const{color:e,onChange:n,variant:r}=t;return p.jsx(Us,{color:e,onColorChange:n,tooltip:"Background Color",children:p.jsx(Rt,{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 RF(t){const{color:e,onChange:n}=t;return p.jsx(Us,{color:e,onColorChange:n,tooltip:"Text Color",children:p.jsx(Rt,{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 qy="left",Yy="filled",Jy="smooth",IF=null,DF=null,LF=null,PF=null,BF=null,$F=null,jF=["filled","outline"],FF=["sharp","smooth","round"],YE=qe.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:qy,parseHTML:t=>t.getAttribute("data-alignment")||qy,renderHTML:t=>({"data-alignment":t.alignment})},variant:{default:Yy,parseHTML:t=>t.getAttribute("data-variant")||Yy,renderHTML:t=>({"data-variant":t.variant})},borderRadius:{default:Jy,parseHTML:t=>t.getAttribute("data-border-radius")||Jy,renderHTML:t=>({"data-border-radius":t.borderRadius})},showIfKey:{default:Qe,parseHTML:t=>t.getAttribute("data-show-if-key")||Qe,renderHTML(t){return t.showIfKey?{"data-show-if-key":t.showIfKey}:{}}},buttonColor:IF,textColor:DF,paddingTop:LF,paddingRight:PF,paddingBottom:BF,paddingLeft:$F}},parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML({HTMLAttributes:t}){return["div",Ne(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 gi(MF,{contentDOMElementTag:"div",className:"mly:relative"})}}),HF=0,JE=Vh.extend({addAttributes(){var t;return oe(U({},(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:HF,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!=null&&e.aspectRatio?{"data-aspect-ratio":e==null?void 0: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:Qe,parseHTML:e=>e.getAttribute("data-show-if-key")||Qe,renderHTML(e){return e.showIfKey?{"data-show-if-key":e.showIfKey}:{}}}})},addNodeView(){return gi(Sj,{className:"mly:relative"})}});function zF(t){const{node:e,updateAttributes:n}=t;let{language:r,activeTab:i="code"}=e.attrs;i||(i="code");const o=r?`language-${r}`:"",s=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==null?void 0:g.attrs)||{},w=b?`{{${y},fallback=${b}}}`:`{{${y}}}`;return m+w}return m},""),u=new DOMParser().parseFromString(l,"text/html"),d=u.querySelectorAll("style"),f=u.body;return`<style>${Array.from(d).map(m=>m.innerHTML).join(`
495
- `)}</style>${f.innerHTML}`},[i]),a=s==="";return p.jsxs(mi,{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(fv,{as:"code",className:ye("is-editable",o)})}),i==="preview"&&p.jsx("div",{className:ye("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!=null&&l.shadowRoot)return;const c=l.attachShadow({mode:"open"}),u=new CSSStyleSheet;u.replaceSync(`
496
- * { font-family: 'Inter', sans-serif; }
497
- blockquote, h1, h2, h3, img, li, ol, p, ul {
498
- margin-top: 0;
499
- margin-bottom: 0;
500
- }
501
- `),c.adoptedStyleSheets=[u];const d=document.createElement("div");d.innerHTML=s,c.appendChild(d)},contentEditable:!1,onClick:()=>{a&&n({activeTab:"code"})}})]})}var UF=z5.extend({addStorage(){return{colors:new Set}}}),VF=["ltr","rtl"],un="ltr",WF=np.extend({addAttributes(){var t;return oe(U({},((t=this==null?void 0:this.parent)==null?void 0:t.call(this))||{}),{textDirection:{default:un,parseHTML:e=>e.getAttribute("data-text-direction")||e.getAttribute("dir")||un,renderHTML(e){return!e.textDirection||e.textDirection===un?{}:{"data-text-direction":e.textDirection,dir:e.textDirection}}},showIfKey:{default:Qe,parseHTML:e=>e.getAttribute("data-show-if-key")||Qe,renderHTML(e){return e.showIfKey?{"data-show-if-key":e.showIfKey}:{}}}})},addCommands(){var t;return oe(U({},(t=this.parent)==null?void 0:t.call(this)),{setTextDirection:e=>({commands:n})=>n.updateAttributes(this.name,{textDirection:e})})}}),Xy=qe.create({name:"footer",group:"block",content:"inline*",addAttributes(){return{"maily-component":{default:"footer",renderHTML:t=>({"data-maily-component":t["maily-component"]}),parseHTML:t=>t==null?void 0:t.getAttribute("data-maily-component")},textDirection:{default:un,parseHTML:t=>t.getAttribute("data-text-direction")||t.getAttribute("dir")||un,renderHTML(t){return!t.textDirection||t.textDirection===un?{}:{"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",Ne(this.options.HTMLAttributes,t,{class:"footer mly:block mly:text-[13px] mly:text-slate-500 mly:relative"}),0]}}),KF=a9.extend({addAttributes(){var t;return oe(U({},(t=this.parent)==null?void 0:t.call(this)),{isUrlVariable:{default:!1}})},addCommands(){var t;return oe(U({},(t=this.parent)==null?void 0:t.call(this)),{setIsUrlVariable:e=>({chain:n})=>n().setMark("link",{isUrlVariable:e}).run()})}}),GF=tp.extend({addAttributes(){var t;return oe(U({},((t=this==null?void 0:this.parent)==null?void 0:t.call(this))||{}),{textDirection:{default:un,parseHTML:e=>e.getAttribute("data-text-direction")||e.getAttribute("dir")||un,renderHTML(e){return!e.textDirection||e.textDirection===un?{}:{"data-text-direction":e.textDirection,dir:e.textDirection}}},showIfKey:{default:Qe,parseHTML:e=>e.getAttribute("data-show-if-key")||Qe,renderHTML(e){return e.showIfKey?{"data-show-if-key":e.showIfKey}:{}}}})}});function qF(t){const{editor:e,getPos:n}=t;return p.jsxs(mi,{"data-type":"repeat",draggable:e.isEditable,"data-drag-handle":e.isEditable,className:"mly:relative",children:[p.jsx(fv,{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(yx,{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 XE=qe.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:Qe,parseHTML:t=>t.getAttribute("data-show-if-key")||Qe,renderHTML(t){return t.showIfKey?{"data-show-if-key":t.showIfKey}:{}}}}},parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML({HTMLAttributes:t}){return["div",Ne(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 gi(qF,{contentDOMElementTag:"div",className:"mly:relative"})}}),YF=Ve.create({name:"maily-kit",addOptions(){return{link:{HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:"mly:no-underline"},openOnClick:!1}}},addExtensions(){const t=[K1.extend({content:"(block|columns)+"}),I$.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}),L$,UF.configure({types:[my.name,Q1.name]}),my.configure(),D$.configure({types:[np.name,tp.name,Xy.name]}),VE,Xy,P$,G1.configure({color:"#555",width:3,class:"ProseMirror-dropcursor"}),GF.configure({levels:[1,2,3],HTMLAttributes:{class:"mly:relative"}}),WF.configure({HTMLAttributes:{class:"mly:relative"}})];return this.options.linkCard!==!1&&t.push(qE.configure(this.options.linkCard)),this.options.repeat!==!1&&t.push(XE),this.options.section!==!1&&t.push(IE),this.options.columns!==!1&&t.push(UE),this.options.column!==!1&&t.push(dE),this.options.button!==!1&&t.push(YE),this.options.spacer!==!1&&t.push(KE),this.options.logo!==!1&&t.push(BE),this.options.image!==!1&&t.push(JE),this.options.link!==!1&&t.push(KF.configure(this.options.link)),t}}),JF=l9.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}),XF=Ve.create({name:"slash-command",addOptions(){return{suggestion:{char:"/",command:({editor:t,range:e,props:n})=>{n.command({editor:t,range:e})}}}},addProseMirrorPlugins(){return[Jw(U({editor:this.editor},this.options.suggestion))]}});function ZF(t){var e;const{item:n,groupIndex:r,commandIndex:i,selectedGroupIndex:o,selectedCommandIndex:s,editor:a,activeCommandRef:l,selectItem:c,hoveredItemKey:u,onHover:d}=t,[f,h]=x.useState(!1),m=r===o&&i===s,g=`${r}-${i}`,y=u===g,b=n&&"commands"in n,w=!!(n!=null&&n.preview)&&(y||m&&!u),v=typeof n.render=="function"?(e=n.render)==null?void 0:e.call(n,a):null;let k=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(HR,{className:"mly:size-3.5 mly:stroke-[2.5]"})})]});v!==null&&v!==!0&&(k=v);const C=x.useRef(0),S=x.useCallback(()=>{window.clearTimeout(C.current);const N=200;C.current=window.setTimeout(()=>{h(!0),C.current=0},N)},[h]);return x.useEffect(()=>{w?S():(window.clearTimeout(C.current),C.current=0,h(!1))},[w]),x.useEffect(()=>()=>{C.current&&(window.clearTimeout(C.current),C.current=0)},[]),p.jsxs(Nt,{open:f,children:[p.jsx(Tt,{asChild:!0,children:p.jsx("button",{className:ye("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:()=>d(!0),onMouseLeave:()=>d(!1),type:"button",ref:m?l:null,children:k})}),p.jsx(xt,{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==null?void 0: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==null?void 0:n.preview,alt:n==null?void 0: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 QF(t){const{groups:e,query:n,editor:r}=t,i=[...e];let o=n==null?void 0:n.toLowerCase();const s=o.match(/^([^.]+)\./);if(s){const[l,c]=s,u=eH(e,c);if(u){const d=o.slice(l.length),f=u.commands.filter(h=>!d||ol(h,d));return f.length?[oe(U({},u),{commands:f})]:[]}}return i.map(l=>oe(U({},l),{commands:l.commands.flatMap(c=>nH({item:c,search:o,editor:r}))})).filter(l=>l.commands.length>0)}function eH(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 vd(t,e){return t?t.toLowerCase().includes(e.toLowerCase()):!1}function ol(t,e){var n,r;return vd(t.title,e)||vd(t.description,e)||((r=(n=t.searchTerms)==null?void 0:n.some(i=>vd(i,e)))!=null?r:!1)}function tH(t){return"commands"in t&&Array.isArray(t.commands)&&!!t.id}function nH(t){var e,n,r,i;const{item:o,search:s,editor:a}=t;if(((e=o==null?void 0:o.render)==null?void 0:e.call(o,a))===null)return[];const c=s.length>0;if(tH(o)){const u=oe(U({},o),{command:h=>{const{editor:m,range:g}=h;m.chain().focus().insertContentAt(g,`/${o.id}.`).run()}});return ol(u,s)?[u]:((r=(n=u==null?void 0:u.commands)==null?void 0:n.some(h=>ol(h,s)))!=null?r:!1)?(i=u==null?void 0:u.commands)!=null?i:[]:[]}return!c||ol(o,s)?[o]:[]}var rH=x.forwardRef((t,e)=>{const{items:n,command:r,editor:i,range:o,query:s}=t,[a,l]=x.useState(0),[c,u]=x.useState(0),[d,f]=x.useState(null),h=x.useRef(""),m=x.useRef(0),g=x.useRef(0),y=x.useCallback((E,v)=>{const k=n[E].commands[v];k&&r(k)},[r]);x.useImperativeHandle(e,()=>({onKeyDown:({event:E})=>{var v,k,C,S;if(["ArrowUp","ArrowDown","Enter","ArrowLeft","ArrowRight"].includes(E.key)){let M=c,D=a;switch(E.key){case"ArrowLeft":E.preventDefault();const H=n==null?void 0:n[a];return H&&"id"in H?(i.chain().focus().insertContentAt(o,`/${h.current}`).run(),setTimeout(()=>{l(m.current),u(g.current)},0),!0):!1;case"ArrowRight":E.preventDefault();const z=(k=(v=n==null?void 0:n[a])==null?void 0:v.commands)==null?void 0:k[c];return z&&"commands"in z?(y(a,c),h.current=s,m.current=a,g.current=c,!0):!1;case"Enter":return n.length?(y(a,c),h.current=s,m.current=a,g.current=c,!0):!1;case"ArrowUp":return n.length?(M=c-1,D=a,M<0&&(D=a-1,M=((C=n[D])==null?void 0:C.commands.length)-1||0),D<0&&(D=n.length-1,M=((S=n[D])==null?void 0:S.commands.length)-1||0),l(D),u(M),!0):!1;case"ArrowDown":if(!n.length)return!1;const K=n[a].commands;return M=c+1,D=a,K.length-1<M&&(M=0,D=a+1),n.length-1<D&&(D=0),l(D),u(M),!0;default:return!1}}}}));const b=x.useRef(null),w=x.useRef(null);return x.useLayoutEffect(()=>{const E=b==null?void 0:b.current,v=w==null?void 0:w.current;if(!E||!v)return;const{offsetTop:k,offsetHeight:C}=v;E.style.transition="none",E.scrollTop=k-C},[a,c,b,w]),x.useEffect(()=>{l(0),u(0)},[n]),x.useEffect(()=>()=>{h.current="",m.current=0,g.current=0},[]),!n||n.length===0?null:p.jsx(Vt,{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((E,v)=>p.jsxs(x.Fragment,{children:[p.jsx("span",{className:ye("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:E.title}),p.jsx("div",{className:"mly:space-y-0.5 mly:p-1",children:E.commands.map((k,C)=>{const S=`${v}-${C}`;return p.jsx(ZF,{item:k,groupIndex:v,commandIndex:C,selectedGroupIndex:a,selectedCommandIndex:c,selectItem:()=>y(v,C),editor:i,activeCommandRef:w,hoveredItemKey:d,onHover:N=>f(N?S:null)},S)})})]},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 iH(t=pp){return{items:({query:e,editor:n})=>QF({query:e,editor:n,groups:t}),allow:({editor:e})=>!e.isActive("htmlCodeBlock"),render:()=>{let e,n=null;return{onStart:r=>{e=new lh(rH,{props:r,editor:r.editor}),n=Pr("body",{getReferenceClientRect:r.clientRect,appendTo:()=>document.body,content:e.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"top-start"})},onUpdate:r=>{var i;const o=n==null?void 0:n[0];!o||(i=o==null?void 0:o.state)!=null&&i.isDestroyed||(e==null||e.updateProps(r),o.setProps({getReferenceClientRect:r.clientRect}))},onKeyDown:r=>{var i,o;if(r.event.key==="Escape"){const s=n==null?void 0:n[0];return(i=s==null?void 0:s.state)!=null&&i.isDestroyed||s==null||s.destroy(),e==null||e.destroy(),!0}return(o=e==null?void 0:e.ref)==null?void 0:o.onKeyDown(r)},onExit:()=>{if(!n||!(n!=null&&n[0])||!e)return;const r=n==null?void 0:n[0];r.state.isDestroyed||r.destroy(),e==null||e.destroy()}}}}}var ZE=x.forwardRef((t,e)=>{var n;const{items:r=[],editor:i}=t,o=x.useRef(null),s=(n=vi(i))==null?void 0:n.variableSuggestionsPopover;return x.useImperativeHandle(e,()=>({onKeyDown:({event:a})=>{if(!o.current)return!1;const{moveUp:l,moveDown:c,select:u}=o.current||{};return a.key==="ArrowUp"?(a.preventDefault(),l(),!0):a.key==="ArrowDown"?(a.preventDefault(),c(),!0):a.key==="Enter"?(u(),!0):!1}})),p.jsx(s,{items:r,onSelectItem:a=>{var l,c;t.command({id:a.name,required:(l=a.required)!=null?l:!0,hideDefaultValue:(c=a==null?void 0:a.hideDefaultValue)!=null?c:!1,label:a==null?void 0:a.label})},ref:o})});ZE.displayName="VariableList";function oH(t=mp){return{char:t,items:({query:e,editor:n})=>{var r;const i=(r=CE(n))==null?void 0:r.variables;return na(i,{query:e,editor:n,from:"content-variable"})},render:()=>{let e,n=null;return{onStart:r=>{e=new lh(ZE,{props:r,editor:r.editor}),r.clientRect&&(n=Pr("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==null?void 0:n[0])==null||i.setProps({getReferenceClientRect:r.clientRect}))},onKeyDown(r){var i;return r.event.key==="Escape"?(n==null||n[0].hide(),!0):(i=e.ref)==null?void 0:i.onKeyDown(r)},onExit(){!n||!(n!=null&&n[0])||!e||(n==null||n[0].destroy(),e.destroy())}}}}}var QE=j5(U4);QE.register("html",g1);var ek=k3.extend({name:"htmlCodeBlock",content:"(text|variable)*",addAttributes(){var t;return oe(U({},(t=this.parent)==null?void 0:t.call(this)),{activeTab:"code",showIfKey:{default:Qe,parseHTML:e=>e.getAttribute("data-show-if-key")||Qe,renderHTML(e){return e.showIfKey?{"data-show-if-key":e.showIfKey}:{}}}})},addNodeView(){return gi(zF,{className:"mly:relative",attrs:({node:t})=>{var e;return{"data-active-tab":((e=t==null?void 0: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 oe(U({},(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 o=r.depth;for(let u=o;u>0;u--)if(r.node(u).type.name===this.name){o=u;break}const s=r.before(o)+1,a=r.after(o)-1,l=e.state.doc.resolve(s),c=e.state.doc.resolve(a);if(l&&c){const u=e.state.tr.setSelection(ue.between(l,c));return e.view.dispatch(u),!0}return!1}})}}).configure({lowlight:QE}),sH=(t,e)=>[VE.name,Vh.name,KE.name,JE.name,HE.name,qE.name,BE.name,YE.name,ek.name,zE.name].some(r=>t.isActive(r));function aH(t){return p.jsxs("svg",oe(U({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 lH(t){return p.jsxs("svg",oe(U({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 cH(t){const{direction:e,onDirectionChange:n}=t,r=VF.includes(e)?e:"ltr",i={ltr:{icon:aH,tooltip:"Left to Right",onClick:()=>{n("ltr")}},rtl:{icon:lH,tooltip:"Right to Left",onClick:()=>{n("rtl")}}},o=i[r];return p.jsxs(rn,{children:[p.jsxs(Nt,{children:[p.jsx(Tt,{asChild:!0,children:p.jsx(on,{className:ye("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(o.icon,{className:"mly:h-3 mly:w-3 mly:stroke-[2.5]"})})}),p.jsx(xt,{sideOffset:8,children:"Text Direction"})]}),p.jsx(Wt,{className:"mly:flex mly:w-max mly:gap-0.5 mly:rounded-lg mly:p-0.5!",side:"top",sideOffset:8,align:"center",onOpenAutoFocus:s=>{s.preventDefault()},onCloseAutoFocus:s=>{s.preventDefault()},children:Object.entries(i).map(([s,a])=>p.jsx(cn,{icon:a.icon,tooltip:a.tooltip,command:a.onClick,isActive:()=>s===r},s))})]})}var uH="#374151",dH=t=>In({editor:t,selector:n=>{var r,i,o,s,a,l,c,u,d,f,h,m;return{currentTextColor:n.editor.getAttributes("textStyle").color||uH,linkUrl:(r=n.editor)==null?void 0:r.getAttributes("link").href,textAlign:(i=n.editor)!=null&&i.isActive({textAlign:"left"})?"left":(o=n.editor)!=null&&o.isActive({textAlign:"center"})?"center":(s=n.editor)!=null&&s.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)||((u=n.editor.getAttributes("footer"))==null?void 0:u.textDirection)||un,isFooterActive:n.editor.isActive("footer"),footerTextDirection:((d=n.editor.getAttributes("footer"))==null?void 0:d.textDirection)||un,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:Br});function tk(t){var e,n,r,i;const{editor:o,showListMenu:s=!0}=t,a=dH(o),l=o==null?void 0:o.storage.color.colors,c=(r=(n=(e=Array==null?void 0:Array.from(l))==null?void 0:e.reverse())==null?void 0:n.slice(0,6))!=null?r:[],u=[{name:"bold",isActive:()=>o==null?void 0:o.isActive("bold"),command:()=>o==null?void 0:o.chain().focus().toggleBold().run(),icon:ix,tooltip:"Bold"},{name:"italic",isActive:()=>o==null?void 0:o.isActive("italic"),command:()=>o==null?void 0:o.chain().focus().toggleItalic().run(),icon:px,tooltip:"Italic"},{name:"underline",isActive:()=>o==null?void 0:o.isActive("underline"),command:()=>o==null?void 0:o.chain().focus().toggleUnderline().run(),icon:xx,tooltip:"Underline"},{name:"strike",isActive:()=>o==null?void 0:o.isActive("strike"),command:()=>o==null?void 0:o.chain().focus().toggleStrike().run(),icon:bx,tooltip:"Strikethrough"},{name:"code",isActive:()=>o==null?void 0:o.isActive("code"),command:()=>o==null?void 0:o.chain().focus().toggleCode().run(),icon:KR,tooltip:"Code"}];return p.jsxs(p.Fragment,{children:[u.map((d,f)=>p.jsx(cn,U({},d),f)),p.jsx(au,{alignment:a.textAlign,onAlignmentChange:d=>{o==null||o.chain().focus().setTextAlign(d).run()}}),p.jsx(cH,{direction:a.textDirection,onDirectionChange:d=>{a.isFooterActive?o==null||o.chain().focus().setFooterTextDirection(d).run():a.isHeadingActive?o==null||o.chain().focus().updateAttributes("heading",{textDirection:d}).run():o==null||o.chain().focus().setTextDirection(d).run()}}),!a.isListActive&&s&&p.jsxs(p.Fragment,{children:[p.jsx(cn,{icon:_h,command:()=>{o.chain().focus().toggleBulletList().run()},tooltip:"Bullet List"}),p.jsx(cn,{icon:Sh,command:()=>{o.chain().focus().toggleOrderedList().run()},tooltip:"Ordered List"})]}),p.jsx(bo,{defaultValue:(i=a==null?void 0:a.linkUrl)!=null?i:"",onValueChange:(d,f)=>{if(!d){o==null||o.chain().focus().extendMarkRange("link").unsetLink().unsetUnderline().run();return}o==null||o.chain().extendMarkRange("link").setLink({href:d}).setIsUrlVariable(f??!1).setUnderline().run()},tooltip:"External URL",editor:o,isVariable:a.isUrlVariable}),p.jsx(ze,{}),p.jsx(Us,{color:a.currentTextColor,onColorChange:d=>{o==null||o.chain().setColor(d).run()},tooltip:"Text Color",suggestedColors:c,children:p.jsx(Rt,{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 fH=t=>t.type==="option",hH=t=>t.type==="category";function pH(t){const{options:e}=t,n=x.useMemo(()=>e.find(i=>i.type==="option"&&i.isActive()),[e]),{icon:r=mx}=n||{};return p.jsxs(rn,{children:[p.jsxs(Nt,{children:[p.jsx(Tt,{asChild:!0,children:p.jsxs(on,{className:ye("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(ox,{className:"mly:h-3 mly:w-3 mly:shrink-0 mly:stroke-[2.5]"})]})}),p.jsx(xt,{sideOffset:8,children:"Turn into"})]}),p.jsx(Wt,{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,o)=>{if(fH(i))return p.jsxs(Rt,{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(hH(i))return p.jsx("label",{className:ye("mly:px-2 mly:text-xs mly:font-medium mly:text-midnight-gray/60",o===0?"mly:mb-2 mly:mt-1":"mly:my-2"),children:i.label},i.id)})})]})}function mH(t){return In({editor:t,selector:({editor:e})=>[{type:"category",label:"Hierarchy",id:"hierarchy"},{icon:mx,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:kh,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:ux,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:dx,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:Eh,onClick:()=>{e.chain().focus().liftListItem("listItem").setFooter().run()},disabled:()=>!e.can().setFooter(),isActive:()=>e.isActive("footer")},{type:"category",label:"Lists",id:"lists"},{icon:_h,onClick:()=>e.chain().focus().toggleBulletList().run(),id:"bulletList",disabled:()=>!e.can().toggleBulletList(),isActive:()=>e.isActive("bulletList"),label:"Bullet list",type:"option"},{icon:Sh,onClick:()=>e.chain().focus().toggleOrderedList().run(),id:"orderedList",disabled:()=>!e.can().toggleOrderedList(),isActive:()=>e.isActive("orderedList"),label:"Numbered list",type:"option"}]})}function gH(t){const{editor:e,appendTo:n}=t;if(!e)return null;const r=oe(U(U({},t),n?{appendTo:n.current}:{}),{pluginKey:"text-menu",shouldShow:({editor:o,from:s,view:a})=>{var l;if(!a||o.view.dragging)return!1;const c=a.domAtPos(s||0).node,d=a.nodeDOM(s||0)||c;if(sH(o)||!o.isEditable)return!1;const h=[XE.name,IE.name,UE.name,dE.name].some(m=>o.isActive(m))&&((l=d==null?void 0:d.classList)==null?void 0:l.contains("ProseMirror-selectednode"));return su(o)&&!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=mH(e);return p.jsx(nr,oe(U({},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(Vt,{children:[p.jsx(pH,{options:i}),p.jsx(ze,{className:"mly:mx-0"}),p.jsx(tk,{editor:e})]})}))}function yH(t){const{editor:e,appendTo:n}=t;if(!e)return null;const r=oe(U({},t),{pluginKey:"variable-menu",shouldShow:({editor:i})=>{var o;return i.isActive("variable")&&!((o=i.storage.variable)!=null&&o.popover)},tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},plugins:[pi],sticky:"popper",maxWidth:"100%",appendTo:()=>(n==null?void 0:n.current)||"parent",placement:"top-start"}});return p.jsx(nr,oe(U({},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(Vt,{children:p.jsx(tk,{showListMenu:!1,editor:e})})}))}var bH=Ve.create({name:"selection",addProseMirrorPlugins(){const{editor:t}=this;return[new $e({key:new Pe("selection"),props:{decorations(e){return e.selection.empty||t.isFocused===!0?null:He.create(e.doc,[pt.inline(e.selection.from,e.selection.to,{class:"selection mly:bg-blue-200 mly:inline mly:py-1"})])}}})]}});function vH(t){const{blocks:e,extensions:n=[]}=t;return[...[YF,XF.configure({suggestion:iH(e)}),HE.configure({suggestion:oH()}),ek,zE,JF,bH].filter(i=>!n.some(o=>o.name===i.name)),...n]}function Zy(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 o=(e=i.attrs)==null?void 0:e.height;typeof o=="string"&&["sm","md","lg","xl"].includes(o)&&(o=((n=zs.find(s=>s.short===o))==null?void 0:n.value)||WE),i.attrs=oe(U({},i.attrs),{height:o})}i.content&&r.push(...i.content)}}return t}function xH(t){const{config:{wrapClassName:e="",contentClassName:n="",bodyClassName:r="",hasMenuBar:i=!0,hideContextMenu:o=!1,spellCheck:s=!1,autofocus:a="end",immediatelyRender:l=!1}={},onCreate:c,onUpdate:u,extensions:d,contentHtml:f,contentJson:h,blocks:m=pp,editable:g=!0,placeholderUrl:y=lu,scrollThreshold:b=40,scrollMargin:w=40}=t,E=x.useMemo(()=>{if(h){const C=(h==null?void 0:h.type)==="doc"?h:{type:"doc",content:h};return Zy(C)}else return f||{type:"doc",content:[{type:"paragraph",content:[]}]}},[f,h,Zy]),v=x.useRef(null),k=tM({editorProps:{scrollThreshold:b,scrollMargin:w,attributes:{class:ye("mly:prose mly:w-full",n),spellCheck:s?"true":"false"}},immediatelyRender:l,onCreate:({editor:C})=>{c==null||c(C)},onUpdate:({editor:C})=>{u==null||u(C)},extensions:vH({extensions:d,blocks:m}),content:E,autofocus:a,editable:g});return k?p.jsx(lF,{placeholderUrl:y,children:p.jsxs("div",{id:"mly-editor",className:ye("mly-editor mly:antialiased",k.isEditable?"mly-editable":"mly-not-editable",e),ref:v,children:[i&&p.jsx(uj,{config:t.config,editor:k}),p.jsxs("div",{className:ye("mly:mt-4 mly:rounded mly:border mly:border-gray-200 mly:bg-white mly:p-4",r),children:[p.jsx(gH,{editor:k,appendTo:v}),p.jsx(gF,{editor:k,appendTo:v}),p.jsx(NF,{editor:k,appendTo:v}),p.jsx(KA,{editor:k}),p.jsx(SF,{editor:k,appendTo:v}),p.jsx(nj,{editor:k,appendTo:v}),!o&&p.jsx(cj,{editor:k}),p.jsx(yH,{editor:k,appendTo:v}),p.jsx(xF,{editor:k,appendTo:v}),p.jsx(fj,{editor:k,appendTo:v}),p.jsx(bF,{editor:k,appendTo:v})]})]})}):null}const wH={type:"doc",content:[{type:"paragraph"}]};function RH({slug:t}){const{data:e,loading:n,error:r,refetch:i}=ok(()=>xd.template(t));return p.jsx(sk,{loading:n&&!e,error:r,empty:!e,emptyLabel:"Template not found.",retry:i,children:e&&p.jsx(EH,{tpl:e,slug:t,refetch:i})})}function EH({tpl:t,slug:e,refetch:n}){var M,D,H,$,z;const[r,i]=fe.useState("design"),[o,s]=fe.useState(wH),[a,l]=fe.useState(((M=t.draft)==null?void 0:M.subject)??t.subject??""),[c,u]=fe.useState(((D=t.draft)==null?void 0:D.preheader)??t.preheader??""),[d,f]=fe.useState(!1),[h,m]=fe.useState(""),[g,y]=fe.useState(!1),b=fe.useRef(null),w=fe.useRef(!1),E=t.kind??"marketing",v=t.name??e,k=t.slug??e,C=((H=t.body)==null?void 0:H.mjml)??(($=t.draft)==null?void 0:$.mjml)??"",S=((z=t.body)==null?void 0:z.plainText)??"";fe.useEffect(()=>{var K,A;if(w.current)return;w.current=!0;const L=((K=t.draft)==null?void 0:K.editorJson)??((A=t.body)==null?void 0:A.editorJson);L&&s(L)},[t]);async function N(){y(!0),m("Saving draft…");try{await xd.updateTemplateDraft(e,{subject:a,preheader:c,editorJson:o}),m("Publishing…");const L=await xd.publishTemplate(e);m(`Published v${L.version}`),f(!1),n()}catch(L){m(`Error: ${(L==null?void 0:L.message)??String(L)}`)}finally{y(!1)}}return p.jsxs(p.Fragment,{children:[p.jsx(ak,{title:v,desc:p.jsxs(p.Fragment,{children:[p.jsxs("span",{className:"mono",children:["templates/",k]})," · ",p.jsx("span",{className:"pill "+(E==="transactional"?"blue":"neutral"),style:{marginLeft:4},children:E})]}),actions:p.jsxs(p.Fragment,{children:[p.jsxs("button",{className:"btn",children:[p.jsx(Ro.Eye,{size:14}),"Preview"]}),p.jsxs("button",{className:"btn",children:[p.jsx(Ro.Send,{size:14}),"Test send"]}),p.jsxs("button",{className:"btn",children:[p.jsx(Ro.Copy,{size:14}),"Duplicate"]}),p.jsxs("button",{className:"btn btn-primary",disabled:g,onClick:N,children:[p.jsx(Ro.Rocket,{size:14}),"Publish"]}),h&&p.jsx("span",{className:"text-xs subtle",style:{marginLeft:8},children:h})]})}),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:d?"Unsaved changes":"Saved"})})]}),p.jsxs("div",{style:{padding:16},children:[p.jsxs("div",{className:"field",children:[p.jsx("label",{className:"field-label",children:"Subject"}),p.jsx("input",{className:"input",value:a,onChange:L=>{l(L.target.value),f(!0)}})]}),p.jsxs("div",{className:"field",children:[p.jsx("label",{className:"field-label",children:"Preheader"}),p.jsx("input",{className:"input",value:c,onChange:L=>{u(L.target.value),f(!0)}})]})]}),r==="design"&&p.jsx("div",{className:"maily-host",style:{padding:16,background:"var(--bg-sunken)",minHeight:480},children:p.jsx(xH,{contentJson:o,onCreate:L=>{b.current=L},onUpdate:L=>{b.current=L,s(L.getJSON()),f(!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:C||"/* 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:S||"/* Plain text is auto-derived on publish. */"})]}),p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[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",defaultValue:t.fromName??"",placeholder:"(default from mailer config)"})]}),p.jsxs("div",{className:"field",children:[p.jsx("label",{className:"field-label",children:"From email"}),p.jsx("input",{className:"input",defaultValue:t.fromEmail??"",placeholder:"(default from mailer config)"})]}),p.jsxs("div",{className:"field",style:{marginBottom:0},children:[p.jsx("label",{className:"field-label",children:"Reply-to"}),p.jsx("input",{className:"input",defaultValue:t.replyTo??"",placeholder:"(same as From)"})]})]})]}),Array.isArray(t.requiredVariables)&&t.requiredVariables.length>0&&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:"Used in subject/body"})]}),p.jsx("div",{className:"card-body",children:t.requiredVariables.map(L=>p.jsxs("div",{className:"hstack",style:{padding:"6px 0",borderBottom:"1px solid var(--border)"},children:[p.jsx("span",{className:"mono text-sm",children:L.name??L}),p.jsx("span",{className:"grow"}),L.type&&p.jsx("span",{className:"tag",children:L.type}),L.required!=null&&p.jsx("span",{className:"text-xs subtle",children:L.required?"required":"optional"})]},L.name??L))})]}),Array.isArray(t.lintWarnings)&&t.lintWarnings.length>0&&p.jsxs("div",{className:"card",children:[p.jsx("div",{className:"card-head",children:p.jsx("span",{className:"card-title",children:"Lint warnings"})}),p.jsx("div",{className:"card-body",style:{display:"grid",gap:8},children:t.lintWarnings.map((L,K)=>p.jsxs("div",{className:"hstack",children:[p.jsx(Ro.Warn,{size:14,style:{color:"var(--amber-fg)"}}),p.jsx("span",{className:"text-sm",children:L.message??String(L)})]},K))})]})]})]})]})}export{RH as TemplateEditor};
502
- //# sourceMappingURL=template-editor-dMzrGcva.js.map