@yiitap/vue 1.2.4 → 1.3.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.
Files changed (43) hide show
  1. package/dist/index.cjs +83 -46
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +83 -46
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +14992 -13347
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/vue.css +1 -1
  8. package/package.json +24 -18
  9. package/types/components/YiiEditor.vue.d.ts +19 -0
  10. package/types/components/buttons/OAiBtn.vue.d.ts +20 -0
  11. package/types/components/common/OBlockList.vue.d.ts +26 -0
  12. package/types/components/common/OBlockListItem.vue.d.ts +16 -0
  13. package/types/components/common/OBlockPopover.vue.d.ts +18 -0
  14. package/types/components/common/OCommonBtn.vue.d.ts +20 -2
  15. package/types/components/common/OMenubarBtn.vue.d.ts +99 -1
  16. package/types/components/common/OToast.d.ts +11 -0
  17. package/types/components/index.d.ts +5 -0
  18. package/types/components/menus/OAiMenu.vue.d.ts +27 -0
  19. package/types/components/menus/OBubbleMenu.vue.d.ts +1 -1
  20. package/types/components/menus/OFloatingMenu.vue.d.ts +1 -1
  21. package/types/components/ui/OBtn.vue.d.ts +36 -0
  22. package/types/components/ui/OBtnGroup.vue.d.ts +100 -0
  23. package/types/components/ui/OInput.vue.d.ts +23 -1
  24. package/types/constants/ai.d.ts +6 -0
  25. package/types/constants/block.d.ts +2 -0
  26. package/types/constants/data.d.ts +4 -0
  27. package/types/constants/index.d.ts +2 -0
  28. package/types/extensions/ai-block/index.d.ts +3 -0
  29. package/types/extensions/ai-block/view.vue.d.ts +92 -0
  30. package/types/extensions/char-command/emoji/suggestion.d.ts +5 -9
  31. package/types/extensions/char-command/slash/suggestion.d.ts +5 -9
  32. package/types/extensions/dynamic.d.ts +1 -1
  33. package/types/extensions/index.d.ts +49 -23
  34. package/types/hooks/index.d.ts +2 -0
  35. package/types/hooks/useAi.d.ts +6 -0
  36. package/types/hooks/useI18n.d.ts +1 -0
  37. package/types/hooks/useNodeView.d.ts +6 -0
  38. package/types/i18n/messages/en.d.ts +44 -0
  39. package/types/i18n/messages/zh-hans.d.ts +42 -0
  40. package/types/i18n/messages/zh-hant.d.ts +1 -0
  41. package/types/index.d.ts +0 -1
  42. package/types/utils/convert.d.ts +1 -0
  43. package/types/constants/demo-article.d.ts +0 -7
package/dist/index.cjs CHANGED
@@ -1,19 +1,19 @@
1
- "use strict";var gb=Object.defineProperty;var bb=(t,e,n)=>e in t?gb(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Xe=(t,e,n)=>bb(t,typeof e!="symbol"?e+"":e,n);/**
1
+ "use strict";var $b=Object.defineProperty;var Fb=(t,e,n)=>e in t?$b(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Je=(t,e,n)=>Fb(t,typeof e!="symbol"?e+"":e,n);/**
2
2
  * Copyright 2025 Yiitap
3
3
  * @license MIT
4
- **/Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("vue"),Yr=require("@yiitap/util-emoji");function gt(t){this.content=t}gt.prototype={constructor:gt,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 o=n&&n!=t?this.remove(n):this,r=o.find(t),i=o.content.slice();return r==-1?i.push(n||t,e):(i[r+1]=e,n&&(i[r]=n)),new gt(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new gt(n)},addToStart:function(t,e){return new gt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new gt(n)},addBefore:function(t,e,n){var o=this.remove(e),r=o.content.slice(),i=o.find(t);return r.splice(i==-1?r.length:i,0,e,n),new gt(r)},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=gt.from(t),t.size?new gt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=gt.from(t),t.size?new gt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=gt.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}};gt.from=function(t){if(t instanceof gt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new gt(e)};function zp(t,e,n){for(let o=0;;o++){if(o==t.childCount||o==e.childCount)return t.childCount==e.childCount?null:n;let r=t.child(o),i=e.child(o);if(r==i){n+=r.nodeSize;continue}if(!r.sameMarkup(i))return n;if(r.isText&&r.text!=i.text){for(let s=0;r.text[s]==i.text[s];s++)n++;return n}if(r.content.size||i.content.size){let s=zp(r.content,i.content,n+1);if(s!=null)return s}n+=r.nodeSize}}function Hp(t,e,n,o){for(let r=t.childCount,i=e.childCount;;){if(r==0||i==0)return r==i?null:{a:n,b:o};let s=t.child(--r),a=e.child(--i),c=s.nodeSize;if(s==a){n-=c,o-=c;continue}if(!s.sameMarkup(a))return{a:n,b:o};if(s.isText&&s.text!=a.text){let d=0,u=Math.min(s.text.length,a.text.length);for(;d<u&&s.text[s.text.length-d-1]==a.text[a.text.length-d-1];)d++,n--,o--;return{a:n,b:o}}if(s.content.size||a.content.size){let d=Hp(s.content,a.content,n-1,o-1);if(d)return d}n-=c,o-=c}}class T{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let o=0;o<e.length;o++)this.size+=e[o].nodeSize}nodesBetween(e,n,o,r=0,i){for(let s=0,a=0;a<n;s++){let c=this.content[s],d=a+c.nodeSize;if(d>e&&o(c,r+a,i||null,s)!==!1&&c.content.size){let u=a+1;c.nodesBetween(Math.max(0,e-u),Math.min(c.content.size,n-u),o,r+u)}a=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,o,r){let i="",s=!0;return this.nodesBetween(e,n,(a,c)=>{let d=a.isText?a.text.slice(Math.max(e,c)-c,n-c):a.isLeaf?r?typeof r=="function"?r(a):r:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&d||a.isTextblock)&&o&&(s?s=!1:i+=o),i+=d},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,o=e.firstChild,r=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(o)&&(r[r.length-1]=n.withText(n.text+o.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new T(r,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let o=[],r=0;if(n>e)for(let i=0,s=0;s<n;i++){let a=this.content[i],c=s+a.nodeSize;c>e&&((s<e||c>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))),o.push(a),r+=a.nodeSize),s=c}return new T(o,r)}cutByIndex(e,n){return e==n?T.empty:e==0&&n==this.content.length?this:new T(this.content.slice(e,n))}replaceChild(e,n){let o=this.content[e];if(o==n)return this;let r=this.content.slice(),i=this.size+n.nodeSize-o.nodeSize;return r[e]=n,new T(r,i)}addToStart(e){return new T([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new T(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,o=0;n<this.content.length;n++){let r=this.content[n];e(r,o,n),o+=r.nodeSize}}findDiffStart(e,n=0){return zp(this,e,n)}findDiffEnd(e,n=this.size,o=e.size){return Hp(this,e,n,o)}findIndex(e,n=-1){if(e==0)return Ni(0,e);if(e==this.size)return Ni(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let o=0,r=0;;o++){let i=this.child(o),s=r+i.nodeSize;if(s>=e)return s==e||n>0?Ni(o+1,s):Ni(o,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return T.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new T(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return T.empty;let n,o=0;for(let r=0;r<e.length;r++){let i=e[r];o+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(n||(n=e.slice(0,r)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new T(n||e,o)}static from(e){if(!e)return T.empty;if(e instanceof T)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new T([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}T.empty=new T([],0);const Ra={index:0,offset:0};function Ni(t,e){return Ra.index=t,Ra.offset=e,Ra}function ls(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 o=0;o<t.length;o++)if(!ls(t[o],e[o]))return!1}else{for(let o in t)if(!(o in e)||!ls(t[o],e[o]))return!1;for(let o in e)if(!(o in t))return!1}return!0}let $e=class ml{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,o=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!o&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,r)),n.push(this),o=!0),n&&n.push(i)}}return n||(n=e.slice()),o||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&&ls(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 o=e.marks[n.type];if(!o)throw new RangeError(`There is no mark type ${n.type} in this schema`);let r=o.create(n.attrs);return o.checkAttrs(r.attrs),r}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let o=0;o<e.length;o++)if(!e[o].eq(n[o]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return ml.none;if(e instanceof ml)return[e];let n=e.slice();return n.sort((o,r)=>o.type.rank-r.type.rank),n}};$e.none=[];class cs extends Error{}class ${constructor(e,n,o){this.content=e,this.openStart=n,this.openEnd=o}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let o=qp(this.content,e+this.openStart,n);return o&&new $(o,this.openStart,this.openEnd)}removeBetween(e,n){return new $(Up(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 $.empty;let o=n.openStart||0,r=n.openEnd||0;if(typeof o!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new $(T.fromJSON(e,n.content),o,r)}static maxOpen(e,n=!0){let o=0,r=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)o++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)r++;return new $(e,o,r)}}$.empty=new $(T.empty,0,0);function Up(t,e,n){let{index:o,offset:r}=t.findIndex(e),i=t.maybeChild(o),{index:s,offset:a}=t.findIndex(n);if(r==e||i.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(o!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(o,i.copy(Up(i.content,e-r-1,n-r-1)))}function qp(t,e,n,o){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r);if(i==e||s.isText)return t.cut(0,e).append(n).append(t.cut(e));let a=qp(s.content,e-i-1,n);return a&&t.replaceChild(r,s.copy(a))}function yb(t,e,n){if(n.openStart>t.depth)throw new cs("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new cs("Inconsistent open depths");return Wp(t,e,n,0)}function Wp(t,e,n,o){let r=t.index(o),i=t.node(o);if(r==e.index(o)&&o<t.depth-n.openStart){let s=Wp(t,e,n,o+1);return i.copy(i.content.replaceChild(r,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==o&&e.depth==o){let s=t.parent,a=s.content;return Ao(s,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:s,end:a}=vb(n,t);return Ao(i,jp(t,s,a,e,o))}else return Ao(i,ds(t,e,o))}function Kp(t,e){if(!e.type.compatibleContent(t.type))throw new cs("Cannot join "+e.type.name+" onto "+t.type.name)}function gl(t,e,n){let o=t.node(n);return Kp(o,e.node(n)),o}function Mo(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 Lr(t,e,n,o){let r=(e||t).node(n),i=0,s=e?e.index(n):r.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(Mo(t.nodeAfter,o),i++));for(let a=i;a<s;a++)Mo(r.child(a),o);e&&e.depth==n&&e.textOffset&&Mo(e.nodeBefore,o)}function Ao(t,e){return t.type.checkContent(e),t.copy(e)}function jp(t,e,n,o,r){let i=t.depth>r&&gl(t,e,r+1),s=o.depth>r&&gl(n,o,r+1),a=[];return Lr(null,t,r,a),i&&s&&e.index(r)==n.index(r)?(Kp(i,s),Mo(Ao(i,jp(t,e,n,o,r+1)),a)):(i&&Mo(Ao(i,ds(t,e,r+1)),a),Lr(e,n,r,a),s&&Mo(Ao(s,ds(n,o,r+1)),a)),Lr(o,null,r,a),new T(a)}function ds(t,e,n){let o=[];if(Lr(null,t,n,o),t.depth>n){let r=gl(t,e,n+1);Mo(Ao(r,ds(t,e,n+1)),o)}return Lr(e,null,n,o),new T(o)}function vb(t,e){let n=e.depth-t.openStart,r=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)r=e.node(i).copy(T.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}class Jr{constructor(e,n,o){this.pos=e,this.path=n,this.parentOffset=o,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 o=this.pos-this.path[this.path.length-1],r=e.child(n);return o?e.child(n).cut(o):r}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 o=this.path[n*3],r=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)r+=o.child(i).nodeSize;return r}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return $e.none;if(this.textOffset)return e.child(n).marks;let o=e.maybeChild(n-1),r=e.maybeChild(n);if(!o){let a=o;o=r,r=a}let i=o.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!r||!i[s].isInSet(r.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let o=n.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!r||!o[i].isInSet(r.marks))&&(o=o[i--].removeFromSet(o));return o}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 o=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);o>=0;o--)if(e.pos<=this.end(o)&&(!n||n(this.node(o))))return new us(this,e,o);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 o=[],r=0,i=n;for(let s=e;;){let{index:a,offset:c}=s.content.findIndex(i),d=i-c;if(o.push(s,a,r+c),!d||(s=s.child(a),s.isText))break;i=d-1,r+=c+1}return new Jr(n,o,i)}static resolveCached(e,n){let o=vd.get(e);if(o)for(let i=0;i<o.elts.length;i++){let s=o.elts[i];if(s.pos==n)return s}else vd.set(e,o=new kb);let r=o.elts[o.i]=Jr.resolve(e,n);return o.i=(o.i+1)%Eb,r}}class kb{constructor(){this.elts=[],this.i=0}}const Eb=12,vd=new WeakMap;class us{constructor(e,n,o){this.$from=e,this.$to=n,this.depth=o}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 wb=Object.create(null);let po=class bl{constructor(e,n,o,r=$e.none){this.type=e,this.attrs=n,this.marks=r,this.content=o||T.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,o,r=0){this.content.nodesBetween(e,n,o,r,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,o,r){return this.content.textBetween(e,n,o,r)}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,o){return this.type==e&&ls(this.attrs,n||e.defaultAttrs||wb)&&$e.sameSet(this.marks,o||$e.none)}copy(e=null){return e==this.content?this:new bl(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new bl(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,o=!1){if(e==n)return $.empty;let r=this.resolve(e),i=this.resolve(n),s=o?0:r.sharedDepth(n),a=r.start(s),d=r.node(s).content.cut(r.pos-a,i.pos-a);return new $(d,r.depth-s,i.depth-s)}replace(e,n,o){return yb(this.resolve(e),this.resolve(n),o)}nodeAt(e){for(let n=this;;){let{index:o,offset:r}=n.content.findIndex(e);if(n=n.maybeChild(o),!n)return null;if(r==e||n.isText)return n;e-=r+1}}childAfter(e){let{index:n,offset:o}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:o}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:o}=this.content.findIndex(e);if(o<e)return{node:this.content.child(n),index:n,offset:o};let r=this.content.child(n-1);return{node:r,index:n-1,offset:o-r.nodeSize}}resolve(e){return Jr.resolveCached(this,e)}resolveNoCache(e){return Jr.resolve(this,e)}rangeHasMark(e,n,o){let r=!1;return n>e&&this.nodesBetween(e,n,i=>(o.isInSet(i.marks)&&(r=!0),!r)),r}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()+")"),Gp(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,o=T.empty,r=0,i=o.childCount){let s=this.contentMatchAt(e).matchFragment(o,r,i),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let c=r;c<i;c++)if(!this.type.allowsMarks(o.child(c).marks))return!1;return!0}canReplaceWith(e,n,o,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(o),s=i&&i.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=$e.none;for(let n=0;n<this.marks.length;n++){let o=this.marks[n];o.type.checkAttrs(o.attrs),e=o.addToSet(e)}if(!$e.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 o;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");o=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,o)}let r=T.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,r,o);return i.type.checkAttrs(i.attrs),i}};po.prototype.text=void 0;class ps extends po{constructor(e,n,o,r){if(super(e,n,null,r),!o)throw new RangeError("Empty text nodes are not allowed");this.text=o}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Gp(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 ps(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ps(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 Gp(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class $o{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let o=new Cb(e,n);if(o.next==null)return $o.empty;let r=Yp(o);o.next&&o.err("Unexpected trailing text");let i=Mb(Ob(r));return Ab(i,o),i}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,o=e.childCount){let r=this;for(let i=n;r&&i<o;i++)r=r.matchType(e.child(i).type);return r}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 o=0;o<e.next.length;o++)if(this.next[n].type==e.next[o].type)return!0;return!1}fillBefore(e,n=!1,o=0){let r=[this];function i(s,a){let c=s.matchFragment(e,o);if(c&&(!n||c.validEnd))return T.from(a.map(d=>d.createAndFill()));for(let d=0;d<s.next.length;d++){let{type:u,next:p}=s.next[d];if(!(u.isText||u.hasRequiredAttrs())&&r.indexOf(p)==-1){r.push(p);let f=i(p,a.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let o=0;o<this.wrapCache.length;o+=2)if(this.wrapCache[o]==e)return this.wrapCache[o+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),o=[{match:this,type:null,via:null}];for(;o.length;){let r=o.shift(),i=r.match;if(i.matchType(e)){let s=[];for(let a=r;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:a,next:c}=i.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!r.type||c.validEnd)&&(o.push({match:a.contentMatch,type:a,via:r}),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(o){e.push(o);for(let r=0;r<o.next.length;r++)e.indexOf(o.next[r].next)==-1&&n(o.next[r].next)}return n(this),e.map((o,r)=>{let i=r+(o.validEnd?"*":" ")+" ";for(let s=0;s<o.next.length;s++)i+=(s?", ":"")+o.next[s].type.name+"->"+e.indexOf(o.next[s].next);return i}).join(`
5
- `)}}$o.empty=new $o(!0);class Cb{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 Yp(t){let e=[];do e.push(_b(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function _b(t){let e=[];do e.push(Sb(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Sb(t){let e=Tb(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=xb(t,e);else break;return e}function kd(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function xb(t,e){let n=kd(t),o=n;return t.eat(",")&&(t.next!="}"?o=kd(t):o=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:o,expr:e}}function Nb(t,e){let n=t.nodeTypes,o=n[e];if(o)return[o];let r=[];for(let i in n){let s=n[i];s.isInGroup(e)&&r.push(s)}return r.length==0&&t.err("No node type or group '"+e+"' found"),r}function Tb(t){if(t.eat("(")){let e=Yp(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=Nb(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 Ob(t){let e=[[]];return r(i(t,0),n()),e;function n(){return e.push([])-1}function o(s,a,c){let d={term:c,to:a};return e[s].push(d),d}function r(s,a){s.forEach(c=>c.to=a)}function i(s,a){if(s.type=="choice")return s.exprs.reduce((c,d)=>c.concat(i(d,a)),[]);if(s.type=="seq")for(let c=0;;c++){let d=i(s.exprs[c],a);if(c==s.exprs.length-1)return d;r(d,a=n())}else if(s.type=="star"){let c=n();return o(a,c),r(i(s.expr,c),c),[o(c)]}else if(s.type=="plus"){let c=n();return r(i(s.expr,a),c),r(i(s.expr,c),c),[o(c)]}else{if(s.type=="opt")return[o(a)].concat(i(s.expr,a));if(s.type=="range"){let c=a;for(let d=0;d<s.min;d++){let u=n();r(i(s.expr,c),u),c=u}if(s.max==-1)r(i(s.expr,c),c);else for(let d=s.min;d<s.max;d++){let u=n();o(c,u),r(i(s.expr,c),u),c=u}return[o(c)]}else{if(s.type=="name")return[o(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Jp(t,e){return e-t}function Ed(t,e){let n=[];return o(e),n.sort(Jp);function o(r){let i=t[r];if(i.length==1&&!i[0].term)return o(i[0].to);n.push(r);for(let s=0;s<i.length;s++){let{term:a,to:c}=i[s];!a&&n.indexOf(c)==-1&&o(c)}}}function Mb(t){let e=Object.create(null);return n(Ed(t,0));function n(o){let r=[];o.forEach(s=>{t[s].forEach(({term:a,to:c})=>{if(!a)return;let d;for(let u=0;u<r.length;u++)r[u][0]==a&&(d=r[u][1]);Ed(t,c).forEach(u=>{d||r.push([a,d=[]]),d.indexOf(u)==-1&&d.push(u)})})});let i=e[o.join(",")]=new $o(o.indexOf(t.length-1)>-1);for(let s=0;s<r.length;s++){let a=r[s][1].sort(Jp);i.next.push({type:r[s][0],next:e[a.join(",")]||n(a)})}return i}}function Ab(t,e){for(let n=0,o=[t];n<o.length;n++){let r=o[n],i=!r.validEnd,s=[];for(let a=0;a<r.next.length;a++){let{type:c,next:d}=r.next[a];s.push(c.name),i&&!(c.isText||c.hasRequiredAttrs())&&(i=!1),o.indexOf(d)==-1&&o.push(d)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Xp(t){let e=Object.create(null);for(let n in t){let o=t[n];if(!o.hasDefault)return null;e[n]=o.default}return e}function Zp(t,e){let n=Object.create(null);for(let o in t){let r=e&&e[o];if(r===void 0){let i=t[o];if(i.hasDefault)r=i.default;else throw new RangeError("No value supplied for attribute "+o)}n[o]=r}return n}function Qp(t,e,n,o){for(let r in e)if(!(r in t))throw new RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let r in t){let i=t[r];i.validate&&i.validate(e[r])}}function ef(t,e){let n=Object.create(null);if(e)for(let o in e)n[o]=new Db(t,o,e[o]);return n}let wd=class tf{constructor(e,n,o){this.name=e,this.schema=n,this.spec=o,this.markSet=null,this.groups=o.group?o.group.split(" "):[],this.attrs=ef(e,o.attrs),this.defaultAttrs=Xp(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(o.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==$o.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:Zp(this.attrs,e)}create(e=null,n,o){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new po(this,this.computeAttrs(e),T.from(n),$e.setFrom(o))}createChecked(e=null,n,o){return n=T.from(n),this.checkContent(n),new po(this,this.computeAttrs(e),n,$e.setFrom(o))}createAndFill(e=null,n,o){if(e=this.computeAttrs(e),n=T.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let r=this.contentMatch.matchFragment(n),i=r&&r.fillBefore(T.empty,!0);return i?new po(this,e,n.append(i),$e.setFrom(o)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let o=0;o<e.childCount;o++)if(!this.allowsMarks(e.child(o).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){Qp(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 o=0;o<e.length;o++)this.allowsMarkType(e[o].type)?n&&n.push(e[o]):n||(n=e.slice(0,o));return n?n.length?n:$e.none:e}static compile(e,n){let o=Object.create(null);e.forEach((i,s)=>o[i]=new tf(i,n,s));let r=n.spec.topNode||"doc";if(!o[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!o.text)throw new RangeError("Every schema needs a 'text' type");for(let i in o.text.attrs)throw new RangeError("The text node type should not have attributes");return o}};function Rb(t,e,n){let o=n.split("|");return r=>{let i=r===null?"null":typeof r;if(o.indexOf(i)<0)throw new RangeError(`Expected value of type ${o} for attribute ${e} on type ${t}, got ${i}`)}}class Db{constructor(e,n,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?Rb(e,n,o.validate):o.validate}get isRequired(){return!this.hasDefault}}class na{constructor(e,n,o,r){this.name=e,this.rank=n,this.schema=o,this.spec=r,this.attrs=ef(e,r.attrs),this.excluded=null;let i=Xp(this.attrs);this.instance=i?new $e(this,i):null}create(e=null){return!e&&this.instance?this.instance:new $e(this,Zp(this.attrs,e))}static compile(e,n){let o=Object.create(null),r=0;return e.forEach((i,s)=>o[i]=new na(i,r++,n,s)),o}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){Qp(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class nf{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let r in e)n[r]=e[r];n.nodes=gt.from(e.nodes),n.marks=gt.from(e.marks||{}),this.nodes=wd.compile(this.spec.nodes,this),this.marks=na.compile(this.spec.marks,this);let o=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let i=this.nodes[r],s=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=o[s]||(o[s]=$o.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=a=="_"?null:a?Cd(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let r in this.marks){let i=this.marks[r],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:Cd(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,o,r){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof wd){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,o,r)}text(e,n){let o=this.nodes.text;return new ps(o,o.defaultAttrs,e,$e.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return po.fromJSON(this,e)}markFromJSON(e){return $e.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Cd(t,e){let n=[];for(let o=0;o<e.length;o++){let r=e[o],i=t.marks[r],s=i;if(i)n.push(i);else for(let a in t.marks){let c=t.marks[a];(r=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(r)>-1)&&n.push(s=c)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[o]+"'")}return n}function Ib(t){return t.tag!=null}function Bb(t){return t.style!=null}let Pr=class yl{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let o=this.matchedStyles=[];n.forEach(r=>{if(Ib(r))this.tags.push(r);else if(Bb(r)){let i=/[^=]*/.exec(r.style)[0];o.indexOf(i)<0&&o.push(i),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let o=new Sd(this,n,!1);return o.addAll(e,$e.none,n.from,n.to),o.finish()}parseSlice(e,n={}){let o=new Sd(this,n,!0);return o.addAll(e,$e.none,n.from,n.to),$.maxOpen(o.finish())}matchTag(e,n,o){for(let r=o?this.tags.indexOf(o)+1:0;r<this.tags.length;r++){let i=this.tags[r];if($b(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,n,o,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let s=this.styles[i],a=s.style;if(!(a.indexOf(e)!=0||s.context&&!o.matchesContext(s.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(s.getAttrs){let c=s.getAttrs(n);if(c===!1)continue;s.attrs=c||void 0}return s}}}static schemaRules(e){let n=[];function o(r){let i=r.priority==null?50:r.priority,s=0;for(;s<n.length;s++){let a=n[s];if((a.priority==null?50:a.priority)<i)break}n.splice(s,0,r)}for(let r in e.marks){let i=e.marks[r].spec.parseDOM;i&&i.forEach(s=>{o(s=xd(s)),s.mark||s.ignore||s.clearMark||(s.mark=r)})}for(let r in e.nodes){let i=e.nodes[r].spec.parseDOM;i&&i.forEach(s=>{o(s=xd(s)),s.node||s.ignore||s.mark||(s.node=r)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new yl(e,yl.schemaRules(e)))}};const of={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},Lb={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},rf={ol:!0,ul:!0},Xr=1,vl=2,Xi=4;function _d(t,e,n){return e!=null?(e?Xr:0)|(e==="full"?vl:0):t&&t.whitespace=="pre"?Xr|vl:n&-5}class Ti{constructor(e,n,o,r,i,s){this.type=e,this.attrs=n,this.marks=o,this.solid=r,this.options=s,this.content=[],this.activeMarks=$e.none,this.match=i||(s&Xi?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(T.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let o=this.type.contentMatch,r;return(r=o.findWrapping(e.type))?(this.match=o,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Xr)){let o=this.content[this.content.length-1],r;if(o&&o.isText&&(r=/[ \t\r\n\u000c]+$/.exec(o.text))){let i=o;o.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-r[0].length))}}let n=T.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(T.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&&!of.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Sd{constructor(e,n,o){this.parser=e,this.options=n,this.isOpen=o,this.open=0,this.localPreserveWS=!1;let r=n.topNode,i,s=_d(null,n.preserveWhitespace,0)|(o?Xi:0);r?i=new Ti(r.type,r.attrs,$e.none,!0,n.topMatch||r.type.contentMatch,s):o?i=new Ti(null,null,$e.none,!0,null,s):i=new Ti(e.schema.topNodeType,null,$e.none,!0,null,s),this.nodes=[i],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 o=e.nodeValue,r=this.top,i=r.options&vl?"full":this.localPreserveWS||(r.options&Xr)>0;if(i==="full"||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(o)){if(i)i!=="full"?o=o.replace(/\r?\n|\r/g," "):o=o.replace(/\r\n?/g,`
6
- `);else if(o=o.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(o)&&this.open==this.nodes.length-1){let s=r.content[r.content.length-1],a=e.previousSibling;(!s||a&&a.nodeName=="BR"||s.isText&&/[ \t\r\n\u000c]$/.test(s.text))&&(o=o.slice(1))}o&&this.insertNode(this.parser.schema.text(o),n),this.findInText(e)}else this.findInside(e)}addElement(e,n,o){let r=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),a;rf.hasOwnProperty(s)&&this.parser.normalizeLists&&Pb(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,o));e:if(c?c.ignore:Lb.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!c||c.skip||c.closeParent){c&&c.closeParent?this.open=Math.max(0,this.open-1):c&&c.skip.nodeType&&(e=c.skip);let d,u=this.needsBlock;if(of.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),d=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let p=c&&c.skip?n:this.readStyles(e,n);p&&this.addAll(e,p),d&&this.sync(i),this.needsBlock=u}else{let d=this.readStyles(e,n);d&&this.addElementByRule(e,c,d,c.consuming===!1?a:void 0)}this.localPreserveWS=r}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
7
- `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n)}readStyles(e,n){let o=e.style;if(o&&o.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let i=this.parser.matchedStyles[r],s=o.getPropertyValue(i);if(s)for(let a=void 0;;){let c=this.parser.matchStyle(i,s,this,a);if(!c)break;if(c.ignore)return null;if(c.clearMark?n=n.filter(d=>!c.clearMark(d)):n=n.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)a=c;else break}}return n}addElementByRule(e,n,o,r){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),o)||this.leafFallback(e,o);else{let c=this.enter(s,n.attrs||null,o,n.preserveWhitespace);c&&(i=!0,o=c)}else{let c=this.parser.schema.marks[n.mark];o=o.concat(c.create(n.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,o,r);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,o));else{let c=e;typeof n.contentElement=="string"?c=e.querySelector(n.contentElement):typeof n.contentElement=="function"?c=n.contentElement(e):n.contentElement&&(c=n.contentElement),this.findAround(e,c,!0),this.addAll(c,o),this.findAround(e,c,!1)}i&&this.sync(a)&&this.open--}addAll(e,n,o,r){let i=o||0;for(let s=o?e.childNodes[o]:e.firstChild,a=r==null?null:e.childNodes[r];s!=a;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,n);this.findAtPoint(e,i)}findPlace(e,n){let o,r;for(let i=this.open;i>=0;i--){let s=this.nodes[i],a=s.findWrapping(e);if(a&&(!o||o.length>a.length)&&(o=a,r=s,!a.length)||s.solid)break}if(!o)return null;this.sync(r);for(let i=0;i<o.length;i++)n=this.enterInner(o[i],null,n,!1);return n}insertNode(e,n){if(e.isInline&&this.needsBlock&&!this.top.type){let r=this.textblockFromContext();r&&(n=this.enterInner(r,null,n))}let o=this.findPlace(e,n);if(o){this.closeExtra();let r=this.top;r.match&&(r.match=r.match.matchType(e.type));let i=$e.none;for(let s of o.concat(e.marks))(r.type?r.type.allowsMarkType(s.type):Nd(s.type,e.type))&&(i=s.addToSet(i));return r.content.push(e.mark(i)),!0}return!1}enter(e,n,o,r){let i=this.findPlace(e.create(n),o);return i&&(i=this.enterInner(e,n,o,!0,r)),i}enterInner(e,n,o,r=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let a=_d(e,i,s.options);s.options&Xi&&s.content.length==0&&(a|=Xi);let c=$e.none;return o=o.filter(d=>(s.type?s.type.allowsMarkType(d.type):Nd(d.type,e))?(c=d.addToSet(c),!1):!0),this.nodes.push(new Ti(e,n,c,r,null,a)),this.open++,o}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|=Xr)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let o=this.nodes[n].content;for(let r=o.length-1;r>=0;r--)e+=o[r].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let o=0;o<this.find.length;o++)this.find[o].node==e&&this.find[o].offset==n&&(this.find[o].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,o){if(e!=n&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&n.compareDocumentPosition(this.find[r].node)&(o?2:4)&&(this.find[r].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("/"),o=this.options.context,r=!this.isOpen&&(!o||o.parent.type==this.nodes[0].type),i=-(o?o.depth+1:0)+(r?0:1),s=(a,c)=>{for(;a>=0;a--){let d=n[a];if(d==""){if(a==n.length-1||a==0)continue;for(;c>=i;c--)if(s(a-1,c))return!0;return!1}else{let u=c>0||c==0&&r?this.nodes[c].type:o&&c>=i?o.node(c-i).type:null;if(!u||u.name!=d&&!u.isInGroup(d))return!1;c--}}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 o=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(o&&o.isTextblock&&o.defaultAttrs)return o}for(let n in this.parser.schema.nodes){let o=this.parser.schema.nodes[n];if(o.isTextblock&&o.defaultAttrs)return o}}}function Pb(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&rf.hasOwnProperty(o)&&n?(n.appendChild(e),e=n):o=="li"?n=e:o&&(n=null)}}function $b(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function xd(t){let e={};for(let n in t)e[n]=t[n];return e}function Nd(t,e){let n=e.schema.nodes;for(let o in n){let r=n[o];if(!r.allowsMarkType(t))continue;let i=[],s=a=>{i.push(a);for(let c=0;c<a.edgeCount;c++){let{type:d,next:u}=a.edge(c);if(d==e||i.indexOf(u)<0&&s(u))return!0}};if(s(r.contentMatch))return!0}}class qo{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},o){o||(o=Da(n).createDocumentFragment());let r=o,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let a=0,c=0;for(;a<i.length&&c<s.marks.length;){let d=s.marks[c];if(!this.marks[d.type.name]){c++;continue}if(!d.eq(i[a][0])||d.type.spec.spanning===!1)break;a++,c++}for(;a<i.length;)r=i.pop()[1];for(;c<s.marks.length;){let d=s.marks[c++],u=this.serializeMark(d,s.isInline,n);u&&(i.push([d,r]),r.appendChild(u.dom),r=u.contentDOM||u.dom)}}r.appendChild(this.serializeNodeInner(s,n))}),o}serializeNodeInner(e,n){let{dom:o,contentDOM:r}=Zi(Da(n),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,r)}return o}serializeNode(e,n={}){let o=this.serializeNodeInner(e,n);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(o),o=i.dom)}return o}serializeMark(e,n,o={}){let r=this.marks[e.type.name];return r&&Zi(Da(o),r(e,n),null,e.attrs)}static renderSpec(e,n,o=null,r){return Zi(e,n,o,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new qo(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Td(e.nodes);return n.text||(n.text=o=>o.text),n}static marksFromSchema(e){return Td(e.marks)}}function Td(t){let e={};for(let n in t){let o=t[n].spec.toDOM;o&&(e[n]=o)}return e}function Da(t){return t.document||window.document}const Od=new WeakMap;function Fb(t){let e=Od.get(t);return e===void 0&&Od.set(t,e=Vb(t)),e}function Vb(t){let e=null;function n(o){if(o&&typeof o=="object")if(Array.isArray(o))if(typeof o[0]=="string")e||(e=[]),e.push(o);else for(let r=0;r<o.length;r++)n(o[r]);else for(let r in o)n(o[r])}return n(t),e}function Zi(t,e,n,o){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 r=e[0],i;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(o&&(i=Fb(o))&&i.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=r.indexOf(" ");s>0&&(n=r.slice(0,s),r=r.slice(s+1));let a,c=n?t.createElementNS(n,r):t.createElement(r),d=e[1],u=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){u=2;for(let p in d)if(d[p]!=null){let f=p.indexOf(" ");f>0?c.setAttributeNS(p.slice(0,f),p.slice(f+1),d[p]):c.setAttribute(p,d[p])}}for(let p=u;p<e.length;p++){let f=e[p];if(f===0){if(p<e.length-1||p>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else{let{dom:h,contentDOM:m}=Zi(t,f,n,o);if(c.appendChild(h),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:c,contentDOM:a}}const sf=65535,af=Math.pow(2,16);function zb(t,e){return t+e*af}function Md(t){return t&sf}function Hb(t){return(t-(t&sf))/af}const lf=1,cf=2,Qi=4,df=8;class kl{constructor(e,n,o){this.pos=e,this.delInfo=n,this.recover=o}get deleted(){return(this.delInfo&df)>0}get deletedBefore(){return(this.delInfo&(lf|Qi))>0}get deletedAfter(){return(this.delInfo&(cf|Qi))>0}get deletedAcross(){return(this.delInfo&Qi)>0}}class qt{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&qt.empty)return qt.empty}recover(e){let n=0,o=Md(e);if(!this.inverted)for(let r=0;r<o;r++)n+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[o*3]+n+Hb(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,o){let r=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?r:0);if(c>e)break;let d=this.ranges[a+i],u=this.ranges[a+s],p=c+d;if(e<=p){let f=d?e==c?-1:e==p?1:n:n,h=c+r+(f<0?0:u);if(o)return h;let m=e==(n<0?c:p)?null:zb(a/3,e-c),g=e==c?cf:e==p?lf:Qi;return(n<0?e!=c:e!=p)&&(g|=df),new kl(h,g,m)}r+=u-d}return o?e+r:new kl(e+r,0,null)}touches(e,n){let o=0,r=Md(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?o:0);if(c>e)break;let d=this.ranges[a+i],u=c+d;if(e<=u&&a==r*3)return!0;o+=this.ranges[a+s]-d}return!1}forEach(e){let n=this.inverted?2:1,o=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let s=this.ranges[r],a=s-(this.inverted?i:0),c=s+(this.inverted?0:i),d=this.ranges[r+n],u=this.ranges[r+o];e(a,a+d,c,c+u),i+=u-d}}invert(){return new qt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?qt.empty:new qt(e<0?[0,-e,0]:[0,0,e])}}qt.empty=new qt([]);class Zr{constructor(e,n,o=0,r=e?e.length:0){this.mirror=n,this.from=o,this.to=r,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Zr(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,o=this._maps.length;n<e._maps.length;n++){let r=e.getMirror(n);this.appendMap(e._maps[n],r!=null&&r<n?o+r: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,o=this._maps.length+e._maps.length;n>=0;n--){let r=e.getMirror(n);this.appendMap(e._maps[n].invert(),r!=null&&r>n?o-r-1:void 0)}}invert(){let e=new Zr;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let o=this.from;o<this.to;o++)e=this._maps[o].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,o){let r=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],a=s.mapResult(e,n);if(a.recover!=null){let c=this.getMirror(i);if(c!=null&&c>i&&c<this.to){i=c,e=this._maps[c].recover(a.recover);continue}}r|=a.delInfo,e=a.pos}return o?e:new kl(e,r,null)}}const Ia=Object.create(null);class _t{getMap(){return qt.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let o=Ia[n.stepType];if(!o)throw new RangeError(`No step type ${n.stepType} defined`);return o.fromJSON(e,n)}static jsonID(e,n){if(e in Ia)throw new RangeError("Duplicate use of step JSON ID "+e);return Ia[e]=n,n.prototype.jsonID=e,n}}class tt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new tt(e,null)}static fail(e){return new tt(null,e)}static fromReplace(e,n,o,r){try{return tt.ok(e.replace(n,o,r))}catch(i){if(i instanceof cs)return tt.fail(i.message);throw i}}}function oc(t,e,n){let o=[];for(let r=0;r<t.childCount;r++){let i=t.child(r);i.content.size&&(i=i.copy(oc(i.content,e,i))),i.isInline&&(i=e(i,n,r)),o.push(i)}return T.fromArray(o)}class ao extends _t{constructor(e,n,o){super(),this.from=e,this.to=n,this.mark=o}apply(e){let n=e.slice(this.from,this.to),o=e.resolve(this.from),r=o.node(o.sharedDepth(this.to)),i=new $(oc(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),r),n.openStart,n.openEnd);return tt.fromReplace(e,this.from,this.to,i)}invert(){return new Tn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deleted&&o.deleted||n.pos>=o.pos?null:new ao(n.pos,o.pos,this.mark)}merge(e){return e instanceof ao&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ao(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 ao(n.from,n.to,e.markFromJSON(n.mark))}}_t.jsonID("addMark",ao);class Tn extends _t{constructor(e,n,o){super(),this.from=e,this.to=n,this.mark=o}apply(e){let n=e.slice(this.from,this.to),o=new $(oc(n.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),n.openStart,n.openEnd);return tt.fromReplace(e,this.from,this.to,o)}invert(){return new ao(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deleted&&o.deleted||n.pos>=o.pos?null:new Tn(n.pos,o.pos,this.mark)}merge(e){return e instanceof Tn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Tn(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 Tn(n.from,n.to,e.markFromJSON(n.mark))}}_t.jsonID("removeMark",Tn);class lo extends _t{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return tt.fail("No node at mark step's position");let o=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return tt.fromReplace(e,this.pos,this.pos+1,new $(T.from(o),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let o=this.mark.addToSet(n.marks);if(o.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(o))return new lo(this.pos,n.marks[r]);return new lo(this.pos,this.mark)}}return new lr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new lo(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 lo(n.pos,e.markFromJSON(n.mark))}}_t.jsonID("addNodeMark",lo);class lr extends _t{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return tt.fail("No node at mark step's position");let o=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return tt.fromReplace(e,this.pos,this.pos+1,new $(T.from(o),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new lo(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new lr(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 lr(n.pos,e.markFromJSON(n.mark))}}_t.jsonID("removeNodeMark",lr);class at extends _t{constructor(e,n,o,r=!1){super(),this.from=e,this.to=n,this.slice=o,this.structure=r}apply(e){return this.structure&&El(e,this.from,this.to)?tt.fail("Structure replace would overwrite content"):tt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new qt([this.from,this.to-this.from,this.slice.size])}invert(e){return new at(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deletedAcross&&o.deletedAcross?null:new at(n.pos,Math.max(n.pos,o.pos),this.slice)}merge(e){if(!(e instanceof at)||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?$.empty:new $(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new at(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?$.empty:new $(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new at(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 at(n.from,n.to,$.fromJSON(e,n.slice),!!n.structure)}}_t.jsonID("replace",at);class lt extends _t{constructor(e,n,o,r,i,s,a=!1){super(),this.from=e,this.to=n,this.gapFrom=o,this.gapTo=r,this.slice=i,this.insert=s,this.structure=a}apply(e){if(this.structure&&(El(e,this.from,this.gapFrom)||El(e,this.gapTo,this.to)))return tt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return tt.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,n.content);return o?tt.fromReplace(e,this.from,this.to,o):tt.fail("Content does not fit in gap")}getMap(){return new qt([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 lt(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),o=e.mapResult(this.to,-1),r=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?o.pos:e.map(this.gapTo,1);return n.deletedAcross&&o.deletedAcross||r<n.pos||i>o.pos?null:new lt(n.pos,o.pos,r,i,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 lt(n.from,n.to,n.gapFrom,n.gapTo,$.fromJSON(e,n.slice),n.insert,!!n.structure)}}_t.jsonID("replaceAround",lt);function El(t,e,n){let o=t.resolve(e),r=n-e,i=o.depth;for(;r>0&&i>0&&o.indexAfter(i)==o.node(i).childCount;)i--,r--;if(r>0){let s=o.node(i).maybeChild(o.indexAfter(i));for(;r>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,r--}}return!1}function Ub(t,e,n,o){let r=[],i=[],s,a;t.doc.nodesBetween(e,n,(c,d,u)=>{if(!c.isInline)return;let p=c.marks;if(!o.isInSet(p)&&u.type.allowsMarkType(o.type)){let f=Math.max(d,e),h=Math.min(d+c.nodeSize,n),m=o.addToSet(p);for(let g=0;g<p.length;g++)p[g].isInSet(m)||(s&&s.to==f&&s.mark.eq(p[g])?s.to=h:r.push(s=new Tn(f,h,p[g])));a&&a.to==f?a.to=h:i.push(a=new ao(f,h,o))}}),r.forEach(c=>t.step(c)),i.forEach(c=>t.step(c))}function qb(t,e,n,o){let r=[],i=0;t.doc.nodesBetween(e,n,(s,a)=>{if(!s.isInline)return;i++;let c=null;if(o instanceof na){let d=s.marks,u;for(;u=o.isInSet(d);)(c||(c=[])).push(u),d=u.removeFromSet(d)}else o?o.isInSet(s.marks)&&(c=[o]):c=s.marks;if(c&&c.length){let d=Math.min(a+s.nodeSize,n);for(let u=0;u<c.length;u++){let p=c[u],f;for(let h=0;h<r.length;h++){let m=r[h];m.step==i-1&&p.eq(r[h].style)&&(f=m)}f?(f.to=d,f.step=i):r.push({style:p,from:Math.max(a,e),to:d,step:i})}}}),r.forEach(s=>t.step(new Tn(s.from,s.to,s.style)))}function rc(t,e,n,o=n.contentMatch,r=!0){let i=t.doc.nodeAt(e),s=[],a=e+1;for(let c=0;c<i.childCount;c++){let d=i.child(c),u=a+d.nodeSize,p=o.matchType(d.type);if(!p)s.push(new at(a,u,$.empty));else{o=p;for(let f=0;f<d.marks.length;f++)n.allowsMarkType(d.marks[f].type)||t.step(new Tn(a,u,d.marks[f]));if(r&&d.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,m;for(;f=h.exec(d.text);)m||(m=new $(T.from(n.schema.text(" ",n.allowedMarks(d.marks))),0,0)),s.push(new at(a+f.index,a+f.index+f[0].length,m))}}a=u}if(!o.validEnd){let c=o.fillBefore(T.empty,!0);t.replace(a,a,new $(c,0,0))}for(let c=s.length-1;c>=0;c--)t.step(s[c])}function Wb(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Er(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let o=t.depth;;--o){let r=t.$from.node(o),i=t.$from.index(o),s=t.$to.indexAfter(o);if(o<t.depth&&r.canReplace(i,s,n))return o;if(o==0||r.type.spec.isolating||!Wb(r,i,s))break}return null}function Kb(t,e,n){let{$from:o,$to:r,depth:i}=e,s=o.before(i+1),a=r.after(i+1),c=s,d=a,u=T.empty,p=0;for(let m=i,g=!1;m>n;m--)g||o.index(m)>0?(g=!0,u=T.from(o.node(m).copy(u)),p++):c--;let f=T.empty,h=0;for(let m=i,g=!1;m>n;m--)g||r.after(m+1)<r.end(m)?(g=!0,f=T.from(r.node(m).copy(f)),h++):d++;t.step(new lt(c,d,s,a,new $(u.append(f),p,h),u.size-p,!0))}function ic(t,e,n=null,o=t){let r=jb(t,e),i=r&&Gb(o,e);return i?r.map(Ad).concat({type:e,attrs:n}).concat(i.map(Ad)):null}function Ad(t){return{type:t,attrs:null}}function jb(t,e){let{parent:n,startIndex:o,endIndex:r}=t,i=n.contentMatchAt(o).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(o,r,s)?i:null}function Gb(t,e){let{parent:n,startIndex:o,endIndex:r}=t,i=n.child(o),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let c=(s.length?s[s.length-1]:e).contentMatch;for(let d=o;c&&d<r;d++)c=c.matchType(n.child(d).type);return!c||!c.validEnd?null:s}function Yb(t,e,n){let o=T.empty;for(let s=n.length-1;s>=0;s--){if(o.size){let a=n[s].type.contentMatch.matchFragment(o);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=T.from(n[s].type.create(n[s].attrs,o))}let r=e.start,i=e.end;t.step(new lt(r,i,r,i,new $(o,0,0),n.length,!0))}function Jb(t,e,n,o,r){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,a)=>{let c=typeof r=="function"?r(s):r;if(s.isTextblock&&!s.hasMarkup(o,c)&&Xb(t.doc,t.mapping.slice(i).map(a),o)){let d=null;if(o.schema.linebreakReplacement){let h=o.whitespace=="pre",m=!!o.contentMatch.matchType(o.schema.linebreakReplacement);h&&!m?d=!1:!h&&m&&(d=!0)}d===!1&&pf(t,s,a,i),rc(t,t.mapping.slice(i).map(a,1),o,void 0,d===null);let u=t.mapping.slice(i),p=u.map(a,1),f=u.map(a+s.nodeSize,1);return t.step(new lt(p,f,p+1,f-1,new $(T.from(o.create(c,null,s.marks)),0,0),1,!0)),d===!0&&uf(t,s,a,i),!1}})}function uf(t,e,n,o){e.forEach((r,i)=>{if(r.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(r.text);){let c=t.mapping.slice(o).map(n+1+i+s.index);t.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function pf(t,e,n,o){e.forEach((r,i)=>{if(r.type==r.type.schema.linebreakReplacement){let s=t.mapping.slice(o).map(n+1+i);t.replaceWith(s,s+1,e.type.schema.text(`
8
- `))}})}function Xb(t,e,n){let o=t.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,n)}function Zb(t,e,n,o,r){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(o,null,r||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new lt(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new $(T.from(s),0,0),1,!0))}function Wn(t,e,n=1,o){let r=t.resolve(e),i=r.depth-n,s=o&&o[o.length-1]||r.parent;if(i<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!s.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let d=r.depth-1,u=n-2;d>i;d--,u--){let p=r.node(d),f=r.index(d);if(p.type.spec.isolating)return!1;let h=p.content.cutByIndex(f,p.childCount),m=o&&o[u+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let g=o&&o[u]||p;if(!p.canReplace(f+1,p.childCount)||!g.type.validContent(h))return!1}let a=r.indexAfter(i),c=o&&o[0];return r.node(i).canReplaceWith(a,a,c?c.type:r.node(i+1).type)}function Qb(t,e,n=1,o){let r=t.doc.resolve(e),i=T.empty,s=T.empty;for(let a=r.depth,c=r.depth-n,d=n-1;a>c;a--,d--){i=T.from(r.node(a).copy(i));let u=o&&o[d];s=T.from(u?u.type.create(u.attrs,s):r.node(a).copy(s))}t.step(new at(e,e,new $(i.append(s),n,n),!0))}function yo(t,e){let n=t.resolve(e),o=n.index();return ff(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(o,o+1)}function ey(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:o}=t.type.schema;for(let r=0;r<e.childCount;r++){let i=e.child(r),s=i.type==o?t.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function ff(t,e){return!!(t&&e&&!t.isLeaf&&ey(t,e))}function oa(t,e,n=-1){let o=t.resolve(e);for(let r=o.depth;;r--){let i,s,a=o.index(r);if(r==o.depth?(i=o.nodeBefore,s=o.nodeAfter):n>0?(i=o.node(r+1),a++,s=o.node(r).maybeChild(a)):(i=o.node(r).maybeChild(a-1),s=o.node(r+1)),i&&!i.isTextblock&&ff(i,s)&&o.node(r).canReplace(a,a+1))return e;if(r==0)break;e=n<0?o.before(r):o.after(r)}}function ty(t,e,n){let o=null,{linebreakReplacement:r}=t.doc.type.schema,i=t.doc.resolve(e-n),s=i.node().type;if(r&&s.inlineContent){let u=s.whitespace=="pre",p=!!s.contentMatch.matchType(r);u&&!p?o=!1:!u&&p&&(o=!0)}let a=t.steps.length;if(o===!1){let u=t.doc.resolve(e+n);pf(t,u.node(),u.before(),a)}s.inlineContent&&rc(t,e+n-1,s,i.node().contentMatchAt(i.index()),o==null);let c=t.mapping.slice(a),d=c.map(e-n);if(t.step(new at(d,c.map(e+n,-1),$.empty,!0)),o===!0){let u=t.doc.resolve(d);uf(t,u.node(),u.before(),t.steps.length)}return t}function ny(t,e,n){let o=t.resolve(e);if(o.parent.canReplaceWith(o.index(),o.index(),n))return e;if(o.parentOffset==0)for(let r=o.depth-1;r>=0;r--){let i=o.index(r);if(o.node(r).canReplaceWith(i,i,n))return o.before(r+1);if(i>0)return null}if(o.parentOffset==o.parent.content.size)for(let r=o.depth-1;r>=0;r--){let i=o.indexAfter(r);if(o.node(r).canReplaceWith(i,i,n))return o.after(r+1);if(i<o.node(r).childCount)return null}return null}function hf(t,e,n){let o=t.resolve(e);if(!n.content.size)return e;let r=n.content;for(let i=0;i<n.openStart;i++)r=r.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=o.depth;s>=0;s--){let a=s==o.depth?0:o.pos<=(o.start(s+1)+o.end(s+1))/2?-1:1,c=o.index(s)+(a>0?1:0),d=o.node(s),u=!1;if(i==1)u=d.canReplace(c,c,r);else{let p=d.contentMatchAt(c).findWrapping(r.firstChild.type);u=p&&d.canReplaceWith(c,c,p[0])}if(u)return a==0?o.pos:a<0?o.before(s+1):o.after(s+1)}return null}function ra(t,e,n=e,o=$.empty){if(e==n&&!o.size)return null;let r=t.resolve(e),i=t.resolve(n);return mf(r,i,o)?new at(e,n,o):new oy(r,i,o).fit()}function mf(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class oy{constructor(e,n,o){this.$from=e,this.$to=n,this.unplaced=o,this.frontier=[],this.placed=T.empty;for(let r=0;r<=e.depth;r++){let i=e.node(r);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=T.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,o=this.$from,r=this.close(e<0?this.$to:o.doc.resolve(e));if(!r)return null;let i=this.placed,s=o.depth,a=r.depth;for(;s&&a&&i.childCount==1;)i=i.firstChild.content,s--,a--;let c=new $(i,s,a);return e>-1?new lt(o.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||o.pos!=this.$to.pos?new at(o.pos,r.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,o=0,r=this.unplaced.openEnd;o<e;o++){let i=n.firstChild;if(n.childCount>1&&(r=0),i.type.spec.isolating&&r<=o){e=o;break}n=i.content}for(let n=1;n<=2;n++)for(let o=n==1?e:this.unplaced.openStart;o>=0;o--){let r,i=null;o?(i=Ba(this.unplaced.content,o-1).firstChild,r=i.content):r=this.unplaced.content;let s=r.firstChild;for(let a=this.depth;a>=0;a--){let{type:c,match:d}=this.frontier[a],u,p=null;if(n==1&&(s?d.matchType(s.type)||(p=d.fillBefore(T.from(s),!1)):i&&c.compatibleContent(i.type)))return{sliceDepth:o,frontierDepth:a,parent:i,inject:p};if(n==2&&s&&(u=d.findWrapping(s.type)))return{sliceDepth:o,frontierDepth:a,parent:i,wrap:u};if(i&&d.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:o}=this.unplaced,r=Ba(e,n);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new $(e,n+1,Math.max(o,r.size+n>=e.size-o?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:o}=this.unplaced,r=Ba(e,n);if(r.childCount<=1&&n>0){let i=e.size-n<=n+r.size;this.unplaced=new $(Rr(e,n-1,1),n-1,i?n-1:o)}else this.unplaced=new $(Rr(e,n,1),n,o)}placeNodes({sliceDepth:e,frontierDepth:n,parent:o,inject:r,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let s=this.unplaced,a=o?o.content:s.content,c=s.openStart-e,d=0,u=[],{match:p,type:f}=this.frontier[n];if(r){for(let g=0;g<r.childCount;g++)u.push(r.child(g));p=p.matchFragment(r)}let h=a.size+e-(s.content.size-s.openEnd);for(;d<a.childCount;){let g=a.child(d),b=p.matchType(g.type);if(!b)break;d++,(d>1||c==0||g.content.size)&&(p=b,u.push(gf(g.mark(f.allowedMarks(g.marks)),d==1?c:0,d==a.childCount?h:-1)))}let m=d==a.childCount;m||(h=-1),this.placed=Dr(this.placed,n,T.from(u)),this.frontier[n].match=p,m&&h<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,b=a;g<h;g++){let y=b.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),b=y.content}this.unplaced=m?e==0?$.empty:new $(Rr(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new $(Rr(s.content,e,d),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!La(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:o}=this.$to,r=this.$to.after(o);for(;o>1&&r==this.$to.end(--o);)++r;return r}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:o,type:r}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=La(e,n,r,o,i);if(s){for(let a=n-1;a>=0;a--){let{match:c,type:d}=this.frontier[a],u=La(e,a,d,c,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:i?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=Dr(this.placed,n.depth,n.fit)),e=n.move;for(let o=n.depth+1;o<=e.depth;o++){let r=e.node(o),i=r.type.contentMatch.fillBefore(r.content,!0,e.index(o));this.openFrontierNode(r.type,r.attrs,i)}return e}openFrontierNode(e,n=null,o){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Dr(this.placed,this.depth,T.from(e.create(n,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(T.empty,!0);n.childCount&&(this.placed=Dr(this.placed,this.frontier.length,n))}}function Rr(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Rr(t.firstChild.content,e-1,n)))}function Dr(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Dr(t.lastChild.content,e-1,n)))}function Ba(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function gf(t,e,n){if(e<=0)return t;let o=t.content;return e>1&&(o=o.replaceChild(0,gf(o.firstChild,e-1,o.childCount==1?n-1:0))),e>0&&(o=t.type.contentMatch.fillBefore(o).append(o),n<=0&&(o=o.append(t.type.contentMatch.matchFragment(o).fillBefore(T.empty,!0)))),t.copy(o)}function La(t,e,n,o,r){let i=t.node(e),s=r?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=o.fillBefore(i.content,!0,s);return a&&!ry(n,i.content,s)?a:null}function ry(t,e,n){for(let o=n;o<e.childCount;o++)if(!t.allowsMarks(e.child(o).marks))return!0;return!1}function iy(t){return t.spec.defining||t.spec.definingForContent}function sy(t,e,n,o){if(!o.size)return t.deleteRange(e,n);let r=t.doc.resolve(e),i=t.doc.resolve(n);if(mf(r,i,o))return t.step(new at(e,n,o));let s=yf(r,t.doc.resolve(n));s[s.length-1]==0&&s.pop();let a=-(r.depth+1);s.unshift(a);for(let f=r.depth,h=r.pos-1;f>0;f--,h--){let m=r.node(f).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(f)>-1?a=f:r.before(f)==h&&s.splice(1,0,-f)}let c=s.indexOf(a),d=[],u=o.openStart;for(let f=o.content,h=0;;h++){let m=f.firstChild;if(d.push(m),h==o.openStart)break;f=m.content}for(let f=u-1;f>=0;f--){let h=d[f],m=iy(h.type);if(m&&!h.sameMarkup(r.node(Math.abs(a)-1)))u=f;else if(m||!h.type.isTextblock)break}for(let f=o.openStart;f>=0;f--){let h=(f+u+1)%(o.openStart+1),m=d[h];if(m)for(let g=0;g<s.length;g++){let b=s[(g+c)%s.length],y=!0;b<0&&(y=!1,b=-b);let k=r.node(b-1),w=r.index(b-1);if(k.canReplaceWith(w,w,m.type,m.marks))return t.replace(r.before(b),y?i.after(b):n,new $(bf(o.content,0,o.openStart,h),h,o.openEnd))}}let p=t.steps.length;for(let f=s.length-1;f>=0&&(t.replace(e,n,o),!(t.steps.length>p));f--){let h=s[f];h<0||(e=r.before(h),n=i.after(h))}}function bf(t,e,n,o,r){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(bf(i.content,e+1,n,o,i)))}if(e>o){let i=r.contentMatchAt(0),s=i.fillBefore(t).append(t);t=s.append(i.matchFragment(s).fillBefore(T.empty,!0))}return t}function ay(t,e,n,o){if(!o.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let r=ny(t.doc,e,o.type);r!=null&&(e=n=r)}t.replaceRange(e,n,new $(T.from(o),0,0))}function ly(t,e,n){let o=t.doc.resolve(e),r=t.doc.resolve(n),i=yf(o,r);for(let s=0;s<i.length;s++){let a=i[s],c=s==i.length-1;if(c&&a==0||o.node(a).type.contentMatch.validEnd)return t.delete(o.start(a),r.end(a));if(a>0&&(c||o.node(a-1).canReplace(o.index(a-1),r.indexAfter(a-1))))return t.delete(o.before(a),r.after(a))}for(let s=1;s<=o.depth&&s<=r.depth;s++)if(e-o.start(s)==o.depth-s&&n>o.end(s)&&r.end(s)-n!=r.depth-s&&o.start(s-1)==r.start(s-1)&&o.node(s-1).canReplace(o.index(s-1),r.index(s-1)))return t.delete(o.before(s),n);t.delete(e,n)}function yf(t,e){let n=[],o=Math.min(t.depth,e.depth);for(let r=o;r>=0;r--){let i=t.start(r);if(i<t.pos-(t.depth-r)||e.end(r)>e.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(i==e.start(r)||r==t.depth&&r==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==i-1)&&n.push(r)}return n}class sr extends _t{constructor(e,n,o){super(),this.pos=e,this.attr=n,this.value=o}apply(e){let n=e.nodeAt(this.pos);if(!n)return tt.fail("No node at attribute step's position");let o=Object.create(null);for(let i in n.attrs)o[i]=n.attrs[i];o[this.attr]=this.value;let r=n.type.create(o,null,n.marks);return tt.fromReplace(e,this.pos,this.pos+1,new $(T.from(r),0,n.isLeaf?0:1))}getMap(){return qt.empty}invert(e){return new sr(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 sr(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 sr(n.pos,n.attr,n.value)}}_t.jsonID("attr",sr);class Qr extends _t{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let r in e.attrs)n[r]=e.attrs[r];n[this.attr]=this.value;let o=e.type.create(n,e.content,e.marks);return tt.ok(o)}getMap(){return qt.empty}invert(e){return new Qr(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 Qr(n.attr,n.value)}}_t.jsonID("docAttr",Qr);let cr=class extends Error{};cr=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};cr.prototype=Object.create(Error.prototype);cr.prototype.constructor=cr;cr.prototype.name="TransformError";class sc{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Zr}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new cr(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,o=$.empty){let r=ra(this.doc,e,n,o);return r&&this.step(r),this}replaceWith(e,n,o){return this.replace(e,n,new $(T.from(o),0,0))}delete(e,n){return this.replace(e,n,$.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,o){return sy(this,e,n,o),this}replaceRangeWith(e,n,o){return ay(this,e,n,o),this}deleteRange(e,n){return ly(this,e,n),this}lift(e,n){return Kb(this,e,n),this}join(e,n=1){return ty(this,e,n),this}wrap(e,n){return Yb(this,e,n),this}setBlockType(e,n=e,o,r=null){return Jb(this,e,n,o,r),this}setNodeMarkup(e,n,o=null,r){return Zb(this,e,n,o,r),this}setNodeAttribute(e,n,o){return this.step(new sr(e,n,o)),this}setDocAttribute(e,n){return this.step(new Qr(e,n)),this}addNodeMark(e,n){return this.step(new lo(e,n)),this}removeNodeMark(e,n){if(!(n instanceof $e)){let o=this.doc.nodeAt(e);if(!o)throw new RangeError("No node at position "+e);if(n=n.isInSet(o.marks),!n)return this}return this.step(new lr(e,n)),this}split(e,n=1,o){return Qb(this,e,n,o),this}addMark(e,n,o){return Ub(this,e,n,o),this}removeMark(e,n,o){return qb(this,e,n,o),this}clearIncompatible(e,n,o){return rc(this,e,n,o),this}}const Pa=Object.create(null);class ee{constructor(e,n,o){this.$anchor=e,this.$head=n,this.ranges=o||[new vf(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=$.empty){let o=n.content.lastChild,r=null;for(let a=0;a<n.openEnd;a++)r=o,o=o.lastChild;let i=e.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:c,$to:d}=s[a],u=e.mapping.slice(i);e.replaceRange(u.map(c.pos),u.map(d.pos),a?$.empty:n),a==0&&Id(e,i,(o?o.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,n){let o=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:s,$to:a}=r[i],c=e.mapping.slice(o),d=c.map(s.pos),u=c.map(a.pos);i?e.deleteRange(d,u):(e.replaceRangeWith(d,u,n),Id(e,o,n.isInline?-1:1))}}static findFrom(e,n,o=!1){let r=e.parent.inlineContent?new J(e):Zo(e.node(0),e.parent,e.pos,e.index(),n,o);if(r)return r;for(let i=e.depth-1;i>=0;i--){let s=n<0?Zo(e.node(0),e.node(i),e.before(i+1),e.index(i),n,o):Zo(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,o);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new jt(e.node(0))}static atStart(e){return Zo(e,e,0,0,1)||new jt(e)}static atEnd(e){return Zo(e,e,e.content.size,e.childCount,-1)||new jt(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=Pa[n.type];if(!o)throw new RangeError(`No selection type ${n.type} defined`);return o.fromJSON(e,n)}static jsonID(e,n){if(e in Pa)throw new RangeError("Duplicate use of selection JSON ID "+e);return Pa[e]=n,n.prototype.jsonID=e,n}getBookmark(){return J.between(this.$anchor,this.$head).getBookmark()}}ee.prototype.visible=!0;class vf{constructor(e,n){this.$from=e,this.$to=n}}let Rd=!1;function Dd(t){!Rd&&!t.parent.inlineContent&&(Rd=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class J extends ee{constructor(e,n=e){Dd(e),Dd(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let o=e.resolve(n.map(this.head));if(!o.parent.inlineContent)return ee.near(o);let r=e.resolve(n.map(this.anchor));return new J(r.parent.inlineContent?r:o,o)}replace(e,n=$.empty){if(super.replace(e,n),n==$.empty){let o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}}eq(e){return e instanceof J&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new ia(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 J(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,o=n){let r=e.resolve(n);return new this(r,o==n?r:e.resolve(o))}static between(e,n,o){let r=e.pos-n.pos;if((!o||r)&&(o=r>=0?1:-1),!n.parent.inlineContent){let i=ee.findFrom(n,o,!0)||ee.findFrom(n,-o,!0);if(i)n=i.$head;else return ee.near(n,o)}return e.parent.inlineContent||(r==0?e=n:(e=(ee.findFrom(e,-o,!0)||ee.findFrom(e,o,!0)).$anchor,e.pos<n.pos!=r<0&&(e=n))),new J(e,n)}}ee.jsonID("text",J);class ia{constructor(e,n){this.anchor=e,this.head=n}map(e){return new ia(e.map(this.anchor),e.map(this.head))}resolve(e){return J.between(e.resolve(this.anchor),e.resolve(this.head))}}class G extends ee{constructor(e){let n=e.nodeAfter,o=e.node(0).resolve(e.pos+n.nodeSize);super(e,o),this.node=n}map(e,n){let{deleted:o,pos:r}=n.mapResult(this.anchor),i=e.resolve(r);return o?ee.near(i):new G(i)}content(){return new $(T.from(this.node),0,0)}eq(e){return e instanceof G&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ac(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new G(e.resolve(n.anchor))}static create(e,n){return new G(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}G.prototype.visible=!1;ee.jsonID("node",G);class ac{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:o}=e.mapResult(this.anchor);return n?new ia(o,o):new ac(o)}resolve(e){let n=e.resolve(this.anchor),o=n.nodeAfter;return o&&G.isSelectable(o)?new G(n):ee.near(n)}}class jt extends ee{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=$.empty){if(n==$.empty){e.delete(0,e.doc.content.size);let o=ee.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new jt(e)}map(e){return new jt(e)}eq(e){return e instanceof jt}getBookmark(){return cy}}ee.jsonID("all",jt);const cy={map(){return this},resolve(t){return new jt(t)}};function Zo(t,e,n,o,r,i=!1){if(e.inlineContent)return J.create(t,n);for(let s=o-(r>0?0:1);r>0?s<e.childCount:s>=0;s+=r){let a=e.child(s);if(a.isAtom){if(!i&&G.isSelectable(a))return G.create(t,n-(r<0?a.nodeSize:0))}else{let c=Zo(t,a,n+r,r<0?a.childCount:0,r,i);if(c)return c}n+=a.nodeSize*r}return null}function Id(t,e,n){let o=t.steps.length-1;if(o<e)return;let r=t.steps[o];if(!(r instanceof at||r instanceof lt))return;let i=t.mapping.maps[o],s;i.forEach((a,c,d,u)=>{s==null&&(s=u)}),t.setSelection(ee.near(t.doc.resolve(s),n))}const Bd=1,Ld=2,Pd=4;class dy extends sc{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|Bd)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&Bd)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Ld,this}ensureMarks(e){return $e.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&Ld)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&-3,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let o=this.selection;return n&&(e=e.mark(this.storedMarks||(o.empty?o.$from.marks():o.$from.marksAcross(o.$to)||$e.none))),o.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,o){let r=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(o==null&&(o=n),o=o??n,!e)return this.deleteRange(n,o);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=o==n?s.marks():s.marksAcross(this.doc.resolve(o))}return this.replaceRangeWith(n,o,r.text(e,i)),this.selection.empty||this.setSelection(ee.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|=Pd,this}get scrolledIntoView(){return(this.updated&Pd)>0}}function $d(t,e){return!e||!t?t:t.bind(e)}class Ir{constructor(e,n,o){this.name=e,this.init=$d(n.init,o),this.apply=$d(n.apply,o)}}const uy=[new Ir("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Ir("selection",{init(t,e){return t.selection||ee.atStart(e.doc)},apply(t){return t.selection}}),new Ir("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,o){return o.selection.$cursor?t.storedMarks:null}}),new Ir("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class $a{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=uy.slice(),n&&n.forEach(o=>{if(this.pluginsByKey[o.key])throw new RangeError("Adding different instances of a keyed plugin ("+o.key+")");this.plugins.push(o),this.pluginsByKey[o.key]=o,o.spec.state&&this.fields.push(new Ir(o.key,o.spec.state,o))})}}class rr{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 o=0;o<this.config.plugins.length;o++)if(o!=n){let r=this.config.plugins[o];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],o=this.applyInner(e),r=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let a=this.config.plugins[s];if(a.spec.appendTransaction){let c=r?r[s].n:0,d=r?r[s].state:this,u=c<n.length&&a.spec.appendTransaction.call(a,c?n.slice(c):n,d,o);if(u&&o.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!r){r=[];for(let p=0;p<this.config.plugins.length;p++)r.push(p<s?{state:o,n:n.length}:{state:this,n:0})}n.push(u),o=o.applyInner(u),i=!0}r&&(r[s]={state:o,n:n.length})}}if(!i)return{state:o,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new rr(this.config),o=this.config.fields;for(let r=0;r<o.length;r++){let i=o[r];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new dy(this)}static create(e){let n=new $a(e.doc?e.doc.type.schema:e.schema,e.plugins),o=new rr(n);for(let r=0;r<n.fields.length;r++)o[n.fields[r].name]=n.fields[r].init(e,o);return o}reconfigure(e){let n=new $a(this.schema,e.plugins),o=n.fields,r=new rr(n);for(let i=0;i<o.length;i++){let s=o[i].name;r[s]=this.hasOwnProperty(s)?this[s]:o[i].init(e,r)}return r}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(o=>o.toJSON())),e&&typeof e=="object")for(let o in e){if(o=="doc"||o=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[o],i=r.spec.state;i&&i.toJSON&&(n[o]=i.toJSON.call(r,this[r.key]))}return n}static fromJSON(e,n,o){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new $a(e.schema,e.plugins),i=new rr(r);return r.fields.forEach(s=>{if(s.name=="doc")i.doc=po.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=ee.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(o)for(let a in o){let c=o[a],d=c.spec.state;if(c.key==s.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){i[s.name]=d.fromJSON.call(c,e,n[a],i);return}}i[s.name]=s.init(e,i)}}),i}}function kf(t,e,n){for(let o in t){let r=t[o];r instanceof Function?r=r.bind(e):o=="handleDOMEvents"&&(r=kf(r,e,{})),n[o]=r}return n}class Se{constructor(e){this.spec=e,this.props={},e.props&&kf(e.props,this,this.props),this.key=e.key?e.key.key:Ef("plugin")}getState(e){return e[this.key]}}const Fa=Object.create(null);function Ef(t){return t in Fa?t+"$"+ ++Fa[t]:(Fa[t]=0,t+"$")}class xe{constructor(e="key"){this.key=Ef(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const bt=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},ei=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let wl=null;const zn=function(t,e,n){let o=wl||(wl=document.createRange());return o.setEnd(t,n??t.nodeValue.length),o.setStart(t,e||0),o},py=function(){wl=null},Fo=function(t,e,n,o){return n&&(Fd(t,e,n,o,-1)||Fd(t,e,n,o,1))},fy=/^(img|br|input|textarea|hr)$/i;function Fd(t,e,n,o,r){for(;;){if(t==n&&e==o)return!0;if(e==(r<0?0:nn(t))){let i=t.parentNode;if(!i||i.nodeType!=1||mi(t)||fy.test(t.nodeName)||t.contentEditable=="false")return!1;e=bt(t)+(r<0?0:1),t=i}else if(t.nodeType==1){if(t=t.childNodes[e+(r<0?-1:0)],t.contentEditable=="false")return!1;e=r<0?nn(t):0}else return!1}}function nn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function hy(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=nn(t)}else if(t.parentNode&&!mi(t))e=bt(t),t=t.parentNode;else return null}}function my(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&&!mi(t))e=bt(t)+1,t=t.parentNode;else return null}}function gy(t,e,n){for(let o=e==0,r=e==nn(t);o||r;){if(t==n)return!0;let i=bt(t);if(t=t.parentNode,!t)return!1;o=o&&i==0,r=r&&i==nn(t)}}function mi(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 sa=function(t){return t.focusNode&&Fo(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function So(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function by(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function yy(t,e,n){if(t.caretPositionFromPoint)try{let o=t.caretPositionFromPoint(e,n);if(o)return{node:o.offsetNode,offset:Math.min(nn(o.offsetNode),o.offset)}}catch{}if(t.caretRangeFromPoint){let o=t.caretRangeFromPoint(e,n);if(o)return{node:o.startContainer,offset:Math.min(nn(o.startContainer),o.startOffset)}}}const Mn=typeof navigator<"u"?navigator:null,Vd=typeof document<"u"?document:null,vo=Mn&&Mn.userAgent||"",Cl=/Edge\/(\d+)/.exec(vo),wf=/MSIE \d/.exec(vo),_l=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(vo),Pt=!!(wf||_l||Cl),fo=wf?document.documentMode:_l?+_l[1]:Cl?+Cl[1]:0,gn=!Pt&&/gecko\/(\d+)/i.test(vo);gn&&+(/Firefox\/(\d+)/.exec(vo)||[0,0])[1];const Sl=!Pt&&/Chrome\/(\d+)/.exec(vo),wt=!!Sl,Cf=Sl?+Sl[1]:0,Mt=!Pt&&!!Mn&&/Apple Computer/.test(Mn.vendor),dr=Mt&&(/Mobile\/\w+/.test(vo)||!!Mn&&Mn.maxTouchPoints>2),tn=dr||(Mn?/Mac/.test(Mn.platform):!1),vy=Mn?/Win/.test(Mn.platform):!1,Un=/Android \d/.test(vo),gi=!!Vd&&"webkitFontSmoothing"in Vd.documentElement.style,ky=gi?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Ey(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 Ln(t,e){return typeof t=="number"?t:t[e]}function wy(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,o=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*o}}function zd(t,e,n){let o=t.someProp("scrollThreshold")||0,r=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let s=n||t.dom;s;s=ei(s)){if(s.nodeType!=1)continue;let a=s,c=a==i.body,d=c?Ey(i):wy(a),u=0,p=0;if(e.top<d.top+Ln(o,"top")?p=-(d.top-e.top+Ln(r,"top")):e.bottom>d.bottom-Ln(o,"bottom")&&(p=e.bottom-e.top>d.bottom-d.top?e.top+Ln(r,"top")-d.top:e.bottom-d.bottom+Ln(r,"bottom")),e.left<d.left+Ln(o,"left")?u=-(d.left-e.left+Ln(r,"left")):e.right>d.right-Ln(o,"right")&&(u=e.right-d.right+Ln(r,"right")),u||p)if(c)i.defaultView.scrollBy(u,p);else{let f=a.scrollLeft,h=a.scrollTop;p&&(a.scrollTop+=p),u&&(a.scrollLeft+=u);let m=a.scrollLeft-f,g=a.scrollTop-h;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}if(c||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function Cy(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),o,r;for(let i=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let a=t.root.elementFromPoint(i,s);if(!a||a==t.dom||!t.dom.contains(a))continue;let c=a.getBoundingClientRect();if(c.top>=n-20){o=a,r=c.top;break}}return{refDOM:o,refTop:r,stack:_f(t.dom)}}function _f(t){let e=[],n=t.ownerDocument;for(let o=t;o&&(e.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),t!=n);o=ei(o));return e}function _y({refDOM:t,refTop:e,stack:n}){let o=t?t.getBoundingClientRect().top:0;Sf(n,o==0?0:o-e)}function Sf(t,e){for(let n=0;n<t.length;n++){let{dom:o,top:r,left:i}=t[n];o.scrollTop!=r+e&&(o.scrollTop=r+e),o.scrollLeft!=i&&(o.scrollLeft=i)}}let Go=null;function Sy(t){if(t.setActive)return t.setActive();if(Go)return t.focus(Go);let e=_f(t);t.focus(Go==null?{get preventScroll(){return Go={preventScroll:!0},!0}}:void 0),Go||(Go=!1,Sf(e,0))}function xf(t,e){let n,o=2e8,r,i=0,s=e.top,a=e.top,c,d;for(let u=t.firstChild,p=0;u;u=u.nextSibling,p++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=zn(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<o){n=u,o=g,r=g&&n.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&g&&(i=p+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!c&&m.left<=e.left&&m.right>=e.left&&(c=u,d={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!n&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(i=p+1)}}return!n&&c&&(n=c,r=d,o=0),n&&n.nodeType==3?xy(n,r):!n||o&&n.nodeType==1?{node:t,offset:i}:xf(n,r)}function xy(t,e){let n=t.nodeValue.length,o=document.createRange();for(let r=0;r<n;r++){o.setEnd(t,r+1),o.setStart(t,r);let i=eo(o,1);if(i.top!=i.bottom&&lc(e,i))return{node:t,offset:r+(e.left>=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}function lc(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Ny(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function Ty(t,e,n){let{node:o,offset:r}=xf(e,n),i=-1;if(o.nodeType==1&&!o.firstChild){let s=o.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(o,r,i)}function Oy(t,e,n,o){let r=-1;for(let i=e,s=!1;i!=t.dom;){let a=t.docView.nearestDesc(i,!0),c;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((c=a.dom.getBoundingClientRect()).width||c.height)&&(a.node.isBlock&&a.parent&&(!s&&c.left>o.left||c.top>o.top?r=a.posBefore:(!s&&c.right<o.left||c.bottom<o.top)&&(r=a.posAfter),s=!0),!a.contentDOM&&r<0&&!a.node.isText))return(a.node.isBlock?o.top<(c.top+c.bottom)/2:o.left<(c.left+c.right)/2)?a.posBefore:a.posAfter;i=a.dom.parentNode}return r>-1?r:t.docView.posFromDOM(e,n,-1)}function Nf(t,e,n){let o=t.childNodes.length;if(o&&n.top<n.bottom)for(let r=Math.max(0,Math.min(o-1,Math.floor(o*(e.top-n.top)/(n.bottom-n.top))-2)),i=r;;){let s=t.childNodes[i];if(s.nodeType==1){let a=s.getClientRects();for(let c=0;c<a.length;c++){let d=a[c];if(lc(e,d))return Nf(s,e,d)}}if((i=(i+1)%o)==r)break}return t}function My(t,e){let n=t.dom.ownerDocument,o,r=0,i=yy(n,e.left,e.top);i&&({node:o,offset:r}=i);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 d=t.dom.getBoundingClientRect();if(!lc(e,d)||(s=Nf(t.dom,e,d),!s))return null}if(Mt)for(let d=s;o&&d;d=ei(d))d.draggable&&(o=void 0);if(s=Ny(s,e),o){if(gn&&o.nodeType==1&&(r=Math.min(r,o.childNodes.length),r<o.childNodes.length)){let u=o.childNodes[r],p;u.nodeName=="IMG"&&(p=u.getBoundingClientRect()).right<=e.left&&p.bottom>e.top&&r++}let d;gi&&r&&o.nodeType==1&&(d=o.childNodes[r-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=e.top&&r--,o==t.dom&&r==o.childNodes.length-1&&o.lastChild.nodeType==1&&e.top>o.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(r==0||o.nodeType!=1||o.childNodes[r-1].nodeName!="BR")&&(a=Oy(t,o,r,e))}a==null&&(a=Ty(t,s,e));let c=t.docView.nearestDesc(s,!0);return{pos:a,inside:c?c.posAtStart-c.border:-1}}function Hd(t){return t.top<t.bottom||t.left<t.right}function eo(t,e){let n=t.getClientRects();if(n.length){let o=n[e<0?0:n.length-1];if(Hd(o))return o}return Array.prototype.find.call(n,Hd)||t.getBoundingClientRect()}const Ay=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Tf(t,e,n){let{node:o,offset:r,atom:i}=t.docView.domFromPos(e,n<0?-1:1),s=gi||gn;if(o.nodeType==3)if(s&&(Ay.test(o.nodeValue)||(n<0?!r:r==o.nodeValue.length))){let c=eo(zn(o,r,r),n);if(gn&&r&&/\s/.test(o.nodeValue[r-1])&&r<o.nodeValue.length){let d=eo(zn(o,r-1,r-1),-1);if(d.top==c.top){let u=eo(zn(o,r,r+1),-1);if(u.top!=c.top)return Tr(u,u.left<d.left)}}return c}else{let c=r,d=r,u=n<0?1:-1;return n<0&&!r?(d++,u=-1):n>=0&&r==o.nodeValue.length?(c--,u=1):n<0?c--:d++,Tr(eo(zn(o,c,d),u),u<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&r&&(n<0||r==nn(o))){let c=o.childNodes[r-1];if(c.nodeType==1)return Va(c.getBoundingClientRect(),!1)}if(i==null&&r<nn(o)){let c=o.childNodes[r];if(c.nodeType==1)return Va(c.getBoundingClientRect(),!0)}return Va(o.getBoundingClientRect(),n>=0)}if(i==null&&r&&(n<0||r==nn(o))){let c=o.childNodes[r-1],d=c.nodeType==3?zn(c,nn(c)-(s?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(d)return Tr(eo(d,1),!1)}if(i==null&&r<nn(o)){let c=o.childNodes[r];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let d=c?c.nodeType==3?zn(c,0,s?0:1):c.nodeType==1?c:null:null;if(d)return Tr(eo(d,-1),!0)}return Tr(eo(o.nodeType==3?zn(o):o,-n),n>=0)}function Tr(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 Va(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 Of(t,e,n){let o=t.state,r=t.root.activeElement;o!=e&&t.updateState(e),r!=t.dom&&t.focus();try{return n()}finally{o!=e&&t.updateState(o),r!=t.dom&&r&&r.focus()}}function Ry(t,e,n){let o=e.selection,r=n=="up"?o.$from:o.$to;return Of(t,e,()=>{let{node:i}=t.docView.domFromPos(r.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode}let s=Tf(t,r.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let c;if(a.nodeType==1)c=a.getClientRects();else if(a.nodeType==3)c=zn(a,0,a.nodeValue.length).getClientRects();else continue;for(let d=0;d<c.length;d++){let u=c[d];if(u.bottom>u.top+1&&(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 Dy=/[\u0590-\u08ac]/;function Iy(t,e,n){let{$head:o}=e.selection;if(!o.parent.isTextblock)return!1;let r=o.parentOffset,i=!r,s=r==o.parent.content.size,a=t.domSelection();return a?!Dy.test(o.parent.textContent)||!a.modify?n=="left"||n=="backward"?i:s:Of(t,e,()=>{let{focusNode:c,focusOffset:d,anchorNode:u,anchorOffset:p}=t.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",n,"character");let h=o.depth?t.docView.domAfterPos(o.before()):t.dom,{focusNode:m,focusOffset:g}=t.domSelectionRange(),b=m&&!h.contains(m.nodeType==1?m:m.parentNode)||c==m&&d==g;try{a.collapse(u,p),c&&(c!=u||d!=p)&&a.extend&&a.extend(c,d)}catch{}return f!=null&&(a.caretBidiLevel=f),b}):o.pos==o.start()||o.pos==o.end()}let Ud=null,qd=null,Wd=!1;function By(t,e,n){return Ud==e&&qd==n?Wd:(Ud=e,qd=n,Wd=n=="up"||n=="down"?Ry(t,e,n):Iy(t,e,n))}const on=0,Kd=1,No=2,An=3;class bi{constructor(e,n,o,r){this.parent=e,this.children=n,this.dom=o,this.contentDOM=r,this.dirty=on,o.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,o){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,o=this.posAtStart;;n++){let r=this.children[n];if(r==e)return o;o+=r.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,o){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(o<0){let i,s;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=n>bt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!1;break}if(i.previousSibling)break}if(r==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!0;break}if(i.nextSibling)break}}return r??o>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let o=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),s;if(i&&(!n||i.node))if(o&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))o=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let o=n;o;o=o.parent)if(o==this)return n}posFromDOM(e,n,o){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,n,o)}return-1}descAt(e){for(let n=0,o=0;n<this.children.length;n++){let r=this.children[n],i=o+r.size;if(o==e&&i!=o){for(;!r.border&&r.children.length;)for(let s=0;s<r.children.length;s++){let a=r.children[s];if(a.size){r=a;break}}return r}if(e<i)return r.descAt(e-o-r.border);o=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let o=0,r=0;for(let i=0;o<this.children.length;o++){let s=this.children[o],a=i+s.size;if(a>e||s instanceof Af){r=e-i;break}i=a}if(r)return this.children[o].domFromPos(r-this.children[o].border,n);for(let i;o&&!(i=this.children[o-1]).size&&i instanceof Mf&&i.side>=0;o--);if(n<=0){let i,s=!0;for(;i=o?this.children[o-1]:null,!(!i||i.dom.parentNode==this.contentDOM);o--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?bt(i.dom)+1:0}}else{let i,s=!0;for(;i=o<this.children.length?this.children[o]:null,!(!i||i.dom.parentNode==this.contentDOM);o++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?bt(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,o=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let s=o,a=0;;a++){let c=this.children[a],d=s+c.size;if(r==-1&&e<=d){let u=s+c.border;if(e>=u&&n<=d-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,n,u);e=s;for(let p=a;p>0;p--){let f=this.children[p-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){r=bt(f.dom)+1;break}e-=f.size}r==-1&&(r=0)}if(r>-1&&(d>n||a==this.children.length-1)){n=d;for(let u=a+1;u<this.children.length;u++){let p=this.children[u];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(-1)){i=bt(p.dom);break}n+=p.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=d}return{node:this.contentDOM,from:e,to:n,fromOffset:r,toOffset:i}}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:o}=this.domFromPos(e,0);if(n.nodeType!=1||o==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[o]}setSelection(e,n,o,r=!1){let i=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],b=m+g.size;if(i>m&&s<b)return g.setSelection(e-m-g.border,n-m-g.border,o,r);m=b}let a=this.domFromPos(e,e?-1:1),c=n==e?a:this.domFromPos(n,n?-1:1),d=o.root.getSelection(),u=o.domSelectionRange(),p=!1;if((gn||Mt)&&e==n){let{node:h,offset:m}=a;if(h.nodeType==3){if(p=!!(m&&h.nodeValue[m-1]==`
9
- `),p&&m==h.nodeValue.length)for(let g=h,b;g;g=g.parentNode){if(b=g.nextSibling){b.nodeName=="BR"&&(a=c={node:b.parentNode,offset:bt(b)+1});break}let y=g.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let g=h.childNodes[m-1];p=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(gn&&u.focusNode&&u.focusNode!=c.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(r=!0)}if(!(r||p&&Mt)&&Fo(a.node,a.offset,u.anchorNode,u.anchorOffset)&&Fo(c.node,c.offset,u.focusNode,u.focusOffset))return;let f=!1;if((d.extend||e==n)&&!p){d.collapse(a.node,a.offset);try{e!=n&&d.extend(c.node,c.offset),f=!0}catch{}}if(!f){if(e>n){let m=a;a=c,c=m}let h=document.createRange();h.setEnd(c.node,c.offset),h.setStart(a.node,a.offset),d.removeAllRanges(),d.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let o=0,r=0;r<this.children.length;r++){let i=this.children[r],s=o+i.size;if(o==s?e<=s&&n>=o:e<s&&n>o){let a=o+i.border,c=s-i.border;if(e>=a&&n<=c){this.dirty=e==o||n==s?No:Kd,e==a&&n==c&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=An:i.markDirty(e-a,n-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?No:An}o=s}this.dirty=No}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let o=e==1?No:Kd;n.dirty<o&&(n.dirty=o)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class Mf extends bi{constructor(e,n,o,r){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(o,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!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,i=this}matchesWidget(e){return this.dirty==on&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class Ly extends bi{constructor(e,n,o,r){super(e,[],n,null),this.textDOM=o,this.text=r}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 Vo extends bi{constructor(e,n,o,r,i){super(e,[],o,r),this.mark=n,this.spec=i}static create(e,n,o,r){let i=r.nodeViews[n.type.name],s=i&&i(n,r,o);return(!s||!s.dom)&&(s=qo.renderSpec(document,n.type.spec.toDOM(n,o),null,n.attrs)),new Vo(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&An||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=An&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=on){let o=this.parent;for(;!o.node;)o=o.parent;o.dirty<this.dirty&&(o.dirty=this.dirty),this.dirty=on}}slice(e,n,o){let r=Vo.create(this.parent,this.mark,!0,o),i=this.children,s=this.size;n<s&&(i=Nl(i,n,s,o)),e>0&&(i=Nl(i,0,e,o));for(let a=0;a<i.length;a++)i[a].parent=r;return r.children=i,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class ho extends bi{constructor(e,n,o,r,i,s,a,c,d){super(e,[],i,s),this.node=n,this.outerDeco=o,this.innerDeco=r,this.nodeDOM=a}static create(e,n,o,r,i,s){let a=i.nodeViews[n.type.name],c,d=a&&a(n,i,()=>{if(!c)return s;if(c.parent)return c.parent.posBeforeChild(c)},o,r),u=d&&d.dom,p=d&&d.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:p}=qo.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!p&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=If(u,o,n),d?c=new Py(e,n,o,r,u,p||null,f,d,i,s+1):n.isText?new aa(e,n,o,r,u,f,i):new ho(e,n,o,r,u,p||null,f,i,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 o=this.children[n];if(this.dom.contains(o.dom.parentNode)){e.contentElement=o.dom.parentNode;break}}e.contentElement||(e.getContent=()=>T.empty)}return e}matchesNode(e,n,o){return this.dirty==on&&e.eq(this.node)&&fs(n,this.outerDeco)&&o.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let o=this.node.inlineContent,r=n,i=e.composing?this.localCompositionInfo(e,n):null,s=i&&i.pos>-1?i:null,a=i&&i.pos<0,c=new Fy(this,s&&s.node,e);Hy(this.node,this.innerDeco,(d,u,p)=>{d.spec.marks?c.syncToMarks(d.spec.marks,o,e):d.type.side>=0&&!p&&c.syncToMarks(u==this.node.childCount?$e.none:this.node.child(u).marks,o,e),c.placeWidget(d,e,r)},(d,u,p,f)=>{c.syncToMarks(d.marks,o,e);let h;c.findNodeMatch(d,u,p,f)||a&&e.state.selection.from>r&&e.state.selection.to<r+d.nodeSize&&(h=c.findIndexWithChild(i.node))>-1&&c.updateNodeAt(d,u,p,h,e)||c.updateNextNode(d,u,p,e,f,r)||c.addNode(d,u,p,e,r),r+=d.nodeSize}),c.syncToMarks([],o,e),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==No)&&(s&&this.protectLocalComposition(e,s),Rf(this.contentDOM,this.children,e),dr&&Uy(this.dom))}localCompositionInfo(e,n){let{from:o,to:r}=e.state.selection;if(!(e.state.selection instanceof J)||o<n||r>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,a=qy(this.node.content,s,o-n,r-n);return a<0?null:{node:i,pos:a,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:o,text:r}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new Ly(this,i,n,r);e.input.compositionNodes.push(s),this.children=Nl(this.children,o,o+r.length,e,s)}update(e,n,o,r){return this.dirty==An||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,o,r),!0)}updateInner(e,n,o,r){this.updateOuterDeco(n),this.node=e,this.innerDeco=o,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=on}updateOuterDeco(e){if(fs(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,o=this.dom;this.dom=Df(this.dom,this.nodeDOM,xl(this.outerDeco,this.node,n),xl(e,this.node,n)),this.dom!=o&&(o.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function jd(t,e,n,o,r){If(o,e,t);let i=new ho(void 0,t,e,n,o,o,o,r,0);return i.contentDOM&&i.updateChildren(r,0),i}class aa extends ho{constructor(e,n,o,r,i,s,a){super(e,n,o,r,i,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,o,r){return this.dirty==An||this.dirty!=on&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=on||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=on,!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,o){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,o)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,o){let r=this.node.cut(e,n),i=document.createTextNode(r.text);return new aa(this.parent,r,this.outerDeco,this.innerDeco,i,i,o)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=An)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Af extends bi{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==on&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Py extends ho{constructor(e,n,o,r,i,s,a,c,d,u){super(e,n,o,r,i,s,a,d,u),this.spec=c}update(e,n,o,r){if(this.dirty==An)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,o);return i&&this.updateInner(e,n,o,r),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,o,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,o,r){this.spec.setSelection?this.spec.setSelection(e,n,o.root):super.setSelection(e,n,o,r)}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 Rf(t,e,n){let o=t.firstChild,r=!1;for(let i=0;i<e.length;i++){let s=e[i],a=s.dom;if(a.parentNode==t){for(;a!=o;)o=Gd(o),r=!0;o=o.nextSibling}else r=!0,t.insertBefore(a,o);if(s instanceof Vo){let c=o?o.previousSibling:t.lastChild;Rf(s.contentDOM,s.children,n),o=c?c.nextSibling:t.firstChild}}for(;o;)o=Gd(o),r=!0;r&&n.trackWrites==t&&(n.trackWrites=null)}const $r=function(t){t&&(this.nodeName=t)};$r.prototype=Object.create(null);const To=[new $r];function xl(t,e,n){if(t.length==0)return To;let o=n?To[0]:new $r,r=[o];for(let i=0;i<t.length;i++){let s=t[i].type.attrs;if(s){s.nodeName&&r.push(o=new $r(s.nodeName));for(let a in s){let c=s[a];c!=null&&(n&&r.length==1&&r.push(o=new $r(e.isInline?"span":"div")),a=="class"?o.class=(o.class?o.class+" ":"")+c:a=="style"?o.style=(o.style?o.style+";":"")+c:a!="nodeName"&&(o[a]=c))}}}return r}function Df(t,e,n,o){if(n==To&&o==To)return e;let r=e;for(let i=0;i<o.length;i++){let s=o[i],a=n[i];if(i){let c;a&&a.nodeName==s.nodeName&&r!=t&&(c=r.parentNode)&&c.nodeName.toLowerCase()==s.nodeName||(c=document.createElement(s.nodeName),c.pmIsDeco=!0,c.appendChild(r),a=To[0]),r=c}$y(r,a||To[0],s)}return r}function $y(t,e,n){for(let o in e)o!="class"&&o!="style"&&o!="nodeName"&&!(o in n)&&t.removeAttribute(o);for(let o in n)o!="class"&&o!="style"&&o!="nodeName"&&n[o]!=e[o]&&t.setAttribute(o,n[o]);if(e.class!=n.class){let o=e.class?e.class.split(" ").filter(Boolean):[],r=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&t.classList.remove(o[i]);for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&t.classList.add(r[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let o=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=o.exec(e.style);)t.style.removeProperty(r[1])}n.style&&(t.style.cssText+=n.style)}}function If(t,e,n){return Df(t,t,To,xl(e,n,t.nodeType!=1))}function fs(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 Gd(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Fy{constructor(e,n,o){this.lock=n,this.view=o,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Vy(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let o=e;o<n;o++)this.top.children[o].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,o){let r=0,i=this.stack.length>>1,s=Math.min(i,e.length);for(;r<s&&(r==i-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&e[r].type.spec.spanning!==!1;)r++;for(;r<i;)this.destroyRest(),this.top.dirty=on,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let c=this.index;c<Math.min(this.index+3,this.top.children.length);c++){let d=this.top.children[c];if(d.matchesMark(e[i])&&!this.isLocked(d.dom)){a=c;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let c=Vo.create(this.top,e[i],n,o);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,i++}}findNodeMatch(e,n,o,r){let i=-1,s;if(r>=this.preMatch.index&&(s=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,o))i=this.top.children.indexOf(s,this.index);else for(let a=this.index,c=Math.min(this.top.children.length,a+5);a<c;a++){let d=this.top.children[a];if(d.matchesNode(e,n,o)&&!this.preMatch.matched.has(d)){i=a;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,o,r,i){let s=this.top.children[r];return s.dirty==An&&s.dom==s.contentDOM&&(s.dirty=No),s.update(e,n,o,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let o=e.pmViewDesc;if(o){for(let r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==o)return r}return-1}e=n}}updateNextNode(e,n,o,r,i,s){for(let a=this.index;a<this.top.children.length;a++){let c=this.top.children[a];if(c instanceof ho){let d=this.preMatch.matched.get(c);if(d!=null&&d!=i)return!1;let u=c.dom,p,f=this.isLocked(u)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=An&&fs(n,c.outerDeco));if(!f&&c.update(e,n,o,r))return this.destroyBetween(this.index,a),c.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(p=this.recreateWrapper(c,e,n,o,r,s)))return this.destroyBetween(this.index,a),this.top.children[this.index]=p,p.contentDOM&&(p.dirty=No,p.updateChildren(r,s+1),p.dirty=on),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,o,r,i,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!fs(o,e.outerDeco)||!r.eq(e.innerDeco))return null;let a=ho.create(this.top,n,o,r,i,s);if(a.contentDOM){a.children=e.children,e.children=[];for(let c of a.children)c.parent=a}return e.destroy(),a}addNode(e,n,o,r,i){let s=ho.create(this.top,e,n,o,r,i);s.contentDOM&&s.updateChildren(r,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,o){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let i=new Mf(this.top,e,n,o);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Vo;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof aa)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Mt||wt)&&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 o=document.createElement(e);e=="IMG"&&(o.className="ProseMirror-separator",o.alt=""),e=="BR"&&(o.className="ProseMirror-trailingBreak");let r=new Af(this.top,[],o,null);n!=this.top?n.children.push(r):n.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Vy(t,e){let n=e,o=n.children.length,r=t.childCount,i=new Map,s=[];e:for(;r>0;){let a;for(;;)if(o){let d=n.children[o-1];if(d instanceof Vo)n=d,o=d.children.length;else{a=d,o--;break}}else{if(n==e)break e;o=n.parent.children.indexOf(n),n=n.parent}let c=a.node;if(c){if(c!=t.child(r-1))break;--r,i.set(a,r),s.push(a)}}return{index:r,matched:i,matches:s.reverse()}}function zy(t,e){return t.type.side-e.type.side}function Hy(t,e,n,o){let r=e.locals(t),i=0;if(r.length==0){for(let d=0;d<t.childCount;d++){let u=t.child(d);o(u,r,e.forChild(i,u),d),i+=u.nodeSize}return}let s=0,a=[],c=null;for(let d=0;;){let u,p;for(;s<r.length&&r[s].to==i;){let b=r[s++];b.widget&&(u?(p||(p=[u])).push(b):u=b)}if(u)if(p){p.sort(zy);for(let b=0;b<p.length;b++)n(p[b],d,!!c)}else n(u,d,!!c);let f,h;if(c)h=-1,f=c,c=null;else if(d<t.childCount)h=d,f=t.child(d++);else break;for(let b=0;b<a.length;b++)a[b].to<=i&&a.splice(b--,1);for(;s<r.length&&r[s].from<=i&&r[s].to>i;)a.push(r[s++]);let m=i+f.nodeSize;if(f.isText){let b=m;s<r.length&&r[s].from<b&&(b=r[s].from);for(let y=0;y<a.length;y++)a[y].to<b&&(b=a[y].to);b<m&&(c=f.cut(b-i),f=f.cut(0,b-i),m=b,h=-1)}else for(;s<r.length&&r[s].to<m;)s++;let g=f.isInline&&!f.isLeaf?a.filter(b=>!b.inline):a.slice();o(f,g,e.forChild(i,f),h),i=m}}function Uy(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 qy(t,e,n,o){for(let r=0,i=0;r<t.childCount&&i<=o;){let s=t.child(r++),a=i;if(i+=s.nodeSize,!s.isText)continue;let c=s.text;for(;r<t.childCount;){let d=t.child(r++);if(i+=d.nodeSize,!d.isText)break;c+=d.text}if(i>=n){if(i>=o&&c.slice(o-e.length-a,o-a)==e)return o-e.length;let d=a<o?c.lastIndexOf(e,o-a-1):-1;if(d>=0&&d+e.length+a>=n)return a+d;if(n==o&&c.length>=o+e.length-a&&c.slice(o-a,o-a+e.length)==e)return o}}return-1}function Nl(t,e,n,o,r){let i=[];for(let s=0,a=0;s<t.length;s++){let c=t[s],d=a,u=a+=c.size;d>=n||u<=e?i.push(c):(d<e&&i.push(c.slice(0,e-d,o)),r&&(i.push(r),r=void 0),u>n&&i.push(c.slice(n-d,c.size,o)))}return i}function cc(t,e=null){let n=t.domSelectionRange(),o=t.state.doc;if(!n.focusNode)return null;let r=t.docView.nearestDesc(n.focusNode),i=r&&r.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a=o.resolve(s),c,d;if(sa(n)){for(c=s;r&&!r.node;)r=r.parent;let p=r.node;if(r&&p.isAtom&&G.isSelectable(p)&&r.parent&&!(p.isInline&&gy(n.focusNode,n.focusOffset,r.dom))){let f=r.posBefore;d=new G(s==f?a:o.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let p=s,f=s;for(let h=0;h<n.rangeCount;h++){let m=n.getRangeAt(h);p=Math.min(p,t.docView.posFromDOM(m.startContainer,m.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(p<0)return null;[c,s]=f==t.state.selection.anchor?[f,p]:[p,f],a=o.resolve(s)}else c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let u=o.resolve(c);if(!d){let p=e=="pointer"||t.state.selection.head<a.pos&&!i?1:-1;d=dc(t,u,a,p)}return d}function Bf(t){return t.editable?t.hasFocus():Pf(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Kn(t,e=!1){let n=t.state.selection;if(Lf(t,n),!!Bf(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&wt){let o=t.domSelectionRange(),r=t.domObserver.currentSelection;if(o.anchorNode&&r.anchorNode&&Fo(o.anchorNode,o.anchorOffset,r.anchorNode,r.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)Ky(t);else{let{anchor:o,head:r}=n,i,s;Yd&&!(n instanceof J)&&(n.$from.parent.inlineContent||(i=Jd(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=Jd(t,n.to))),t.docView.setSelection(o,r,t,e),Yd&&(i&&Xd(i),s&&Xd(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Wy(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Yd=Mt||wt&&Cf<63;function Jd(t,e){let{node:n,offset:o}=t.docView.domFromPos(e,0),r=o<n.childNodes.length?n.childNodes[o]:null,i=o?n.childNodes[o-1]:null;if(Mt&&r&&r.contentEditable=="false")return za(r);if((!r||r.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(r)return za(r);if(i)return za(i)}}function za(t){return t.contentEditable="true",Mt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Xd(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Wy(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),o=n.anchorNode,r=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=o||n.anchorOffset!=r)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Bf(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Ky(t){let e=t.domSelection(),n=document.createRange();if(!e)return;let o=t.cursorWrapper.dom,r=o.nodeName=="IMG";r?n.setStart(o.parentNode,bt(o)+1):n.setStart(o,0),n.collapse(!0),e.removeAllRanges(),e.addRange(n),!r&&!t.state.selection.visible&&Pt&&fo<=11&&(o.disabled=!0,o.disabled=!1)}function Lf(t,e){if(e instanceof G){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Zd(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Zd(t)}function Zd(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function dc(t,e,n,o){return t.someProp("createSelectionBetween",r=>r(t,e,n))||J.between(e,n,o)}function Qd(t){return t.editable&&!t.hasFocus()?!1:Pf(t)}function Pf(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 jy(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Fo(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Tl(t,e){let{$anchor:n,$head:o}=t.selection,r=e>0?n.max(o):n.min(o),i=r.parent.inlineContent?r.depth?t.doc.resolve(e>0?r.after():r.before()):null:r;return i&&ee.findFrom(i,e)}function to(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function eu(t,e,n){let o=t.state.selection;if(o instanceof J)if(n.indexOf("s")>-1){let{$head:r}=o,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=t.state.doc.resolve(r.pos+i.nodeSize*(e<0?-1:1));return to(t,new J(o.$anchor,s))}else if(o.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let r=Tl(t.state,e);return r&&r instanceof G?to(t,r):!1}else if(!(tn&&n.indexOf("m")>-1)){let r=o.$head,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter,s;if(!i||i.isText)return!1;let a=e<0?r.pos-i.nodeSize:r.pos;return i.isAtom||(s=t.docView.descAt(a))&&!s.contentDOM?G.isSelectable(i)?to(t,new G(e<0?t.state.doc.resolve(r.pos-i.nodeSize):r)):gi?to(t,new J(t.state.doc.resolve(e<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(o instanceof G&&o.node.isInline)return to(t,new J(e>0?o.$to:o.$from));{let r=Tl(t.state,e);return r?to(t,r):!1}}}function hs(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Fr(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Yo(t,e){return e<0?Gy(t):Yy(t)}function Gy(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let r,i,s=!1;for(gn&&n.nodeType==1&&o<hs(n)&&Fr(n.childNodes[o],-1)&&(s=!0);;)if(o>0){if(n.nodeType!=1)break;{let a=n.childNodes[o-1];if(Fr(a,-1))r=n,i=--o;else if(a.nodeType==3)n=a,o=n.nodeValue.length;else break}}else{if($f(n))break;{let a=n.previousSibling;for(;a&&Fr(a,-1);)r=n.parentNode,i=bt(a),a=a.previousSibling;if(a)n=a,o=hs(n);else{if(n=n.parentNode,n==t.dom)break;o=0}}}s?Ol(t,n,o):r&&Ol(t,r,i)}function Yy(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let r=hs(n),i,s;for(;;)if(o<r){if(n.nodeType!=1)break;let a=n.childNodes[o];if(Fr(a,1))i=n,s=++o;else break}else{if($f(n))break;{let a=n.nextSibling;for(;a&&Fr(a,1);)i=a.parentNode,s=bt(a)+1,a=a.nextSibling;if(a)n=a,o=0,r=hs(n);else{if(n=n.parentNode,n==t.dom)break;o=r=0}}}i&&Ol(t,i,s)}function $f(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Jy(t,e){for(;t&&e==t.childNodes.length&&!mi(t);)e=bt(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 Xy(t,e){for(;t&&!e&&!mi(t);)e=bt(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 Ol(t,e,n){if(e.nodeType!=3){let i,s;(s=Jy(e,n))?(e=s,n=0):(i=Xy(e,n))&&(e=i,n=i.nodeValue.length)}let o=t.domSelection();if(!o)return;if(sa(o)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),o.removeAllRanges(),o.addRange(i)}else o.extend&&o.extend(e,n);t.domObserver.setCurSelection();let{state:r}=t;setTimeout(()=>{t.state==r&&Kn(t)},50)}function tu(t,e){let n=t.state.doc.resolve(e);if(!(wt||vy)&&n.parent.inlineContent){let r=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(i.left-r.left)>1)return i.left<r.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),s=(i.top+i.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(i.left-r.left)>1)return i.left>r.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function nu(t,e,n){let o=t.state.selection;if(o instanceof J&&!o.empty||n.indexOf("s")>-1||tn&&n.indexOf("m")>-1)return!1;let{$from:r,$to:i}=o;if(!r.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=Tl(t.state,e);if(s&&s instanceof G)return to(t,s)}if(!r.parent.inlineContent){let s=e<0?r:i,a=o instanceof jt?ee.near(s,e):ee.findFrom(s,e);return a?to(t,a):!1}return!1}function ou(t,e){if(!(t.state.selection instanceof J))return!0;let{$head:n,$anchor:o,empty:r}=t.state.selection;if(!n.sameParent(o))return!0;if(!r)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=t.state.tr;return e<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),t.dispatch(s),!0}return!1}function ru(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Zy(t){if(!Mt||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 o=e.firstChild;ru(t,o,"true"),setTimeout(()=>ru(t,o,"false"),20)}return!1}function Qy(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function ev(t,e){let n=e.keyCode,o=Qy(e);if(n==8||tn&&n==72&&o=="c")return ou(t,-1)||Yo(t,-1);if(n==46&&!e.shiftKey||tn&&n==68&&o=="c")return ou(t,1)||Yo(t,1);if(n==13||n==27)return!0;if(n==37||tn&&n==66&&o=="c"){let r=n==37?tu(t,t.state.selection.from)=="ltr"?-1:1:-1;return eu(t,r,o)||Yo(t,r)}else if(n==39||tn&&n==70&&o=="c"){let r=n==39?tu(t,t.state.selection.from)=="ltr"?1:-1:1;return eu(t,r,o)||Yo(t,r)}else{if(n==38||tn&&n==80&&o=="c")return nu(t,-1,o)||Yo(t,-1);if(n==40||tn&&n==78&&o=="c")return Zy(t)||nu(t,1,o)||Yo(t,1);if(o==(tn?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function uc(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:o,openStart:r,openEnd:i}=e;for(;r>1&&i>1&&o.childCount==1&&o.firstChild.childCount==1;){r--,i--;let h=o.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),o=h.content}let s=t.someProp("clipboardSerializer")||qo.fromSchema(t.state.schema),a=qf(),c=a.createElement("div");c.appendChild(s.serializeFragment(o,{document:a}));let d=c.firstChild,u,p=0;for(;d&&d.nodeType==1&&(u=Uf[d.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let m=a.createElement(u[h]);for(;c.firstChild;)m.appendChild(c.firstChild);c.appendChild(m),p++}d=c.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${r} ${i}${p?` -${p}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
10
-
11
- `);return{dom:c,text:f,slice:e}}function Ff(t,e,n,o,r){let i=r.parent.type.spec.code,s,a;if(!n&&!e)return null;let c=e&&(o||i||!n);if(c){if(t.someProp("transformPastedText",f=>{e=f(e,i||o,t)}),i)return e?new $(T.from(t.state.schema.text(e.replace(/\r\n?/g,`
12
- `))),0,0):$.empty;let p=t.someProp("clipboardTextParser",f=>f(e,r,o,t));if(p)a=p;else{let f=r.marks(),{schema:h}=t.state,m=qo.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let b=s.appendChild(document.createElement("p"));g&&b.appendChild(m.serializeNode(h.text(g,f)))})}}else t.someProp("transformPastedHTML",p=>{n=p(n,t)}),s=rv(n),gi&&iv(s);let d=s&&s.querySelector("[data-pm-slice]"),u=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let p=+u[3];p>0;p--){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")||Pr.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(c||u),context:r,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!tv.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)a=sv(iu(a,+u[1],+u[2]),u[4]);else if(a=$.maxOpen(nv(a.content,r),!0),a.openStart||a.openEnd){let p=0,f=0;for(let h=a.content.firstChild;p<a.openStart&&!h.type.spec.isolating;p++,h=h.firstChild);for(let h=a.content.lastChild;f<a.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);a=iu(a,p,f)}return t.someProp("transformPasted",p=>{a=p(a,t)}),a}const tv=/^(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 nv(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.index(n)),i,s=[];if(t.forEach(a=>{if(!s)return;let c=r.findWrapping(a.type),d;if(!c)return s=null;if(d=s.length&&i.length&&zf(c,i,a,s[s.length-1],0))s[s.length-1]=d;else{s.length&&(s[s.length-1]=Hf(s[s.length-1],i.length));let u=Vf(a,c);s.push(u),r=r.matchType(u.type),i=c}}),s)return T.from(s)}return t}function Vf(t,e,n=0){for(let o=e.length-1;o>=n;o--)t=e[o].create(null,T.from(t));return t}function zf(t,e,n,o,r){if(r<t.length&&r<e.length&&t[r]==e[r]){let i=zf(t,e,n,o.lastChild,r+1);if(i)return o.copy(o.content.replaceChild(o.childCount-1,i));if(o.contentMatchAt(o.childCount).matchType(r==t.length-1?n.type:t[r+1]))return o.copy(o.content.append(T.from(Vf(n,t,r+1))))}}function Hf(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Hf(t.lastChild,e-1)),o=t.contentMatchAt(t.childCount).fillBefore(T.empty,!0);return t.copy(n.append(o))}function Ml(t,e,n,o,r,i){let s=e<0?t.firstChild:t.lastChild,a=s.content;return t.childCount>1&&(i=0),r<o-1&&(a=Ml(a,e,n,o,r+1,i)),r>=n&&(a=e<0?s.contentMatchAt(0).fillBefore(a,i<=r).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(T.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function iu(t,e,n){return e<t.openStart&&(t=new $(Ml(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new $(Ml(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Uf={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 su=null;function qf(){return su||(su=document.implementation.createHTMLDocument("title"))}let Ha=null;function ov(t){let e=window.trustedTypes;return e?(Ha||(Ha=e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Ha.createHTML(t)):t}function rv(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=qf().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(t),r;if((r=o&&Uf[o[1].toLowerCase()])&&(t=r.map(i=>"<"+i+">").join("")+t+r.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=ov(t),r)for(let i=0;i<r.length;i++)n=n.querySelector(r[i])||n;return n}function iv(t){let e=t.querySelectorAll(wt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let o=e[n];o.childNodes.length==1&&o.textContent==" "&&o.parentNode&&o.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),o)}}function sv(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,o;try{o=JSON.parse(e)}catch{return t}let{content:r,openStart:i,openEnd:s}=t;for(let a=o.length-2;a>=0;a-=2){let c=n.nodes[o[a]];if(!c||c.hasRequiredAttrs())break;r=T.from(c.create(o[a+1],r)),i++,s++}return new $(r,i,s)}const At={},Rt={},av={touchstart:!0,touchmove:!0};class lv{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function cv(t){for(let e in At){let n=At[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=o=>{uv(t,o)&&!pc(t,o)&&(t.editable||!(o.type in Rt))&&n(t,o)},av[e]?{passive:!0}:void 0)}Mt&&t.dom.addEventListener("input",()=>null),Al(t)}function co(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function dv(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 Al(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=o=>pc(t,o))})}function pc(t,e){return t.someProp("handleDOMEvents",n=>{let o=n[e.type];return o?o(t,e)||e.defaultPrevented:!1})}function uv(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 pv(t,e){!pc(t,e)&&At[e.type]&&(t.editable||!(e.type in Rt))&&At[e.type](t,e)}Rt.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Kf(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Un&&wt&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),dr&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let o=Date.now();t.input.lastIOSEnter=o,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==o&&(t.someProp("handleKeyDown",r=>r(t,So(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",o=>o(t,n))||ev(t,n)?n.preventDefault():co(t,"key")};Rt.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Rt.keypress=(t,e)=>{let n=e;if(Kf(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||tn&&n.metaKey)return;if(t.someProp("handleKeyPress",r=>r(t,n))){n.preventDefault();return}let o=t.state.selection;if(!(o instanceof J)||!o.$from.sameParent(o.$to)){let r=String.fromCharCode(n.charCode);!/[\r\n]/.test(r)&&!t.someProp("handleTextInput",i=>i(t,o.$from.pos,o.$to.pos,r))&&t.dispatch(t.state.tr.insertText(r).scrollIntoView()),n.preventDefault()}};function la(t){return{left:t.clientX,top:t.clientY}}function fv(t,e){let n=e.x-t.clientX,o=e.y-t.clientY;return n*n+o*o<100}function fc(t,e,n,o,r){if(o==-1)return!1;let i=t.state.doc.resolve(o);for(let s=i.depth+1;s>0;s--)if(t.someProp(e,a=>s>i.depth?a(t,n,i.nodeAfter,i.before(s),r,!0):a(t,n,i.node(s),i.before(s),r,!1)))return!0;return!1}function ar(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let o=t.state.tr.setSelection(e);o.setMeta("pointer",!0),t.dispatch(o)}function hv(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),o=n.nodeAfter;return o&&o.isAtom&&G.isSelectable(o)?(ar(t,new G(n)),!0):!1}function mv(t,e){if(e==-1)return!1;let n=t.state.selection,o,r;n instanceof G&&(o=n.node);let i=t.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let a=s>i.depth?i.nodeAfter:i.node(s);if(G.isSelectable(a)){o&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?r=i.before(n.$from.depth):r=i.before(s);break}}return r!=null?(ar(t,G.create(t.state.doc,r)),!0):!1}function gv(t,e,n,o,r){return fc(t,"handleClickOn",e,n,o)||t.someProp("handleClick",i=>i(t,e,o))||(r?mv(t,n):hv(t,n))}function bv(t,e,n,o){return fc(t,"handleDoubleClickOn",e,n,o)||t.someProp("handleDoubleClick",r=>r(t,e,o))}function yv(t,e,n,o){return fc(t,"handleTripleClickOn",e,n,o)||t.someProp("handleTripleClick",r=>r(t,e,o))||vv(t,n,o)}function vv(t,e,n){if(n.button!=0)return!1;let o=t.state.doc;if(e==-1)return o.inlineContent?(ar(t,J.create(o,0,o.content.size)),!0):!1;let r=o.resolve(e);for(let i=r.depth+1;i>0;i--){let s=i>r.depth?r.nodeAfter:r.node(i),a=r.before(i);if(s.inlineContent)ar(t,J.create(o,a+1,a+1+s.content.size));else if(G.isSelectable(s))ar(t,G.create(o,a));else continue;return!0}}function hc(t){return ms(t)}const Wf=tn?"metaKey":"ctrlKey";At.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let o=hc(t),r=Date.now(),i="singleClick";r-t.input.lastClick.time<500&&fv(n,t.input.lastClick)&&!n[Wf]&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:r,x:n.clientX,y:n.clientY,type:i};let s=t.posAtCoords(la(n));s&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new kv(t,s,n,!!o)):(i=="doubleClick"?bv:yv)(t,s.pos,s.inside,n)?n.preventDefault():co(t,"pointer"))};class kv{constructor(e,n,o,r){this.view=e,this.pos=n,this.event=o,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!o[Wf],this.allowDefault=o.shiftKey;let i,s;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),s=n.inside;else{let u=e.state.doc.resolve(n.pos);i=u.parent,s=u.depth?u.before():0}const a=r?null:o.target,c=a?e.docView.nearestDesc(a,!0):null;this.target=c&&c.dom.nodeType==1?c.dom:null;let{selection:d}=e.state;(o.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||d instanceof G&&d.from<=s&&d.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&gn&&!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)),co(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(()=>Kn(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(la(e))),this.updateAllowDefault(e),this.allowDefault||!n?co(this.view,"pointer"):gv(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Mt&&this.mightDrag&&!this.mightDrag.node.isAtom||wt&&!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)?(ar(this.view,ee.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):co(this.view,"pointer")}move(e){this.updateAllowDefault(e),co(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)}}At.touchstart=t=>{t.input.lastTouch=Date.now(),hc(t),co(t,"pointer")};At.touchmove=t=>{t.input.lastTouch=Date.now(),co(t,"pointer")};At.contextmenu=t=>hc(t);function Kf(t,e){return t.composing?!0:Mt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const Ev=Un?5e3:-1;Rt.compositionstart=Rt.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof J&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(o=>o.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),ms(t,!0),t.markCursor=null;else if(ms(t,!e.selection.empty),gn&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let o=t.domSelectionRange();for(let r=o.focusNode,i=o.focusOffset;r&&r.nodeType==1&&i!=0;){let s=i<0?r.lastChild:r.childNodes[i-1];if(!s)break;if(s.nodeType==3){let a=t.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else r=s,i=-1}}t.input.composing=!0}jf(t,Ev)};Rt.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,jf(t,20))};function jf(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>ms(t),e))}function Gf(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Cv());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function wv(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=hy(e.focusNode,e.focusOffset),o=my(e.focusNode,e.focusOffset);if(n&&o&&n!=o){let r=o.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||o==i)return i;if(!r||!r.isText(o.nodeValue))return o;if(t.input.compositionNode==o){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return o}}return n||o}function Cv(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function ms(t,e=!1){if(!(Un&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Gf(t),e||t.docView&&t.docView.dirty){let n=cc(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!t.state.selection.empty?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function _v(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 o=getSelection(),r=document.createRange();r.selectNodeContents(e),t.dom.blur(),o.removeAllRanges(),o.addRange(r),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const ti=Pt&&fo<15||dr&&ky<604;At.copy=Rt.cut=(t,e)=>{let n=e,o=t.state.selection,r=n.type=="cut";if(o.empty)return;let i=ti?null:n.clipboardData,s=o.content(),{dom:a,text:c}=uc(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",c)):_v(t,a),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Sv(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function xv(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,o=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus();let r=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),o.parentNode&&o.parentNode.removeChild(o),n?ni(t,o.value,null,r,e):ni(t,o.textContent,o.innerHTML,r,e)},50)}function ni(t,e,n,o,r){let i=Ff(t,e,n,o,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,r,i||$.empty)))return!0;if(!i)return!1;let s=Sv(i),a=s?t.state.tr.replaceSelectionWith(s,o):t.state.tr.replaceSelection(i);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Yf(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," "):""}Rt.paste=(t,e)=>{let n=e;if(t.composing&&!Un)return;let o=ti?null:n.clipboardData,r=t.input.shiftKey&&t.input.lastKeyCode!=45;o&&ni(t,Yf(o),o.getData("text/html"),r,n)?n.preventDefault():xv(t,n)};class Jf{constructor(e,n,o){this.slice=e,this.move=n,this.node=o}}const Xf=tn?"altKey":"ctrlKey";At.dragstart=(t,e)=>{let n=e,o=t.input.mouseDown;if(o&&o.done(),!n.dataTransfer)return;let r=t.state.selection,i=r.empty?null:t.posAtCoords(la(n)),s;if(!(i&&i.pos>=r.from&&i.pos<=(r instanceof G?r.to-1:r.to))){if(o&&o.mightDrag)s=G.create(t.state.doc,o.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let p=t.docView.nearestDesc(n.target,!0);p&&p.node.type.spec.draggable&&p!=t.docView&&(s=G.create(t.state.doc,p.posBefore))}}let a=(s||t.state.selection).content(),{dom:c,text:d,slice:u}=uc(t,a);(!n.dataTransfer.files.length||!wt||Cf>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ti?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",ti||n.dataTransfer.setData("text/plain",d),t.dragging=new Jf(u,!n[Xf],s)};At.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Rt.dragover=Rt.dragenter=(t,e)=>e.preventDefault();Rt.drop=(t,e)=>{let n=e,o=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let r=t.posAtCoords(la(n));if(!r)return;let i=t.state.doc.resolve(r.pos),s=o&&o.slice;s?t.someProp("transformPasted",m=>{s=m(s,t)}):s=Ff(t,Yf(n.dataTransfer),ti?null:n.dataTransfer.getData("text/html"),!1,i);let a=!!(o&&!n[Xf]);if(t.someProp("handleDrop",m=>m(t,n,s||$.empty,a))){n.preventDefault();return}if(!s)return;n.preventDefault();let c=s?hf(t.state.doc,i.pos,s):i.pos;c==null&&(c=i.pos);let d=t.state.tr;if(a){let{node:m}=o;m?m.replace(d):d.deleteSelection()}let u=d.mapping.map(c),p=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,f=d.doc;if(p?d.replaceRangeWith(u,u,s.content.firstChild):d.replaceRange(u,u,s),d.doc.eq(f))return;let h=d.doc.resolve(u);if(p&&G.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))d.setSelection(new G(h));else{let m=d.mapping.map(c);d.mapping.maps[d.mapping.maps.length-1].forEach((g,b,y,k)=>m=k),d.setSelection(dc(t,h,d.doc.resolve(m)))}t.focus(),t.dispatch(d.setMeta("uiEvent","drop"))};At.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())&&Kn(t)},20))};At.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)};At.beforeinput=(t,e)=>{if(wt&&Un&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:o}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=o||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,So(8,"Backspace")))))return;let{$cursor:r}=t.state.selection;r&&r.pos>0&&t.dispatch(t.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let t in Rt)At[t]=Rt[t];function oi(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 gs{constructor(e,n){this.toDOM=e,this.spec=n||Ro,this.side=this.spec.side||0}map(e,n,o,r){let{pos:i,deleted:s}=e.mapResult(n.from+r,this.side<0?-1:1);return s?null:new Ze(i-o,i-o,this)}valid(){return!0}eq(e){return this==e||e instanceof gs&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&oi(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class mo{constructor(e,n){this.attrs=e,this.spec=n||Ro}map(e,n,o,r){let i=e.map(n.from+r,this.spec.inclusiveStart?-1:1)-o,s=e.map(n.to+r,this.spec.inclusiveEnd?1:-1)-o;return i>=s?null:new Ze(i,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof mo&&oi(this.attrs,e.attrs)&&oi(this.spec,e.spec)}static is(e){return e.type instanceof mo}destroy(){}}class mc{constructor(e,n){this.attrs=e,this.spec=n||Ro}map(e,n,o,r){let i=e.mapResult(n.from+r,1);if(i.deleted)return null;let s=e.mapResult(n.to+r,-1);return s.deleted||s.pos<=i.pos?null:new Ze(i.pos-o,s.pos-o,this)}valid(e,n){let{index:o,offset:r}=e.content.findIndex(n.from),i;return r==n.from&&!(i=e.child(o)).isText&&r+i.nodeSize==n.to}eq(e){return this==e||e instanceof mc&&oi(this.attrs,e.attrs)&&oi(this.spec,e.spec)}destroy(){}}class Ze{constructor(e,n,o){this.from=e,this.to=n,this.type=o}copy(e,n){return new Ze(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,o){return this.type.map(e,this,n,o)}static widget(e,n,o){return new Ze(e,e,new gs(n,o))}static inline(e,n,o,r){return new Ze(e,n,new mo(o,r))}static node(e,n,o,r){return new Ze(e,n,new mc(o,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof mo}get widget(){return this.type instanceof gs}}const Qo=[],Ro={};class Me{constructor(e,n){this.local=e.length?e:Qo,this.children=n.length?n:Qo}static create(e,n){return n.length?bs(n,e,0,Ro):Et}find(e,n,o){let r=[];return this.findInner(e??0,n??1e9,r,0,o),r}findInner(e,n,o,r,i){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=n&&a.to>=e&&(!i||i(a.spec))&&o.push(a.copy(a.from+r,a.to+r))}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,o,r+a,i)}}map(e,n,o){return this==Et||e.maps.length==0?this:this.mapInner(e,n,0,0,o||Ro)}mapInner(e,n,o,r,i){let s;for(let a=0;a<this.local.length;a++){let c=this.local[a].map(e,o,r);c&&c.type.valid(n,c)?(s||(s=[])).push(c):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?Nv(this.children,s||[],e,n,o,r,i):s?new Me(s.sort(Do),Qo):Et}add(e,n){return n.length?this==Et?Me.create(e,n):this.addInner(e,n,0):this}addInner(e,n,o){let r,i=0;e.forEach((a,c)=>{let d=c+o,u;if(u=Qf(n,a,d)){for(r||(r=this.children.slice());i<r.length&&r[i]<c;)i+=3;r[i]==c?r[i+2]=r[i+2].addInner(a,u,d+1):r.splice(i,0,c,c+a.nodeSize,bs(u,a,d+1,Ro)),i+=3}});let s=Zf(i?eh(n):n,-o);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||s.splice(a--,1);return new Me(s.length?this.local.concat(s).sort(Do):this.local,r||this.children)}remove(e){return e.length==0||this==Et?this:this.removeInner(e,0)}removeInner(e,n){let o=this.children,r=this.local;for(let i=0;i<o.length;i+=3){let s,a=o[i]+n,c=o[i+1]+n;for(let u=0,p;u<e.length;u++)(p=e[u])&&p.from>a&&p.to<c&&(e[u]=null,(s||(s=[])).push(p));if(!s)continue;o==this.children&&(o=this.children.slice());let d=o[i+2].removeInner(s,a+1);d!=Et?o[i+2]=d:(o.splice(i,3),i-=3)}if(r.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let a=0;a<r.length;a++)r[a].eq(s,n)&&(r==this.local&&(r=this.local.slice()),r.splice(a--,1))}return o==this.children&&r==this.local?this:r.length||o.length?new Me(r,o):Et}forChild(e,n){if(this==Et)return this;if(n.isLeaf)return Me.empty;let o,r;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(o=this.children[a+2]);break}let i=e+1,s=i+n.content.size;for(let a=0;a<this.local.length;a++){let c=this.local[a];if(c.from<s&&c.to>i&&c.type instanceof mo){let d=Math.max(i,c.from)-i,u=Math.min(s,c.to)-i;d<u&&(r||(r=[])).push(c.copy(d,u))}}if(r){let a=new Me(r.sort(Do),Qo);return o?new ro([a,o]):a}return o||Et}eq(e){if(this==e)return!0;if(!(e instanceof Me)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let 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 gc(this.localsInner(e))}localsInner(e){if(this==Et)return Qo;if(e.inlineContent||!this.local.some(mo.is))return this.local;let n=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof mo||n.push(this.local[o]);return n}forEachSet(e){e(this)}}Me.empty=new Me([],[]);Me.removeOverlap=gc;const Et=Me.empty;class ro{constructor(e){this.members=e}map(e,n){const o=this.members.map(r=>r.map(e,n,Ro));return ro.from(o)}forChild(e,n){if(n.isLeaf)return Me.empty;let o=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,n);i!=Et&&(i instanceof ro?o=o.concat(i.members):o.push(i))}return ro.from(o)}eq(e){if(!(e instanceof ro)||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,o=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!n)n=i;else{o&&(n=n.slice(),o=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?gc(o?n:n.sort(Do)):Qo}static from(e){switch(e.length){case 0:return Et;case 1:return e[0];default:return new ro(e.every(n=>n instanceof Me)?e:e.reduce((n,o)=>n.concat(o instanceof Me?o:o.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function Nv(t,e,n,o,r,i,s){let a=t.slice();for(let d=0,u=i;d<n.maps.length;d++){let p=0;n.maps[d].forEach((f,h,m,g)=>{let b=g-m-(h-f);for(let y=0;y<a.length;y+=3){let k=a[y+1];if(k<0||f>k+u-p)continue;let w=a[y]+u-p;h>=w?a[y+1]=f<=w?-2:-1:f>=u&&b&&(a[y]+=b,a[y+1]+=b)}p+=b}),u=n.maps[d].map(u,-1)}let c=!1;for(let d=0;d<a.length;d+=3)if(a[d+1]<0){if(a[d+1]==-2){c=!0,a[d+1]=-1;continue}let u=n.map(t[d]+i),p=u-r;if(p<0||p>=o.content.size){c=!0;continue}let f=n.map(t[d+1]+i,-1),h=f-r,{index:m,offset:g}=o.content.findIndex(p),b=o.maybeChild(m);if(b&&g==p&&g+b.nodeSize==h){let y=a[d+2].mapInner(n,b,u+1,t[d]+i+1,s);y!=Et?(a[d]=p,a[d+1]=h,a[d+2]=y):(a[d+1]=-2,c=!0)}else c=!0}if(c){let d=Tv(a,t,e,n,r,i,s),u=bs(d,o,0,s);e=u.local;for(let p=0;p<a.length;p+=3)a[p+1]<0&&(a.splice(p,3),p-=3);for(let p=0,f=0;p<u.children.length;p+=3){let h=u.children[p];for(;f<a.length&&a[f]<h;)f+=3;a.splice(f,0,u.children[p],u.children[p+1],u.children[p+2])}}return new Me(e.sort(Do),a)}function Zf(t,e){if(!e||!t.length)return t;let n=[];for(let o=0;o<t.length;o++){let r=t[o];n.push(new Ze(r.from+e,r.to+e,r.type))}return n}function Tv(t,e,n,o,r,i,s){function a(c,d){for(let u=0;u<c.local.length;u++){let p=c.local[u].map(o,r,d);p?n.push(p):s.onRemove&&s.onRemove(c.local[u].spec)}for(let u=0;u<c.children.length;u+=3)a(c.children[u+2],c.children[u]+d+1)}for(let c=0;c<t.length;c+=3)t[c+1]==-1&&a(t[c+2],e[c]+i+1);return n}function Qf(t,e,n){if(e.isLeaf)return null;let o=n+e.nodeSize,r=null;for(let i=0,s;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<o&&((r||(r=[])).push(s),t[i]=null);return r}function eh(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function bs(t,e,n,o){let r=[],i=!1;e.forEach((a,c)=>{let d=Qf(t,a,c+n);if(d){i=!0;let u=bs(d,a,n+c+1,o);u!=Et&&r.push(c,c+a.nodeSize,u)}});let s=Zf(i?eh(t):t,-n).sort(Do);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||(o.onRemove&&o.onRemove(s[a].spec),s.splice(a--,1));return s.length||r.length?new Me(s,r):Et}function Do(t,e){return t.from-e.from||t.to-e.to}function gc(t){let e=t;for(let n=0;n<e.length-1;n++){let o=e[n];if(o.from!=o.to)for(let r=n+1;r<e.length;r++){let i=e[r];if(i.from==o.from){i.to!=o.to&&(e==t&&(e=t.slice()),e[r]=i.copy(i.from,o.to),au(e,r+1,i.copy(o.to,i.to)));continue}else{i.from<o.to&&(e==t&&(e=t.slice()),e[n]=o.copy(o.from,i.from),au(e,r,o.copy(i.from,o.to)));break}}}return e}function au(t,e,n){for(;e<t.length&&Do(n,t[e])>0;)e++;t.splice(e,0,n)}function Ua(t){let e=[];return t.someProp("decorations",n=>{let o=n(t.state);o&&o!=Et&&e.push(o)}),t.cursorWrapper&&e.push(Me.create(t.state.doc,[t.cursorWrapper.deco])),ro.from(e)}const Ov={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Mv=Pt&&fo<=11;class Av{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 Rv{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Av,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(o=>{for(let r=0;r<o.length;r++)this.queue.push(o[r]);Pt&&fo<=11&&o.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),Mv&&(this.onCharData=o=>{this.queue.push({target:o.target,type:"characterData",oldValue:o.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,Ov)),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(Qd(this.view)){if(this.suppressingSelectionUpdates)return Kn(this.view);if(Pt&&fo<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Fo(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,o;for(let i=e.focusNode;i;i=ei(i))n.add(i);for(let i=e.anchorNode;i;i=ei(i))if(n.has(i)){o=i;break}let r=o&&this.view.docView.nearestDesc(o);if(r&&r.ignoreMutation({type:"selection",target:o.nodeType==3?o.parentNode:o}))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 o=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(o)&&Qd(e)&&!this.ignoreSelectionChange(o),i=-1,s=-1,a=!1,c=[];if(e.editable)for(let u=0;u<n.length;u++){let p=this.registerMutation(n[u],c);p&&(i=i<0?p.from:Math.min(p.from,i),s=s<0?p.to:Math.max(p.to,s),p.typeOver&&(a=!0))}if(gn&&c.length){let u=c.filter(p=>p.nodeName=="BR");if(u.length==2){let[p,f]=u;p.parentNode&&p.parentNode.parentNode==f.parentNode?f.remove():p.remove()}else{let{focusNode:p}=this.currentSelection;for(let f of u){let h=f.parentNode;h&&h.nodeName=="LI"&&(!p||Bv(e,p)!=h)&&f.remove()}}}let d=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&sa(o)&&(d=cc(e))&&d.eq(ee.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Kn(e),this.currentSelection.set(o)):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,s),Dv(e)),this.handleDOMChange(i,s,a,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(o)||Kn(e),this.currentSelection.set(o))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let o=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(o==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!o||o.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let p=e.addedNodes[u];n.push(p),p.nodeType==3&&(this.lastChangedTextNode=p)}if(o.contentDOM&&o.contentDOM!=o.dom&&!o.contentDOM.contains(e.target))return{from:o.posBefore,to:o.posAfter};let r=e.previousSibling,i=e.nextSibling;if(Pt&&fo<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:p,nextSibling:f}=e.addedNodes[u];(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(r=p),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f)}let s=r&&r.parentNode==e.target?bt(r)+1:0,a=o.localPosFromDOM(e.target,s,-1),c=i&&i.parentNode==e.target?bt(i):e.target.childNodes.length,d=o.localPosFromDOM(e.target,c,1);return{from:a,to:d}}else return e.type=="attributes"?{from:o.posAtStart-o.border,to:o.posAtEnd+o.border}:(this.lastChangedTextNode=e.target,{from:o.posAtStart,to:o.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let lu=new WeakMap,cu=!1;function Dv(t){if(!lu.has(t)&&(lu.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=gn,cu)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."),cu=!0}}function du(t,e){let n=e.startContainer,o=e.startOffset,r=e.endContainer,i=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return Fo(s.node,s.offset,r,i)&&([n,o,r,i]=[r,i,n,o]),{anchorNode:n,anchorOffset:o,focusNode:r,focusOffset:i}}function Iv(t,e){if(e.getComposedRanges){let r=e.getComposedRanges(t.root)[0];if(r)return du(t,r)}let n;function o(r){r.preventDefault(),r.stopImmediatePropagation(),n=r.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",o,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",o,!0),n?du(t,n):null}function Bv(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let o=t.docView.nearestDesc(n,!0);if(o&&o.node.isBlock)return n}return null}function Lv(t,e,n){let{node:o,fromOffset:r,toOffset:i,from:s,to:a}=t.docView.parseRange(e,n),c=t.domSelectionRange(),d,u=c.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(d=[{node:u,offset:c.anchorOffset}],sa(c)||d.push({node:c.focusNode,offset:c.focusOffset})),wt&&t.input.lastKeyCode===8)for(let b=i;b>r;b--){let y=o.childNodes[b-1],k=y.pmViewDesc;if(y.nodeName=="BR"&&!k){i=b;break}if(!k||k.size)break}let p=t.state.doc,f=t.someProp("domParser")||Pr.fromSchema(t.state.schema),h=p.resolve(s),m=null,g=f.parse(o,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:r,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:Pv,context:h});if(d&&d[0].pos!=null){let b=d[0].pos,y=d[1]&&d[1].pos;y==null&&(y=b),m={anchor:b+s,head:y+s}}return{doc:g,sel:m,from:s,to:a}}function Pv(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Mt&&/^(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||Mt&&/^(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 $v=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Fv(t,e,n,o,r){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let M=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,P=cc(t,M);if(P&&!t.state.selection.eq(P)){if(wt&&Un&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",te=>te(t,So(13,"Enter"))))return;let K=t.state.tr.setSelection(P);M=="pointer"?K.setMeta("pointer",!0):M=="key"&&K.scrollIntoView(),i&&K.setMeta("composition",i),t.dispatch(K)}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 c=t.state.selection,d=Lv(t,e,n),u=t.state.doc,p=u.slice(d.from,d.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=Hv(p.content,d.doc.content,d.from,f,h);if(m&&t.input.domChangeCount++,(dr&&t.input.lastIOSEnter>Date.now()-225||Un)&&r.some(M=>M.nodeType==1&&!$v.test(M.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",M=>M(t,So(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(o&&c instanceof J&&!c.empty&&c.$head.sameParent(c.$anchor)&&!t.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(d.sel){let M=uu(t,t.state.doc,d.sel);if(M&&!M.eq(t.state.selection)){let P=t.state.tr.setSelection(M);i&&P.setMeta("composition",i),t.dispatch(P)}}return}t.state.selection.from<t.state.selection.to&&m.start==m.endB&&t.state.selection instanceof J&&(m.start>t.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=d.from?m.start=t.state.selection.from:m.endA<t.state.selection.to&&m.endA>=t.state.selection.to-2&&t.state.selection.to<=d.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),Pt&&fo<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>d.from&&d.doc.textBetween(m.start-d.from-1,m.start-d.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let g=d.doc.resolveNoCache(m.start-d.from),b=d.doc.resolveNoCache(m.endB-d.from),y=u.resolve(m.start),k=g.sameParent(b)&&g.parent.inlineContent&&y.end()>=m.endA,w;if((dr&&t.input.lastIOSEnter>Date.now()-225&&(!k||r.some(M=>M.nodeName=="DIV"||M.nodeName=="P"))||!k&&g.pos<d.doc.content.size&&!g.sameParent(b)&&(w=ee.findFrom(d.doc.resolve(g.pos+1),1,!0))&&w.head==b.pos)&&t.someProp("handleKeyDown",M=>M(t,So(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&zv(u,m.start,m.endA,g,b)&&t.someProp("handleKeyDown",M=>M(t,So(8,"Backspace")))){Un&&wt&&t.domObserver.suppressSelectionUpdates();return}wt&&m.endB==m.start&&(t.input.lastChromeDelete=Date.now()),Un&&!k&&g.start()!=b.start()&&b.parentOffset==0&&g.depth==b.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==m.endA&&(m.endB-=2,b=d.doc.resolveNoCache(m.endB-d.from),setTimeout(()=>{t.someProp("handleKeyDown",function(M){return M(t,So(13,"Enter"))})},20));let v=m.start,_=m.endA,C,A,L;if(k){if(g.pos==b.pos)Pt&&fo<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Kn(t),20)),C=t.state.tr.delete(v,_),A=u.resolve(m.start).marksAcross(u.resolve(m.endA));else if(m.endA==m.endB&&(L=Vv(g.parent.content.cut(g.parentOffset,b.parentOffset),y.parent.content.cut(y.parentOffset,m.endA-y.start()))))C=t.state.tr,L.type=="add"?C.addMark(v,_,L.mark):C.removeMark(v,_,L.mark);else if(g.parent.child(g.index()).isText&&g.index()==b.index()-(b.textOffset?0:1)){let M=g.parent.textBetween(g.parentOffset,b.parentOffset);if(t.someProp("handleTextInput",P=>P(t,v,_,M)))return;C=t.state.tr.insertText(M,v,_)}}if(C||(C=t.state.tr.replace(v,_,d.doc.slice(m.start-d.from,m.endB-d.from))),d.sel){let M=uu(t,C.doc,d.sel);M&&!(wt&&t.composing&&M.empty&&(m.start!=m.endB||t.input.lastChromeDelete<Date.now()-100)&&(M.head==v||M.head==C.mapping.map(_)-1)||Pt&&M.empty&&M.head==v)&&C.setSelection(M)}A&&C.ensureMarks(A),i&&C.setMeta("composition",i),t.dispatch(C.scrollIntoView())}function uu(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:dc(t,e.resolve(n.anchor),e.resolve(n.head))}function Vv(t,e){let n=t.firstChild.marks,o=e.firstChild.marks,r=n,i=o,s,a,c;for(let u=0;u<o.length;u++)r=o[u].removeFromSet(r);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(r.length==1&&i.length==0)a=r[0],s="add",c=u=>u.mark(a.addToSet(u.marks));else if(r.length==0&&i.length==1)a=i[0],s="remove",c=u=>u.mark(a.removeFromSet(u.marks));else return null;let d=[];for(let u=0;u<e.childCount;u++)d.push(c(e.child(u)));if(T.from(d).eq(t))return{mark:a,type:s}}function zv(t,e,n,o,r){if(n-e<=r.pos-o.pos||qa(o,!0,!1)<r.pos)return!1;let i=t.resolve(e);if(!o.parent.isTextblock){let a=i.nodeAfter;return a!=null&&n==e+a.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=t.resolve(qa(i,!0,!0));return!s.parent.isTextblock||s.pos>n||qa(s,!0,!1)<n?!1:o.parent.content.cut(o.parentOffset).eq(s.parent.content)}function qa(t,e,n){let o=t.depth,r=e?t.end():t.pos;for(;o>0&&(e||t.indexAfter(o)==t.node(o).childCount);)o--,r++,e=!1;if(n){let i=t.node(o).maybeChild(t.indexAfter(o));for(;i&&!i.isLeaf;)i=i.firstChild,r++}return r}function Hv(t,e,n,o,r){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:s,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(r=="end"){let c=Math.max(0,i-Math.min(s,a));o-=s+c-i}if(s<i&&t.size<e.size){let c=o<=i&&o>=s?i-o:0;i-=c,i&&i<e.size&&pu(e.textBetween(i-1,i+1))&&(i+=c?1:-1),a=i+(a-s),s=i}else if(a<i){let c=o<=i&&o>=a?i-o:0;i-=c,i&&i<t.size&&pu(t.textBetween(i-1,i+1))&&(i+=c?1:-1),s=i+(s-a),a=i}return{start:i,endA:s,endB:a}}function pu(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 Uv{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 lv,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(bu),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=mu(this),hu(this),this.nodeViews=gu(this),this.docView=jd(this.state.doc,fu(this),Ua(this),this.dom,this),this.domObserver=new Rv(this,(o,r,i,s)=>Fv(this,o,r,i,s)),this.domObserver.start(),cv(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&&Al(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(bu),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let o in this._props)n[o]=this._props[o];n.state=this.state;for(let o in e)n[o]=e[o];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var o;let r=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(Gf(this),s=!0),this.state=e;let a=r.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=gu(this);Wv(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Al(this),this.editable=mu(this),hu(this);let c=Ua(this),d=fu(this),u=r.plugins!=e.plugins&&!r.doc.eq(e.doc)?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",p=i||!this.docView.matchesNode(e.doc,d,c);(p||!e.selection.eq(r.selection))&&(s=!0);let f=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&Cy(this);if(s){this.domObserver.stop();let h=p&&(Pt||wt)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&qv(r.selection,e.selection);if(p){let m=wt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=wv(this)),(i||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=jd(e.doc,d,c,this.dom,this)),m&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&jy(this))?Kn(this,h):(Lf(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),!((o=this.dragging)===null||o===void 0)&&o.node&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&_y(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 G){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&zd(this,n.getBoundingClientRect(),e)}else zd(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 o=this.directPlugins[n];o.spec.view&&this.pluginViews.push(o.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let o=this.state.plugins[n];o.spec.view&&this.pluginViews.push(o.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let o=this.pluginViews[n];o.update&&o.update(this,e)}}updateDraggedNode(e,n){let o=e.node,r=-1;if(this.state.doc.nodeAt(o.from)==o.node)r=o.from;else{let i=o.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==o.node&&(r=i)}this.dragging=new Jf(e.slice,e.move,r<0?void 0:G.create(this.state.doc,r))}someProp(e,n){let o=this._props&&this._props[e],r;if(o!=null&&(r=n?n(o):o))return r;for(let s=0;s<this.directPlugins.length;s++){let a=this.directPlugins[s].props[e];if(a!=null&&(r=n?n(a):a))return r}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let a=i[s].props[e];if(a!=null&&(r=n?n(a):a))return r}}hasFocus(){if(Pt){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&&Sy(this.dom),Kn(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 My(this,e)}coordsAtPos(e,n=1){return Tf(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,o=-1){let r=this.docView.posFromDOM(e,n,o);if(r==null)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,n){return By(this,n||this.state,e)}pasteHTML(e,n){return ni(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return ni(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return uc(this,e)}destroy(){this.docView&&(dv(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Ua(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,py())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return pv(this,e)}dispatch(e){let n=this._props.dispatchTransaction;n?n.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?Mt&&this.root.nodeType===11&&by(this.dom.ownerDocument)==this.dom&&Iv(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function fu(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 o in n)o=="class"?e.class+=" "+n[o]:o=="style"?e.style=(e.style?e.style+";":"")+n[o]:!e[o]&&o!="contenteditable"&&o!="nodeName"&&(e[o]=String(n[o]))}),e.translate||(e.translate="no"),[Ze.node(0,t.state.doc.content.size,e)]}function hu(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:Ze.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function mu(t){return!t.someProp("editable",e=>e(t.state)===!1)}function qv(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 gu(t){let e=Object.create(null);function n(o){for(let r in o)Object.prototype.hasOwnProperty.call(e,r)||(e[r]=o[r])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function Wv(t,e){let n=0,o=0;for(let r in t){if(t[r]!=e[r])return!0;n++}for(let r in e)o++;return n!=o}function bu(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 go={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:"'"},ys={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Kv=typeof navigator<"u"&&/Mac/.test(navigator.platform),jv=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var yt=0;yt<10;yt++)go[48+yt]=go[96+yt]=String(yt);for(var yt=1;yt<=24;yt++)go[yt+111]="F"+yt;for(var yt=65;yt<=90;yt++)go[yt]=String.fromCharCode(yt+32),ys[yt]=String.fromCharCode(yt);for(var Wa in go)ys.hasOwnProperty(Wa)||(ys[Wa]=go[Wa]);function Gv(t){var e=Kv&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||jv&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?ys:go)[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 Yv=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function Jv(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let o,r,i,s;for(let a=0;a<e.length-1;a++){let c=e[a];if(/^(cmd|meta|m)$/i.test(c))s=!0;else if(/^a(lt)?$/i.test(c))o=!0;else if(/^(c|ctrl|control)$/i.test(c))r=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))Yv?s=!0:r=!0;else throw new Error("Unrecognized modifier name: "+c)}return o&&(n="Alt-"+n),r&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function Xv(t){let e=Object.create(null);for(let n in t)e[Jv(n)]=t[n];return e}function Ka(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 Zv(t){return new Se({props:{handleKeyDown:bc(t)}})}function bc(t){let e=Xv(t);return function(n,o){let r=Gv(o),i,s=e[Ka(r,o)];if(s&&s(n.state,n.dispatch,n))return!0;if(r.length==1&&r!=" "){if(o.shiftKey){let a=e[Ka(r,o,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((o.shiftKey||o.altKey||o.metaKey||r.charCodeAt(0)>127)&&(i=go[o.keyCode])&&i!=r){let a=e[Ka(i,o)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}const yc=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function th(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const nh=(t,e,n)=>{let o=th(t,n);if(!o)return!1;let r=vc(o);if(!r){let s=o.blockRange(),a=s&&Er(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)}let i=r.nodeBefore;if(uh(t,r,e,-1))return!0;if(o.parent.content.size==0&&(ur(i,"end")||G.isSelectable(i)))for(let s=o.depth;;s--){let a=ra(t.doc,o.before(s),o.after(s),$.empty);if(a&&a.slice.size<a.to-a.from){if(e){let c=t.tr.step(a);c.setSelection(ur(i,"end")?ee.findFrom(c.doc.resolve(c.mapping.map(r.pos,-1)),-1):G.create(c.doc,r.pos-i.nodeSize)),e(c.scrollIntoView())}return!0}if(s==1||o.node(s-1).childCount>1)break}return i.isAtom&&r.depth==o.depth-1?(e&&e(t.tr.delete(r.pos-i.nodeSize,r.pos).scrollIntoView()),!0):!1},Qv=(t,e,n)=>{let o=th(t,n);if(!o)return!1;let r=vc(o);return r?oh(t,r,e):!1},ek=(t,e,n)=>{let o=ih(t,n);if(!o)return!1;let r=kc(o);return r?oh(t,r,e):!1};function oh(t,e,n){let o=e.nodeBefore,r=o,i=e.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let u=r.lastChild;if(!u)return!1;r=u}let s=e.nodeAfter,a=s,c=e.pos+1;for(;!a.isTextblock;c++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let d=ra(t.doc,i,c,$.empty);if(!d||d.from!=i||d instanceof at&&d.slice.size>=c-i)return!1;if(n){let u=t.tr.step(d);u.setSelection(J.create(u.doc,i)),n(u.scrollIntoView())}return!0}function ur(t,e,n=!1){for(let o=t;o;o=e=="start"?o.firstChild:o.lastChild){if(o.isTextblock)return!0;if(n&&o.childCount!=1)return!1}return!1}const rh=(t,e,n)=>{let{$head:o,empty:r}=t.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):o.parentOffset>0)return!1;i=vc(o)}let s=i&&i.nodeBefore;return!s||!G.isSelectable(s)?!1:(e&&e(t.tr.setSelection(G.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function vc(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 ih(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const sh=(t,e,n)=>{let o=ih(t,n);if(!o)return!1;let r=kc(o);if(!r)return!1;let i=r.nodeAfter;if(uh(t,r,e,1))return!0;if(o.parent.content.size==0&&(ur(i,"start")||G.isSelectable(i))){let s=ra(t.doc,o.before(),o.after(),$.empty);if(s&&s.slice.size<s.to-s.from){if(e){let a=t.tr.step(s);a.setSelection(ur(i,"start")?ee.findFrom(a.doc.resolve(a.mapping.map(r.pos)),1):G.create(a.doc,a.mapping.map(r.pos))),e(a.scrollIntoView())}return!0}}return i.isAtom&&r.depth==o.depth-1?(e&&e(t.tr.delete(r.pos,r.pos+i.nodeSize).scrollIntoView()),!0):!1},ah=(t,e,n)=>{let{$head:o,empty:r}=t.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):o.parentOffset<o.parent.content.size)return!1;i=kc(o)}let s=i&&i.nodeAfter;return!s||!G.isSelectable(s)?!1:(e&&e(t.tr.setSelection(G.create(t.doc,i.pos)).scrollIntoView()),!0)};function kc(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 tk=(t,e)=>{let n=t.selection,o=n instanceof G,r;if(o){if(n.node.isTextblock||!yo(t.doc,n.from))return!1;r=n.from}else if(r=oa(t.doc,n.from,-1),r==null)return!1;if(e){let i=t.tr.join(r);o&&i.setSelection(G.create(i.doc,r-t.doc.resolve(r).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},nk=(t,e)=>{let n=t.selection,o;if(n instanceof G){if(n.node.isTextblock||!yo(t.doc,n.to))return!1;o=n.to}else if(o=oa(t.doc,n.to,1),o==null)return!1;return e&&e(t.tr.join(o).scrollIntoView()),!0},ok=(t,e)=>{let{$from:n,$to:o}=t.selection,r=n.blockRange(o),i=r&&Er(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)},lh=(t,e)=>{let{$head:n,$anchor:o}=t.selection;return!n.parent.type.spec.code||!n.sameParent(o)?!1:(e&&e(t.tr.insertText(`
13
- `).scrollIntoView()),!0)};function Ec(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 rk=(t,e)=>{let{$head:n,$anchor:o}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(o))return!1;let r=n.node(-1),i=n.indexAfter(-1),s=Ec(r.contentMatchAt(i));if(!s||!r.canReplaceWith(i,i,s))return!1;if(e){let a=n.after(),c=t.tr.replaceWith(a,a,s.createAndFill());c.setSelection(ee.near(c.doc.resolve(a),1)),e(c.scrollIntoView())}return!0},ch=(t,e)=>{let n=t.selection,{$from:o,$to:r}=n;if(n instanceof jt||o.parent.inlineContent||r.parent.inlineContent)return!1;let i=Ec(r.parent.contentMatchAt(r.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!o.parentOffset&&r.index()<r.parent.childCount?o:r).pos,a=t.tr.insert(s,i.createAndFill());a.setSelection(J.create(a.doc,s+1)),e(a.scrollIntoView())}return!0},dh=(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 i=n.before();if(Wn(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let o=n.blockRange(),r=o&&Er(o);return r==null?!1:(e&&e(t.tr.lift(o,r).scrollIntoView()),!0)};function ik(t){return(e,n)=>{let{$from:o,$to:r}=e.selection;if(e.selection instanceof G&&e.selection.node.isBlock)return!o.parentOffset||!Wn(e.doc,o.pos)?!1:(n&&n(e.tr.split(o.pos).scrollIntoView()),!0);if(!o.depth)return!1;let i=[],s,a,c=!1,d=!1;for(let h=o.depth;;h--)if(o.node(h).isBlock){c=o.end(h)==o.pos+(o.depth-h),d=o.start(h)==o.pos-(o.depth-h),a=Ec(o.node(h-1).contentMatchAt(o.indexAfter(h-1))),i.unshift(c&&a?{type:a}:null),s=h;break}else{if(h==1)return!1;i.unshift(null)}let u=e.tr;(e.selection instanceof J||e.selection instanceof jt)&&u.deleteSelection();let p=u.mapping.map(o.pos),f=Wn(u.doc,p,i.length,i);if(f||(i[0]=a?{type:a}:null,f=Wn(u.doc,p,i.length,i)),u.split(p,i.length,i),!c&&d&&o.node(s).type!=a){let h=u.mapping.map(o.before(s)),m=u.doc.resolve(h);a&&o.node(s-1).canReplaceWith(m.index(),m.index()+1,a)&&u.setNodeMarkup(u.mapping.map(o.before(s)),a)}return n&&n(u.scrollIntoView()),!0}}const sk=ik(),ak=(t,e)=>{let{$from:n,to:o}=t.selection,r,i=n.sharedDepth(o);return i==0?!1:(r=n.before(i),e&&e(t.tr.setSelection(G.create(t.doc,r))),!0)};function lk(t,e,n){let o=e.nodeBefore,r=e.nodeAfter,i=e.index();return!o||!r||!o.type.compatibleContent(r.type)?!1:!o.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-o.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(r.isTextblock||yo(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function uh(t,e,n,o){let r=e.nodeBefore,i=e.nodeAfter,s,a,c=r.type.spec.isolating||i.type.spec.isolating;if(!c&&lk(t,e,n))return!0;let d=!c&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(s=(a=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&a.matchType(s[0]||i.type).validEnd){if(n){let h=e.pos+i.nodeSize,m=T.empty;for(let y=s.length-1;y>=0;y--)m=T.from(s[y].create(null,m));m=T.from(r.copy(m));let g=t.tr.step(new lt(e.pos-1,h,e.pos,h,new $(m,1,0),s.length,!0)),b=g.doc.resolve(h+2*s.length);b.nodeAfter&&b.nodeAfter.type==r.type&&yo(g.doc,b.pos)&&g.join(b.pos),n(g.scrollIntoView())}return!0}let u=i.type.spec.isolating||o>0&&c?null:ee.findFrom(e,1),p=u&&u.$from.blockRange(u.$to),f=p&&Er(p);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(p,f).scrollIntoView()),!0;if(d&&ur(i,"start",!0)&&ur(r,"end")){let h=r,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let g=i,b=1;for(;!g.isTextblock;g=g.firstChild)b++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(n){let y=T.empty;for(let w=m.length-1;w>=0;w--)y=T.from(m[w].copy(y));let k=t.tr.step(new lt(e.pos-m.length,e.pos+i.nodeSize,e.pos+b,e.pos+i.nodeSize-b,new $(y,m.length,0),0,!0));n(k.scrollIntoView())}return!0}}return!1}function ph(t){return function(e,n){let o=e.selection,r=t<0?o.$from:o.$to,i=r.depth;for(;r.node(i).isInline;){if(!i)return!1;i--}return r.node(i).isTextblock?(n&&n(e.tr.setSelection(J.create(e.doc,t<0?r.start(i):r.end(i)))),!0):!1}}const ck=ph(-1),dk=ph(1);function uk(t,e=null){return function(n,o){let{$from:r,$to:i}=n.selection,s=r.blockRange(i),a=s&&ic(s,t,e);return a?(o&&o(n.tr.wrap(s,a).scrollIntoView()),!0):!1}}function yu(t,e=null){return function(n,o){let r=!1;for(let i=0;i<n.selection.ranges.length&&!r;i++){let{$from:{pos:s},$to:{pos:a}}=n.selection.ranges[i];n.doc.nodesBetween(s,a,(c,d)=>{if(r)return!1;if(!(!c.isTextblock||c.hasMarkup(t,e)))if(c.type==t)r=!0;else{let u=n.doc.resolve(d),p=u.index();r=u.parent.canReplaceWith(p,p+1,t)}})}if(!r)return!1;if(o){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:a},$to:{pos:c}}=n.selection.ranges[s];i.setBlockType(a,c,t,e)}o(i.scrollIntoView())}return!0}}function wc(...t){return function(e,n,o){for(let r=0;r<t.length;r++)if(t[r](e,n,o))return!0;return!1}}wc(yc,nh,rh);wc(yc,sh,ah);wc(lh,ch,dh,sk);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function pk(t,e=null){return function(n,o){let{$from:r,$to:i}=n.selection,s=r.blockRange(i);if(!s)return!1;let a=o?n.tr:null;return fk(a,s,t,e)?(o&&o(a.scrollIntoView()),!0):!1}}function fk(t,e,n,o=null){let r=!1,i=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 c=s.resolve(e.start-2);i=new us(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new us(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),r=!0}let a=ic(i,n,o,e);return a?(t&&hk(t,e,a,r,n),!0):!1}function hk(t,e,n,o,r){let i=T.empty;for(let u=n.length-1;u>=0;u--)i=T.from(n[u].type.create(n[u].attrs,i));t.step(new lt(e.start-(o?2:0),e.end,e.start,e.end,new $(i,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==r&&(s=u+1);let a=n.length-s,c=e.start+n.length-(o?2:0),d=e.parent;for(let u=e.startIndex,p=e.endIndex,f=!0;u<p;u++,f=!1)!f&&Wn(t.doc,c,a)&&(t.split(c,a),c+=2*a),c+=d.child(u).nodeSize;return t}function mk(t){return function(e,n){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,s=>s.childCount>0&&s.firstChild.type==t);return i?n?o.node(i.depth-1).type==t?gk(e,n,t,i):bk(e,n,i):!0:!1}}function gk(t,e,n,o){let r=t.tr,i=o.end,s=o.$to.end(o.depth);i<s&&(r.step(new lt(i-1,s,i,s,new $(T.from(n.create(null,o.parent.copy())),1,0),1,!0)),o=new us(r.doc.resolve(o.$from.pos),r.doc.resolve(s),o.depth));const a=Er(o);if(a==null)return!1;r.lift(o,a);let c=r.doc.resolve(r.mapping.map(i,-1)-1);return yo(r.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&r.join(c.pos),e(r.scrollIntoView()),!0}function bk(t,e,n){let o=t.tr,r=n.parent;for(let h=n.end,m=n.endIndex-1,g=n.startIndex;m>g;m--)h-=r.child(m).nodeSize,o.delete(h-1,h+1);let i=o.doc.resolve(n.start),s=i.nodeAfter;if(o.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,c=n.endIndex==r.childCount,d=i.node(-1),u=i.index(-1);if(!d.canReplace(u+(a?0:1),u+1,s.content.append(c?T.empty:T.from(r))))return!1;let p=i.pos,f=p+s.nodeSize;return o.step(new lt(p-(a?1:0),f+(c?1:0),p+1,f-1,new $((a?T.empty:T.from(r.copy(T.empty))).append(c?T.empty:T.from(r.copy(T.empty))),a?0:1,c?0:1),a?0:1)),e(o.scrollIntoView()),!0}function yk(t){return function(e,n){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,d=>d.childCount>0&&d.firstChild.type==t);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let a=i.parent,c=a.child(s-1);if(c.type!=t)return!1;if(n){let d=c.lastChild&&c.lastChild.type==a.type,u=T.from(d?t.create():null),p=new $(T.from(t.create(null,T.from(a.type.create(null,u)))),d?3:1,0),f=i.start,h=i.end;n(e.tr.step(new lt(f-(d?3:1),h,f,h,p,1,!0)).scrollIntoView())}return!0}}function ca(t){const{state:e,transaction:n}=t;let{selection:o}=n,{doc:r}=n,{storedMarks:i}=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 i},get selection(){return o},get doc(){return r},get tr(){return o=n.selection,r=n.doc,i=n.storedMarks,n}}}class da{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:o}=this,{view:r}=n,{tr:i}=o,s=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([a,c])=>[a,(...u)=>{const p=c(...u)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),p}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:o,editor:r,state:i}=this,{view:s}=r,a=[],c=!!e,d=e||i.tr,u=()=>(!c&&n&&!d.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(d),a.every(f=>f===!0)),p={...Object.fromEntries(Object.entries(o).map(([f,h])=>[f,(...g)=>{const b=this.buildProps(d,n),y=h(...g)(b);return a.push(y),p}])),run:u};return p}createCan(e){const{rawCommands:n,state:o}=this,r=!1,i=e||o.tr,s=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(n).map(([c,d])=>[c,(...u)=>d(...u)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(e,n=!0){const{rawCommands:o,editor:r,state:i}=this,{view:s}=r,a={tr:e,editor:r,view:s,state:ca({state:i,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(o).map(([c,d])=>[c,(...u)=>d(...u)(a)]))}};return a}}class vk{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const o=this.callbacks[e];return o&&o.forEach(r=>r.apply(this,n)),this}off(e,n){const o=this.callbacks[e];return o&&(n?this.callbacks[e]=o.filter(r=>r!==n):delete this.callbacks[e]),this}once(e,n){const o=(...r)=>{this.off(e,o),n.apply(this,r)};return this.on(e,o)}removeAllListeners(){this.callbacks={}}}function U(t,e,n){return t.config[e]===void 0&&t.parent?U(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?U(t.parent,e,n):null}):t.config[e]}function ua(t){const e=t.filter(r=>r.type==="extension"),n=t.filter(r=>r.type==="node"),o=t.filter(r=>r.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:o}}function fh(t){const e=[],{nodeExtensions:n,markExtensions:o}=ua(t),r=[...n,...o],i={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:r},c=U(s,"addGlobalAttributes",a);if(!c)return;c().forEach(u=>{u.types.forEach(p=>{Object.entries(u.attributes).forEach(([f,h])=>{e.push({type:p,name:f,attribute:{...i,...h}})})})})}),r.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage},c=U(s,"addAttributes",a);if(!c)return;const d=c();Object.entries(d).forEach(([u,p])=>{const f={...i,...p};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 dt(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 Ce(...t){return t.filter(e=>!!e).reduce((e,n)=>{const o={...e};return Object.entries(n).forEach(([r,i])=>{if(!o[r]){o[r]=i;return}if(r==="class"){const a=i?String(i).split(" "):[],c=o[r]?o[r].split(" "):[],d=a.filter(u=>!c.includes(u));o[r]=[...c,...d].join(" ")}else if(r==="style"){const a=i?i.split(";").map(u=>u.trim()).filter(Boolean):[],c=o[r]?o[r].split(";").map(u=>u.trim()).filter(Boolean):[],d=new Map;c.forEach(u=>{const[p,f]=u.split(":").map(h=>h.trim());d.set(p,f)}),a.forEach(u=>{const[p,f]=u.split(":").map(h=>h.trim());d.set(p,f)}),o[r]=Array.from(d.entries()).map(([u,p])=>`${u}: ${p}`).join("; ")}else o[r]=i}),o},{})}function Rl(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,o)=>Ce(n,o),{})}function hh(t){return typeof t=="function"}function me(t,e=void 0,...n){return hh(t)?e?t.bind(e)(...n):t(...n):t}function kk(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Ek(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function vu(t,e){return"style"in t?t:{...t,getAttrs:n=>{const o=t.getAttrs?t.getAttrs(n):t.attrs;if(o===!1)return!1;const r=e.reduce((i,s)=>{const a=s.attribute.parseHTML?s.attribute.parseHTML(n):Ek(n.getAttribute(s.name));return a==null?i:{...i,[s.name]:a}},{});return{...o,...r}}}}function ku(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&kk(n)?!1:n!=null))}function wk(t,e){var n;const o=fh(t),{nodeExtensions:r,markExtensions:i}=ua(t),s=(n=r.find(d=>U(d,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(r.map(d=>{const u=o.filter(y=>y.type===d.name),p={name:d.name,options:d.options,storage:d.storage,editor:e},f=t.reduce((y,k)=>{const w=U(k,"extendNodeSchema",p);return{...y,...w?w(d):{}}},{}),h=ku({...f,content:me(U(d,"content",p)),marks:me(U(d,"marks",p)),group:me(U(d,"group",p)),inline:me(U(d,"inline",p)),atom:me(U(d,"atom",p)),selectable:me(U(d,"selectable",p)),draggable:me(U(d,"draggable",p)),code:me(U(d,"code",p)),whitespace:me(U(d,"whitespace",p)),linebreakReplacement:me(U(d,"linebreakReplacement",p)),defining:me(U(d,"defining",p)),isolating:me(U(d,"isolating",p)),attrs:Object.fromEntries(u.map(y=>{var k;return[y.name,{default:(k=y==null?void 0:y.attribute)===null||k===void 0?void 0:k.default}]}))}),m=me(U(d,"parseHTML",p));m&&(h.parseDOM=m.map(y=>vu(y,u)));const g=U(d,"renderHTML",p);g&&(h.toDOM=y=>g({node:y,HTMLAttributes:Rl(y,u)}));const b=U(d,"renderText",p);return b&&(h.toText=b),[d.name,h]})),c=Object.fromEntries(i.map(d=>{const u=o.filter(b=>b.type===d.name),p={name:d.name,options:d.options,storage:d.storage,editor:e},f=t.reduce((b,y)=>{const k=U(y,"extendMarkSchema",p);return{...b,...k?k(d):{}}},{}),h=ku({...f,inclusive:me(U(d,"inclusive",p)),excludes:me(U(d,"excludes",p)),group:me(U(d,"group",p)),spanning:me(U(d,"spanning",p)),code:me(U(d,"code",p)),attrs:Object.fromEntries(u.map(b=>{var y;return[b.name,{default:(y=b==null?void 0:b.attribute)===null||y===void 0?void 0:y.default}]}))}),m=me(U(d,"parseHTML",p));m&&(h.parseDOM=m.map(b=>vu(b,u)));const g=U(d,"renderHTML",p);return g&&(h.toDOM=b=>g({mark:b,HTMLAttributes:Rl(b,u)})),[d.name,h]}));return new nf({topNode:s,nodes:a,marks:c})}function ja(t,e){return e.nodes[t]||e.marks[t]||null}function Eu(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Cc(t,e){const n=qo.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}const Ck=(t,e=500)=>{let n="";const o=t.parentOffset;return t.parent.nodesBetween(Math.max(0,o-e),o,(r,i,s,a)=>{var c,d;const u=((d=(c=r.type.spec).toText)===null||d===void 0?void 0:d.call(c,{node:r,pos:i,parent:s,index:a}))||r.textContent||"%leaf%";n+=r.isAtom&&!r.isText?u:u.slice(0,Math.max(0,o-i))}),n};function _c(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class yi{constructor(e){this.find=e.find,this.handler=e.handler}}const _k=(t,e)=>{if(_c(e))return e.exec(t);const n=e(t);if(!n)return null;const o=[n.text];return o.index=n.index,o.input=t,o.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),o.push(n.replaceWith)),o};function Oi(t){var e;const{editor:n,from:o,to:r,text:i,rules:s,plugin:a}=t,{view:c}=n;if(c.composing)return!1;const d=c.state.doc.resolve(o);if(d.parent.type.spec.code||!((e=d.nodeBefore||d.nodeAfter)===null||e===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let u=!1;const p=Ck(d)+i;return s.forEach(f=>{if(u)return;const h=_k(p,f.find);if(!h)return;const m=c.state.tr,g=ca({state:c.state,transaction:m}),b={from:o-(h[0].length-i.length),to:r},{commands:y,chain:k,can:w}=new da({editor:n,state:g});f.handler({state:g,range:b,match:h,commands:y,chain:k,can:w})===null||!m.steps.length||(m.setMeta(a,{transform:m,from:o,to:r,text:i}),c.dispatch(m),u=!0)}),u}function Sk(t){const{editor:e,rules:n}=t,o=new Se({state:{init(){return null},apply(r,i,s){const a=r.getMeta(o);if(a)return a;const c=r.getMeta("applyInputRules");return!!c&&setTimeout(()=>{let{text:u}=c;typeof u=="string"?u=u:u=Cc(T.from(u),s.schema);const{from:p}=c,f=p+u.length;Oi({editor:e,from:p,to:f,text:u,rules:n,plugin:o})}),r.selectionSet||r.docChanged?null:i}},props:{handleTextInput(r,i,s,a){return Oi({editor:e,from:i,to:s,text:a,rules:n,plugin:o})},handleDOMEvents:{compositionend:r=>(setTimeout(()=>{const{$cursor:i}=r.state.selection;i&&Oi({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:o})}),!1)},handleKeyDown(r,i){if(i.key!=="Enter")return!1;const{$cursor:s}=r.state.selection;return s?Oi({editor:e,from:s.pos,to:s.pos,text:`
14
- `,rules:n,plugin:o}):!1}},isInputRules:!0});return o}function xk(t){return Object.prototype.toString.call(t).slice(8,-1)}function Mi(t){return xk(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function pa(t,e){const n={...t};return Mi(t)&&Mi(e)&&Object.keys(e).forEach(o=>{Mi(e[o])&&Mi(t[o])?n[o]=pa(t[o],e[o]):n[o]=e[o]}),n}class sn{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=me(U(this,"addOptions",{name:this.name}))),this.storage=me(U(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new sn(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>pa(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new sn(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=me(U(n,"addOptions",{name:n.name})),n.storage=me(U(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){const{tr:o}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){const s=r.marks();if(!!!s.find(d=>(d==null?void 0:d.type.name)===n.name))return!1;const c=s.find(d=>(d==null?void 0:d.type.name)===n.name);return c&&o.removeStoredMark(c),o.insertText(" ",r.pos),e.view.dispatch(o),!0}return!1}}function Nk(t){return typeof t=="number"}class Tk{constructor(e){this.find=e.find,this.handler=e.handler}}const Ok=(t,e,n)=>{if(_c(e))return[...t.matchAll(e)];const o=e(t,n);return o?o.map(r=>{const i=[r.text];return i.index=r.index,i.input=t,i.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(r.replaceWith)),i}):[]};function Mk(t){const{editor:e,state:n,from:o,to:r,rule:i,pasteEvent:s,dropEvent:a}=t,{commands:c,chain:d,can:u}=new da({editor:e,state:n}),p=[];return n.doc.nodesBetween(o,r,(h,m)=>{if(!h.isTextblock||h.type.spec.code)return;const g=Math.max(o,m),b=Math.min(r,m+h.content.size),y=h.textBetween(g-m,b-m,void 0,"");Ok(y,i.find,s).forEach(w=>{if(w.index===void 0)return;const v=g+w.index+1,_=v+w[0].length,C={from:n.tr.mapping.map(v),to:n.tr.mapping.map(_)},A=i.handler({state:n,range:C,match:w,commands:c,chain:d,can:u,pasteEvent:s,dropEvent:a});p.push(A)})}),p.every(h=>h!==null)}let Ai=null;const Ak=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 Rk(t){const{editor:e,rules:n}=t;let o=null,r=!1,i=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const c=({state:u,from:p,to:f,rule:h,pasteEvt:m})=>{const g=u.tr,b=ca({state:u,transaction:g});if(!(!Mk({editor:e,state:b,from:Math.max(p-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 Se({view(p){const f=m=>{var g;o=!((g=p.dom.parentElement)===null||g===void 0)&&g.contains(m.target)?p.dom.parentElement:null,o&&(Ai=e)},h=()=>{Ai&&(Ai=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(p,f)=>{if(i=o===p.dom.parentElement,a=f,!i){const h=Ai;h&&setTimeout(()=>{const m=h.state.selection;m&&h.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(p,f)=>{var h;const m=(h=f.clipboardData)===null||h===void 0?void 0:h.getData("text/html");return s=f,r=!!(m!=null&&m.includes("data-pm-slice")),!1}}},appendTransaction:(p,f,h)=>{const m=p[0],g=m.getMeta("uiEvent")==="paste"&&!r,b=m.getMeta("uiEvent")==="drop"&&!i,y=m.getMeta("applyPasteRules"),k=!!y;if(!g&&!b&&!k)return;if(k){let{text:_}=y;typeof _=="string"?_=_:_=Cc(T.from(_),h.schema);const{from:C}=y,A=C+_.length,L=Ak(_);return c({rule:u,state:h,from:C,to:{b:A},pasteEvt:L})}const w=f.doc.content.findDiffStart(h.doc.content),v=f.doc.content.findDiffEnd(h.doc.content);if(!(!Nk(w)||!v||w===v.b))return c({rule:u,state:h,from:w,to:v,pasteEvt:s})}}))}function Dk(t){const e=t.filter((n,o)=>t.indexOf(n)!==o);return Array.from(new Set(e))}class ir{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=ir.resolve(e),this.schema=wk(this.extensions,n),this.setupExtensions()}static resolve(e){const n=ir.sort(ir.flatten(e)),o=Dk(n.map(r=>r.name));return o.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${o.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{const o={name:n.name,options:n.options,storage:n.storage},r=U(n,"addExtensions",o);return r?[n,...this.flatten(r())]:n}).flat(10)}static sort(e){return e.sort((o,r)=>{const i=U(o,"priority")||100,s=U(r,"priority")||100;return i>s?-1:i<s?1:0})}get commands(){return this.extensions.reduce((e,n)=>{const o={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:ja(n.name,this.schema)},r=U(n,"addCommands",o);return r?{...e,...r()}:e},{})}get plugins(){const{editor:e}=this,n=ir.sort([...this.extensions].reverse()),o=[],r=[],i=n.map(s=>{const a={name:s.name,options:s.options,storage:s.storage,editor:e,type:ja(s.name,this.schema)},c=[],d=U(s,"addKeyboardShortcuts",a);let u={};if(s.type==="mark"&&U(s,"exitable",a)&&(u.ArrowRight=()=>sn.handleExit({editor:e,mark:s})),d){const g=Object.fromEntries(Object.entries(d()).map(([b,y])=>[b,()=>y({editor:e})]));u={...u,...g}}const p=Zv(u);c.push(p);const f=U(s,"addInputRules",a);Eu(s,e.options.enableInputRules)&&f&&o.push(...f());const h=U(s,"addPasteRules",a);Eu(s,e.options.enablePasteRules)&&h&&r.push(...h());const m=U(s,"addProseMirrorPlugins",a);if(m){const g=m();c.push(...g)}return c}).flat();return[Sk({editor:e,rules:o}),...Rk({editor:e,rules:r}),...i]}get attributes(){return fh(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=ua(this.extensions);return Object.fromEntries(n.filter(o=>!!U(o,"addNodeView")).map(o=>{const r=this.attributes.filter(c=>c.type===o.name),i={name:o.name,options:o.options,storage:o.storage,editor:e,type:dt(o.name,this.schema)},s=U(o,"addNodeView",i);if(!s)return[];const a=(c,d,u,p,f)=>{const h=Rl(c,r);return s()({node:c,view:d,getPos:u,decorations:p,innerDecorations:f,editor:e,extension:o,HTMLAttributes:h})};return[o.name,a]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;const o={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:ja(e.name,this.schema)};e.type==="mark"&&(!((n=me(U(e,"keepOnSplit",o)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const r=U(e,"onBeforeCreate",o),i=U(e,"onCreate",o),s=U(e,"onUpdate",o),a=U(e,"onSelectionUpdate",o),c=U(e,"onTransaction",o),d=U(e,"onFocus",o),u=U(e,"onBlur",o),p=U(e,"onDestroy",o);r&&this.editor.on("beforeCreate",r),i&&this.editor.on("create",i),s&&this.editor.on("update",s),a&&this.editor.on("selectionUpdate",a),c&&this.editor.on("transaction",c),d&&this.editor.on("focus",d),u&&this.editor.on("blur",u),p&&this.editor.on("destroy",p)})}}class De{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=me(U(this,"addOptions",{name:this.name}))),this.storage=me(U(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new De(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>pa(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new De({...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=me(U(n,"addOptions",{name:n.name})),n.storage=me(U(n,"addStorage",{name:n.name,options:n.options})),n}}function mh(t,e,n){const{from:o,to:r}=e,{blockSeparator:i=`
15
-
16
- `,textSerializers:s={}}=n||{};let a="";return t.nodesBetween(o,r,(c,d,u,p)=>{var f;c.isBlock&&d>o&&(a+=i);const h=s==null?void 0:s[c.type.name];if(h)return u&&(a+=h({node:c,pos:d,parent:u,index:p,range:e})),!1;c.isText&&(a+=(f=c==null?void 0:c.text)===null||f===void 0?void 0:f.slice(Math.max(o,d)-d,r-d))}),a}function Sc(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const Ik=De.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Se({key:new xe("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:o,selection:r}=e,{ranges:i}=r,s=Math.min(...i.map(u=>u.$from.pos)),a=Math.max(...i.map(u=>u.$to.pos)),c=Sc(n);return mh(o,{from:s,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),Bk=()=>({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),Lk=(t=!1)=>({commands:e})=>e.setContent("",t),Pk=()=>({state:t,tr:e,dispatch:n})=>{const{selection:o}=e,{ranges:r}=o;return n&&r.forEach(({$from:i,$to:s})=>{t.doc.nodesBetween(i.pos,s.pos,(a,c)=>{if(a.type.isText)return;const{doc:d,mapping:u}=e,p=d.resolve(u.map(c)),f=d.resolve(u.map(c+a.nodeSize)),h=p.blockRange(f);if(!h)return;const m=Er(h);if(a.type.isTextblock){const{defaultType:g}=p.parent.contentMatchAt(p.index());e.setNodeMarkup(h.start,g)}(m||m===0)&&e.lift(h,m)})}),!0},$k=t=>e=>t(e),Fk=()=>({state:t,dispatch:e})=>ch(t,e),Vk=(t,e)=>({editor:n,tr:o})=>{const{state:r}=n,i=r.doc.slice(t.from,t.to);o.deleteRange(t.from,t.to);const s=o.mapping.map(e);return o.insert(s,i.content),o.setSelection(new J(o.doc.resolve(s-1))),!0},zk=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,o=n.$anchor.node();if(o.content.size>0)return!1;const r=t.selection.$anchor;for(let i=r.depth;i>0;i-=1)if(r.node(i).type===o.type){if(e){const a=r.before(i),c=r.after(i);t.delete(a,c).scrollIntoView()}return!0}return!1},Hk=t=>({tr:e,state:n,dispatch:o})=>{const r=dt(t,n.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r){if(o){const c=i.before(s),d=i.after(s);e.delete(c,d).scrollIntoView()}return!0}return!1},Uk=t=>({tr:e,dispatch:n})=>{const{from:o,to:r}=t;return n&&e.delete(o,r),!0},qk=()=>({state:t,dispatch:e})=>yc(t,e),Wk=()=>({commands:t})=>t.keyboardShortcut("Enter"),Kk=()=>({state:t,dispatch:e})=>rk(t,e);function vs(t,e,n={strict:!0}){const o=Object.keys(e);return o.length?o.every(r=>n.strict?e[r]===t[r]:_c(e[r])?e[r].test(t[r]):e[r]===t[r]):!0}function gh(t,e,n={}){return t.find(o=>o.type===e&&vs(Object.fromEntries(Object.keys(n).map(r=>[r,o.attrs[r]])),n))}function wu(t,e,n={}){return!!gh(t,e,n)}function wr(t,e,n){var o;if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(u=>u.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(u=>u.type===e)||(n=n||((o=r.node.marks[0])===null||o===void 0?void 0:o.attrs),!gh([...r.node.marks],e,n)))return;let s=r.index,a=t.start()+r.offset,c=s+1,d=a+r.node.nodeSize;for(;s>0&&wu([...t.parent.child(s-1).marks],e,n);)s-=1,a-=t.parent.child(s).nodeSize;for(;c<t.parent.childCount&&wu([...t.parent.child(c).marks],e,n);)d+=t.parent.child(c).nodeSize,c+=1;return{from:a,to:d}}function ko(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 jk=(t,e={})=>({tr:n,state:o,dispatch:r})=>{const i=ko(t,o.schema),{doc:s,selection:a}=n,{$from:c,from:d,to:u}=a;if(r){const p=wr(c,i,e);if(p&&p.from<=d&&p.to>=u){const f=J.create(s,p.from,p.to);n.setSelection(f)}}return!0},Gk=t=>e=>{const n=typeof t=="function"?t(e):t;for(let o=0;o<n.length;o+=1)if(n[o](e))return!0;return!1};function fa(t){return t instanceof J}function qn(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function bh(t,e=null){if(!e)return null;const n=ee.atStart(t),o=ee.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return o;const r=n.from,i=o.to;return e==="all"?J.create(t,qn(0,r,i),qn(t.content.size,r,i)):J.create(t,qn(e,r,i),qn(e,r,i))}function yh(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function ha(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const Yk=(t=null,e={})=>({editor:n,view:o,tr:r,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{(ha()||yh())&&o.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(o.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};if(o.hasFocus()&&t===null||t===!1)return!0;if(i&&t===null&&!fa(n.state.selection))return s(),!0;const a=bh(r.doc,t)||n.state.selection,c=n.state.selection.eq(a);return i&&(c||r.setSelection(a),c&&r.storedMarks&&r.setStoredMarks(r.storedMarks),s()),!0},Jk=(t,e)=>n=>t.every((o,r)=>e(o,{...n,index:r})),Xk=(t,e)=>({tr:n,commands:o})=>o.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),vh=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const o=e[n];o.nodeType===3&&o.nodeValue&&/^(\n\s\s|\n)$/.test(o.nodeValue)?t.removeChild(o):o.nodeType===1&&vh(o)}return t};function Ri(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return vh(n)}function ks(t,e,n){if(t instanceof po||t instanceof T)return t;n={slice:!0,parseOptions:{},...n};const o=typeof t=="object"&&t!==null,r=typeof t=="string";if(o)try{if(Array.isArray(t)&&t.length>0)return T.fromArray(t.map(a=>e.nodeFromJSON(a)));const s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),ks("",e,n)}if(r){if(n.errorOnInvalidContent){let s=!1,a="";const c=new nf({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:d=>(s=!0,a=typeof d=="string"?d:d.outerHTML,null)}]}})});if(n.slice?Pr.fromSchema(c).parseSlice(Ri(t),n.parseOptions):Pr.fromSchema(c).parse(Ri(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const i=Pr.fromSchema(e);return n.slice?i.parseSlice(Ri(t),n.parseOptions).content:i.parse(Ri(t),n.parseOptions)}return ks("",e,n)}function Zk(t,e,n){const o=t.steps.length-1;if(o<e)return;const r=t.steps[o];if(!(r instanceof at||r instanceof lt))return;const i=t.mapping.maps[o];let s=0;i.forEach((a,c,d,u)=>{s===0&&(s=u)}),t.setSelection(ee.near(t.doc.resolve(s),n))}const Qk=t=>!("type"in t),eE=(t,e,n)=>({tr:o,dispatch:r,editor:i})=>{var s;if(r){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;try{a=ks(e,i.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions},errorOnInvalidContent:(s=n.errorOnInvalidContent)!==null&&s!==void 0?s:i.options.enableContentCheck})}catch(m){return i.emit("contentError",{editor:i,error:m,disableCollaboration:()=>{i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}}),!1}let{from:c,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},u=!0,p=!0;if((Qk(a)?a:[a]).forEach(m=>{m.check(),u=u?m.isText&&m.marks.length===0:!1,p=p?m.isBlock:!1}),c===d&&p){const{parent:m}=o.doc.resolve(c);m.isTextblock&&!m.type.spec.code&&!m.childCount&&(c-=1,d+=1)}let h;if(u){if(Array.isArray(e))h=e.map(m=>m.text||"").join("");else if(e instanceof T){let m="";e.forEach(g=>{g.text&&(m+=g.text)}),h=m}else typeof e=="object"&&e&&e.text?h=e.text:h=e;o.insertText(h,c,d)}else h=a,o.replaceWith(c,d,h);n.updateSelection&&Zk(o,o.steps.length-1,-1),n.applyInputRules&&o.setMeta("applyInputRules",{from:c,text:h}),n.applyPasteRules&&o.setMeta("applyPasteRules",{from:c,text:h})}return!0},tE=()=>({state:t,dispatch:e})=>tk(t,e),nE=()=>({state:t,dispatch:e})=>nk(t,e),oE=()=>({state:t,dispatch:e})=>nh(t,e),rE=()=>({state:t,dispatch:e})=>sh(t,e),iE=()=>({state:t,dispatch:e,tr:n})=>{try{const o=oa(t.doc,t.selection.$from.pos,-1);return o==null?!1:(n.join(o,2),e&&e(n),!0)}catch{return!1}},sE=()=>({state:t,dispatch:e,tr:n})=>{try{const o=oa(t.doc,t.selection.$from.pos,1);return o==null?!1:(n.join(o,2),e&&e(n),!0)}catch{return!1}},aE=()=>({state:t,dispatch:e})=>Qv(t,e),lE=()=>({state:t,dispatch:e})=>ek(t,e);function kh(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function cE(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let o,r,i,s;for(let a=0;a<e.length-1;a+=1){const c=e[a];if(/^(cmd|meta|m)$/i.test(c))s=!0;else if(/^a(lt)?$/i.test(c))o=!0;else if(/^(c|ctrl|control)$/i.test(c))r=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))ha()||kh()?s=!0:r=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return o&&(n=`Alt-${n}`),r&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}const dE=t=>({editor:e,view:n,tr:o,dispatch:r})=>{const i=cE(t).split(/-(?!$)/),s=i.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),a=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{n.someProp("handleKeyDown",d=>d(n,a))});return c==null||c.steps.forEach(d=>{const u=d.map(o.mapping);u&&r&&o.maybeStep(u)}),!0};function ri(t,e,n={}){const{from:o,to:r,empty:i}=t.selection,s=e?dt(e,t.schema):null,a=[];t.doc.nodesBetween(o,r,(p,f)=>{if(p.isText)return;const h=Math.max(o,f),m=Math.min(r,f+p.nodeSize);a.push({node:p,from:h,to:m})});const c=r-o,d=a.filter(p=>s?s.name===p.node.type.name:!0).filter(p=>vs(p.node.attrs,n,{strict:!1}));return i?!!d.length:d.reduce((p,f)=>p+f.to-f.from,0)>=c}const uE=(t,e={})=>({state:n,dispatch:o})=>{const r=dt(t,n.schema);return ri(n,r,e)?ok(n,o):!1},pE=()=>({state:t,dispatch:e})=>dh(t,e),fE=t=>({state:e,dispatch:n})=>{const o=dt(t,e.schema);return mk(o)(e,n)},hE=()=>({state:t,dispatch:e})=>lh(t,e);function ma(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Cu(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((o,r)=>(n.includes(r)||(o[r]=t[r]),o),{})}const mE=(t,e)=>({tr:n,state:o,dispatch:r})=>{let i=null,s=null;const a=ma(typeof t=="string"?t:t.name,o.schema);return a?(a==="node"&&(i=dt(t,o.schema)),a==="mark"&&(s=ko(t,o.schema)),r&&n.selection.ranges.forEach(c=>{o.doc.nodesBetween(c.$from.pos,c.$to.pos,(d,u)=>{i&&i===d.type&&n.setNodeMarkup(u,void 0,Cu(d.attrs,e)),s&&d.marks.length&&d.marks.forEach(p=>{s===p.type&&n.addMark(u,u+d.nodeSize,s.create(Cu(p.attrs,e)))})})}),!0):!1},gE=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),bE=()=>({tr:t,dispatch:e})=>{if(e){const n=new jt(t.doc);t.setSelection(n)}return!0},yE=()=>({state:t,dispatch:e})=>rh(t,e),vE=()=>({state:t,dispatch:e})=>ah(t,e),kE=()=>({state:t,dispatch:e})=>ak(t,e),EE=()=>({state:t,dispatch:e})=>dk(t,e),wE=()=>({state:t,dispatch:e})=>ck(t,e);function Dl(t,e,n={},o={}){return ks(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:o.errorOnInvalidContent})}const CE=(t,e=!1,n={},o={})=>({editor:r,tr:i,dispatch:s,commands:a})=>{var c,d;const{doc:u}=i;if(n.preserveWhitespace!=="full"){const p=Dl(t,r.schema,n,{errorOnInvalidContent:(c=o.errorOnInvalidContent)!==null&&c!==void 0?c:r.options.enableContentCheck});return s&&i.replaceWith(0,u.content.size,p).setMeta("preventUpdate",!e),!0}return s&&i.setMeta("preventUpdate",!e),a.insertContentAt({from:0,to:u.content.size},t,{parseOptions:n,errorOnInvalidContent:(d=o.errorOnInvalidContent)!==null&&d!==void 0?d:r.options.enableContentCheck})};function Eh(t,e){const n=ko(e,t.schema),{from:o,to:r,empty:i}=t.selection,s=[];i?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(o,r,c=>{s.push(...c.marks)});const a=s.find(c=>c.type.name===n.name);return a?{...a.attrs}:{}}function _E(t,e){const n=new sc(t);return e.forEach(o=>{o.steps.forEach(r=>{n.step(r)})}),n}function SE(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 Il(t,e){const n=[];return t.descendants((o,r)=>{e(o)&&n.push({node:o,pos:r})}),n}function xE(t,e,n){const o=[];return t.nodesBetween(e.from,e.to,(r,i)=>{n(r)&&o.push({node:r,pos:i})}),o}function wh(t,e){for(let n=t.depth;n>0;n-=1){const o=t.node(n);if(e(o))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:o}}}function xc(t){return e=>wh(e.$from,t)}function Ch(t,e){const n={from:0,to:t.content.size};return mh(t,n,e)}function NE(t,e){const n=dt(e,t.schema),{from:o,to:r}=t.selection,i=[];t.doc.nodesBetween(o,r,a=>{i.push(a)});const s=i.reverse().find(a=>a.type.name===n.name);return s?{...s.attrs}:{}}function _h(t,e){const n=ma(typeof e=="string"?e:e.name,t.schema);return n==="node"?NE(t,e):n==="mark"?Eh(t,e):{}}function TE(t,e=JSON.stringify){const n={};return t.filter(o=>{const r=e(o);return Object.prototype.hasOwnProperty.call(n,r)?!1:n[r]=!0})}function OE(t){const e=TE(t);return e.length===1?e:e.filter((n,o)=>!e.filter((i,s)=>s!==o).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function ME(t){const{mapping:e,steps:n}=t,o=[];return e.maps.forEach((r,i)=>{const s=[];if(r.ranges.length)r.forEach((a,c)=>{s.push({from:a,to:c})});else{const{from:a,to:c}=n[i];if(a===void 0||c===void 0)return;s.push({from:a,to:c})}s.forEach(({from:a,to:c})=>{const d=e.slice(i).map(a,-1),u=e.slice(i).map(c),p=e.invert().map(d,-1),f=e.invert().map(u);o.push({oldRange:{from:p,to:f},newRange:{from:d,to:u}})})}),OE(o)}function Nc(t,e,n){const o=[];return t===e?n.resolve(t).marks().forEach(r=>{const i=n.resolve(t),s=wr(i,r.type);s&&o.push({mark:r,...s})}):n.nodesBetween(t,e,(r,i)=>{!r||(r==null?void 0:r.nodeSize)===void 0||o.push(...r.marks.map(s=>({from:i,to:i+r.nodeSize,mark:s})))}),o}function es(t,e,n){return Object.fromEntries(Object.entries(n).filter(([o])=>{const r=t.find(i=>i.type===e&&i.name===o);return r?r.attribute.keepOnSplit:!1}))}function Bl(t,e,n={}){const{empty:o,ranges:r}=t.selection,i=e?ko(e,t.schema):null;if(o)return!!(t.storedMarks||t.selection.$from.marks()).filter(p=>i?i.name===p.type.name:!0).find(p=>vs(p.attrs,n,{strict:!1}));let s=0;const a=[];if(r.forEach(({$from:p,$to:f})=>{const h=p.pos,m=f.pos;t.doc.nodesBetween(h,m,(g,b)=>{if(!g.isText&&!g.marks.length)return;const y=Math.max(h,b),k=Math.min(m,b+g.nodeSize),w=k-y;s+=w,a.push(...g.marks.map(v=>({mark:v,from:y,to:k})))})}),s===0)return!1;const c=a.filter(p=>i?i.name===p.mark.type.name:!0).filter(p=>vs(p.mark.attrs,n,{strict:!1})).reduce((p,f)=>p+f.to-f.from,0),d=a.filter(p=>i?p.mark.type!==i&&p.mark.type.excludes(i):!0).reduce((p,f)=>p+f.to-f.from,0);return(c>0?c+d:c)>=s}function AE(t,e,n={}){if(!e)return ri(t,null,n)||Bl(t,null,n);const o=ma(e,t.schema);return o==="node"?ri(t,e,n):o==="mark"?Bl(t,e,n):!1}function _u(t,e){const{nodeExtensions:n}=ua(e),o=n.find(s=>s.name===t);if(!o)return!1;const r={name:o.name,options:o.options,storage:o.storage},i=me(U(o,"group",r));return typeof i!="string"?!1:i.split(" ").includes("list")}function Tc(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var o;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((o=t.text)!==null&&o!==void 0?o:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let r=!0;return t.content.forEach(i=>{r!==!1&&(Tc(i,{ignoreWhitespace:n,checkChildren:e})||(r=!1))}),r}return!1}function Sh(t){return t instanceof G}function xh(t,e,n){const r=t.state.doc.content.size,i=qn(e,0,r),s=qn(n,0,r),a=t.coordsAtPos(i),c=t.coordsAtPos(s,-1),d=Math.min(a.top,c.top),u=Math.max(a.bottom,c.bottom),p=Math.min(a.left,c.left),f=Math.max(a.right,c.right),h=f-p,m=u-d,y={top:d,bottom:u,left:p,right:f,width:h,height:m,x:p,y:d};return{...y,toJSON:()=>y}}function RE(t,e,n){var o;const{selection:r}=e;let i=null;if(fa(r)&&(i=r.$cursor),i){const a=(o=t.storedMarks)!==null&&o!==void 0?o:i.marks();return!!n.isInSet(a)||!a.some(c=>c.type.excludes(n))}const{ranges:s}=r;return s.some(({$from:a,$to:c})=>{let d=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,c.pos,(u,p,f)=>{if(d)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));d=h&&m}return!d}),d})}const DE=(t,e={})=>({tr:n,state:o,dispatch:r})=>{const{selection:i}=n,{empty:s,ranges:a}=i,c=ko(t,o.schema);if(r)if(s){const d=Eh(o,c);n.addStoredMark(c.create({...d,...e}))}else a.forEach(d=>{const u=d.$from.pos,p=d.$to.pos;o.doc.nodesBetween(u,p,(f,h)=>{const m=Math.max(h,u),g=Math.min(h+f.nodeSize,p);f.marks.find(y=>y.type===c)?f.marks.forEach(y=>{c===y.type&&n.addMark(m,g,c.create({...y.attrs,...e}))}):n.addMark(m,g,c.create(e))})});return RE(o,n,c)},IE=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),BE=(t,e={})=>({state:n,dispatch:o,chain:r})=>{const i=dt(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?r().command(({commands:a})=>yu(i,{...s,...e})(n)?!0:a.clearNodes()).command(({state:a})=>yu(i,{...s,...e})(a,o)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},LE=t=>({tr:e,dispatch:n})=>{if(n){const{doc:o}=e,r=qn(t,0,o.content.size),i=G.create(o,r);e.setSelection(i)}return!0},PE=t=>({tr:e,dispatch:n})=>{if(n){const{doc:o}=e,{from:r,to:i}=typeof t=="number"?{from:t,to:t}:t,s=J.atStart(o).from,a=J.atEnd(o).to,c=qn(r,s,a),d=qn(i,s,a),u=J.create(o,c,d);e.setSelection(u)}return!0},$E=t=>({state:e,dispatch:n})=>{const o=dt(t,e.schema);return yk(o)(e,n)};function Su(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const o=n.filter(r=>e==null?void 0:e.includes(r.type.name));t.tr.ensureMarks(o)}}const FE=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:o,editor:r})=>{const{selection:i,doc:s}=e,{$from:a,$to:c}=i,d=r.extensionManager.attributes,u=es(d,a.node().type.name,a.node().attrs);if(i instanceof G&&i.node.isBlock)return!a.parentOffset||!Wn(s,a.pos)?!1:(o&&(t&&Su(n,r.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const p=c.parentOffset===c.parent.content.size,f=a.depth===0?void 0:SE(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=p&&f?[{type:f,attrs:u}]:void 0,m=Wn(e.doc,e.mapping.map(a.pos),1,h);if(!h&&!m&&Wn(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(m=!0,h=f?[{type:f,attrs:u}]:void 0),o){if(m&&(i instanceof J&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,h),f&&!p&&!a.parentOffset&&a.parent.type!==f)){const g=e.mapping.map(a.before()),b=e.doc.resolve(g);a.node(-1).canReplaceWith(b.index(),b.index()+1,f)&&e.setNodeMarkup(e.mapping.map(a.before()),f)}t&&Su(n,r.extensionManager.splittableMarks),e.scrollIntoView()}return m},VE=(t,e={})=>({tr:n,state:o,dispatch:r,editor:i})=>{var s;const a=dt(t,o.schema),{$from:c,$to:d}=o.selection,u=o.selection.node;if(u&&u.isBlock||c.depth<2||!c.sameParent(d))return!1;const p=c.node(-1);if(p.type!==a)return!1;const f=i.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==a||c.index(-2)!==c.node(-2).childCount-1)return!1;if(r){let y=T.empty;const k=c.index(-1)?1:c.index(-2)?2:3;for(let L=c.depth-k;L>=c.depth-3;L-=1)y=T.from(c.node(L).copy(y));const w=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,v={...es(f,c.node().type.name,c.node().attrs),...e},_=((s=a.contentMatch.defaultType)===null||s===void 0?void 0:s.createAndFill(v))||void 0;y=y.append(T.from(a.createAndFill(null,_)||void 0));const C=c.before(c.depth-(k-1));n.replace(C,c.after(-w),new $(y,4-k,0));let A=-1;n.doc.nodesBetween(C,n.doc.content.size,(L,M)=>{if(A>-1)return!1;L.isTextblock&&L.content.size===0&&(A=M+1)}),A>-1&&n.setSelection(J.near(n.doc.resolve(A))),n.scrollIntoView()}return!0}const h=d.pos===c.end()?p.contentMatchAt(0).defaultType:null,m={...es(f,p.type.name,p.attrs),...e},g={...es(f,c.node().type.name,c.node().attrs),...e};n.delete(c.pos,d.pos);const b=h?[{type:a,attrs:m},{type:h,attrs:g}]:[{type:a,attrs:m}];if(!Wn(n.doc,c.pos,2))return!1;if(r){const{selection:y,storedMarks:k}=o,{splittableMarks:w}=i.extensionManager,v=k||y.$to.parentOffset&&y.$from.marks();if(n.split(c.pos,2,b).scrollIntoView(),!v||!r)return!0;const _=v.filter(C=>w.includes(C.type.name));n.ensureMarks(_)}return!0},Ga=(t,e)=>{const n=xc(s=>s.type===e)(t.selection);if(!n)return!0;const o=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(o===void 0)return!0;const r=t.doc.nodeAt(o);return n.node.type===(r==null?void 0:r.type)&&yo(t.doc,n.pos)&&t.join(n.pos),!0},Ya=(t,e)=>{const n=xc(s=>s.type===e)(t.selection);if(!n)return!0;const o=t.doc.resolve(n.start).after(n.depth);if(o===void 0)return!0;const r=t.doc.nodeAt(o);return n.node.type===(r==null?void 0:r.type)&&yo(t.doc,o)&&t.join(o),!0},zE=(t,e,n,o={})=>({editor:r,tr:i,state:s,dispatch:a,chain:c,commands:d,can:u})=>{const{extensions:p,splittableMarks:f}=r.extensionManager,h=dt(t,s.schema),m=dt(e,s.schema),{selection:g,storedMarks:b}=s,{$from:y,$to:k}=g,w=y.blockRange(k),v=b||g.$to.parentOffset&&g.$from.marks();if(!w)return!1;const _=xc(C=>_u(C.type.name,p))(g);if(w.depth>=1&&_&&w.depth-_.depth<=1){if(_.node.type===h)return d.liftListItem(m);if(_u(_.node.type.name,p)&&h.validContent(_.node.content)&&a)return c().command(()=>(i.setNodeMarkup(_.pos,h),!0)).command(()=>Ga(i,h)).command(()=>Ya(i,h)).run()}return!n||!v||!a?c().command(()=>u().wrapInList(h,o)?!0:d.clearNodes()).wrapInList(h,o).command(()=>Ga(i,h)).command(()=>Ya(i,h)).run():c().command(()=>{const C=u().wrapInList(h,o),A=v.filter(L=>f.includes(L.type.name));return i.ensureMarks(A),C?!0:d.clearNodes()}).wrapInList(h,o).command(()=>Ga(i,h)).command(()=>Ya(i,h)).run()},HE=(t,e={},n={})=>({state:o,commands:r})=>{const{extendEmptyMarkRange:i=!1}=n,s=ko(t,o.schema);return Bl(o,s,e)?r.unsetMark(s,{extendEmptyMarkRange:i}):r.setMark(s,e)},UE=(t,e,n={})=>({state:o,commands:r})=>{const i=dt(t,o.schema),s=dt(e,o.schema),a=ri(o,i,n);let c;return o.selection.$anchor.sameParent(o.selection.$head)&&(c=o.selection.$anchor.parent.attrs),a?r.setNode(s,c):r.setNode(i,{...c,...n})},qE=(t,e={})=>({state:n,commands:o})=>{const r=dt(t,n.schema);return ri(n,r,e)?o.lift(r):o.wrapIn(r,e)},WE=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let o=0;o<n.length;o+=1){const r=n[o];let i;if(r.spec.isInputRules&&(i=r.getState(t))){if(e){const s=t.tr,a=i.transform;for(let c=a.steps.length-1;c>=0;c-=1)s.step(a.steps[c].invert(a.docs[c]));if(i.text){const c=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,c))}else s.delete(i.from,i.to)}return!0}}return!1},KE=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:o,ranges:r}=n;return o||e&&r.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0},jE=(t,e={})=>({tr:n,state:o,dispatch:r})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:a}=n,c=ko(t,o.schema),{$from:d,empty:u,ranges:p}=a;if(!r)return!0;if(u&&s){let{from:f,to:h}=a;const m=(i=d.marks().find(b=>b.type===c))===null||i===void 0?void 0:i.attrs,g=wr(d,c,m);g&&(f=g.from,h=g.to),n.removeMark(f,h,c)}else p.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,c)});return n.removeStoredMark(c),!0},GE=(t,e={})=>({tr:n,state:o,dispatch:r})=>{let i=null,s=null;const a=ma(typeof t=="string"?t:t.name,o.schema);return a?(a==="node"&&(i=dt(t,o.schema)),a==="mark"&&(s=ko(t,o.schema)),r&&n.selection.ranges.forEach(c=>{const d=c.$from.pos,u=c.$to.pos;let p,f,h,m;n.selection.empty?o.doc.nodesBetween(d,u,(g,b)=>{i&&i===g.type&&(h=Math.max(b,d),m=Math.min(b+g.nodeSize,u),p=b,f=g)}):o.doc.nodesBetween(d,u,(g,b)=>{b<d&&i&&i===g.type&&(h=Math.max(b,d),m=Math.min(b+g.nodeSize,u),p=b,f=g),b>=d&&b<=u&&(i&&i===g.type&&n.setNodeMarkup(b,void 0,{...g.attrs,...e}),s&&g.marks.length&&g.marks.forEach(y=>{if(s===y.type){const k=Math.max(b,d),w=Math.min(b+g.nodeSize,u);n.addMark(k,w,s.create({...y.attrs,...e}))}}))}),f&&(p!==void 0&&n.setNodeMarkup(p,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},YE=(t,e={})=>({state:n,dispatch:o})=>{const r=dt(t,n.schema);return uk(r,e)(n,o)},JE=(t,e={})=>({state:n,dispatch:o})=>{const r=dt(t,n.schema);return pk(r,e)(n,o)};var XE=Object.freeze({__proto__:null,blur:Bk,clearContent:Lk,clearNodes:Pk,command:$k,createParagraphNear:Fk,cut:Vk,deleteCurrentNode:zk,deleteNode:Hk,deleteRange:Uk,deleteSelection:qk,enter:Wk,exitCode:Kk,extendMarkRange:jk,first:Gk,focus:Yk,forEach:Jk,insertContent:Xk,insertContentAt:eE,joinBackward:oE,joinDown:nE,joinForward:rE,joinItemBackward:iE,joinItemForward:sE,joinTextblockBackward:aE,joinTextblockForward:lE,joinUp:tE,keyboardShortcut:dE,lift:uE,liftEmptyBlock:pE,liftListItem:fE,newlineInCode:hE,resetAttributes:mE,scrollIntoView:gE,selectAll:bE,selectNodeBackward:yE,selectNodeForward:vE,selectParentNode:kE,selectTextblockEnd:EE,selectTextblockStart:wE,setContent:CE,setMark:DE,setMeta:IE,setNode:BE,setNodeSelection:LE,setTextSelection:PE,sinkListItem:$E,splitBlock:FE,splitListItem:VE,toggleList:zE,toggleMark:HE,toggleNode:UE,toggleWrap:qE,undoInputRule:WE,unsetAllMarks:KE,unsetMark:jE,updateAttributes:GE,wrapIn:YE,wrapInList:JE});const ZE=De.create({name:"commands",addCommands(){return{...XE}}}),QE=De.create({name:"drop",addProseMirrorPlugins(){return[new Se({key:new xe("tiptapDrop"),props:{handleDrop:(t,e,n,o)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:o})}}})]}}),ew=De.create({name:"editable",addProseMirrorPlugins(){return[new Se({key:new xe("editable"),props:{editable:()=>this.editor.options.editable}})]}}),tw=De.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Se({key:new xe("focusEvents"),props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const o=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(o),!1},blur:(e,n)=>{t.isFocused=!1;const o=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(o),!1}}}})]}}),nw=De.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:a})=>{const{selection:c,doc:d}=a,{empty:u,$anchor:p}=c,{pos:f,parent:h}=p,m=p.parent.isTextblock&&f>0?a.doc.resolve(f-1):p,g=m.parent.type.spec.isolating,b=p.pos-p.parentOffset,y=g&&m.parent.childCount===1?b===p.pos:ee.atStart(d).from===f;return!u||!h.type.isTextblock||h.textContent.length||!y||y&&p.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()]),o={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()},r={...o},i={...o,"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 ha()||kh()?i:r},addProseMirrorPlugins(){return[new Se({key:new xe("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(g=>g.getMeta("composition")))return;const o=t.some(g=>g.docChanged)&&!e.doc.eq(n.doc),r=t.some(g=>g.getMeta("preventClearDocument"));if(!o||r)return;const{empty:i,from:s,to:a}=e.selection,c=ee.atStart(e.doc).from,d=ee.atEnd(e.doc).to;if(i||!(s===c&&a===d)||!Tc(n.doc))return;const f=n.tr,h=ca({state:n,transaction:f}),{commands:m}=new da({editor:this.editor,state:h});if(m.clearNodes(),!!f.steps.length)return f}})]}}),ow=De.create({name:"paste",addProseMirrorPlugins(){return[new Se({key:new xe("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),rw=De.create({name:"tabindex",addProseMirrorPlugins(){return[new Se({key:new xe("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class xo{get name(){return this.node.type.name}constructor(e,n,o=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=o,this.resolvedPos=e,this.editor=n,this.currentNode=r}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,o=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,o=this.to-1}this.editor.commands.insertContentAt({from:n,to:o},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 xo(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 xo(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 xo(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,o)=>{const r=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=this.pos+o+(i?0:1),a=this.resolvedPos.doc.resolve(s);if(!r&&a.depth<=this.depth)return;const c=new xo(a,this.editor,r,r?n:null);r&&(c.actualDepth=this.depth+1),e.push(new xo(a,this.editor,r,r?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 o=null,r=this.parent;for(;r&&!o;){if(r.node.type.name===e)if(Object.keys(n).length>0){const i=r.node.attrs,s=Object.keys(n);for(let a=0;a<s.length;a+=1){const c=s[a];if(i[c]!==n[c])break}}else o=r;r=r.parent}return o}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},o=!1){let r=[];if(!this.children||this.children.length===0)return r;const i=Object.keys(n);return this.children.forEach(s=>{o&&r.length>0||(s.node.type.name===e&&i.every(c=>n[c]===s.node.attrs[c])&&r.push(s),!(o&&r.length>0)&&(r=r.concat(s.querySelectorAll(e,n,o))))}),r}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}}const iw=`.ProseMirror {
4
+ **/Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),Vb=require("openai"),zb=require("markdown-it"),ei=require("@yiitap/util-emoji");function yt(t){this.content=t}yt.prototype={constructor:yt,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 o=n&&n!=t?this.remove(n):this,r=o.find(t),i=o.content.slice();return r==-1?i.push(n||t,e):(i[r+1]=e,n&&(i[r]=n)),new yt(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new yt(n)},addToStart:function(t,e){return new yt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new yt(n)},addBefore:function(t,e,n){var o=this.remove(e),r=o.content.slice(),i=o.find(t);return r.splice(i==-1?r.length:i,0,e,n),new yt(r)},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=yt.from(t),t.size?new yt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=yt.from(t),t.size?new yt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=yt.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}};yt.from=function(t){if(t instanceof yt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new yt(e)};function Zp(t,e,n){for(let o=0;;o++){if(o==t.childCount||o==e.childCount)return t.childCount==e.childCount?null:n;let r=t.child(o),i=e.child(o);if(r==i){n+=r.nodeSize;continue}if(!r.sameMarkup(i))return n;if(r.isText&&r.text!=i.text){for(let s=0;r.text[s]==i.text[s];s++)n++;return n}if(r.content.size||i.content.size){let s=Zp(r.content,i.content,n+1);if(s!=null)return s}n+=r.nodeSize}}function Qp(t,e,n,o){for(let r=t.childCount,i=e.childCount;;){if(r==0||i==0)return r==i?null:{a:n,b:o};let s=t.child(--r),l=e.child(--i),c=s.nodeSize;if(s==l){n-=c,o-=c;continue}if(!s.sameMarkup(l))return{a:n,b:o};if(s.isText&&s.text!=l.text){let u=0,d=Math.min(s.text.length,l.text.length);for(;u<d&&s.text[s.text.length-u-1]==l.text[l.text.length-u-1];)u++,n--,o--;return{a:n,b:o}}if(s.content.size||l.content.size){let u=Qp(s.content,l.content,n-1,o-1);if(u)return u}n-=c,o-=c}}class A{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let o=0;o<e.length;o++)this.size+=e[o].nodeSize}nodesBetween(e,n,o,r=0,i){for(let s=0,l=0;l<n;s++){let c=this.content[s],u=l+c.nodeSize;if(u>e&&o(c,r+l,i||null,s)!==!1&&c.content.size){let d=l+1;c.nodesBetween(Math.max(0,e-d),Math.min(c.content.size,n-d),o,r+d)}l=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,o,r){let i="",s=!0;return this.nodesBetween(e,n,(l,c)=>{let u=l.isText?l.text.slice(Math.max(e,c)-c,n-c):l.isLeaf?r?typeof r=="function"?r(l):r:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&u||l.isTextblock)&&o&&(s?s=!1:i+=o),i+=u},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,o=e.firstChild,r=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(o)&&(r[r.length-1]=n.withText(n.text+o.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new A(r,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let o=[],r=0;if(n>e)for(let i=0,s=0;s<n;i++){let l=this.content[i],c=s+l.nodeSize;c>e&&((s<e||c>n)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,n-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,n-s-1))),o.push(l),r+=l.nodeSize),s=c}return new A(o,r)}cutByIndex(e,n){return e==n?A.empty:e==0&&n==this.content.length?this:new A(this.content.slice(e,n))}replaceChild(e,n){let o=this.content[e];if(o==n)return this;let r=this.content.slice(),i=this.size+n.nodeSize-o.nodeSize;return r[e]=n,new A(r,i)}addToStart(e){return new A([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new A(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,o=0;n<this.content.length;n++){let r=this.content[n];e(r,o,n),o+=r.nodeSize}}findDiffStart(e,n=0){return Zp(this,e,n)}findDiffEnd(e,n=this.size,o=e.size){return Qp(this,e,n,o)}findIndex(e,n=-1){if(e==0)return Ri(0,e);if(e==this.size)return Ri(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let o=0,r=0;;o++){let i=this.child(o),s=r+i.nodeSize;if(s>=e)return s==e||n>0?Ri(o+1,s):Ri(o,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return A.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new A(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return A.empty;let n,o=0;for(let r=0;r<e.length;r++){let i=e[r];o+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(n||(n=e.slice(0,r)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new A(n||e,o)}static from(e){if(!e)return A.empty;if(e instanceof A)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new A([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}A.empty=new A([],0);const La={index:0,offset:0};function Ri(t,e){return La.index=t,La.offset=e,La}function fs(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 o=0;o<t.length;o++)if(!fs(t[o],e[o]))return!1}else{for(let o in t)if(!(o in e)||!fs(t[o],e[o]))return!1;for(let o in e)if(!(o in t))return!1}return!0}let He=class vl{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,o=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!o&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,r)),n.push(this),o=!0),n&&n.push(i)}}return n||(n=e.slice()),o||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&&fs(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 o=e.marks[n.type];if(!o)throw new RangeError(`There is no mark type ${n.type} in this schema`);let r=o.create(n.attrs);return o.checkAttrs(r.attrs),r}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let o=0;o<e.length;o++)if(!e[o].eq(n[o]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return vl.none;if(e instanceof vl)return[e];let n=e.slice();return n.sort((o,r)=>o.type.rank-r.type.rank),n}};He.none=[];class hs extends Error{}class V{constructor(e,n,o){this.content=e,this.openStart=n,this.openEnd=o}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let o=tf(this.content,e+this.openStart,n);return o&&new V(o,this.openStart,this.openEnd)}removeBetween(e,n){return new V(ef(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 V.empty;let o=n.openStart||0,r=n.openEnd||0;if(typeof o!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new V(A.fromJSON(e,n.content),o,r)}static maxOpen(e,n=!0){let o=0,r=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)o++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)r++;return new V(e,o,r)}}V.empty=new V(A.empty,0,0);function ef(t,e,n){let{index:o,offset:r}=t.findIndex(e),i=t.maybeChild(o),{index:s,offset:l}=t.findIndex(n);if(r==e||i.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(o!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(o,i.copy(ef(i.content,e-r-1,n-r-1)))}function tf(t,e,n,o){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r);if(i==e||s.isText)return t.cut(0,e).append(n).append(t.cut(e));let l=tf(s.content,e-i-1,n);return l&&t.replaceChild(r,s.copy(l))}function Hb(t,e,n){if(n.openStart>t.depth)throw new hs("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new hs("Inconsistent open depths");return nf(t,e,n,0)}function nf(t,e,n,o){let r=t.index(o),i=t.node(o);if(r==e.index(o)&&o<t.depth-n.openStart){let s=nf(t,e,n,o+1);return i.copy(i.content.replaceChild(r,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==o&&e.depth==o){let s=t.parent,l=s.content;return Lo(s,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=Ub(n,t);return Lo(i,rf(t,s,l,e,o))}else return Lo(i,ms(t,e,o))}function of(t,e){if(!e.type.compatibleContent(t.type))throw new hs("Cannot join "+e.type.name+" onto "+t.type.name)}function kl(t,e,n){let o=t.node(n);return of(o,e.node(n)),o}function Io(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 zr(t,e,n,o){let r=(e||t).node(n),i=0,s=e?e.index(n):r.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(Io(t.nodeAfter,o),i++));for(let l=i;l<s;l++)Io(r.child(l),o);e&&e.depth==n&&e.textOffset&&Io(e.nodeBefore,o)}function Lo(t,e){return t.type.checkContent(e),t.copy(e)}function rf(t,e,n,o,r){let i=t.depth>r&&kl(t,e,r+1),s=o.depth>r&&kl(n,o,r+1),l=[];return zr(null,t,r,l),i&&s&&e.index(r)==n.index(r)?(of(i,s),Io(Lo(i,rf(t,e,n,o,r+1)),l)):(i&&Io(Lo(i,ms(t,e,r+1)),l),zr(e,n,r,l),s&&Io(Lo(s,ms(n,o,r+1)),l)),zr(o,null,r,l),new A(l)}function ms(t,e,n){let o=[];if(zr(null,t,n,o),t.depth>n){let r=kl(t,e,n+1);Io(Lo(r,ms(t,e,n+1)),o)}return zr(e,null,n,o),new A(o)}function Ub(t,e){let n=e.depth-t.openStart,r=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)r=e.node(i).copy(A.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}class ti{constructor(e,n,o){this.pos=e,this.path=n,this.parentOffset=o,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 o=this.pos-this.path[this.path.length-1],r=e.child(n);return o?e.child(n).cut(o):r}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 o=this.path[n*3],r=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)r+=o.child(i).nodeSize;return r}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return He.none;if(this.textOffset)return e.child(n).marks;let o=e.maybeChild(n-1),r=e.maybeChild(n);if(!o){let l=o;o=r,r=l}let i=o.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!r||!i[s].isInSet(r.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let o=n.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!r||!o[i].isInSet(r.marks))&&(o=o[i--].removeFromSet(o));return o}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 o=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);o>=0;o--)if(e.pos<=this.end(o)&&(!n||n(this.node(o))))return new gs(this,e,o);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 o=[],r=0,i=n;for(let s=e;;){let{index:l,offset:c}=s.content.findIndex(i),u=i-c;if(o.push(s,l,r+c),!u||(s=s.child(l),s.isText))break;i=u-1,r+=c+1}return new ti(n,o,i)}static resolveCached(e,n){let o=Mu.get(e);if(o)for(let i=0;i<o.elts.length;i++){let s=o.elts[i];if(s.pos==n)return s}else Mu.set(e,o=new qb);let r=o.elts[o.i]=ti.resolve(e,n);return o.i=(o.i+1)%Kb,r}}class qb{constructor(){this.elts=[],this.i=0}}const Kb=12,Mu=new WeakMap;class gs{constructor(e,n,o){this.$from=e,this.$to=n,this.depth=o}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 Wb=Object.create(null);let An=class wl{constructor(e,n,o,r=He.none){this.type=e,this.attrs=n,this.marks=r,this.content=o||A.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,o,r=0){this.content.nodesBetween(e,n,o,r,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,o,r){return this.content.textBetween(e,n,o,r)}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,o){return this.type==e&&fs(this.attrs,n||e.defaultAttrs||Wb)&&He.sameSet(this.marks,o||He.none)}copy(e=null){return e==this.content?this:new wl(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new wl(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,o=!1){if(e==n)return V.empty;let r=this.resolve(e),i=this.resolve(n),s=o?0:r.sharedDepth(n),l=r.start(s),u=r.node(s).content.cut(r.pos-l,i.pos-l);return new V(u,r.depth-s,i.depth-s)}replace(e,n,o){return Hb(this.resolve(e),this.resolve(n),o)}nodeAt(e){for(let n=this;;){let{index:o,offset:r}=n.content.findIndex(e);if(n=n.maybeChild(o),!n)return null;if(r==e||n.isText)return n;e-=r+1}}childAfter(e){let{index:n,offset:o}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:o}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:o}=this.content.findIndex(e);if(o<e)return{node:this.content.child(n),index:n,offset:o};let r=this.content.child(n-1);return{node:r,index:n-1,offset:o-r.nodeSize}}resolve(e){return ti.resolveCached(this,e)}resolveNoCache(e){return ti.resolve(this,e)}rangeHasMark(e,n,o){let r=!1;return n>e&&this.nodesBetween(e,n,i=>(o.isInSet(i.marks)&&(r=!0),!r)),r}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()+")"),sf(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,o=A.empty,r=0,i=o.childCount){let s=this.contentMatchAt(e).matchFragment(o,r,i),l=s&&s.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let c=r;c<i;c++)if(!this.type.allowsMarks(o.child(c).marks))return!1;return!0}canReplaceWith(e,n,o,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(o),s=i&&i.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=He.none;for(let n=0;n<this.marks.length;n++){let o=this.marks[n];o.type.checkAttrs(o.attrs),e=o.addToSet(e)}if(!He.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 o;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");o=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,o)}let r=A.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,r,o);return i.type.checkAttrs(i.attrs),i}};An.prototype.text=void 0;class bs extends An{constructor(e,n,o,r){if(super(e,n,null,r),!o)throw new RangeError("Empty text nodes are not allowed");this.text=o}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):sf(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 bs(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new bs(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 sf(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Uo{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let o=new jb(e,n);if(o.next==null)return Uo.empty;let r=af(o);o.next&&o.err("Unexpected trailing text");let i=ey(Qb(r));return ty(i,o),i}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,o=e.childCount){let r=this;for(let i=n;r&&i<o;i++)r=r.matchType(e.child(i).type);return r}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 o=0;o<e.next.length;o++)if(this.next[n].type==e.next[o].type)return!0;return!1}fillBefore(e,n=!1,o=0){let r=[this];function i(s,l){let c=s.matchFragment(e,o);if(c&&(!n||c.validEnd))return A.from(l.map(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:d,next:p}=s.next[u];if(!(d.isText||d.hasRequiredAttrs())&&r.indexOf(p)==-1){r.push(p);let f=i(p,l.concat(d));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let o=0;o<this.wrapCache.length;o+=2)if(this.wrapCache[o]==e)return this.wrapCache[o+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),o=[{match:this,type:null,via:null}];for(;o.length;){let r=o.shift(),i=r.match;if(i.matchType(e)){let s=[];for(let l=r;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:c}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!r.type||c.validEnd)&&(o.push({match:l.contentMatch,type:l,via:r}),n[l.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(o){e.push(o);for(let r=0;r<o.next.length;r++)e.indexOf(o.next[r].next)==-1&&n(o.next[r].next)}return n(this),e.map((o,r)=>{let i=r+(o.validEnd?"*":" ")+" ";for(let s=0;s<o.next.length;s++)i+=(s?", ":"")+o.next[s].type.name+"->"+e.indexOf(o.next[s].next);return i}).join(`
5
+ `)}}Uo.empty=new Uo(!0);class jb{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 af(t){let e=[];do e.push(Gb(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Gb(t){let e=[];do e.push(Yb(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Yb(t){let e=Zb(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=Jb(t,e);else break;return e}function Au(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function Jb(t,e){let n=Au(t),o=n;return t.eat(",")&&(t.next!="}"?o=Au(t):o=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:o,expr:e}}function Xb(t,e){let n=t.nodeTypes,o=n[e];if(o)return[o];let r=[];for(let i in n){let s=n[i];s.isInGroup(e)&&r.push(s)}return r.length==0&&t.err("No node type or group '"+e+"' found"),r}function Zb(t){if(t.eat("(")){let e=af(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=Xb(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 Qb(t){let e=[[]];return r(i(t,0),n()),e;function n(){return e.push([])-1}function o(s,l,c){let u={term:c,to:l};return e[s].push(u),u}function r(s,l){s.forEach(c=>c.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((c,u)=>c.concat(i(u,l)),[]);if(s.type=="seq")for(let c=0;;c++){let u=i(s.exprs[c],l);if(c==s.exprs.length-1)return u;r(u,l=n())}else if(s.type=="star"){let c=n();return o(l,c),r(i(s.expr,c),c),[o(c)]}else if(s.type=="plus"){let c=n();return r(i(s.expr,l),c),r(i(s.expr,c),c),[o(c)]}else{if(s.type=="opt")return[o(l)].concat(i(s.expr,l));if(s.type=="range"){let c=l;for(let u=0;u<s.min;u++){let d=n();r(i(s.expr,c),d),c=d}if(s.max==-1)r(i(s.expr,c),c);else for(let u=s.min;u<s.max;u++){let d=n();o(c,d),r(i(s.expr,c),d),c=d}return[o(c)]}else{if(s.type=="name")return[o(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function lf(t,e){return e-t}function Ru(t,e){let n=[];return o(e),n.sort(lf);function o(r){let i=t[r];if(i.length==1&&!i[0].term)return o(i[0].to);n.push(r);for(let s=0;s<i.length;s++){let{term:l,to:c}=i[s];!l&&n.indexOf(c)==-1&&o(c)}}}function ey(t){let e=Object.create(null);return n(Ru(t,0));function n(o){let r=[];o.forEach(s=>{t[s].forEach(({term:l,to:c})=>{if(!l)return;let u;for(let d=0;d<r.length;d++)r[d][0]==l&&(u=r[d][1]);Ru(t,c).forEach(d=>{u||r.push([l,u=[]]),u.indexOf(d)==-1&&u.push(d)})})});let i=e[o.join(",")]=new Uo(o.indexOf(t.length-1)>-1);for(let s=0;s<r.length;s++){let l=r[s][1].sort(lf);i.next.push({type:r[s][0],next:e[l.join(",")]||n(l)})}return i}}function ty(t,e){for(let n=0,o=[t];n<o.length;n++){let r=o[n],i=!r.validEnd,s=[];for(let l=0;l<r.next.length;l++){let{type:c,next:u}=r.next[l];s.push(c.name),i&&!(c.isText||c.hasRequiredAttrs())&&(i=!1),o.indexOf(u)==-1&&o.push(u)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function cf(t){let e=Object.create(null);for(let n in t){let o=t[n];if(!o.hasDefault)return null;e[n]=o.default}return e}function uf(t,e){let n=Object.create(null);for(let o in t){let r=e&&e[o];if(r===void 0){let i=t[o];if(i.hasDefault)r=i.default;else throw new RangeError("No value supplied for attribute "+o)}n[o]=r}return n}function df(t,e,n,o){for(let r in e)if(!(r in t))throw new RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let r in t){let i=t[r];i.validate&&i.validate(e[r])}}function pf(t,e){let n=Object.create(null);if(e)for(let o in e)n[o]=new oy(t,o,e[o]);return n}let Bu=class ff{constructor(e,n,o){this.name=e,this.schema=n,this.spec=o,this.markSet=null,this.groups=o.group?o.group.split(" "):[],this.attrs=pf(e,o.attrs),this.defaultAttrs=cf(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(o.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Uo.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:uf(this.attrs,e)}create(e=null,n,o){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new An(this,this.computeAttrs(e),A.from(n),He.setFrom(o))}createChecked(e=null,n,o){return n=A.from(n),this.checkContent(n),new An(this,this.computeAttrs(e),n,He.setFrom(o))}createAndFill(e=null,n,o){if(e=this.computeAttrs(e),n=A.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let r=this.contentMatch.matchFragment(n),i=r&&r.fillBefore(A.empty,!0);return i?new An(this,e,n.append(i),He.setFrom(o)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let o=0;o<e.childCount;o++)if(!this.allowsMarks(e.child(o).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){df(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 o=0;o<e.length;o++)this.allowsMarkType(e[o].type)?n&&n.push(e[o]):n||(n=e.slice(0,o));return n?n.length?n:He.none:e}static compile(e,n){let o=Object.create(null);e.forEach((i,s)=>o[i]=new ff(i,n,s));let r=n.spec.topNode||"doc";if(!o[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!o.text)throw new RangeError("Every schema needs a 'text' type");for(let i in o.text.attrs)throw new RangeError("The text node type should not have attributes");return o}};function ny(t,e,n){let o=n.split("|");return r=>{let i=r===null?"null":typeof r;if(o.indexOf(i)<0)throw new RangeError(`Expected value of type ${o} for attribute ${e} on type ${t}, got ${i}`)}}class oy{constructor(e,n,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?ny(e,n,o.validate):o.validate}get isRequired(){return!this.hasDefault}}class ia{constructor(e,n,o,r){this.name=e,this.rank=n,this.schema=o,this.spec=r,this.attrs=pf(e,r.attrs),this.excluded=null;let i=cf(this.attrs);this.instance=i?new He(this,i):null}create(e=null){return!e&&this.instance?this.instance:new He(this,uf(this.attrs,e))}static compile(e,n){let o=Object.create(null),r=0;return e.forEach((i,s)=>o[i]=new ia(i,r++,n,s)),o}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){df(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class hf{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let r in e)n[r]=e[r];n.nodes=yt.from(e.nodes),n.marks=yt.from(e.marks||{}),this.nodes=Bu.compile(this.spec.nodes,this),this.marks=ia.compile(this.spec.marks,this);let o=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let i=this.nodes[r],s=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=o[s]||(o[s]=Uo.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?Du(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let r in this.marks){let i=this.marks[r],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:Du(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,o,r){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Bu){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,o,r)}text(e,n){let o=this.nodes.text;return new bs(o,o.defaultAttrs,e,He.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return An.fromJSON(this,e)}markFromJSON(e){return He.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Du(t,e){let n=[];for(let o=0;o<e.length;o++){let r=e[o],i=t.marks[r],s=i;if(i)n.push(i);else for(let l in t.marks){let c=t.marks[l];(r=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(r)>-1)&&n.push(s=c)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[o]+"'")}return n}function ry(t){return t.tag!=null}function iy(t){return t.style!=null}let lr=class El{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let o=this.matchedStyles=[];n.forEach(r=>{if(ry(r))this.tags.push(r);else if(iy(r)){let i=/[^=]*/.exec(r.style)[0];o.indexOf(i)<0&&o.push(i),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let o=new Lu(this,n,!1);return o.addAll(e,He.none,n.from,n.to),o.finish()}parseSlice(e,n={}){let o=new Lu(this,n,!0);return o.addAll(e,He.none,n.from,n.to),V.maxOpen(o.finish())}matchTag(e,n,o){for(let r=o?this.tags.indexOf(o)+1:0;r<this.tags.length;r++){let i=this.tags[r];if(ly(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,n,o,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!o.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(s.getAttrs){let c=s.getAttrs(n);if(c===!1)continue;s.attrs=c||void 0}return s}}}static schemaRules(e){let n=[];function o(r){let i=r.priority==null?50:r.priority,s=0;for(;s<n.length;s++){let l=n[s];if((l.priority==null?50:l.priority)<i)break}n.splice(s,0,r)}for(let r in e.marks){let i=e.marks[r].spec.parseDOM;i&&i.forEach(s=>{o(s=Pu(s)),s.mark||s.ignore||s.clearMark||(s.mark=r)})}for(let r in e.nodes){let i=e.nodes[r].spec.parseDOM;i&&i.forEach(s=>{o(s=Pu(s)),s.node||s.ignore||s.mark||(s.node=r)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new El(e,El.schemaRules(e)))}};const mf={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},sy={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},gf={ol:!0,ul:!0},ni=1,_l=2,ns=4;function Iu(t,e,n){return e!=null?(e?ni:0)|(e==="full"?_l:0):t&&t.whitespace=="pre"?ni|_l:n&-5}class Bi{constructor(e,n,o,r,i,s){this.type=e,this.attrs=n,this.marks=o,this.solid=r,this.options=s,this.content=[],this.activeMarks=He.none,this.match=i||(s&ns?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(A.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let o=this.type.contentMatch,r;return(r=o.findWrapping(e.type))?(this.match=o,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ni)){let o=this.content[this.content.length-1],r;if(o&&o.isText&&(r=/[ \t\r\n\u000c]+$/.exec(o.text))){let i=o;o.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-r[0].length))}}let n=A.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(A.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&&!mf.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Lu{constructor(e,n,o){this.parser=e,this.options=n,this.isOpen=o,this.open=0,this.localPreserveWS=!1;let r=n.topNode,i,s=Iu(null,n.preserveWhitespace,0)|(o?ns:0);r?i=new Bi(r.type,r.attrs,He.none,!0,n.topMatch||r.type.contentMatch,s):o?i=new Bi(null,null,He.none,!0,null,s):i=new Bi(e.schema.topNodeType,null,He.none,!0,null,s),this.nodes=[i],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 o=e.nodeValue,r=this.top,i=r.options&_l?"full":this.localPreserveWS||(r.options&ni)>0;if(i==="full"||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(o)){if(i)i!=="full"?o=o.replace(/\r?\n|\r/g," "):o=o.replace(/\r\n?/g,`
6
+ `);else if(o=o.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(o)&&this.open==this.nodes.length-1){let s=r.content[r.content.length-1],l=e.previousSibling;(!s||l&&l.nodeName=="BR"||s.isText&&/[ \t\r\n\u000c]$/.test(s.text))&&(o=o.slice(1))}o&&this.insertNode(this.parser.schema.text(o),n),this.findInText(e)}else this.findInside(e)}addElement(e,n,o){let r=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;gf.hasOwnProperty(s)&&this.parser.normalizeLists&&ay(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,o));e:if(c?c.ignore:sy.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!c||c.skip||c.closeParent){c&&c.closeParent?this.open=Math.max(0,this.open-1):c&&c.skip.nodeType&&(e=c.skip);let u,d=this.needsBlock;if(mf.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),u=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let p=c&&c.skip?n:this.readStyles(e,n);p&&this.addAll(e,p),u&&this.sync(i),this.needsBlock=d}else{let u=this.readStyles(e,n);u&&this.addElementByRule(e,c,u,c.consuming===!1?l:void 0)}this.localPreserveWS=r}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
7
+ `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n)}readStyles(e,n){let o=e.style;if(o&&o.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let i=this.parser.matchedStyles[r],s=o.getPropertyValue(i);if(s)for(let l=void 0;;){let c=this.parser.matchStyle(i,s,this,l);if(!c)break;if(c.ignore)return null;if(c.clearMark?n=n.filter(u=>!c.clearMark(u)):n=n.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)l=c;else break}}return n}addElementByRule(e,n,o,r){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),o)||this.leafFallback(e,o);else{let c=this.enter(s,n.attrs||null,o,n.preserveWhitespace);c&&(i=!0,o=c)}else{let c=this.parser.schema.marks[n.mark];o=o.concat(c.create(n.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,o,r);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,o));else{let c=e;typeof n.contentElement=="string"?c=e.querySelector(n.contentElement):typeof n.contentElement=="function"?c=n.contentElement(e):n.contentElement&&(c=n.contentElement),this.findAround(e,c,!0),this.addAll(c,o),this.findAround(e,c,!1)}i&&this.sync(l)&&this.open--}addAll(e,n,o,r){let i=o||0;for(let s=o?e.childNodes[o]:e.firstChild,l=r==null?null:e.childNodes[r];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,n);this.findAtPoint(e,i)}findPlace(e,n){let o,r;for(let i=this.open;i>=0;i--){let s=this.nodes[i],l=s.findWrapping(e);if(l&&(!o||o.length>l.length)&&(o=l,r=s,!l.length)||s.solid)break}if(!o)return null;this.sync(r);for(let i=0;i<o.length;i++)n=this.enterInner(o[i],null,n,!1);return n}insertNode(e,n){if(e.isInline&&this.needsBlock&&!this.top.type){let r=this.textblockFromContext();r&&(n=this.enterInner(r,null,n))}let o=this.findPlace(e,n);if(o){this.closeExtra();let r=this.top;r.match&&(r.match=r.match.matchType(e.type));let i=He.none;for(let s of o.concat(e.marks))(r.type?r.type.allowsMarkType(s.type):$u(s.type,e.type))&&(i=s.addToSet(i));return r.content.push(e.mark(i)),!0}return!1}enter(e,n,o,r){let i=this.findPlace(e.create(n),o);return i&&(i=this.enterInner(e,n,o,!0,r)),i}enterInner(e,n,o,r=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=Iu(e,i,s.options);s.options&ns&&s.content.length==0&&(l|=ns);let c=He.none;return o=o.filter(u=>(s.type?s.type.allowsMarkType(u.type):$u(u.type,e))?(c=u.addToSet(c),!1):!0),this.nodes.push(new Bi(e,n,c,r,null,l)),this.open++,o}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|=ni)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let o=this.nodes[n].content;for(let r=o.length-1;r>=0;r--)e+=o[r].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let o=0;o<this.find.length;o++)this.find[o].node==e&&this.find[o].offset==n&&(this.find[o].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,o){if(e!=n&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&n.compareDocumentPosition(this.find[r].node)&(o?2:4)&&(this.find[r].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("/"),o=this.options.context,r=!this.isOpen&&(!o||o.parent.type==this.nodes[0].type),i=-(o?o.depth+1:0)+(r?0:1),s=(l,c)=>{for(;l>=0;l--){let u=n[l];if(u==""){if(l==n.length-1||l==0)continue;for(;c>=i;c--)if(s(l-1,c))return!0;return!1}else{let d=c>0||c==0&&r?this.nodes[c].type:o&&c>=i?o.node(c-i).type:null;if(!d||d.name!=u&&!d.isInGroup(u))return!1;c--}}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 o=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(o&&o.isTextblock&&o.defaultAttrs)return o}for(let n in this.parser.schema.nodes){let o=this.parser.schema.nodes[n];if(o.isTextblock&&o.defaultAttrs)return o}}}function ay(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&gf.hasOwnProperty(o)&&n?(n.appendChild(e),e=n):o=="li"?n=e:o&&(n=null)}}function ly(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Pu(t){let e={};for(let n in t)e[n]=t[n];return e}function $u(t,e){let n=e.schema.nodes;for(let o in n){let r=n[o];if(!r.allowsMarkType(t))continue;let i=[],s=l=>{i.push(l);for(let c=0;c<l.edgeCount;c++){let{type:u,next:d}=l.edge(c);if(u==e||i.indexOf(d)<0&&s(d))return!0}};if(s(r.contentMatch))return!0}}class Yo{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},o){o||(o=Pa(n).createDocumentFragment());let r=o,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let l=0,c=0;for(;l<i.length&&c<s.marks.length;){let u=s.marks[c];if(!this.marks[u.type.name]){c++;continue}if(!u.eq(i[l][0])||u.type.spec.spanning===!1)break;l++,c++}for(;l<i.length;)r=i.pop()[1];for(;c<s.marks.length;){let u=s.marks[c++],d=this.serializeMark(u,s.isInline,n);d&&(i.push([u,r]),r.appendChild(d.dom),r=d.contentDOM||d.dom)}}r.appendChild(this.serializeNodeInner(s,n))}),o}serializeNodeInner(e,n){let{dom:o,contentDOM:r}=rs(Pa(n),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,r)}return o}serializeNode(e,n={}){let o=this.serializeNodeInner(e,n);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(o),o=i.dom)}return o}serializeMark(e,n,o={}){let r=this.marks[e.type.name];return r&&rs(Pa(o),r(e,n),null,e.attrs)}static renderSpec(e,n,o=null,r){return rs(e,n,o,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Yo(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Fu(e.nodes);return n.text||(n.text=o=>o.text),n}static marksFromSchema(e){return Fu(e.marks)}}function Fu(t){let e={};for(let n in t){let o=t[n].spec.toDOM;o&&(e[n]=o)}return e}function Pa(t){return t.document||window.document}const Vu=new WeakMap;function cy(t){let e=Vu.get(t);return e===void 0&&Vu.set(t,e=uy(t)),e}function uy(t){let e=null;function n(o){if(o&&typeof o=="object")if(Array.isArray(o))if(typeof o[0]=="string")e||(e=[]),e.push(o);else for(let r=0;r<o.length;r++)n(o[r]);else for(let r in o)n(o[r])}return n(t),e}function rs(t,e,n,o){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 r=e[0],i;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(o&&(i=cy(o))&&i.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=r.indexOf(" ");s>0&&(n=r.slice(0,s),r=r.slice(s+1));let l,c=n?t.createElementNS(n,r):t.createElement(r),u=e[1],d=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){d=2;for(let p in u)if(u[p]!=null){let f=p.indexOf(" ");f>0?c.setAttributeNS(p.slice(0,f),p.slice(f+1),u[p]):c.setAttribute(p,u[p])}}for(let p=d;p<e.length;p++){let f=e[p];if(f===0){if(p<e.length-1||p>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else{let{dom:h,contentDOM:m}=rs(t,f,n,o);if(c.appendChild(h),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:c,contentDOM:l}}const bf=65535,yf=Math.pow(2,16);function dy(t,e){return t+e*yf}function zu(t){return t&bf}function py(t){return(t-(t&bf))/yf}const vf=1,kf=2,is=4,wf=8;class Cl{constructor(e,n,o){this.pos=e,this.delInfo=n,this.recover=o}get deleted(){return(this.delInfo&wf)>0}get deletedBefore(){return(this.delInfo&(vf|is))>0}get deletedAfter(){return(this.delInfo&(kf|is))>0}get deletedAcross(){return(this.delInfo&is)>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,o=zu(e);if(!this.inverted)for(let r=0;r<o;r++)n+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[o*3]+n+py(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,o){let r=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?r:0);if(c>e)break;let u=this.ranges[l+i],d=this.ranges[l+s],p=c+u;if(e<=p){let f=u?e==c?-1:e==p?1:n:n,h=c+r+(f<0?0:d);if(o)return h;let m=e==(n<0?c:p)?null:dy(l/3,e-c),g=e==c?kf:e==p?vf:is;return(n<0?e!=c:e!=p)&&(g|=wf),new Cl(h,g,m)}r+=d-u}return o?e+r:new Cl(e+r,0,null)}touches(e,n){let o=0,r=zu(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?o:0);if(c>e)break;let u=this.ranges[l+i],d=c+u;if(e<=d&&l==r*3)return!0;o+=this.ranges[l+s]-u}return!1}forEach(e){let n=this.inverted?2:1,o=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let s=this.ranges[r],l=s-(this.inverted?i:0),c=s+(this.inverted?0:i),u=this.ranges[r+n],d=this.ranges[r+o];e(l,l+u,c,c+d),i+=d-u}}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 oi{constructor(e,n,o=0,r=e?e.length:0){this.mirror=n,this.from=o,this.to=r,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new oi(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,o=this._maps.length;n<e._maps.length;n++){let r=e.getMirror(n);this.appendMap(e._maps[n],r!=null&&r<n?o+r: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,o=this._maps.length+e._maps.length;n>=0;n--){let r=e.getMirror(n);this.appendMap(e._maps[n].invert(),r!=null&&r>n?o-r-1:void 0)}}invert(){let e=new oi;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let o=this.from;o<this.to;o++)e=this._maps[o].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,o){let r=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],l=s.mapResult(e,n);if(l.recover!=null){let c=this.getMirror(i);if(c!=null&&c>i&&c<this.to){i=c,e=this._maps[c].recover(l.recover);continue}}r|=l.delInfo,e=l.pos}return o?e:new Cl(e,r,null)}}const $a=Object.create(null);class Nt{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 o=$a[n.stepType];if(!o)throw new RangeError(`No step type ${n.stepType} defined`);return o.fromJSON(e,n)}static jsonID(e,n){if(e in $a)throw new RangeError("Duplicate use of step JSON ID "+e);return $a[e]=n,n.prototype.jsonID=e,n}}class st{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new st(e,null)}static fail(e){return new st(null,e)}static fromReplace(e,n,o,r){try{return st.ok(e.replace(n,o,r))}catch(i){if(i instanceof hs)return st.fail(i.message);throw i}}}function cc(t,e,n){let o=[];for(let r=0;r<t.childCount;r++){let i=t.child(r);i.content.size&&(i=i.copy(cc(i.content,e,i))),i.isInline&&(i=e(i,n,r)),o.push(i)}return A.fromArray(o)}class po extends Nt{constructor(e,n,o){super(),this.from=e,this.to=n,this.mark=o}apply(e){let n=e.slice(this.from,this.to),o=e.resolve(this.from),r=o.node(o.sharedDepth(this.to)),i=new V(cc(n.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),r),n.openStart,n.openEnd);return st.fromReplace(e,this.from,this.to,i)}invert(){return new Mn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deleted&&o.deleted||n.pos>=o.pos?null:new po(n.pos,o.pos,this.mark)}merge(e){return e instanceof po&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new po(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 po(n.from,n.to,e.markFromJSON(n.mark))}}Nt.jsonID("addMark",po);class Mn extends Nt{constructor(e,n,o){super(),this.from=e,this.to=n,this.mark=o}apply(e){let n=e.slice(this.from,this.to),o=new V(cc(n.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),n.openStart,n.openEnd);return st.fromReplace(e,this.from,this.to,o)}invert(){return new po(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deleted&&o.deleted||n.pos>=o.pos?null:new Mn(n.pos,o.pos,this.mark)}merge(e){return e instanceof Mn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Mn(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 Mn(n.from,n.to,e.markFromJSON(n.mark))}}Nt.jsonID("removeMark",Mn);class fo extends Nt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return st.fail("No node at mark step's position");let o=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return st.fromReplace(e,this.pos,this.pos+1,new V(A.from(o),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let o=this.mark.addToSet(n.marks);if(o.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(o))return new fo(this.pos,n.marks[r]);return new fo(this.pos,this.mark)}}return new dr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new fo(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 fo(n.pos,e.markFromJSON(n.mark))}}Nt.jsonID("addNodeMark",fo);class dr extends Nt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return st.fail("No node at mark step's position");let o=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return st.fromReplace(e,this.pos,this.pos+1,new V(A.from(o),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new fo(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new dr(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 dr(n.pos,e.markFromJSON(n.mark))}}Nt.jsonID("removeNodeMark",dr);class pt extends Nt{constructor(e,n,o,r=!1){super(),this.from=e,this.to=n,this.slice=o,this.structure=r}apply(e){return this.structure&&Sl(e,this.from,this.to)?st.fail("Structure replace would overwrite content"):st.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 pt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deletedAcross&&o.deletedAcross?null:new pt(n.pos,Math.max(n.pos,o.pos),this.slice)}merge(e){if(!(e instanceof pt)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?V.empty:new V(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new pt(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?V.empty:new V(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new pt(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new pt(n.from,n.to,V.fromJSON(e,n.slice),!!n.structure)}}Nt.jsonID("replace",pt);class ft extends Nt{constructor(e,n,o,r,i,s,l=!1){super(),this.from=e,this.to=n,this.gapFrom=o,this.gapTo=r,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(Sl(e,this.from,this.gapFrom)||Sl(e,this.gapTo,this.to)))return st.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return st.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,n.content);return o?st.fromReplace(e,this.from,this.to,o):st.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 ft(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),o=e.mapResult(this.to,-1),r=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?o.pos:e.map(this.gapTo,1);return n.deletedAcross&&o.deletedAcross||r<n.pos||i>o.pos?null:new ft(n.pos,o.pos,r,i,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 ft(n.from,n.to,n.gapFrom,n.gapTo,V.fromJSON(e,n.slice),n.insert,!!n.structure)}}Nt.jsonID("replaceAround",ft);function Sl(t,e,n){let o=t.resolve(e),r=n-e,i=o.depth;for(;r>0&&i>0&&o.indexAfter(i)==o.node(i).childCount;)i--,r--;if(r>0){let s=o.node(i).maybeChild(o.indexAfter(i));for(;r>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,r--}}return!1}function fy(t,e,n,o){let r=[],i=[],s,l;t.doc.nodesBetween(e,n,(c,u,d)=>{if(!c.isInline)return;let p=c.marks;if(!o.isInSet(p)&&d.type.allowsMarkType(o.type)){let f=Math.max(u,e),h=Math.min(u+c.nodeSize,n),m=o.addToSet(p);for(let g=0;g<p.length;g++)p[g].isInSet(m)||(s&&s.to==f&&s.mark.eq(p[g])?s.to=h:r.push(s=new Mn(f,h,p[g])));l&&l.to==f?l.to=h:i.push(l=new po(f,h,o))}}),r.forEach(c=>t.step(c)),i.forEach(c=>t.step(c))}function hy(t,e,n,o){let r=[],i=0;t.doc.nodesBetween(e,n,(s,l)=>{if(!s.isInline)return;i++;let c=null;if(o instanceof ia){let u=s.marks,d;for(;d=o.isInSet(u);)(c||(c=[])).push(d),u=d.removeFromSet(u)}else o?o.isInSet(s.marks)&&(c=[o]):c=s.marks;if(c&&c.length){let u=Math.min(l+s.nodeSize,n);for(let d=0;d<c.length;d++){let p=c[d],f;for(let h=0;h<r.length;h++){let m=r[h];m.step==i-1&&p.eq(r[h].style)&&(f=m)}f?(f.to=u,f.step=i):r.push({style:p,from:Math.max(l,e),to:u,step:i})}}}),r.forEach(s=>t.step(new Mn(s.from,s.to,s.style)))}function uc(t,e,n,o=n.contentMatch,r=!0){let i=t.doc.nodeAt(e),s=[],l=e+1;for(let c=0;c<i.childCount;c++){let u=i.child(c),d=l+u.nodeSize,p=o.matchType(u.type);if(!p)s.push(new pt(l,d,V.empty));else{o=p;for(let f=0;f<u.marks.length;f++)n.allowsMarkType(u.marks[f].type)||t.step(new Mn(l,d,u.marks[f]));if(r&&u.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,m;for(;f=h.exec(u.text);)m||(m=new V(A.from(n.schema.text(" ",n.allowedMarks(u.marks))),0,0)),s.push(new pt(l+f.index,l+f.index+f[0].length,m))}}l=d}if(!o.validEnd){let c=o.fillBefore(A.empty,!0);t.replace(l,l,new V(c,0,0))}for(let c=s.length-1;c>=0;c--)t.step(s[c])}function my(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function _r(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let o=t.depth;;--o){let r=t.$from.node(o),i=t.$from.index(o),s=t.$to.indexAfter(o);if(o<t.depth&&r.canReplace(i,s,n))return o;if(o==0||r.type.spec.isolating||!my(r,i,s))break}return null}function gy(t,e,n){let{$from:o,$to:r,depth:i}=e,s=o.before(i+1),l=r.after(i+1),c=s,u=l,d=A.empty,p=0;for(let m=i,g=!1;m>n;m--)g||o.index(m)>0?(g=!0,d=A.from(o.node(m).copy(d)),p++):c--;let f=A.empty,h=0;for(let m=i,g=!1;m>n;m--)g||r.after(m+1)<r.end(m)?(g=!0,f=A.from(r.node(m).copy(f)),h++):u++;t.step(new ft(c,u,s,l,new V(d.append(f),p,h),d.size-p,!0))}function dc(t,e,n=null,o=t){let r=by(t,e),i=r&&yy(o,e);return i?r.map(Hu).concat({type:e,attrs:n}).concat(i.map(Hu)):null}function Hu(t){return{type:t,attrs:null}}function by(t,e){let{parent:n,startIndex:o,endIndex:r}=t,i=n.contentMatchAt(o).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(o,r,s)?i:null}function yy(t,e){let{parent:n,startIndex:o,endIndex:r}=t,i=n.child(o),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let c=(s.length?s[s.length-1]:e).contentMatch;for(let u=o;c&&u<r;u++)c=c.matchType(n.child(u).type);return!c||!c.validEnd?null:s}function vy(t,e,n){let o=A.empty;for(let s=n.length-1;s>=0;s--){if(o.size){let l=n[s].type.contentMatch.matchFragment(o);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=A.from(n[s].type.create(n[s].attrs,o))}let r=e.start,i=e.end;t.step(new ft(r,i,r,i,new V(o,0,0),n.length,!0))}function ky(t,e,n,o,r){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,l)=>{let c=typeof r=="function"?r(s):r;if(s.isTextblock&&!s.hasMarkup(o,c)&&wy(t.doc,t.mapping.slice(i).map(l),o)){let u=null;if(o.schema.linebreakReplacement){let h=o.whitespace=="pre",m=!!o.contentMatch.matchType(o.schema.linebreakReplacement);h&&!m?u=!1:!h&&m&&(u=!0)}u===!1&&_f(t,s,l,i),uc(t,t.mapping.slice(i).map(l,1),o,void 0,u===null);let d=t.mapping.slice(i),p=d.map(l,1),f=d.map(l+s.nodeSize,1);return t.step(new ft(p,f,p+1,f-1,new V(A.from(o.create(c,null,s.marks)),0,0),1,!0)),u===!0&&Ef(t,s,l,i),!1}})}function Ef(t,e,n,o){e.forEach((r,i)=>{if(r.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(r.text);){let c=t.mapping.slice(o).map(n+1+i+s.index);t.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function _f(t,e,n,o){e.forEach((r,i)=>{if(r.type==r.type.schema.linebreakReplacement){let s=t.mapping.slice(o).map(n+1+i);t.replaceWith(s,s+1,e.type.schema.text(`
8
+ `))}})}function wy(t,e,n){let o=t.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,n)}function Ey(t,e,n,o,r){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(o,null,r||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new ft(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new V(A.from(s),0,0),1,!0))}function Yn(t,e,n=1,o){let r=t.resolve(e),i=r.depth-n,s=o&&o[o.length-1]||r.parent;if(i<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!s.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let u=r.depth-1,d=n-2;u>i;u--,d--){let p=r.node(u),f=r.index(u);if(p.type.spec.isolating)return!1;let h=p.content.cutByIndex(f,p.childCount),m=o&&o[d+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let g=o&&o[d]||p;if(!p.canReplace(f+1,p.childCount)||!g.type.validContent(h))return!1}let l=r.indexAfter(i),c=o&&o[0];return r.node(i).canReplaceWith(l,l,c?c.type:r.node(i+1).type)}function _y(t,e,n=1,o){let r=t.doc.resolve(e),i=A.empty,s=A.empty;for(let l=r.depth,c=r.depth-n,u=n-1;l>c;l--,u--){i=A.from(r.node(l).copy(i));let d=o&&o[u];s=A.from(d?d.type.create(d.attrs,s):r.node(l).copy(s))}t.step(new pt(e,e,new V(i.append(s),n,n),!0))}function wo(t,e){let n=t.resolve(e),o=n.index();return Cf(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(o,o+1)}function Cy(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:o}=t.type.schema;for(let r=0;r<e.childCount;r++){let i=e.child(r),s=i.type==o?t.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function Cf(t,e){return!!(t&&e&&!t.isLeaf&&Cy(t,e))}function sa(t,e,n=-1){let o=t.resolve(e);for(let r=o.depth;;r--){let i,s,l=o.index(r);if(r==o.depth?(i=o.nodeBefore,s=o.nodeAfter):n>0?(i=o.node(r+1),l++,s=o.node(r).maybeChild(l)):(i=o.node(r).maybeChild(l-1),s=o.node(r+1)),i&&!i.isTextblock&&Cf(i,s)&&o.node(r).canReplace(l,l+1))return e;if(r==0)break;e=n<0?o.before(r):o.after(r)}}function Sy(t,e,n){let o=null,{linebreakReplacement:r}=t.doc.type.schema,i=t.doc.resolve(e-n),s=i.node().type;if(r&&s.inlineContent){let d=s.whitespace=="pre",p=!!s.contentMatch.matchType(r);d&&!p?o=!1:!d&&p&&(o=!0)}let l=t.steps.length;if(o===!1){let d=t.doc.resolve(e+n);_f(t,d.node(),d.before(),l)}s.inlineContent&&uc(t,e+n-1,s,i.node().contentMatchAt(i.index()),o==null);let c=t.mapping.slice(l),u=c.map(e-n);if(t.step(new pt(u,c.map(e+n,-1),V.empty,!0)),o===!0){let d=t.doc.resolve(u);Ef(t,d.node(),d.before(),t.steps.length)}return t}function xy(t,e,n){let o=t.resolve(e);if(o.parent.canReplaceWith(o.index(),o.index(),n))return e;if(o.parentOffset==0)for(let r=o.depth-1;r>=0;r--){let i=o.index(r);if(o.node(r).canReplaceWith(i,i,n))return o.before(r+1);if(i>0)return null}if(o.parentOffset==o.parent.content.size)for(let r=o.depth-1;r>=0;r--){let i=o.indexAfter(r);if(o.node(r).canReplaceWith(i,i,n))return o.after(r+1);if(i<o.node(r).childCount)return null}return null}function Sf(t,e,n){let o=t.resolve(e);if(!n.content.size)return e;let r=n.content;for(let i=0;i<n.openStart;i++)r=r.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=o.depth;s>=0;s--){let l=s==o.depth?0:o.pos<=(o.start(s+1)+o.end(s+1))/2?-1:1,c=o.index(s)+(l>0?1:0),u=o.node(s),d=!1;if(i==1)d=u.canReplace(c,c,r);else{let p=u.contentMatchAt(c).findWrapping(r.firstChild.type);d=p&&u.canReplaceWith(c,c,p[0])}if(d)return l==0?o.pos:l<0?o.before(s+1):o.after(s+1)}return null}function aa(t,e,n=e,o=V.empty){if(e==n&&!o.size)return null;let r=t.resolve(e),i=t.resolve(n);return xf(r,i,o)?new pt(e,n,o):new Ny(r,i,o).fit()}function xf(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Ny{constructor(e,n,o){this.$from=e,this.$to=n,this.unplaced=o,this.frontier=[],this.placed=A.empty;for(let r=0;r<=e.depth;r++){let i=e.node(r);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=A.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,o=this.$from,r=this.close(e<0?this.$to:o.doc.resolve(e));if(!r)return null;let i=this.placed,s=o.depth,l=r.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let c=new V(i,s,l);return e>-1?new ft(o.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||o.pos!=this.$to.pos?new pt(o.pos,r.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,o=0,r=this.unplaced.openEnd;o<e;o++){let i=n.firstChild;if(n.childCount>1&&(r=0),i.type.spec.isolating&&r<=o){e=o;break}n=i.content}for(let n=1;n<=2;n++)for(let o=n==1?e:this.unplaced.openStart;o>=0;o--){let r,i=null;o?(i=Fa(this.unplaced.content,o-1).firstChild,r=i.content):r=this.unplaced.content;let s=r.firstChild;for(let l=this.depth;l>=0;l--){let{type:c,match:u}=this.frontier[l],d,p=null;if(n==1&&(s?u.matchType(s.type)||(p=u.fillBefore(A.from(s),!1)):i&&c.compatibleContent(i.type)))return{sliceDepth:o,frontierDepth:l,parent:i,inject:p};if(n==2&&s&&(d=u.findWrapping(s.type)))return{sliceDepth:o,frontierDepth:l,parent:i,wrap:d};if(i&&u.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:o}=this.unplaced,r=Fa(e,n);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new V(e,n+1,Math.max(o,r.size+n>=e.size-o?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:o}=this.unplaced,r=Fa(e,n);if(r.childCount<=1&&n>0){let i=e.size-n<=n+r.size;this.unplaced=new V(Lr(e,n-1,1),n-1,i?n-1:o)}else this.unplaced=new V(Lr(e,n,1),n,o)}placeNodes({sliceDepth:e,frontierDepth:n,parent:o,inject:r,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let s=this.unplaced,l=o?o.content:s.content,c=s.openStart-e,u=0,d=[],{match:p,type:f}=this.frontier[n];if(r){for(let g=0;g<r.childCount;g++)d.push(r.child(g));p=p.matchFragment(r)}let h=l.size+e-(s.content.size-s.openEnd);for(;u<l.childCount;){let g=l.child(u),b=p.matchType(g.type);if(!b)break;u++,(u>1||c==0||g.content.size)&&(p=b,d.push(Nf(g.mark(f.allowedMarks(g.marks)),u==1?c:0,u==l.childCount?h:-1)))}let m=u==l.childCount;m||(h=-1),this.placed=Pr(this.placed,n,A.from(d)),this.frontier[n].match=p,m&&h<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,b=l;g<h;g++){let y=b.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),b=y.content}this.unplaced=m?e==0?V.empty:new V(Lr(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new V(Lr(s.content,e,u),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Va(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:o}=this.$to,r=this.$to.after(o);for(;o>1&&r==this.$to.end(--o);)++r;return r}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:o,type:r}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=Va(e,n,r,o,i);if(s){for(let l=n-1;l>=0;l--){let{match:c,type:u}=this.frontier[l],d=Va(e,l,u,c,!0);if(!d||d.childCount)continue e}return{depth:n,fit:s,move:i?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=Pr(this.placed,n.depth,n.fit)),e=n.move;for(let o=n.depth+1;o<=e.depth;o++){let r=e.node(o),i=r.type.contentMatch.fillBefore(r.content,!0,e.index(o));this.openFrontierNode(r.type,r.attrs,i)}return e}openFrontierNode(e,n=null,o){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Pr(this.placed,this.depth,A.from(e.create(n,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(A.empty,!0);n.childCount&&(this.placed=Pr(this.placed,this.frontier.length,n))}}function Lr(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Lr(t.firstChild.content,e-1,n)))}function Pr(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Pr(t.lastChild.content,e-1,n)))}function Fa(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Nf(t,e,n){if(e<=0)return t;let o=t.content;return e>1&&(o=o.replaceChild(0,Nf(o.firstChild,e-1,o.childCount==1?n-1:0))),e>0&&(o=t.type.contentMatch.fillBefore(o).append(o),n<=0&&(o=o.append(t.type.contentMatch.matchFragment(o).fillBefore(A.empty,!0)))),t.copy(o)}function Va(t,e,n,o,r){let i=t.node(e),s=r?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let l=o.fillBefore(i.content,!0,s);return l&&!Ty(n,i.content,s)?l:null}function Ty(t,e,n){for(let o=n;o<e.childCount;o++)if(!t.allowsMarks(e.child(o).marks))return!0;return!1}function Oy(t){return t.spec.defining||t.spec.definingForContent}function My(t,e,n,o){if(!o.size)return t.deleteRange(e,n);let r=t.doc.resolve(e),i=t.doc.resolve(n);if(xf(r,i,o))return t.step(new pt(e,n,o));let s=Of(r,t.doc.resolve(n));s[s.length-1]==0&&s.pop();let l=-(r.depth+1);s.unshift(l);for(let f=r.depth,h=r.pos-1;f>0;f--,h--){let m=r.node(f).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(f)>-1?l=f:r.before(f)==h&&s.splice(1,0,-f)}let c=s.indexOf(l),u=[],d=o.openStart;for(let f=o.content,h=0;;h++){let m=f.firstChild;if(u.push(m),h==o.openStart)break;f=m.content}for(let f=d-1;f>=0;f--){let h=u[f],m=Oy(h.type);if(m&&!h.sameMarkup(r.node(Math.abs(l)-1)))d=f;else if(m||!h.type.isTextblock)break}for(let f=o.openStart;f>=0;f--){let h=(f+d+1)%(o.openStart+1),m=u[h];if(m)for(let g=0;g<s.length;g++){let b=s[(g+c)%s.length],y=!0;b<0&&(y=!1,b=-b);let k=r.node(b-1),E=r.index(b-1);if(k.canReplaceWith(E,E,m.type,m.marks))return t.replace(r.before(b),y?i.after(b):n,new V(Tf(o.content,0,o.openStart,h),h,o.openEnd))}}let p=t.steps.length;for(let f=s.length-1;f>=0&&(t.replace(e,n,o),!(t.steps.length>p));f--){let h=s[f];h<0||(e=r.before(h),n=i.after(h))}}function Tf(t,e,n,o,r){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(Tf(i.content,e+1,n,o,i)))}if(e>o){let i=r.contentMatchAt(0),s=i.fillBefore(t).append(t);t=s.append(i.matchFragment(s).fillBefore(A.empty,!0))}return t}function Ay(t,e,n,o){if(!o.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let r=xy(t.doc,e,o.type);r!=null&&(e=n=r)}t.replaceRange(e,n,new V(A.from(o),0,0))}function Ry(t,e,n){let o=t.doc.resolve(e),r=t.doc.resolve(n),i=Of(o,r);for(let s=0;s<i.length;s++){let l=i[s],c=s==i.length-1;if(c&&l==0||o.node(l).type.contentMatch.validEnd)return t.delete(o.start(l),r.end(l));if(l>0&&(c||o.node(l-1).canReplace(o.index(l-1),r.indexAfter(l-1))))return t.delete(o.before(l),r.after(l))}for(let s=1;s<=o.depth&&s<=r.depth;s++)if(e-o.start(s)==o.depth-s&&n>o.end(s)&&r.end(s)-n!=r.depth-s&&o.start(s-1)==r.start(s-1)&&o.node(s-1).canReplace(o.index(s-1),r.index(s-1)))return t.delete(o.before(s),n);t.delete(e,n)}function Of(t,e){let n=[],o=Math.min(t.depth,e.depth);for(let r=o;r>=0;r--){let i=t.start(r);if(i<t.pos-(t.depth-r)||e.end(r)>e.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(i==e.start(r)||r==t.depth&&r==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==i-1)&&n.push(r)}return n}class cr extends Nt{constructor(e,n,o){super(),this.pos=e,this.attr=n,this.value=o}apply(e){let n=e.nodeAt(this.pos);if(!n)return st.fail("No node at attribute step's position");let o=Object.create(null);for(let i in n.attrs)o[i]=n.attrs[i];o[this.attr]=this.value;let r=n.type.create(o,null,n.marks);return st.fromReplace(e,this.pos,this.pos+1,new V(A.from(r),0,n.isLeaf?0:1))}getMap(){return jt.empty}invert(e){return new cr(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 cr(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 cr(n.pos,n.attr,n.value)}}Nt.jsonID("attr",cr);class ri extends Nt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let r in e.attrs)n[r]=e.attrs[r];n[this.attr]=this.value;let o=e.type.create(n,e.content,e.marks);return st.ok(o)}getMap(){return jt.empty}invert(e){return new ri(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 ri(n.attr,n.value)}}Nt.jsonID("docAttr",ri);let pr=class extends Error{};pr=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};pr.prototype=Object.create(Error.prototype);pr.prototype.constructor=pr;pr.prototype.name="TransformError";class pc{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new oi}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new pr(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,o=V.empty){let r=aa(this.doc,e,n,o);return r&&this.step(r),this}replaceWith(e,n,o){return this.replace(e,n,new V(A.from(o),0,0))}delete(e,n){return this.replace(e,n,V.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,o){return My(this,e,n,o),this}replaceRangeWith(e,n,o){return Ay(this,e,n,o),this}deleteRange(e,n){return Ry(this,e,n),this}lift(e,n){return gy(this,e,n),this}join(e,n=1){return Sy(this,e,n),this}wrap(e,n){return vy(this,e,n),this}setBlockType(e,n=e,o,r=null){return ky(this,e,n,o,r),this}setNodeMarkup(e,n,o=null,r){return Ey(this,e,n,o,r),this}setNodeAttribute(e,n,o){return this.step(new cr(e,n,o)),this}setDocAttribute(e,n){return this.step(new ri(e,n)),this}addNodeMark(e,n){return this.step(new fo(e,n)),this}removeNodeMark(e,n){if(!(n instanceof He)){let o=this.doc.nodeAt(e);if(!o)throw new RangeError("No node at position "+e);if(n=n.isInSet(o.marks),!n)return this}return this.step(new dr(e,n)),this}split(e,n=1,o){return _y(this,e,n,o),this}addMark(e,n,o){return fy(this,e,n,o),this}removeMark(e,n,o){return hy(this,e,n,o),this}clearIncompatible(e,n,o){return uc(this,e,n,o),this}}const za=Object.create(null);class ae{constructor(e,n,o){this.$anchor=e,this.$head=n,this.ranges=o||[new Mf(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=V.empty){let o=n.content.lastChild,r=null;for(let l=0;l<n.openEnd;l++)r=o,o=o.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:c,$to:u}=s[l],d=e.mapping.slice(i);e.replaceRange(d.map(c.pos),d.map(u.pos),l?V.empty:n),l==0&&Ku(e,i,(o?o.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,n){let o=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:s,$to:l}=r[i],c=e.mapping.slice(o),u=c.map(s.pos),d=c.map(l.pos);i?e.deleteRange(u,d):(e.replaceRangeWith(u,d,n),Ku(e,o,n.isInline?-1:1))}}static findFrom(e,n,o=!1){let r=e.parent.inlineContent?new ne(e):tr(e.node(0),e.parent,e.pos,e.index(),n,o);if(r)return r;for(let i=e.depth-1;i>=0;i--){let s=n<0?tr(e.node(0),e.node(i),e.before(i+1),e.index(i),n,o):tr(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,o);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Jt(e.node(0))}static atStart(e){return tr(e,e,0,0,1)||new Jt(e)}static atEnd(e){return tr(e,e,e.content.size,e.childCount,-1)||new Jt(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=za[n.type];if(!o)throw new RangeError(`No selection type ${n.type} defined`);return o.fromJSON(e,n)}static jsonID(e,n){if(e in za)throw new RangeError("Duplicate use of selection JSON ID "+e);return za[e]=n,n.prototype.jsonID=e,n}getBookmark(){return ne.between(this.$anchor,this.$head).getBookmark()}}ae.prototype.visible=!0;class Mf{constructor(e,n){this.$from=e,this.$to=n}}let Uu=!1;function qu(t){!Uu&&!t.parent.inlineContent&&(Uu=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class ne extends ae{constructor(e,n=e){qu(e),qu(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let o=e.resolve(n.map(this.head));if(!o.parent.inlineContent)return ae.near(o);let r=e.resolve(n.map(this.anchor));return new ne(r.parent.inlineContent?r:o,o)}replace(e,n=V.empty){if(super.replace(e,n),n==V.empty){let o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}}eq(e){return e instanceof ne&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new la(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 ne(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,o=n){let r=e.resolve(n);return new this(r,o==n?r:e.resolve(o))}static between(e,n,o){let r=e.pos-n.pos;if((!o||r)&&(o=r>=0?1:-1),!n.parent.inlineContent){let i=ae.findFrom(n,o,!0)||ae.findFrom(n,-o,!0);if(i)n=i.$head;else return ae.near(n,o)}return e.parent.inlineContent||(r==0?e=n:(e=(ae.findFrom(e,-o,!0)||ae.findFrom(e,o,!0)).$anchor,e.pos<n.pos!=r<0&&(e=n))),new ne(e,n)}}ae.jsonID("text",ne);class la{constructor(e,n){this.anchor=e,this.head=n}map(e){return new la(e.map(this.anchor),e.map(this.head))}resolve(e){return ne.between(e.resolve(this.anchor),e.resolve(this.head))}}class oe extends ae{constructor(e){let n=e.nodeAfter,o=e.node(0).resolve(e.pos+n.nodeSize);super(e,o),this.node=n}map(e,n){let{deleted:o,pos:r}=n.mapResult(this.anchor),i=e.resolve(r);return o?ae.near(i):new oe(i)}content(){return new V(A.from(this.node),0,0)}eq(e){return e instanceof oe&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new fc(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new oe(e.resolve(n.anchor))}static create(e,n){return new oe(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}oe.prototype.visible=!1;ae.jsonID("node",oe);class fc{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:o}=e.mapResult(this.anchor);return n?new la(o,o):new fc(o)}resolve(e){let n=e.resolve(this.anchor),o=n.nodeAfter;return o&&oe.isSelectable(o)?new oe(n):ae.near(n)}}class Jt extends ae{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=V.empty){if(n==V.empty){e.delete(0,e.doc.content.size);let o=ae.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Jt(e)}map(e){return new Jt(e)}eq(e){return e instanceof Jt}getBookmark(){return By}}ae.jsonID("all",Jt);const By={map(){return this},resolve(t){return new Jt(t)}};function tr(t,e,n,o,r,i=!1){if(e.inlineContent)return ne.create(t,n);for(let s=o-(r>0?0:1);r>0?s<e.childCount:s>=0;s+=r){let l=e.child(s);if(l.isAtom){if(!i&&oe.isSelectable(l))return oe.create(t,n-(r<0?l.nodeSize:0))}else{let c=tr(t,l,n+r,r<0?l.childCount:0,r,i);if(c)return c}n+=l.nodeSize*r}return null}function Ku(t,e,n){let o=t.steps.length-1;if(o<e)return;let r=t.steps[o];if(!(r instanceof pt||r instanceof ft))return;let i=t.mapping.maps[o],s;i.forEach((l,c,u,d)=>{s==null&&(s=d)}),t.setSelection(ae.near(t.doc.resolve(s),n))}const Wu=1,ju=2,Gu=4;class Dy extends pc{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|Wu)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&Wu)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ju,this}ensureMarks(e){return He.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&ju)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&-3,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let o=this.selection;return n&&(e=e.mark(this.storedMarks||(o.empty?o.$from.marks():o.$from.marksAcross(o.$to)||He.none))),o.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,o){let r=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(o==null&&(o=n),o=o??n,!e)return this.deleteRange(n,o);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=o==n?s.marks():s.marksAcross(this.doc.resolve(o))}return this.replaceRangeWith(n,o,r.text(e,i)),this.selection.empty||this.setSelection(ae.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|=Gu,this}get scrolledIntoView(){return(this.updated&Gu)>0}}function Yu(t,e){return!e||!t?t:t.bind(e)}class $r{constructor(e,n,o){this.name=e,this.init=Yu(n.init,o),this.apply=Yu(n.apply,o)}}const Iy=[new $r("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new $r("selection",{init(t,e){return t.selection||ae.atStart(e.doc)},apply(t){return t.selection}}),new $r("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,o){return o.selection.$cursor?t.storedMarks:null}}),new $r("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Ha{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Iy.slice(),n&&n.forEach(o=>{if(this.pluginsByKey[o.key])throw new RangeError("Adding different instances of a keyed plugin ("+o.key+")");this.plugins.push(o),this.pluginsByKey[o.key]=o,o.spec.state&&this.fields.push(new $r(o.key,o.spec.state,o))})}}class ar{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 o=0;o<this.config.plugins.length;o++)if(o!=n){let r=this.config.plugins[o];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],o=this.applyInner(e),r=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let c=r?r[s].n:0,u=r?r[s].state:this,d=c<n.length&&l.spec.appendTransaction.call(l,c?n.slice(c):n,u,o);if(d&&o.filterTransaction(d,s)){if(d.setMeta("appendedTransaction",e),!r){r=[];for(let p=0;p<this.config.plugins.length;p++)r.push(p<s?{state:o,n:n.length}:{state:this,n:0})}n.push(d),o=o.applyInner(d),i=!0}r&&(r[s]={state:o,n:n.length})}}if(!i)return{state:o,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new ar(this.config),o=this.config.fields;for(let r=0;r<o.length;r++){let i=o[r];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new Dy(this)}static create(e){let n=new Ha(e.doc?e.doc.type.schema:e.schema,e.plugins),o=new ar(n);for(let r=0;r<n.fields.length;r++)o[n.fields[r].name]=n.fields[r].init(e,o);return o}reconfigure(e){let n=new Ha(this.schema,e.plugins),o=n.fields,r=new ar(n);for(let i=0;i<o.length;i++){let s=o[i].name;r[s]=this.hasOwnProperty(s)?this[s]:o[i].init(e,r)}return r}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(o=>o.toJSON())),e&&typeof e=="object")for(let o in e){if(o=="doc"||o=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[o],i=r.spec.state;i&&i.toJSON&&(n[o]=i.toJSON.call(r,this[r.key]))}return n}static fromJSON(e,n,o){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new Ha(e.schema,e.plugins),i=new ar(r);return r.fields.forEach(s=>{if(s.name=="doc")i.doc=An.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=ae.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(o)for(let l in o){let c=o[l],u=c.spec.state;if(c.key==s.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){i[s.name]=u.fromJSON.call(c,e,n[l],i);return}}i[s.name]=s.init(e,i)}}),i}}function Af(t,e,n){for(let o in t){let r=t[o];r instanceof Function?r=r.bind(e):o=="handleDOMEvents"&&(r=Af(r,e,{})),n[o]=r}return n}class Ae{constructor(e){this.spec=e,this.props={},e.props&&Af(e.props,this,this.props),this.key=e.key?e.key.key:Rf("plugin")}getState(e){return e[this.key]}}const Ua=Object.create(null);function Rf(t){return t in Ua?t+"$"+ ++Ua[t]:(Ua[t]=0,t+"$")}class xe{constructor(e="key"){this.key=Rf(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const vt=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},ii=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let xl=null;const Kn=function(t,e,n){let o=xl||(xl=document.createRange());return o.setEnd(t,n??t.nodeValue.length),o.setStart(t,e||0),o},Ly=function(){xl=null},qo=function(t,e,n,o){return n&&(Ju(t,e,n,o,-1)||Ju(t,e,n,o,1))},Py=/^(img|br|input|textarea|hr)$/i;function Ju(t,e,n,o,r){for(;;){if(t==n&&e==o)return!0;if(e==(r<0?0:rn(t))){let i=t.parentNode;if(!i||i.nodeType!=1||ki(t)||Py.test(t.nodeName)||t.contentEditable=="false")return!1;e=vt(t)+(r<0?0:1),t=i}else if(t.nodeType==1){if(t=t.childNodes[e+(r<0?-1:0)],t.contentEditable=="false")return!1;e=r<0?rn(t):0}else return!1}}function rn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function $y(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=rn(t)}else if(t.parentNode&&!ki(t))e=vt(t),t=t.parentNode;else return null}}function Fy(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&&!ki(t))e=vt(t)+1,t=t.parentNode;else return null}}function Vy(t,e,n){for(let o=e==0,r=e==rn(t);o||r;){if(t==n)return!0;let i=vt(t);if(t=t.parentNode,!t)return!1;o=o&&i==0,r=r&&i==rn(t)}}function ki(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 ca=function(t){return t.focusNode&&qo(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Oo(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function zy(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Hy(t,e,n){if(t.caretPositionFromPoint)try{let o=t.caretPositionFromPoint(e,n);if(o)return{node:o.offsetNode,offset:Math.min(rn(o.offsetNode),o.offset)}}catch{}if(t.caretRangeFromPoint){let o=t.caretRangeFromPoint(e,n);if(o)return{node:o.startContainer,offset:Math.min(rn(o.startContainer),o.startOffset)}}}const Bn=typeof navigator<"u"?navigator:null,Xu=typeof document<"u"?document:null,Eo=Bn&&Bn.userAgent||"",Nl=/Edge\/(\d+)/.exec(Eo),Bf=/MSIE \d/.exec(Eo),Tl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Eo),Vt=!!(Bf||Tl||Nl),go=Bf?document.documentMode:Tl?+Tl[1]:Nl?+Nl[1]:0,vn=!Vt&&/gecko\/(\d+)/i.test(Eo);vn&&+(/Firefox\/(\d+)/.exec(Eo)||[0,0])[1];const Ol=!Vt&&/Chrome\/(\d+)/.exec(Eo),Ct=!!Ol,Df=Ol?+Ol[1]:0,Bt=!Vt&&!!Bn&&/Apple Computer/.test(Bn.vendor),fr=Bt&&(/Mobile\/\w+/.test(Eo)||!!Bn&&Bn.maxTouchPoints>2),on=fr||(Bn?/Mac/.test(Bn.platform):!1),Uy=Bn?/Win/.test(Bn.platform):!1,jn=/Android \d/.test(Eo),wi=!!Xu&&"webkitFontSmoothing"in Xu.documentElement.style,qy=wi?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Ky(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 Vn(t,e){return typeof t=="number"?t:t[e]}function Wy(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,o=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*o}}function Zu(t,e,n){let o=t.someProp("scrollThreshold")||0,r=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let s=n||t.dom;s;s=ii(s)){if(s.nodeType!=1)continue;let l=s,c=l==i.body,u=c?Ky(i):Wy(l),d=0,p=0;if(e.top<u.top+Vn(o,"top")?p=-(u.top-e.top+Vn(r,"top")):e.bottom>u.bottom-Vn(o,"bottom")&&(p=e.bottom-e.top>u.bottom-u.top?e.top+Vn(r,"top")-u.top:e.bottom-u.bottom+Vn(r,"bottom")),e.left<u.left+Vn(o,"left")?d=-(u.left-e.left+Vn(r,"left")):e.right>u.right-Vn(o,"right")&&(d=e.right-u.right+Vn(r,"right")),d||p)if(c)i.defaultView.scrollBy(d,p);else{let f=l.scrollLeft,h=l.scrollTop;p&&(l.scrollTop+=p),d&&(l.scrollLeft+=d);let m=l.scrollLeft-f,g=l.scrollTop-h;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}if(c||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function jy(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),o,r;for(let i=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=t.root.elementFromPoint(i,s);if(!l||l==t.dom||!t.dom.contains(l))continue;let c=l.getBoundingClientRect();if(c.top>=n-20){o=l,r=c.top;break}}return{refDOM:o,refTop:r,stack:If(t.dom)}}function If(t){let e=[],n=t.ownerDocument;for(let o=t;o&&(e.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),t!=n);o=ii(o));return e}function Gy({refDOM:t,refTop:e,stack:n}){let o=t?t.getBoundingClientRect().top:0;Lf(n,o==0?0:o-e)}function Lf(t,e){for(let n=0;n<t.length;n++){let{dom:o,top:r,left:i}=t[n];o.scrollTop!=r+e&&(o.scrollTop=r+e),o.scrollLeft!=i&&(o.scrollLeft=i)}}let Xo=null;function Yy(t){if(t.setActive)return t.setActive();if(Xo)return t.focus(Xo);let e=If(t);t.focus(Xo==null?{get preventScroll(){return Xo={preventScroll:!0},!0}}:void 0),Xo||(Xo=!1,Lf(e,0))}function Pf(t,e){let n,o=2e8,r,i=0,s=e.top,l=e.top,c,u;for(let d=t.firstChild,p=0;d;d=d.nextSibling,p++){let f;if(d.nodeType==1)f=d.getClientRects();else if(d.nodeType==3)f=Kn(d).getClientRects();else continue;for(let h=0;h<f.length;h++){let m=f[h];if(m.top<=s&&m.bottom>=l){s=Math.max(m.bottom,s),l=Math.min(m.top,l);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<o){n=d,o=g,r=g&&n.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,d.nodeType==1&&g&&(i=p+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!c&&m.left<=e.left&&m.right>=e.left&&(c=d,u={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)&&(i=p+1)}}return!n&&c&&(n=c,r=u,o=0),n&&n.nodeType==3?Jy(n,r):!n||o&&n.nodeType==1?{node:t,offset:i}:Pf(n,r)}function Jy(t,e){let n=t.nodeValue.length,o=document.createRange();for(let r=0;r<n;r++){o.setEnd(t,r+1),o.setStart(t,r);let i=ro(o,1);if(i.top!=i.bottom&&hc(e,i))return{node:t,offset:r+(e.left>=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}function hc(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Xy(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function Zy(t,e,n){let{node:o,offset:r}=Pf(e,n),i=-1;if(o.nodeType==1&&!o.firstChild){let s=o.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(o,r,i)}function Qy(t,e,n,o){let r=-1;for(let i=e,s=!1;i!=t.dom;){let l=t.docView.nearestDesc(i,!0),c;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((c=l.dom.getBoundingClientRect()).width||c.height)&&(l.node.isBlock&&l.parent&&(!s&&c.left>o.left||c.top>o.top?r=l.posBefore:(!s&&c.right<o.left||c.bottom<o.top)&&(r=l.posAfter),s=!0),!l.contentDOM&&r<0&&!l.node.isText))return(l.node.isBlock?o.top<(c.top+c.bottom)/2:o.left<(c.left+c.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return r>-1?r:t.docView.posFromDOM(e,n,-1)}function $f(t,e,n){let o=t.childNodes.length;if(o&&n.top<n.bottom)for(let r=Math.max(0,Math.min(o-1,Math.floor(o*(e.top-n.top)/(n.bottom-n.top))-2)),i=r;;){let s=t.childNodes[i];if(s.nodeType==1){let l=s.getClientRects();for(let c=0;c<l.length;c++){let u=l[c];if(hc(e,u))return $f(s,e,u)}}if((i=(i+1)%o)==r)break}return t}function ev(t,e){let n=t.dom.ownerDocument,o,r=0,i=Hy(n,e.left,e.top);i&&({node:o,offset:r}=i);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let u=t.dom.getBoundingClientRect();if(!hc(e,u)||(s=$f(t.dom,e,u),!s))return null}if(Bt)for(let u=s;o&&u;u=ii(u))u.draggable&&(o=void 0);if(s=Xy(s,e),o){if(vn&&o.nodeType==1&&(r=Math.min(r,o.childNodes.length),r<o.childNodes.length)){let d=o.childNodes[r],p;d.nodeName=="IMG"&&(p=d.getBoundingClientRect()).right<=e.left&&p.bottom>e.top&&r++}let u;wi&&r&&o.nodeType==1&&(u=o.childNodes[r-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&r--,o==t.dom&&r==o.childNodes.length-1&&o.lastChild.nodeType==1&&e.top>o.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(r==0||o.nodeType!=1||o.childNodes[r-1].nodeName!="BR")&&(l=Qy(t,o,r,e))}l==null&&(l=Zy(t,s,e));let c=t.docView.nearestDesc(s,!0);return{pos:l,inside:c?c.posAtStart-c.border:-1}}function Qu(t){return t.top<t.bottom||t.left<t.right}function ro(t,e){let n=t.getClientRects();if(n.length){let o=n[e<0?0:n.length-1];if(Qu(o))return o}return Array.prototype.find.call(n,Qu)||t.getBoundingClientRect()}const tv=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Ff(t,e,n){let{node:o,offset:r,atom:i}=t.docView.domFromPos(e,n<0?-1:1),s=wi||vn;if(o.nodeType==3)if(s&&(tv.test(o.nodeValue)||(n<0?!r:r==o.nodeValue.length))){let c=ro(Kn(o,r,r),n);if(vn&&r&&/\s/.test(o.nodeValue[r-1])&&r<o.nodeValue.length){let u=ro(Kn(o,r-1,r-1),-1);if(u.top==c.top){let d=ro(Kn(o,r,r+1),-1);if(d.top!=c.top)return Ar(d,d.left<u.left)}}return c}else{let c=r,u=r,d=n<0?1:-1;return n<0&&!r?(u++,d=-1):n>=0&&r==o.nodeValue.length?(c--,d=1):n<0?c--:u++,Ar(ro(Kn(o,c,u),d),d<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&r&&(n<0||r==rn(o))){let c=o.childNodes[r-1];if(c.nodeType==1)return qa(c.getBoundingClientRect(),!1)}if(i==null&&r<rn(o)){let c=o.childNodes[r];if(c.nodeType==1)return qa(c.getBoundingClientRect(),!0)}return qa(o.getBoundingClientRect(),n>=0)}if(i==null&&r&&(n<0||r==rn(o))){let c=o.childNodes[r-1],u=c.nodeType==3?Kn(c,rn(c)-(s?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(u)return Ar(ro(u,1),!1)}if(i==null&&r<rn(o)){let c=o.childNodes[r];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let u=c?c.nodeType==3?Kn(c,0,s?0:1):c.nodeType==1?c:null:null;if(u)return Ar(ro(u,-1),!0)}return Ar(ro(o.nodeType==3?Kn(o):o,-n),n>=0)}function Ar(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 qa(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 Vf(t,e,n){let o=t.state,r=t.root.activeElement;o!=e&&t.updateState(e),r!=t.dom&&t.focus();try{return n()}finally{o!=e&&t.updateState(o),r!=t.dom&&r&&r.focus()}}function nv(t,e,n){let o=e.selection,r=n=="up"?o.$from:o.$to;return Vf(t,e,()=>{let{node:i}=t.docView.domFromPos(r.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let s=Ff(t,r.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let c;if(l.nodeType==1)c=l.getClientRects();else if(l.nodeType==3)c=Kn(l,0,l.nodeValue.length).getClientRects();else continue;for(let u=0;u<c.length;u++){let d=c[u];if(d.bottom>d.top+1&&(n=="up"?s.top-d.top>(d.bottom-s.top)*2:d.bottom-s.bottom>(s.bottom-d.top)*2))return!1}}return!0})}const ov=/[\u0590-\u08ac]/;function rv(t,e,n){let{$head:o}=e.selection;if(!o.parent.isTextblock)return!1;let r=o.parentOffset,i=!r,s=r==o.parent.content.size,l=t.domSelection();return l?!ov.test(o.parent.textContent)||!l.modify?n=="left"||n=="backward"?i:s:Vf(t,e,()=>{let{focusNode:c,focusOffset:u,anchorNode:d,anchorOffset:p}=t.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",n,"character");let h=o.depth?t.docView.domAfterPos(o.before()):t.dom,{focusNode:m,focusOffset:g}=t.domSelectionRange(),b=m&&!h.contains(m.nodeType==1?m:m.parentNode)||c==m&&u==g;try{l.collapse(d,p),c&&(c!=d||u!=p)&&l.extend&&l.extend(c,u)}catch{}return f!=null&&(l.caretBidiLevel=f),b}):o.pos==o.start()||o.pos==o.end()}let ed=null,td=null,nd=!1;function iv(t,e,n){return ed==e&&td==n?nd:(ed=e,td=n,nd=n=="up"||n=="down"?nv(t,e,n):rv(t,e,n))}const sn=0,od=1,Ao=2,Dn=3;class Ei{constructor(e,n,o,r){this.parent=e,this.children=n,this.dom=o,this.contentDOM=r,this.dirty=sn,o.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,o){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,o=this.posAtStart;;n++){let r=this.children[n];if(r==e)return o;o+=r.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,o){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(o<0){let i,s;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=n>vt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!1;break}if(i.previousSibling)break}if(r==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!0;break}if(i.nextSibling)break}}return r??o>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let o=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),s;if(i&&(!n||i.node))if(o&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))o=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let o=n;o;o=o.parent)if(o==this)return n}posFromDOM(e,n,o){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,n,o)}return-1}descAt(e){for(let n=0,o=0;n<this.children.length;n++){let r=this.children[n],i=o+r.size;if(o==e&&i!=o){for(;!r.border&&r.children.length;)for(let s=0;s<r.children.length;s++){let l=r.children[s];if(l.size){r=l;break}}return r}if(e<i)return r.descAt(e-o-r.border);o=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let o=0,r=0;for(let i=0;o<this.children.length;o++){let s=this.children[o],l=i+s.size;if(l>e||s instanceof Hf){r=e-i;break}i=l}if(r)return this.children[o].domFromPos(r-this.children[o].border,n);for(let i;o&&!(i=this.children[o-1]).size&&i instanceof zf&&i.side>=0;o--);if(n<=0){let i,s=!0;for(;i=o?this.children[o-1]:null,!(!i||i.dom.parentNode==this.contentDOM);o--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?vt(i.dom)+1:0}}else{let i,s=!0;for(;i=o<this.children.length?this.children[o]:null,!(!i||i.dom.parentNode==this.contentDOM);o++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?vt(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,o=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let s=o,l=0;;l++){let c=this.children[l],u=s+c.size;if(r==-1&&e<=u){let d=s+c.border;if(e>=d&&n<=u-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,n,d);e=s;for(let p=l;p>0;p--){let f=this.children[p-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){r=vt(f.dom)+1;break}e-=f.size}r==-1&&(r=0)}if(r>-1&&(u>n||l==this.children.length-1)){n=u;for(let d=l+1;d<this.children.length;d++){let p=this.children[d];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(-1)){i=vt(p.dom);break}n+=p.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=u}return{node:this.contentDOM,from:e,to:n,fromOffset:r,toOffset:i}}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:o}=this.domFromPos(e,0);if(n.nodeType!=1||o==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[o]}setSelection(e,n,o,r=!1){let i=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],b=m+g.size;if(i>m&&s<b)return g.setSelection(e-m-g.border,n-m-g.border,o,r);m=b}let l=this.domFromPos(e,e?-1:1),c=n==e?l:this.domFromPos(n,n?-1:1),u=o.root.getSelection(),d=o.domSelectionRange(),p=!1;if((vn||Bt)&&e==n){let{node:h,offset:m}=l;if(h.nodeType==3){if(p=!!(m&&h.nodeValue[m-1]==`
9
+ `),p&&m==h.nodeValue.length)for(let g=h,b;g;g=g.parentNode){if(b=g.nextSibling){b.nodeName=="BR"&&(l=c={node:b.parentNode,offset:vt(b)+1});break}let y=g.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let g=h.childNodes[m-1];p=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(vn&&d.focusNode&&d.focusNode!=c.node&&d.focusNode.nodeType==1){let h=d.focusNode.childNodes[d.focusOffset];h&&h.contentEditable=="false"&&(r=!0)}if(!(r||p&&Bt)&&qo(l.node,l.offset,d.anchorNode,d.anchorOffset)&&qo(c.node,c.offset,d.focusNode,d.focusOffset))return;let f=!1;if((u.extend||e==n)&&!p){u.collapse(l.node,l.offset);try{e!=n&&u.extend(c.node,c.offset),f=!0}catch{}}if(!f){if(e>n){let m=l;l=c,c=m}let h=document.createRange();h.setEnd(c.node,c.offset),h.setStart(l.node,l.offset),u.removeAllRanges(),u.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 o=0,r=0;r<this.children.length;r++){let i=this.children[r],s=o+i.size;if(o==s?e<=s&&n>=o:e<s&&n>o){let l=o+i.border,c=s-i.border;if(e>=l&&n<=c){this.dirty=e==o||n==s?Ao:od,e==l&&n==c&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Dn:i.markDirty(e-l,n-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Ao:Dn}o=s}this.dirty=Ao}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let o=e==1?Ao:od;n.dirty<o&&(n.dirty=o)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class zf extends Ei{constructor(e,n,o,r){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(o,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==sn&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class sv extends Ei{constructor(e,n,o,r){super(e,[],n,null),this.textDOM=o,this.text=r}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 Ko extends Ei{constructor(e,n,o,r,i){super(e,[],o,r),this.mark=n,this.spec=i}static create(e,n,o,r){let i=r.nodeViews[n.type.name],s=i&&i(n,r,o);return(!s||!s.dom)&&(s=Yo.renderSpec(document,n.type.spec.toDOM(n,o),null,n.attrs)),new Ko(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Dn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Dn&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=sn){let o=this.parent;for(;!o.node;)o=o.parent;o.dirty<this.dirty&&(o.dirty=this.dirty),this.dirty=sn}}slice(e,n,o){let r=Ko.create(this.parent,this.mark,!0,o),i=this.children,s=this.size;n<s&&(i=Al(i,n,s,o)),e>0&&(i=Al(i,0,e,o));for(let l=0;l<i.length;l++)i[l].parent=r;return r.children=i,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class bo extends Ei{constructor(e,n,o,r,i,s,l,c,u){super(e,[],i,s),this.node=n,this.outerDeco=o,this.innerDeco=r,this.nodeDOM=l}static create(e,n,o,r,i,s){let l=i.nodeViews[n.type.name],c,u=l&&l(n,i,()=>{if(!c)return s;if(c.parent)return c.parent.posBeforeChild(c)},o,r),d=u&&u.dom,p=u&&u.contentDOM;if(n.isText){if(!d)d=document.createTextNode(n.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:p}=Yo.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!p&&!n.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),n.type.spec.draggable&&(d.draggable=!0));let f=d;return d=Kf(d,o,n),u?c=new av(e,n,o,r,d,p||null,f,u,i,s+1):n.isText?new ua(e,n,o,r,d,f,i):new bo(e,n,o,r,d,p||null,f,i,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 o=this.children[n];if(this.dom.contains(o.dom.parentNode)){e.contentElement=o.dom.parentNode;break}}e.contentElement||(e.getContent=()=>A.empty)}return e}matchesNode(e,n,o){return this.dirty==sn&&e.eq(this.node)&&ys(n,this.outerDeco)&&o.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let o=this.node.inlineContent,r=n,i=e.composing?this.localCompositionInfo(e,n):null,s=i&&i.pos>-1?i:null,l=i&&i.pos<0,c=new cv(this,s&&s.node,e);pv(this.node,this.innerDeco,(u,d,p)=>{u.spec.marks?c.syncToMarks(u.spec.marks,o,e):u.type.side>=0&&!p&&c.syncToMarks(d==this.node.childCount?He.none:this.node.child(d).marks,o,e),c.placeWidget(u,e,r)},(u,d,p,f)=>{c.syncToMarks(u.marks,o,e);let h;c.findNodeMatch(u,d,p,f)||l&&e.state.selection.from>r&&e.state.selection.to<r+u.nodeSize&&(h=c.findIndexWithChild(i.node))>-1&&c.updateNodeAt(u,d,p,h,e)||c.updateNextNode(u,d,p,e,f,r)||c.addNode(u,d,p,e,r),r+=u.nodeSize}),c.syncToMarks([],o,e),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==Ao)&&(s&&this.protectLocalComposition(e,s),Uf(this.contentDOM,this.children,e),fr&&fv(this.dom))}localCompositionInfo(e,n){let{from:o,to:r}=e.state.selection;if(!(e.state.selection instanceof ne)||o<n||r>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,l=hv(this.node.content,s,o-n,r-n);return l<0?null:{node:i,pos:l,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:o,text:r}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new sv(this,i,n,r);e.input.compositionNodes.push(s),this.children=Al(this.children,o,o+r.length,e,s)}update(e,n,o,r){return this.dirty==Dn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,o,r),!0)}updateInner(e,n,o,r){this.updateOuterDeco(n),this.node=e,this.innerDeco=o,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=sn}updateOuterDeco(e){if(ys(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,o=this.dom;this.dom=qf(this.dom,this.nodeDOM,Ml(this.outerDeco,this.node,n),Ml(e,this.node,n)),this.dom!=o&&(o.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function rd(t,e,n,o,r){Kf(o,e,t);let i=new bo(void 0,t,e,n,o,o,o,r,0);return i.contentDOM&&i.updateChildren(r,0),i}class ua extends bo{constructor(e,n,o,r,i,s,l){super(e,n,o,r,i,null,s,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,o,r){return this.dirty==Dn||this.dirty!=sn&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=sn||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=sn,!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,o){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,o)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,o){let r=this.node.cut(e,n),i=document.createTextNode(r.text);return new ua(this.parent,r,this.outerDeco,this.innerDeco,i,i,o)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Dn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Hf extends Ei{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==sn&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class av extends bo{constructor(e,n,o,r,i,s,l,c,u,d){super(e,n,o,r,i,s,l,u,d),this.spec=c}update(e,n,o,r){if(this.dirty==Dn)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,o);return i&&this.updateInner(e,n,o,r),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,o,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,o,r){this.spec.setSelection?this.spec.setSelection(e,n,o.root):super.setSelection(e,n,o,r)}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 Uf(t,e,n){let o=t.firstChild,r=!1;for(let i=0;i<e.length;i++){let s=e[i],l=s.dom;if(l.parentNode==t){for(;l!=o;)o=id(o),r=!0;o=o.nextSibling}else r=!0,t.insertBefore(l,o);if(s instanceof Ko){let c=o?o.previousSibling:t.lastChild;Uf(s.contentDOM,s.children,n),o=c?c.nextSibling:t.firstChild}}for(;o;)o=id(o),r=!0;r&&n.trackWrites==t&&(n.trackWrites=null)}const Hr=function(t){t&&(this.nodeName=t)};Hr.prototype=Object.create(null);const Ro=[new Hr];function Ml(t,e,n){if(t.length==0)return Ro;let o=n?Ro[0]:new Hr,r=[o];for(let i=0;i<t.length;i++){let s=t[i].type.attrs;if(s){s.nodeName&&r.push(o=new Hr(s.nodeName));for(let l in s){let c=s[l];c!=null&&(n&&r.length==1&&r.push(o=new Hr(e.isInline?"span":"div")),l=="class"?o.class=(o.class?o.class+" ":"")+c:l=="style"?o.style=(o.style?o.style+";":"")+c:l!="nodeName"&&(o[l]=c))}}}return r}function qf(t,e,n,o){if(n==Ro&&o==Ro)return e;let r=e;for(let i=0;i<o.length;i++){let s=o[i],l=n[i];if(i){let c;l&&l.nodeName==s.nodeName&&r!=t&&(c=r.parentNode)&&c.nodeName.toLowerCase()==s.nodeName||(c=document.createElement(s.nodeName),c.pmIsDeco=!0,c.appendChild(r),l=Ro[0]),r=c}lv(r,l||Ro[0],s)}return r}function lv(t,e,n){for(let o in e)o!="class"&&o!="style"&&o!="nodeName"&&!(o in n)&&t.removeAttribute(o);for(let o in n)o!="class"&&o!="style"&&o!="nodeName"&&n[o]!=e[o]&&t.setAttribute(o,n[o]);if(e.class!=n.class){let o=e.class?e.class.split(" ").filter(Boolean):[],r=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&t.classList.remove(o[i]);for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&t.classList.add(r[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let o=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=o.exec(e.style);)t.style.removeProperty(r[1])}n.style&&(t.style.cssText+=n.style)}}function Kf(t,e,n){return qf(t,t,Ro,Ml(e,n,t.nodeType!=1))}function ys(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 id(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class cv{constructor(e,n,o){this.lock=n,this.view=o,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=uv(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let o=e;o<n;o++)this.top.children[o].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,o){let r=0,i=this.stack.length>>1,s=Math.min(i,e.length);for(;r<s&&(r==i-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&e[r].type.spec.spanning!==!1;)r++;for(;r<i;)this.destroyRest(),this.top.dirty=sn,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let l=-1;for(let c=this.index;c<Math.min(this.index+3,this.top.children.length);c++){let u=this.top.children[c];if(u.matchesMark(e[i])&&!this.isLocked(u.dom)){l=c;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let c=Ko.create(this.top,e[i],n,o);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,i++}}findNodeMatch(e,n,o,r){let i=-1,s;if(r>=this.preMatch.index&&(s=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,o))i=this.top.children.indexOf(s,this.index);else for(let l=this.index,c=Math.min(this.top.children.length,l+5);l<c;l++){let u=this.top.children[l];if(u.matchesNode(e,n,o)&&!this.preMatch.matched.has(u)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,o,r,i){let s=this.top.children[r];return s.dirty==Dn&&s.dom==s.contentDOM&&(s.dirty=Ao),s.update(e,n,o,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let o=e.pmViewDesc;if(o){for(let r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==o)return r}return-1}e=n}}updateNextNode(e,n,o,r,i,s){for(let l=this.index;l<this.top.children.length;l++){let c=this.top.children[l];if(c instanceof bo){let u=this.preMatch.matched.get(c);if(u!=null&&u!=i)return!1;let d=c.dom,p,f=this.isLocked(d)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=Dn&&ys(n,c.outerDeco));if(!f&&c.update(e,n,o,r))return this.destroyBetween(this.index,l),c.dom!=d&&(this.changed=!0),this.index++,!0;if(!f&&(p=this.recreateWrapper(c,e,n,o,r,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=p,p.contentDOM&&(p.dirty=Ao,p.updateChildren(r,s+1),p.dirty=sn),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,o,r,i,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!ys(o,e.outerDeco)||!r.eq(e.innerDeco))return null;let l=bo.create(this.top,n,o,r,i,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let c of l.children)c.parent=l}return e.destroy(),l}addNode(e,n,o,r,i){let s=bo.create(this.top,e,n,o,r,i);s.contentDOM&&s.updateChildren(r,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,o){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let i=new zf(this.top,e,n,o);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Ko;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof ua)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Bt||Ct)&&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 o=document.createElement(e);e=="IMG"&&(o.className="ProseMirror-separator",o.alt=""),e=="BR"&&(o.className="ProseMirror-trailingBreak");let r=new Hf(this.top,[],o,null);n!=this.top?n.children.push(r):n.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function uv(t,e){let n=e,o=n.children.length,r=t.childCount,i=new Map,s=[];e:for(;r>0;){let l;for(;;)if(o){let u=n.children[o-1];if(u instanceof Ko)n=u,o=u.children.length;else{l=u,o--;break}}else{if(n==e)break e;o=n.parent.children.indexOf(n),n=n.parent}let c=l.node;if(c){if(c!=t.child(r-1))break;--r,i.set(l,r),s.push(l)}}return{index:r,matched:i,matches:s.reverse()}}function dv(t,e){return t.type.side-e.type.side}function pv(t,e,n,o){let r=e.locals(t),i=0;if(r.length==0){for(let u=0;u<t.childCount;u++){let d=t.child(u);o(d,r,e.forChild(i,d),u),i+=d.nodeSize}return}let s=0,l=[],c=null;for(let u=0;;){let d,p;for(;s<r.length&&r[s].to==i;){let b=r[s++];b.widget&&(d?(p||(p=[d])).push(b):d=b)}if(d)if(p){p.sort(dv);for(let b=0;b<p.length;b++)n(p[b],u,!!c)}else n(d,u,!!c);let f,h;if(c)h=-1,f=c,c=null;else if(u<t.childCount)h=u,f=t.child(u++);else break;for(let b=0;b<l.length;b++)l[b].to<=i&&l.splice(b--,1);for(;s<r.length&&r[s].from<=i&&r[s].to>i;)l.push(r[s++]);let m=i+f.nodeSize;if(f.isText){let b=m;s<r.length&&r[s].from<b&&(b=r[s].from);for(let y=0;y<l.length;y++)l[y].to<b&&(b=l[y].to);b<m&&(c=f.cut(b-i),f=f.cut(0,b-i),m=b,h=-1)}else for(;s<r.length&&r[s].to<m;)s++;let g=f.isInline&&!f.isLeaf?l.filter(b=>!b.inline):l.slice();o(f,g,e.forChild(i,f),h),i=m}}function fv(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 hv(t,e,n,o){for(let r=0,i=0;r<t.childCount&&i<=o;){let s=t.child(r++),l=i;if(i+=s.nodeSize,!s.isText)continue;let c=s.text;for(;r<t.childCount;){let u=t.child(r++);if(i+=u.nodeSize,!u.isText)break;c+=u.text}if(i>=n){if(i>=o&&c.slice(o-e.length-l,o-l)==e)return o-e.length;let u=l<o?c.lastIndexOf(e,o-l-1):-1;if(u>=0&&u+e.length+l>=n)return l+u;if(n==o&&c.length>=o+e.length-l&&c.slice(o-l,o-l+e.length)==e)return o}}return-1}function Al(t,e,n,o,r){let i=[];for(let s=0,l=0;s<t.length;s++){let c=t[s],u=l,d=l+=c.size;u>=n||d<=e?i.push(c):(u<e&&i.push(c.slice(0,e-u,o)),r&&(i.push(r),r=void 0),d>n&&i.push(c.slice(n-u,c.size,o)))}return i}function mc(t,e=null){let n=t.domSelectionRange(),o=t.state.doc;if(!n.focusNode)return null;let r=t.docView.nearestDesc(n.focusNode),i=r&&r.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let l=o.resolve(s),c,u;if(ca(n)){for(c=s;r&&!r.node;)r=r.parent;let p=r.node;if(r&&p.isAtom&&oe.isSelectable(p)&&r.parent&&!(p.isInline&&Vy(n.focusNode,n.focusOffset,r.dom))){let f=r.posBefore;u=new oe(s==f?l:o.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let p=s,f=s;for(let h=0;h<n.rangeCount;h++){let m=n.getRangeAt(h);p=Math.min(p,t.docView.posFromDOM(m.startContainer,m.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(p<0)return null;[c,s]=f==t.state.selection.anchor?[f,p]:[p,f],l=o.resolve(s)}else c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let d=o.resolve(c);if(!u){let p=e=="pointer"||t.state.selection.head<l.pos&&!i?1:-1;u=gc(t,d,l,p)}return u}function Wf(t){return t.editable?t.hasFocus():Gf(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Jn(t,e=!1){let n=t.state.selection;if(jf(t,n),!!Wf(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Ct){let o=t.domSelectionRange(),r=t.domObserver.currentSelection;if(o.anchorNode&&r.anchorNode&&qo(o.anchorNode,o.anchorOffset,r.anchorNode,r.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)gv(t);else{let{anchor:o,head:r}=n,i,s;sd&&!(n instanceof ne)&&(n.$from.parent.inlineContent||(i=ad(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=ad(t,n.to))),t.docView.setSelection(o,r,t,e),sd&&(i&&ld(i),s&&ld(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&mv(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const sd=Bt||Ct&&Df<63;function ad(t,e){let{node:n,offset:o}=t.docView.domFromPos(e,0),r=o<n.childNodes.length?n.childNodes[o]:null,i=o?n.childNodes[o-1]:null;if(Bt&&r&&r.contentEditable=="false")return Ka(r);if((!r||r.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(r)return Ka(r);if(i)return Ka(i)}}function Ka(t){return t.contentEditable="true",Bt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function ld(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function mv(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),o=n.anchorNode,r=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=o||n.anchorOffset!=r)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Wf(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function gv(t){let e=t.domSelection(),n=document.createRange();if(!e)return;let o=t.cursorWrapper.dom,r=o.nodeName=="IMG";r?n.setStart(o.parentNode,vt(o)+1):n.setStart(o,0),n.collapse(!0),e.removeAllRanges(),e.addRange(n),!r&&!t.state.selection.visible&&Vt&&go<=11&&(o.disabled=!0,o.disabled=!1)}function jf(t,e){if(e instanceof oe){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(cd(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else cd(t)}function cd(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function gc(t,e,n,o){return t.someProp("createSelectionBetween",r=>r(t,e,n))||ne.between(e,n,o)}function ud(t){return t.editable&&!t.hasFocus()?!1:Gf(t)}function Gf(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 bv(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return qo(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Rl(t,e){let{$anchor:n,$head:o}=t.selection,r=e>0?n.max(o):n.min(o),i=r.parent.inlineContent?r.depth?t.doc.resolve(e>0?r.after():r.before()):null:r;return i&&ae.findFrom(i,e)}function io(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function dd(t,e,n){let o=t.state.selection;if(o instanceof ne)if(n.indexOf("s")>-1){let{$head:r}=o,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=t.state.doc.resolve(r.pos+i.nodeSize*(e<0?-1:1));return io(t,new ne(o.$anchor,s))}else if(o.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let r=Rl(t.state,e);return r&&r instanceof oe?io(t,r):!1}else if(!(on&&n.indexOf("m")>-1)){let r=o.$head,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter,s;if(!i||i.isText)return!1;let l=e<0?r.pos-i.nodeSize:r.pos;return i.isAtom||(s=t.docView.descAt(l))&&!s.contentDOM?oe.isSelectable(i)?io(t,new oe(e<0?t.state.doc.resolve(r.pos-i.nodeSize):r)):wi?io(t,new ne(t.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(o instanceof oe&&o.node.isInline)return io(t,new ne(e>0?o.$to:o.$from));{let r=Rl(t.state,e);return r?io(t,r):!1}}}function vs(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Ur(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Zo(t,e){return e<0?yv(t):vv(t)}function yv(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let r,i,s=!1;for(vn&&n.nodeType==1&&o<vs(n)&&Ur(n.childNodes[o],-1)&&(s=!0);;)if(o>0){if(n.nodeType!=1)break;{let l=n.childNodes[o-1];if(Ur(l,-1))r=n,i=--o;else if(l.nodeType==3)n=l,o=n.nodeValue.length;else break}}else{if(Yf(n))break;{let l=n.previousSibling;for(;l&&Ur(l,-1);)r=n.parentNode,i=vt(l),l=l.previousSibling;if(l)n=l,o=vs(n);else{if(n=n.parentNode,n==t.dom)break;o=0}}}s?Bl(t,n,o):r&&Bl(t,r,i)}function vv(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let r=vs(n),i,s;for(;;)if(o<r){if(n.nodeType!=1)break;let l=n.childNodes[o];if(Ur(l,1))i=n,s=++o;else break}else{if(Yf(n))break;{let l=n.nextSibling;for(;l&&Ur(l,1);)i=l.parentNode,s=vt(l)+1,l=l.nextSibling;if(l)n=l,o=0,r=vs(n);else{if(n=n.parentNode,n==t.dom)break;o=r=0}}}i&&Bl(t,i,s)}function Yf(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function kv(t,e){for(;t&&e==t.childNodes.length&&!ki(t);)e=vt(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 wv(t,e){for(;t&&!e&&!ki(t);)e=vt(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 Bl(t,e,n){if(e.nodeType!=3){let i,s;(s=kv(e,n))?(e=s,n=0):(i=wv(e,n))&&(e=i,n=i.nodeValue.length)}let o=t.domSelection();if(!o)return;if(ca(o)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),o.removeAllRanges(),o.addRange(i)}else o.extend&&o.extend(e,n);t.domObserver.setCurSelection();let{state:r}=t;setTimeout(()=>{t.state==r&&Jn(t)},50)}function pd(t,e){let n=t.state.doc.resolve(e);if(!(Ct||Uy)&&n.parent.inlineContent){let r=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(i.left-r.left)>1)return i.left<r.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),s=(i.top+i.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(i.left-r.left)>1)return i.left>r.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function fd(t,e,n){let o=t.state.selection;if(o instanceof ne&&!o.empty||n.indexOf("s")>-1||on&&n.indexOf("m")>-1)return!1;let{$from:r,$to:i}=o;if(!r.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=Rl(t.state,e);if(s&&s instanceof oe)return io(t,s)}if(!r.parent.inlineContent){let s=e<0?r:i,l=o instanceof Jt?ae.near(s,e):ae.findFrom(s,e);return l?io(t,l):!1}return!1}function hd(t,e){if(!(t.state.selection instanceof ne))return!0;let{$head:n,$anchor:o,empty:r}=t.state.selection;if(!n.sameParent(o))return!0;if(!r)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=t.state.tr;return e<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),t.dispatch(s),!0}return!1}function md(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Ev(t){if(!Bt||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 o=e.firstChild;md(t,o,"true"),setTimeout(()=>md(t,o,"false"),20)}return!1}function _v(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Cv(t,e){let n=e.keyCode,o=_v(e);if(n==8||on&&n==72&&o=="c")return hd(t,-1)||Zo(t,-1);if(n==46&&!e.shiftKey||on&&n==68&&o=="c")return hd(t,1)||Zo(t,1);if(n==13||n==27)return!0;if(n==37||on&&n==66&&o=="c"){let r=n==37?pd(t,t.state.selection.from)=="ltr"?-1:1:-1;return dd(t,r,o)||Zo(t,r)}else if(n==39||on&&n==70&&o=="c"){let r=n==39?pd(t,t.state.selection.from)=="ltr"?1:-1:1;return dd(t,r,o)||Zo(t,r)}else{if(n==38||on&&n==80&&o=="c")return fd(t,-1,o)||Zo(t,-1);if(n==40||on&&n==78&&o=="c")return Ev(t)||fd(t,1,o)||Zo(t,1);if(o==(on?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function bc(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:o,openStart:r,openEnd:i}=e;for(;r>1&&i>1&&o.childCount==1&&o.firstChild.childCount==1;){r--,i--;let h=o.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),o=h.content}let s=t.someProp("clipboardSerializer")||Yo.fromSchema(t.state.schema),l=th(),c=l.createElement("div");c.appendChild(s.serializeFragment(o,{document:l}));let u=c.firstChild,d,p=0;for(;u&&u.nodeType==1&&(d=eh[u.nodeName.toLowerCase()]);){for(let h=d.length-1;h>=0;h--){let m=l.createElement(d[h]);for(;c.firstChild;)m.appendChild(c.firstChild);c.appendChild(m),p++}u=c.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${r} ${i}${p?` -${p}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
10
+
11
+ `);return{dom:c,text:f,slice:e}}function Jf(t,e,n,o,r){let i=r.parent.type.spec.code,s,l;if(!n&&!e)return null;let c=e&&(o||i||!n);if(c){if(t.someProp("transformPastedText",f=>{e=f(e,i||o,t)}),i)return e?new V(A.from(t.state.schema.text(e.replace(/\r\n?/g,`
12
+ `))),0,0):V.empty;let p=t.someProp("clipboardTextParser",f=>f(e,r,o,t));if(p)l=p;else{let f=r.marks(),{schema:h}=t.state,m=Yo.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let b=s.appendChild(document.createElement("p"));g&&b.appendChild(m.serializeNode(h.text(g,f)))})}}else t.someProp("transformPastedHTML",p=>{n=p(n,t)}),s=Tv(n),wi&&Ov(s);let u=s&&s.querySelector("[data-pm-slice]"),d=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let p=+d[3];p>0;p--){let f=s.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;s=f}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||lr.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(c||d),context:r,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Sv.test(f.parentNode.nodeName)?{ignore:!0}:null}})),d)l=Mv(gd(l,+d[1],+d[2]),d[4]);else if(l=V.maxOpen(xv(l.content,r),!0),l.openStart||l.openEnd){let p=0,f=0;for(let h=l.content.firstChild;p<l.openStart&&!h.type.spec.isolating;p++,h=h.firstChild);for(let h=l.content.lastChild;f<l.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);l=gd(l,p,f)}return t.someProp("transformPasted",p=>{l=p(l,t)}),l}const Sv=/^(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 xv(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.index(n)),i,s=[];if(t.forEach(l=>{if(!s)return;let c=r.findWrapping(l.type),u;if(!c)return s=null;if(u=s.length&&i.length&&Zf(c,i,l,s[s.length-1],0))s[s.length-1]=u;else{s.length&&(s[s.length-1]=Qf(s[s.length-1],i.length));let d=Xf(l,c);s.push(d),r=r.matchType(d.type),i=c}}),s)return A.from(s)}return t}function Xf(t,e,n=0){for(let o=e.length-1;o>=n;o--)t=e[o].create(null,A.from(t));return t}function Zf(t,e,n,o,r){if(r<t.length&&r<e.length&&t[r]==e[r]){let i=Zf(t,e,n,o.lastChild,r+1);if(i)return o.copy(o.content.replaceChild(o.childCount-1,i));if(o.contentMatchAt(o.childCount).matchType(r==t.length-1?n.type:t[r+1]))return o.copy(o.content.append(A.from(Xf(n,t,r+1))))}}function Qf(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Qf(t.lastChild,e-1)),o=t.contentMatchAt(t.childCount).fillBefore(A.empty,!0);return t.copy(n.append(o))}function Dl(t,e,n,o,r,i){let s=e<0?t.firstChild:t.lastChild,l=s.content;return t.childCount>1&&(i=0),r<o-1&&(l=Dl(l,e,n,o,r+1,i)),r>=n&&(l=e<0?s.contentMatchAt(0).fillBefore(l,i<=r).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(A.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(l))}function gd(t,e,n){return e<t.openStart&&(t=new V(Dl(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new V(Dl(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const eh={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 bd=null;function th(){return bd||(bd=document.implementation.createHTMLDocument("title"))}let Wa=null;function Nv(t){let e=window.trustedTypes;return e?(Wa||(Wa=e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Wa.createHTML(t)):t}function Tv(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=th().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(t),r;if((r=o&&eh[o[1].toLowerCase()])&&(t=r.map(i=>"<"+i+">").join("")+t+r.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=Nv(t),r)for(let i=0;i<r.length;i++)n=n.querySelector(r[i])||n;return n}function Ov(t){let e=t.querySelectorAll(Ct?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let o=e[n];o.childNodes.length==1&&o.textContent==" "&&o.parentNode&&o.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),o)}}function Mv(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,o;try{o=JSON.parse(e)}catch{return t}let{content:r,openStart:i,openEnd:s}=t;for(let l=o.length-2;l>=0;l-=2){let c=n.nodes[o[l]];if(!c||c.hasRequiredAttrs())break;r=A.from(c.create(o[l+1],r)),i++,s++}return new V(r,i,s)}const Dt={},It={},Av={touchstart:!0,touchmove:!0};class Rv{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Bv(t){for(let e in Dt){let n=Dt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=o=>{Iv(t,o)&&!yc(t,o)&&(t.editable||!(o.type in It))&&n(t,o)},Av[e]?{passive:!0}:void 0)}Bt&&t.dom.addEventListener("input",()=>null),Il(t)}function ho(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Dv(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 Il(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=o=>yc(t,o))})}function yc(t,e){return t.someProp("handleDOMEvents",n=>{let o=n[e.type];return o?o(t,e)||e.defaultPrevented:!1})}function Iv(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 Lv(t,e){!yc(t,e)&&Dt[e.type]&&(t.editable||!(e.type in It))&&Dt[e.type](t,e)}It.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!oh(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(jn&&Ct&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),fr&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let o=Date.now();t.input.lastIOSEnter=o,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==o&&(t.someProp("handleKeyDown",r=>r(t,Oo(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",o=>o(t,n))||Cv(t,n)?n.preventDefault():ho(t,"key")};It.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};It.keypress=(t,e)=>{let n=e;if(oh(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||on&&n.metaKey)return;if(t.someProp("handleKeyPress",r=>r(t,n))){n.preventDefault();return}let o=t.state.selection;if(!(o instanceof ne)||!o.$from.sameParent(o.$to)){let r=String.fromCharCode(n.charCode);!/[\r\n]/.test(r)&&!t.someProp("handleTextInput",i=>i(t,o.$from.pos,o.$to.pos,r))&&t.dispatch(t.state.tr.insertText(r).scrollIntoView()),n.preventDefault()}};function da(t){return{left:t.clientX,top:t.clientY}}function Pv(t,e){let n=e.x-t.clientX,o=e.y-t.clientY;return n*n+o*o<100}function vc(t,e,n,o,r){if(o==-1)return!1;let i=t.state.doc.resolve(o);for(let s=i.depth+1;s>0;s--)if(t.someProp(e,l=>s>i.depth?l(t,n,i.nodeAfter,i.before(s),r,!0):l(t,n,i.node(s),i.before(s),r,!1)))return!0;return!1}function ur(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let o=t.state.tr.setSelection(e);o.setMeta("pointer",!0),t.dispatch(o)}function $v(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),o=n.nodeAfter;return o&&o.isAtom&&oe.isSelectable(o)?(ur(t,new oe(n)),!0):!1}function Fv(t,e){if(e==-1)return!1;let n=t.state.selection,o,r;n instanceof oe&&(o=n.node);let i=t.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(oe.isSelectable(l)){o&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?r=i.before(n.$from.depth):r=i.before(s);break}}return r!=null?(ur(t,oe.create(t.state.doc,r)),!0):!1}function Vv(t,e,n,o,r){return vc(t,"handleClickOn",e,n,o)||t.someProp("handleClick",i=>i(t,e,o))||(r?Fv(t,n):$v(t,n))}function zv(t,e,n,o){return vc(t,"handleDoubleClickOn",e,n,o)||t.someProp("handleDoubleClick",r=>r(t,e,o))}function Hv(t,e,n,o){return vc(t,"handleTripleClickOn",e,n,o)||t.someProp("handleTripleClick",r=>r(t,e,o))||Uv(t,n,o)}function Uv(t,e,n){if(n.button!=0)return!1;let o=t.state.doc;if(e==-1)return o.inlineContent?(ur(t,ne.create(o,0,o.content.size)),!0):!1;let r=o.resolve(e);for(let i=r.depth+1;i>0;i--){let s=i>r.depth?r.nodeAfter:r.node(i),l=r.before(i);if(s.inlineContent)ur(t,ne.create(o,l+1,l+1+s.content.size));else if(oe.isSelectable(s))ur(t,oe.create(o,l));else continue;return!0}}function kc(t){return ks(t)}const nh=on?"metaKey":"ctrlKey";Dt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let o=kc(t),r=Date.now(),i="singleClick";r-t.input.lastClick.time<500&&Pv(n,t.input.lastClick)&&!n[nh]&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:r,x:n.clientX,y:n.clientY,type:i};let s=t.posAtCoords(da(n));s&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new qv(t,s,n,!!o)):(i=="doubleClick"?zv:Hv)(t,s.pos,s.inside,n)?n.preventDefault():ho(t,"pointer"))};class qv{constructor(e,n,o,r){this.view=e,this.pos=n,this.event=o,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!o[nh],this.allowDefault=o.shiftKey;let i,s;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),s=n.inside;else{let d=e.state.doc.resolve(n.pos);i=d.parent,s=d.depth?d.before():0}const l=r?null:o.target,c=l?e.docView.nearestDesc(l,!0):null;this.target=c&&c.dom.nodeType==1?c.dom:null;let{selection:u}=e.state;(o.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||u instanceof oe&&u.from<=s&&u.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&vn&&!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)),ho(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(()=>Jn(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(da(e))),this.updateAllowDefault(e),this.allowDefault||!n?ho(this.view,"pointer"):Vv(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Bt&&this.mightDrag&&!this.mightDrag.node.isAtom||Ct&&!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)?(ur(this.view,ae.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):ho(this.view,"pointer")}move(e){this.updateAllowDefault(e),ho(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)}}Dt.touchstart=t=>{t.input.lastTouch=Date.now(),kc(t),ho(t,"pointer")};Dt.touchmove=t=>{t.input.lastTouch=Date.now(),ho(t,"pointer")};Dt.contextmenu=t=>kc(t);function oh(t,e){return t.composing?!0:Bt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const Kv=jn?5e3:-1;It.compositionstart=It.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof ne&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(o=>o.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),ks(t,!0),t.markCursor=null;else if(ks(t,!e.selection.empty),vn&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let o=t.domSelectionRange();for(let r=o.focusNode,i=o.focusOffset;r&&r.nodeType==1&&i!=0;){let s=i<0?r.lastChild:r.childNodes[i-1];if(!s)break;if(s.nodeType==3){let l=t.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else r=s,i=-1}}t.input.composing=!0}rh(t,Kv)};It.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,rh(t,20))};function rh(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>ks(t),e))}function ih(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=jv());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Wv(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=$y(e.focusNode,e.focusOffset),o=Fy(e.focusNode,e.focusOffset);if(n&&o&&n!=o){let r=o.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||o==i)return i;if(!r||!r.isText(o.nodeValue))return o;if(t.input.compositionNode==o){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return o}}return n||o}function jv(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function ks(t,e=!1){if(!(jn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),ih(t),e||t.docView&&t.docView.dirty){let n=mc(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!t.state.selection.empty?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function Gv(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 o=getSelection(),r=document.createRange();r.selectNodeContents(e),t.dom.blur(),o.removeAllRanges(),o.addRange(r),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const si=Vt&&go<15||fr&&qy<604;Dt.copy=It.cut=(t,e)=>{let n=e,o=t.state.selection,r=n.type=="cut";if(o.empty)return;let i=si?null:n.clipboardData,s=o.content(),{dom:l,text:c}=bc(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",c)):Gv(t,l),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Yv(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function Jv(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,o=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus();let r=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),o.parentNode&&o.parentNode.removeChild(o),n?ai(t,o.value,null,r,e):ai(t,o.textContent,o.innerHTML,r,e)},50)}function ai(t,e,n,o,r){let i=Jf(t,e,n,o,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,r,i||V.empty)))return!0;if(!i)return!1;let s=Yv(i),l=s?t.state.tr.replaceSelectionWith(s,o):t.state.tr.replaceSelection(i);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function sh(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," "):""}It.paste=(t,e)=>{let n=e;if(t.composing&&!jn)return;let o=si?null:n.clipboardData,r=t.input.shiftKey&&t.input.lastKeyCode!=45;o&&ai(t,sh(o),o.getData("text/html"),r,n)?n.preventDefault():Jv(t,n)};class ah{constructor(e,n,o){this.slice=e,this.move=n,this.node=o}}const lh=on?"altKey":"ctrlKey";Dt.dragstart=(t,e)=>{let n=e,o=t.input.mouseDown;if(o&&o.done(),!n.dataTransfer)return;let r=t.state.selection,i=r.empty?null:t.posAtCoords(da(n)),s;if(!(i&&i.pos>=r.from&&i.pos<=(r instanceof oe?r.to-1:r.to))){if(o&&o.mightDrag)s=oe.create(t.state.doc,o.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let p=t.docView.nearestDesc(n.target,!0);p&&p.node.type.spec.draggable&&p!=t.docView&&(s=oe.create(t.state.doc,p.posBefore))}}let l=(s||t.state.selection).content(),{dom:c,text:u,slice:d}=bc(t,l);(!n.dataTransfer.files.length||!Ct||Df>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(si?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",si||n.dataTransfer.setData("text/plain",u),t.dragging=new ah(d,!n[lh],s)};Dt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};It.dragover=It.dragenter=(t,e)=>e.preventDefault();It.drop=(t,e)=>{let n=e,o=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let r=t.posAtCoords(da(n));if(!r)return;let i=t.state.doc.resolve(r.pos),s=o&&o.slice;s?t.someProp("transformPasted",m=>{s=m(s,t)}):s=Jf(t,sh(n.dataTransfer),si?null:n.dataTransfer.getData("text/html"),!1,i);let l=!!(o&&!n[lh]);if(t.someProp("handleDrop",m=>m(t,n,s||V.empty,l))){n.preventDefault();return}if(!s)return;n.preventDefault();let c=s?Sf(t.state.doc,i.pos,s):i.pos;c==null&&(c=i.pos);let u=t.state.tr;if(l){let{node:m}=o;m?m.replace(u):u.deleteSelection()}let d=u.mapping.map(c),p=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,f=u.doc;if(p?u.replaceRangeWith(d,d,s.content.firstChild):u.replaceRange(d,d,s),u.doc.eq(f))return;let h=u.doc.resolve(d);if(p&&oe.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))u.setSelection(new oe(h));else{let m=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((g,b,y,k)=>m=k),u.setSelection(gc(t,h,u.doc.resolve(m)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))};Dt.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())&&Jn(t)},20))};Dt.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)};Dt.beforeinput=(t,e)=>{if(Ct&&jn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:o}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=o||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,Oo(8,"Backspace")))))return;let{$cursor:r}=t.state.selection;r&&r.pos>0&&t.dispatch(t.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let t in It)Dt[t]=It[t];function li(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 ws{constructor(e,n){this.toDOM=e,this.spec=n||Po,this.side=this.spec.side||0}map(e,n,o,r){let{pos:i,deleted:s}=e.mapResult(n.from+r,this.side<0?-1:1);return s?null:new Ge(i-o,i-o,this)}valid(){return!0}eq(e){return this==e||e instanceof ws&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&li(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class yo{constructor(e,n){this.attrs=e,this.spec=n||Po}map(e,n,o,r){let i=e.map(n.from+r,this.spec.inclusiveStart?-1:1)-o,s=e.map(n.to+r,this.spec.inclusiveEnd?1:-1)-o;return i>=s?null:new Ge(i,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof yo&&li(this.attrs,e.attrs)&&li(this.spec,e.spec)}static is(e){return e.type instanceof yo}destroy(){}}class wc{constructor(e,n){this.attrs=e,this.spec=n||Po}map(e,n,o,r){let i=e.mapResult(n.from+r,1);if(i.deleted)return null;let s=e.mapResult(n.to+r,-1);return s.deleted||s.pos<=i.pos?null:new Ge(i.pos-o,s.pos-o,this)}valid(e,n){let{index:o,offset:r}=e.content.findIndex(n.from),i;return r==n.from&&!(i=e.child(o)).isText&&r+i.nodeSize==n.to}eq(e){return this==e||e instanceof wc&&li(this.attrs,e.attrs)&&li(this.spec,e.spec)}destroy(){}}class Ge{constructor(e,n,o){this.from=e,this.to=n,this.type=o}copy(e,n){return new Ge(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,o){return this.type.map(e,this,n,o)}static widget(e,n,o){return new Ge(e,e,new ws(n,o))}static inline(e,n,o,r){return new Ge(e,n,new yo(o,r))}static node(e,n,o,r){return new Ge(e,n,new wc(o,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof yo}get widget(){return this.type instanceof ws}}const nr=[],Po={};class Ne{constructor(e,n){this.local=e.length?e:nr,this.children=n.length?n:nr}static create(e,n){return n.length?Es(n,e,0,Po):_t}find(e,n,o){let r=[];return this.findInner(e??0,n??1e9,r,0,o),r}findInner(e,n,o,r,i){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=n&&l.to>=e&&(!i||i(l.spec))&&o.push(l.copy(l.from+r,l.to+r))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,n-l,o,r+l,i)}}map(e,n,o){return this==_t||e.maps.length==0?this:this.mapInner(e,n,0,0,o||Po)}mapInner(e,n,o,r,i){let s;for(let l=0;l<this.local.length;l++){let c=this.local[l].map(e,o,r);c&&c.type.valid(n,c)?(s||(s=[])).push(c):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?Xv(this.children,s||[],e,n,o,r,i):s?new Ne(s.sort($o),nr):_t}add(e,n){return n.length?this==_t?Ne.create(e,n):this.addInner(e,n,0):this}addInner(e,n,o){let r,i=0;e.forEach((l,c)=>{let u=c+o,d;if(d=uh(n,l,u)){for(r||(r=this.children.slice());i<r.length&&r[i]<c;)i+=3;r[i]==c?r[i+2]=r[i+2].addInner(l,d,u+1):r.splice(i,0,c,c+l.nodeSize,Es(d,l,u+1,Po)),i+=3}});let s=ch(i?dh(n):n,-o);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new Ne(s.length?this.local.concat(s).sort($o):this.local,r||this.children)}remove(e){return e.length==0||this==_t?this:this.removeInner(e,0)}removeInner(e,n){let o=this.children,r=this.local;for(let i=0;i<o.length;i+=3){let s,l=o[i]+n,c=o[i+1]+n;for(let d=0,p;d<e.length;d++)(p=e[d])&&p.from>l&&p.to<c&&(e[d]=null,(s||(s=[])).push(p));if(!s)continue;o==this.children&&(o=this.children.slice());let u=o[i+2].removeInner(s,l+1);u!=_t?o[i+2]=u:(o.splice(i,3),i-=3)}if(r.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let l=0;l<r.length;l++)r[l].eq(s,n)&&(r==this.local&&(r=this.local.slice()),r.splice(l--,1))}return o==this.children&&r==this.local?this:r.length||o.length?new Ne(r,o):_t}forChild(e,n){if(this==_t)return this;if(n.isLeaf)return Ne.empty;let o,r;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(o=this.children[l+2]);break}let i=e+1,s=i+n.content.size;for(let l=0;l<this.local.length;l++){let c=this.local[l];if(c.from<s&&c.to>i&&c.type instanceof yo){let u=Math.max(i,c.from)-i,d=Math.min(s,c.to)-i;u<d&&(r||(r=[])).push(c.copy(u,d))}}if(r){let l=new Ne(r.sort($o),nr);return o?new lo([l,o]):l}return o||_t}eq(e){if(this==e)return!0;if(!(e instanceof Ne)||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 Ec(this.localsInner(e))}localsInner(e){if(this==_t)return nr;if(e.inlineContent||!this.local.some(yo.is))return this.local;let n=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof yo||n.push(this.local[o]);return n}forEachSet(e){e(this)}}Ne.empty=new Ne([],[]);Ne.removeOverlap=Ec;const _t=Ne.empty;class lo{constructor(e){this.members=e}map(e,n){const o=this.members.map(r=>r.map(e,n,Po));return lo.from(o)}forChild(e,n){if(n.isLeaf)return Ne.empty;let o=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,n);i!=_t&&(i instanceof lo?o=o.concat(i.members):o.push(i))}return lo.from(o)}eq(e){if(!(e instanceof lo)||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,o=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!n)n=i;else{o&&(n=n.slice(),o=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?Ec(o?n:n.sort($o)):nr}static from(e){switch(e.length){case 0:return _t;case 1:return e[0];default:return new lo(e.every(n=>n instanceof Ne)?e:e.reduce((n,o)=>n.concat(o instanceof Ne?o:o.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function Xv(t,e,n,o,r,i,s){let l=t.slice();for(let u=0,d=i;u<n.maps.length;u++){let p=0;n.maps[u].forEach((f,h,m,g)=>{let b=g-m-(h-f);for(let y=0;y<l.length;y+=3){let k=l[y+1];if(k<0||f>k+d-p)continue;let E=l[y]+d-p;h>=E?l[y+1]=f<=E?-2:-1:f>=d&&b&&(l[y]+=b,l[y+1]+=b)}p+=b}),d=n.maps[u].map(d,-1)}let c=!1;for(let u=0;u<l.length;u+=3)if(l[u+1]<0){if(l[u+1]==-2){c=!0,l[u+1]=-1;continue}let d=n.map(t[u]+i),p=d-r;if(p<0||p>=o.content.size){c=!0;continue}let f=n.map(t[u+1]+i,-1),h=f-r,{index:m,offset:g}=o.content.findIndex(p),b=o.maybeChild(m);if(b&&g==p&&g+b.nodeSize==h){let y=l[u+2].mapInner(n,b,d+1,t[u]+i+1,s);y!=_t?(l[u]=p,l[u+1]=h,l[u+2]=y):(l[u+1]=-2,c=!0)}else c=!0}if(c){let u=Zv(l,t,e,n,r,i,s),d=Es(u,o,0,s);e=d.local;for(let p=0;p<l.length;p+=3)l[p+1]<0&&(l.splice(p,3),p-=3);for(let p=0,f=0;p<d.children.length;p+=3){let h=d.children[p];for(;f<l.length&&l[f]<h;)f+=3;l.splice(f,0,d.children[p],d.children[p+1],d.children[p+2])}}return new Ne(e.sort($o),l)}function ch(t,e){if(!e||!t.length)return t;let n=[];for(let o=0;o<t.length;o++){let r=t[o];n.push(new Ge(r.from+e,r.to+e,r.type))}return n}function Zv(t,e,n,o,r,i,s){function l(c,u){for(let d=0;d<c.local.length;d++){let p=c.local[d].map(o,r,u);p?n.push(p):s.onRemove&&s.onRemove(c.local[d].spec)}for(let d=0;d<c.children.length;d+=3)l(c.children[d+2],c.children[d]+u+1)}for(let c=0;c<t.length;c+=3)t[c+1]==-1&&l(t[c+2],e[c]+i+1);return n}function uh(t,e,n){if(e.isLeaf)return null;let o=n+e.nodeSize,r=null;for(let i=0,s;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<o&&((r||(r=[])).push(s),t[i]=null);return r}function dh(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Es(t,e,n,o){let r=[],i=!1;e.forEach((l,c)=>{let u=uh(t,l,c+n);if(u){i=!0;let d=Es(u,l,n+c+1,o);d!=_t&&r.push(c,c+l.nodeSize,d)}});let s=ch(i?dh(t):t,-n).sort($o);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(o.onRemove&&o.onRemove(s[l].spec),s.splice(l--,1));return s.length||r.length?new Ne(s,r):_t}function $o(t,e){return t.from-e.from||t.to-e.to}function Ec(t){let e=t;for(let n=0;n<e.length-1;n++){let o=e[n];if(o.from!=o.to)for(let r=n+1;r<e.length;r++){let i=e[r];if(i.from==o.from){i.to!=o.to&&(e==t&&(e=t.slice()),e[r]=i.copy(i.from,o.to),yd(e,r+1,i.copy(o.to,i.to)));continue}else{i.from<o.to&&(e==t&&(e=t.slice()),e[n]=o.copy(o.from,i.from),yd(e,r,o.copy(i.from,o.to)));break}}}return e}function yd(t,e,n){for(;e<t.length&&$o(n,t[e])>0;)e++;t.splice(e,0,n)}function ja(t){let e=[];return t.someProp("decorations",n=>{let o=n(t.state);o&&o!=_t&&e.push(o)}),t.cursorWrapper&&e.push(Ne.create(t.state.doc,[t.cursorWrapper.deco])),lo.from(e)}const Qv={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},ek=Vt&&go<=11;class tk{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 nk{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new tk,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(o=>{for(let r=0;r<o.length;r++)this.queue.push(o[r]);Vt&&go<=11&&o.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),ek&&(this.onCharData=o=>{this.queue.push({target:o.target,type:"characterData",oldValue:o.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,Qv)),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(ud(this.view)){if(this.suppressingSelectionUpdates)return Jn(this.view);if(Vt&&go<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&qo(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,o;for(let i=e.focusNode;i;i=ii(i))n.add(i);for(let i=e.anchorNode;i;i=ii(i))if(n.has(i)){o=i;break}let r=o&&this.view.docView.nearestDesc(o);if(r&&r.ignoreMutation({type:"selection",target:o.nodeType==3?o.parentNode:o}))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 o=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(o)&&ud(e)&&!this.ignoreSelectionChange(o),i=-1,s=-1,l=!1,c=[];if(e.editable)for(let d=0;d<n.length;d++){let p=this.registerMutation(n[d],c);p&&(i=i<0?p.from:Math.min(p.from,i),s=s<0?p.to:Math.max(p.to,s),p.typeOver&&(l=!0))}if(vn&&c.length){let d=c.filter(p=>p.nodeName=="BR");if(d.length==2){let[p,f]=d;p.parentNode&&p.parentNode.parentNode==f.parentNode?f.remove():p.remove()}else{let{focusNode:p}=this.currentSelection;for(let f of d){let h=f.parentNode;h&&h.nodeName=="LI"&&(!p||ik(e,p)!=h)&&f.remove()}}}let u=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ca(o)&&(u=mc(e))&&u.eq(ae.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Jn(e),this.currentSelection.set(o)):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,s),ok(e)),this.handleDOMChange(i,s,l,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(o)||Jn(e),this.currentSelection.set(o))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let o=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(o==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!o||o.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let p=e.addedNodes[d];n.push(p),p.nodeType==3&&(this.lastChangedTextNode=p)}if(o.contentDOM&&o.contentDOM!=o.dom&&!o.contentDOM.contains(e.target))return{from:o.posBefore,to:o.posAfter};let r=e.previousSibling,i=e.nextSibling;if(Vt&&go<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:p,nextSibling:f}=e.addedNodes[d];(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(r=p),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f)}let s=r&&r.parentNode==e.target?vt(r)+1:0,l=o.localPosFromDOM(e.target,s,-1),c=i&&i.parentNode==e.target?vt(i):e.target.childNodes.length,u=o.localPosFromDOM(e.target,c,1);return{from:l,to:u}}else return e.type=="attributes"?{from:o.posAtStart-o.border,to:o.posAtEnd+o.border}:(this.lastChangedTextNode=e.target,{from:o.posAtStart,to:o.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let vd=new WeakMap,kd=!1;function ok(t){if(!vd.has(t)&&(vd.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=vn,kd)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."),kd=!0}}function wd(t,e){let n=e.startContainer,o=e.startOffset,r=e.endContainer,i=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return qo(s.node,s.offset,r,i)&&([n,o,r,i]=[r,i,n,o]),{anchorNode:n,anchorOffset:o,focusNode:r,focusOffset:i}}function rk(t,e){if(e.getComposedRanges){let r=e.getComposedRanges(t.root)[0];if(r)return wd(t,r)}let n;function o(r){r.preventDefault(),r.stopImmediatePropagation(),n=r.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",o,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",o,!0),n?wd(t,n):null}function ik(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let o=t.docView.nearestDesc(n,!0);if(o&&o.node.isBlock)return n}return null}function sk(t,e,n){let{node:o,fromOffset:r,toOffset:i,from:s,to:l}=t.docView.parseRange(e,n),c=t.domSelectionRange(),u,d=c.anchorNode;if(d&&t.dom.contains(d.nodeType==1?d:d.parentNode)&&(u=[{node:d,offset:c.anchorOffset}],ca(c)||u.push({node:c.focusNode,offset:c.focusOffset})),Ct&&t.input.lastKeyCode===8)for(let b=i;b>r;b--){let y=o.childNodes[b-1],k=y.pmViewDesc;if(y.nodeName=="BR"&&!k){i=b;break}if(!k||k.size)break}let p=t.state.doc,f=t.someProp("domParser")||lr.fromSchema(t.state.schema),h=p.resolve(s),m=null,g=f.parse(o,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:r,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:ak,context:h});if(u&&u[0].pos!=null){let b=u[0].pos,y=u[1]&&u[1].pos;y==null&&(y=b),m={anchor:b+s,head:y+s}}return{doc:g,sel:m,from:s,to:l}}function ak(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Bt&&/^(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||Bt&&/^(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 lk=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function ck(t,e,n,o,r){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let N=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,M=mc(t,N);if(M&&!t.state.selection.eq(M)){if(Ct&&jn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",G=>G(t,Oo(13,"Enter"))))return;let z=t.state.tr.setSelection(M);N=="pointer"?z.setMeta("pointer",!0):N=="key"&&z.scrollIntoView(),i&&z.setMeta("composition",i),t.dispatch(z)}return}let s=t.state.doc.resolve(e),l=s.sharedDepth(n);e=s.before(l+1),n=t.state.doc.resolve(n).after(l+1);let c=t.state.selection,u=sk(t,e,n),d=t.state.doc,p=d.slice(u.from,u.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=pk(p.content,u.doc.content,u.from,f,h);if(m&&t.input.domChangeCount++,(fr&&t.input.lastIOSEnter>Date.now()-225||jn)&&r.some(N=>N.nodeType==1&&!lk.test(N.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",N=>N(t,Oo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(o&&c instanceof ne&&!c.empty&&c.$head.sameParent(c.$anchor)&&!t.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(u.sel){let N=Ed(t,t.state.doc,u.sel);if(N&&!N.eq(t.state.selection)){let M=t.state.tr.setSelection(N);i&&M.setMeta("composition",i),t.dispatch(M)}}return}t.state.selection.from<t.state.selection.to&&m.start==m.endB&&t.state.selection instanceof ne&&(m.start>t.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=u.from?m.start=t.state.selection.from:m.endA<t.state.selection.to&&m.endA>=t.state.selection.to-2&&t.state.selection.to<=u.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),Vt&&go<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>u.from&&u.doc.textBetween(m.start-u.from-1,m.start-u.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let g=u.doc.resolveNoCache(m.start-u.from),b=u.doc.resolveNoCache(m.endB-u.from),y=d.resolve(m.start),k=g.sameParent(b)&&g.parent.inlineContent&&y.end()>=m.endA,E;if((fr&&t.input.lastIOSEnter>Date.now()-225&&(!k||r.some(N=>N.nodeName=="DIV"||N.nodeName=="P"))||!k&&g.pos<u.doc.content.size&&!g.sameParent(b)&&(E=ae.findFrom(u.doc.resolve(g.pos+1),1,!0))&&E.head==b.pos)&&t.someProp("handleKeyDown",N=>N(t,Oo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&dk(d,m.start,m.endA,g,b)&&t.someProp("handleKeyDown",N=>N(t,Oo(8,"Backspace")))){jn&&Ct&&t.domObserver.suppressSelectionUpdates();return}Ct&&m.endB==m.start&&(t.input.lastChromeDelete=Date.now()),jn&&!k&&g.start()!=b.start()&&b.parentOffset==0&&g.depth==b.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==m.endA&&(m.endB-=2,b=u.doc.resolveNoCache(m.endB-u.from),setTimeout(()=>{t.someProp("handleKeyDown",function(N){return N(t,Oo(13,"Enter"))})},20));let v=m.start,C=m.endA,_,R,B;if(k){if(g.pos==b.pos)Vt&&go<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Jn(t),20)),_=t.state.tr.delete(v,C),R=d.resolve(m.start).marksAcross(d.resolve(m.endA));else if(m.endA==m.endB&&(B=uk(g.parent.content.cut(g.parentOffset,b.parentOffset),y.parent.content.cut(y.parentOffset,m.endA-y.start()))))_=t.state.tr,B.type=="add"?_.addMark(v,C,B.mark):_.removeMark(v,C,B.mark);else if(g.parent.child(g.index()).isText&&g.index()==b.index()-(b.textOffset?0:1)){let N=g.parent.textBetween(g.parentOffset,b.parentOffset);if(t.someProp("handleTextInput",M=>M(t,v,C,N)))return;_=t.state.tr.insertText(N,v,C)}}if(_||(_=t.state.tr.replace(v,C,u.doc.slice(m.start-u.from,m.endB-u.from))),u.sel){let N=Ed(t,_.doc,u.sel);N&&!(Ct&&t.composing&&N.empty&&(m.start!=m.endB||t.input.lastChromeDelete<Date.now()-100)&&(N.head==v||N.head==_.mapping.map(C)-1)||Vt&&N.empty&&N.head==v)&&_.setSelection(N)}R&&_.ensureMarks(R),i&&_.setMeta("composition",i),t.dispatch(_.scrollIntoView())}function Ed(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:gc(t,e.resolve(n.anchor),e.resolve(n.head))}function uk(t,e){let n=t.firstChild.marks,o=e.firstChild.marks,r=n,i=o,s,l,c;for(let d=0;d<o.length;d++)r=o[d].removeFromSet(r);for(let d=0;d<n.length;d++)i=n[d].removeFromSet(i);if(r.length==1&&i.length==0)l=r[0],s="add",c=d=>d.mark(l.addToSet(d.marks));else if(r.length==0&&i.length==1)l=i[0],s="remove",c=d=>d.mark(l.removeFromSet(d.marks));else return null;let u=[];for(let d=0;d<e.childCount;d++)u.push(c(e.child(d)));if(A.from(u).eq(t))return{mark:l,type:s}}function dk(t,e,n,o,r){if(n-e<=r.pos-o.pos||Ga(o,!0,!1)<r.pos)return!1;let i=t.resolve(e);if(!o.parent.isTextblock){let l=i.nodeAfter;return l!=null&&n==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=t.resolve(Ga(i,!0,!0));return!s.parent.isTextblock||s.pos>n||Ga(s,!0,!1)<n?!1:o.parent.content.cut(o.parentOffset).eq(s.parent.content)}function Ga(t,e,n){let o=t.depth,r=e?t.end():t.pos;for(;o>0&&(e||t.indexAfter(o)==t.node(o).childCount);)o--,r++,e=!1;if(n){let i=t.node(o).maybeChild(t.indexAfter(o));for(;i&&!i.isLeaf;)i=i.firstChild,r++}return r}function pk(t,e,n,o,r){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:s,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(r=="end"){let c=Math.max(0,i-Math.min(s,l));o-=s+c-i}if(s<i&&t.size<e.size){let c=o<=i&&o>=s?i-o:0;i-=c,i&&i<e.size&&_d(e.textBetween(i-1,i+1))&&(i+=c?1:-1),l=i+(l-s),s=i}else if(l<i){let c=o<=i&&o>=l?i-o:0;i-=c,i&&i<t.size&&_d(t.textBetween(i-1,i+1))&&(i+=c?1:-1),s=i+(s-l),l=i}return{start:i,endA:s,endB:l}}function _d(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 fk{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 Rv,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Td),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=xd(this),Sd(this),this.nodeViews=Nd(this),this.docView=rd(this.state.doc,Cd(this),ja(this),this.dom,this),this.domObserver=new nk(this,(o,r,i,s)=>ck(this,o,r,i,s)),this.domObserver.start(),Bv(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&&Il(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Td),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let o in this._props)n[o]=this._props[o];n.state=this.state;for(let o in e)n[o]=e[o];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var o;let r=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(ih(this),s=!0),this.state=e;let l=r.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=Nd(this);mk(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&Il(this),this.editable=xd(this),Sd(this);let c=ja(this),u=Cd(this),d=r.plugins!=e.plugins&&!r.doc.eq(e.doc)?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",p=i||!this.docView.matchesNode(e.doc,u,c);(p||!e.selection.eq(r.selection))&&(s=!0);let f=d=="preserve"&&s&&this.dom.style.overflowAnchor==null&&jy(this);if(s){this.domObserver.stop();let h=p&&(Vt||Ct)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&hk(r.selection,e.selection);if(p){let m=Ct?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Wv(this)),(i||!this.docView.update(e.doc,u,c,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=rd(e.doc,u,c,this.dom,this)),m&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&bv(this))?Jn(this,h):(jf(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),!((o=this.dragging)===null||o===void 0)&&o.node&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():f&&Gy(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 oe){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Zu(this,n.getBoundingClientRect(),e)}else Zu(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 o=this.directPlugins[n];o.spec.view&&this.pluginViews.push(o.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let o=this.state.plugins[n];o.spec.view&&this.pluginViews.push(o.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let o=this.pluginViews[n];o.update&&o.update(this,e)}}updateDraggedNode(e,n){let o=e.node,r=-1;if(this.state.doc.nodeAt(o.from)==o.node)r=o.from;else{let i=o.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==o.node&&(r=i)}this.dragging=new ah(e.slice,e.move,r<0?void 0:oe.create(this.state.doc,r))}someProp(e,n){let o=this._props&&this._props[e],r;if(o!=null&&(r=n?n(o):o))return r;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(r=n?n(l):l))return r}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let l=i[s].props[e];if(l!=null&&(r=n?n(l):l))return r}}hasFocus(){if(Vt){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&&Yy(this.dom),Jn(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 ev(this,e)}coordsAtPos(e,n=1){return Ff(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,o=-1){let r=this.docView.posFromDOM(e,n,o);if(r==null)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,n){return iv(this,n||this.state,e)}pasteHTML(e,n){return ai(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return ai(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return bc(this,e)}destroy(){this.docView&&(Dv(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ja(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Ly())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Lv(this,e)}dispatch(e){let n=this._props.dispatchTransaction;n?n.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?Bt&&this.root.nodeType===11&&zy(this.dom.ownerDocument)==this.dom&&rk(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function Cd(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 o in n)o=="class"?e.class+=" "+n[o]:o=="style"?e.style=(e.style?e.style+";":"")+n[o]:!e[o]&&o!="contenteditable"&&o!="nodeName"&&(e[o]=String(n[o]))}),e.translate||(e.translate="no"),[Ge.node(0,t.state.doc.content.size,e)]}function Sd(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:Ge.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function xd(t){return!t.someProp("editable",e=>e(t.state)===!1)}function hk(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 Nd(t){let e=Object.create(null);function n(o){for(let r in o)Object.prototype.hasOwnProperty.call(e,r)||(e[r]=o[r])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function mk(t,e){let n=0,o=0;for(let r in t){if(t[r]!=e[r])return!0;n++}for(let r in e)o++;return n!=o}function Td(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 vo={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:"'"},_s={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},gk=typeof navigator<"u"&&/Mac/.test(navigator.platform),bk=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var kt=0;kt<10;kt++)vo[48+kt]=vo[96+kt]=String(kt);for(var kt=1;kt<=24;kt++)vo[kt+111]="F"+kt;for(var kt=65;kt<=90;kt++)vo[kt]=String.fromCharCode(kt+32),_s[kt]=String.fromCharCode(kt);for(var Ya in vo)_s.hasOwnProperty(Ya)||(_s[Ya]=vo[Ya]);function yk(t){var e=gk&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||bk&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?_s:vo)[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 vk=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function kk(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let o,r,i,s;for(let l=0;l<e.length-1;l++){let c=e[l];if(/^(cmd|meta|m)$/i.test(c))s=!0;else if(/^a(lt)?$/i.test(c))o=!0;else if(/^(c|ctrl|control)$/i.test(c))r=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))vk?s=!0:r=!0;else throw new Error("Unrecognized modifier name: "+c)}return o&&(n="Alt-"+n),r&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function wk(t){let e=Object.create(null);for(let n in t)e[kk(n)]=t[n];return e}function Ja(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 Ek(t){return new Ae({props:{handleKeyDown:_c(t)}})}function _c(t){let e=wk(t);return function(n,o){let r=yk(o),i,s=e[Ja(r,o)];if(s&&s(n.state,n.dispatch,n))return!0;if(r.length==1&&r!=" "){if(o.shiftKey){let l=e[Ja(r,o,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((o.shiftKey||o.altKey||o.metaKey||r.charCodeAt(0)>127)&&(i=vo[o.keyCode])&&i!=r){let l=e[Ja(i,o)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}const Cc=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function ph(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const fh=(t,e,n)=>{let o=ph(t,n);if(!o)return!1;let r=Sc(o);if(!r){let s=o.blockRange(),l=s&&_r(s);return l==null?!1:(e&&e(t.tr.lift(s,l).scrollIntoView()),!0)}let i=r.nodeBefore;if(Eh(t,r,e,-1))return!0;if(o.parent.content.size==0&&(hr(i,"end")||oe.isSelectable(i)))for(let s=o.depth;;s--){let l=aa(t.doc,o.before(s),o.after(s),V.empty);if(l&&l.slice.size<l.to-l.from){if(e){let c=t.tr.step(l);c.setSelection(hr(i,"end")?ae.findFrom(c.doc.resolve(c.mapping.map(r.pos,-1)),-1):oe.create(c.doc,r.pos-i.nodeSize)),e(c.scrollIntoView())}return!0}if(s==1||o.node(s-1).childCount>1)break}return i.isAtom&&r.depth==o.depth-1?(e&&e(t.tr.delete(r.pos-i.nodeSize,r.pos).scrollIntoView()),!0):!1},_k=(t,e,n)=>{let o=ph(t,n);if(!o)return!1;let r=Sc(o);return r?hh(t,r,e):!1},Ck=(t,e,n)=>{let o=gh(t,n);if(!o)return!1;let r=xc(o);return r?hh(t,r,e):!1};function hh(t,e,n){let o=e.nodeBefore,r=o,i=e.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let d=r.lastChild;if(!d)return!1;r=d}let s=e.nodeAfter,l=s,c=e.pos+1;for(;!l.isTextblock;c++){if(l.type.spec.isolating)return!1;let d=l.firstChild;if(!d)return!1;l=d}let u=aa(t.doc,i,c,V.empty);if(!u||u.from!=i||u instanceof pt&&u.slice.size>=c-i)return!1;if(n){let d=t.tr.step(u);d.setSelection(ne.create(d.doc,i)),n(d.scrollIntoView())}return!0}function hr(t,e,n=!1){for(let o=t;o;o=e=="start"?o.firstChild:o.lastChild){if(o.isTextblock)return!0;if(n&&o.childCount!=1)return!1}return!1}const mh=(t,e,n)=>{let{$head:o,empty:r}=t.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):o.parentOffset>0)return!1;i=Sc(o)}let s=i&&i.nodeBefore;return!s||!oe.isSelectable(s)?!1:(e&&e(t.tr.setSelection(oe.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function Sc(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 gh(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const bh=(t,e,n)=>{let o=gh(t,n);if(!o)return!1;let r=xc(o);if(!r)return!1;let i=r.nodeAfter;if(Eh(t,r,e,1))return!0;if(o.parent.content.size==0&&(hr(i,"start")||oe.isSelectable(i))){let s=aa(t.doc,o.before(),o.after(),V.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=t.tr.step(s);l.setSelection(hr(i,"start")?ae.findFrom(l.doc.resolve(l.mapping.map(r.pos)),1):oe.create(l.doc,l.mapping.map(r.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&r.depth==o.depth-1?(e&&e(t.tr.delete(r.pos,r.pos+i.nodeSize).scrollIntoView()),!0):!1},yh=(t,e,n)=>{let{$head:o,empty:r}=t.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):o.parentOffset<o.parent.content.size)return!1;i=xc(o)}let s=i&&i.nodeAfter;return!s||!oe.isSelectable(s)?!1:(e&&e(t.tr.setSelection(oe.create(t.doc,i.pos)).scrollIntoView()),!0)};function xc(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 Sk=(t,e)=>{let n=t.selection,o=n instanceof oe,r;if(o){if(n.node.isTextblock||!wo(t.doc,n.from))return!1;r=n.from}else if(r=sa(t.doc,n.from,-1),r==null)return!1;if(e){let i=t.tr.join(r);o&&i.setSelection(oe.create(i.doc,r-t.doc.resolve(r).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},xk=(t,e)=>{let n=t.selection,o;if(n instanceof oe){if(n.node.isTextblock||!wo(t.doc,n.to))return!1;o=n.to}else if(o=sa(t.doc,n.to,1),o==null)return!1;return e&&e(t.tr.join(o).scrollIntoView()),!0},Nk=(t,e)=>{let{$from:n,$to:o}=t.selection,r=n.blockRange(o),i=r&&_r(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)},vh=(t,e)=>{let{$head:n,$anchor:o}=t.selection;return!n.parent.type.spec.code||!n.sameParent(o)?!1:(e&&e(t.tr.insertText(`
13
+ `).scrollIntoView()),!0)};function Nc(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 Tk=(t,e)=>{let{$head:n,$anchor:o}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(o))return!1;let r=n.node(-1),i=n.indexAfter(-1),s=Nc(r.contentMatchAt(i));if(!s||!r.canReplaceWith(i,i,s))return!1;if(e){let l=n.after(),c=t.tr.replaceWith(l,l,s.createAndFill());c.setSelection(ae.near(c.doc.resolve(l),1)),e(c.scrollIntoView())}return!0},kh=(t,e)=>{let n=t.selection,{$from:o,$to:r}=n;if(n instanceof Jt||o.parent.inlineContent||r.parent.inlineContent)return!1;let i=Nc(r.parent.contentMatchAt(r.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!o.parentOffset&&r.index()<r.parent.childCount?o:r).pos,l=t.tr.insert(s,i.createAndFill());l.setSelection(ne.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},wh=(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 i=n.before();if(Yn(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let o=n.blockRange(),r=o&&_r(o);return r==null?!1:(e&&e(t.tr.lift(o,r).scrollIntoView()),!0)};function Ok(t){return(e,n)=>{let{$from:o,$to:r}=e.selection;if(e.selection instanceof oe&&e.selection.node.isBlock)return!o.parentOffset||!Yn(e.doc,o.pos)?!1:(n&&n(e.tr.split(o.pos).scrollIntoView()),!0);if(!o.depth)return!1;let i=[],s,l,c=!1,u=!1;for(let h=o.depth;;h--)if(o.node(h).isBlock){c=o.end(h)==o.pos+(o.depth-h),u=o.start(h)==o.pos-(o.depth-h),l=Nc(o.node(h-1).contentMatchAt(o.indexAfter(h-1))),i.unshift(c&&l?{type:l}:null),s=h;break}else{if(h==1)return!1;i.unshift(null)}let d=e.tr;(e.selection instanceof ne||e.selection instanceof Jt)&&d.deleteSelection();let p=d.mapping.map(o.pos),f=Yn(d.doc,p,i.length,i);if(f||(i[0]=l?{type:l}:null,f=Yn(d.doc,p,i.length,i)),d.split(p,i.length,i),!c&&u&&o.node(s).type!=l){let h=d.mapping.map(o.before(s)),m=d.doc.resolve(h);l&&o.node(s-1).canReplaceWith(m.index(),m.index()+1,l)&&d.setNodeMarkup(d.mapping.map(o.before(s)),l)}return n&&n(d.scrollIntoView()),!0}}const Mk=Ok(),Ak=(t,e)=>{let{$from:n,to:o}=t.selection,r,i=n.sharedDepth(o);return i==0?!1:(r=n.before(i),e&&e(t.tr.setSelection(oe.create(t.doc,r))),!0)};function Rk(t,e,n){let o=e.nodeBefore,r=e.nodeAfter,i=e.index();return!o||!r||!o.type.compatibleContent(r.type)?!1:!o.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-o.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(r.isTextblock||wo(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function Eh(t,e,n,o){let r=e.nodeBefore,i=e.nodeAfter,s,l,c=r.type.spec.isolating||i.type.spec.isolating;if(!c&&Rk(t,e,n))return!0;let u=!c&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(s=(l=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(n){let h=e.pos+i.nodeSize,m=A.empty;for(let y=s.length-1;y>=0;y--)m=A.from(s[y].create(null,m));m=A.from(r.copy(m));let g=t.tr.step(new ft(e.pos-1,h,e.pos,h,new V(m,1,0),s.length,!0)),b=g.doc.resolve(h+2*s.length);b.nodeAfter&&b.nodeAfter.type==r.type&&wo(g.doc,b.pos)&&g.join(b.pos),n(g.scrollIntoView())}return!0}let d=i.type.spec.isolating||o>0&&c?null:ae.findFrom(e,1),p=d&&d.$from.blockRange(d.$to),f=p&&_r(p);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(p,f).scrollIntoView()),!0;if(u&&hr(i,"start",!0)&&hr(r,"end")){let h=r,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let g=i,b=1;for(;!g.isTextblock;g=g.firstChild)b++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(n){let y=A.empty;for(let E=m.length-1;E>=0;E--)y=A.from(m[E].copy(y));let k=t.tr.step(new ft(e.pos-m.length,e.pos+i.nodeSize,e.pos+b,e.pos+i.nodeSize-b,new V(y,m.length,0),0,!0));n(k.scrollIntoView())}return!0}}return!1}function _h(t){return function(e,n){let o=e.selection,r=t<0?o.$from:o.$to,i=r.depth;for(;r.node(i).isInline;){if(!i)return!1;i--}return r.node(i).isTextblock?(n&&n(e.tr.setSelection(ne.create(e.doc,t<0?r.start(i):r.end(i)))),!0):!1}}const Bk=_h(-1),Dk=_h(1);function Ik(t,e=null){return function(n,o){let{$from:r,$to:i}=n.selection,s=r.blockRange(i),l=s&&dc(s,t,e);return l?(o&&o(n.tr.wrap(s,l).scrollIntoView()),!0):!1}}function Od(t,e=null){return function(n,o){let r=!1;for(let i=0;i<n.selection.ranges.length&&!r;i++){let{$from:{pos:s},$to:{pos:l}}=n.selection.ranges[i];n.doc.nodesBetween(s,l,(c,u)=>{if(r)return!1;if(!(!c.isTextblock||c.hasMarkup(t,e)))if(c.type==t)r=!0;else{let d=n.doc.resolve(u),p=d.index();r=d.parent.canReplaceWith(p,p+1,t)}})}if(!r)return!1;if(o){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:c}}=n.selection.ranges[s];i.setBlockType(l,c,t,e)}o(i.scrollIntoView())}return!0}}function Tc(...t){return function(e,n,o){for(let r=0;r<t.length;r++)if(t[r](e,n,o))return!0;return!1}}Tc(Cc,fh,mh);Tc(Cc,bh,yh);Tc(vh,kh,wh,Mk);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Lk(t,e=null){return function(n,o){let{$from:r,$to:i}=n.selection,s=r.blockRange(i);if(!s)return!1;let l=o?n.tr:null;return Pk(l,s,t,e)?(o&&o(l.scrollIntoView()),!0):!1}}function Pk(t,e,n,o=null){let r=!1,i=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 c=s.resolve(e.start-2);i=new gs(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new gs(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),r=!0}let l=dc(i,n,o,e);return l?(t&&$k(t,e,l,r,n),!0):!1}function $k(t,e,n,o,r){let i=A.empty;for(let d=n.length-1;d>=0;d--)i=A.from(n[d].type.create(n[d].attrs,i));t.step(new ft(e.start-(o?2:0),e.end,e.start,e.end,new V(i,0,0),n.length,!0));let s=0;for(let d=0;d<n.length;d++)n[d].type==r&&(s=d+1);let l=n.length-s,c=e.start+n.length-(o?2:0),u=e.parent;for(let d=e.startIndex,p=e.endIndex,f=!0;d<p;d++,f=!1)!f&&Yn(t.doc,c,l)&&(t.split(c,l),c+=2*l),c+=u.child(d).nodeSize;return t}function Fk(t){return function(e,n){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,s=>s.childCount>0&&s.firstChild.type==t);return i?n?o.node(i.depth-1).type==t?Vk(e,n,t,i):zk(e,n,i):!0:!1}}function Vk(t,e,n,o){let r=t.tr,i=o.end,s=o.$to.end(o.depth);i<s&&(r.step(new ft(i-1,s,i,s,new V(A.from(n.create(null,o.parent.copy())),1,0),1,!0)),o=new gs(r.doc.resolve(o.$from.pos),r.doc.resolve(s),o.depth));const l=_r(o);if(l==null)return!1;r.lift(o,l);let c=r.doc.resolve(r.mapping.map(i,-1)-1);return wo(r.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&r.join(c.pos),e(r.scrollIntoView()),!0}function zk(t,e,n){let o=t.tr,r=n.parent;for(let h=n.end,m=n.endIndex-1,g=n.startIndex;m>g;m--)h-=r.child(m).nodeSize,o.delete(h-1,h+1);let i=o.doc.resolve(n.start),s=i.nodeAfter;if(o.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,c=n.endIndex==r.childCount,u=i.node(-1),d=i.index(-1);if(!u.canReplace(d+(l?0:1),d+1,s.content.append(c?A.empty:A.from(r))))return!1;let p=i.pos,f=p+s.nodeSize;return o.step(new ft(p-(l?1:0),f+(c?1:0),p+1,f-1,new V((l?A.empty:A.from(r.copy(A.empty))).append(c?A.empty:A.from(r.copy(A.empty))),l?0:1,c?0:1),l?0:1)),e(o.scrollIntoView()),!0}function Hk(t){return function(e,n){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,u=>u.childCount>0&&u.firstChild.type==t);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,c=l.child(s-1);if(c.type!=t)return!1;if(n){let u=c.lastChild&&c.lastChild.type==l.type,d=A.from(u?t.create():null),p=new V(A.from(t.create(null,A.from(l.type.create(null,d)))),u?3:1,0),f=i.start,h=i.end;n(e.tr.step(new ft(f-(u?3:1),h,f,h,p,1,!0)).scrollIntoView())}return!0}}function pa(t){const{state:e,transaction:n}=t;let{selection:o}=n,{doc:r}=n,{storedMarks:i}=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 i},get selection(){return o},get doc(){return r},get tr(){return o=n.selection,r=n.doc,i=n.storedMarks,n}}}class fa{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:o}=this,{view:r}=n,{tr:i}=o,s=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([l,c])=>[l,(...d)=>{const p=c(...d)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),p}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:o,editor:r,state:i}=this,{view:s}=r,l=[],c=!!e,u=e||i.tr,d=()=>(!c&&n&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(u),l.every(f=>f===!0)),p={...Object.fromEntries(Object.entries(o).map(([f,h])=>[f,(...g)=>{const b=this.buildProps(u,n),y=h(...g)(b);return l.push(y),p}])),run:d};return p}createCan(e){const{rawCommands:n,state:o}=this,r=!1,i=e||o.tr,s=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(n).map(([c,u])=>[c,(...d)=>u(...d)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(e,n=!0){const{rawCommands:o,editor:r,state:i}=this,{view:s}=r,l={tr:e,editor:r,view:s,state:pa({state:i,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(o).map(([c,u])=>[c,(...d)=>u(...d)(l)]))}};return l}}class Uk{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const o=this.callbacks[e];return o&&o.forEach(r=>r.apply(this,n)),this}off(e,n){const o=this.callbacks[e];return o&&(n?this.callbacks[e]=o.filter(r=>r!==n):delete this.callbacks[e]),this}once(e,n){const o=(...r)=>{this.off(e,o),n.apply(this,r)};return this.on(e,o)}removeAllListeners(){this.callbacks={}}}function j(t,e,n){return t.config[e]===void 0&&t.parent?j(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?j(t.parent,e,n):null}):t.config[e]}function ha(t){const e=t.filter(r=>r.type==="extension"),n=t.filter(r=>r.type==="node"),o=t.filter(r=>r.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:o}}function Ch(t){const e=[],{nodeExtensions:n,markExtensions:o}=ha(t),r=[...n,...o],i={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage,extensions:r},c=j(s,"addGlobalAttributes",l);if(!c)return;c().forEach(d=>{d.types.forEach(p=>{Object.entries(d.attributes).forEach(([f,h])=>{e.push({type:p,name:f,attribute:{...i,...h}})})})})}),r.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage},c=j(s,"addAttributes",l);if(!c)return;const u=c();Object.entries(u).forEach(([d,p])=>{const f={...i,...p};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:d,attribute:f})})}),e}function mt(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 _e(...t){return t.filter(e=>!!e).reduce((e,n)=>{const o={...e};return Object.entries(n).forEach(([r,i])=>{if(!o[r]){o[r]=i;return}if(r==="class"){const l=i?String(i).split(" "):[],c=o[r]?o[r].split(" "):[],u=l.filter(d=>!c.includes(d));o[r]=[...c,...u].join(" ")}else if(r==="style"){const l=i?i.split(";").map(d=>d.trim()).filter(Boolean):[],c=o[r]?o[r].split(";").map(d=>d.trim()).filter(Boolean):[],u=new Map;c.forEach(d=>{const[p,f]=d.split(":").map(h=>h.trim());u.set(p,f)}),l.forEach(d=>{const[p,f]=d.split(":").map(h=>h.trim());u.set(p,f)}),o[r]=Array.from(u.entries()).map(([d,p])=>`${d}: ${p}`).join("; ")}else o[r]=i}),o},{})}function Ll(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,o)=>_e(n,o),{})}function Sh(t){return typeof t=="function"}function ve(t,e=void 0,...n){return Sh(t)?e?t.bind(e)(...n):t(...n):t}function qk(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Kk(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Md(t,e){return"style"in t?t:{...t,getAttrs:n=>{const o=t.getAttrs?t.getAttrs(n):t.attrs;if(o===!1)return!1;const r=e.reduce((i,s)=>{const l=s.attribute.parseHTML?s.attribute.parseHTML(n):Kk(n.getAttribute(s.name));return l==null?i:{...i,[s.name]:l}},{});return{...o,...r}}}}function Ad(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&qk(n)?!1:n!=null))}function xh(t,e){var n;const o=Ch(t),{nodeExtensions:r,markExtensions:i}=ha(t),s=(n=r.find(u=>j(u,"topNode")))===null||n===void 0?void 0:n.name,l=Object.fromEntries(r.map(u=>{const d=o.filter(y=>y.type===u.name),p={name:u.name,options:u.options,storage:u.storage,editor:e},f=t.reduce((y,k)=>{const E=j(k,"extendNodeSchema",p);return{...y,...E?E(u):{}}},{}),h=Ad({...f,content:ve(j(u,"content",p)),marks:ve(j(u,"marks",p)),group:ve(j(u,"group",p)),inline:ve(j(u,"inline",p)),atom:ve(j(u,"atom",p)),selectable:ve(j(u,"selectable",p)),draggable:ve(j(u,"draggable",p)),code:ve(j(u,"code",p)),whitespace:ve(j(u,"whitespace",p)),linebreakReplacement:ve(j(u,"linebreakReplacement",p)),defining:ve(j(u,"defining",p)),isolating:ve(j(u,"isolating",p)),attrs:Object.fromEntries(d.map(y=>{var k;return[y.name,{default:(k=y==null?void 0:y.attribute)===null||k===void 0?void 0:k.default}]}))}),m=ve(j(u,"parseHTML",p));m&&(h.parseDOM=m.map(y=>Md(y,d)));const g=j(u,"renderHTML",p);g&&(h.toDOM=y=>g({node:y,HTMLAttributes:Ll(y,d)}));const b=j(u,"renderText",p);return b&&(h.toText=b),[u.name,h]})),c=Object.fromEntries(i.map(u=>{const d=o.filter(b=>b.type===u.name),p={name:u.name,options:u.options,storage:u.storage,editor:e},f=t.reduce((b,y)=>{const k=j(y,"extendMarkSchema",p);return{...b,...k?k(u):{}}},{}),h=Ad({...f,inclusive:ve(j(u,"inclusive",p)),excludes:ve(j(u,"excludes",p)),group:ve(j(u,"group",p)),spanning:ve(j(u,"spanning",p)),code:ve(j(u,"code",p)),attrs:Object.fromEntries(d.map(b=>{var y;return[b.name,{default:(y=b==null?void 0:b.attribute)===null||y===void 0?void 0:y.default}]}))}),m=ve(j(u,"parseHTML",p));m&&(h.parseDOM=m.map(b=>Md(b,d)));const g=j(u,"renderHTML",p);return g&&(h.toDOM=b=>g({mark:b,HTMLAttributes:Ll(b,d)})),[u.name,h]}));return new hf({topNode:s,nodes:l,marks:c})}function Xa(t,e){return e.nodes[t]||e.marks[t]||null}function Rd(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Oc(t,e){const n=Yo.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}const Wk=(t,e=500)=>{let n="";const o=t.parentOffset;return t.parent.nodesBetween(Math.max(0,o-e),o,(r,i,s,l)=>{var c,u;const d=((u=(c=r.type.spec).toText)===null||u===void 0?void 0:u.call(c,{node:r,pos:i,parent:s,index:l}))||r.textContent||"%leaf%";n+=r.isAtom&&!r.isText?d:d.slice(0,Math.max(0,o-i))}),n};function Mc(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class _i{constructor(e){this.find=e.find,this.handler=e.handler}}const jk=(t,e)=>{if(Mc(e))return e.exec(t);const n=e(t);if(!n)return null;const o=[n.text];return o.index=n.index,o.input=t,o.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),o.push(n.replaceWith)),o};function Di(t){var e;const{editor:n,from:o,to:r,text:i,rules:s,plugin:l}=t,{view:c}=n;if(c.composing)return!1;const u=c.state.doc.resolve(o);if(u.parent.type.spec.code||!((e=u.nodeBefore||u.nodeAfter)===null||e===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let d=!1;const p=Wk(u)+i;return s.forEach(f=>{if(d)return;const h=jk(p,f.find);if(!h)return;const m=c.state.tr,g=pa({state:c.state,transaction:m}),b={from:o-(h[0].length-i.length),to:r},{commands:y,chain:k,can:E}=new fa({editor:n,state:g});f.handler({state:g,range:b,match:h,commands:y,chain:k,can:E})===null||!m.steps.length||(m.setMeta(l,{transform:m,from:o,to:r,text:i}),c.dispatch(m),d=!0)}),d}function Gk(t){const{editor:e,rules:n}=t,o=new Ae({state:{init(){return null},apply(r,i,s){const l=r.getMeta(o);if(l)return l;const c=r.getMeta("applyInputRules");return!!c&&setTimeout(()=>{let{text:d}=c;typeof d=="string"?d=d:d=Oc(A.from(d),s.schema);const{from:p}=c,f=p+d.length;Di({editor:e,from:p,to:f,text:d,rules:n,plugin:o})}),r.selectionSet||r.docChanged?null:i}},props:{handleTextInput(r,i,s,l){return Di({editor:e,from:i,to:s,text:l,rules:n,plugin:o})},handleDOMEvents:{compositionend:r=>(setTimeout(()=>{const{$cursor:i}=r.state.selection;i&&Di({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:o})}),!1)},handleKeyDown(r,i){if(i.key!=="Enter")return!1;const{$cursor:s}=r.state.selection;return s?Di({editor:e,from:s.pos,to:s.pos,text:`
14
+ `,rules:n,plugin:o}):!1}},isInputRules:!0});return o}function Yk(t){return Object.prototype.toString.call(t).slice(8,-1)}function Ii(t){return Yk(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function ma(t,e){const n={...t};return Ii(t)&&Ii(e)&&Object.keys(e).forEach(o=>{Ii(e[o])&&Ii(t[o])?n[o]=ma(t[o],e[o]):n[o]=e[o]}),n}class ln{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=ve(j(this,"addOptions",{name:this.name}))),this.storage=ve(j(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new ln(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>ma(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new ln(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=ve(j(n,"addOptions",{name:n.name})),n.storage=ve(j(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){const{tr:o}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){const s=r.marks();if(!!!s.find(u=>(u==null?void 0:u.type.name)===n.name))return!1;const c=s.find(u=>(u==null?void 0:u.type.name)===n.name);return c&&o.removeStoredMark(c),o.insertText(" ",r.pos),e.view.dispatch(o),!0}return!1}}function Jk(t){return typeof t=="number"}class Xk{constructor(e){this.find=e.find,this.handler=e.handler}}const Zk=(t,e,n)=>{if(Mc(e))return[...t.matchAll(e)];const o=e(t,n);return o?o.map(r=>{const i=[r.text];return i.index=r.index,i.input=t,i.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(r.replaceWith)),i}):[]};function Qk(t){const{editor:e,state:n,from:o,to:r,rule:i,pasteEvent:s,dropEvent:l}=t,{commands:c,chain:u,can:d}=new fa({editor:e,state:n}),p=[];return n.doc.nodesBetween(o,r,(h,m)=>{if(!h.isTextblock||h.type.spec.code)return;const g=Math.max(o,m),b=Math.min(r,m+h.content.size),y=h.textBetween(g-m,b-m,void 0,"");Zk(y,i.find,s).forEach(E=>{if(E.index===void 0)return;const v=g+E.index+1,C=v+E[0].length,_={from:n.tr.mapping.map(v),to:n.tr.mapping.map(C)},R=i.handler({state:n,range:_,match:E,commands:c,chain:u,can:d,pasteEvent:s,dropEvent:l});p.push(R)})}),p.every(h=>h!==null)}let Li=null;const ew=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 tw(t){const{editor:e,rules:n}=t;let o=null,r=!1,i=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const c=({state:d,from:p,to:f,rule:h,pasteEvt:m})=>{const g=d.tr,b=pa({state:d,transaction:g});if(!(!Qk({editor:e,state:b,from:Math.max(p-1,0),to:f.b-1,rule:h,pasteEvent:m,dropEvent:l})||!g.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return n.map(d=>new Ae({view(p){const f=m=>{var g;o=!((g=p.dom.parentElement)===null||g===void 0)&&g.contains(m.target)?p.dom.parentElement:null,o&&(Li=e)},h=()=>{Li&&(Li=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(p,f)=>{if(i=o===p.dom.parentElement,l=f,!i){const h=Li;h&&setTimeout(()=>{const m=h.state.selection;m&&h.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(p,f)=>{var h;const m=(h=f.clipboardData)===null||h===void 0?void 0:h.getData("text/html");return s=f,r=!!(m!=null&&m.includes("data-pm-slice")),!1}}},appendTransaction:(p,f,h)=>{const m=p[0],g=m.getMeta("uiEvent")==="paste"&&!r,b=m.getMeta("uiEvent")==="drop"&&!i,y=m.getMeta("applyPasteRules"),k=!!y;if(!g&&!b&&!k)return;if(k){let{text:C}=y;typeof C=="string"?C=C:C=Oc(A.from(C),h.schema);const{from:_}=y,R=_+C.length,B=ew(C);return c({rule:d,state:h,from:_,to:{b:R},pasteEvt:B})}const E=f.doc.content.findDiffStart(h.doc.content),v=f.doc.content.findDiffEnd(h.doc.content);if(!(!Jk(E)||!v||E===v.b))return c({rule:d,state:h,from:E,to:v,pasteEvt:s})}}))}function nw(t){const e=t.filter((n,o)=>t.indexOf(n)!==o);return Array.from(new Set(e))}class Bo{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=Bo.resolve(e),this.schema=xh(this.extensions,n),this.setupExtensions()}static resolve(e){const n=Bo.sort(Bo.flatten(e)),o=nw(n.map(r=>r.name));return o.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${o.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{const o={name:n.name,options:n.options,storage:n.storage},r=j(n,"addExtensions",o);return r?[n,...this.flatten(r())]:n}).flat(10)}static sort(e){return e.sort((o,r)=>{const i=j(o,"priority")||100,s=j(r,"priority")||100;return i>s?-1:i<s?1:0})}get commands(){return this.extensions.reduce((e,n)=>{const o={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:Xa(n.name,this.schema)},r=j(n,"addCommands",o);return r?{...e,...r()}:e},{})}get plugins(){const{editor:e}=this,n=Bo.sort([...this.extensions].reverse()),o=[],r=[],i=n.map(s=>{const l={name:s.name,options:s.options,storage:s.storage,editor:e,type:Xa(s.name,this.schema)},c=[],u=j(s,"addKeyboardShortcuts",l);let d={};if(s.type==="mark"&&j(s,"exitable",l)&&(d.ArrowRight=()=>ln.handleExit({editor:e,mark:s})),u){const g=Object.fromEntries(Object.entries(u()).map(([b,y])=>[b,()=>y({editor:e})]));d={...d,...g}}const p=Ek(d);c.push(p);const f=j(s,"addInputRules",l);Rd(s,e.options.enableInputRules)&&f&&o.push(...f());const h=j(s,"addPasteRules",l);Rd(s,e.options.enablePasteRules)&&h&&r.push(...h());const m=j(s,"addProseMirrorPlugins",l);if(m){const g=m();c.push(...g)}return c}).flat();return[Gk({editor:e,rules:o}),...tw({editor:e,rules:r}),...i]}get attributes(){return Ch(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=ha(this.extensions);return Object.fromEntries(n.filter(o=>!!j(o,"addNodeView")).map(o=>{const r=this.attributes.filter(c=>c.type===o.name),i={name:o.name,options:o.options,storage:o.storage,editor:e,type:mt(o.name,this.schema)},s=j(o,"addNodeView",i);if(!s)return[];const l=(c,u,d,p,f)=>{const h=Ll(c,r);return s()({node:c,view:u,getPos:d,decorations:p,innerDecorations:f,editor:e,extension:o,HTMLAttributes:h})};return[o.name,l]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;const o={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:Xa(e.name,this.schema)};e.type==="mark"&&(!((n=ve(j(e,"keepOnSplit",o)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const r=j(e,"onBeforeCreate",o),i=j(e,"onCreate",o),s=j(e,"onUpdate",o),l=j(e,"onSelectionUpdate",o),c=j(e,"onTransaction",o),u=j(e,"onFocus",o),d=j(e,"onBlur",o),p=j(e,"onDestroy",o);r&&this.editor.on("beforeCreate",r),i&&this.editor.on("create",i),s&&this.editor.on("update",s),l&&this.editor.on("selectionUpdate",l),c&&this.editor.on("transaction",c),u&&this.editor.on("focus",u),d&&this.editor.on("blur",d),p&&this.editor.on("destroy",p)})}}class De{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=ve(j(this,"addOptions",{name:this.name}))),this.storage=ve(j(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new De(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>ma(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new De({...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=ve(j(n,"addOptions",{name:n.name})),n.storage=ve(j(n,"addStorage",{name:n.name,options:n.options})),n}}function Nh(t,e,n){const{from:o,to:r}=e,{blockSeparator:i=`
15
+
16
+ `,textSerializers:s={}}=n||{};let l="";return t.nodesBetween(o,r,(c,u,d,p)=>{var f;c.isBlock&&u>o&&(l+=i);const h=s==null?void 0:s[c.type.name];if(h)return d&&(l+=h({node:c,pos:u,parent:d,index:p,range:e})),!1;c.isText&&(l+=(f=c==null?void 0:c.text)===null||f===void 0?void 0:f.slice(Math.max(o,u)-u,r-u))}),l}function Ac(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const ow=De.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ae({key:new xe("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:o,selection:r}=e,{ranges:i}=r,s=Math.min(...i.map(d=>d.$from.pos)),l=Math.max(...i.map(d=>d.$to.pos)),c=Ac(n);return Nh(o,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),rw=()=>({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),iw=(t=!1)=>({commands:e})=>e.setContent("",t),sw=()=>({state:t,tr:e,dispatch:n})=>{const{selection:o}=e,{ranges:r}=o;return n&&r.forEach(({$from:i,$to:s})=>{t.doc.nodesBetween(i.pos,s.pos,(l,c)=>{if(l.type.isText)return;const{doc:u,mapping:d}=e,p=u.resolve(d.map(c)),f=u.resolve(d.map(c+l.nodeSize)),h=p.blockRange(f);if(!h)return;const m=_r(h);if(l.type.isTextblock){const{defaultType:g}=p.parent.contentMatchAt(p.index());e.setNodeMarkup(h.start,g)}(m||m===0)&&e.lift(h,m)})}),!0},aw=t=>e=>t(e),lw=()=>({state:t,dispatch:e})=>kh(t,e),cw=(t,e)=>({editor:n,tr:o})=>{const{state:r}=n,i=r.doc.slice(t.from,t.to);o.deleteRange(t.from,t.to);const s=o.mapping.map(e);return o.insert(s,i.content),o.setSelection(new ne(o.doc.resolve(s-1))),!0},uw=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,o=n.$anchor.node();if(o.content.size>0)return!1;const r=t.selection.$anchor;for(let i=r.depth;i>0;i-=1)if(r.node(i).type===o.type){if(e){const l=r.before(i),c=r.after(i);t.delete(l,c).scrollIntoView()}return!0}return!1},dw=t=>({tr:e,state:n,dispatch:o})=>{const r=mt(t,n.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r){if(o){const c=i.before(s),u=i.after(s);e.delete(c,u).scrollIntoView()}return!0}return!1},pw=t=>({tr:e,dispatch:n})=>{const{from:o,to:r}=t;return n&&e.delete(o,r),!0},fw=()=>({state:t,dispatch:e})=>Cc(t,e),hw=()=>({commands:t})=>t.keyboardShortcut("Enter"),mw=()=>({state:t,dispatch:e})=>Tk(t,e);function Cs(t,e,n={strict:!0}){const o=Object.keys(e);return o.length?o.every(r=>n.strict?e[r]===t[r]:Mc(e[r])?e[r].test(t[r]):e[r]===t[r]):!0}function Th(t,e,n={}){return t.find(o=>o.type===e&&Cs(Object.fromEntries(Object.keys(n).map(r=>[r,o.attrs[r]])),n))}function Bd(t,e,n={}){return!!Th(t,e,n)}function Cr(t,e,n){var o;if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(d=>d.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(d=>d.type===e)||(n=n||((o=r.node.marks[0])===null||o===void 0?void 0:o.attrs),!Th([...r.node.marks],e,n)))return;let s=r.index,l=t.start()+r.offset,c=s+1,u=l+r.node.nodeSize;for(;s>0&&Bd([...t.parent.child(s-1).marks],e,n);)s-=1,l-=t.parent.child(s).nodeSize;for(;c<t.parent.childCount&&Bd([...t.parent.child(c).marks],e,n);)u+=t.parent.child(c).nodeSize,c+=1;return{from:l,to:u}}function _o(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 gw=(t,e={})=>({tr:n,state:o,dispatch:r})=>{const i=_o(t,o.schema),{doc:s,selection:l}=n,{$from:c,from:u,to:d}=l;if(r){const p=Cr(c,i,e);if(p&&p.from<=u&&p.to>=d){const f=ne.create(s,p.from,p.to);n.setSelection(f)}}return!0},bw=t=>e=>{const n=typeof t=="function"?t(e):t;for(let o=0;o<n.length;o+=1)if(n[o](e))return!0;return!1};function ga(t){return t instanceof ne}function Gn(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Oh(t,e=null){if(!e)return null;const n=ae.atStart(t),o=ae.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return o;const r=n.from,i=o.to;return e==="all"?ne.create(t,Gn(0,r,i),Gn(t.content.size,r,i)):ne.create(t,Gn(e,r,i),Gn(e,r,i))}function Mh(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function ba(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const yw=(t=null,e={})=>({editor:n,view:o,tr:r,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{(ba()||Mh())&&o.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(o.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};if(o.hasFocus()&&t===null||t===!1)return!0;if(i&&t===null&&!ga(n.state.selection))return s(),!0;const l=Oh(r.doc,t)||n.state.selection,c=n.state.selection.eq(l);return i&&(c||r.setSelection(l),c&&r.storedMarks&&r.setStoredMarks(r.storedMarks),s()),!0},vw=(t,e)=>n=>t.every((o,r)=>e(o,{...n,index:r})),kw=(t,e)=>({tr:n,commands:o})=>o.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),Ah=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const o=e[n];o.nodeType===3&&o.nodeValue&&/^(\n\s\s|\n)$/.test(o.nodeValue)?t.removeChild(o):o.nodeType===1&&Ah(o)}return t};function Fr(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return Ah(n)}function Ss(t,e,n){if(t instanceof An||t instanceof A)return t;n={slice:!0,parseOptions:{},...n};const o=typeof t=="object"&&t!==null,r=typeof t=="string";if(o)try{if(Array.isArray(t)&&t.length>0)return A.fromArray(t.map(l=>e.nodeFromJSON(l)));const s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),Ss("",e,n)}if(r){if(n.errorOnInvalidContent){let s=!1,l="";const c=new hf({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:u=>(s=!0,l=typeof u=="string"?u:u.outerHTML,null)}]}})});if(n.slice?lr.fromSchema(c).parseSlice(Fr(t),n.parseOptions):lr.fromSchema(c).parse(Fr(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=lr.fromSchema(e);return n.slice?i.parseSlice(Fr(t),n.parseOptions).content:i.parse(Fr(t),n.parseOptions)}return Ss("",e,n)}function ww(t,e,n){const o=t.steps.length-1;if(o<e)return;const r=t.steps[o];if(!(r instanceof pt||r instanceof ft))return;const i=t.mapping.maps[o];let s=0;i.forEach((l,c,u,d)=>{s===0&&(s=d)}),t.setSelection(ae.near(t.doc.resolve(s),n))}const Ew=t=>!("type"in t),_w=(t,e,n)=>({tr:o,dispatch:r,editor:i})=>{var s;if(r){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;try{l=Ss(e,i.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions},errorOnInvalidContent:(s=n.errorOnInvalidContent)!==null&&s!==void 0?s:i.options.enableContentCheck})}catch(m){return i.emit("contentError",{editor:i,error:m,disableCollaboration:()=>{i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}}),!1}let{from:c,to:u}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},d=!0,p=!0;if((Ew(l)?l:[l]).forEach(m=>{m.check(),d=d?m.isText&&m.marks.length===0:!1,p=p?m.isBlock:!1}),c===u&&p){const{parent:m}=o.doc.resolve(c);m.isTextblock&&!m.type.spec.code&&!m.childCount&&(c-=1,u+=1)}let h;if(d){if(Array.isArray(e))h=e.map(m=>m.text||"").join("");else if(e instanceof A){let m="";e.forEach(g=>{g.text&&(m+=g.text)}),h=m}else typeof e=="object"&&e&&e.text?h=e.text:h=e;o.insertText(h,c,u)}else h=l,o.replaceWith(c,u,h);n.updateSelection&&ww(o,o.steps.length-1,-1),n.applyInputRules&&o.setMeta("applyInputRules",{from:c,text:h}),n.applyPasteRules&&o.setMeta("applyPasteRules",{from:c,text:h})}return!0},Cw=()=>({state:t,dispatch:e})=>Sk(t,e),Sw=()=>({state:t,dispatch:e})=>xk(t,e),xw=()=>({state:t,dispatch:e})=>fh(t,e),Nw=()=>({state:t,dispatch:e})=>bh(t,e),Tw=()=>({state:t,dispatch:e,tr:n})=>{try{const o=sa(t.doc,t.selection.$from.pos,-1);return o==null?!1:(n.join(o,2),e&&e(n),!0)}catch{return!1}},Ow=()=>({state:t,dispatch:e,tr:n})=>{try{const o=sa(t.doc,t.selection.$from.pos,1);return o==null?!1:(n.join(o,2),e&&e(n),!0)}catch{return!1}},Mw=()=>({state:t,dispatch:e})=>_k(t,e),Aw=()=>({state:t,dispatch:e})=>Ck(t,e);function Rh(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Rw(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let o,r,i,s;for(let l=0;l<e.length-1;l+=1){const c=e[l];if(/^(cmd|meta|m)$/i.test(c))s=!0;else if(/^a(lt)?$/i.test(c))o=!0;else if(/^(c|ctrl|control)$/i.test(c))r=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))ba()||Rh()?s=!0:r=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return o&&(n=`Alt-${n}`),r&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}const Bw=t=>({editor:e,view:n,tr:o,dispatch:r})=>{const i=Rw(t).split(/-(?!$)/),s=i.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{n.someProp("handleKeyDown",u=>u(n,l))});return c==null||c.steps.forEach(u=>{const d=u.map(o.mapping);d&&r&&o.maybeStep(d)}),!0};function ci(t,e,n={}){const{from:o,to:r,empty:i}=t.selection,s=e?mt(e,t.schema):null,l=[];t.doc.nodesBetween(o,r,(p,f)=>{if(p.isText)return;const h=Math.max(o,f),m=Math.min(r,f+p.nodeSize);l.push({node:p,from:h,to:m})});const c=r-o,u=l.filter(p=>s?s.name===p.node.type.name:!0).filter(p=>Cs(p.node.attrs,n,{strict:!1}));return i?!!u.length:u.reduce((p,f)=>p+f.to-f.from,0)>=c}const Dw=(t,e={})=>({state:n,dispatch:o})=>{const r=mt(t,n.schema);return ci(n,r,e)?Nk(n,o):!1},Iw=()=>({state:t,dispatch:e})=>wh(t,e),Lw=t=>({state:e,dispatch:n})=>{const o=mt(t,e.schema);return Fk(o)(e,n)},Pw=()=>({state:t,dispatch:e})=>vh(t,e);function ya(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Dd(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((o,r)=>(n.includes(r)||(o[r]=t[r]),o),{})}const $w=(t,e)=>({tr:n,state:o,dispatch:r})=>{let i=null,s=null;const l=ya(typeof t=="string"?t:t.name,o.schema);return l?(l==="node"&&(i=mt(t,o.schema)),l==="mark"&&(s=_o(t,o.schema)),r&&n.selection.ranges.forEach(c=>{o.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,d)=>{i&&i===u.type&&n.setNodeMarkup(d,void 0,Dd(u.attrs,e)),s&&u.marks.length&&u.marks.forEach(p=>{s===p.type&&n.addMark(d,d+u.nodeSize,s.create(Dd(p.attrs,e)))})})}),!0):!1},Fw=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),Vw=()=>({tr:t,dispatch:e})=>{if(e){const n=new Jt(t.doc);t.setSelection(n)}return!0},zw=()=>({state:t,dispatch:e})=>mh(t,e),Hw=()=>({state:t,dispatch:e})=>yh(t,e),Uw=()=>({state:t,dispatch:e})=>Ak(t,e),qw=()=>({state:t,dispatch:e})=>Dk(t,e),Kw=()=>({state:t,dispatch:e})=>Bk(t,e);function Pl(t,e,n={},o={}){return Ss(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:o.errorOnInvalidContent})}const Ww=(t,e=!1,n={},o={})=>({editor:r,tr:i,dispatch:s,commands:l})=>{var c,u;const{doc:d}=i;if(n.preserveWhitespace!=="full"){const p=Pl(t,r.schema,n,{errorOnInvalidContent:(c=o.errorOnInvalidContent)!==null&&c!==void 0?c:r.options.enableContentCheck});return s&&i.replaceWith(0,d.content.size,p).setMeta("preventUpdate",!e),!0}return s&&i.setMeta("preventUpdate",!e),l.insertContentAt({from:0,to:d.content.size},t,{parseOptions:n,errorOnInvalidContent:(u=o.errorOnInvalidContent)!==null&&u!==void 0?u:r.options.enableContentCheck})};function Bh(t,e){const n=_o(e,t.schema),{from:o,to:r,empty:i}=t.selection,s=[];i?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(o,r,c=>{s.push(...c.marks)});const l=s.find(c=>c.type.name===n.name);return l?{...l.attrs}:{}}function jw(t,e){const n=new pc(t);return e.forEach(o=>{o.steps.forEach(r=>{n.step(r)})}),n}function Gw(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 $l(t,e){const n=[];return t.descendants((o,r)=>{e(o)&&n.push({node:o,pos:r})}),n}function Yw(t,e,n){const o=[];return t.nodesBetween(e.from,e.to,(r,i)=>{n(r)&&o.push({node:r,pos:i})}),o}function Dh(t,e){for(let n=t.depth;n>0;n-=1){const o=t.node(n);if(e(o))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:o}}}function Rc(t){return e=>Dh(e.$from,t)}function Jw(t,e){const n=Bo.resolve(t);return xh(n,e)}function Xw(t,e){const n=Jw(e),o=Fr(t);return lr.fromSchema(n).parse(o).toJSON()}function Ih(t,e){const n={from:0,to:t.content.size};return Nh(t,n,e)}function Zw(t,e){const n=mt(e,t.schema),{from:o,to:r}=t.selection,i=[];t.doc.nodesBetween(o,r,l=>{i.push(l)});const s=i.reverse().find(l=>l.type.name===n.name);return s?{...s.attrs}:{}}function Lh(t,e){const n=ya(typeof e=="string"?e:e.name,t.schema);return n==="node"?Zw(t,e):n==="mark"?Bh(t,e):{}}function Qw(t,e=JSON.stringify){const n={};return t.filter(o=>{const r=e(o);return Object.prototype.hasOwnProperty.call(n,r)?!1:n[r]=!0})}function eE(t){const e=Qw(t);return e.length===1?e:e.filter((n,o)=>!e.filter((i,s)=>s!==o).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function tE(t){const{mapping:e,steps:n}=t,o=[];return e.maps.forEach((r,i)=>{const s=[];if(r.ranges.length)r.forEach((l,c)=>{s.push({from:l,to:c})});else{const{from:l,to:c}=n[i];if(l===void 0||c===void 0)return;s.push({from:l,to:c})}s.forEach(({from:l,to:c})=>{const u=e.slice(i).map(l,-1),d=e.slice(i).map(c),p=e.invert().map(u,-1),f=e.invert().map(d);o.push({oldRange:{from:p,to:f},newRange:{from:u,to:d}})})}),eE(o)}function Bc(t,e,n){const o=[];return t===e?n.resolve(t).marks().forEach(r=>{const i=n.resolve(t),s=Cr(i,r.type);s&&o.push({mark:r,...s})}):n.nodesBetween(t,e,(r,i)=>{!r||(r==null?void 0:r.nodeSize)===void 0||o.push(...r.marks.map(s=>({from:i,to:i+r.nodeSize,mark:s})))}),o}function ss(t,e,n){return Object.fromEntries(Object.entries(n).filter(([o])=>{const r=t.find(i=>i.type===e&&i.name===o);return r?r.attribute.keepOnSplit:!1}))}function Fl(t,e,n={}){const{empty:o,ranges:r}=t.selection,i=e?_o(e,t.schema):null;if(o)return!!(t.storedMarks||t.selection.$from.marks()).filter(p=>i?i.name===p.type.name:!0).find(p=>Cs(p.attrs,n,{strict:!1}));let s=0;const l=[];if(r.forEach(({$from:p,$to:f})=>{const h=p.pos,m=f.pos;t.doc.nodesBetween(h,m,(g,b)=>{if(!g.isText&&!g.marks.length)return;const y=Math.max(h,b),k=Math.min(m,b+g.nodeSize),E=k-y;s+=E,l.push(...g.marks.map(v=>({mark:v,from:y,to:k})))})}),s===0)return!1;const c=l.filter(p=>i?i.name===p.mark.type.name:!0).filter(p=>Cs(p.mark.attrs,n,{strict:!1})).reduce((p,f)=>p+f.to-f.from,0),u=l.filter(p=>i?p.mark.type!==i&&p.mark.type.excludes(i):!0).reduce((p,f)=>p+f.to-f.from,0);return(c>0?c+u:c)>=s}function nE(t,e,n={}){if(!e)return ci(t,null,n)||Fl(t,null,n);const o=ya(e,t.schema);return o==="node"?ci(t,e,n):o==="mark"?Fl(t,e,n):!1}function Id(t,e){const{nodeExtensions:n}=ha(e),o=n.find(s=>s.name===t);if(!o)return!1;const r={name:o.name,options:o.options,storage:o.storage},i=ve(j(o,"group",r));return typeof i!="string"?!1:i.split(" ").includes("list")}function Dc(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var o;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((o=t.text)!==null&&o!==void 0?o:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let r=!0;return t.content.forEach(i=>{r!==!1&&(Dc(i,{ignoreWhitespace:n,checkChildren:e})||(r=!1))}),r}return!1}function Ph(t){return t instanceof oe}function $h(t,e,n){const r=t.state.doc.content.size,i=Gn(e,0,r),s=Gn(n,0,r),l=t.coordsAtPos(i),c=t.coordsAtPos(s,-1),u=Math.min(l.top,c.top),d=Math.max(l.bottom,c.bottom),p=Math.min(l.left,c.left),f=Math.max(l.right,c.right),h=f-p,m=d-u,y={top:u,bottom:d,left:p,right:f,width:h,height:m,x:p,y:u};return{...y,toJSON:()=>y}}function oE(t,e,n){var o;const{selection:r}=e;let i=null;if(ga(r)&&(i=r.$cursor),i){const l=(o=t.storedMarks)!==null&&o!==void 0?o:i.marks();return!!n.isInSet(l)||!l.some(c=>c.type.excludes(n))}const{ranges:s}=r;return s.some(({$from:l,$to:c})=>{let u=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,c.pos,(d,p,f)=>{if(u)return!1;if(d.isInline){const h=!f||f.type.allowsMarkType(n),m=!!n.isInSet(d.marks)||!d.marks.some(g=>g.type.excludes(n));u=h&&m}return!u}),u})}const rE=(t,e={})=>({tr:n,state:o,dispatch:r})=>{const{selection:i}=n,{empty:s,ranges:l}=i,c=_o(t,o.schema);if(r)if(s){const u=Bh(o,c);n.addStoredMark(c.create({...u,...e}))}else l.forEach(u=>{const d=u.$from.pos,p=u.$to.pos;o.doc.nodesBetween(d,p,(f,h)=>{const m=Math.max(h,d),g=Math.min(h+f.nodeSize,p);f.marks.find(y=>y.type===c)?f.marks.forEach(y=>{c===y.type&&n.addMark(m,g,c.create({...y.attrs,...e}))}):n.addMark(m,g,c.create(e))})});return oE(o,n,c)},iE=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),sE=(t,e={})=>({state:n,dispatch:o,chain:r})=>{const i=mt(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?r().command(({commands:l})=>Od(i,{...s,...e})(n)?!0:l.clearNodes()).command(({state:l})=>Od(i,{...s,...e})(l,o)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},aE=t=>({tr:e,dispatch:n})=>{if(n){const{doc:o}=e,r=Gn(t,0,o.content.size),i=oe.create(o,r);e.setSelection(i)}return!0},lE=t=>({tr:e,dispatch:n})=>{if(n){const{doc:o}=e,{from:r,to:i}=typeof t=="number"?{from:t,to:t}:t,s=ne.atStart(o).from,l=ne.atEnd(o).to,c=Gn(r,s,l),u=Gn(i,s,l),d=ne.create(o,c,u);e.setSelection(d)}return!0},cE=t=>({state:e,dispatch:n})=>{const o=mt(t,e.schema);return Hk(o)(e,n)};function Ld(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const o=n.filter(r=>e==null?void 0:e.includes(r.type.name));t.tr.ensureMarks(o)}}const uE=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:o,editor:r})=>{const{selection:i,doc:s}=e,{$from:l,$to:c}=i,u=r.extensionManager.attributes,d=ss(u,l.node().type.name,l.node().attrs);if(i instanceof oe&&i.node.isBlock)return!l.parentOffset||!Yn(s,l.pos)?!1:(o&&(t&&Ld(n,r.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const p=c.parentOffset===c.parent.content.size,f=l.depth===0?void 0:Gw(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=p&&f?[{type:f,attrs:d}]:void 0,m=Yn(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!m&&Yn(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(m=!0,h=f?[{type:f,attrs:d}]:void 0),o){if(m&&(i instanceof ne&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),f&&!p&&!l.parentOffset&&l.parent.type!==f)){const g=e.mapping.map(l.before()),b=e.doc.resolve(g);l.node(-1).canReplaceWith(b.index(),b.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}t&&Ld(n,r.extensionManager.splittableMarks),e.scrollIntoView()}return m},dE=(t,e={})=>({tr:n,state:o,dispatch:r,editor:i})=>{var s;const l=mt(t,o.schema),{$from:c,$to:u}=o.selection,d=o.selection.node;if(d&&d.isBlock||c.depth<2||!c.sameParent(u))return!1;const p=c.node(-1);if(p.type!==l)return!1;const f=i.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==l||c.index(-2)!==c.node(-2).childCount-1)return!1;if(r){let y=A.empty;const k=c.index(-1)?1:c.index(-2)?2:3;for(let B=c.depth-k;B>=c.depth-3;B-=1)y=A.from(c.node(B).copy(y));const E=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,v={...ss(f,c.node().type.name,c.node().attrs),...e},C=((s=l.contentMatch.defaultType)===null||s===void 0?void 0:s.createAndFill(v))||void 0;y=y.append(A.from(l.createAndFill(null,C)||void 0));const _=c.before(c.depth-(k-1));n.replace(_,c.after(-E),new V(y,4-k,0));let R=-1;n.doc.nodesBetween(_,n.doc.content.size,(B,N)=>{if(R>-1)return!1;B.isTextblock&&B.content.size===0&&(R=N+1)}),R>-1&&n.setSelection(ne.near(n.doc.resolve(R))),n.scrollIntoView()}return!0}const h=u.pos===c.end()?p.contentMatchAt(0).defaultType:null,m={...ss(f,p.type.name,p.attrs),...e},g={...ss(f,c.node().type.name,c.node().attrs),...e};n.delete(c.pos,u.pos);const b=h?[{type:l,attrs:m},{type:h,attrs:g}]:[{type:l,attrs:m}];if(!Yn(n.doc,c.pos,2))return!1;if(r){const{selection:y,storedMarks:k}=o,{splittableMarks:E}=i.extensionManager,v=k||y.$to.parentOffset&&y.$from.marks();if(n.split(c.pos,2,b).scrollIntoView(),!v||!r)return!0;const C=v.filter(_=>E.includes(_.type.name));n.ensureMarks(C)}return!0},Za=(t,e)=>{const n=Rc(s=>s.type===e)(t.selection);if(!n)return!0;const o=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(o===void 0)return!0;const r=t.doc.nodeAt(o);return n.node.type===(r==null?void 0:r.type)&&wo(t.doc,n.pos)&&t.join(n.pos),!0},Qa=(t,e)=>{const n=Rc(s=>s.type===e)(t.selection);if(!n)return!0;const o=t.doc.resolve(n.start).after(n.depth);if(o===void 0)return!0;const r=t.doc.nodeAt(o);return n.node.type===(r==null?void 0:r.type)&&wo(t.doc,o)&&t.join(o),!0},pE=(t,e,n,o={})=>({editor:r,tr:i,state:s,dispatch:l,chain:c,commands:u,can:d})=>{const{extensions:p,splittableMarks:f}=r.extensionManager,h=mt(t,s.schema),m=mt(e,s.schema),{selection:g,storedMarks:b}=s,{$from:y,$to:k}=g,E=y.blockRange(k),v=b||g.$to.parentOffset&&g.$from.marks();if(!E)return!1;const C=Rc(_=>Id(_.type.name,p))(g);if(E.depth>=1&&C&&E.depth-C.depth<=1){if(C.node.type===h)return u.liftListItem(m);if(Id(C.node.type.name,p)&&h.validContent(C.node.content)&&l)return c().command(()=>(i.setNodeMarkup(C.pos,h),!0)).command(()=>Za(i,h)).command(()=>Qa(i,h)).run()}return!n||!v||!l?c().command(()=>d().wrapInList(h,o)?!0:u.clearNodes()).wrapInList(h,o).command(()=>Za(i,h)).command(()=>Qa(i,h)).run():c().command(()=>{const _=d().wrapInList(h,o),R=v.filter(B=>f.includes(B.type.name));return i.ensureMarks(R),_?!0:u.clearNodes()}).wrapInList(h,o).command(()=>Za(i,h)).command(()=>Qa(i,h)).run()},fE=(t,e={},n={})=>({state:o,commands:r})=>{const{extendEmptyMarkRange:i=!1}=n,s=_o(t,o.schema);return Fl(o,s,e)?r.unsetMark(s,{extendEmptyMarkRange:i}):r.setMark(s,e)},hE=(t,e,n={})=>({state:o,commands:r})=>{const i=mt(t,o.schema),s=mt(e,o.schema),l=ci(o,i,n);let c;return o.selection.$anchor.sameParent(o.selection.$head)&&(c=o.selection.$anchor.parent.attrs),l?r.setNode(s,c):r.setNode(i,{...c,...n})},mE=(t,e={})=>({state:n,commands:o})=>{const r=mt(t,n.schema);return ci(n,r,e)?o.lift(r):o.wrapIn(r,e)},gE=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let o=0;o<n.length;o+=1){const r=n[o];let i;if(r.spec.isInputRules&&(i=r.getState(t))){if(e){const s=t.tr,l=i.transform;for(let c=l.steps.length-1;c>=0;c-=1)s.step(l.steps[c].invert(l.docs[c]));if(i.text){const c=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,c))}else s.delete(i.from,i.to)}return!0}}return!1},bE=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:o,ranges:r}=n;return o||e&&r.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0},yE=(t,e={})=>({tr:n,state:o,dispatch:r})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=n,c=_o(t,o.schema),{$from:u,empty:d,ranges:p}=l;if(!r)return!0;if(d&&s){let{from:f,to:h}=l;const m=(i=u.marks().find(b=>b.type===c))===null||i===void 0?void 0:i.attrs,g=Cr(u,c,m);g&&(f=g.from,h=g.to),n.removeMark(f,h,c)}else p.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,c)});return n.removeStoredMark(c),!0},vE=(t,e={})=>({tr:n,state:o,dispatch:r})=>{let i=null,s=null;const l=ya(typeof t=="string"?t:t.name,o.schema);return l?(l==="node"&&(i=mt(t,o.schema)),l==="mark"&&(s=_o(t,o.schema)),r&&n.selection.ranges.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;let p,f,h,m;n.selection.empty?o.doc.nodesBetween(u,d,(g,b)=>{i&&i===g.type&&(h=Math.max(b,u),m=Math.min(b+g.nodeSize,d),p=b,f=g)}):o.doc.nodesBetween(u,d,(g,b)=>{b<u&&i&&i===g.type&&(h=Math.max(b,u),m=Math.min(b+g.nodeSize,d),p=b,f=g),b>=u&&b<=d&&(i&&i===g.type&&n.setNodeMarkup(b,void 0,{...g.attrs,...e}),s&&g.marks.length&&g.marks.forEach(y=>{if(s===y.type){const k=Math.max(b,u),E=Math.min(b+g.nodeSize,d);n.addMark(k,E,s.create({...y.attrs,...e}))}}))}),f&&(p!==void 0&&n.setNodeMarkup(p,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},kE=(t,e={})=>({state:n,dispatch:o})=>{const r=mt(t,n.schema);return Ik(r,e)(n,o)},wE=(t,e={})=>({state:n,dispatch:o})=>{const r=mt(t,n.schema);return Lk(r,e)(n,o)};var EE=Object.freeze({__proto__:null,blur:rw,clearContent:iw,clearNodes:sw,command:aw,createParagraphNear:lw,cut:cw,deleteCurrentNode:uw,deleteNode:dw,deleteRange:pw,deleteSelection:fw,enter:hw,exitCode:mw,extendMarkRange:gw,first:bw,focus:yw,forEach:vw,insertContent:kw,insertContentAt:_w,joinBackward:xw,joinDown:Sw,joinForward:Nw,joinItemBackward:Tw,joinItemForward:Ow,joinTextblockBackward:Mw,joinTextblockForward:Aw,joinUp:Cw,keyboardShortcut:Bw,lift:Dw,liftEmptyBlock:Iw,liftListItem:Lw,newlineInCode:Pw,resetAttributes:$w,scrollIntoView:Fw,selectAll:Vw,selectNodeBackward:zw,selectNodeForward:Hw,selectParentNode:Uw,selectTextblockEnd:qw,selectTextblockStart:Kw,setContent:Ww,setMark:rE,setMeta:iE,setNode:sE,setNodeSelection:aE,setTextSelection:lE,sinkListItem:cE,splitBlock:uE,splitListItem:dE,toggleList:pE,toggleMark:fE,toggleNode:hE,toggleWrap:mE,undoInputRule:gE,unsetAllMarks:bE,unsetMark:yE,updateAttributes:vE,wrapIn:kE,wrapInList:wE});const _E=De.create({name:"commands",addCommands(){return{...EE}}}),CE=De.create({name:"drop",addProseMirrorPlugins(){return[new Ae({key:new xe("tiptapDrop"),props:{handleDrop:(t,e,n,o)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:o})}}})]}}),SE=De.create({name:"editable",addProseMirrorPlugins(){return[new Ae({key:new xe("editable"),props:{editable:()=>this.editor.options.editable}})]}}),xE=De.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ae({key:new xe("focusEvents"),props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const o=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(o),!1},blur:(e,n)=>{t.isFocused=!1;const o=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(o),!1}}}})]}}),NE=De.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{const{selection:c,doc:u}=l,{empty:d,$anchor:p}=c,{pos:f,parent:h}=p,m=p.parent.isTextblock&&f>0?l.doc.resolve(f-1):p,g=m.parent.type.spec.isolating,b=p.pos-p.parentOffset,y=g&&m.parent.childCount===1?b===p.pos:ae.atStart(u).from===f;return!d||!h.type.isTextblock||h.textContent.length||!y||y&&p.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()]),o={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()},r={...o},i={...o,"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 ba()||Rh()?i:r},addProseMirrorPlugins(){return[new Ae({key:new xe("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(g=>g.getMeta("composition")))return;const o=t.some(g=>g.docChanged)&&!e.doc.eq(n.doc),r=t.some(g=>g.getMeta("preventClearDocument"));if(!o||r)return;const{empty:i,from:s,to:l}=e.selection,c=ae.atStart(e.doc).from,u=ae.atEnd(e.doc).to;if(i||!(s===c&&l===u)||!Dc(n.doc))return;const f=n.tr,h=pa({state:n,transaction:f}),{commands:m}=new fa({editor:this.editor,state:h});if(m.clearNodes(),!!f.steps.length)return f}})]}}),TE=De.create({name:"paste",addProseMirrorPlugins(){return[new Ae({key:new xe("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),OE=De.create({name:"tabindex",addProseMirrorPlugins(){return[new Ae({key:new xe("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Mo{get name(){return this.node.type.name}constructor(e,n,o=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=o,this.resolvedPos=e,this.editor=n,this.currentNode=r}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,o=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,o=this.to-1}this.editor.commands.insertContentAt({from:n,to:o},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 Mo(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 Mo(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 Mo(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,o)=>{const r=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=this.pos+o+(i?0:1),l=this.resolvedPos.doc.resolve(s);if(!r&&l.depth<=this.depth)return;const c=new Mo(l,this.editor,r,r?n:null);r&&(c.actualDepth=this.depth+1),e.push(new Mo(l,this.editor,r,r?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 o=null,r=this.parent;for(;r&&!o;){if(r.node.type.name===e)if(Object.keys(n).length>0){const i=r.node.attrs,s=Object.keys(n);for(let l=0;l<s.length;l+=1){const c=s[l];if(i[c]!==n[c])break}}else o=r;r=r.parent}return o}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},o=!1){let r=[];if(!this.children||this.children.length===0)return r;const i=Object.keys(n);return this.children.forEach(s=>{o&&r.length>0||(s.node.type.name===e&&i.every(c=>n[c]===s.node.attrs[c])&&r.push(s),!(o&&r.length>0)&&(r=r.concat(s.querySelectorAll(e,n,o))))}),r}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}}const ME=`.ProseMirror {
17
17
  position: relative;
18
18
  }
19
19
 
@@ -87,76 +87,113 @@ img.ProseMirror-separator {
87
87
 
88
88
  .tippy-box[data-animation=fade][data-state=hidden] {
89
89
  opacity: 0
90
- }`;function sw(t,e,n){const o=document.querySelector("style[data-tiptap-style]");if(o!==null)return o;const r=document.createElement("style");return e&&r.setAttribute("nonce",e),r.setAttribute("data-tiptap-style",""),r.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(r),r}let cn=class extends vk{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,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:o,moved:r})=>this.options.onDrop(n,o,r)),this.on("paste",({event:n,slice:o})=>this.options.onPaste(n,o)),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=sw(iw,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 o=hh(n)?n(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:o});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;const n=this.state.plugins;let o=n;if([].concat(e).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;o=n.filter(a=>!a.key.startsWith(s))}),n.length===o.length)return;const r=this.state.reconfigure({plugins:o});return this.view.updateState(r),r}createExtensionManager(){var e,n;const r=[...this.options.enableCoreExtensions?[ew,Ik.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),ZE,tw,nw,rw,QE,ow].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i==null?void 0:i.type));this.extensionManager=new ir(r,this)}createCommandManager(){this.commandManager=new da({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let n;try{n=Dl(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=Dl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const o=bh(n,this.options.autofocus);this.view=new Uv(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:rr.create({doc:n,selection:o||void 0})});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews(),this.prependClass();const i=this.view.dom;i.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),o=!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}),o&&this.emit("selectionUpdate",{editor:this,transaction:e});const r=e.getMeta("focus"),i=e.getMeta("blur");r&&this.emit("focus",{editor:this,event:r.event,transaction:e}),i&&this.emit("blur",{editor:this,event:i.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return _h(this.state,e)}isActive(e,n){const o=typeof e=="string"?e:null,r=typeof e=="string"?n:e;return AE(this.state,o,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Cc(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
90
+ }`;function AE(t,e,n){const o=document.querySelector("style[data-tiptap-style]");if(o!==null)return o;const r=document.createElement("style");return e&&r.setAttribute("nonce",e),r.setAttribute("data-tiptap-style",""),r.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(r),r}let Zt=class extends Uk{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,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:o,moved:r})=>this.options.onDrop(n,o,r)),this.on("paste",({event:n,slice:o})=>this.options.onPaste(n,o)),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=AE(ME,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 o=Sh(n)?n(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:o});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;const n=this.state.plugins;let o=n;if([].concat(e).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;o=n.filter(l=>!l.key.startsWith(s))}),n.length===o.length)return;const r=this.state.reconfigure({plugins:o});return this.view.updateState(r),r}createExtensionManager(){var e,n;const r=[...this.options.enableCoreExtensions?[SE,ow.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),_E,xE,NE,OE,CE,TE].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i==null?void 0:i.type));this.extensionManager=new Bo(r,this)}createCommandManager(){this.commandManager=new fa({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let n;try{n=Pl(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(l=>l.name!=="collaboration"),this.createExtensionManager()}}),n=Pl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const o=Oh(n,this.options.autofocus);this.view=new fk(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:ar.create({doc:n,selection:o||void 0})});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews(),this.prependClass();const i=this.view.dom;i.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 l;return(l=this.capturedTransaction)===null||l===void 0?void 0:l.step(s)});return}const n=this.state.apply(e),o=!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}),o&&this.emit("selectionUpdate",{editor:this,transaction:e});const r=e.getMeta("focus"),i=e.getMeta("blur");r&&this.emit("focus",{editor:this,event:r.event,transaction:e}),i&&this.emit("blur",{editor:this,event:i.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return Lh(this.state,e)}isActive(e,n){const o=typeof e=="string"?e:null,r=typeof e=="string"?n:e;return nE(this.state,o,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Oc(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
91
91
 
92
- `,textSerializers:o={}}=e||{};return Ch(this.state.doc,{blockSeparator:n,textSerializers:{...Sc(this.schema),...o}})}get isEmpty(){return Tc(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 o;return((o=this.$doc)===null||o===void 0?void 0:o.querySelector(e,n))||null}$nodes(e,n){var o;return((o=this.$doc)===null||o===void 0?void 0:o.querySelectorAll(e,n))||null}$pos(e){const n=this.state.doc.resolve(e);return new xo(n,this)}get $doc(){return this.$pos(0)}};function zo(t){return new yi({find:t.find,handler:({state:e,range:n,match:o})=>{const r=me(t.getAttributes,void 0,o);if(r===!1||r===null)return null;const{tr:i}=e,s=o[o.length-1],a=o[0];if(s){const c=a.search(/\S/),d=n.from+a.indexOf(s),u=d+s.length;if(Nc(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>d).length)return null;u<n.to&&i.delete(u,n.to),d>n.from&&i.delete(n.from+c,d);const f=n.from+c+s.length;i.addMark(n.from+c,f,t.type.create(r||{})),i.removeStoredMark(t.type)}}})}function ga(t){return new yi({find:t.find,handler:({state:e,range:n,match:o})=>{const r=me(t.getAttributes,void 0,o)||{},{tr:i}=e,s=n.from;let a=n.to;const c=t.type.create(r);if(o[1]){const d=o[0].lastIndexOf(o[1]);let u=s+d;u>a?u=a:a=u+o[1].length;const p=o[0][o[0].length-1];i.insertText(p,s+o[0].length-1),i.replaceWith(u,a,c)}else if(o[0]){const d=t.type.isInline?s:s-1;i.insert(d,t.type.create(r)).delete(i.mapping.map(s),i.mapping.map(a))}i.scrollIntoView()}})}function Ll(t){return new yi({find:t.find,handler:({state:e,range:n,match:o})=>{const r=e.doc.resolve(n.from),i=me(t.getAttributes,void 0,o)||{};if(!r.node(-1).canReplaceWith(r.index(-1),r.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)}})}function Ye(t){return new yi({find:t.find,handler:({state:e,range:n,match:o})=>{let r=t.replace,i=n.from;const s=n.to;if(o[1]){const a=o[0].lastIndexOf(o[1]);r+=o[0].slice(a+o[1].length),i+=a;const c=i-s;c>0&&(r=o[0].slice(a-c,a)+r,i=s)}e.tr.insertText(r,i,s)}})}function pr(t){return new yi({find:t.find,handler:({state:e,range:n,match:o,chain:r})=>{const i=me(t.getAttributes,void 0,o)||{},s=e.tr.delete(n.from,n.to),c=s.doc.resolve(n.from).blockRange(),d=c&&ic(c,t.type,i);if(!d)return null;if(s.wrap(c,d),t.keepMarks&&t.editor){const{selection:p,storedMarks:f}=e,{splittableMarks:h}=t.editor.extensionManager,m=f||p.$to.parentOffset&&p.$from.marks();if(m){const g=m.filter(b=>h.includes(b.type.name));s.ensureMarks(g)}}if(t.keepAttributes){const p=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";r().updateAttributes(p,i).run()}const u=s.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&yo(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(o,u))&&s.join(n.from-1)}})}class Ue{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=me(U(this,"addOptions",{name:this.name}))),this.storage=me(U(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ue(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>pa(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Ue(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=me(U(n,"addOptions",{name:n.name})),n.storage=me(U(n,"addStorage",{name:n.name,options:n.options})),n}}class aw{constructor(e,n,o){this.isDragging=!1,this.component=e,this.editor=n.editor,this.options={stopEvent:null,ignoreMutation:null,...o},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,o,r,i,s,a,c;const{view:d}=this.editor,u=e.target,p=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||!((o=this.contentDOM)===null||o===void 0)&&o.contains(u)||!p)return;let f=0,h=0;if(this.dom!==p){const y=this.dom.getBoundingClientRect(),k=p.getBoundingClientRect(),w=(r=e.offsetX)!==null&&r!==void 0?r:(i=e.nativeEvent)===null||i===void 0?void 0:i.offsetX,v=(s=e.offsetY)!==null&&s!==void 0?s:(a=e.nativeEvent)===null||a===void 0?void 0:a.offsetY;f=k.x-y.x+w,h=k.y-y.y+v}(c=e.dataTransfer)===null||c===void 0||c.setDragImage(this.dom,f,h);const m=this.getPos();if(typeof m!="number")return;const g=G.create(d.state.doc,m),b=d.state.tr.setSelection(g);d.dispatch(b)}stopEvent(e){var n;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:e});const o=e.target;if(!(this.dom.contains(o)&&!(!((n=this.contentDOM)===null||n===void 0)&&n.contains(o))))return!1;const i=e.type.startsWith("drag"),s=e.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(o.tagName)||o.isContentEditable)&&!s&&!i)return!0;const{isEditable:c}=this.editor,{isDragging:d}=this,u=!!this.node.type.spec.draggable,p=G.isSelectable(this.node),f=e.type==="copy",h=e.type==="paste",m=e.type==="cut",g=e.type==="mousedown";if(!u&&p&&i&&e.target===this.dom&&e.preventDefault(),u&&i&&!d&&e.target===this.dom)return e.preventDefault(),!1;if(u&&c&&!d&&g){const b=o.closest("[data-drag-handle]");b&&(this.dom===b||this.dom.contains(b))&&(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!(d||s||f||h||m||g&&p)}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"&&(ha()||yh())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(o=>o.isContentEditable)?!1:this.contentDOM===e.target&&e.type==="attributes"?!0:!this.contentDOM.contains(e.target)}updateAttributes(e){this.editor.commands.command(({tr:n})=>{const o=this.getPos();return typeof o!="number"?!1:(n.setNodeMarkup(o,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 bo(t){return new Tk({find:t.find,handler:({state:e,range:n,match:o,pasteEvent:r})=>{const i=me(t.getAttributes,void 0,o,r);if(i===!1||i===null)return null;const{tr:s}=e,a=o[o.length-1],c=o[0];let d=n.to;if(a){const u=c.search(/\S/),p=n.from+c.indexOf(a),f=p+a.length;if(Nc(n.from,n.to,e.doc).filter(m=>m.mark.type.excluded.find(b=>b===t.type&&b!==m.mark.type)).filter(m=>m.to>p).length)return null;f<n.to&&s.delete(f,n.to),p>n.from&&s.delete(n.from+u,p),d=n.from+u+a.length,s.addMark(n.from+u,d,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}function lw(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var $t="top",an="bottom",ln="right",Ft="left",Oc="auto",vi=[$t,an,ln,Ft],fr="start",ii="end",cw="clippingParents",Nh="viewport",Or="popper",dw="reference",xu=vi.reduce(function(t,e){return t.concat([e+"-"+fr,e+"-"+ii])},[]),Th=[].concat(vi,[Oc]).reduce(function(t,e){return t.concat([e,e+"-"+fr,e+"-"+ii])},[]),uw="beforeRead",pw="read",fw="afterRead",hw="beforeMain",mw="main",gw="afterMain",bw="beforeWrite",yw="write",vw="afterWrite",kw=[uw,pw,fw,hw,mw,gw,bw,yw,vw];function Rn(t){return t?(t.nodeName||"").toLowerCase():null}function Gt(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Ho(t){var e=Gt(t).Element;return t instanceof e||t instanceof Element}function rn(t){var e=Gt(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function Mc(t){if(typeof ShadowRoot>"u")return!1;var e=Gt(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function Ew(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var o=e.styles[n]||{},r=e.attributes[n]||{},i=e.elements[n];!rn(i)||!Rn(i)||(Object.assign(i.style,o),Object.keys(r).forEach(function(s){var a=r[s];a===!1?i.removeAttribute(s):i.setAttribute(s,a===!0?"":a)}))})}function ww(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(o){var r=e.elements[o],i=e.attributes[o]||{},s=Object.keys(e.styles.hasOwnProperty(o)?e.styles[o]:n[o]),a=s.reduce(function(c,d){return c[d]="",c},{});!rn(r)||!Rn(r)||(Object.assign(r.style,a),Object.keys(i).forEach(function(c){r.removeAttribute(c)}))})}}const Oh={name:"applyStyles",enabled:!0,phase:"write",fn:Ew,effect:ww,requires:["computeStyles"]};function On(t){return t.split("-")[0]}var Io=Math.max,Es=Math.min,hr=Math.round;function Pl(){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 Mh(){return!/^((?!chrome|android).)*safari/i.test(Pl())}function mr(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var o=t.getBoundingClientRect(),r=1,i=1;e&&rn(t)&&(r=t.offsetWidth>0&&hr(o.width)/t.offsetWidth||1,i=t.offsetHeight>0&&hr(o.height)/t.offsetHeight||1);var s=Ho(t)?Gt(t):window,a=s.visualViewport,c=!Mh()&&n,d=(o.left+(c&&a?a.offsetLeft:0))/r,u=(o.top+(c&&a?a.offsetTop:0))/i,p=o.width/r,f=o.height/i;return{width:p,height:f,top:u,right:d+p,bottom:u+f,left:d,x:d,y:u}}function Ac(t){var e=mr(t),n=t.offsetWidth,o=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-o)<=1&&(o=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:o}}function Ah(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&Mc(n)){var o=e;do{if(o&&t.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function jn(t){return Gt(t).getComputedStyle(t)}function Cw(t){return["table","td","th"].indexOf(Rn(t))>=0}function Eo(t){return((Ho(t)?t.ownerDocument:t.document)||window.document).documentElement}function ba(t){return Rn(t)==="html"?t:t.assignedSlot||t.parentNode||(Mc(t)?t.host:null)||Eo(t)}function Nu(t){return!rn(t)||jn(t).position==="fixed"?null:t.offsetParent}function _w(t){var e=/firefox/i.test(Pl()),n=/Trident/i.test(Pl());if(n&&rn(t)){var o=jn(t);if(o.position==="fixed")return null}var r=ba(t);for(Mc(r)&&(r=r.host);rn(r)&&["html","body"].indexOf(Rn(r))<0;){var i=jn(r);if(i.transform!=="none"||i.perspective!=="none"||i.contain==="paint"||["transform","perspective"].indexOf(i.willChange)!==-1||e&&i.willChange==="filter"||e&&i.filter&&i.filter!=="none")return r;r=r.parentNode}return null}function ki(t){for(var e=Gt(t),n=Nu(t);n&&Cw(n)&&jn(n).position==="static";)n=Nu(n);return n&&(Rn(n)==="html"||Rn(n)==="body"&&jn(n).position==="static")?e:n||_w(t)||e}function Rc(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Vr(t,e,n){return Io(t,Es(e,n))}function Sw(t,e,n){var o=Vr(t,e,n);return o>n?n:o}function Rh(){return{top:0,right:0,bottom:0,left:0}}function Dh(t){return Object.assign({},Rh(),t)}function Ih(t,e){return e.reduce(function(n,o){return n[o]=t,n},{})}var xw=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,Dh(typeof e!="number"?e:Ih(e,vi))};function Nw(t){var e,n=t.state,o=t.name,r=t.options,i=n.elements.arrow,s=n.modifiersData.popperOffsets,a=On(n.placement),c=Rc(a),d=[Ft,ln].indexOf(a)>=0,u=d?"height":"width";if(!(!i||!s)){var p=xw(r.padding,n),f=Ac(i),h=c==="y"?$t:Ft,m=c==="y"?an:ln,g=n.rects.reference[u]+n.rects.reference[c]-s[c]-n.rects.popper[u],b=s[c]-n.rects.reference[c],y=ki(i),k=y?c==="y"?y.clientHeight||0:y.clientWidth||0:0,w=g/2-b/2,v=p[h],_=k-f[u]-p[m],C=k/2-f[u]/2+w,A=Vr(v,C,_),L=c;n.modifiersData[o]=(e={},e[L]=A,e.centerOffset=A-C,e)}}function Tw(t){var e=t.state,n=t.options,o=n.element,r=o===void 0?"[data-popper-arrow]":o;r!=null&&(typeof r=="string"&&(r=e.elements.popper.querySelector(r),!r)||Ah(e.elements.popper,r)&&(e.elements.arrow=r))}const Ow={name:"arrow",enabled:!0,phase:"main",fn:Nw,effect:Tw,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function gr(t){return t.split("-")[1]}var Mw={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Aw(t,e){var n=t.x,o=t.y,r=e.devicePixelRatio||1;return{x:hr(n*r)/r||0,y:hr(o*r)/r||0}}function Tu(t){var e,n=t.popper,o=t.popperRect,r=t.placement,i=t.variation,s=t.offsets,a=t.position,c=t.gpuAcceleration,d=t.adaptive,u=t.roundOffsets,p=t.isFixed,f=s.x,h=f===void 0?0:f,m=s.y,g=m===void 0?0:m,b=typeof u=="function"?u({x:h,y:g}):{x:h,y:g};h=b.x,g=b.y;var y=s.hasOwnProperty("x"),k=s.hasOwnProperty("y"),w=Ft,v=$t,_=window;if(d){var C=ki(n),A="clientHeight",L="clientWidth";if(C===Gt(n)&&(C=Eo(n),jn(C).position!=="static"&&a==="absolute"&&(A="scrollHeight",L="scrollWidth")),C=C,r===$t||(r===Ft||r===ln)&&i===ii){v=an;var M=p&&C===_&&_.visualViewport?_.visualViewport.height:C[A];g-=M-o.height,g*=c?1:-1}if(r===Ft||(r===$t||r===an)&&i===ii){w=ln;var P=p&&C===_&&_.visualViewport?_.visualViewport.width:C[L];h-=P-o.width,h*=c?1:-1}}var K=Object.assign({position:a},d&&Mw),te=u===!0?Aw({x:h,y:g},Gt(n)):{x:h,y:g};if(h=te.x,g=te.y,c){var de;return Object.assign({},K,(de={},de[v]=k?"0":"",de[w]=y?"0":"",de.transform=(_.devicePixelRatio||1)<=1?"translate("+h+"px, "+g+"px)":"translate3d("+h+"px, "+g+"px, 0)",de))}return Object.assign({},K,(e={},e[v]=k?g+"px":"",e[w]=y?h+"px":"",e.transform="",e))}function Rw(t){var e=t.state,n=t.options,o=n.gpuAcceleration,r=o===void 0?!0:o,i=n.adaptive,s=i===void 0?!0:i,a=n.roundOffsets,c=a===void 0?!0:a,d={placement:On(e.placement),variation:gr(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:r,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,Tu(Object.assign({},d,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:c})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Tu(Object.assign({},d,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const Dw={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Rw,data:{}};var Di={passive:!0};function Iw(t){var e=t.state,n=t.instance,o=t.options,r=o.scroll,i=r===void 0?!0:r,s=o.resize,a=s===void 0?!0:s,c=Gt(e.elements.popper),d=[].concat(e.scrollParents.reference,e.scrollParents.popper);return i&&d.forEach(function(u){u.addEventListener("scroll",n.update,Di)}),a&&c.addEventListener("resize",n.update,Di),function(){i&&d.forEach(function(u){u.removeEventListener("scroll",n.update,Di)}),a&&c.removeEventListener("resize",n.update,Di)}}const Bw={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Iw,data:{}};var Lw={left:"right",right:"left",bottom:"top",top:"bottom"};function ts(t){return t.replace(/left|right|bottom|top/g,function(e){return Lw[e]})}var Pw={start:"end",end:"start"};function Ou(t){return t.replace(/start|end/g,function(e){return Pw[e]})}function Dc(t){var e=Gt(t),n=e.pageXOffset,o=e.pageYOffset;return{scrollLeft:n,scrollTop:o}}function Ic(t){return mr(Eo(t)).left+Dc(t).scrollLeft}function $w(t,e){var n=Gt(t),o=Eo(t),r=n.visualViewport,i=o.clientWidth,s=o.clientHeight,a=0,c=0;if(r){i=r.width,s=r.height;var d=Mh();(d||!d&&e==="fixed")&&(a=r.offsetLeft,c=r.offsetTop)}return{width:i,height:s,x:a+Ic(t),y:c}}function Fw(t){var e,n=Eo(t),o=Dc(t),r=(e=t.ownerDocument)==null?void 0:e.body,i=Io(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),s=Io(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),a=-o.scrollLeft+Ic(t),c=-o.scrollTop;return jn(r||n).direction==="rtl"&&(a+=Io(n.clientWidth,r?r.clientWidth:0)-i),{width:i,height:s,x:a,y:c}}function Bc(t){var e=jn(t),n=e.overflow,o=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+r+o)}function Bh(t){return["html","body","#document"].indexOf(Rn(t))>=0?t.ownerDocument.body:rn(t)&&Bc(t)?t:Bh(ba(t))}function zr(t,e){var n;e===void 0&&(e=[]);var o=Bh(t),r=o===((n=t.ownerDocument)==null?void 0:n.body),i=Gt(o),s=r?[i].concat(i.visualViewport||[],Bc(o)?o:[]):o,a=e.concat(s);return r?a:a.concat(zr(ba(s)))}function $l(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function Vw(t,e){var n=mr(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 Mu(t,e,n){return e===Nh?$l($w(t,n)):Ho(e)?Vw(e,n):$l(Fw(Eo(t)))}function zw(t){var e=zr(ba(t)),n=["absolute","fixed"].indexOf(jn(t).position)>=0,o=n&&rn(t)?ki(t):t;return Ho(o)?e.filter(function(r){return Ho(r)&&Ah(r,o)&&Rn(r)!=="body"}):[]}function Hw(t,e,n,o){var r=e==="clippingParents"?zw(t):[].concat(e),i=[].concat(r,[n]),s=i[0],a=i.reduce(function(c,d){var u=Mu(t,d,o);return c.top=Io(u.top,c.top),c.right=Es(u.right,c.right),c.bottom=Es(u.bottom,c.bottom),c.left=Io(u.left,c.left),c},Mu(t,s,o));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Lh(t){var e=t.reference,n=t.element,o=t.placement,r=o?On(o):null,i=o?gr(o):null,s=e.x+e.width/2-n.width/2,a=e.y+e.height/2-n.height/2,c;switch(r){case $t:c={x:s,y:e.y-n.height};break;case an:c={x:s,y:e.y+e.height};break;case ln:c={x:e.x+e.width,y:a};break;case Ft:c={x:e.x-n.width,y:a};break;default:c={x:e.x,y:e.y}}var d=r?Rc(r):null;if(d!=null){var u=d==="y"?"height":"width";switch(i){case fr:c[d]=c[d]-(e[u]/2-n[u]/2);break;case ii:c[d]=c[d]+(e[u]/2-n[u]/2);break}}return c}function si(t,e){e===void 0&&(e={});var n=e,o=n.placement,r=o===void 0?t.placement:o,i=n.strategy,s=i===void 0?t.strategy:i,a=n.boundary,c=a===void 0?cw:a,d=n.rootBoundary,u=d===void 0?Nh:d,p=n.elementContext,f=p===void 0?Or:p,h=n.altBoundary,m=h===void 0?!1:h,g=n.padding,b=g===void 0?0:g,y=Dh(typeof b!="number"?b:Ih(b,vi)),k=f===Or?dw:Or,w=t.rects.popper,v=t.elements[m?k:f],_=Hw(Ho(v)?v:v.contextElement||Eo(t.elements.popper),c,u,s),C=mr(t.elements.reference),A=Lh({reference:C,element:w,placement:r}),L=$l(Object.assign({},w,A)),M=f===Or?L:C,P={top:_.top-M.top+y.top,bottom:M.bottom-_.bottom+y.bottom,left:_.left-M.left+y.left,right:M.right-_.right+y.right},K=t.modifiersData.offset;if(f===Or&&K){var te=K[r];Object.keys(P).forEach(function(de){var ce=[ln,an].indexOf(de)>=0?1:-1,re=[$t,an].indexOf(de)>=0?"y":"x";P[de]+=te[re]*ce})}return P}function Uw(t,e){e===void 0&&(e={});var n=e,o=n.placement,r=n.boundary,i=n.rootBoundary,s=n.padding,a=n.flipVariations,c=n.allowedAutoPlacements,d=c===void 0?Th:c,u=gr(o),p=u?a?xu:xu.filter(function(m){return gr(m)===u}):vi,f=p.filter(function(m){return d.indexOf(m)>=0});f.length===0&&(f=p);var h=f.reduce(function(m,g){return m[g]=si(t,{placement:g,boundary:r,rootBoundary:i,padding:s})[On(g)],m},{});return Object.keys(h).sort(function(m,g){return h[m]-h[g]})}function qw(t){if(On(t)===Oc)return[];var e=ts(t);return[Ou(t),e,Ou(e)]}function Ww(t){var e=t.state,n=t.options,o=t.name;if(!e.modifiersData[o]._skip){for(var r=n.mainAxis,i=r===void 0?!0:r,s=n.altAxis,a=s===void 0?!0:s,c=n.fallbackPlacements,d=n.padding,u=n.boundary,p=n.rootBoundary,f=n.altBoundary,h=n.flipVariations,m=h===void 0?!0:h,g=n.allowedAutoPlacements,b=e.options.placement,y=On(b),k=y===b,w=c||(k||!m?[ts(b)]:qw(b)),v=[b].concat(w).reduce(function(rt,Te){return rt.concat(On(Te)===Oc?Uw(e,{placement:Te,boundary:u,rootBoundary:p,padding:d,flipVariations:m,allowedAutoPlacements:g}):Te)},[]),_=e.rects.reference,C=e.rects.popper,A=new Map,L=!0,M=v[0],P=0;P<v.length;P++){var K=v[P],te=On(K),de=gr(K)===fr,ce=[$t,an].indexOf(te)>=0,re=ce?"width":"height",ie=si(e,{placement:K,boundary:u,rootBoundary:p,altBoundary:f,padding:d}),x=ce?de?ln:Ft:de?an:$t;_[re]>C[re]&&(x=ts(x));var O=ts(x),V=[];if(i&&V.push(ie[te]<=0),a&&V.push(ie[x]<=0,ie[O]<=0),V.every(function(rt){return rt})){M=K,L=!1;break}A.set(K,V)}if(L)for(var Y=m?3:1,Q=function(Te){var Fe=v.find(function(Vt){var pt=A.get(Vt);if(pt)return pt.slice(0,Te).every(function(Xt){return Xt})});if(Fe)return M=Fe,"break"},fe=Y;fe>0;fe--){var Ne=Q(fe);if(Ne==="break")break}e.placement!==M&&(e.modifiersData[o]._skip=!0,e.placement=M,e.reset=!0)}}const Kw={name:"flip",enabled:!0,phase:"main",fn:Ww,requiresIfExists:["offset"],data:{_skip:!1}};function Au(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 Ru(t){return[$t,ln,an,Ft].some(function(e){return t[e]>=0})}function jw(t){var e=t.state,n=t.name,o=e.rects.reference,r=e.rects.popper,i=e.modifiersData.preventOverflow,s=si(e,{elementContext:"reference"}),a=si(e,{altBoundary:!0}),c=Au(s,o),d=Au(a,r,i),u=Ru(c),p=Ru(d);e.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:d,isReferenceHidden:u,hasPopperEscaped:p},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":p})}const Gw={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:jw};function Yw(t,e,n){var o=On(t),r=[Ft,$t].indexOf(o)>=0?-1:1,i=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,s=i[0],a=i[1];return s=s||0,a=(a||0)*r,[Ft,ln].indexOf(o)>=0?{x:a,y:s}:{x:s,y:a}}function Jw(t){var e=t.state,n=t.options,o=t.name,r=n.offset,i=r===void 0?[0,0]:r,s=Th.reduce(function(u,p){return u[p]=Yw(p,e.rects,i),u},{}),a=s[e.placement],c=a.x,d=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=c,e.modifiersData.popperOffsets.y+=d),e.modifiersData[o]=s}const Xw={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Jw};function Zw(t){var e=t.state,n=t.name;e.modifiersData[n]=Lh({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})}const Qw={name:"popperOffsets",enabled:!0,phase:"read",fn:Zw,data:{}};function e0(t){return t==="x"?"y":"x"}function t0(t){var e=t.state,n=t.options,o=t.name,r=n.mainAxis,i=r===void 0?!0:r,s=n.altAxis,a=s===void 0?!1:s,c=n.boundary,d=n.rootBoundary,u=n.altBoundary,p=n.padding,f=n.tether,h=f===void 0?!0:f,m=n.tetherOffset,g=m===void 0?0:m,b=si(e,{boundary:c,rootBoundary:d,padding:p,altBoundary:u}),y=On(e.placement),k=gr(e.placement),w=!k,v=Rc(y),_=e0(v),C=e.modifiersData.popperOffsets,A=e.rects.reference,L=e.rects.popper,M=typeof g=="function"?g(Object.assign({},e.rects,{placement:e.placement})):g,P=typeof M=="number"?{mainAxis:M,altAxis:M}:Object.assign({mainAxis:0,altAxis:0},M),K=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,te={x:0,y:0};if(C){if(i){var de,ce=v==="y"?$t:Ft,re=v==="y"?an:ln,ie=v==="y"?"height":"width",x=C[v],O=x+b[ce],V=x-b[re],Y=h?-L[ie]/2:0,Q=k===fr?A[ie]:L[ie],fe=k===fr?-L[ie]:-A[ie],Ne=e.elements.arrow,rt=h&&Ne?Ac(Ne):{width:0,height:0},Te=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Rh(),Fe=Te[ce],Vt=Te[re],pt=Vr(0,A[ie],rt[ie]),Xt=w?A[ie]/2-Y-pt-Fe-P.mainAxis:Q-pt-Fe-P.mainAxis,ft=w?-A[ie]/2+Y+pt+Vt+P.mainAxis:fe+pt+Vt+P.mainAxis,Zt=e.elements.arrow&&ki(e.elements.arrow),kn=Zt?v==="y"?Zt.clientTop||0:Zt.clientLeft||0:0,un=(de=K==null?void 0:K[v])!=null?de:0,zt=x+Xt-un-kn,pn=x+ft-un,le=Vr(h?Es(O,zt):O,x,h?Io(V,pn):V);C[v]=le,te[v]=le-x}if(a){var It,vt=v==="x"?$t:Ft,Z=v==="x"?an:ln,St=C[_],Ie=_==="y"?"height":"width",ke=St+b[vt],xt=St-b[Z],Je=[$t,Ft].indexOf(y)!==-1,fn=(It=K==null?void 0:K[_])!=null?It:0,Nt=Je?ke:St-A[Ie]-L[Ie]-fn+P.altAxis,I=Je?St+A[Ie]+L[Ie]-fn-P.altAxis:xt,z=h&&Je?Sw(Nt,St,I):Vr(h?Nt:ke,St,h?I:xt);C[_]=z,te[_]=z-St}e.modifiersData[o]=te}}const n0={name:"preventOverflow",enabled:!0,phase:"main",fn:t0,requiresIfExists:["offset"]};function o0(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function r0(t){return t===Gt(t)||!rn(t)?Dc(t):o0(t)}function i0(t){var e=t.getBoundingClientRect(),n=hr(e.width)/t.offsetWidth||1,o=hr(e.height)/t.offsetHeight||1;return n!==1||o!==1}function s0(t,e,n){n===void 0&&(n=!1);var o=rn(e),r=rn(e)&&i0(e),i=Eo(e),s=mr(t,r,n),a={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(o||!o&&!n)&&((Rn(e)!=="body"||Bc(i))&&(a=r0(e)),rn(e)?(c=mr(e,!0),c.x+=e.clientLeft,c.y+=e.clientTop):i&&(c.x=Ic(i))),{x:s.left+a.scrollLeft-c.x,y:s.top+a.scrollTop-c.y,width:s.width,height:s.height}}function a0(t){var e=new Map,n=new Set,o=[];t.forEach(function(i){e.set(i.name,i)});function r(i){n.add(i.name);var s=[].concat(i.requires||[],i.requiresIfExists||[]);s.forEach(function(a){if(!n.has(a)){var c=e.get(a);c&&r(c)}}),o.push(i)}return t.forEach(function(i){n.has(i.name)||r(i)}),o}function l0(t){var e=a0(t);return kw.reduce(function(n,o){return n.concat(e.filter(function(r){return r.phase===o}))},[])}function c0(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function d0(t){var e=t.reduce(function(n,o){var r=n[o.name];return n[o.name]=r?Object.assign({},r,o,{options:Object.assign({},r.options,o.options),data:Object.assign({},r.data,o.data)}):o,n},{});return Object.keys(e).map(function(n){return e[n]})}var Du={placement:"bottom",modifiers:[],strategy:"absolute"};function Iu(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return!e.some(function(o){return!(o&&typeof o.getBoundingClientRect=="function")})}function u0(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,o=n===void 0?[]:n,r=e.defaultOptions,i=r===void 0?Du:r;return function(a,c,d){d===void 0&&(d=i);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},Du,i),modifiersData:{},elements:{reference:a,popper:c},attributes:{},styles:{}},p=[],f=!1,h={state:u,setOptions:function(y){var k=typeof y=="function"?y(u.options):y;g(),u.options=Object.assign({},i,u.options,k),u.scrollParents={reference:Ho(a)?zr(a):a.contextElement?zr(a.contextElement):[],popper:zr(c)};var w=l0(d0([].concat(o,u.options.modifiers)));return u.orderedModifiers=w.filter(function(v){return v.enabled}),m(),h.update()},forceUpdate:function(){if(!f){var y=u.elements,k=y.reference,w=y.popper;if(Iu(k,w)){u.rects={reference:s0(k,ki(w),u.options.strategy==="fixed"),popper:Ac(w)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(P){return u.modifiersData[P.name]=Object.assign({},P.data)});for(var v=0;v<u.orderedModifiers.length;v++){if(u.reset===!0){u.reset=!1,v=-1;continue}var _=u.orderedModifiers[v],C=_.fn,A=_.options,L=A===void 0?{}:A,M=_.name;typeof C=="function"&&(u=C({state:u,options:L,name:M,instance:h})||u)}}}},update:c0(function(){return new Promise(function(b){h.forceUpdate(),b(u)})}),destroy:function(){g(),f=!0}};if(!Iu(a,c))return h;h.setOptions(d).then(function(b){!f&&d.onFirstUpdate&&d.onFirstUpdate(b)});function m(){u.orderedModifiers.forEach(function(b){var y=b.name,k=b.options,w=k===void 0?{}:k,v=b.effect;if(typeof v=="function"){var _=v({state:u,name:y,instance:h,options:w}),C=function(){};p.push(_||C)}})}function g(){p.forEach(function(b){return b()}),p=[]}return h}}var p0=[Bw,Qw,Dw,Oh,Xw,Kw,n0,Ow,Gw],f0=u0({defaultModifiers:p0}),h0="tippy-box",Ph="tippy-content",m0="tippy-backdrop",$h="tippy-arrow",Fh="tippy-svg-arrow",_o={passive:!0,capture:!0},Vh=function(){return document.body};function g0(t,e){return{}.hasOwnProperty.call(t,e)}function Ja(t,e,n){if(Array.isArray(t)){var o=t[e];return o??(Array.isArray(n)?n[e]:n)}return t}function Lc(t,e){var n={}.toString.call(t);return n.indexOf("[object")===0&&n.indexOf(e+"]")>-1}function zh(t,e){return typeof t=="function"?t.apply(void 0,e):t}function Bu(t,e){if(e===0)return t;var n;return function(o){clearTimeout(n),n=setTimeout(function(){t(o)},e)}}function b0(t,e){var n=Object.assign({},t);return e.forEach(function(o){delete n[o]}),n}function y0(t){return t.split(/\s+/).filter(Boolean)}function er(t){return[].concat(t)}function Lu(t,e){t.indexOf(e)===-1&&t.push(e)}function v0(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function k0(t){return t.split("-")[0]}function ws(t){return[].slice.call(t)}function Pu(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function Hr(){return document.createElement("div")}function ai(t){return["Element","Fragment"].some(function(e){return Lc(t,e)})}function E0(t){return Lc(t,"NodeList")}function w0(t){return Lc(t,"MouseEvent")}function C0(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function _0(t){return ai(t)?[t]:E0(t)?ws(t):Array.isArray(t)?t:ws(document.querySelectorAll(t))}function Xa(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function $u(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function S0(t){var e,n=er(t),o=n[0];return o!=null&&(e=o.ownerDocument)!=null&&e.body?o.ownerDocument:document}function x0(t,e){var n=e.clientX,o=e.clientY;return t.every(function(r){var i=r.popperRect,s=r.popperState,a=r.props,c=a.interactiveBorder,d=k0(s.placement),u=s.modifiersData.offset;if(!u)return!0;var p=d==="bottom"?u.top.y:0,f=d==="top"?u.bottom.y:0,h=d==="right"?u.left.x:0,m=d==="left"?u.right.x:0,g=i.top-o+p>c,b=o-i.bottom-f>c,y=i.left-n+h>c,k=n-i.right-m>c;return g||b||y||k})}function Za(t,e,n){var o=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(r){t[o](r,n)})}function Fu(t,e){for(var n=e;n;){var o;if(t.contains(n))return!0;n=n.getRootNode==null||(o=n.getRootNode())==null?void 0:o.host}return!1}var Nn={isTouch:!1},Vu=0;function N0(){Nn.isTouch||(Nn.isTouch=!0,window.performance&&document.addEventListener("mousemove",Hh))}function Hh(){var t=performance.now();t-Vu<20&&(Nn.isTouch=!1,document.removeEventListener("mousemove",Hh)),Vu=t}function T0(){var t=document.activeElement;if(C0(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function O0(){document.addEventListener("touchstart",N0,_o),window.addEventListener("blur",T0)}var M0=typeof window<"u"&&typeof document<"u",A0=M0?!!window.msCrypto:!1;function Jo(t){var e=t==="destroy"?"n already-":" ";return[t+"() was called on a"+e+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function zu(t){var e=/[ \t]{2,}/g,n=/^[ \t]*/gm;return t.replace(e," ").replace(n,"").trim()}function R0(t){return zu(`
92
+ `,textSerializers:o={}}=e||{};return Ih(this.state.doc,{blockSeparator:n,textSerializers:{...Ac(this.schema),...o}})}get isEmpty(){return Dc(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 o;return((o=this.$doc)===null||o===void 0?void 0:o.querySelector(e,n))||null}$nodes(e,n){var o;return((o=this.$doc)===null||o===void 0?void 0:o.querySelectorAll(e,n))||null}$pos(e){const n=this.state.doc.resolve(e);return new Mo(n,this)}get $doc(){return this.$pos(0)}};function Wo(t){return new _i({find:t.find,handler:({state:e,range:n,match:o})=>{const r=ve(t.getAttributes,void 0,o);if(r===!1||r===null)return null;const{tr:i}=e,s=o[o.length-1],l=o[0];if(s){const c=l.search(/\S/),u=n.from+l.indexOf(s),d=u+s.length;if(Bc(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>u).length)return null;d<n.to&&i.delete(d,n.to),u>n.from&&i.delete(n.from+c,u);const f=n.from+c+s.length;i.addMark(n.from+c,f,t.type.create(r||{})),i.removeStoredMark(t.type)}}})}function va(t){return new _i({find:t.find,handler:({state:e,range:n,match:o})=>{const r=ve(t.getAttributes,void 0,o)||{},{tr:i}=e,s=n.from;let l=n.to;const c=t.type.create(r);if(o[1]){const u=o[0].lastIndexOf(o[1]);let d=s+u;d>l?d=l:l=d+o[1].length;const p=o[0][o[0].length-1];i.insertText(p,s+o[0].length-1),i.replaceWith(d,l,c)}else if(o[0]){const u=t.type.isInline?s:s-1;i.insert(u,t.type.create(r)).delete(i.mapping.map(s),i.mapping.map(l))}i.scrollIntoView()}})}function Vl(t){return new _i({find:t.find,handler:({state:e,range:n,match:o})=>{const r=e.doc.resolve(n.from),i=ve(t.getAttributes,void 0,o)||{};if(!r.node(-1).canReplaceWith(r.index(-1),r.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)}})}function et(t){return new _i({find:t.find,handler:({state:e,range:n,match:o})=>{let r=t.replace,i=n.from;const s=n.to;if(o[1]){const l=o[0].lastIndexOf(o[1]);r+=o[0].slice(l+o[1].length),i+=l;const c=i-s;c>0&&(r=o[0].slice(l-c,l)+r,i=s)}e.tr.insertText(r,i,s)}})}function mr(t){return new _i({find:t.find,handler:({state:e,range:n,match:o,chain:r})=>{const i=ve(t.getAttributes,void 0,o)||{},s=e.tr.delete(n.from,n.to),c=s.doc.resolve(n.from).blockRange(),u=c&&dc(c,t.type,i);if(!u)return null;if(s.wrap(c,u),t.keepMarks&&t.editor){const{selection:p,storedMarks:f}=e,{splittableMarks:h}=t.editor.extensionManager,m=f||p.$to.parentOffset&&p.$from.marks();if(m){const g=m.filter(b=>h.includes(b.type.name));s.ensureMarks(g)}}if(t.keepAttributes){const p=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";r().updateAttributes(p,i).run()}const d=s.doc.resolve(n.from-1).nodeBefore;d&&d.type===t.type&&wo(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(o,d))&&s.join(n.from-1)}})}class ze{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=ve(j(this,"addOptions",{name:this.name}))),this.storage=ve(j(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new ze(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>ma(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new ze(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=ve(j(n,"addOptions",{name:n.name})),n.storage=ve(j(n,"addStorage",{name:n.name,options:n.options})),n}}class RE{constructor(e,n,o){this.isDragging=!1,this.component=e,this.editor=n.editor,this.options={stopEvent:null,ignoreMutation:null,...o},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,o,r,i,s,l,c;const{view:u}=this.editor,d=e.target,p=d.nodeType===3?(n=d.parentElement)===null||n===void 0?void 0:n.closest("[data-drag-handle]"):d.closest("[data-drag-handle]");if(!this.dom||!((o=this.contentDOM)===null||o===void 0)&&o.contains(d)||!p)return;let f=0,h=0;if(this.dom!==p){const y=this.dom.getBoundingClientRect(),k=p.getBoundingClientRect(),E=(r=e.offsetX)!==null&&r!==void 0?r:(i=e.nativeEvent)===null||i===void 0?void 0:i.offsetX,v=(s=e.offsetY)!==null&&s!==void 0?s:(l=e.nativeEvent)===null||l===void 0?void 0:l.offsetY;f=k.x-y.x+E,h=k.y-y.y+v}(c=e.dataTransfer)===null||c===void 0||c.setDragImage(this.dom,f,h);const m=this.getPos();if(typeof m!="number")return;const g=oe.create(u.state.doc,m),b=u.state.tr.setSelection(g);u.dispatch(b)}stopEvent(e){var n;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:e});const o=e.target;if(!(this.dom.contains(o)&&!(!((n=this.contentDOM)===null||n===void 0)&&n.contains(o))))return!1;const i=e.type.startsWith("drag"),s=e.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(o.tagName)||o.isContentEditable)&&!s&&!i)return!0;const{isEditable:c}=this.editor,{isDragging:u}=this,d=!!this.node.type.spec.draggable,p=oe.isSelectable(this.node),f=e.type==="copy",h=e.type==="paste",m=e.type==="cut",g=e.type==="mousedown";if(!d&&p&&i&&e.target===this.dom&&e.preventDefault(),d&&i&&!u&&e.target===this.dom)return e.preventDefault(),!1;if(d&&c&&!u&&g){const b=o.closest("[data-drag-handle]");b&&(this.dom===b||this.dom.contains(b))&&(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!(u||s||f||h||m||g&&p)}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"&&(ba()||Mh())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(o=>o.isContentEditable)?!1:this.contentDOM===e.target&&e.type==="attributes"?!0:!this.contentDOM.contains(e.target)}updateAttributes(e){this.editor.commands.command(({tr:n})=>{const o=this.getPos();return typeof o!="number"?!1:(n.setNodeMarkup(o,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 ko(t){return new Xk({find:t.find,handler:({state:e,range:n,match:o,pasteEvent:r})=>{const i=ve(t.getAttributes,void 0,o,r);if(i===!1||i===null)return null;const{tr:s}=e,l=o[o.length-1],c=o[0];let u=n.to;if(l){const d=c.search(/\S/),p=n.from+c.indexOf(l),f=p+l.length;if(Bc(n.from,n.to,e.doc).filter(m=>m.mark.type.excluded.find(b=>b===t.type&&b!==m.mark.type)).filter(m=>m.to>p).length)return null;f<n.to&&s.delete(f,n.to),p>n.from&&s.delete(n.from+d,p),u=n.from+d+l.length,s.addMark(n.from+d,u,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}function Fh(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var zt="top",cn="bottom",un="right",Ht="left",Ic="auto",Ci=[zt,cn,un,Ht],gr="start",ui="end",BE="clippingParents",Vh="viewport",Rr="popper",DE="reference",Pd=Ci.reduce(function(t,e){return t.concat([e+"-"+gr,e+"-"+ui])},[]),zh=[].concat(Ci,[Ic]).reduce(function(t,e){return t.concat([e,e+"-"+gr,e+"-"+ui])},[]),IE="beforeRead",LE="read",PE="afterRead",$E="beforeMain",FE="main",VE="afterMain",zE="beforeWrite",HE="write",UE="afterWrite",qE=[IE,LE,PE,$E,FE,VE,zE,HE,UE];function In(t){return t?(t.nodeName||"").toLowerCase():null}function Xt(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function jo(t){var e=Xt(t).Element;return t instanceof e||t instanceof Element}function an(t){var e=Xt(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function Lc(t){if(typeof ShadowRoot>"u")return!1;var e=Xt(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function KE(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var o=e.styles[n]||{},r=e.attributes[n]||{},i=e.elements[n];!an(i)||!In(i)||(Object.assign(i.style,o),Object.keys(r).forEach(function(s){var l=r[s];l===!1?i.removeAttribute(s):i.setAttribute(s,l===!0?"":l)}))})}function WE(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(o){var r=e.elements[o],i=e.attributes[o]||{},s=Object.keys(e.styles.hasOwnProperty(o)?e.styles[o]:n[o]),l=s.reduce(function(c,u){return c[u]="",c},{});!an(r)||!In(r)||(Object.assign(r.style,l),Object.keys(i).forEach(function(c){r.removeAttribute(c)}))})}}const Hh={name:"applyStyles",enabled:!0,phase:"write",fn:KE,effect:WE,requires:["computeStyles"]};function Rn(t){return t.split("-")[0]}var Fo=Math.max,xs=Math.min,br=Math.round;function zl(){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 Uh(){return!/^((?!chrome|android).)*safari/i.test(zl())}function yr(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var o=t.getBoundingClientRect(),r=1,i=1;e&&an(t)&&(r=t.offsetWidth>0&&br(o.width)/t.offsetWidth||1,i=t.offsetHeight>0&&br(o.height)/t.offsetHeight||1);var s=jo(t)?Xt(t):window,l=s.visualViewport,c=!Uh()&&n,u=(o.left+(c&&l?l.offsetLeft:0))/r,d=(o.top+(c&&l?l.offsetTop:0))/i,p=o.width/r,f=o.height/i;return{width:p,height:f,top:d,right:u+p,bottom:d+f,left:u,x:u,y:d}}function Pc(t){var e=yr(t),n=t.offsetWidth,o=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-o)<=1&&(o=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:o}}function qh(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&Lc(n)){var o=e;do{if(o&&t.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function Xn(t){return Xt(t).getComputedStyle(t)}function jE(t){return["table","td","th"].indexOf(In(t))>=0}function Co(t){return((jo(t)?t.ownerDocument:t.document)||window.document).documentElement}function ka(t){return In(t)==="html"?t:t.assignedSlot||t.parentNode||(Lc(t)?t.host:null)||Co(t)}function $d(t){return!an(t)||Xn(t).position==="fixed"?null:t.offsetParent}function GE(t){var e=/firefox/i.test(zl()),n=/Trident/i.test(zl());if(n&&an(t)){var o=Xn(t);if(o.position==="fixed")return null}var r=ka(t);for(Lc(r)&&(r=r.host);an(r)&&["html","body"].indexOf(In(r))<0;){var i=Xn(r);if(i.transform!=="none"||i.perspective!=="none"||i.contain==="paint"||["transform","perspective"].indexOf(i.willChange)!==-1||e&&i.willChange==="filter"||e&&i.filter&&i.filter!=="none")return r;r=r.parentNode}return null}function Si(t){for(var e=Xt(t),n=$d(t);n&&jE(n)&&Xn(n).position==="static";)n=$d(n);return n&&(In(n)==="html"||In(n)==="body"&&Xn(n).position==="static")?e:n||GE(t)||e}function $c(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function qr(t,e,n){return Fo(t,xs(e,n))}function YE(t,e,n){var o=qr(t,e,n);return o>n?n:o}function Kh(){return{top:0,right:0,bottom:0,left:0}}function Wh(t){return Object.assign({},Kh(),t)}function jh(t,e){return e.reduce(function(n,o){return n[o]=t,n},{})}var JE=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,Wh(typeof e!="number"?e:jh(e,Ci))};function XE(t){var e,n=t.state,o=t.name,r=t.options,i=n.elements.arrow,s=n.modifiersData.popperOffsets,l=Rn(n.placement),c=$c(l),u=[Ht,un].indexOf(l)>=0,d=u?"height":"width";if(!(!i||!s)){var p=JE(r.padding,n),f=Pc(i),h=c==="y"?zt:Ht,m=c==="y"?cn:un,g=n.rects.reference[d]+n.rects.reference[c]-s[c]-n.rects.popper[d],b=s[c]-n.rects.reference[c],y=Si(i),k=y?c==="y"?y.clientHeight||0:y.clientWidth||0:0,E=g/2-b/2,v=p[h],C=k-f[d]-p[m],_=k/2-f[d]/2+E,R=qr(v,_,C),B=c;n.modifiersData[o]=(e={},e[B]=R,e.centerOffset=R-_,e)}}function ZE(t){var e=t.state,n=t.options,o=n.element,r=o===void 0?"[data-popper-arrow]":o;r!=null&&(typeof r=="string"&&(r=e.elements.popper.querySelector(r),!r)||qh(e.elements.popper,r)&&(e.elements.arrow=r))}const QE={name:"arrow",enabled:!0,phase:"main",fn:XE,effect:ZE,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function vr(t){return t.split("-")[1]}var e0={top:"auto",right:"auto",bottom:"auto",left:"auto"};function t0(t,e){var n=t.x,o=t.y,r=e.devicePixelRatio||1;return{x:br(n*r)/r||0,y:br(o*r)/r||0}}function Fd(t){var e,n=t.popper,o=t.popperRect,r=t.placement,i=t.variation,s=t.offsets,l=t.position,c=t.gpuAcceleration,u=t.adaptive,d=t.roundOffsets,p=t.isFixed,f=s.x,h=f===void 0?0:f,m=s.y,g=m===void 0?0:m,b=typeof d=="function"?d({x:h,y:g}):{x:h,y:g};h=b.x,g=b.y;var y=s.hasOwnProperty("x"),k=s.hasOwnProperty("y"),E=Ht,v=zt,C=window;if(u){var _=Si(n),R="clientHeight",B="clientWidth";if(_===Xt(n)&&(_=Co(n),Xn(_).position!=="static"&&l==="absolute"&&(R="scrollHeight",B="scrollWidth")),_=_,r===zt||(r===Ht||r===un)&&i===ui){v=cn;var N=p&&_===C&&C.visualViewport?C.visualViewport.height:_[R];g-=N-o.height,g*=c?1:-1}if(r===Ht||(r===zt||r===cn)&&i===ui){E=un;var M=p&&_===C&&C.visualViewport?C.visualViewport.width:_[B];h-=M-o.width,h*=c?1:-1}}var z=Object.assign({position:l},u&&e0),G=d===!0?t0({x:h,y:g},Xt(n)):{x:h,y:g};if(h=G.x,g=G.y,c){var $;return Object.assign({},z,($={},$[v]=k?"0":"",$[E]=y?"0":"",$.transform=(C.devicePixelRatio||1)<=1?"translate("+h+"px, "+g+"px)":"translate3d("+h+"px, "+g+"px, 0)",$))}return Object.assign({},z,(e={},e[v]=k?g+"px":"",e[E]=y?h+"px":"",e.transform="",e))}function n0(t){var e=t.state,n=t.options,o=n.gpuAcceleration,r=o===void 0?!0:o,i=n.adaptive,s=i===void 0?!0:i,l=n.roundOffsets,c=l===void 0?!0:l,u={placement:Rn(e.placement),variation:vr(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:r,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,Fd(Object.assign({},u,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:c})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Fd(Object.assign({},u,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const o0={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:n0,data:{}};var Pi={passive:!0};function r0(t){var e=t.state,n=t.instance,o=t.options,r=o.scroll,i=r===void 0?!0:r,s=o.resize,l=s===void 0?!0:s,c=Xt(e.elements.popper),u=[].concat(e.scrollParents.reference,e.scrollParents.popper);return i&&u.forEach(function(d){d.addEventListener("scroll",n.update,Pi)}),l&&c.addEventListener("resize",n.update,Pi),function(){i&&u.forEach(function(d){d.removeEventListener("scroll",n.update,Pi)}),l&&c.removeEventListener("resize",n.update,Pi)}}const i0={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:r0,data:{}};var s0={left:"right",right:"left",bottom:"top",top:"bottom"};function as(t){return t.replace(/left|right|bottom|top/g,function(e){return s0[e]})}var a0={start:"end",end:"start"};function Vd(t){return t.replace(/start|end/g,function(e){return a0[e]})}function Fc(t){var e=Xt(t),n=e.pageXOffset,o=e.pageYOffset;return{scrollLeft:n,scrollTop:o}}function Vc(t){return yr(Co(t)).left+Fc(t).scrollLeft}function l0(t,e){var n=Xt(t),o=Co(t),r=n.visualViewport,i=o.clientWidth,s=o.clientHeight,l=0,c=0;if(r){i=r.width,s=r.height;var u=Uh();(u||!u&&e==="fixed")&&(l=r.offsetLeft,c=r.offsetTop)}return{width:i,height:s,x:l+Vc(t),y:c}}function c0(t){var e,n=Co(t),o=Fc(t),r=(e=t.ownerDocument)==null?void 0:e.body,i=Fo(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),s=Fo(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),l=-o.scrollLeft+Vc(t),c=-o.scrollTop;return Xn(r||n).direction==="rtl"&&(l+=Fo(n.clientWidth,r?r.clientWidth:0)-i),{width:i,height:s,x:l,y:c}}function zc(t){var e=Xn(t),n=e.overflow,o=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+r+o)}function Gh(t){return["html","body","#document"].indexOf(In(t))>=0?t.ownerDocument.body:an(t)&&zc(t)?t:Gh(ka(t))}function Kr(t,e){var n;e===void 0&&(e=[]);var o=Gh(t),r=o===((n=t.ownerDocument)==null?void 0:n.body),i=Xt(o),s=r?[i].concat(i.visualViewport||[],zc(o)?o:[]):o,l=e.concat(s);return r?l:l.concat(Kr(ka(s)))}function Hl(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function u0(t,e){var n=yr(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 zd(t,e,n){return e===Vh?Hl(l0(t,n)):jo(e)?u0(e,n):Hl(c0(Co(t)))}function d0(t){var e=Kr(ka(t)),n=["absolute","fixed"].indexOf(Xn(t).position)>=0,o=n&&an(t)?Si(t):t;return jo(o)?e.filter(function(r){return jo(r)&&qh(r,o)&&In(r)!=="body"}):[]}function p0(t,e,n,o){var r=e==="clippingParents"?d0(t):[].concat(e),i=[].concat(r,[n]),s=i[0],l=i.reduce(function(c,u){var d=zd(t,u,o);return c.top=Fo(d.top,c.top),c.right=xs(d.right,c.right),c.bottom=xs(d.bottom,c.bottom),c.left=Fo(d.left,c.left),c},zd(t,s,o));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function Yh(t){var e=t.reference,n=t.element,o=t.placement,r=o?Rn(o):null,i=o?vr(o):null,s=e.x+e.width/2-n.width/2,l=e.y+e.height/2-n.height/2,c;switch(r){case zt:c={x:s,y:e.y-n.height};break;case cn:c={x:s,y:e.y+e.height};break;case un:c={x:e.x+e.width,y:l};break;case Ht:c={x:e.x-n.width,y:l};break;default:c={x:e.x,y:e.y}}var u=r?$c(r):null;if(u!=null){var d=u==="y"?"height":"width";switch(i){case gr:c[u]=c[u]-(e[d]/2-n[d]/2);break;case ui:c[u]=c[u]+(e[d]/2-n[d]/2);break}}return c}function di(t,e){e===void 0&&(e={});var n=e,o=n.placement,r=o===void 0?t.placement:o,i=n.strategy,s=i===void 0?t.strategy:i,l=n.boundary,c=l===void 0?BE:l,u=n.rootBoundary,d=u===void 0?Vh:u,p=n.elementContext,f=p===void 0?Rr:p,h=n.altBoundary,m=h===void 0?!1:h,g=n.padding,b=g===void 0?0:g,y=Wh(typeof b!="number"?b:jh(b,Ci)),k=f===Rr?DE:Rr,E=t.rects.popper,v=t.elements[m?k:f],C=p0(jo(v)?v:v.contextElement||Co(t.elements.popper),c,d,s),_=yr(t.elements.reference),R=Yh({reference:_,element:E,placement:r}),B=Hl(Object.assign({},E,R)),N=f===Rr?B:_,M={top:C.top-N.top+y.top,bottom:N.bottom-C.bottom+y.bottom,left:C.left-N.left+y.left,right:N.right-C.right+y.right},z=t.modifiersData.offset;if(f===Rr&&z){var G=z[r];Object.keys(M).forEach(function($){var U=[un,cn].indexOf($)>=0?1:-1,q=[zt,cn].indexOf($)>=0?"y":"x";M[$]+=G[q]*U})}return M}function f0(t,e){e===void 0&&(e={});var n=e,o=n.placement,r=n.boundary,i=n.rootBoundary,s=n.padding,l=n.flipVariations,c=n.allowedAutoPlacements,u=c===void 0?zh:c,d=vr(o),p=d?l?Pd:Pd.filter(function(m){return vr(m)===d}):Ci,f=p.filter(function(m){return u.indexOf(m)>=0});f.length===0&&(f=p);var h=f.reduce(function(m,g){return m[g]=di(t,{placement:g,boundary:r,rootBoundary:i,padding:s})[Rn(g)],m},{});return Object.keys(h).sort(function(m,g){return h[m]-h[g]})}function h0(t){if(Rn(t)===Ic)return[];var e=as(t);return[Vd(t),e,Vd(e)]}function m0(t){var e=t.state,n=t.options,o=t.name;if(!e.modifiersData[o]._skip){for(var r=n.mainAxis,i=r===void 0?!0:r,s=n.altAxis,l=s===void 0?!0:s,c=n.fallbackPlacements,u=n.padding,d=n.boundary,p=n.rootBoundary,f=n.altBoundary,h=n.flipVariations,m=h===void 0?!0:h,g=n.allowedAutoPlacements,b=e.options.placement,y=Rn(b),k=y===b,E=c||(k||!m?[as(b)]:h0(b)),v=[b].concat(E).reduce(function(ot,Re){return ot.concat(Rn(Re)===Ic?f0(e,{placement:Re,boundary:d,rootBoundary:p,padding:u,flipVariations:m,allowedAutoPlacements:g}):Re)},[]),C=e.rects.reference,_=e.rects.popper,R=new Map,B=!0,N=v[0],M=0;M<v.length;M++){var z=v[M],G=Rn(z),$=vr(z)===gr,U=[zt,cn].indexOf(G)>=0,q=U?"width":"height",ee=di(e,{placement:z,boundary:d,rootBoundary:p,altBoundary:f,padding:u}),S=U?$?un:Ht:$?cn:zt;C[q]>_[q]&&(S=as(S));var O=as(S),F=[];if(i&&F.push(ee[G]<=0),l&&F.push(ee[S]<=0,ee[O]<=0),F.every(function(ot){return ot})){N=z,B=!1;break}R.set(z,F)}if(B)for(var J=m?3:1,Q=function(Re){var X=v.find(function(be){var ke=R.get(be);if(ke)return ke.slice(0,Re).every(function(Ye){return Ye})});if(X)return N=X,"break"},ce=J;ce>0;ce--){var Ce=Q(ce);if(Ce==="break")break}e.placement!==N&&(e.modifiersData[o]._skip=!0,e.placement=N,e.reset=!0)}}const g0={name:"flip",enabled:!0,phase:"main",fn:m0,requiresIfExists:["offset"],data:{_skip:!1}};function Hd(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 Ud(t){return[zt,un,cn,Ht].some(function(e){return t[e]>=0})}function b0(t){var e=t.state,n=t.name,o=e.rects.reference,r=e.rects.popper,i=e.modifiersData.preventOverflow,s=di(e,{elementContext:"reference"}),l=di(e,{altBoundary:!0}),c=Hd(s,o),u=Hd(l,r,i),d=Ud(c),p=Ud(u);e.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:u,isReferenceHidden:d,hasPopperEscaped:p},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":p})}const y0={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:b0};function v0(t,e,n){var o=Rn(t),r=[Ht,zt].indexOf(o)>=0?-1:1,i=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,s=i[0],l=i[1];return s=s||0,l=(l||0)*r,[Ht,un].indexOf(o)>=0?{x:l,y:s}:{x:s,y:l}}function k0(t){var e=t.state,n=t.options,o=t.name,r=n.offset,i=r===void 0?[0,0]:r,s=zh.reduce(function(d,p){return d[p]=v0(p,e.rects,i),d},{}),l=s[e.placement],c=l.x,u=l.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=c,e.modifiersData.popperOffsets.y+=u),e.modifiersData[o]=s}const w0={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:k0};function E0(t){var e=t.state,n=t.name;e.modifiersData[n]=Yh({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})}const _0={name:"popperOffsets",enabled:!0,phase:"read",fn:E0,data:{}};function C0(t){return t==="x"?"y":"x"}function S0(t){var e=t.state,n=t.options,o=t.name,r=n.mainAxis,i=r===void 0?!0:r,s=n.altAxis,l=s===void 0?!1:s,c=n.boundary,u=n.rootBoundary,d=n.altBoundary,p=n.padding,f=n.tether,h=f===void 0?!0:f,m=n.tetherOffset,g=m===void 0?0:m,b=di(e,{boundary:c,rootBoundary:u,padding:p,altBoundary:d}),y=Rn(e.placement),k=vr(e.placement),E=!k,v=$c(y),C=C0(v),_=e.modifiersData.popperOffsets,R=e.rects.reference,B=e.rects.popper,N=typeof g=="function"?g(Object.assign({},e.rects,{placement:e.placement})):g,M=typeof N=="number"?{mainAxis:N,altAxis:N}:Object.assign({mainAxis:0,altAxis:0},N),z=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,G={x:0,y:0};if(_){if(i){var $,U=v==="y"?zt:Ht,q=v==="y"?cn:un,ee=v==="y"?"height":"width",S=_[v],O=S+b[U],F=S-b[q],J=h?-B[ee]/2:0,Q=k===gr?R[ee]:B[ee],ce=k===gr?-B[ee]:-R[ee],Ce=e.elements.arrow,ot=h&&Ce?Pc(Ce):{width:0,height:0},Re=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Kh(),X=Re[U],be=Re[q],ke=qr(0,R[ee],ot[ee]),Ye=E?R[ee]/2-J-ke-X-M.mainAxis:Q-ke-X-M.mainAxis,tt=E?-R[ee]/2+J+ke+be+M.mainAxis:ce+ke+be+M.mainAxis,en=e.elements.arrow&&Si(e.elements.arrow),En=en?v==="y"?en.clientTop||0:en.clientLeft||0:0,fn=($=z==null?void 0:z[v])!=null?$:0,qt=S+Ye-fn-En,hn=S+tt-fn,pe=qr(h?xs(O,qt):O,S,h?Fo(F,hn):F);_[v]=pe,G[v]=pe-S}if(l){var Pt,wt=v==="x"?zt:Ht,se=v==="x"?cn:un,Tt=_[C],$e=C==="y"?"height":"width",Oe=Tt+b[wt],Ot=Tt-b[se],nt=[zt,Ht].indexOf(y)!==-1,mn=(Pt=z==null?void 0:z[C])!=null?Pt:0,Mt=nt?Oe:Tt-R[$e]-B[$e]-mn+M.altAxis,L=nt?Tt+R[$e]+B[$e]-mn-M.altAxis:Ot,K=h&&nt?YE(Mt,Tt,L):qr(h?Mt:Oe,Tt,h?L:Ot);_[C]=K,G[C]=K-Tt}e.modifiersData[o]=G}}const x0={name:"preventOverflow",enabled:!0,phase:"main",fn:S0,requiresIfExists:["offset"]};function N0(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function T0(t){return t===Xt(t)||!an(t)?Fc(t):N0(t)}function O0(t){var e=t.getBoundingClientRect(),n=br(e.width)/t.offsetWidth||1,o=br(e.height)/t.offsetHeight||1;return n!==1||o!==1}function M0(t,e,n){n===void 0&&(n=!1);var o=an(e),r=an(e)&&O0(e),i=Co(e),s=yr(t,r,n),l={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(o||!o&&!n)&&((In(e)!=="body"||zc(i))&&(l=T0(e)),an(e)?(c=yr(e,!0),c.x+=e.clientLeft,c.y+=e.clientTop):i&&(c.x=Vc(i))),{x:s.left+l.scrollLeft-c.x,y:s.top+l.scrollTop-c.y,width:s.width,height:s.height}}function A0(t){var e=new Map,n=new Set,o=[];t.forEach(function(i){e.set(i.name,i)});function r(i){n.add(i.name);var s=[].concat(i.requires||[],i.requiresIfExists||[]);s.forEach(function(l){if(!n.has(l)){var c=e.get(l);c&&r(c)}}),o.push(i)}return t.forEach(function(i){n.has(i.name)||r(i)}),o}function R0(t){var e=A0(t);return qE.reduce(function(n,o){return n.concat(e.filter(function(r){return r.phase===o}))},[])}function B0(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function D0(t){var e=t.reduce(function(n,o){var r=n[o.name];return n[o.name]=r?Object.assign({},r,o,{options:Object.assign({},r.options,o.options),data:Object.assign({},r.data,o.data)}):o,n},{});return Object.keys(e).map(function(n){return e[n]})}var qd={placement:"bottom",modifiers:[],strategy:"absolute"};function Kd(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return!e.some(function(o){return!(o&&typeof o.getBoundingClientRect=="function")})}function I0(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,o=n===void 0?[]:n,r=e.defaultOptions,i=r===void 0?qd:r;return function(l,c,u){u===void 0&&(u=i);var d={placement:"bottom",orderedModifiers:[],options:Object.assign({},qd,i),modifiersData:{},elements:{reference:l,popper:c},attributes:{},styles:{}},p=[],f=!1,h={state:d,setOptions:function(y){var k=typeof y=="function"?y(d.options):y;g(),d.options=Object.assign({},i,d.options,k),d.scrollParents={reference:jo(l)?Kr(l):l.contextElement?Kr(l.contextElement):[],popper:Kr(c)};var E=R0(D0([].concat(o,d.options.modifiers)));return d.orderedModifiers=E.filter(function(v){return v.enabled}),m(),h.update()},forceUpdate:function(){if(!f){var y=d.elements,k=y.reference,E=y.popper;if(Kd(k,E)){d.rects={reference:M0(k,Si(E),d.options.strategy==="fixed"),popper:Pc(E)},d.reset=!1,d.placement=d.options.placement,d.orderedModifiers.forEach(function(M){return d.modifiersData[M.name]=Object.assign({},M.data)});for(var v=0;v<d.orderedModifiers.length;v++){if(d.reset===!0){d.reset=!1,v=-1;continue}var C=d.orderedModifiers[v],_=C.fn,R=C.options,B=R===void 0?{}:R,N=C.name;typeof _=="function"&&(d=_({state:d,options:B,name:N,instance:h})||d)}}}},update:B0(function(){return new Promise(function(b){h.forceUpdate(),b(d)})}),destroy:function(){g(),f=!0}};if(!Kd(l,c))return h;h.setOptions(u).then(function(b){!f&&u.onFirstUpdate&&u.onFirstUpdate(b)});function m(){d.orderedModifiers.forEach(function(b){var y=b.name,k=b.options,E=k===void 0?{}:k,v=b.effect;if(typeof v=="function"){var C=v({state:d,name:y,instance:h,options:E}),_=function(){};p.push(C||_)}})}function g(){p.forEach(function(b){return b()}),p=[]}return h}}var L0=[i0,_0,o0,Hh,w0,g0,x0,QE,y0],P0=I0({defaultModifiers:L0}),$0="tippy-box",Jh="tippy-content",F0="tippy-backdrop",Xh="tippy-arrow",Zh="tippy-svg-arrow",To={passive:!0,capture:!0},Qh=function(){return document.body};function V0(t,e){return{}.hasOwnProperty.call(t,e)}function el(t,e,n){if(Array.isArray(t)){var o=t[e];return o??(Array.isArray(n)?n[e]:n)}return t}function Hc(t,e){var n={}.toString.call(t);return n.indexOf("[object")===0&&n.indexOf(e+"]")>-1}function em(t,e){return typeof t=="function"?t.apply(void 0,e):t}function Wd(t,e){if(e===0)return t;var n;return function(o){clearTimeout(n),n=setTimeout(function(){t(o)},e)}}function z0(t,e){var n=Object.assign({},t);return e.forEach(function(o){delete n[o]}),n}function H0(t){return t.split(/\s+/).filter(Boolean)}function or(t){return[].concat(t)}function jd(t,e){t.indexOf(e)===-1&&t.push(e)}function U0(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function q0(t){return t.split("-")[0]}function Ns(t){return[].slice.call(t)}function Gd(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function Wr(){return document.createElement("div")}function pi(t){return["Element","Fragment"].some(function(e){return Hc(t,e)})}function K0(t){return Hc(t,"NodeList")}function W0(t){return Hc(t,"MouseEvent")}function j0(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function G0(t){return pi(t)?[t]:K0(t)?Ns(t):Array.isArray(t)?t:Ns(document.querySelectorAll(t))}function tl(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function Yd(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function Y0(t){var e,n=or(t),o=n[0];return o!=null&&(e=o.ownerDocument)!=null&&e.body?o.ownerDocument:document}function J0(t,e){var n=e.clientX,o=e.clientY;return t.every(function(r){var i=r.popperRect,s=r.popperState,l=r.props,c=l.interactiveBorder,u=q0(s.placement),d=s.modifiersData.offset;if(!d)return!0;var p=u==="bottom"?d.top.y:0,f=u==="top"?d.bottom.y:0,h=u==="right"?d.left.x:0,m=u==="left"?d.right.x:0,g=i.top-o+p>c,b=o-i.bottom-f>c,y=i.left-n+h>c,k=n-i.right-m>c;return g||b||y||k})}function nl(t,e,n){var o=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(r){t[o](r,n)})}function Jd(t,e){for(var n=e;n;){var o;if(t.contains(n))return!0;n=n.getRootNode==null||(o=n.getRootNode())==null?void 0:o.host}return!1}var On={isTouch:!1},Xd=0;function X0(){On.isTouch||(On.isTouch=!0,window.performance&&document.addEventListener("mousemove",tm))}function tm(){var t=performance.now();t-Xd<20&&(On.isTouch=!1,document.removeEventListener("mousemove",tm)),Xd=t}function Z0(){var t=document.activeElement;if(j0(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function Q0(){document.addEventListener("touchstart",X0,To),window.addEventListener("blur",Z0)}var e_=typeof window<"u"&&typeof document<"u",t_=e_?!!window.msCrypto:!1;function Qo(t){var e=t==="destroy"?"n already-":" ";return[t+"() was called on a"+e+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function Zd(t){var e=/[ \t]{2,}/g,n=/^[ \t]*/gm;return t.replace(e," ").replace(n,"").trim()}function n_(t){return Zd(`
93
93
  %ctippy.js
94
94
 
95
- %c`+zu(t)+`
95
+ %c`+Zd(t)+`
96
96
 
97
97
  %c👷‍ This is a development-only message. It will be removed in production.
98
- `)}function Uh(t){return[R0(t),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var li;process.env.NODE_ENV!=="production"&&D0();function D0(){li=new Set}function Hn(t,e){if(t&&!li.has(e)){var n;li.add(e),(n=console).warn.apply(n,Uh(e))}}function Fl(t,e){if(t&&!li.has(e)){var n;li.add(e),(n=console).error.apply(n,Uh(e))}}function I0(t){var e=!t,n=Object.prototype.toString.call(t)==="[object Object]"&&!t.addEventListener;Fl(e,["tippy() was passed","`"+String(t)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),Fl(n,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}var qh={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},B0={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Wt=Object.assign({appendTo:Vh,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},qh,B0),L0=Object.keys(Wt),P0=function(e){process.env.NODE_ENV!=="production"&&Kh(e,[]);var n=Object.keys(e);n.forEach(function(o){Wt[o]=e[o]})};function Wh(t){var e=t.plugins||[],n=e.reduce(function(o,r){var i=r.name,s=r.defaultValue;if(i){var a;o[i]=t[i]!==void 0?t[i]:(a=Wt[i])!=null?a:s}return o},{});return Object.assign({},t,n)}function $0(t,e){var n=e?Object.keys(Wh(Object.assign({},Wt,{plugins:e}))):L0,o=n.reduce(function(r,i){var s=(t.getAttribute("data-tippy-"+i)||"").trim();if(!s)return r;if(i==="content")r[i]=s;else try{r[i]=JSON.parse(s)}catch{r[i]=s}return r},{});return o}function Hu(t,e){var n=Object.assign({},e,{content:zh(e.content,[t])},e.ignoreAttributes?{}:$0(t,e.plugins));return n.aria=Object.assign({},Wt.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}function Kh(t,e){t===void 0&&(t={}),e===void 0&&(e=[]);var n=Object.keys(t);n.forEach(function(o){var r=b0(Wt,Object.keys(qh)),i=!g0(r,o);i&&(i=e.filter(function(s){return s.name===o}).length===0),Hn(i,["`"+o+"`","is not a valid prop. You may have spelled it incorrectly, or if it's","a plugin, forgot to pass it in an array as props.plugins.",`
98
+ `)}function nm(t){return[n_(t),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var fi;process.env.NODE_ENV!=="production"&&o_();function o_(){fi=new Set}function Wn(t,e){if(t&&!fi.has(e)){var n;fi.add(e),(n=console).warn.apply(n,nm(e))}}function Ul(t,e){if(t&&!fi.has(e)){var n;fi.add(e),(n=console).error.apply(n,nm(e))}}function r_(t){var e=!t,n=Object.prototype.toString.call(t)==="[object Object]"&&!t.addEventListener;Ul(e,["tippy() was passed","`"+String(t)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),Ul(n,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}var om={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},i_={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Gt=Object.assign({appendTo:Qh,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},om,i_),s_=Object.keys(Gt),a_=function(e){process.env.NODE_ENV!=="production"&&im(e,[]);var n=Object.keys(e);n.forEach(function(o){Gt[o]=e[o]})};function rm(t){var e=t.plugins||[],n=e.reduce(function(o,r){var i=r.name,s=r.defaultValue;if(i){var l;o[i]=t[i]!==void 0?t[i]:(l=Gt[i])!=null?l:s}return o},{});return Object.assign({},t,n)}function l_(t,e){var n=e?Object.keys(rm(Object.assign({},Gt,{plugins:e}))):s_,o=n.reduce(function(r,i){var s=(t.getAttribute("data-tippy-"+i)||"").trim();if(!s)return r;if(i==="content")r[i]=s;else try{r[i]=JSON.parse(s)}catch{r[i]=s}return r},{});return o}function Qd(t,e){var n=Object.assign({},e,{content:em(e.content,[t])},e.ignoreAttributes?{}:l_(t,e.plugins));return n.aria=Object.assign({},Gt.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}function im(t,e){t===void 0&&(t={}),e===void 0&&(e=[]);var n=Object.keys(t);n.forEach(function(o){var r=z0(Gt,Object.keys(om)),i=!V0(r,o);i&&(i=e.filter(function(s){return s.name===o}).length===0),Wn(i,["`"+o+"`","is not a valid prop. You may have spelled it incorrectly, or if it's","a plugin, forgot to pass it in an array as props.plugins.",`
99
99
 
100
100
  `,`All props: https://atomiks.github.io/tippyjs/v6/all-props/
101
- `,"Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))})}var F0=function(){return"innerHTML"};function Vl(t,e){t[F0()]=e}function Uu(t){var e=Hr();return t===!0?e.className=$h:(e.className=Fh,ai(t)?e.appendChild(t):Vl(e,t)),e}function qu(t,e){ai(e.content)?(Vl(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Vl(t,e.content):t.textContent=e.content)}function zl(t){var e=t.firstElementChild,n=ws(e.children);return{box:e,content:n.find(function(o){return o.classList.contains(Ph)}),arrow:n.find(function(o){return o.classList.contains($h)||o.classList.contains(Fh)}),backdrop:n.find(function(o){return o.classList.contains(m0)})}}function jh(t){var e=Hr(),n=Hr();n.className=h0,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var o=Hr();o.className=Ph,o.setAttribute("data-state","hidden"),qu(o,t.props),e.appendChild(n),n.appendChild(o),r(t.props,t.props);function r(i,s){var a=zl(e),c=a.box,d=a.content,u=a.arrow;s.theme?c.setAttribute("data-theme",s.theme):c.removeAttribute("data-theme"),typeof s.animation=="string"?c.setAttribute("data-animation",s.animation):c.removeAttribute("data-animation"),s.inertia?c.setAttribute("data-inertia",""):c.removeAttribute("data-inertia"),c.style.maxWidth=typeof s.maxWidth=="number"?s.maxWidth+"px":s.maxWidth,s.role?c.setAttribute("role",s.role):c.removeAttribute("role"),(i.content!==s.content||i.allowHTML!==s.allowHTML)&&qu(d,t.props),s.arrow?u?i.arrow!==s.arrow&&(c.removeChild(u),c.appendChild(Uu(s.arrow))):c.appendChild(Uu(s.arrow)):u&&c.removeChild(u)}return{popper:e,onUpdate:r}}jh.$$tippy=!0;var V0=1,Ii=[],Qa=[];function z0(t,e){var n=Hu(t,Object.assign({},Wt,Wh(Pu(e)))),o,r,i,s=!1,a=!1,c=!1,d=!1,u,p,f,h=[],m=Bu(zt,n.interactiveDebounce),g,b=V0++,y=null,k=v0(n.plugins),w={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},v={id:b,reference:t,popper:Hr(),popperInstance:y,props:n,state:w,plugins:k,clearDelayTimeouts:Nt,setProps:I,setContent:z,show:ue,hide:Ee,hideWithInteractivity:Qe,enable:Je,disable:fn,unmount:Ht,destroy:Sr};if(!n.render)return process.env.NODE_ENV!=="production"&&Fl(!0,"render() function has not been supplied."),v;var _=n.render(v),C=_.popper,A=_.onUpdate;C.setAttribute("data-tippy-root",""),C.id="tippy-"+v.id,v.popper=C,t._tippy=v,C._tippy=v;var L=k.map(function(S){return S.fn(v)}),M=t.hasAttribute("aria-expanded");return Zt(),Y(),x(),O("onCreate",[v]),n.showOnCreate&&ke(),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&&ce().addEventListener("mousemove",m)}),v;function P(){var S=v.props.touch;return Array.isArray(S)?S:[S,0]}function K(){return P()[0]==="hold"}function te(){var S;return!!((S=v.props.render)!=null&&S.$$tippy)}function de(){return g||t}function ce(){var S=de().parentNode;return S?S0(S):document}function re(){return zl(C)}function ie(S){return v.state.isMounted&&!v.state.isVisible||Nn.isTouch||u&&u.type==="focus"?0:Ja(v.props.delay,S?0:1,Wt.delay)}function x(S){S===void 0&&(S=!1),C.style.pointerEvents=v.props.interactive&&!S?"":"none",C.style.zIndex=""+v.props.zIndex}function O(S,q,ne){if(ne===void 0&&(ne=!0),L.forEach(function(be){be[S]&&be[S].apply(be,q)}),ne){var _e;(_e=v.props)[S].apply(_e,q)}}function V(){var S=v.props.aria;if(S.content){var q="aria-"+S.content,ne=C.id,_e=er(v.props.triggerTarget||t);_e.forEach(function(be){var it=be.getAttribute(q);if(v.state.isVisible)be.setAttribute(q,it?it+" "+ne:ne);else{var Tt=it&&it.replace(ne,"").trim();Tt?be.setAttribute(q,Tt):be.removeAttribute(q)}})}}function Y(){if(!(M||!v.props.aria.expanded)){var S=er(v.props.triggerTarget||t);S.forEach(function(q){v.props.interactive?q.setAttribute("aria-expanded",v.state.isVisible&&q===de()?"true":"false"):q.removeAttribute("aria-expanded")})}}function Q(){ce().removeEventListener("mousemove",m),Ii=Ii.filter(function(S){return S!==m})}function fe(S){if(!(Nn.isTouch&&(c||S.type==="mousedown"))){var q=S.composedPath&&S.composedPath()[0]||S.target;if(!(v.props.interactive&&Fu(C,q))){if(er(v.props.triggerTarget||t).some(function(ne){return Fu(ne,q)})){if(Nn.isTouch||v.state.isVisible&&v.props.trigger.indexOf("click")>=0)return}else O("onClickOutside",[v,S]);v.props.hideOnClick===!0&&(v.clearDelayTimeouts(),v.hide(),a=!0,setTimeout(function(){a=!1}),v.state.isMounted||Fe())}}}function Ne(){c=!0}function rt(){c=!1}function Te(){var S=ce();S.addEventListener("mousedown",fe,!0),S.addEventListener("touchend",fe,_o),S.addEventListener("touchstart",rt,_o),S.addEventListener("touchmove",Ne,_o)}function Fe(){var S=ce();S.removeEventListener("mousedown",fe,!0),S.removeEventListener("touchend",fe,_o),S.removeEventListener("touchstart",rt,_o),S.removeEventListener("touchmove",Ne,_o)}function Vt(S,q){Xt(S,function(){!v.state.isVisible&&C.parentNode&&C.parentNode.contains(C)&&q()})}function pt(S,q){Xt(S,q)}function Xt(S,q){var ne=re().box;function _e(be){be.target===ne&&(Za(ne,"remove",_e),q())}if(S===0)return q();Za(ne,"remove",p),Za(ne,"add",_e),p=_e}function ft(S,q,ne){ne===void 0&&(ne=!1);var _e=er(v.props.triggerTarget||t);_e.forEach(function(be){be.addEventListener(S,q,ne),h.push({node:be,eventType:S,handler:q,options:ne})})}function Zt(){K()&&(ft("touchstart",un,{passive:!0}),ft("touchend",pn,{passive:!0})),y0(v.props.trigger).forEach(function(S){if(S!=="manual")switch(ft(S,un),S){case"mouseenter":ft("mouseleave",pn);break;case"focus":ft(A0?"focusout":"blur",le);break;case"focusin":ft("focusout",le);break}})}function kn(){h.forEach(function(S){var q=S.node,ne=S.eventType,_e=S.handler,be=S.options;q.removeEventListener(ne,_e,be)}),h=[]}function un(S){var q,ne=!1;if(!(!v.state.isEnabled||It(S)||a)){var _e=((q=u)==null?void 0:q.type)==="focus";u=S,g=S.currentTarget,Y(),!v.state.isVisible&&w0(S)&&Ii.forEach(function(be){return be(S)}),S.type==="click"&&(v.props.trigger.indexOf("mouseenter")<0||s)&&v.props.hideOnClick!==!1&&v.state.isVisible?ne=!0:ke(S),S.type==="click"&&(s=!ne),ne&&!_e&&xt(S)}}function zt(S){var q=S.target,ne=de().contains(q)||C.contains(q);if(!(S.type==="mousemove"&&ne)){var _e=Ie().concat(C).map(function(be){var it,Tt=be._tippy,Jn=(it=Tt.popperInstance)==null?void 0:it.state;return Jn?{popperRect:be.getBoundingClientRect(),popperState:Jn,props:n}:null}).filter(Boolean);x0(_e,S)&&(Q(),xt(S))}}function pn(S){var q=It(S)||v.props.trigger.indexOf("click")>=0&&s;if(!q){if(v.props.interactive){v.hideWithInteractivity(S);return}xt(S)}}function le(S){v.props.trigger.indexOf("focusin")<0&&S.target!==de()||v.props.interactive&&S.relatedTarget&&C.contains(S.relatedTarget)||xt(S)}function It(S){return Nn.isTouch?K()!==S.type.indexOf("touch")>=0:!1}function vt(){Z();var S=v.props,q=S.popperOptions,ne=S.placement,_e=S.offset,be=S.getReferenceClientRect,it=S.moveTransition,Tt=te()?zl(C).arrow:null,Jn=be?{getBoundingClientRect:be,contextElement:be.contextElement||de()}:t,xr={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(N){var B=N.state;if(te()){var se=re(),qe=se.box;["placement","reference-hidden","escaped"].forEach(function(Ve){Ve==="placement"?qe.setAttribute("data-placement",B.placement):B.attributes.popper["data-popper-"+Ve]?qe.setAttribute("data-"+Ve,""):qe.removeAttribute("data-"+Ve)}),B.attributes.popper={}}}},Bt=[{name:"offset",options:{offset:_e}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!it}},xr];te()&&Tt&&Bt.push({name:"arrow",options:{element:Tt,padding:3}}),Bt.push.apply(Bt,(q==null?void 0:q.modifiers)||[]),v.popperInstance=f0(Jn,C,Object.assign({},q,{placement:ne,onFirstUpdate:f,modifiers:Bt}))}function Z(){v.popperInstance&&(v.popperInstance.destroy(),v.popperInstance=null)}function St(){var S=v.props.appendTo,q,ne=de();v.props.interactive&&S===Vh||S==="parent"?q=ne.parentNode:q=zh(S,[ne]),q.contains(C)||q.appendChild(C),v.state.isMounted=!0,vt(),process.env.NODE_ENV!=="production"&&Hn(v.props.interactive&&S===Wt.appendTo&&ne.nextElementSibling!==C,["Interactive tippy element may not be accessible via keyboard","navigation because it is not directly after the reference element","in the DOM source order.",`
101
+ `,"Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))})}var c_=function(){return"innerHTML"};function ql(t,e){t[c_()]=e}function ep(t){var e=Wr();return t===!0?e.className=Xh:(e.className=Zh,pi(t)?e.appendChild(t):ql(e,t)),e}function tp(t,e){pi(e.content)?(ql(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?ql(t,e.content):t.textContent=e.content)}function Kl(t){var e=t.firstElementChild,n=Ns(e.children);return{box:e,content:n.find(function(o){return o.classList.contains(Jh)}),arrow:n.find(function(o){return o.classList.contains(Xh)||o.classList.contains(Zh)}),backdrop:n.find(function(o){return o.classList.contains(F0)})}}function sm(t){var e=Wr(),n=Wr();n.className=$0,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var o=Wr();o.className=Jh,o.setAttribute("data-state","hidden"),tp(o,t.props),e.appendChild(n),n.appendChild(o),r(t.props,t.props);function r(i,s){var l=Kl(e),c=l.box,u=l.content,d=l.arrow;s.theme?c.setAttribute("data-theme",s.theme):c.removeAttribute("data-theme"),typeof s.animation=="string"?c.setAttribute("data-animation",s.animation):c.removeAttribute("data-animation"),s.inertia?c.setAttribute("data-inertia",""):c.removeAttribute("data-inertia"),c.style.maxWidth=typeof s.maxWidth=="number"?s.maxWidth+"px":s.maxWidth,s.role?c.setAttribute("role",s.role):c.removeAttribute("role"),(i.content!==s.content||i.allowHTML!==s.allowHTML)&&tp(u,t.props),s.arrow?d?i.arrow!==s.arrow&&(c.removeChild(d),c.appendChild(ep(s.arrow))):c.appendChild(ep(s.arrow)):d&&c.removeChild(d)}return{popper:e,onUpdate:r}}sm.$$tippy=!0;var u_=1,$i=[],ol=[];function d_(t,e){var n=Qd(t,Object.assign({},Gt,rm(Gd(e)))),o,r,i,s=!1,l=!1,c=!1,u=!1,d,p,f,h=[],m=Wd(qt,n.interactiveDebounce),g,b=u_++,y=null,k=U0(n.plugins),E={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},v={id:b,reference:t,popper:Wr(),popperInstance:y,props:n,state:E,plugins:k,clearDelayTimeouts:Mt,setProps:L,setContent:K,show:fe,hide:Me,hideWithInteractivity:rt,enable:nt,disable:mn,unmount:Kt,destroy:Tr};if(!n.render)return process.env.NODE_ENV!=="production"&&Ul(!0,"render() function has not been supplied."),v;var C=n.render(v),_=C.popper,R=C.onUpdate;_.setAttribute("data-tippy-root",""),_.id="tippy-"+v.id,v.popper=_,t._tippy=v,_._tippy=v;var B=k.map(function(x){return x.fn(v)}),N=t.hasAttribute("aria-expanded");return en(),J(),S(),O("onCreate",[v]),n.showOnCreate&&Oe(),_.addEventListener("mouseenter",function(){v.props.interactive&&v.state.isVisible&&v.clearDelayTimeouts()}),_.addEventListener("mouseleave",function(){v.props.interactive&&v.props.trigger.indexOf("mouseenter")>=0&&U().addEventListener("mousemove",m)}),v;function M(){var x=v.props.touch;return Array.isArray(x)?x:[x,0]}function z(){return M()[0]==="hold"}function G(){var x;return!!((x=v.props.render)!=null&&x.$$tippy)}function $(){return g||t}function U(){var x=$().parentNode;return x?Y0(x):document}function q(){return Kl(_)}function ee(x){return v.state.isMounted&&!v.state.isVisible||On.isTouch||d&&d.type==="focus"?0:el(v.props.delay,x?0:1,Gt.delay)}function S(x){x===void 0&&(x=!1),_.style.pointerEvents=v.props.interactive&&!x?"":"none",_.style.zIndex=""+v.props.zIndex}function O(x,Y,le){if(le===void 0&&(le=!0),B.forEach(function(Ee){Ee[x]&&Ee[x].apply(Ee,Y)}),le){var Be;(Be=v.props)[x].apply(Be,Y)}}function F(){var x=v.props.aria;if(x.content){var Y="aria-"+x.content,le=_.id,Be=or(v.props.triggerTarget||t);Be.forEach(function(Ee){var ut=Ee.getAttribute(Y);if(v.state.isVisible)Ee.setAttribute(Y,ut?ut+" "+le:le);else{var At=ut&&ut.replace(le,"").trim();At?Ee.setAttribute(Y,At):Ee.removeAttribute(Y)}})}}function J(){if(!(N||!v.props.aria.expanded)){var x=or(v.props.triggerTarget||t);x.forEach(function(Y){v.props.interactive?Y.setAttribute("aria-expanded",v.state.isVisible&&Y===$()?"true":"false"):Y.removeAttribute("aria-expanded")})}}function Q(){U().removeEventListener("mousemove",m),$i=$i.filter(function(x){return x!==m})}function ce(x){if(!(On.isTouch&&(c||x.type==="mousedown"))){var Y=x.composedPath&&x.composedPath()[0]||x.target;if(!(v.props.interactive&&Jd(_,Y))){if(or(v.props.triggerTarget||t).some(function(le){return Jd(le,Y)})){if(On.isTouch||v.state.isVisible&&v.props.trigger.indexOf("click")>=0)return}else O("onClickOutside",[v,x]);v.props.hideOnClick===!0&&(v.clearDelayTimeouts(),v.hide(),l=!0,setTimeout(function(){l=!1}),v.state.isMounted||X())}}}function Ce(){c=!0}function ot(){c=!1}function Re(){var x=U();x.addEventListener("mousedown",ce,!0),x.addEventListener("touchend",ce,To),x.addEventListener("touchstart",ot,To),x.addEventListener("touchmove",Ce,To)}function X(){var x=U();x.removeEventListener("mousedown",ce,!0),x.removeEventListener("touchend",ce,To),x.removeEventListener("touchstart",ot,To),x.removeEventListener("touchmove",Ce,To)}function be(x,Y){Ye(x,function(){!v.state.isVisible&&_.parentNode&&_.parentNode.contains(_)&&Y()})}function ke(x,Y){Ye(x,Y)}function Ye(x,Y){var le=q().box;function Be(Ee){Ee.target===le&&(nl(le,"remove",Be),Y())}if(x===0)return Y();nl(le,"remove",p),nl(le,"add",Be),p=Be}function tt(x,Y,le){le===void 0&&(le=!1);var Be=or(v.props.triggerTarget||t);Be.forEach(function(Ee){Ee.addEventListener(x,Y,le),h.push({node:Ee,eventType:x,handler:Y,options:le})})}function en(){z()&&(tt("touchstart",fn,{passive:!0}),tt("touchend",hn,{passive:!0})),H0(v.props.trigger).forEach(function(x){if(x!=="manual")switch(tt(x,fn),x){case"mouseenter":tt("mouseleave",hn);break;case"focus":tt(t_?"focusout":"blur",pe);break;case"focusin":tt("focusout",pe);break}})}function En(){h.forEach(function(x){var Y=x.node,le=x.eventType,Be=x.handler,Ee=x.options;Y.removeEventListener(le,Be,Ee)}),h=[]}function fn(x){var Y,le=!1;if(!(!v.state.isEnabled||Pt(x)||l)){var Be=((Y=d)==null?void 0:Y.type)==="focus";d=x,g=x.currentTarget,J(),!v.state.isVisible&&W0(x)&&$i.forEach(function(Ee){return Ee(x)}),x.type==="click"&&(v.props.trigger.indexOf("mouseenter")<0||s)&&v.props.hideOnClick!==!1&&v.state.isVisible?le=!0:Oe(x),x.type==="click"&&(s=!le),le&&!Be&&Ot(x)}}function qt(x){var Y=x.target,le=$().contains(Y)||_.contains(Y);if(!(x.type==="mousemove"&&le)){var Be=$e().concat(_).map(function(Ee){var ut,At=Ee._tippy,eo=(ut=At.popperInstance)==null?void 0:ut.state;return eo?{popperRect:Ee.getBoundingClientRect(),popperState:eo,props:n}:null}).filter(Boolean);J0(Be,x)&&(Q(),Ot(x))}}function hn(x){var Y=Pt(x)||v.props.trigger.indexOf("click")>=0&&s;if(!Y){if(v.props.interactive){v.hideWithInteractivity(x);return}Ot(x)}}function pe(x){v.props.trigger.indexOf("focusin")<0&&x.target!==$()||v.props.interactive&&x.relatedTarget&&_.contains(x.relatedTarget)||Ot(x)}function Pt(x){return On.isTouch?z()!==x.type.indexOf("touch")>=0:!1}function wt(){se();var x=v.props,Y=x.popperOptions,le=x.placement,Be=x.offset,Ee=x.getReferenceClientRect,ut=x.moveTransition,At=G()?Kl(_).arrow:null,eo=Ee?{getBoundingClientRect:Ee,contextElement:Ee.contextElement||$()}:t,Or={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(T){var P=T.state;if(G()){var ue=q(),We=ue.box;["placement","reference-hidden","escaped"].forEach(function(Ue){Ue==="placement"?We.setAttribute("data-placement",P.placement):P.attributes.popper["data-popper-"+Ue]?We.setAttribute("data-"+Ue,""):We.removeAttribute("data-"+Ue)}),P.attributes.popper={}}}},$t=[{name:"offset",options:{offset:Be}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!ut}},Or];G()&&At&&$t.push({name:"arrow",options:{element:At,padding:3}}),$t.push.apply($t,(Y==null?void 0:Y.modifiers)||[]),v.popperInstance=P0(eo,_,Object.assign({},Y,{placement:le,onFirstUpdate:f,modifiers:$t}))}function se(){v.popperInstance&&(v.popperInstance.destroy(),v.popperInstance=null)}function Tt(){var x=v.props.appendTo,Y,le=$();v.props.interactive&&x===Qh||x==="parent"?Y=le.parentNode:Y=em(x,[le]),Y.contains(_)||Y.appendChild(_),v.state.isMounted=!0,wt(),process.env.NODE_ENV!=="production"&&Wn(v.props.interactive&&x===Gt.appendTo&&le.nextElementSibling!==_,["Interactive tippy element may not be accessible via keyboard","navigation because it is not directly after the reference element","in the DOM source order.",`
102
102
 
103
103
  `,"Using a wrapper <div> or <span> tag around the reference element","solves this by creating a new parentNode context.",`
104
104
 
105
105
  `,"Specifying `appendTo: document.body` silences this warning, but it","assumes you are using a focus management solution to handle","keyboard navigation.",`
106
106
 
107
- `,"See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "))}function Ie(){return ws(C.querySelectorAll("[data-tippy-root]"))}function ke(S){v.clearDelayTimeouts(),S&&O("onTrigger",[v,S]),Te();var q=ie(!0),ne=P(),_e=ne[0],be=ne[1];Nn.isTouch&&_e==="hold"&&be&&(q=be),q?o=setTimeout(function(){v.show()},q):v.show()}function xt(S){if(v.clearDelayTimeouts(),O("onUntrigger",[v,S]),!v.state.isVisible){Fe();return}if(!(v.props.trigger.indexOf("mouseenter")>=0&&v.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(S.type)>=0&&s)){var q=ie(!1);q?r=setTimeout(function(){v.state.isVisible&&v.hide()},q):i=requestAnimationFrame(function(){v.hide()})}}function Je(){v.state.isEnabled=!0}function fn(){v.hide(),v.state.isEnabled=!1}function Nt(){clearTimeout(o),clearTimeout(r),cancelAnimationFrame(i)}function I(S){if(process.env.NODE_ENV!=="production"&&Hn(v.state.isDestroyed,Jo("setProps")),!v.state.isDestroyed){O("onBeforeUpdate",[v,S]),kn();var q=v.props,ne=Hu(t,Object.assign({},q,Pu(S),{ignoreAttributes:!0}));v.props=ne,Zt(),q.interactiveDebounce!==ne.interactiveDebounce&&(Q(),m=Bu(zt,ne.interactiveDebounce)),q.triggerTarget&&!ne.triggerTarget?er(q.triggerTarget).forEach(function(_e){_e.removeAttribute("aria-expanded")}):ne.triggerTarget&&t.removeAttribute("aria-expanded"),Y(),x(),A&&A(q,ne),v.popperInstance&&(vt(),Ie().forEach(function(_e){requestAnimationFrame(_e._tippy.popperInstance.forceUpdate)})),O("onAfterUpdate",[v,S])}}function z(S){v.setProps({content:S})}function ue(){process.env.NODE_ENV!=="production"&&Hn(v.state.isDestroyed,Jo("show"));var S=v.state.isVisible,q=v.state.isDestroyed,ne=!v.state.isEnabled,_e=Nn.isTouch&&!v.props.touch,be=Ja(v.props.duration,0,Wt.duration);if(!(S||q||ne||_e)&&!de().hasAttribute("disabled")&&(O("onShow",[v],!1),v.props.onShow(v)!==!1)){if(v.state.isVisible=!0,te()&&(C.style.visibility="visible"),x(),Te(),v.state.isMounted||(C.style.transition="none"),te()){var it=re(),Tt=it.box,Jn=it.content;Xa([Tt,Jn],0)}f=function(){var Bt;if(!(!v.state.isVisible||d)){if(d=!0,C.offsetHeight,C.style.transition=v.props.moveTransition,te()&&v.props.animation){var E=re(),N=E.box,B=E.content;Xa([N,B],be),$u([N,B],"visible")}V(),Y(),Lu(Qa,v),(Bt=v.popperInstance)==null||Bt.forceUpdate(),O("onMount",[v]),v.props.animation&&te()&&pt(be,function(){v.state.isShown=!0,O("onShown",[v])})}},St()}}function Ee(){process.env.NODE_ENV!=="production"&&Hn(v.state.isDestroyed,Jo("hide"));var S=!v.state.isVisible,q=v.state.isDestroyed,ne=!v.state.isEnabled,_e=Ja(v.props.duration,1,Wt.duration);if(!(S||q||ne)&&(O("onHide",[v],!1),v.props.onHide(v)!==!1)){if(v.state.isVisible=!1,v.state.isShown=!1,d=!1,s=!1,te()&&(C.style.visibility="hidden"),Q(),Fe(),x(!0),te()){var be=re(),it=be.box,Tt=be.content;v.props.animation&&(Xa([it,Tt],_e),$u([it,Tt],"hidden"))}V(),Y(),v.props.animation?te()&&Vt(_e,v.unmount):v.unmount()}}function Qe(S){process.env.NODE_ENV!=="production"&&Hn(v.state.isDestroyed,Jo("hideWithInteractivity")),ce().addEventListener("mousemove",m),Lu(Ii,m),m(S)}function Ht(){process.env.NODE_ENV!=="production"&&Hn(v.state.isDestroyed,Jo("unmount")),v.state.isVisible&&v.hide(),v.state.isMounted&&(Z(),Ie().forEach(function(S){S._tippy.unmount()}),C.parentNode&&C.parentNode.removeChild(C),Qa=Qa.filter(function(S){return S!==v}),v.state.isMounted=!1,O("onHidden",[v]))}function Sr(){process.env.NODE_ENV!=="production"&&Hn(v.state.isDestroyed,Jo("destroy")),!v.state.isDestroyed&&(v.clearDelayTimeouts(),v.unmount(),kn(),delete t._tippy,v.state.isDestroyed=!0,O("onDestroy",[v]))}}function bn(t,e){e===void 0&&(e={});var n=Wt.plugins.concat(e.plugins||[]);process.env.NODE_ENV!=="production"&&(I0(t),Kh(e,n)),O0();var o=Object.assign({},e,{plugins:n}),r=_0(t);if(process.env.NODE_ENV!=="production"){var i=ai(o.content),s=r.length>1;Hn(i&&s,["tippy() was passed an Element as the `content` prop, but more than","one tippy instance was created by this invocation. This means the","content element will only be appended to the last tippy instance.",`
107
+ `,"See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "))}function $e(){return Ns(_.querySelectorAll("[data-tippy-root]"))}function Oe(x){v.clearDelayTimeouts(),x&&O("onTrigger",[v,x]),Re();var Y=ee(!0),le=M(),Be=le[0],Ee=le[1];On.isTouch&&Be==="hold"&&Ee&&(Y=Ee),Y?o=setTimeout(function(){v.show()},Y):v.show()}function Ot(x){if(v.clearDelayTimeouts(),O("onUntrigger",[v,x]),!v.state.isVisible){X();return}if(!(v.props.trigger.indexOf("mouseenter")>=0&&v.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(x.type)>=0&&s)){var Y=ee(!1);Y?r=setTimeout(function(){v.state.isVisible&&v.hide()},Y):i=requestAnimationFrame(function(){v.hide()})}}function nt(){v.state.isEnabled=!0}function mn(){v.hide(),v.state.isEnabled=!1}function Mt(){clearTimeout(o),clearTimeout(r),cancelAnimationFrame(i)}function L(x){if(process.env.NODE_ENV!=="production"&&Wn(v.state.isDestroyed,Qo("setProps")),!v.state.isDestroyed){O("onBeforeUpdate",[v,x]),En();var Y=v.props,le=Qd(t,Object.assign({},Y,Gd(x),{ignoreAttributes:!0}));v.props=le,en(),Y.interactiveDebounce!==le.interactiveDebounce&&(Q(),m=Wd(qt,le.interactiveDebounce)),Y.triggerTarget&&!le.triggerTarget?or(Y.triggerTarget).forEach(function(Be){Be.removeAttribute("aria-expanded")}):le.triggerTarget&&t.removeAttribute("aria-expanded"),J(),S(),R&&R(Y,le),v.popperInstance&&(wt(),$e().forEach(function(Be){requestAnimationFrame(Be._tippy.popperInstance.forceUpdate)})),O("onAfterUpdate",[v,x])}}function K(x){v.setProps({content:x})}function fe(){process.env.NODE_ENV!=="production"&&Wn(v.state.isDestroyed,Qo("show"));var x=v.state.isVisible,Y=v.state.isDestroyed,le=!v.state.isEnabled,Be=On.isTouch&&!v.props.touch,Ee=el(v.props.duration,0,Gt.duration);if(!(x||Y||le||Be)&&!$().hasAttribute("disabled")&&(O("onShow",[v],!1),v.props.onShow(v)!==!1)){if(v.state.isVisible=!0,G()&&(_.style.visibility="visible"),S(),Re(),v.state.isMounted||(_.style.transition="none"),G()){var ut=q(),At=ut.box,eo=ut.content;tl([At,eo],0)}f=function(){var $t;if(!(!v.state.isVisible||u)){if(u=!0,_.offsetHeight,_.style.transition=v.props.moveTransition,G()&&v.props.animation){var w=q(),T=w.box,P=w.content;tl([T,P],Ee),Yd([T,P],"visible")}F(),J(),jd(ol,v),($t=v.popperInstance)==null||$t.forceUpdate(),O("onMount",[v]),v.props.animation&&G()&&ke(Ee,function(){v.state.isShown=!0,O("onShown",[v])})}},Tt()}}function Me(){process.env.NODE_ENV!=="production"&&Wn(v.state.isDestroyed,Qo("hide"));var x=!v.state.isVisible,Y=v.state.isDestroyed,le=!v.state.isEnabled,Be=el(v.props.duration,1,Gt.duration);if(!(x||Y||le)&&(O("onHide",[v],!1),v.props.onHide(v)!==!1)){if(v.state.isVisible=!1,v.state.isShown=!1,u=!1,s=!1,G()&&(_.style.visibility="hidden"),Q(),X(),S(!0),G()){var Ee=q(),ut=Ee.box,At=Ee.content;v.props.animation&&(tl([ut,At],Be),Yd([ut,At],"hidden"))}F(),J(),v.props.animation?G()&&be(Be,v.unmount):v.unmount()}}function rt(x){process.env.NODE_ENV!=="production"&&Wn(v.state.isDestroyed,Qo("hideWithInteractivity")),U().addEventListener("mousemove",m),jd($i,m),m(x)}function Kt(){process.env.NODE_ENV!=="production"&&Wn(v.state.isDestroyed,Qo("unmount")),v.state.isVisible&&v.hide(),v.state.isMounted&&(se(),$e().forEach(function(x){x._tippy.unmount()}),_.parentNode&&_.parentNode.removeChild(_),ol=ol.filter(function(x){return x!==v}),v.state.isMounted=!1,O("onHidden",[v]))}function Tr(){process.env.NODE_ENV!=="production"&&Wn(v.state.isDestroyed,Qo("destroy")),!v.state.isDestroyed&&(v.clearDelayTimeouts(),v.unmount(),En(),delete t._tippy,v.state.isDestroyed=!0,O("onDestroy",[v]))}}function dn(t,e){e===void 0&&(e={});var n=Gt.plugins.concat(e.plugins||[]);process.env.NODE_ENV!=="production"&&(r_(t),im(e,n)),Q0();var o=Object.assign({},e,{plugins:n}),r=G0(t);if(process.env.NODE_ENV!=="production"){var i=pi(o.content),s=r.length>1;Wn(i&&s,["tippy() was passed an Element as the `content` prop, but more than","one tippy instance was created by this invocation. This means the","content element will only be appended to the last tippy instance.",`
108
108
 
109
109
  `,"Instead, pass the .innerHTML of the element, or use a function that","returns a cloned version of the element instead.",`
110
110
 
111
111
  `,`1) content: element.innerHTML
112
- `,"2) content: () => element.cloneNode(true)"].join(" "))}var a=r.reduce(function(c,d){var u=d&&z0(d,o);return u&&c.push(u),c},[]);return ai(t)?a[0]:a}bn.defaultProps=Wt;bn.setDefaultProps=P0;bn.currentInput=Nn;Object.assign({},Oh,{effect:function(e){var n=e.state,o={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,o.popper),n.styles=o,n.elements.arrow&&Object.assign(n.elements.arrow.style,o.arrow)}});bn.setDefaultProps({render:jh});class H0{constructor({editor:e,element:n,view:o,tippyOptions:r={},updateDelay:i=250,shouldShow:s}){this.preventHide=!1,this.shouldShow=({view:a,state:c,from:d,to:u})=>{const{doc:p,selection:f}=c,{empty:h}=f,m=!p.textBetween(d,u).length&&fa(c.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 c;if(this.preventHide){this.preventHide=!1;return}a!=null&&a.relatedTarget&&(!((c=this.element.parentNode)===null||c===void 0)&&c.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,c)=>{const d=!(c!=null&&c.selection.eq(a.state.selection)),u=!(c!=null&&c.doc.eq(a.state.doc));!d&&!u||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(a,d,u,c)},this.updateDelay))},this.updateHandler=(a,c,d,u)=>{var p,f,h;const{state:m,composing:g}=a,{selection:b}=m;if(g||!c&&!d)return;this.createTooltip();const{ranges:k}=b,w=Math.min(...k.map(C=>C.$from.pos)),v=Math.max(...k.map(C=>C.$to.pos));if(!((p=this.shouldShow)===null||p===void 0?void 0:p.call(this,{editor:this.editor,element:this.element,view:a,state:m,oldState:u,from:w,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(Sh(m.selection)){let C=a.nodeDOM(w);if(C){const A=C.dataset.nodeViewWrapper?C:C.querySelector("[data-node-view-wrapper]");if(A&&(C=A.firstChild),C)return C.getBoundingClientRect()}}return xh(a,w,v)})}),this.show()},this.editor=e,this.element=n,this.view=o,this.updateDelay=i,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=r,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=bn(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:o}=e,r=o.selection.from!==o.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,n);return}const i=!(n!=null&&n.selection.eq(e.state.selection)),s=!(n!=null&&n.doc.eq(e.state.doc));this.updateHandler(e,i,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 Gh=t=>new Se({key:typeof t.pluginKey=="string"?new xe(t.pluginKey):t.pluginKey,view:e=>new H0({view:e,...t})});De.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Gh({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});class U0{getTextContent(e){return Ch(e,{textSerializers:Sc(this.editor.schema)})}constructor({editor:e,element:n,view:o,tippyOptions:r={},shouldShow:i}){this.preventHide=!1,this.shouldShow=({view:s,state:a})=>{const{selection:c}=a,{$anchor:d,empty:u}=c,p=d.depth===1,f=d.parent.isTextblock&&!d.parent.type.spec.code&&!d.parent.textContent&&d.parent.childCount===0&&!this.getTextContent(d.parent);return!(!s.hasFocus()||!u||!p||!f||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:s})=>{var a;if(this.preventHide){this.preventHide=!1;return}s!=null&&s.relatedTarget&&(!((a=this.element.parentNode)===null||a===void 0)&&a.contains(s.relatedTarget))||(s==null?void 0:s.relatedTarget)!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=s=>{this.blurHandler({event:s})},this.editor=e,this.element=n,this.view=o,i&&(this.shouldShow=i),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=r,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=bn(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"right",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){var o,r,i;const{state:s}=e,{doc:a,selection:c}=s,{from:d,to:u}=c;if(n&&n.doc.eq(a)&&n.selection.eq(c))return;if(this.createTooltip(),!((o=this.shouldShow)===null||o===void 0?void 0:o.call(this,{editor:this.editor,view:e,state:s,oldState:n}))){this.hide();return}(r=this.tippy)===null||r===void 0||r.setProps({getReferenceClientRect:((i=this.tippyOptions)===null||i===void 0?void 0:i.getReferenceClientRect)||(()=>xh(e,d,u))}),this.show()}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const Yh=t=>new Se({key:typeof t.pluginKey=="string"?new xe(t.pluginKey):t.pluginKey,view:e=>new U0({view:e,...t})});De.create({name:"floatingMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"floatingMenu",shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Yh({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}});const q0=l.defineComponent({name:"BubbleMenu",props:{pluginKey:{type:[String,Object],default:"bubbleMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},tippyOptions:{type:Object,default:()=>({})},shouldShow:{type:Function,default:null}},setup(t,{slots:e}){const n=l.ref(null);return l.onMounted(()=>{const{updateDelay:o,editor:r,pluginKey:i,shouldShow:s,tippyOptions:a}=t;r.registerPlugin(Gh({updateDelay:o,editor:r,element:n.value,pluginKey:i,shouldShow:s,tippyOptions:a}))}),l.onBeforeUnmount(()=>{const{pluginKey:o,editor:r}=t;r.unregisterPlugin(o)}),()=>{var o;return l.h("div",{ref:n},(o=e.default)===null||o===void 0?void 0:o.call(e))}}});function Wu(t){return l.customRef((e,n)=>({get(){return e(),t},set(o){t=o,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}class Jh extends cn{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=Wu(this.view.state),this.reactiveExtensionStorage=Wu(this.extensionStorage),this.on("beforeTransaction",({nextState:n})=>{this.reactiveState.value=n,this.reactiveExtensionStorage.value=this.extensionStorage}),l.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,n){const o=super.registerPlugin(e,n);return this.reactiveState&&(this.reactiveState.value=o),o}unregisterPlugin(e){const n=super.unregisterPlugin(e);return this.reactiveState&&n&&(this.reactiveState.value=n),n}}const W0=l.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(t){const e=l.ref(),n=l.getCurrentInstance();return l.watchEffect(()=>{const o=t.editor;o&&o.options.element&&e.value&&l.nextTick(()=>{if(!e.value||!o.options.element.firstChild)return;const r=l.unref(e.value);e.value.append(...o.options.element.childNodes),o.contentComponent=n.ctx._,n&&(o.appContext={...n.appContext,provides:n.provides}),o.setOptions({element:r}),o.createNodeViews()})}),l.onBeforeUnmount(()=>{const o=t.editor;o&&(o.contentComponent=null,o.appContext=null)}),{rootEl:e}},render(){return l.h("div",{ref:t=>{this.rootEl=t}})}}),K0=l.defineComponent({name:"FloatingMenu",props:{pluginKey:{type:null,default:"floatingMenu"},editor:{type:Object,required:!0},tippyOptions:{type:Object,default:()=>({})},shouldShow:{type:Function,default:null}},setup(t,{slots:e}){const n=l.ref(null);return l.onMounted(()=>{const{pluginKey:o,editor:r,tippyOptions:i,shouldShow:s}=t;r.registerPlugin(Yh({pluginKey:o,editor:r,element:n.value,tippyOptions:i,shouldShow:s}))}),l.onBeforeUnmount(()=>{const{pluginKey:o,editor:r}=t;r.unregisterPlugin(o)}),()=>{var o;return l.h("div",{ref:n},(o=e.default)===null||o===void 0?void 0:o.call(e))}}}),Gn=l.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return l.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),Pc=l.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var t,e;return l.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(t=this.$slots).default)===null||e===void 0?void 0:e.call(t))}}),j0=(t={})=>{const e=l.shallowRef();return l.onMounted(()=>{e.value=new Jh(t)}),l.onBeforeUnmount(()=>{var n,o,r;const i=(n=e.value)===null||n===void 0?void 0:n.options.element,s=i==null?void 0:i.cloneNode(!0);(o=i==null?void 0:i.parentNode)===null||o===void 0||o.replaceChild(s,i),(r=e.value)===null||r===void 0||r.destroy()}),e};class $c{constructor(e,{props:n={},editor:o}){this.editor=o,this.component=l.markRaw(e),this.el=document.createElement("div"),this.props=l.reactive(n),this.renderedComponent=this.renderComponent()}get element(){return this.renderedComponent.el}get ref(){var e,n,o,r;return!((n=(e=this.renderedComponent.vNode)===null||e===void 0?void 0:e.component)===null||n===void 0)&&n.exposed?this.renderedComponent.vNode.component.exposed:(r=(o=this.renderedComponent.vNode)===null||o===void 0?void 0:o.component)===null||r===void 0?void 0:r.proxy}renderComponent(){let e=l.h(this.component,this.props);return this.editor.appContext&&(e.appContext=this.editor.appContext),typeof document<"u"&&this.el&&l.render(e,this.el),{vNode:e,destroy:()=>{this.el&&l.render(null,this.el),this.el=null,e=null},el:this.el?this.el.firstElementChild:null}}updateProps(e={}){Object.entries(e).forEach(([n,o])=>{this.props[n]=o}),this.renderComponent()}destroy(){this.renderedComponent.destroy()}}const ut={editor:{type:Object,required:!0},node:{type:Object,required:!0},decorations:{type:Object,required:!0},selected:{type:Boolean,required:!0},extension:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0},view:{type:Object,required:!0},innerDecorations:{type:Object,required:!0},HTMLAttributes:{type:Object,required:!0}};class G0 extends aw{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:(r={})=>this.updateAttributes(r),deleteNode:()=>this.deleteNode()},n=this.onDragStart.bind(this);this.decorationClasses=l.ref(this.getDecorationClasses());const o=l.defineComponent({extends:{...this.component},props:Object.keys(e),template:this.component.template,setup:r=>{var i,s;return l.provide("onDragStart",n),l.provide("decorationClasses",this.decorationClasses),(s=(i=this.component).setup)===null||s===void 0?void 0:s.call(i,r,{expose:()=>{}})},__scopeId:this.component.__scopeId,__cssModules:this.component.__cssModules,__name:this.component.__name,__file:this.component.__file});this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.renderer=new $c(o,{editor:this.editor,props:e})}get dom(){if(!this.renderer.element||!this.renderer.element.hasAttribute("data-node-view-wrapper"))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.dom.querySelector("[data-node-view-content]")}handleSelectionUpdate(){const{from:e,to:n}=this.editor.state.selection,o=this.getPos();if(typeof o=="number")if(e<=o&&n>=o+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(e,n,o){const r=i=>{this.decorationClasses.value=this.getDecorationClasses(),this.renderer.updateProps(i)};if(typeof this.options.update=="function"){const i=this.node,s=this.decorations,a=this.innerDecorations;return this.node=e,this.decorations=n,this.innerDecorations=o,this.options.update({oldNode:i,oldDecorations:s,newNode:e,newDecorations:n,oldInnerDecorations:a,innerDecorations:o,updateProps:()=>r({node:e,decorations:n,innerDecorations:o})})}return e.type!==this.node.type?!1:(e===this.node&&this.decorations===n&&this.innerDecorations===o||(this.node=e,this.decorations=n,this.innerDecorations=o,r({node:e,decorations:n,innerDecorations:o})),!0)}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element&&this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element&&this.renderer.element.classList.remove("ProseMirror-selectednode")}getDecorationClasses(){return this.decorations.map(e=>e.type.attrs.class).flat().join(" ")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate)}}function yn(t,e){return n=>{if(!n.editor.contentComponent)return{};const o=typeof t=="function"&&"__vccOpts"in t?t.__vccOpts:t;return new G0(o,n,e)}}const Y0=/^\s*>\s$/,Xh=Ue.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",Ce(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[pr({find:Y0,type:this.type})]}}),J0=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,X0=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Z0=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Q0=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,eC=sn.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",Ce(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[zo({find:J0,type:this.type}),zo({find:Z0,type:this.type})]},addPasteRules(){return[bo({find:X0,type:this.type}),bo({find:Q0,type:this.type})]}}),tC="listItem",Ku="textStyle",ju=/^\s*([-+*])\s$/,nC=Ue.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Ce(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(tC,this.editor.getAttributes(Ku)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=pr({find:ju,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=pr({find:ju,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Ku),editor:this.editor})),[t]}}),oC=/(^|[^`])`([^`]+)`(?!`)/,rC=/(^|[^`])`([^`]+)`(?!`)/g,iC=sn.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Ce(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[zo({find:oC,type:this.type})]},addPasteRules(){return[bo({find:rC,type:this.type})]}}),sC=/^```([a-z]+)?[\s\n]$/,aC=/^~~~([a-z]+)?[\s\n]$/,Zh=Ue.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,i=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(s=>s.startsWith(n)).map(s=>s.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Ce(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:o,empty:r}=n;if(!r||o.parent.type!==this.type)return!1;const i=o.parentOffset===o.parent.nodeSize-2,s=o.parent.textContent.endsWith(`
113
-
114
- `);return!i||!s?!1:t.chain().command(({tr:a})=>(a.delete(o.pos-2,o.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:o}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type||!(r.parentOffset===r.parent.nodeSize-2))return!1;const a=r.after();return a===void 0?!1:o.nodeAt(a)?t.commands.command(({tr:d})=>(d.setSelection(ee.near(o.resolve(a))),!0)):t.commands.exitCode()}}},addInputRules(){return[Ll({find:sC,type:this.type,getAttributes:t=>({language:t[1]})}),Ll({find:aC,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Se({key:new xe("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),o=e.clipboardData.getData("vscode-editor-data"),r=o?JSON.parse(o):void 0,i=r==null?void 0:r.mode;if(!n||!i)return!1;const{tr:s,schema:a}=t.state,c=a.text(n.replace(/\r\n?/g,`
115
- `));return s.replaceSelectionWith(this.type.create({language:i},c)),s.selection.$from.parent.type!==this.type&&s.setSelection(J.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}}),Qh=Ue.create({name:"doc",topNode:!0,content:"block+"});function lC(t={}){return new Se({view(e){return new cC(e,t)}})}class cC{constructor(e,n){var o;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(o=n.width)!==null&&o!==void 0?o:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{let i=s=>{this[r](s)};return e.dom.addEventListener(r,i),{name:r,handler:i}})}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,o;if(n){let a=e.nodeBefore,c=e.nodeAfter;if(a||c){let d=this.editorView.nodeDOM(this.cursorPos-(a?a.nodeSize:0));if(d){let u=d.getBoundingClientRect(),p=a?u.bottom:u.top;a&&c&&(p=(p+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),o={left:u.left,right:u.right,top:p-this.width/2,bottom:p+this.width/2}}}}if(!o){let a=this.editorView.coordsAtPos(this.cursorPos);o={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}let r=this.editorView.dom.offsetParent;this.element||(this.element=r.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 i,s;if(!r||r==document.body&&getComputedStyle(r).position=="static")i=-pageXOffset,s=-pageYOffset;else{let a=r.getBoundingClientRect();i=a.left-r.scrollLeft,s=a.top-r.scrollTop}this.element.style.left=o.left-i+"px",this.element.style.top=o.top-s+"px",this.element.style.width=o.right-o.left+"px",this.element.style.height=o.bottom-o.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),o=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),r=o&&o.type.spec.disableDropCursor,i=typeof r=="function"?r(this.editorView,n,e):r;if(n&&!i){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=hf(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){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const dC=De.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[lC(this.options)]}});class je extends ee{constructor(e){super(e,e)}map(e,n){let o=e.resolve(n.map(this.head));return je.valid(o)?new je(o):ee.near(o)}content(){return $.empty}eq(e){return e instanceof je&&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 je(e.resolve(n.pos))}getBookmark(){return new Fc(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!uC(e)||!pC(e))return!1;let o=n.type.spec.allowGapCursor;if(o!=null)return o;let r=n.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,n,o=!1){e:for(;;){if(!o&&je.valid(e))return e;let r=e.pos,i=null;for(let s=e.depth;;s--){let a=e.node(s);if(n>0?e.indexAfter(s)<a.childCount:e.index(s)>0){i=a.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;r+=n;let c=e.doc.resolve(r);if(je.valid(c))return c}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!G.isSelectable(i)){e=e.doc.resolve(r+i.nodeSize*n),o=!1;continue e}break}i=s,r+=n;let a=e.doc.resolve(r);if(je.valid(a))return a}return null}}}je.prototype.visible=!1;je.findFrom=je.findGapCursorFrom;ee.jsonID("gapcursor",je);class Fc{constructor(e){this.pos=e}map(e){return new Fc(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return je.valid(n)?new je(n):ee.near(n)}}function uC(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),o=t.node(e);if(n==0){if(o.type.spec.isolating)return!0;continue}for(let r=o.child(n-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}}return!0}function pC(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),o=t.node(e);if(n==o.childCount){if(o.type.spec.isolating)return!0;continue}for(let r=o.child(n);;r=r.firstChild){if(r.childCount==0&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}}return!0}function fC(){return new Se({props:{decorations:bC,createSelectionBetween(t,e,n){return e.pos==n.pos&&je.valid(n)?new je(n):null},handleClick:mC,handleKeyDown:hC,handleDOMEvents:{beforeinput:gC}}})}const hC=bc({ArrowLeft:Bi("horiz",-1),ArrowRight:Bi("horiz",1),ArrowUp:Bi("vert",-1),ArrowDown:Bi("vert",1)});function Bi(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(o,r,i){let s=o.selection,a=e>0?s.$to:s.$from,c=s.empty;if(s instanceof J){if(!i.endOfTextblock(n)||a.depth==0)return!1;c=!1,a=o.doc.resolve(e>0?a.after():a.before())}let d=je.findGapCursorFrom(a,e,c);return d?(r&&r(o.tr.setSelection(new je(d))),!0):!1}}function mC(t,e,n){if(!t||!t.editable)return!1;let o=t.state.doc.resolve(e);if(!je.valid(o))return!1;let r=t.posAtCoords({left:n.clientX,top:n.clientY});return r&&r.inside>-1&&G.isSelectable(t.state.doc.nodeAt(r.inside))?!1:(t.dispatch(t.state.tr.setSelection(new je(o))),!0)}function gC(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof je))return!1;let{$from:n}=t.state.selection,o=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!o)return!1;let r=T.empty;for(let s=o.length-1;s>=0;s--)r=T.from(o[s].createAndFill(null,r));let i=t.state.tr.replace(n.pos,n.pos,new $(r,0,0));return i.setSelection(J.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function bC(t){if(!(t.selection instanceof je))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Me.create(t.doc,[Ze.widget(t.selection.head,e,{key:"gapcursor"})])}const yC=De.create({name:"gapCursor",addProseMirrorPlugins(){return[fC()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=me(U(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),vC=Ue.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",Ce(this.options.HTMLAttributes,t)]},renderText(){return`
116
- `},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:o})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:r,storedMarks:i}=n;if(r.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:a}=o.extensionManager,c=i||r.$to.parentOffset&&r.$from.marks();return e().insertContent({type:this.name}).command(({tr:d,dispatch:u})=>{if(u&&c&&s){const p=c.filter(f=>a.includes(f.type.name));d.ensureMarks(p)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),em=Ue.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(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]}`,Ce(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=>Ll({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Cs=200,ct=function(){};ct.prototype.append=function(e){return e.length?(e=ct.from(e),!this.length&&e||e.length<Cs&&this.leafAppend(e)||this.length<Cs&&e.leafPrepend(this)||this.appendInner(e)):this};ct.prototype.prepend=function(e){return e.length?ct.from(e).append(this):this};ct.prototype.appendInner=function(e){return new kC(this,e)};ct.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?ct.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};ct.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ct.prototype.forEach=function(e,n,o){n===void 0&&(n=0),o===void 0&&(o=this.length),n<=o?this.forEachInner(e,n,o,0):this.forEachInvertedInner(e,n,o,0)};ct.prototype.map=function(e,n,o){n===void 0&&(n=0),o===void 0&&(o=this.length);var r=[];return this.forEach(function(i,s){return r.push(e(i,s))},n,o),r};ct.from=function(e){return e instanceof ct?e:e&&e.length?new tm(e):ct.empty};var tm=function(t){function e(o){t.call(this),this.values=o}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(r,i){return r==0&&i==this.length?this:new e(this.values.slice(r,i))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,i,s,a){for(var c=i;c<s;c++)if(r(this.values[c],a+c)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,a){for(var c=i-1;c>=s;c--)if(r(this.values[c],a+c)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=Cs)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=Cs)return new e(r.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(ct);ct.empty=new tm([]);var kC=function(t){function e(n,o){t.call(this),this.left=n,this.right=o,this.length=n.length+o.length,this.depth=Math.max(n.depth,o.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(o){return o<this.left.length?this.left.get(o):this.right.get(o-this.left.length)},e.prototype.forEachInner=function(o,r,i,s){var a=this.left.length;if(r<a&&this.left.forEachInner(o,r,Math.min(i,a),s)===!1||i>a&&this.right.forEachInner(o,Math.max(r-a,0),Math.min(this.length,i)-a,s+a)===!1)return!1},e.prototype.forEachInvertedInner=function(o,r,i,s){var a=this.left.length;if(r>a&&this.right.forEachInvertedInner(o,r-a,Math.max(i,a)-a,s+a)===!1||i<a&&this.left.forEachInvertedInner(o,Math.min(r,a),i,s)===!1)return!1},e.prototype.sliceInner=function(o,r){if(o==0&&r==this.length)return this;var i=this.left.length;return r<=i?this.left.slice(o,r):o>=i?this.right.slice(o-i,r-i):this.left.slice(o,i).append(this.right.slice(0,r-i))},e.prototype.leafAppend=function(o){var r=this.right.leafAppend(o);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(o){var r=this.left.leafPrepend(o);if(r)return new e(r,this.right)},e.prototype.appendInner=function(o){return this.left.depth>=Math.max(this.right.depth,o.depth)+1?new e(this.left,new e(this.right,o)):new e(this,o)},e}(ct);const EC=500;class mn{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let o=this.items.length;for(;;o--)if(this.items.get(o-1).selection){--o;break}let r,i;n&&(r=this.remapping(o,this.items.length),i=r.maps.length);let s=e.tr,a,c,d=[],u=[];return this.items.forEach((p,f)=>{if(!p.step){r||(r=this.remapping(o,f+1),i=r.maps.length),i--,u.push(p);return}if(r){u.push(new _n(p.map));let h=p.step.map(r.slice(i)),m;h&&s.maybeStep(h).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],d.push(new _n(m,void 0,void 0,d.length+u.length))),i--,m&&r.appendMap(m,i)}else s.maybeStep(p.step);if(p.selection)return a=r?p.selection.map(r.slice(i)):p.selection,c=new mn(this.items.slice(0,o).append(u.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:s,selection:a}}addTransform(e,n,o,r){let i=[],s=this.eventCount,a=this.items,c=!r&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let p=e.steps[u].invert(e.docs[u]),f=new _n(e.mapping.maps[u],p,n),h;(h=c&&c.merge(f))&&(f=h,u?i.pop():a=a.slice(0,a.length-1)),i.push(f),n&&(s++,n=void 0),r||(c=f)}let d=s-o.depth;return d>CC&&(a=wC(a,d),s-=d),new mn(a.append(i),s)}remapping(e,n){let o=new Zr;return this.items.forEach((r,i)=>{let s=r.mirrorOffset!=null&&i-r.mirrorOffset>=e?o.maps.length-r.mirrorOffset:void 0;o.appendMap(r.map,s)},e,n),o}addMaps(e){return this.eventCount==0?this:new mn(this.items.append(e.map(n=>new _n(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let o=[],r=Math.max(0,this.items.length-n),i=e.mapping,s=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},r);let c=n;this.items.forEach(f=>{let h=i.getMirror(--c);if(h==null)return;s=Math.min(s,h);let m=i.maps[h];if(f.step){let g=e.steps[h].invert(e.docs[h]),b=f.selection&&f.selection.map(i.slice(c+1,h));b&&a++,o.push(new _n(m,g,b))}else o.push(new _n(m))},r);let d=[];for(let f=n;f<s;f++)d.push(new _n(i.maps[f]));let u=this.items.slice(0,r).append(d).append(o),p=new mn(u,a);return p.emptyItemCount()>EC&&(p=p.compress(this.items.length-o.length)),p}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),o=n.maps.length,r=[],i=0;return this.items.forEach((s,a)=>{if(a>=e)r.push(s),s.selection&&i++;else if(s.step){let c=s.step.map(n.slice(o)),d=c&&c.getMap();if(o--,d&&n.appendMap(d,o),c){let u=s.selection&&s.selection.map(n.slice(o));u&&i++;let p=new _n(d.invert(),c,u),f,h=r.length-1;(f=r.length&&r[h].merge(p))?r[h]=f:r.push(p)}}else s.map&&o--},this.items.length,0),new mn(ct.from(r.reverse()),i)}}mn.empty=new mn(ct.empty,0);function wC(t,e){let n;return t.forEach((o,r)=>{if(o.selection&&e--==0)return n=r,!1}),t.slice(n)}class _n{constructor(e,n,o,r){this.map=e,this.step=n,this.selection=o,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new _n(n.getMap().invert(),n,this.selection)}}}class no{constructor(e,n,o,r,i){this.done=e,this.undone=n,this.prevRanges=o,this.prevTime=r,this.prevComposition=i}}const CC=20;function _C(t,e,n,o){let r=n.getMeta(Bo),i;if(r)return r.historyState;n.getMeta(NC)&&(t=new no(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(Bo))return s.getMeta(Bo).redo?new no(t.done.addTransform(n,void 0,o,ns(e)),t.undone,Gu(n.mapping.maps),t.prevTime,t.prevComposition):new no(t.done,t.undone.addTransform(n,void 0,o,ns(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),c=t.prevTime==0||!s&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-o.newGroupDelay||!SC(n,t.prevRanges)),d=s?el(t.prevRanges,n.mapping):Gu(n.mapping.maps);return new no(t.done.addTransform(n,c?e.selection.getBookmark():void 0,o,ns(e)),mn.empty,d,n.time,a??t.prevComposition)}else return(i=n.getMeta("rebased"))?new no(t.done.rebased(n,i),t.undone.rebased(n,i),el(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new no(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),el(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function SC(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((o,r)=>{for(let i=0;i<e.length;i+=2)o<=e[i+1]&&r>=e[i]&&(n=!0)}),n}function Gu(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((o,r,i,s)=>e.push(i,s));return e}function el(t,e){if(!t)return null;let n=[];for(let o=0;o<t.length;o+=2){let r=e.map(t[o],1),i=e.map(t[o+1],-1);r<=i&&n.push(r,i)}return n}function xC(t,e,n){let o=ns(e),r=Bo.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,o);if(!i)return null;let s=i.selection.resolve(i.transform.doc),a=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),r,o),c=new no(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(Bo,{redo:n,historyState:c})}let tl=!1,Yu=null;function ns(t){let e=t.plugins;if(Yu!=e){tl=!1,Yu=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){tl=!0;break}}return tl}const Bo=new xe("history"),NC=new xe("closeHistory");function TC(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Se({key:Bo,state:{init(){return new no(mn.empty,mn.empty,null,0,-1)},apply(e,n,o){return _C(n,o,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let o=n.inputType,r=o=="historyUndo"?om:o=="historyRedo"?rm:null;return r?(n.preventDefault(),r(e.state,e.dispatch)):!1}}}})}function nm(t,e){return(n,o)=>{let r=Bo.getState(n);if(!r||(t?r.undone:r.done).eventCount==0)return!1;if(o){let i=xC(r,n,t);i&&o(e?i.scrollIntoView():i)}return!0}}const om=nm(!1,!0),rm=nm(!0,!0),OC=De.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>om(t,e),redo:()=>({state:t,dispatch:e})=>rm(t,e)}},addProseMirrorPlugins(){return[TC(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()}}}),im=Ue.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Ce(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{const{selection:n}=e,{$from:o,$to:r}=n,i=t();return o.parentOffset===0?i.insertContentAt({from:Math.max(o.pos-1,0),to:r.pos},{type:this.name}):Sh(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({tr:s,dispatch:a})=>{var c;if(a){const{$to:d}=s.selection,u=d.end();if(d.nodeAfter)d.nodeAfter.isTextblock?s.setSelection(J.create(s.doc,d.pos+1)):d.nodeAfter.isBlock?s.setSelection(G.create(s.doc,d.pos)):s.setSelection(J.create(s.doc,d.pos));else{const p=(c=d.parent.type.contentMatch.defaultType)===null||c===void 0?void 0:c.create();p&&(s.insert(u,p),s.setSelection(J.create(s.doc,u+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[ga({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),MC=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,AC=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,RC=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,DC=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,IC=sn.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",Ce(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[zo({find:MC,type:this.type}),zo({find:RC,type:this.type})]},addPasteRules(){return[bo({find:AC,type:this.type}),bo({find:DC,type:this.type})]}}),BC=Ue.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Ce(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)}}}),LC="listItem",Ju="textStyle",Xu=/^(\d+)\.\s$/,PC=Ue.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Ce(this.options.HTMLAttributes,n),0]:["ol",Ce(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(LC,this.editor.getAttributes(Ju)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=pr({find:Xu,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=pr({find:Xu,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Ju)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),sm=Ue.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Ce(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),$C=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,FC=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,VC=sn.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",Ce(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[zo({find:$C,type:this.type})]},addPasteRules(){return[bo({find:FC,type:this.type})]}}),zC=Ue.create({name:"text",group:"inline"}),HC=De.create({name:"starterKit",addExtensions(){var t,e,n,o,r,i,s,a,c,d,u,p,f,h,m,g,b,y;const k=[];return this.options.bold!==!1&&k.push(eC.configure((t=this.options)===null||t===void 0?void 0:t.bold)),this.options.blockquote!==!1&&k.push(Xh.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bulletList!==!1&&k.push(nC.configure((n=this.options)===null||n===void 0?void 0:n.bulletList)),this.options.code!==!1&&k.push(iC.configure((o=this.options)===null||o===void 0?void 0:o.code)),this.options.codeBlock!==!1&&k.push(Zh.configure((r=this.options)===null||r===void 0?void 0:r.codeBlock)),this.options.document!==!1&&k.push(Qh.configure((i=this.options)===null||i===void 0?void 0:i.document)),this.options.dropcursor!==!1&&k.push(dC.configure((s=this.options)===null||s===void 0?void 0:s.dropcursor)),this.options.gapcursor!==!1&&k.push(yC.configure((a=this.options)===null||a===void 0?void 0:a.gapcursor)),this.options.hardBreak!==!1&&k.push(vC.configure((c=this.options)===null||c===void 0?void 0:c.hardBreak)),this.options.heading!==!1&&k.push(em.configure((d=this.options)===null||d===void 0?void 0:d.heading)),this.options.history!==!1&&k.push(OC.configure((u=this.options)===null||u===void 0?void 0:u.history)),this.options.horizontalRule!==!1&&k.push(im.configure((p=this.options)===null||p===void 0?void 0:p.horizontalRule)),this.options.italic!==!1&&k.push(IC.configure((f=this.options)===null||f===void 0?void 0:f.italic)),this.options.listItem!==!1&&k.push(BC.configure((h=this.options)===null||h===void 0?void 0:h.listItem)),this.options.orderedList!==!1&&k.push(PC.configure((m=this.options)===null||m===void 0?void 0:m.orderedList)),this.options.paragraph!==!1&&k.push(sm.configure((g=this.options)===null||g===void 0?void 0:g.paragraph)),this.options.strike!==!1&&k.push(VC.configure((b=this.options)===null||b===void 0?void 0:b.strike)),this.options.text!==!1&&k.push(zC.configure((y=this.options)===null||y===void 0?void 0:y.text)),k}}),UC=t=>{if(!t.children.length)return;const e=t.querySelectorAll("span");e&&e.forEach(n=>{var o,r;const i=n.getAttribute("style"),s=(r=(o=n.parentElement)===null||o===void 0?void 0:o.closest("span"))===null||r===void 0?void 0:r.getAttribute("style");n.setAttribute("style",`${s};${i}`)})},qC=sn.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&UC(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",Ce(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(n,o)=>{if(n.isTextblock)return!0;n.marks.filter(r=>r.type===this.type).some(r=>Object.values(r.attrs).some(i=>!!i))||t.removeMark(o,o+n.nodeSize,this.type)}),!0}}}}),oe=l.defineComponent({name:"ICon",__name:"OIcon",props:{name:{type:String,default:""},color:{type:String,default:""},small:{type:Boolean,default:!1}},setup(t){return(e,n)=>(l.openBlock(),l.createElementBlock("span",{class:l.normalizeClass(["o-icon",{small:t.small}]),style:l.normalizeStyle({color:t.color})},[l.createElementVNode("i",{class:l.normalizeClass(["yiitip-icon",`icon-${t.name}`])},null,2)],6))}}),Zu={isoName:"en-us",nativeName:"English (US)",diagram:{name:"Text Diagram",flow:"Flow Diagram",sequence:"Sequence Diagram",class:"Class Diagram",state:"State Diagram",gantt:"Gantt Diagram",tips:"Generation of diagram and chart from text in a similar manner as markdown"},editor:{add:"Add",addMore:"Add More",url:"URL",bold:"Bold",italic:"Italic",strikethrough:"Strikethrough",underline:"Underline",textFormat:"More text format",list:"List",unorderedList:"Unordered List",orderedList:"Ordered List",todoList:"Todo List",subscript:"Subscript",superscript:"Superscript",hyperlink:"Hyperlink",toggleFullscreen:"Toggle Fullscreen",quote:"Quote",left:"Left align",center:"Center align",right:"Right align",justify:"Justify align",print:"Print",outdent:"Decrease indentation",indent:"Increase indentation",indentDropdown:"Indent",removeFormat:"Remove formatting",formatting:"Formatting",fontFamily:"Font Family",defaultFont:"Default Font",fontSize:"Font Size",align:"Align",hr:"Insert Horizontal Rule",undo:"Undo",redo:"Redo",heading:"Heading & Paragraph",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",heading5:"Heading 5",headings:"Headings",paragraph:"Paragraph",code:"Code",codeBlock:"Code Block",size1:"Very small",size2:"A bit small",size3:"Normal",size4:"Medium-large",size5:"Big",size6:"Very big",size7:"Maximum",viewSource:"View Source",textColor:"Text Color",highlightColor:"Highlight Color",default:"Default",lineHeight:"Line Height",blockquote:"Blockquote",table:"Table",photo:"Insert Photo",video:"Insert Video",formula:"Formula",inlineFormula:"Inline",blockFormula:"Block",thirdPartyService:"Third party services",horizontal:"Horizontal Rule",callout:"Callout",emoji:"Emoji",defaultColor:"Default Color",noColor:"No Color",delete:"Delete",duplicate:"Duplicate"},label:{ai:"AI",cancel:"Cancel",color:"Color",edit:"Edit",link:"Link",linkAddress:"Link Address",ok:"Ok",preview:"Preview",template:"Template",example:"Example",submit:"Submit",settings:"Settings",remove:"Remove",replace:"Replace",help:"Help",back:"Back",styles:"Styles",basic:"Basic",basicBlocks:"Basic Blocks",common:"Common",media:"Media",image:"Image",video:"Video",model:"Model",modelViewer:"Model Viewer",more:"More",toc:"Table of Contents",untitled:"Untitled",typeForCommands:"Type '/' for commands",empty:"Empty",emptyTips:"Press Enter to continue with an empty note, or select following",copy:"Copy",cut:"Cut",search:"Search"},table:{cellBackground:"Cell Background",insert:"Insert Table",remove:"Remove Table",addColumn:"Add Column",selectColumn:"Select Column",removeColumn:"Remove Column",addRow:"Add Row",selectRow:"Select Row",removeRow:"Remove Row",merge:"Merge Cells",split:"Split Cells"},image:{preferences:"Image Preferences",ratio:"Ratio",size:"Size",width:"Width",height:"Height",src:"Image Source",caption:"Caption",link:"Link",lockAspectRatio:"Lock aspect ratio",unlockAspectRatio:"Unlock aspect ratio",original:"Original",small:"Small",medium:"Medium",large:"Large"},embed:{video:"Video",map:"Map",design:"Design",develop:"Develop",data:"Data",others:"Others",youtube:"Youtube",vimeo:"Vimeo",netflix:"Netflix",youku:"Youku",iqiyi:"iQiyi",bilibili:"Bilibili",qqvideo:"QQ Video",google_map:"Google Map",amap:"AMap",baidu_map:"Baidu Map",modao:"Modao",lanhu:"Lanhu",figma:"Figma",canva:"Canva",processon:"ProcessOn",codepen:"CodePen",google_forms:"Google Forms",jinshuju:"Jinshuju",iframe:"IFrame",linkTips:"Link or embed code",linkWarning:"Invalid link"},link:{back:"Back to main menu",edit:"Edit Link",off:"Disable Link",open:"Open Link",open_in_new_tab:"Open in new tab"}},WC={isoName:"pl",nativeName:"Polski",diagram:{name:"Schemat tekstowy",flow:"Schemat przepływu",sequence:"Schemat sekwencji",class:"Schemat klas",state:"Diagram stanu",gantt:"Diagram Gantta",tips:"Generowanie diagramu i wykresu z tekstu w podobny sposób jak markdown"},editor:{add:"Dodaj",addMore:"Dodaj więcej",url:"URL",bold:"Pogrubienie",italic:"Kursywa",strikethrough:"Przekreślenie",underline:"Podkreślenie",textFormat:"More text format",unorderedList:"Lista wypunktowana",orderedList:"Lista numerowana",list:"List",todoList:"Lista rzeczy do zrobienia",subscript:"Indeks dolny",superscript:"Indeks górny",hyperlink:"Hiperłącze",toggleFullscreen:"Przełącz na tryb pełnoekranowy",quote:"Zacytuj",left:"Wyrównaj do lewej",center:"Wyrównaj do środka",right:"Wyrównaj do prawej",justify:"Wyjustuj",print:"Drukuj",outdent:"Zmniejsz wcięcie",indent:"Zwiększ wcięcie",indentDropdown:"Wcięcie",removeFormat:"Usuń formatowanie",formatting:"Formatowanie",fontFamily:"Nazwa czcionki",defaultFont:"Domyślna czcionka",fontSize:"Rozmiar czcionki",align:"Wyrównanie",hr:"Wstaw poziomą linię",undo:"Cofnij",redo:"Przywróć",heading:"Heading & Paragraph",heading1:"Nagłówek 1",heading2:"Nagłówek 2",heading3:"Nagłówek 3",heading4:"Nagłówek 4",heading5:"Nagłówek 5",headings:"Nagłówki",paragraph:"Paragraf",code:"Kod",codeBlock:"Blok kodu",size1:"Bardzo mała",size2:"Mała",size3:"Normalna",size4:"Średnio-duża",size5:"Duża",size6:"Bardzo duża",size7:"Maksymalna",viewSource:"Pokaż źródło",textColor:"Kolor czcionki",highlightColor:"Kolor wyróżnienia",default:"Dymyślny",lineHeight:"Wysokość linii",blockquote:"Cytat",table:"Tabela",photo:"Wstaw obraz",video:"Insert Video",formula:"Formuła",inlineFormula:"Formuła w treści",blockFormula:"Blokowa formuła",thirdPartyService:"Third party services",horizontal:"Horizontal Rule",callout:"Callout",emoji:"Emoji",defaultColor:"Default Color",noColor:"No Color",delete:"Delete",duplicate:"Duplicate"},label:{ai:"AI",cancel:"Anuluj",edit:"Edycja",link:"Łącze",linkAddress:"Adres łącza",ok:"Ok",preview:"Podgląd",template:"Szablon",example:"Example",submit:"Submit",settings:"Settings",remove:"Remove",help:"Help",back:"Back",styles:"Styles",basic:"Basic",basicBlocks:"Basic Blocks",common:"Common",media:"Media",image:"Image",video:"Video",model:"Model",modelViewer:"Model Viewer",toc:"Table of Contents",untitled:"Untitled",typeForCommands:"Type '/' for commands",empty:"Empty",emptyTips:"Press Enter to continue with an empty note, or select following",copy:"Copy",cut:"Cut",search:"Search"},table:{cellBackground:"Cell Background",insert:"Insert Table",remove:"Remove Table",addColumn:"Add Column",removeColumn:"Remove Column",addRow:"Add Row",removeRow:"Remove Row",merge:"Merge/Unmerge Cells"},image:{preferences:"Preferencje obrazu",ratio:"Ratio",size:"Rozmiar",width:"Szerokość",height:"Wysokość",src:"Źródło obrazu",caption:"Nagłówek",link:"Łącze",lockAspectRatio:"Lock aspect ratio",unlockAspectRatio:"Unlock aspect ratio",original:"Original",small:"Small",medium:"Medium",large:"Large"},embed:{video:"Video",map:"Map",design:"Design",develop:"Develop",data:"Data",others:"Others",youtube:"Youtube",vimeo:"Vimeo",netflix:"Netflix",youku:"Youku",iqiyi:"iQiyi",bilibili:"Bilibili",qqvideo:"QQ Video",google_map:"Google Map",amap:"AMap",baidu_map:"Baidu Map",modao:"Modao",lanhu:"Lanhu",figma:"Figma",canva:"Canva",processon:"ProcessOn",codepen:"CodePen",google_forms:"Google Forms",jinshuju:"Jinshuju",iframe:"IFrame",linkTips:"Link or embed code",linkWarning:"Invalid link"},link:{back:"Back to main menu",edit:"Edit Link",off:"Disable Link",open:"Open Link",open_in_new_tab:"Open in new tab"}},KC={isoName:"pt-br",nativeName:"Português (BR)",diagram:{name:"Diagrama de Texto",flow:"Diagrama de Fluxo",sequence:"Diagrama de sequência",class:"Diagrama de Classe",state:"Diagrama de Estado",gantt:"Diagrama de Gantt",tips:"Geração de diagrama ou gráfico a partir de texto semelhante a markdown"},editor:{add:"Adicionar",addMore:"Adicione Mais",url:"URL",bold:"Negrito",italic:"Itálico",strikethrough:"Tachar",underline:"Sublinhado",textFormat:"Mais formatos de textos",list:"Lista",unorderedList:"Lista com Marcadores",orderedList:"Lista Numerada",todoList:"Lista de afazer",subscript:"Subscrito",superscript:"Sobrescrito",hyperlink:"Hyperlink",toggleFullscreen:"Alternar tela-cheia",quote:"Citação",left:"Alinhar à esquerda",center:"Alinhar ao centro",right:"Alinhar à direita",justify:"Justificar",print:"Imprimir",outdent:"Diminuir recuo",indent:"Aumentar recuo",indentDropdown:"Recuo",removeFormat:"Limpar formatação",formatting:"Formatação",fontFamily:"Fonte",defaultFont:"Fonte Padrão",fontSize:"Tamanho da fontee",align:"Alinhamento",hr:"Linha Horizontal",undo:"Desfazer",redo:"Refazer",heading:"Heading & Paragraph",heading1:"Título 1",heading2:"Título 2",heading3:"Título 3",heading4:"Título 4",heading5:"Título 5",headings:"Estilos de Parágrafo",paragraph:"Parágrafo",code:"Código",codeBlock:"Bloco de Código",size1:"Muito Pequeno",size2:"Pequeno",size3:"Normal",size4:"Médio",size5:"Grande",size6:"Enorme",size7:"Máximo",viewSource:"Código Fonte",textColor:"Cor do texto",highlightColor:"Cor do fundo",default:"Padrão",lineHeight:"Espaço entre linhas",blockquote:"Bloco de citação",table:"Tabela",photo:"Inserir Foto",video:"Insert Video",formula:"Fórmula",inlineFormula:"Linha",blockFormula:"Bloco",thirdPartyService:"Serviços de terceiros",horizontal:"Horizontal Rule",callout:"Callout",emoji:"Emoji",defaultColor:"Default Color",noColor:"No Color",delete:"Delete",duplicate:"Duplicate"},label:{ai:"AI",cancel:"Cancelar",edit:"Editar",link:"Link",linkAddress:"Endereço do Link",ok:"Ok",preview:"Pré Visualização",template:"Modelo",example:"Exemplo",submit:"Enviar",settings:"Configurações",remove:"Excluir",help:"Ajuda",back:"Voltar",styles:"Styles",basic:"Basic",basicBlocks:"Basic Blocks",common:"Common",media:"Media",image:"Image",video:"Video",model:"Model",modelViewer:"Model Viewer",toc:"Table of Contents",untitled:"Untitled",typeForCommands:"Type '/' for commands",empty:"Empty",emptyTips:"Press Enter to continue with an empty note, or select following",copy:"Copy",cut:"Cut",search:"Search"},table:{cellBackground:"Cell Background",insert:"Insert Table",remove:"Remove Table",addColumn:"Add Column",removeColumn:"Remove Column",addRow:"Add Row",removeRow:"Remove Row",merge:"Merge/Unmerge Cells"},image:{preferences:"Preferências da Imagem",ratio:"Ratio",size:"Tamanho",width:"Largura",height:"Altura",src:"Origem da imagem",caption:"Legenda",link:"Link",lockAspectRatio:"Bloquear proporção",unlockAspectRatio:"Desbloquear proporção",original:"Original",small:"Small",medium:"Medium",large:"Large"},embed:{video:"Vídeo",map:"Mapa",design:"Design",develop:"Desenvolvimento",data:"Dados",others:"Outros",youtube:"Youtube",vimeo:"Vimeo",netflix:"Netflix",youku:"Youku",iqiyi:"iQiyi",bilibili:"Bilibili",qqvideo:"QQ Video",google_map:"Google Map",amap:"AMap",baidu_map:"Baidu Map",modao:"Modao",lanhu:"Lanhu",figma:"Figma",canva:"Canva",processon:"ProcessOn",codepen:"CodePen",google_forms:"Google Forms",jinshuju:"Jinshuju",iframe:"IFrame",linkTips:"Link or embed code",linkWarning:"Invalid link"},link:{back:"Back to main menu",edit:"Edit Link",off:"Disable Link",open:"Open Link",open_in_new_tab:"Open in new tab"}},Qu={isoName:"zh-hans",nativeName:"简体中文",diagram:{name:"文本绘图",flow:"流程图",sequence:"时序图",class:"类图",state:"状态图",gantt:"甘特图",tips:"使用Markdown风格文本生成流程图、顺序图、类图、状态图和甘特图"},editor:{add:"添加",addMore:"添加更多",url:"URL",bold:"粗体",italic:"斜体",strikethrough:"删除线",underline:"下划线",textFormat:"更多格式",list:"列表",unorderedList:"无序列表",orderedList:"有序列表",todoList:"任务列表",subscript:"下标",superscript:"上标",hyperlink:"超链接",toggleFullscreen:"全屏切换",quote:"引号",left:"左对齐",center:"居中对齐",right:"右对齐",justify:"两端对齐",print:"打印",outdent:"减少缩进",indent:"增加缩进",indentDropdown:"缩进",removeFormat:"清除格式",formatting:"格式化",fontFamily:"字体",defaultFont:"默认字体",fontSize:"字体大小",align:"对齐方式",hr:"插入分割线",undo:"撤消",redo:"重做",heading:"标题与段落",heading1:"标题一",heading2:"标题二",heading3:"标题三",heading4:"标题四",heading5:"标题五",headings:"标题",paragraph:"正文",code:"代码",codeBlock:"代码块",size1:"非常小",size2:"比较小",size3:"正常",size4:"中等偏大",size5:"大",size6:"非常大",size7:"超级大",viewSource:"查看资料",textColor:"文字颜色",highlightColor:"背景颜色",default:"默认",lineHeight:"行高",blockquote:"引用",table:"表格",photo:"图片",video:"视频",formula:"数学公式",inlineFormula:"行内公式",blockFormula:"块级公式",thirdPartyService:"第三方服务",horizontal:"水平线",callout:"高亮块",emoji:"表情",defaultColor:"默认颜色",noColor:"无色",delete:"删除",duplicate:"创建副本"},label:{ai:"AI",cancel:"取消",color:"颜色",edit:"编辑",link:"链接",linkAddress:"链接地址",ok:"确定",preview:"预览",template:"模板",example:"示例",submit:"确定",settings:"设置",remove:"删除",replace:"替换",help:"帮助",back:"返回",styles:"样式",basic:"基础",basicBlocks:"基础块",common:"常用",media:"多媒体",image:"图片",video:"视频",model:"模型",modelViewer:"模型",more:"更多",toc:"目录",untitled:"未命名",typeForCommands:"输入 '/' 显示命令",empty:"空白页面",emptyTips:"按回车开始编辑,或从下方选择",copy:"复制",cut:"剪切",search:"搜索"},table:{cellBackground:"单元格背景色",insert:"插入表格",remove:"删除表格",addColumn:"添加列",selectColumn:"选择列",removeColumn:"删除列",addRow:"添加行",selectRow:"选择行",removeRow:"删除行",merge:"合并单元格",split:"拆分单元格"},image:{preferences:"图片设置",ratio:"比例",size:"尺寸",width:"宽度",height:"高度",src:"图片地址",caption:"图片说明",link:"链接",lockAspectRatio:"锁定长宽比",unlockAspectRatio:"解锁长宽比",original:"原始",small:"小",medium:"中",large:"大"},embed:{video:"视频",map:"地图",design:"设计",develop:"开发",data:"数据",others:"其它",youtube:"Youtube",vimeo:"Vimeo",netflix:"Netflix",youku:"优酷",iqiyi:"爱奇艺",bilibili:"Bilibili",qqvideo:"腾讯视频",google_map:"谷歌地图",amap:"高德地图",baidu_map:"百度",modao:"墨刀",lanhu:"蓝湖",figma:"Figma",canva:"Canva",processon:"ProcessOn",codepen:"CodePen",google_forms:"Google Forms",jinshuju:"金数据",iframe:"IFrame",linkTips:"链接或代码",linkWarning:"无效的链接"},link:{back:"返回主菜单",edit:"编辑链接",off:"取消链接",open:"打开链接",open_in_new_tab:"在新标签页打开"}},jC={isoName:"zh-hant",nativeName:"繁體中文",diagram:{name:"文本繪圖",flow:"流程圖",sequence:"時序圖",class:"類圖",state:"狀態圖",gantt:"甘特圖",tips:"使用Markdown風格文本生成流程圖、順序圖、類圖、狀態圖和甘特圖"},editor:{add:"添加",addMore:"添加更多",url:"URL",bold:"粗體",italic:"斜體",strikethrough:"刪除線",underline:"下劃線",textFormat:"更多格式",list:"列表",unorderedList:"無序列表",orderedList:"有序列表",todoList:"任務列表",subscript:"下標",superscript:"上標",hyperlink:"超鏈接",toggleFullscreen:"全屏切換",quote:"引號",left:"左對齊",center:"居中對齊",right:"右對齊",justify:"兩端對齊",print:"打印",outdent:"減少縮進",indent:"增加縮進",indentDropdown:"縮進",removeFormat:"清除格式",formatting:"格式化",fontFamily:"字體",defaultFont:"默認字體",fontSize:"字體大小",align:"對齊方式",hr:"插入分割線",undo:"撤消",redo:"重做",heading:"標題與段落",heading1:"標題一",heading2:"標題二",heading3:"標題三",heading4:"標題四",heading5:"標題五",headings:"標題",paragraph:"正文",code:"代碼",codeBlock:"代碼塊",size1:"非常小",size2:"比較小",size3:"正常",size4:"中等偏大",size5:"大",size6:"非常大",size7:"超級大",viewSource:"查看資料",textColor:"文字顏色",highlightColor:"背景顏色",default:"默認",lineHeight:"行高",blockquote:"引用",table:"表格",photo:"圖片",video:"視頻",formula:"數學公式",inlineFormula:"行內公式",blockFormula:"塊級公式",thirdPartyService:"第三方服務",horizontal:"水平線",callout:"高亮塊",emoji:"表情",defaultColor:"默認顏色",noColor:"無色",delete:"刪除",duplicate:"創建副本"},label:{ai:"AI",cancel:"取消",edit:"編輯",link:"鏈接",linkAddress:"鏈接地址",ok:"確定",preview:"預覽",template:"模板",example:"示例",submit:"確定",settings:"設置",remove:"刪除",help:"幫助",back:"返回",styles:"樣式",basic:"基础",basicBlocks:"基础块",common:"常用",media:"多媒體",image:"圖片",video:"視頻",model:"模型",modelViewer:"模型",toc:"目錄",untitled:"未命名",typeForCommands:"輸入 '/' 顯示命令",empty:"空白页面",emptyTips:"按回车开始编辑,或从下方选择",copy:"複製",cut:"剪切",search:"搜索"},table:{cellBackground:"單元格背景色",insert:"插入表格",remove:"刪除表格",addColumn:"添加列",removeColumn:"刪除列",addRow:"添加行",removeRow:"刪除行",merge:"合併/拆分 單元格"},image:{preferences:"圖片設置",ratio:"比例",size:"尺寸",width:"寬度",height:"高度",src:"圖片地址",caption:"圖片說明",link:"鏈接",lockAspectRatio:"鎖定長寬比",unlockAspectRatio:"解鎖長寬比",original:"原始",small:"小",medium:"中",large:"大"},embed:{video:"視頻",map:"地圖",design:"設計",develop:"開發",data:"數據",others:"其它",youtube:"Youtube",vimeo:"Vimeo",netflix:"Netflix",youku:"優酷",iqiyi:"愛奇藝",bilibili:"Bilibili",qqvideo:"騰訊視頻",google_map:"谷歌地圖",amap:"高德地圖",baidu_map:"百度",modao:"墨刀",lanhu:"藍湖",figma:"Figma",canva:"Canva",processon:"ProcessOn",codepen:"CodePen",google_forms:"Google Forms",jinshuju:"金數據",iframe:"IFrame",linkTips:"鏈接或代碼",linkWarning:"無效的鏈接"},link:{back:"返回主菜單",edit:"編輯鏈接",off:"取消鏈接",open:"打開鏈接",open_in_new_tab:"在新標籤頁打開"}},am={en:Zu,"en-us":Zu,pl:WC,"pt-br":KC,zh:Qu,"zh-hans":Qu,"zh-hant":jC},GC="en",YC=am[GC],JC=t=>am[t]||YC;function ye(){const t=l.inject("locale",{value:"en"}),e=l.computed(()=>JC(t.value));function n(o){return o.split(".").reduce((r,i)=>{if(r)return r[i]},e.value)}return{locale:t,message:e,tr:n}}function Ei(){const t=l.inject("darkMode",{value:!1}),e=l.computed(()=>t.value?"dark":"light");return{darkMode:t,theme:e}}function we(){const t=l.inject("isEditable",{value:!0});function e(o,r,i={}){if(!o.isEditable)return;const s=o==null?void 0:o.chain().focus(),a=o==null?void 0:o.commands;n(a,s,r,i)}function n(o,r,i,s={}){switch(console.log("command",i,s),i){case"backColor":s.color?o.setHighlight({color:s.color}):o.unsetHighlight();break;case"blockquote":r.toggleBlockquote().run();break;case"bold":r.toggleBold().run();break;case"bulletList":r.toggleBulletList().run();break;case"callout":r.toggleCallout().run();break;case"clearFormat":r.unsetAllMarks().run();break;case"code":r.toggleCode().run();break;case"codeBlock":o.toggleCodeBlock({language:"bash"});break;case"content":o.insertContent(s.content);break;case"fontFamily":o.setFontFamily(s.fontFamily);break;case"foreColor":o.setColor(s.color);break;case"heading":r.toggleHeading(s).run();break;case"horizontalRule":r.setHorizontalRule().run();break;case"image":r.setImage({src:"init"}).run();break;case"imageUpdate":r.setImage(s).run();break;case"italic":r.toggleItalic().run();break;case"linkSet":r.extendMarkRange("link").setLink(s).run();break;case"linkUnset":r.extendMarkRange("link").unsetLink().run();break;case"orderedList":r.toggleOrderedList().run();break;case"paragraph":r.setParagraph().run();break;case"strike":r.toggleStrike().run();break;case"table":r.insertTable({rows:3,cols:3,withHeaderRow:!0}).run();break;case"tableAddColumn":r.addColumnAfter().run();break;case"tableAddRow":r.addRowAfter().run();break;case"tableCellAttribute":r.setCellAttribute(s.name,s.value).run();break;case"tableDeleteColumn":r.deleteColumn().run();break;case"tableDeleteRow":r.deleteRow().run();break;case"tableDelete":r.deleteTable().run();break;case"tableInsert":r.insertTable(s).run();break;case"tableMergeCells":r.mergeCells().run();break;case"tableSelectColumn":r.selectColumn(s.pos).run();break;case"tableSelectRow":r.selectRow(s.pos).run();break;case"tableSplitCell":r.splitCell().run();break;case"taskList":o.toggleTaskList();break;case"textAlign":r.setTextAlign(s.textAlign).run();break;case"underline":r.toggleUnderline().run();break;case"video":r.setVideo({src:"init"}).run()}}return{isEditable:t,run:e,onCommand:n}}const Yn=l.defineComponent({__name:"OTooltip",props:{placement:{type:String,default:"top"},trigger:{type:String,default:"mouseenter focus"},delay:{type:Number,default:100},duration:{type:Number,default:100},offset:{type:Object,default:function(){return[0,10]}}},setup(t){const e=t,{theme:n}=Ei(),o=l.ref(),r=l.ref(),i=l.ref();function s(){i.value=bn(o.value,{appendTo:()=>document.body,animation:"perspective",content:r.value,duration:e.duration,delay:e.delay,interactive:!0,offset:e.offset,placement:e.placement,trigger:e.trigger})}function a(){i.value.setProps({theme:n.value})}return l.watch(n,c=>{a()}),l.onMounted(()=>{s()}),(c,d)=>(l.openBlock(),l.createElementBlock("div",{ref_key:"triggerRef",ref:o,"data-tippy-role":"tooltip"},[l.renderSlot(c.$slots,"trigger"),l.createElementVNode("div",{ref_key:"contentRef",ref:r,class:"tooltip-content"},[l.renderSlot(c.$slots,"default")],512)],512))}}),Re=l.defineComponent({__name:"OMenubarBtn",props:{icon:{type:String,default:""},color:{type:String,default:""},background:{type:String,default:""},tooltip:{type:String,default:""},placement:{type:String,default:"top"},contentClass:{type:[String,Object],default:""},contentStyle:{type:[String,Object],default:""},iconClass:{type:[String,Object],default:""}},emits:["click"],setup(t,{emit:e}){const n=e;return(o,r)=>(l.openBlock(),l.createBlock(Yn,{class:"o-tooltip",placement:t.placement},{trigger:l.withCtx(()=>[l.createElementVNode("button",{class:l.normalizeClass(["o-menubar-btn o-command-btn o-btn",t.contentClass]),style:l.normalizeStyle(t.contentStyle),onClick:r[0]||(r[0]=i=>n("click",i))},[l.createVNode(oe,{name:t.icon,color:t.color,class:l.normalizeClass(t.iconClass)},null,8,["name","color","class"])],6)]),default:l.withCtx(()=>[l.createTextVNode(" "+l.toDisplayString(t.tooltip),1)]),_:1},8,["placement"]))}}),XC=l.defineComponent({__name:"OSimpleCommandBtn",props:{name:{type:String,default:""},editor:{type:Object}},setup(t){const e=t,{run:n}=we(),{tr:o}=ye(),r=l.computed(()=>({aiViewer:{icon:"auto_awesome",tooltip:o("label.ai")},blockquote:{icon:"format_quote_open",tooltip:o("editor.blockquote")},bold:{icon:"format_bold",tooltip:o("editor.bold")},callout:{icon:"card_text",tooltip:o("editor.callout")},clearFormat:{icon:"format_clear",tooltip:o("editor.removeFormat")},code:{icon:"code",tooltip:o("editor.code")},codeBlock:{icon:"code_braces",tooltip:o("editor.codeBlock")},columns:{icon:"splitscreen_vertical_add",tooltip:"Column",rotate:!0},horizontalRule:{icon:"horizontal_rule",tooltip:o("editor.hr")},italic:{icon:"format_italic",tooltip:o("editor.italic")},image:{icon:"image",tooltip:o("editor.photo")},linkUnset:{icon:"link_off",tooltip:o("link.off")},modelViewer:{icon:"3d_rotation",tooltip:o("label.modelViewer")},strike:{icon:"format_strikethrough",tooltip:o("editor.strikethrough")},underline:{icon:"format_underlined",tooltip:o("editor.underline")},video:{icon:"videocam",tooltip:o("editor.video")}})),i=l.computed(()=>r.value[e.name]||{icon:"",isActive:!1,command:()=>{}});function s(){n(e.editor,e.name)}return(a,c)=>{var d;return l.openBlock(),l.createBlock(Re,{class:"o-simple-command-btn",icon:i.value.icon,tooltip:i.value.tooltip,"content-class":{"is-active":(d=t.editor)==null?void 0:d.isActive(t.name),"rotate-90":i.value.rotate},onClick:s},null,8,["icon","tooltip","content-class"])}}}),ZC={class:"o-block-placeholder"},QC={class:"icon"},e_={class:"placeholder"},Vc=l.defineComponent({__name:"OBlockPlaceholder",props:{icon:{type:String,default:"image"},placeholder:{type:String,default:""}},setup(t){return(e,n)=>(l.openBlock(),l.createElementBlock("section",ZC,[l.createElementVNode("div",QC,[l.createVNode(l.unref(oe),{name:t.icon},null,8,["name"])]),l.createElementVNode("div",e_,l.toDisplayString(t.placeholder),1)]))}}),Oe={amber:"#ffc107",blue:"#2172e0",brown:"#795548",cyan:"#00bcd4",deepOrange:"#ff5722",deepPurple:"#673ab7",green:"#4caf50",indigo:"#3f51b5",lightBlue:"#03a9f4",lightGreen:"#8bc34a",lime:"#cddc39",orange:"#ff9800",purple:"#9c27b0",pink:"#e91e63",red:"#f44336",teal:"#009688",yellow:"#ffeb3b"},Cr=[{label:"editor.paragraph",value:"paragraph",icon:"title",color:"",style:!0,group:"label.basic"},{label:"editor.heading1",value:"heading",icon:"format_h1",color:Oe.blue,style:!0,options:{level:1}},{label:"editor.heading2",value:"heading",icon:"format_h2",color:Oe.blue,style:!0,options:{level:2}},{label:"editor.heading3",value:"heading",icon:"format_h3",color:Oe.blue,style:!0,options:{level:3}},{label:"editor.todoList",value:"taskList",icon:"check_box",color:Oe.indigo,style:!0},{label:"editor.unorderedList",value:"bulletList",icon:"format_list_bulleted",color:Oe.indigo,style:!0},{label:"editor.orderedList",value:"orderedList",icon:"format_list_numbered",color:Oe.indigo,style:!0},{label:"editor.blockquote",value:"blockquote",icon:"format_quote_open",color:Oe.brown,style:!0},{label:"editor.codeBlock",value:"codeBlock",icon:"code_braces",color:Oe.lightBlue,style:!0},{label:"editor.horizontal",value:"horizontalRule",icon:"horizontal_rule",color:Oe.blue},{label:"editor.callout",value:"callout",color:Oe.deepOrange,icon:"card_text",style:!1},{label:"editor.emoji",value:"emoji",icon:"emoji_emotions",color:Oe.blue}],ci=Cr.filter(t=>t.style),br=[{label:"label.ai",value:"aiViewer",icon:"auto_awesome",color:Oe.purple,tips:"ai",group:"label.ai"},{label:"editor.callout",value:"callout",icon:"card_text",color:Oe.deepOrange,tips:"callout",group:"label.common"},{label:"editor.table",value:"table",icon:"window",tips:"table",color:Oe.cyan},{label:"editor.codeBlock",value:"codeBlock",icon:"code_braces",tips:"code",color:Oe.blue},{label:"editor.todoList",value:"taskList",icon:"check_box",tips:"task",color:Oe.indigo},{label:"label.image",value:"image",icon:"image",color:Oe.amber,tips:"image",group:"label.media"},{label:"label.video",value:"video",icon:"videocam",tips:"video",color:Oe.purple},{label:"label.model",value:"modelViewer",icon:"3d_rotation",tips:"model",color:Oe.purple}],ya=[...Cr,...br],Hl=[{label:"editor.duplicate",value:"duplicate",icon:"content_copy",color:Oe.blue,tips:"Ctrl+D",group:"label.common",filter:"common"},{label:"editor.delete",value:"delete",icon:"delete",tips:"Ctrl+D",color:Oe.deepOrange,filter:"common"},{label:"label.replace",value:"replace",icon:"cached",tips:"Ctrl+R",color:Oe.blue,filter:"image,video,model"},{label:"label.color",value:"palette",icon:"palette",color:Oe.purple,filter:"callout",component:"OCalloutColorBoard"}],t_={key:1,class:"group o-tips"},n_={class:"suffix o-tips"},o_={key:1,class:"item"},Wo=l.defineComponent({__name:"OBlockMenu",props:{editor:{type:Object,required:!0},node:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0},colorful:{type:Boolean,default:!1},showGroup:{type:Boolean,default:!1}},emits:["action"],setup(t,{emit:e}){const n=t,o=e,{tr:r}=ye(),i=l.ref([]),s=l.computed(()=>{var h;return(h=n.node)==null?void 0:h.type.name}),a=l.computed(()=>{const h=Hl.filter(g=>{var b;return((b=g.filter)==null?void 0:b.indexOf("common"))>=0}),m=Hl.filter(g=>{var b;return((b=g.filter)==null?void 0:b.indexOf(s.value))>=0});if(m.length>0){const g=m[0];g.group=`editor.${s.value}`}return[...h,...m]});function c(h){switch(h.component){case"OCalloutColorBoard":return Hc;default:return null}}function d(h){o("action",h),setTimeout(()=>{u(h)},0)}function u(h){switch(h.value){case"delete":n.deleteNode();break;case"duplicate":p();break}}function p(){var y,k,w;const h=n.node.nodeSize,m=n.getPos()+h,g=JSON.parse(JSON.stringify(n.node));(y=n.editor)==null||y.commands.insertContentAt(m,{type:"paragraph"}),(k=n.editor)==null||k.commands.insertContentAt(m,g);const b=m+h+1;(w=n.editor)==null||w.commands.focus(b)}function f(h,m){switch(console.log("select",h,m),m.name){case"backColor":n.updateAttributes({backColor:m.value});break;case"foreColor":n.updateAttributes({borderColor:m.value});break}}return(h,m)=>(l.openBlock(),l.createBlock(l.unref(dn),{class:"o-block-menu",hoverable:"",clickable:""},{default:l.withCtx(()=>[a.value.length?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(a.value,(g,b)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:b},[g.group?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[b>0?(l.openBlock(),l.createBlock(l.unref(Yt),{key:0})):l.createCommentVNode("",!0),t.showGroup?(l.openBlock(),l.createElementBlock("div",t_,l.toDisplayString(l.unref(r)(g.group)),1)):l.createCommentVNode("",!0)],64)):l.createCommentVNode("",!0),c(g)?(l.openBlock(),l.createBlock(l.unref(Pe),{key:1,ref_for:!0,ref:i.value[g.value],offset:[0,16],placement:"right"},{trigger:l.withCtx(()=>[l.createVNode(l.unref(Jt),{class:"item",clickable:""},{prefix:l.withCtx(()=>[l.createVNode(l.unref(oe),{name:g.icon,color:t.colorful?g.color:""},null,8,["name","color"])]),suffix:l.withCtx(()=>[l.createVNode(l.unref(oe),{name:"navigate_next",class:"o-tips"})]),default:l.withCtx(()=>[l.createTextVNode(" "+l.toDisplayString(l.unref(r)(g.label)),1)]),_:2},1024)]),default:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(c(g)),{onSelect:y=>f(g,y)},null,40,["onSelect"]))]),_:2},1536)):(l.openBlock(),l.createBlock(l.unref(Jt),{key:2,class:"item",clickable:"",onClick:y=>d(g)},{prefix:l.withCtx(()=>[l.createVNode(l.unref(oe),{name:g.icon,color:t.colorful?g.color:""},null,8,["name","color"])]),suffix:l.withCtx(()=>[l.createElementVNode("div",n_,l.toDisplayString(g.tips),1)]),default:l.withCtx(()=>[l.createTextVNode(" "+l.toDisplayString(l.unref(r)(g.label)),1)]),_:2},1032,["onClick"]))],64))),128)):(l.openBlock(),l.createElementBlock("div",o_,"No result"))]),_:1}))}}),yr=l.defineComponent({__name:"OBlockPopover",props:{modelValue:{type:Boolean,default:!1},placement:{type:String,default:"bottom-center"},showArrow:{type:Boolean,default:!1},hideClickOutside:{type:Boolean,default:!1},tippyClass:{type:String,default:""},offset:{type:Object,default:function(){return[0,10]}}},emits:["update:modelValue","show","hide"],setup(t,{emit:e}){const n=t,o=e,r=l.ref();function i(a){o("update:modelValue",a)}function s(){n.hideClickOutside&&o("update:modelValue",!1)}return l.watch(()=>n.modelValue,a=>{var c,d;console.log("modelValue",a),a?(c=r.value)==null||c.setShow(!0):(d=r.value)==null||d.setShow(!1)}),l.onMounted(()=>{var a;n.modelValue&&((a=r.value)==null||a.setShow(!0))}),(a,c)=>(l.openBlock(),l.createBlock(l.unref(Pe),{ref_key:"popover",ref:r,placement:t.placement,"tippy-class":t.tippyClass,trigger:"manual",arrow:t.showArrow,offset:t.offset,show:t.modelValue,"onUpdate:show":i,onClickoutside:s},{trigger:l.withCtx(()=>[l.renderSlot(a.$slots,"default")]),default:l.withCtx(()=>[l.renderSlot(a.$slots,"popover-content")]),_:3},8,["placement","tippy-class","arrow","offset","show"]))}}),r_={class:"o-block-toolbar editable-only"},i_={class:"button-group"},zc=l.defineComponent({__name:"OBlockToolbar",props:{...ut,type:{type:String,default:"link"}},emits:["action"],setup(t,{emit:e}){const n=t,o=e,{locale:r,tr:i}=ye(),s=l.ref();function a(c){var d;o("action",c),(d=s.value)==null||d.setShow(!1)}return(c,d)=>(l.openBlock(),l.createElementBlock("div",r_,[l.createElementVNode("section",i_,[l.renderSlot(c.$slots,"default"),l.createVNode(l.unref(Pe),{ref_key:"popover",ref:s,placement:"bottom-end",size:"medium",trigger:"click","show-arrow":!1},{trigger:l.withCtx(()=>[l.createVNode(l.unref(ot),{icon:"more_horiz",tooltip:l.unref(i)("label.more")},null,8,["tooltip"])]),default:l.withCtx(()=>[l.createVNode(l.unref(Wo),l.mergeProps(n,{onAction:a}),null,16)]),_:1},512)])]))}}),s_={class:"o-callout-color-board"},a_={class:"fore-colors"},l_={class:"color-row"},c_={class:"color-row"},d_={class:"back-colors"},u_={class:"color-row"},p_={class:"color-row"},Hc=l.defineComponent({__name:"OCalloutColorBoard",props:{foreColor:{type:String,default:""},backColor:{type:String,default:""},activeColor:{type:String,default:""}},emits:["select"],setup(t,{emit:e}){const n=e;function o(s,a){n("select",{name:s,value:a.value})}const r=l.computed(()=>[{label:"Grey",value:"#e9e9e9"},{label:"Brown",value:"#ffd591"},{label:"Orange",value:"#ffbb96"},{label:"Yellow",value:"#fff08f"},{label:"Green",value:"#b7eb8f"},{label:"Blue",value:"#91d5ff"},{label:"Purple",value:"#d3adf7"},{label:"Pink",value:"#ffadd2"},{label:"Red",value:"#ffa39e"}]),i=l.computed(()=>[{label:"Grey",value:"#F5F5F5"},{label:"Brown",value:"#F4EEEE"},{label:"Orange",value:"#FAEBDD"},{label:"Yellow",value:"#FBF3DB"},{label:"Green",value:"#EDF3EC"},{label:"Blue",value:"#E7F3F8"},{label:"Purple",value:"#F6F3F9"},{label:"Pink",value:"#FAF1F5"},{label:"Red",value:"#FDEBEC"}]);return(s,a)=>(l.openBlock(),l.createElementBlock("section",s_,[l.createElementVNode("section",a_,[a[4]||(a[4]=l.createElementVNode("div",{class:"label o-tips"},"Border color",-1)),l.createElementVNode("div",l_,[l.createVNode(l.unref(Re),{icon:"slash_forward",tooltip:"No color","content-class":"border",onClick:a[0]||(a[0]=c=>o("foreColor",{value:""}))}),t.foreColor?(l.openBlock(),l.createBlock(l.unref(Re),{key:0,tooltip:"Last used","content-style":{borderColor:t.foreColor},onClick:a[1]||(a[1]=c=>o("foreColor",{value:t.foreColor}))},null,8,["content-style"])):l.createCommentVNode("",!0)]),l.createElementVNode("div",c_,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(r.value,(c,d)=>(l.openBlock(),l.createBlock(l.unref(Re),{key:`col-${d}`,tooltip:c.label,"content-style":{borderColor:c.value},onClick:u=>o("foreColor",c)},null,8,["tooltip","content-style","onClick"]))),128))])]),l.createElementVNode("section",d_,[a[5]||(a[5]=l.createElementVNode("div",{class:"label o-tips"},"Background",-1)),l.createElementVNode("div",u_,[l.createVNode(l.unref(Re),{icon:"slash_forward",tooltip:"Default Color","content-class":"border",onClick:a[2]||(a[2]=c=>o("backColor",{value:"#F5F5F5"}))}),t.backColor?(l.openBlock(),l.createBlock(l.unref(Re),{key:0,"content-style":{backgroundColor:t.backColor},tooltip:"Last used","content-class":"border",onClick:a[3]||(a[3]=c=>o("backColor",{value:t.backColor}))},null,8,["content-style"])):l.createCommentVNode("",!0)]),l.createElementVNode("div",p_,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(i.value,(c,d)=>(l.openBlock(),l.createBlock(l.unref(Re),{key:`col-${d}`,tooltip:c.label,"content-style":{backgroundColor:c.value},onClick:u=>o("backColor",c)},null,8,["tooltip","content-style","onClick"]))),128))])])]))}}),f_=l.defineComponent({__name:"OCalloutColorDropdown",props:{editor:{type:Object}},emits:["select"],setup(t,{emit:e}){const n=e,{tr:o}=ye(),{run:r}=we(),i=l.ref(null),s=l.ref(""),a=l.ref("");function c(d,u){d==="foreColor"?(s.value=u,localStorage.setItem("yiitap.text-color.fore",u)):d==="backColor"&&(a.value=u,localStorage.setItem("yiitap.text-color.back",u)),n("select",d,u)}return l.onMounted(()=>{s.value=localStorage.getItem("yiitap.text-color.fore")||"",a.value=localStorage.getItem("yiitap.text-color.back")||""}),(d,u)=>(l.openBlock(),l.createBlock(l.unref(Pe),{ref_key:"popover",ref:i,placement:"bottom-center",trigger:"hover",arrow:""},{trigger:l.withCtx(()=>[l.createVNode(l.unref(ot),{icon:"palette",tooltip:l.unref(o)("editor.textColor")},{default:l.withCtx(()=>[l.createVNode(l.unref(oe),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:l.withCtx(()=>{var p;return[l.createVNode(l.unref(Hc),{"fore-color":s.value,"back-color":a.value,"default-label":l.unref(o)("editor.defaultColor"),"active-color":(p=t.editor)==null?void 0:p.getAttributes("textStyle").color,onSelect:c},null,8,["fore-color","back-color","default-label","active-color"])]}),_:1},512))}}),va=l.defineComponent({__name:"OContextMenu",props:{modelValue:{type:Boolean,default:!1},clientX:{type:Number,default:0},clientY:{type:Number,default:0},event:{type:Object,default:function(){return{}}}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,o=e,r=l.ref();l.computed(()=>{var a;return n.clientX||((a=n.event)==null?void 0:a.clientX)||0}),l.computed(()=>{var a;return n.clientY||((a=n.event)==null?void 0:a.clientY)||0});function i(a){o("update:modelValue",a)}function s(){o("update:modelValue",!1)}return l.watch(()=>n.modelValue,a=>{var c;a?setTimeout(()=>{var d;(d=r.value)==null||d.setShow(a)},0):(c=r.value)==null||c.setShow(a)}),(a,c)=>(l.openBlock(),l.createBlock(l.unref(Pe),{ref_key:"popover",ref:r,placement:"bottom-start",trigger:"manual",show:t.modelValue,"show-arrow":!1,event:t.event,"onUpdate:show":i,onClickoutside:s},{default:l.withCtx(()=>[l.renderSlot(a.$slots,"default")]),_:3},8,["show","event"]))}}),h_={class:"o-color-board"},m_={class:"cell-container"},g_={class:"label"},b_=["onClick"],ka=l.defineComponent({__name:"OColorBoard",props:{defaultColor:{type:String,default:""},defaultLabel:{type:String,default:""},activeColor:{type:String,default:""}},emits:["select"],setup(t,{emit:e}){const n=t,o=e;function r(c){o("select",c.hex)}function i(c){return n.activeColor===c}function s(c){return"abc"}const a=l.computed(()=>[[{label:"color",rgb:"rgb(0, 0, 0)",hex:"#000000"},{label:"color",rgb:"rgb(38, 38, 38)",hex:"#262626"},{label:"color",rgb:"rgb(89, 89, 89)",hex:"#595959"},{label:"color",rgb:"rgb(140, 140, 140)",hex:"#8c8c8c"},{label:"color",rgb:"rgb(191, 191, 191)",hex:"#bfbfbf"},{label:"color",rgb:"rgb(217, 217, 217)",hex:"#d9d9d9"},{label:"color",rgb:"rgb(233, 233, 233)",hex:"#e9e9e9"},{label:"color",rgb:"rgb(245, 245, 245)",hex:"#f5f5f5"},{label:"color",rgb:"rgb(250, 250, 250)",hex:"#fafafa",border:!0},{label:"color",rgb:"rgb(255, 255, 255)",hex:"#ffffff",border:!0}],[{label:"color",rgb:"rgb(245, 34, 45)",hex:"#f5222d"},{label:"color",rgb:"rgb(250, 84, 28)",hex:"#fa541c"},{label:"color",rgb:"rgb(250, 140, 22)",hex:"#fa8c16"},{label:"color",rgb:"rgb(250, 219, 20)",hex:"#fadb14"},{label:"color",rgb:"rgb(82, 196, 26)",hex:"#52c41a"},{label:"color",rgb:"rgb(19, 194, 194)",hex:"#13c2c2"},{label:"color",rgb:"rgb(24, 144, 255)",hex:"#1890ff"},{label:"color",rgb:"rgb(47, 84, 235)",hex:"#2f54eb"},{label:"color",rgb:"rgb(114, 46, 209)",hex:"#722ed1"},{label:"color",rgb:"rgb(235, 47, 150)",hex:"#eb2f96"}],[{label:"color",rgb:"rgb(255, 232, 230)",hex:"#ffe8e6"},{label:"color",rgb:"rgb(255, 236, 224)",hex:"#ffece0"},{label:"color",rgb:"rgb(255, 239, 209)",hex:"#ffefd1"},{label:"color",rgb:"rgb(255, 248, 189)",hex:"#fff8bd"},{label:"color",rgb:"rgb(228, 247, 210)",hex:"#e4f7d2"},{label:"color",rgb:"rgb(211, 245, 240)",hex:"#d3f5f0"},{label:"color",rgb:"rgb(212, 238, 252)",hex:"#d4eefc"},{label:"color",rgb:"rgb(222, 232, 252)",hex:"#dee8fc"},{label:"color",rgb:"rgb(239, 225, 250)",hex:"#efe1fa"},{label:"color",rgb:"rgb(250, 225, 235)",hex:"#fae1eb"}],[{label:"color",rgb:"rgb(255, 163, 158)",hex:"#ffa39e"},{label:"color",rgb:"rgb(255, 187, 150)",hex:"#ffbb96"},{label:"color",rgb:"rgb(255, 213, 145)",hex:"#ffd591"},{label:"color",rgb:"rgb(255, 240, 143)",hex:"#fff08f"},{label:"color",rgb:"rgb(183, 235, 143)",hex:"#b7eb8f"},{label:"color",rgb:"rgb(135, 232, 222)",hex:"#87e8de"},{label:"color",rgb:"rgb(145, 213, 255)",hex:"#91d5ff"},{label:"color",rgb:"rgb(173, 198, 255)",hex:"#adc6ff"},{label:"color",rgb:"rgb(211, 173, 247)",hex:"#d3adf7"},{label:"color",rgb:"rgb(255, 173, 210)",hex:"#ffadd2"}],[{label:"color",rgb:"rgb(255, 77, 79)",hex:"#ff4d4f"},{label:"color",rgb:"rgb(255, 122, 69)",hex:"#ff7a45"},{label:"color",rgb:"rgb(255, 169, 64)",hex:"#ffa940"},{label:"color",rgb:"rgb(255, 236, 61)",hex:"#ffec3d"},{label:"color",rgb:"rgb(115, 209, 61)",hex:"#73d13d"},{label:"color",rgb:"rgb(54, 207, 201)",hex:"#36cfc9"},{label:"color",rgb:"rgb(64, 169, 255)",hex:"#40a9ff"},{label:"color",rgb:"rgb(89, 126, 247)",hex:"#597ef7"},{label:"color",rgb:"rgb(146, 84, 222)",hex:"#9254de"},{label:"color",rgb:"rgb(247, 89, 171)",hex:"#f759ab"}],[{label:"color",rgb:"rgb(207, 19, 34)",hex:"#cf1322"},{label:"color",rgb:"rgb(212, 56, 13)",hex:"#d4380d"},{label:"color",rgb:"rgb(212, 107, 8)",hex:"#d46b08"},{label:"color",rgb:"rgb(212, 177, 6)",hex:"#d4b106"},{label:"color",rgb:"rgb(56, 158, 13)",hex:"#389e0d"},{label:"color",rgb:"rgb(8, 151, 156)",hex:"#08979c"},{label:"color",rgb:"rgb(9, 109, 217)",hex:"#096dd9"},{label:"color",rgb:"rgb(29, 57, 196)",hex:"#1d39c4"},{label:"color",rgb:"rgb(83, 29, 171)",hex:"#531dab"},{label:"color",rgb:"rgb(196, 29, 127)",hex:"#c41d7f"}],[{label:"color",rgb:"rgb(130, 0, 20)",hex:"#820014"},{label:"color",rgb:"rgb(135, 20, 0)",hex:"#871400"},{label:"color",rgb:"rgb(135, 56, 0)",hex:"#873800"},{label:"color",rgb:"rgb(97, 71, 0)",hex:"#614700"},{label:"color",rgb:"rgb(19, 82, 0)",hex:"#135200"},{label:"color",rgb:"rgb(0, 71, 79)",hex:"#00474f"},{label:"color",rgb:"rgb(0, 58, 140)",hex:"#003a8c"},{label:"color",rgb:"rgb(6, 17, 120)",hex:"#061178"},{label:"color",rgb:"rgb(34, 7, 94)",hex:"#22075e"},{label:"color",rgb:"rgb(120, 6, 80)",hex:"#780650"}]]);return(c,d)=>(l.openBlock(),l.createElementBlock("section",h_,[l.createElementVNode("div",{class:"default-color",onClick:d[0]||(d[0]=u=>r({hex:t.defaultColor}))},[l.createElementVNode("div",m_,[l.createElementVNode("div",{class:"cell border",style:l.normalizeStyle({background:t.defaultColor})},[l.createVNode(l.unref(oe),{name:"slash_forward"})],4)]),l.createElementVNode("div",g_,l.toDisplayString(t.defaultLabel),1)]),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(a.value,(u,p)=>(l.openBlock(),l.createElementBlock("div",{class:"color-row",key:`row-${p}`},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(u,(f,h)=>(l.openBlock(),l.createElementBlock("div",{class:"",key:`col-${h}`},[l.createElementVNode("div",{class:"cell-container",onClick:m=>r(f)},[l.createElementVNode("div",{class:l.normalizeClass(["cell",{border:f.border}]),style:l.normalizeStyle({backgroundColor:f.hex})},[i(f.hex)?(l.openBlock(),l.createBlock(l.unref(oe),{key:0,name:"done",style:l.normalizeStyle({color:s(f.rgb)})},null,8,["style"])):l.createCommentVNode("",!0)],6)],8,b_)]))),128))]))),128))]))}}),ot=l.defineComponent({__name:"OCommandBtn",props:{icon:{type:String,default:""},color:{type:String,default:""},background:{type:String,default:""},tooltip:{type:String,default:""},placement:{type:String,default:"top"},disabled:{type:Boolean,default:!1},contentClass:{type:[String,Object],default:""},contentStyle:{type:[String,Object],default:""},iconClass:{type:[String,Object],default:""}},emits:["click"],setup(t,{emit:e}){const n=e;return(o,r)=>(l.openBlock(),l.createBlock(l.unref(Yn),{placement:t.placement},{trigger:l.withCtx(()=>[l.createElementVNode("button",{class:l.normalizeClass(["o-menubar-btn o-command-btn o-btn",t.contentClass]),style:l.normalizeStyle(t.contentStyle),onClick:r[0]||(r[0]=i=>n("click",i))},[l.createVNode(l.unref(oe),{name:t.icon,color:t.color,class:l.normalizeClass(t.iconClass)},null,8,["name","color","class"]),l.renderSlot(o.$slots,"default")],6)]),default:l.withCtx(()=>[l.createTextVNode(" "+l.toDisplayString(t.tooltip),1)]),_:3},8,["placement"]))}}),_s=l.defineComponent({__name:"OCommonBtn",props:{icon:{type:String,default:""},color:{type:String,default:""},background:{type:String,default:""},tooltip:{type:String,default:""},placement:{type:String,default:"top"},disabled:{type:Boolean,default:!1},contentClass:{type:[String,Object],default:""},contentStyle:{type:[String,Object],default:""},iconClass:{type:[String,Object],default:""}},emits:["click"],setup(t,{emit:e}){const n=e;return(o,r)=>(l.openBlock(),l.createBlock(l.unref(Yn),{placement:t.placement},{trigger:l.withCtx(()=>[l.createElementVNode("div",{class:l.normalizeClass(["o-menubar-btn o-command-btn o-btn",t.contentClass]),style:l.normalizeStyle(t.contentStyle),onClick:r[0]||(r[0]=i=>n("click",i))},[l.createVNode(l.unref(oe),{name:t.icon,color:t.color,class:l.normalizeClass(t.iconClass)},null,8,["name","color","class"]),l.renderSlot(o.$slots,"default")],6)]),default:l.withCtx(()=>[l.createTextVNode(" "+l.toDisplayString(t.tooltip),1)]),_:3},8,["placement"]))}}),y_={key:0,class:"o-doc-toc toc"},v_={class:"mini-view"},k_={class:"toc__list"},E_={class:"main-view"},w_={class:"toc__title"},C_={class:"toc__list"},__=["onClick"],S_=l.defineComponent({name:"ODocToc",__name:"ODocToc",props:{editor:{type:cn},maxLevel:{type:Number,default:3}},emits:["docScroll"],setup(t,{expose:e,emit:n}){const o=t,r=n,{tr:i}=ye(),s=l.ref([]),a=l.ref("");function c(){var h;a.value=window.location.hash,(h=o.editor)==null||h.on("update",u),setTimeout(()=>{d(),u()},0)}function d(){const h=document.querySelector(".yiitap"),m=h==null?void 0:h.parentElement;m==null||m.addEventListener("scroll",p)}function u(){var m;const h=[];(m=o.editor)==null||m.state.doc.descendants((g,b)=>{if(g.type.name==="heading"){const y=g.attrs["data-id"];h.push({level:g.attrs.level,text:g.textContent,id:y})}}),s.value=h}function p(h){for(const m of s.value){const g=document.querySelector(`[data-id="${m.id}"]`);if(!g)continue;const b=g.getBoundingClientRect();if(b.top>=0&&b.top<window.innerHeight/2){a.value=m.id;break}}r("docScroll",h)}function f(h){a.value=h.id;const m=document.querySelector(`[data-id="${h.id}"]`);m&&m.scrollIntoView({behavior:"smooth",block:"start"})}return l.watch(()=>o.editor,h=>{c()}),e({onScroll:p,headings:s}),(h,m)=>s.value.length?(l.openBlock(),l.createElementBlock("section",y_,[l.createVNode(l.unref(Pe),{ref:"popover","content-class":"o-toc-popover",placement:"left-start",offset:[0,-50],delay:0,duration:100},{trigger:l.withCtx(()=>[l.createElementVNode("div",v_,[l.createElementVNode("ul",k_,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(s.value,(g,b)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:b},[g.level<=Math.max(Math.min(t.maxLevel,3),2)?(l.openBlock(),l.createElementBlock("li",{key:0,class:l.normalizeClass(["toc__item",[a.value===g.id?"selected":"",`toc__item--${g.level}`]])},null,2)):l.createCommentVNode("",!0)],64))),128))])])]),default:l.withCtx(()=>[l.createElementVNode("div",E_,[l.createElementVNode("div",w_,l.toDisplayString(l.unref(i)("label.toc")),1),l.createElementVNode("ul",C_,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(s.value,(g,b)=>(l.openBlock(),l.createElementBlock("li",{class:l.normalizeClass(["toc__item",`toc__item--${g.level}`]),key:b},[l.createElementVNode("span",{class:l.normalizeClass(["heading",{selected:a.value===g.id}]),onClick:y=>f(g)},l.toDisplayString(g.text),11,__)],2))),128))])])]),_:1},512)])):l.createCommentVNode("",!0)}}),Uc=(t,e)=>{const n=t.__vccOpts||t;for(const[o,r]of e)n[o]=r;return n},x_=Uc(S_,[["__scopeId","data-v-3830551a"]]),N_={class:"o-emoji-select"},T_={key:0},O_={class:"groups o-scroll"},M_={class:"items"},A_=["onClick"],R_={key:0,class:"groups-empty"},D_={class:"group-icons"},I_=["onClick"],Ea=l.defineComponent({__name:"OEmojiSelect",props:{items:{type:Array,required:!0},enableSearch:{type:Boolean,default:!1}},emits:["select"],setup(t,{emit:e}){const n=t,o=e,r=l.ref(null),i=l.ref(""),s=l.ref([]),a=l.ref([]),c=l.ref(0),d=l.computed(()=>i.value?s.value:n.items),u=l.computed(()=>{let m=!1;return d.value.map(g=>{m=m||g.emojis.length}),m});function p(){c.value=0,s.value=i.value?Yr.filterEmojiGroups(i.value):[]}function f(m){o("select",m)}function h(m,g){c.value=g,a.value[g].scrollIntoView({behavior:"instant",block:"start"})}return l.onMounted(()=>{}),(m,g)=>(l.openBlock(),l.createElementBlock("section",N_,[t.enableSearch?(l.openBlock(),l.createElementBlock("div",T_,[l.createVNode(l.unref(Ko),{ref_key:"input",ref:r,modelValue:i.value,"onUpdate:modelValue":[g[0]||(g[0]=b=>i.value=b),p],type:"text",autofocus:"",clearable:""},{prefix:l.withCtx(()=>[l.createVNode(l.unref(oe),{name:"search",class:"o-tips"})]),_:1},8,["modelValue"])])):l.createCommentVNode("",!0),l.createElementVNode("section",O_,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(d.value,(b,y)=>{var k;return l.withDirectives((l.openBlock(),l.createElementBlock("div",{key:`group-${y}`,class:"group"},[l.createElementVNode("header",{ref_for:!0,ref_key:"groupRefs",ref:a},l.toDisplayString(b.name),513),l.createElementVNode("section",M_,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(b.emojis,(w,v)=>(l.openBlock(),l.createElementBlock("div",{key:`item-${v}`},[l.createElementVNode("div",{class:"item",onClick:_=>f(w)},l.toDisplayString(w.emoji),9,A_)]))),128))])],512)),[[l.vShow,(k=b.emojis)==null?void 0:k.length]])}),128)),u.value?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("div",R_,"没有记录"))]),l.createElementVNode("section",D_,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(d.value,(b,y)=>(l.openBlock(),l.createBlock(l.unref(Yn),{key:`target-${y}`,delay:300},{trigger:l.withCtx(()=>{var k;return[l.withDirectives(l.createElementVNode("div",{class:l.normalizeClass(["item",{active:c.value===y}]),onClick:w=>h(b,y)},[l.createVNode(l.unref(oe),{name:l.unref(Yr.emojiGroupIcons)[b.slug]},null,8,["name"])],10,I_),[[l.vShow,(k=b.emojis)==null?void 0:k.length]])]}),default:l.withCtx(()=>[l.createTextVNode(" "+l.toDisplayString(b.name),1)]),_:2},1024))),128))])]))}}),nl=[{label:"Arduino",value:"arduino",icon:"code_blocks"},{label:"Bash",value:"bash",icon:"code_blocks"},{label:"C",value:"c",icon:"code_blocks"},{label:"C++",value:"cpp",icon:"code_blocks"},{label:"C#",value:"csharp",icon:"code_blocks"},{label:"CSS",value:"css",icon:"code_blocks"},{label:"Diff",value:"diff",icon:"code_blocks"},{label:"Go",value:"go",icon:"code_blocks"},{label:"GraphQL",value:"graphql",icon:"code_blocks"},{label:"Ini",value:"ini",icon:"code_blocks"},{label:"Java",value:"java",icon:"code_blocks"},{label:"JavaScript",value:"javascript",icon:"code_blocks"},{label:"JSON",value:"json",icon:"code_blocks"},{label:"Kotlin",value:"kotlin",icon:"code_blocks"},{label:"Less",value:"less",icon:"code_blocks"},{label:"Lua",value:"lua",icon:"code_blocks"},{label:"Makefile",value:"makefile",icon:"code_blocks"},{label:"Markdown",value:"markdown",icon:"code_blocks"},{label:"Objective-C",value:"objectivec",icon:"code_blocks"},{label:"Perl",value:"perl",icon:"code_blocks"},{label:"PHP",value:"php",icon:"code_blocks"},{label:"PHP-Template",value:"php-template",icon:"code_blocks"},{label:"Plain Text",value:"plaintext",icon:"code_blocks"},{label:"Python",value:"python",icon:"code_blocks"},{label:"Python-Repl",value:"python-repl",icon:"code_blocks"},{label:"R",value:"r",icon:"code_blocks"},{label:"Ruby",value:"ruby",icon:"code_blocks"},{label:"Rust",value:"rust",icon:"code_blocks"},{label:"Scss",value:"scss",icon:"code_blocks"},{label:"Shell",value:"shell",icon:"code_blocks"},{label:"SQL",value:"sql",icon:"code_blocks"},{label:"Swift",value:"swift",icon:"code_blocks"},{label:"TypeScript",value:"typescript",icon:"code_blocks"},{label:"VB.Net",value:"vbnet",icon:"code_blocks"},{label:"WebAssembly",value:"wasm",icon:"code_blocks"},{label:"XML",value:"xml",icon:"code_blocks"},{label:"YAML",value:"yaml",icon:"code_blocks"}],B_={class:"selected-language"},L_={class:"header"},P_={class:"o-scroll"},lm=l.defineComponent({__name:"OLanguageDropdown",props:{language:{type:String,default:"shell"}},emits:["select"],setup(t,{emit:e}){const n=t,o=e,{tr:r}=ye(),i=l.ref(),s=l.ref(),a=l.ref(""),c=l.ref(0),d=l.ref(""),u=l.computed(()=>a.value?nl.filter(y=>y.value.toLowerCase().indexOf(a.value.toLowerCase())>=0):nl),p=l.computed(()=>nl.find(y=>y.value===d.value));function f(y){y&&setTimeout(()=>{var k;(k=s.value)==null||k.focus(),c.value=0,window.addEventListener("keyup",b)},0)}function h(){window.removeEventListener("keyup",b)}function m(y){h(),d.value=y.value,o("select",y.value)}function g(){m(u.value[c.value])}function b(y){if(u.value.length>0){switch(y.code){case"ArrowDown":c.value=c.value+1;break;case"ArrowUp":c.value=c.value-1;break;case"Enter":g();break}c.value>=u.value.length&&(c.value=0),c.value<0&&(c.value=u.value.length-1)}else c.value=0}return l.onMounted(()=>{d.value=n.language}),(y,k)=>(l.openBlock(),l.createBlock(l.unref(Pe),{ref_key:"popover",ref:i,placement:"bottom-start",trigger:"click","tippy-class":"o-language-popover","conten-class":"dropdown","onUpdate:show":f},{trigger:l.withCtx(()=>[l.createVNode(l.unref(Dt),{class:"o-dropdown-btn"},{default:l.withCtx(()=>{var w;return[l.createElementVNode("span",B_,l.toDisplayString((w=p.value)==null?void 0:w.label),1),l.createVNode(l.unref(oe),{name:"arrow_drop_down",class:"arrow"})]}),_:1})]),default:l.withCtx(()=>[l.createElementVNode("header",L_,[l.createVNode(l.unref(Ko),{ref_key:"input",ref:s,modelValue:a.value,"onUpdate:modelValue":k[0]||(k[0]=w=>a.value=w),type:"text",placeholder:"Search",autofocus:"",clearable:""},{prefix:l.withCtx(()=>[l.createVNode(l.unref(oe),{name:"search",class:"o-tips"})]),_:1},8,["modelValue"])]),l.createElementVNode("section",P_,[l.createVNode(l.unref(dn),{hoverable:"",clickable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(u.value,(w,v)=>(l.openBlock(),l.createBlock(l.unref(Jt),{key:v,onClick:_=>m(w),class:l.normalizeClass({"is-active":w.value===d.value,"is-select":v===c.value})},{prefix:l.withCtx(()=>[l.createVNode(l.unref(oe),{name:w.icon},null,8,["name"])]),default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(w.label)+" ",1)]),_:2},1032,["onClick","class"]))),128))]),_:1})])]),_:1},512))}}),$_={class:"o-media-input"},F_={class:"fields"},V_={class:"actions"},qc=l.defineComponent({__name:"OMediaInput",props:{val:{type:String,default:""},type:{type:String,default:""}},emits:["input"],setup(t,{emit:e}){const n=t,o=e,{tr:r}=ye(),i=l.ref(),s=l.ref(""),a=l.ref("");function c(){return a.value?(s.value="null",!0):(s.value="error",!1)}function d(){c()&&o("input",a.value)}return l.onMounted(()=>{a.value=n.val,setTimeout(()=>{var u;(u=i.value)==null||u.focus()},0)}),(u,p)=>(l.openBlock(),l.createElementBlock("section",$_,[l.createElementVNode("section",F_,[p[1]||(p[1]=l.createElementVNode("div",{class:"o-media-title"},"Link",-1)),l.createVNode(l.unref(Ko),{ref_key:"input",ref:i,modelValue:a.value,"onUpdate:modelValue":p[0]||(p[0]=f=>a.value=f),status:s.value,type:"text",autofocus:"",clearable:""},{prefix:l.withCtx(()=>[l.createVNode(l.unref(oe),{name:"link",class:"o-tips"})]),_:1},8,["modelValue","status"])]),l.createElementVNode("footer",V_,[l.createVNode(l.unref(Dt),{type:"info",onClick:d},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(r)("label.ok")),1)]),_:1})])]))}}),z_={class:"o-meta-input"},H_={class:"header"},U_={class:"title"},q_={class:"fields"},W_={class:"actions"},Wc=l.defineComponent({__name:"OMetaInput",props:{val:{type:String,default:""},title:{type:String,default:"Link"},type:{type:String,default:"link"},icon:{type:String,default:"link"},secondIcon:{type:String,default:""},secondLabel:{type:String,default:""}},emits:["cancel","confirm"],setup(t,{emit:e}){const n=t,o=e,{tr:r}=ye(),i=l.ref(null),s=l.ref("");function a(){console.log("confirm",s.value),o("confirm",s.value)}return l.onMounted(()=>{s.value=n.val,setTimeout(()=>{var c;(c=i.value)==null||c.focus()},0)}),(c,d)=>(l.openBlock(),l.createElementBlock("section",z_,[l.createElementVNode("section",H_,[l.createElementVNode("div",U_,l.toDisplayString(t.title),1),l.createElementVNode("div",null,[l.renderSlot(c.$slots,"header-right")])]),l.createElementVNode("section",q_,[l.createVNode(l.unref(Ko),{ref_key:"input",ref:i,modelValue:s.value,"onUpdate:modelValue":d[0]||(d[0]=u=>s.value=u),type:"text",autofocus:"",clearable:""},{prefix:l.withCtx(()=>[l.createVNode(l.unref(oe),{name:t.icon,class:"o-tips"},null,8,["name"])]),_:1},8,["modelValue"])]),l.createElementVNode("footer",W_,[l.createVNode(l.unref(Dt),{type:"tertiary",onClick:d[1]||(d[1]=u=>o("cancel"))},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(r)("label.cancel")),1)]),_:1}),l.createVNode(l.unref(Dt),{type:"info",onClick:a},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(r)("label.ok")),1)]),_:1})])]))}}),K_={class:"o-table-grid"},j_=["onMouseover"],cm=l.defineComponent({__name:"OTableGrid",emits:["select"],setup(t,{emit:e}){const n=e,o=l.ref(6),r=l.ref(6),i=l.ref(2),s=l.ref(2);function a(d,u){i.value=d,s.value=u,o.value===d&&o.value<10&&(o.value+=1),r.value===u&&r.value<10&&(r.value+=1)}function c(){n("select",{rows:i.value,cols:s.value,withHeaderRow:!0})}return(d,u)=>(l.openBlock(),l.createElementBlock("section",K_,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(o.value,(p,f)=>(l.openBlock(),l.createElementBlock("div",{class:"rows",key:`row-${f}`},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(r.value,(h,m)=>(l.openBlock(),l.createElementBlock("div",{key:`col-${m}`},[l.createElementVNode("div",{class:l.normalizeClass(["cell",{selected:p<=i.value&&h<=s.value}]),onMouseover:g=>a(p,h),onClick:c},null,42,j_)]))),128))]))),128)),l.createElementVNode("footer",null,l.toDisplayString(i.value)+" x "+l.toDisplayString(s.value),1)]))}}),G_={class:"o-table-cell-background o-button-group"},Y_={class:"o-command-btn"},dm=l.defineComponent({__name:"OTableCellBackground",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ye(),{run:o}=we(),r=l.ref(),i=l.ref("#ffec3d");function s(){a(i.value)}function a(c){r.value.setShow(!1),i.value=c,o(e.editor,"tableCellAttribute",{name:"background",value:i.value})}return(c,d)=>(l.openBlock(),l.createBlock(l.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom-start",trigger:"click"},{trigger:l.withCtx(()=>[l.createVNode(l.unref(Yn),{trigger:"hover"},{trigger:l.withCtx(()=>[l.createElementVNode("div",G_,[l.createElementVNode("div",{class:"o-command-btn label",onClick:l.withModifiers(s,["stop"])},[l.createVNode(l.unref(oe),{name:"crop_16_9",class:"arrow"}),l.createElementVNode("div",{class:"indicator",style:l.normalizeStyle(`background: ${i.value}`)},null,4)]),l.createElementVNode("div",Y_,[l.createVNode(l.unref(oe),{name:"arrow_drop_down"})])])]),default:l.withCtx(()=>[l.createTextVNode(" "+l.toDisplayString(l.unref(n)("editor.highlightColor")),1)]),_:1})]),default:l.withCtx(()=>[l.createVNode(l.unref(ka),{"default-color":"","default-label":l.unref(n)("editor.noColor"),onSelect:a},null,8,["default-label"])]),_:1},512))}}),J_={class:"o-simple-color-board"},X_={class:"fore-colors"},Z_={class:"color-row"},Q_={class:"color-row"},eS={class:"back-colors"},tS={class:"color-row"},nS={class:"color-row"},um=l.defineComponent({__name:"OTextColorBoard",props:{foreColor:{type:String,default:""},backColor:{type:String,default:""},activeColor:{type:String,default:""}},emits:["select"],setup(t,{emit:e}){const n=e;function o(s,a){n("select",s,a.value)}const r=l.computed(()=>[{label:"Grey",value:"#787774"},{label:"Brown",value:"#9F6B53"},{label:"Orange",value:"#D9730D"},{label:"Yellow",value:"#CB912F"},{label:"Green",value:"#448361"},{label:"Blue",value:"#337EA9"},{label:"Purple",value:"#9065B0"},{label:"Pink",value:"#C14C8A"},{label:"Red",value:"#D44C47"}]),i=l.computed(()=>[{label:"Grey",value:"#F1F1EF"},{label:"Brown",value:"#F4EEEE"},{label:"Orange",value:"#FAEBDD"},{label:"Yellow",value:"#FBF3DB"},{label:"Green",value:"#EDF3EC"},{label:"Blue",value:"#E7F3F8"},{label:"Purple",value:"#F6F3F9"},{label:"Pink",value:"#FAF1F5"},{label:"Red",value:"#FDEBEC"}]);return(s,a)=>(l.openBlock(),l.createElementBlock("section",J_,[l.createElementVNode("section",X_,[a[4]||(a[4]=l.createElementVNode("div",{class:"label o-tips"},"Color",-1)),l.createElementVNode("div",Z_,[l.createVNode(l.unref(Re),{icon:"format_text",tooltip:"Default color","content-class":"border",onClick:a[0]||(a[0]=c=>o("foreColor",{value:""}))}),t.foreColor?(l.openBlock(),l.createBlock(l.unref(Re),{key:0,icon:"format_text",color:t.foreColor,tooltip:"Last used","content-class":"border",onClick:a[1]||(a[1]=c=>o("foreColor",{value:t.foreColor}))},null,8,["color"])):l.createCommentVNode("",!0)]),l.createElementVNode("div",Q_,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(r.value,(c,d)=>(l.openBlock(),l.createBlock(l.unref(Re),{key:`col-${d}`,icon:"format_text",color:c.value,tooltip:c.label,onClick:u=>o("foreColor",c)},null,8,["color","tooltip","onClick"]))),128))])]),l.createElementVNode("section",eS,[a[5]||(a[5]=l.createElementVNode("div",{class:"label o-tips"},"Background",-1)),l.createElementVNode("div",tS,[l.createVNode(l.unref(Re),{icon:"slash_forward",tooltip:"No Color","content-class":"border",onClick:a[2]||(a[2]=c=>o("backColor",{value:""}))}),t.backColor?(l.openBlock(),l.createBlock(l.unref(Re),{key:0,icon:"format_text",tooltip:"Last used","content-class":"border","content-style":{backgroundColor:t.backColor},onClick:a[3]||(a[3]=c=>o("backColor",{value:t.backColor}))},null,8,["content-style"])):l.createCommentVNode("",!0)]),l.createElementVNode("div",nS,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(i.value,(c,d)=>(l.openBlock(),l.createBlock(l.unref(Re),{key:`col-${d}`,icon:"format_text",tooltip:c.label,"content-style":{backgroundColor:c.value},onClick:u=>o("backColor",c)},null,8,["tooltip","content-style","onClick"]))),128))])])]))}}),Ss=[{type:"paragraph",content:[]}],pm=[{type:"listItem",content:[{type:"paragraph",content:[]}]}],fm=[{type:"taskItem",content:[{type:"paragraph",content:[]}]}],oS={class:"o-add-node-view"},rS={key:0,class:"view-main"},iS={class:"group o-tips"},sS={class:"panel"},aS={class:"group o-tips"},lS={key:1,class:"item"},cS={key:1,class:"view-emoji"},dS=l.defineComponent({__name:"AddNodeView",props:ut,emits:["action"],setup(t,{emit:e}){const n=t,o=e,{locale:r,tr:i}=ye(),{run:s}=we(),a=l.ref("main"),c=l.ref(0);function d(f){const h=n.editor.chain();let m=null;switch(f.value){case"blockquote":m={content:Ss};break;case"callout":m={content:Ss,attrs:{icon:"💡"}};break;case"codeBlock":m={content:[],attrs:{language:"shell"}};break;case"emoji":m={type:"paragraph",content:[{type:"text",text:":"}]};break;case"heading":m={attrs:f.options};break;case"horizontalRule":m={};break;case"paragraph":m={content:[]};break;case"bulletList":case"orderedList":m={content:pm};break;case"taskList":m={content:fm};break;case"table":setTimeout(()=>{h.insertContentAt(p.value,{type:"paragraph",content:[]}).insertTable({rows:3,cols:3,withHeaderRow:!0}).focus().run()},1);return;case"image":m={type:"paragraph",content:[{type:f.value,attrs:{src:"init"}}]};break;case"model-viewer":m={attrs:{src:"init"}};break}m&&(m.type=m.type||f.value,setTimeout(()=>{u.value?h.insertContent(m).focus().run():h.insertContentAt(p.value,m).focus().run()},1)),o("action",f)}const u=l.computed(()=>n.node.content.size===0),p=l.computed(()=>u.value?c.value:c.value+n.node.nodeSize);return l.onMounted(()=>{c.value=n.getPos()}),(f,h)=>(l.openBlock(),l.createElementBlock("section",oS,[a.value==="main"?(l.openBlock(),l.createElementBlock("section",rS,[l.createElementVNode("section",null,[l.createElementVNode("div",iS,l.toDisplayString(l.unref(i)("label.basic")),1),l.createElementVNode("section",sS,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Cr),(m,g)=>(l.openBlock(),l.createBlock(l.unref(Re),{key:g,icon:m.icon,tooltip:l.unref(i)(m.label),quaternary:"",onClick:b=>d(m)},null,8,["icon","tooltip","onClick"]))),128))])]),l.createVNode(l.unref(dn),{hoverable:"",clickable:""},{default:l.withCtx(()=>[l.unref(br).length?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(br),(m,g)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:g},[m.group?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[g>0?(l.openBlock(),l.createBlock(l.unref(Yt),{key:0})):l.createCommentVNode("",!0),l.createElementVNode("div",aS,l.toDisplayString(l.unref(i)(m.group)),1)],64)):l.createCommentVNode("",!0),l.createVNode(l.unref(Jt),{class:"item",clickable:"",onClick:b=>d(m)},{prefix:l.withCtx(()=>[l.createVNode(l.unref(oe),{name:m.icon,color:m.color},null,8,["name","color"])]),default:l.withCtx(()=>[l.createTextVNode(" "+l.toDisplayString(l.unref(i)(m.label)),1)]),_:2},1032,["onClick"])],64))),128)):(l.openBlock(),l.createElementBlock("div",lS,"No result"))]),_:1})])):a.value==="emoji"?(l.openBlock(),l.createElementBlock("section",cS)):l.createCommentVNode("",!0)]))}}),uS=l.defineComponent({__name:"AddNode",props:ut,setup(t){const e=t,n=l.ref(null),o=l.ref(!1);function r(s){o.value=s}function i(){var s;(s=n.value)==null||s.setShow(!1),o.value=!1}return(s,a)=>(l.openBlock(),l.createBlock(l.unref(Pe),{ref_key:"popover",ref:n,placement:"left",trigger:"mouseenter",arrow:"","onUpdate:show":r},{trigger:l.withCtx(()=>[l.createElementVNode("div",{class:l.normalizeClass(["o-add-node",{"is-selected":o.value}])},[l.createVNode(l.unref(Dt),{type:"tertiary",class:"o-node-btn"},{default:l.withCtx(()=>[l.createVNode(l.unref(oe),{name:"add",small:""})]),_:1})],2)]),default:l.withCtx(()=>[l.createVNode(dS,l.mergeProps(e,{onAction:i}),null,16)]),_:1},512))}}),pS={class:"o-drag-node-view"},fS={key:0,class:"view-main"},hS={key:0},mS={class:"panel"},gS=l.defineComponent({__name:"DragNodeView",props:ut,emits:["action"],setup(t,{emit:e}){const n=t,o=e,{locale:r,tr:i}=ye(),{run:s,onCommand:a}=we(),c=l.ref("main"),d=l.ref(["heading","codeBlock","paragraph"]),u=l.computed(()=>{var b,y;const g=(b=n.node)==null?void 0:b.content.content;if(g.length>0){const k=g[0];if(k.type.name==="image")return k.type.name}return(y=n.node)==null?void 0:y.type.name}),p=l.computed(()=>ci.find(g=>g.value===u.value));function f(g){var b;return g.value===u.value&&((b=n.editor)==null?void 0:b.isActive(u.value,g.options))}function h(g){switch(g.value){default:m(g);break}o("action",g)}function m(g){var w,v,_,C,A;const b=n.getPos();if(g.value===u.value&&d.value.indexOf(u.value)<0){const L=(w=n.editor)==null?void 0:w.isActive(u.value),M=(v=n.editor)==null?void 0:v.commands.lift(u.value);console.log("lift",u.value,L,M);return}const y=(_=n.editor)==null?void 0:_.commands,k=(C=n.editor)==null?void 0:C.chain().focus(b+1);console.log("runCommand",g),a(y,k,g.value,g.options),(A=n.editor)==null||A.commands.setNodeSelection(b)}return l.computed(()=>[{label:"editor.duplicate",value:"duplicate",icon:"content_copy",color:Oe.blue,tips:"Ctrl+D",group:"label.common"},{label:"editor.delete",value:"delete",icon:"delete",tips:"Ctrl+D",color:Oe.deepOrange}]),(g,b)=>(l.openBlock(),l.createElementBlock("section",pS,[c.value==="main"?(l.openBlock(),l.createElementBlock("section",fS,[p.value?(l.openBlock(),l.createElementBlock("section",hS,[b[0]||(b[0]=l.createElementVNode("div",{class:"group o-tips"},"Turn into",-1)),l.createElementVNode("section",mS,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(ci),(y,k)=>(l.openBlock(),l.createBlock(l.unref(Re),{key:k,icon:y.icon,tooltip:l.unref(i)(y.label),"content-class":{"is-active":f(y)},quaternary:"",onClick:w=>h(y)},null,8,["icon","tooltip","content-class","onClick"]))),128))])])):l.createCommentVNode("",!0),l.createVNode(l.unref(Wo),l.mergeProps(n,{colorful:"","show-group":"",onAction:h}),null,16)])):l.createCommentVNode("",!0)]))}}),bS=l.defineComponent({__name:"DragNode",props:ut,emits:["action"],setup(t,{emit:e}){const n=t,o=e,{run:r}=we(),i=l.ref(null),s=l.ref(0),a=l.ref(!1),c=l.ref(["heading","codeBlock","paragraph"]),d=l.ref(!1),u=l.computed(()=>{var k,w;const y=(k=n.node)==null?void 0:k.content.content;if(y.length>0){const v=y[0];if(v.type.name==="image")return v.type.name}return(w=n.node)==null?void 0:w.type.name}),p=l.computed(()=>{var k;let y=u.value;return y==="heading"?{icon:`format_h${((k=n.node.attrs)==null?void 0:k.level)||1}`,color:Oe.blue}:(y==="table-wrapper"&&(y="table"),ya.find(w=>w.value===y)||{icon:"title"})});function f(y){var k;(k=i.value)==null||k.setShow(!1),o("action",y)}function h(y){a.value=y,console.log("show",y),y&&m()}function m(){var k;let y=n.getPos();c.value.includes(u.value)||(y+=1),(k=n.editor)==null||k.commands.setNodeSelection(y),s.value=y}function g(y){d.value=!0,setTimeout(()=>{d.value=!1},10)}function b(y){d.value=!1}return(y,k)=>(l.openBlock(),l.createBlock(l.unref(Pe),{ref_key:"popover",ref:i,placement:"left",size:"medium",trigger:"click",arrow:"","onUpdate:show":h},{trigger:l.withCtx(()=>[l.createElementVNode("div",{class:l.normalizeClass(["o-drag-node",{"is-selected":a.value,"is-dragging":d.value}]),contenteditable:"false",draggable:"true","data-drag-handle":"",onDragstart:g,onDragend:b},[l.createVNode(l.unref(Dt),{type:"tertiary",class:"o-node-btn"},{default:l.withCtx(()=>[l.createVNode(l.unref(oe),{name:p.value.icon,color:p.value.color,small:""},null,8,["name","color"]),l.createVNode(l.unref(oe),{name:"drag_indicator",small:""})]),_:1})],34)]),default:l.withCtx(()=>[l.createVNode(gS,l.mergeProps(n,{onAction:f}),null,16)]),_:1},512))}}),yS=l.defineComponent({__name:"index",props:ut,emits:["action"],setup(t,{emit:e}){const n=t,o=e,r=l.ref(!1),i=l.ref(0);l.ref(0);const s=l.computed(()=>a.value==="paragraph"&&n.node.content.size===0),a=l.computed(()=>{var f,h;const p=(f=n.node)==null?void 0:f.content.content;if(p.length>0){const m=p[0];if(m.type.name==="image")return m.type.name}return(h=n.node)==null?void 0:h.type.name}),c=l.computed(()=>{var p;return i.value||((p=n.node.attrs)==null?void 0:p.level)}),d=l.computed(()=>a.value==="heading"?`type-heading-${c.value}`:`type-${a.value}`);function u(p){o("action",p)}return l.onMounted(()=>{i.value=0}),(p,f)=>{var h;return(h=p.editor)!=null&&h.isEditable?(l.openBlock(),l.createElementBlock("section",{key:0,class:l.normalizeClass(["o-side-node",{"is-active":r.value,"is-empty":s.value}])},[l.createElementVNode("section",{class:l.normalizeClass(["action-container",d.value])},[l.createVNode(uS,l.normalizeProps(l.guardReactiveProps(n)),null,16),s.value?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(bS,l.mergeProps({key:0},n,{onAction:u}),null,16))],2)],2)):l.createCommentVNode("",!0)}}}),Dn=l.defineComponent({__name:"ONodeView",props:ut,emits:["action"],setup(t,{emit:e}){const n=t,o=e,r=l.inject("sideNode",{value:!1});return l.computed(()=>{const i={};return n.node.attrs["data-id"]&&(i["data-id"]=n.node.attrs["data-id"]),i}),(i,s)=>(l.openBlock(),l.createBlock(l.unref(Pc),{class:"o-node-view","data-id":i.node.attrs["data-id"]},{default:l.withCtx(()=>{var a;return[l.unref(r)&&((a=i.editor)!=null&&a.isEditable)?(l.openBlock(),l.createBlock(yS,l.mergeProps({key:0},n,{onAction:s[0]||(s[0]=c=>o("action"))}),null,16)):l.createCommentVNode("",!0),l.renderSlot(i.$slots,"default")]}),_:3},8,["data-id"]))}}),vS={class:"o-add-node-view"},kS={key:0,class:"view-main"},ES={class:"group o-tips"},wS={class:"panel"},CS={class:"group o-tips"},_S={key:1,class:"item"},SS=l.defineComponent({__name:"AddNodeView",props:{editor:{type:Object,required:!0},node:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0}},emits:["action"],setup(t,{emit:e}){const n=t,o=e,{locale:r,tr:i}=ye(),{run:s}=we(),a=l.ref("main");function c(p){const f=n.editor.chain();let h=null;switch(p.value){case"blockquote":h={content:Ss};break;case"callout":h={content:Ss,attrs:{icon:"💡"}};break;case"codeBlock":h={content:[],attrs:{language:"shell"}};break;case"emoji":h={type:"paragraph",content:[{type:"text",text:":"}]};break;case"heading":h={attrs:p.options};break;case"horizontalRule":h={};break;case"paragraph":h={content:[]};break;case"bulletList":case"orderedList":h={content:pm};break;case"taskList":h={content:fm};break;case"table":setTimeout(()=>{f.insertContentAt(u.value,{type:"paragraph",content:[]}).insertTable({rows:3,cols:3,withHeaderRow:!0}).focus().run()},1),o("action",p);return;case"image":h={type:"paragraph",content:[{type:p.value,attrs:{src:"init"}}]};break;case"model-viewer":h={attrs:{src:"init"}};break}if(h){const m=u.value;h.type=h.type||p.value,setTimeout(()=>{d.value?f.insertContent(h).focus().run():f.insertContentAt(m,h).focus().run()},1)}o("action",p)}const d=l.computed(()=>{var p;return((p=n.node)==null?void 0:p.content.size)===0}),u=l.computed(()=>d.value?n.getPos():n.getPos()+n.node.nodeSize);return(p,f)=>(l.openBlock(),l.createElementBlock("section",vS,[a.value==="main"?(l.openBlock(),l.createElementBlock("section",kS,[l.createElementVNode("section",null,[l.createElementVNode("div",ES,l.toDisplayString(l.unref(i)("label.basic")),1),l.createElementVNode("section",wS,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Cr),(h,m)=>(l.openBlock(),l.createBlock(l.unref(Re),{key:m,icon:h.icon,tooltip:l.unref(i)(h.label),quaternary:"",onClick:g=>c(h)},null,8,["icon","tooltip","onClick"]))),128))])]),l.createVNode(l.unref(dn),{hoverable:"",clickable:""},{default:l.withCtx(()=>[l.unref(br).length?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(br),(h,m)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:m},[h.group?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[m>0?(l.openBlock(),l.createBlock(l.unref(Yt),{key:0})):l.createCommentVNode("",!0),l.createElementVNode("div",CS,l.toDisplayString(l.unref(i)(h.group)),1)],64)):l.createCommentVNode("",!0),l.createVNode(l.unref(Jt),{class:"item",clickable:"",onClick:g=>c(h)},{prefix:l.withCtx(()=>[l.createVNode(l.unref(oe),{name:h.icon,color:h.color},null,8,["name","color"])]),default:l.withCtx(()=>[l.createTextVNode(" "+l.toDisplayString(l.unref(i)(h.label)),1)]),_:2},1032,["onClick"])],64))),128)):(l.openBlock(),l.createElementBlock("div",_S,"No result"))]),_:1})])):l.createCommentVNode("",!0)]))}}),hm=l.defineComponent({__name:"AddNode",props:{editor:{type:Object,required:!0},node:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0}},setup(t){const e=t,n=l.ref(),o=l.ref(!1),r=l.computed(()=>{var c;return((c=e.node)==null?void 0:c.content.size)===0});l.computed(()=>r.value?e.getPos():e.getPos()+e.node.nodeSize);function i(c){o.value=c}function s(){var c;(c=n.value)==null||c.setShow(!0)}function a(){var c;(c=n.value)==null||c.setShow(!1),o.value=!1}return(c,d)=>(l.openBlock(),l.createBlock(l.unref(Pe),{ref_key:"popover",ref:n,placement:"left","content-class":"dropdown",trigger:"manual",offset:[0,4],"onUpdate:show":i},{trigger:l.withCtx(()=>[l.createElementVNode("div",{class:l.normalizeClass(["o-add-btn",{"is-selected":o.value}])},[l.createVNode(l.unref(Dt),{type:"tertiary",class:"o-node-btn",onClick:s},{default:l.withCtx(()=>[l.createVNode(l.unref(oe),{name:"add",small:""})]),_:1})],2)]),default:l.withCtx(()=>[l.createVNode(SS,l.mergeProps(e,{onAction:a}),null,16)]),_:1},512))}}),xS={class:"o-drag-node-view"},NS={key:0,class:"view-main"},TS={key:0},OS={class:"panel"},MS=l.defineComponent({__name:"DragNodeView",props:{editor:{type:Object,required:!0},node:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0}},emits:["action"],setup(t,{emit:e}){const n=t,o=e,{locale:r,tr:i}=ye(),{run:s,onCommand:a}=we(),c=l.ref("main"),d=l.ref(["heading","codeBlock","paragraph"]),u=l.computed(()=>{var b,y;const g=(b=n.node)==null?void 0:b.content.content;if(g.length>0){const k=g[0];if(k.type.name==="image")return k.type.name}return(y=n.node)==null?void 0:y.type.name}),p=l.computed(()=>ci.find(g=>g.value===u.value));function f(g){var b;return g.value===u.value&&((b=n.editor)==null?void 0:b.isActive(u.value,g.options))}function h(g){switch(g.value){case"delete":break;case"duplicate":break;default:m(g);break}o("action",g)}function m(g){var w,v,_,C,A;const b=n.getPos();if(g.value===u.value&&d.value.indexOf(u.value)<0){const L=(w=n.editor)==null?void 0:w.isActive(u.value),M=(v=n.editor)==null?void 0:v.commands.lift(u.value);console.log("lift",u.value,L,M);return}const y=(_=n.editor)==null?void 0:_.commands,k=(C=n.editor)==null?void 0:C.chain().focus(b+1);console.log("runCommand",g),a(y,k,g.value,g.options),(A=n.editor)==null||A.commands.focus()}return(g,b)=>(l.openBlock(),l.createElementBlock("section",xS,[c.value==="main"?(l.openBlock(),l.createElementBlock("section",NS,[p.value?(l.openBlock(),l.createElementBlock("section",TS,[b[0]||(b[0]=l.createElementVNode("div",{class:"group o-tips"},"Turn into",-1)),l.createElementVNode("section",OS,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(ci),(y,k)=>(l.openBlock(),l.createBlock(l.unref(Re),{key:k,icon:y.icon,tooltip:l.unref(i)(y.label),"content-class":{"is-active":f(y)},quaternary:"",onClick:w=>h(y)},null,8,["icon","tooltip","content-class","onClick"]))),128))])])):l.createCommentVNode("",!0),l.createVNode(l.unref(Wo),l.mergeProps(n,{colorful:"","show-group":"",onAction:h}),null,16)])):l.createCommentVNode("",!0)]))}}),mm=l.defineComponent({__name:"DragNode",props:{editor:{type:Object,required:!0},node:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0}},emits:["action","dragstart","dragend"],setup(t,{emit:e}){const n=t,o=e,{run:r}=we(),i=l.ref(null),s=l.ref(!1),a=l.ref(["heading","codeBlock","paragraph"]),c=l.computed(()=>{var b,y,k;const g=(y=(b=n.node)==null?void 0:b.content)==null?void 0:y.content;if((g==null?void 0:g.length)>0){const w=g[0];if(w.type.name==="image")return w.type.name}return(k=n.node)==null?void 0:k.type.name}),d=l.computed(()=>{var b;let g=c.value;return g==="heading"?{icon:`format_h${((b=n.node.attrs)==null?void 0:b.level)||1}`,color:Oe.blue}:(g==="table-wrapper"&&(g="table"),ya.find(y=>y.value===g)||{icon:"title"})});function u(g){o("dragstart",g)}function p(g){o("dragend",g)}function f(g){var b;(b=i.value)==null||b.setShow(!1),o("action",g)}function h(g){s.value=g,g&&m()}function m(){var b;let g=n.getPos();a.value.includes(c.value)||(g+=1),(b=n.editor)==null||b.commands.setNodeSelection(g)}return l.watch(()=>n.getPos(),g=>{var b;(b=i.value)==null||b.setShow(!1)}),(g,b)=>(l.openBlock(),l.createBlock(l.unref(Pe),{ref_key:"popover",ref:i,placement:"left","content-class":"dropdown",trigger:"click",offset:[0,2],"onUpdate:show":h},{trigger:l.withCtx(()=>[l.createElementVNode("div",{class:l.normalizeClass(["o-drag-btn",{selected:s.value}]),contenteditable:"false",draggable:"true","data-drag-handle":"",onDragstart:u,onDragend:p},[l.createVNode(l.unref(Dt),{type:"tertiary",class:"o-node-btn"},{default:l.withCtx(()=>[l.createVNode(l.unref(oe),{name:d.value.icon,color:d.value.color,small:""},null,8,["name","color"]),l.createVNode(l.unref(oe),{name:"drag_indicator",small:""})]),_:1})],34)]),default:l.withCtx(()=>[l.createVNode(MS,l.mergeProps(n,{onAction:f}),null,16)]),_:1},512))}}),Dt=l.defineComponent({__name:"OBtn",props:{icon:{type:String,default:""},iconClass:{type:[String,Object],default:""},type:{type:String,default:""}},emits:["click"],setup(t,{emit:e}){const n=e;return(o,r)=>(l.openBlock(),l.createElementBlock("button",{class:l.normalizeClass(["o-btn",t.type?`type-${t.type}`:""]),onClick:r[0]||(r[0]=i=>n("click",i))},[t.icon?(l.openBlock(),l.createBlock(l.unref(oe),{key:0,name:t.icon,class:l.normalizeClass(t.iconClass)},null,8,["name","class"])):l.createCommentVNode("",!0),l.renderSlot(o.$slots,"default")],2))}}),AS={class:"o-checkbox"},RS={class:"o-checkbox__main"},DS={class:"o-checkbox__suffix"},Kc=l.defineComponent({__name:"OCheckbox",props:{modelValue:{type:Boolean,default:!1},label:{type:String,default:""}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,o=e,r=l.computed({get(){return n.modelValue},set(i){o("update:modelValue",i)}});return(i,s)=>(l.openBlock(),l.createElementBlock("div",AS,[l.createElementVNode("div",RS,[l.withDirectives(l.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=a=>r.value=a),type:"checkbox"},null,512),[[l.vModelCheckbox,r.value]])]),l.createElementVNode("div",DS,l.toDisplayString(t.label),1)]))}}),Yt=l.defineComponent({__name:"ODivider",props:{vertical:{type:Boolean,default:!1}},setup(t){return(e,n)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["o-divider",{"o-divider-vertical":t.vertical}])},null,2))}}),IS={class:"o-input__prefix"},BS={class:"o-input__main"},LS={class:"o-input__suffix"},Ko=l.defineComponent({__name:"OInput",props:{modelValue:{type:String,default:""},clearable:{type:Boolean,default:!1},type:{type:String,default:""}},emits:["blur","update:modelValue"],setup(t,{expose:e,emit:n}){const o=t,r=n,i=l.ref(null),s=l.computed({get(){return o.modelValue},set(d){r("update:modelValue",d)}});function a(){var d;(d=i.value)==null||d.focus()}function c(){s.value="",a()}return e({clear:c,focus:a}),(d,u)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["o-input",`type-${t.type}`])},[l.createElementVNode("div",IS,[l.renderSlot(d.$slots,"prefix")]),l.createElementVNode("div",BS,[l.withDirectives(l.createElementVNode("input",{ref_key:"input",ref:i,"onUpdate:modelValue":u[0]||(u[0]=p=>s.value=p),onBlur:u[1]||(u[1]=p=>r("blur"))},null,544),[[l.vModelText,s.value]])]),l.createElementVNode("div",LS,[l.renderSlot(d.$slots,"suffix"),t.clearable&&s.value?(l.openBlock(),l.createBlock(oe,{key:0,name:"close",class:"clear o-tips",onClick:c})):l.createCommentVNode("",!0)])],2))}}),dn=l.defineComponent({__name:"OList",props:{clickable:{type:Boolean,default:!1},hoverable:{type:Boolean,default:!1}},setup(t){return(e,n)=>(l.openBlock(),l.createElementBlock("ul",{class:l.normalizeClass(["o-list",{clickable:t.clickable,hoverable:t.hoverable}])},[l.renderSlot(e.$slots,"default")],2))}}),PS={class:"o-list-item"},$S={class:"o-list-item__prefix"},FS={class:"o-list-item__main"},VS={class:"o-list-item__suffix"},Jt=l.defineComponent({__name:"OListItem",props:{hoverable:{type:Boolean,default:!1}},setup(t){return(e,n)=>(l.openBlock(),l.createElementBlock("li",PS,[l.createElementVNode("div",$S,[l.renderSlot(e.$slots,"prefix")]),l.createElementVNode("div",FS,[l.renderSlot(e.$slots,"default")]),l.createElementVNode("div",VS,[l.renderSlot(e.$slots,"suffix")])]))}}),Pe=l.defineComponent({__name:"OPopover",props:{disable:{type:Boolean,default:!1},arrow:{type:Boolean,default:!1},offset:{type:Object,default:function(){return[0,10]}},placement:{type:String,default:"bottom-start"},trigger:{type:String,default:"mouseenter focus"},tippyClass:{type:String,default:"tippy"},contentClass:{type:String,default:""},event:{type:Object,default:function(){return{}}},delay:{type:Number,default:100},duration:{type:Number,default:200}},emits:["update:show"],setup(t,{expose:e,emit:n}){const o=t,r=n,{theme:i}=Ei(),s=l.ref(null),a=l.ref(),c=l.ref();function d(h){var m,g,b,y;h?((g=c.value)==null||g.setProps({getReferenceClientRect:(m=o.event)!=null&&m.clientX?u:null}),(b=c.value)==null||b.show()):(y=c.value)==null||y.hide()}function u(){var h,m;return{width:0,height:0,left:o.event.clientX,right:o.event.clientX,top:o.event.clientY,bottom:o.event.clientY,x:((h=o.event)==null?void 0:h.clientX)||0,y:((m=o.event)==null?void 0:m.clientY)||0,toJSON:()=>{var g,b;return{width:100,height:100,left:((g=o.event)==null?void 0:g.clientX)||0,top:((b=o.event)==null?void 0:b.clientY)||0}}}}function p(){c.value=bn(s.value,{appendTo:()=>document.body,animation:"shift-away",arrow:o.arrow,content:a.value,duration:o.duration,delay:o.delay,interactive:!0,offset:o.offset,placement:o.placement,trigger:o.trigger,theme:i.value,onShow:h=>{h.popper.classList.add(o.tippyClass||"tippy"),r("update:show",!0)},onHide:h=>{r("update:show",!1)}})}function f(){c.value.setProps({theme:i.value})}return l.watch(i,h=>{f()}),l.onMounted(()=>{p()}),e({setShow:d}),(h,m)=>(l.openBlock(),l.createElementBlock("div",{ref_key:"triggerRef",ref:s,"data-tippy-role":"popover",class:"o-popover"},[l.renderSlot(h.$slots,"trigger"),t.disable?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("div",{key:0,ref_key:"contentRef",ref:a,class:l.normalizeClass(["popover-content",t.contentClass])},[l.renderSlot(h.$slots,"default")],2))],512))}}),zS=l.defineComponent({__name:"OAlignDropdown",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ye(),{run:o}=we(),r=l.ref(null),i=l.computed(()=>[{label:n("editor.left"),value:"left",icon:"format_align_center"},{label:n("editor.center"),value:"center",icon:"format_align_center"},{label:n("editor.right"),value:"right",icon:"format_align_right"},{label:n("editor.justify"),value:"justify",icon:"format_align_justify"}]);function s(a){var c;(c=r.value)==null||c.setShow(!1),o(e.editor,"textAlign",{textAlign:a})}return(a,c)=>(l.openBlock(),l.createBlock(l.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",size:"medium",trigger:"click","show-arrow":!1},{trigger:l.withCtx(()=>[l.createVNode(l.unref(ot),{icon:"format_align_center","content-class":"o-align-dropdown dropdown",tooltip:l.unref(n)("editor.align")},{default:l.withCtx(()=>[l.createVNode(l.unref(oe),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:l.withCtx(()=>[l.createVNode(l.unref(dn),{hoverable:"",clickable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(i.value,(d,u)=>{var p;return l.openBlock(),l.createBlock(l.unref(Jt),{key:u,class:l.normalizeClass({"is-active":(p=t.editor)==null?void 0:p.isActive({textAlign:d.value})}),onClick:f=>s(d.value)},{prefix:l.withCtx(()=>[l.createVNode(l.unref(oe),{name:d.icon},null,8,["name"])]),suffix:l.withCtx(()=>{var f;return[(f=t.editor)!=null&&f.isActive({textAlign:d.value})?(l.openBlock(),l.createBlock(l.unref(oe),{key:0,name:"done",small:""})):l.createCommentVNode("",!0)]}),default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(d.label)+" ",1)]),_:2},1032,["class","onClick"])}),128))]),_:1})]),_:1},512))}}),HS={class:"o-align-group"},US=l.defineComponent({__name:"OAlignGroup",props:{editor:{type:cn}},setup(t){const e=t,{tr:n}=ye(),{run:o}=we(),r=l.computed(()=>[{label:n("editor.left"),value:"left",icon:"format_align_left"},{label:n("editor.center"),value:"center",icon:"format_align_center"},{label:n("editor.right"),value:"right",icon:"format_align_right"}]);function i(s){o(e.editor,"textAlign",{textAlign:s.value})}return(s,a)=>(l.openBlock(),l.createElementBlock("div",HS,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(r.value,(c,d)=>{var u;return l.openBlock(),l.createBlock(Re,{key:d,icon:c.icon,tooltip:c.label,"content-class":{"is-active":(u=t.editor)==null?void 0:u.isActive({textAlign:c.value})},onClick:p=>i(c)},null,8,["icon","tooltip","content-class","onClick"])}),128))]))}}),qS={class:"o-back-color-dropdown o-button-group"},WS=l.defineComponent({__name:"OBackColorDropdown",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ye(),{run:o}=we(),r=l.ref(null),i=l.ref("#ffec3d");function s(){a(i.value)}function a(c){r.value.setShow(!1),i.value=c,o(e.editor,"backColor",{color:c})}return(c,d)=>(l.openBlock(),l.createBlock(l.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:l.withCtx(()=>[l.createVNode(l.unref(Yn),{trigger:"hover"},{trigger:l.withCtx(()=>[l.createElementVNode("div",qS,[l.createVNode(l.unref(Dt),{icon:"ink_highlighter",class:"o-command-btn label",onClick:l.withModifiers(s,["stop"])},{default:l.withCtx(()=>[l.createElementVNode("div",{class:"indicator",style:l.normalizeStyle(`background: ${i.value}`)},null,4)]),_:1}),l.createVNode(l.unref(Dt),{icon:"arrow_drop_down",class:"o-command-btn"})])]),default:l.withCtx(()=>[l.createTextVNode(" "+l.toDisplayString(l.unref(n)("editor.highlightColor")),1)]),_:1})]),default:l.withCtx(()=>{var u;return[l.createVNode(l.unref(ka),{"default-color":"","default-label":l.unref(n)("editor.noColor"),"active-color":(u=t.editor)==null?void 0:u.getAttributes("highlight").color,onSelect:a},null,8,["default-label","active-color"])]}),_:1},512))}}),KS=l.defineComponent({__name:"OEmojiBtn",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ye(),{run:o}=we(),r=l.ref(null);function i(s){var a;(a=r.value)==null||a.setShow(!1),o(e.editor,"content",{content:s.emoji})}return(s,a)=>(l.openBlock(),l.createBlock(l.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn","tippy-class":"o-emoji-popover",placement:"bottom",trigger:"click",arrow:""},{trigger:l.withCtx(()=>[l.createVNode(l.unref(ot),{icon:"emoji_emotions","content-class":"o-emoji-btn",tooltip:l.unref(n)("editor.emoji")},null,8,["tooltip"])]),default:l.withCtx(()=>[l.createVNode(l.unref(Ea),{items:l.unref(Yr.emojiGroups),onSelect:i,"enable-search":""},null,8,["items"])]),_:1},512))}}),jS=l.defineComponent({__name:"OFontFamilyDropdown",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ye(),{run:o}=we(),r=l.ref(null),i=l.computed(()=>[{label:n("editor.default"),value:"system-ui"},{label:"Arial",value:"Arial",separator:!0},{label:"Arial Black",value:"Arial Black"},{label:"Georgia",value:"Georgia"},{label:"Impact",value:"Impact"},{label:"Helvetica",value:"Helvetica"},{label:"Roboto",value:"Roboto"},{label:"Tahoma",value:"Tahoma"},{label:"Times New Roman",value:"Times New Roman"},{label:"Verdana",value:"Verdana"},{label:"Courier New",value:"Courier New",separator:!0},{label:"Monaco",value:"Monaco"},{label:"Monospace",value:"monospace"}]);function s(a){var c;(c=r.value)==null||c.setShow(!1),o(e.editor,"fontFamily",{fontFamily:a})}return(a,c)=>(l.openBlock(),l.createBlock(l.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:l.withCtx(()=>[l.createVNode(l.unref(ot),{icon:"format_font","content-class":"o-font-family-dropdown dropdown",tooltip:l.unref(n)("editor.fontFamily")},{default:l.withCtx(()=>[l.createVNode(l.unref(oe),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:l.withCtx(()=>[l.createVNode(l.unref(dn),{hoverable:"",clickable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(i.value,(d,u)=>{var p;return l.openBlock(),l.createElementBlock(l.Fragment,{key:u},[d.separator?(l.openBlock(),l.createBlock(l.unref(Yt),{key:0})):l.createCommentVNode("",!0),l.createVNode(l.unref(Jt),{class:l.normalizeClass({"is-active":(p=t.editor)==null?void 0:p.isActive("textStyle",{fontFamily:d.value})}),onClick:f=>s(d.value)},{suffix:l.withCtx(()=>{var f;return[(f=t.editor)!=null&&f.isActive("textStyle",{fontFamily:d.value})?(l.openBlock(),l.createBlock(l.unref(oe),{key:0,name:"done",small:""})):l.createCommentVNode("",!0)]}),default:l.withCtx(()=>[l.createElementVNode("span",{style:l.normalizeStyle(`font-family: ${d.value}`)},l.toDisplayString(d.label),5)]),_:2},1032,["class","onClick"])],64)}),128))]),_:1})]),_:1},512))}}),GS={class:"o-fore-color-dropdown o-button-group"},YS=l.defineComponent({__name:"OForeColorDropdown",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ye(),{run:o}=we(),r=l.ref(null),i=l.ref("#ff4d4f");function s(){a(i.value)}function a(c){var d;(d=r.value)==null||d.setShow(!1),i.value=c,o(e.editor,"foreColor",{color:c})}return(c,d)=>(l.openBlock(),l.createBlock(l.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:l.withCtx(()=>[l.createVNode(l.unref(Yn),null,{trigger:l.withCtx(()=>[l.createElementVNode("div",GS,[l.createVNode(l.unref(Dt),{icon:"format_color_text",class:"o-command-btn label",onClick:l.withModifiers(s,["stop"])},{default:l.withCtx(()=>[l.createElementVNode("div",{class:"indicator",style:l.normalizeStyle(`background: ${i.value}`)},null,4)]),_:1}),l.createVNode(l.unref(Dt),{icon:"arrow_drop_down",class:"o-command-btn"})])]),default:l.withCtx(()=>[l.createTextVNode(" "+l.toDisplayString(l.unref(n)("editor.textColor")),1)]),_:1})]),default:l.withCtx(()=>{var u;return[l.createVNode(l.unref(ka),{"default-color":"","default-label":l.unref(n)("editor.defaultColor"),"active-color":(u=t.editor)==null?void 0:u.getAttributes("textStyle").color,onSelect:a},null,8,["default-label","active-color"])]}),_:1},512))}}),JS=l.defineComponent({__name:"OHeadingDropdown",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ye(),{run:o}=we(),r=l.ref(null),i=l.computed(()=>[{label:n("editor.paragraph"),value:"paragraph",valueAlt:"",icon:"title"},{label:n("editor.heading1"),value:"heading",valueAlt:1,icon:"format_h1",separator:!0},{label:n("editor.heading2"),value:"heading",valueAlt:2,icon:"format_h2"},{label:n("editor.heading3"),value:"heading",valueAlt:3,icon:"format_h3"},{label:n("editor.heading4"),value:"heading",valueAlt:4,icon:"format_h4"},{label:n("editor.heading5"),value:"heading",valueAlt:5,icon:"format_h5"}]);function s(c){var d,u;return c.value==="heading"?(d=e.editor)==null?void 0:d.isActive(c.value,{level:c.valueAlt}):(u=e.editor)==null?void 0:u.isActive(c.value)}function a(c){var d;(d=r.value)==null||d.setShow(!1),o(e.editor,c.value,{level:c.valueAlt})}return(c,d)=>(l.openBlock(),l.createBlock(l.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:l.withCtx(()=>[l.createVNode(l.unref(ot),{icon:"format_header_pound","content-class":"o-heading-dropdown dropdown",tooltip:l.unref(n)("editor.heading")},{default:l.withCtx(()=>[l.createVNode(l.unref(oe),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:l.withCtx(()=>[l.createVNode(l.unref(dn),{hoverable:"",clickable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(i.value,(u,p)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:p},[u.separator?(l.openBlock(),l.createBlock(l.unref(Yt),{key:0})):l.createCommentVNode("",!0),l.createVNode(l.unref(Jt),{class:l.normalizeClass({"is-active":s(u)}),onClick:f=>a(u)},{prefix:l.withCtx(()=>[l.createVNode(l.unref(oe),{name:u.icon},null,8,["name"])]),suffix:l.withCtx(()=>[s(u)?(l.openBlock(),l.createBlock(l.unref(oe),{key:0,name:"done",small:""})):l.createCommentVNode("",!0)]),default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(u.label)+" ",1)]),_:2},1032,["class","onClick"])],64))),128))]),_:1})]),_:1},512))}}),XS={class:"o-list-dropdown o-button-group"},ZS=l.defineComponent({__name:"OListDropdown",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ye(),{run:o}=we(),r=l.ref(null),i=l.ref();function s(){o(e.editor,i.value.value)}function a(d){r.value.setShow(!1),i.value=d,o(e.editor,d.value)}const c=l.computed(()=>[{label:n("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:n("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:n("editor.todoList"),value:"taskList",icon:"check_box"}]);return l.onMounted(()=>{i.value=c.value[0]}),(d,u)=>(l.openBlock(),l.createBlock(l.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",size:"medium",trigger:"click","show-arrow":!1},{trigger:l.withCtx(()=>[l.createVNode(l.unref(Yn),{trigger:"hover"},{trigger:l.withCtx(()=>{var p;return[l.createElementVNode("div",XS,[l.createVNode(l.unref(Dt),{icon:(p=i.value)==null?void 0:p.icon,class:"o-command-btn",onClick:l.withModifiers(s,["stop"])},null,8,["icon"]),l.createVNode(l.unref(Dt),{icon:"arrow_drop_down",class:"o-command-btn"})])]}),default:l.withCtx(()=>{var p;return[l.createTextVNode(" "+l.toDisplayString((p=i.value)==null?void 0:p.label),1)]}),_:1})]),default:l.withCtx(()=>[l.createVNode(l.unref(dn),{hoverable:"",clickable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(c.value,(p,f)=>{var h;return l.openBlock(),l.createBlock(l.unref(Jt),{key:f,class:l.normalizeClass({"is-active":(h=t.editor)==null?void 0:h.isActive(p.value)}),onClick:m=>a(p)},{prefix:l.withCtx(()=>[l.createVNode(l.unref(oe),{name:p.icon},null,8,["name"])]),suffix:l.withCtx(()=>{var m;return[(m=t.editor)!=null&&m.isActive(p.value)?(l.openBlock(),l.createBlock(l.unref(oe),{key:0,name:"done",small:""})):l.createCommentVNode("",!0)]}),default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(p.label)+" ",1)]),_:2},1032,["class","onClick"])}),128))]),_:1})]),_:1},512))}}),QS={class:"o-list-group"},ex=l.defineComponent({__name:"OListGroup",props:{editor:{type:cn,required:!0}},setup(t){const e=t,{tr:n}=ye(),{run:o}=we(),r=l.computed(()=>[{label:n("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:n("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:n("editor.todoList"),value:"taskList",icon:"check_box"}]);function i(s){o(e.editor,s.value)}return(s,a)=>(l.openBlock(),l.createElementBlock("div",QS,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(r.value,(c,d)=>{var u;return l.openBlock(),l.createBlock(Re,{key:d,icon:c.icon,tooltip:c.label,"content-class":{"is-active":(u=t.editor)==null?void 0:u.isActive(c.value)},onClick:p=>i(c)},null,8,["icon","tooltip","content-class","onClick"])}),128))]))}}),tx=l.defineComponent({__name:"OLinkBtn",props:{editor:{type:cn}},setup(t){const e=t,{tr:n}=ye(),{run:o}=we(),r=l.ref(),i=l.ref(!1),s=l.ref(""),a=l.ref(!0);function c(){var f;s.value="",a.value=!0;const p=(f=e.editor)==null?void 0:f.getAttributes("link");p!=null&&p.href&&(s.value=p.href,a.value=p.target==="_blank",console.log("show",i.value,p,a.value))}function d(){var p;(p=r.value)==null||p.setShow(!1)}function u(p){var f;p?o(e.editor,"linkSet",{href:p,target:a.value?"_blank":""}):o(e.editor,"linkUnset"),(f=r.value)==null||f.setShow(!1)}return(p,f)=>(l.openBlock(),l.createBlock(l.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:"",show:i.value,"onUpdate:show":[f[1]||(f[1]=h=>i.value=h),c]},{trigger:l.withCtx(()=>{var h;return[l.createVNode(l.unref(ot),{icon:"link","content-class":{"is-active":(h=t.editor)==null?void 0:h.isActive("link")},tooltip:l.unref(n)("editor.hyperlink")},null,8,["content-class","tooltip"])]}),default:l.withCtx(()=>[i.value?(l.openBlock(),l.createBlock(l.unref(Wc),{key:0,title:l.unref(n)("editor.hyperlink"),val:s.value,icon:"link",onCancel:d,onConfirm:u},{"header-right":l.withCtx(()=>[l.createVNode(l.unref(Kc),{modelValue:a.value,"onUpdate:modelValue":f[0]||(f[0]=h=>a.value=h),label:l.unref(n)("link.open_in_new_tab")},null,8,["modelValue","label"])]),_:1},8,["title","val"])):l.createCommentVNode("",!0)]),_:1},8,["show"]))}}),nx=l.defineComponent({__name:"OLinkEditBtn",props:{editor:{type:cn,required:!0}},setup(t){const e=t,{tr:n}=ye(),{run:o}=we(),r=l.ref(),i=l.ref(!1),s=l.ref(""),a=l.ref(!0);function c(){var f;s.value="",a.value=!0;const p=(f=e.editor)==null?void 0:f.getAttributes("link");p!=null&&p.href&&(s.value=p.href,a.value=p.target==="_blank")}function d(){var p;(p=r.value)==null||p.setShow(!1)}function u(p){var f;p?o(e.editor,"linkSet",{href:p,target:a.value?"_blank":""}):o(e.editor,"linkUnset"),(f=r.value)==null||f.setShow(!1)}return(p,f)=>(l.openBlock(),l.createBlock(l.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:"",show:i.value,"onUpdate:show":[f[1]||(f[1]=h=>i.value=h),c]},{trigger:l.withCtx(()=>[l.createVNode(l.unref(ot),{icon:"edit",tooltip:l.unref(n)("link.edit")},null,8,["tooltip"])]),default:l.withCtx(()=>[i.value?(l.openBlock(),l.createBlock(l.unref(Wc),{key:0,title:l.unref(n)("link.edit"),val:s.value,icon:"link",onCancel:d,onConfirm:u},{"header-right":l.withCtx(()=>[l.createVNode(l.unref(Kc),{modelValue:a.value,"onUpdate:modelValue":f[0]||(f[0]=h=>a.value=h),label:l.unref(n)("link.open_in_new_tab")},null,8,["modelValue","label"])]),_:1},8,["title","val"])):l.createCommentVNode("",!0)]),_:1},8,["show"]))}}),ox=l.defineComponent({__name:"OLinkOpenBtn",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ye();function o(){var i;const r=(i=e.editor)==null?void 0:i.getAttributes("link");r!=null&&r.href&&window.open(r.href,"target")}return(r,i)=>(l.openBlock(),l.createBlock(Re,{icon:"open_in_new",tooltip:l.unref(n)("link.open"),"content-class":"o-link-open-btn",onClick:o},null,8,["tooltip"]))}}),gm=["bold","italic","text-format-dropdown","separator","heading","font-family","text-color-dropdown","fore-color","back-color","clearFormat","separator","align-dropdown","separator","horizontalRule","blockquote","list-dropdown","codeBlock","link","image","video","modelViewer","table","callout","emoji","columns","aiViewer"],bm=["table-group","separator","bold","italic","text-format-dropdown","separator","heading","font-family","text-color-dropdown","clearFormat","separator","align-dropdown","separator","horizontalRule","blockquote","list-dropdown","link","image"],ym=["bold","strike","text-color-dropdown","clearFormat","separator","list-group","link","callout","separator","align-dropdown","more"],vm=["link-open","link-edit","linkUnset"],km=["align-group","separator","link"],Em=["align-group","separator","link-open","link-edit","linkUnset"],wm=["heading","separator","italic","underline","font-family","separator","code","blockquote"],Cm=["table-group","separator","bold","italic","font-family","text-color-dropdown","separator","align-group"],rx=["table-group","separator","bold","italic","font-family","text-color-dropdown","separator","align-group"],_m=["style-dropdown","separator","bold","italic","text-color-dropdown","separator","align-dropdown"],ix=["table-group","separator","align-group"],sx={video:["youtube","youku","bilibili","qqvideo"],map:["google_map","amap","baidu_map"],design:["modao","lanhu","figma","canva","processon"],develop:["codepen"],data:["google_forms","jinshuju"],others:["iframe"]},ax={class:"o-command-btn"},lx={class:"o-more-bubble"},cx=l.defineComponent({__name:"OMoreBubble",props:{editor:{type:cn,required:!0}},setup(t){const e=l.ref();return(n,o)=>(l.openBlock(),l.createBlock(l.unref(Pe),{ref_key:"popover",ref:e,offset:[4,10],class:"o-simple-command-btn","content-class":"o-more-bubble-popover",placement:"top-end",size:"medium",trigger:"mouseenter"},{trigger:l.withCtx(()=>[l.createElementVNode("div",ax,[l.createVNode(l.unref(oe),{name:"more_horiz"})])]),default:l.withCtx(()=>[l.createElementVNode("section",lx,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(wm),(r,i)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:i},[r==="separator"?(l.openBlock(),l.createBlock(l.unref(Yt),{key:0,vertical:""})):typeof r=="string"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(l.unref(wa)(r)),{key:1,name:r,editor:t.editor},null,8,["name","editor"])):l.createCommentVNode("",!0)],64))),128))])]),_:1},512))}}),dx=l.defineComponent({__name:"OStyleDropdown",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ye(),{run:o}=we(),r=l.ref(null),i=l.computed(()=>[{label:n("editor.paragraph"),value:"paragraph",icon:"title"},{label:n("editor.heading1"),value:"heading",icon:"format_h1",options:{level:1}},{label:n("editor.heading2"),value:"heading",icon:"format_h2",options:{level:2}},{label:n("editor.heading3"),value:"heading",icon:"format_h3",options:{level:3}},{label:n("editor.todoList"),value:"taskList",icon:"check_box"},{label:n("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:n("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:n("editor.blockquote"),value:"blockquote",icon:"format_quote_open"},{label:n("editor.removeFormat"),value:"clearFormat",icon:"format_clear",separator:!0}]);function s(c){var d;return(d=e.editor)==null?void 0:d.isActive(c.value,c.options)}function a(c){r.value.setShow(!1),o(e.editor,c.value,c.options)}return(c,d)=>(l.openBlock(),l.createBlock(l.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click"},{trigger:l.withCtx(()=>[l.createVNode(l.unref(ot),{icon:"format_paint","content-class":"o-style-dropdown o-command-btn dropdown",tooltip:l.unref(n)("label.styles")},{default:l.withCtx(()=>[l.createVNode(l.unref(oe),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:l.withCtx(()=>[l.createVNode(l.unref(dn),{hoverable:"",clickable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(i.value,(u,p)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:p},[u.separator?(l.openBlock(),l.createBlock(l.unref(Yt),{key:0})):l.createCommentVNode("",!0),l.createVNode(l.unref(Jt),{class:l.normalizeClass({"is-active":s(u)}),onClick:f=>a(u)},{prefix:l.withCtx(()=>[l.createVNode(l.unref(oe),{name:u.icon},null,8,["name"])]),suffix:l.withCtx(()=>[s(u)?(l.openBlock(),l.createBlock(l.unref(oe),{key:0,name:"done",small:""})):l.createCommentVNode("",!0)]),default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(u.label)+" ",1)]),_:2},1032,["class","onClick"])],64))),128))]),_:1})]),_:1},512))}}),ux=l.defineComponent({__name:"OTableBtn",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ye(),{run:o}=we(),r=l.ref(null);function i(s){var a;(a=r.value)==null||a.setShow(!1),o(e.editor,"tableInsert",s)}return(s,a)=>(l.openBlock(),l.createBlock(l.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:""},{trigger:l.withCtx(()=>[l.createVNode(l.unref(ot),{icon:"window","content-class":"o-table-btn",tooltip:l.unref(n)("table.insert")},null,8,["tooltip"])]),default:l.withCtx(()=>[l.createVNode(l.unref(cm),{onSelect:i})]),_:1},512))}}),px={class:"o-table-group"},fx=l.defineComponent({__name:"OTableGroup",props:{editor:{type:cn,required:!0}},setup(t){const{tr:e}=ye(),{run:n}=we();return(o,r)=>{var i,s;return l.openBlock(),l.createElementBlock("section",px,[(i=t.editor)!=null&&i.can().mergeCells()?(l.openBlock(),l.createBlock(l.unref(Re),{key:0,icon:"cell_merge",tooltip:l.unref(e)("table.merge"),onClick:r[0]||(r[0]=a=>l.unref(n)(t.editor,"tableMergeCells"))},null,8,["tooltip"])):l.createCommentVNode("",!0),(s=t.editor)!=null&&s.can().splitCell()?(l.openBlock(),l.createBlock(l.unref(Re),{key:1,icon:"splitscreen_left",tooltip:l.unref(e)("table.split"),onClick:r[1]||(r[1]=a=>l.unref(n)(t.editor,"tableSplitCell"))},null,8,["tooltip"])):l.createCommentVNode("",!0),l.createVNode(l.unref(dm),{editor:t.editor},null,8,["editor"])])}}}),hx=l.defineComponent({__name:"OTextColorDropdown",props:{editor:{type:cn}},setup(t){const e=t,{tr:n}=ye(),{run:o}=we(),r=l.ref(null),i=l.ref(""),s=l.ref("");function a(c,d){c==="foreColor"?(i.value=d,localStorage.setItem("yiitap.text-color.fore",d)):c==="backColor"&&(s.value=d,localStorage.setItem("yiitap.text-color.back",d)),r.value.setShow(!1),o(e.editor,c,{color:d})}return l.onMounted(()=>{i.value=localStorage.getItem("yiitap.text-color.fore")||"",s.value=localStorage.getItem("yiitap.text-color.back")||""}),(c,d)=>(l.openBlock(),l.createBlock(l.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:l.withCtx(()=>[l.createVNode(l.unref(ot),{icon:"format_text","content-class":"o-text-color-dropdown dropdown",tooltip:l.unref(n)("editor.textColor")},{default:l.withCtx(()=>[l.createVNode(l.unref(oe),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:l.withCtx(()=>{var u;return[l.createVNode(l.unref(um),{"fore-color":i.value,"back-color":s.value,"default-label":l.unref(n)("editor.defaultColor"),"active-color":(u=t.editor)==null?void 0:u.getAttributes("textStyle").color,onSelect:a},null,8,["fore-color","back-color","default-label","active-color"])]}),_:1},512))}}),mx=l.defineComponent({__name:"OTextFormatDropdown",props:{editor:{type:cn}},setup(t){const e=t,{tr:n}=ye(),{run:o}=we(),r=l.ref(),i=l.computed(()=>[{label:n("editor.strikethrough"),value:"strike",icon:"format_strikethrough"},{label:n("editor.underline"),value:"underline",icon:"format_underlined"},{label:n("editor.code"),value:"code",icon:"code"}]);function s(a){var c;(c=r.value)==null||c.setShow(!1),o(e.editor,a)}return(a,c)=>(l.openBlock(),l.createBlock(l.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:l.withCtx(()=>[l.createVNode(l.unref(ot),{icon:"title","content-class":"o-text-format-dropdown dropdown",tooltip:l.unref(n)("editor.textFormat")},{default:l.withCtx(()=>[l.createVNode(l.unref(oe),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:l.withCtx(()=>[l.createVNode(l.unref(dn),{hoverable:"",clickable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(i.value,(d,u)=>{var p;return l.openBlock(),l.createBlock(l.unref(Jt),{key:u,class:l.normalizeClass({"is-active":(p=t.editor)==null?void 0:p.isActive(d.value)}),onClick:f=>s(d.value)},{prefix:l.withCtx(()=>[l.createVNode(l.unref(oe),{name:d.icon},null,8,["name"])]),suffix:l.withCtx(()=>{var f;return[(f=t.editor)!=null&&f.isActive(d.value)?(l.openBlock(),l.createBlock(l.unref(oe),{key:0,name:"done",small:""})):l.createCommentVNode("",!0)]}),default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(d.label)+" ",1)]),_:2},1032,["class","onClick"])}),128))]),_:1})]),_:1},512))}}),gx={"align-dropdown":zS,"align-group":US,"back-color":WS,"font-family":jS,"fore-color":YS,heading:JS,"list-dropdown":ZS,"list-group":ex,link:tx,"link-edit":nx,"link-open":ox,emoji:KS,more:cx,"style-dropdown":dx,table:ux,"table-group":fx,"text-color-dropdown":hx,"text-format-dropdown":mx},wa=t=>gx[t]||XC,bx={class:"o-main-menu"},yx={class:"left"},vx={class:"right"},Sm=l.defineComponent({__name:"OMainMenu",props:{editor:{type:Object},menu:{type:Array,default:function(){return[]}}},setup(t){const e=t,n=l.computed(()=>{var r;let o=e.menu;return(r=e.editor)!=null&&r.isActive("table")&&(o=bm),o.length>0?o:gm});return(o,r)=>(l.openBlock(),l.createElementBlock("section",bx,[l.createElementVNode("section",yx,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(n.value,(i,s)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:s},[i==="separator"?(l.openBlock(),l.createBlock(l.unref(Yt),{key:0,vertical:""})):typeof i=="string"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(l.unref(wa)(i)),{key:1,name:i,editor:t.editor},null,8,["name","editor"])):(l.openBlock(),l.createBlock(l.resolveDynamicComponent(i),{key:2,editor:t.editor},null,8,["editor"]))],64))),128)),l.renderSlot(o.$slots,"left")]),l.createElementVNode("section",vx,[l.renderSlot(o.$slots,"right")])]))}}),kx={key:0,class:"o-bubble-menu"},Ex={class:"container"},wx=l.defineComponent({__name:"OBubbleMenu",props:{editor:{type:cn},menu:{type:Array,default:function(){return[]}},tableToolbar:{type:Array,default:function(){return[]}},menuClass:{type:String,default:""}},setup(t){const e=t,{tr:n}=ye(),{theme:o}=Ei(),r=l.ref(!1),i=l.ref({duration:100,placement:"top",role:"popover",arrow:!1,onShow:()=>{r.value=!1}});function s(){r.value=!0}function a(f){const{schema:h}=e.editor,m=h.marks.link;if(!m||!f)return!1;const{$from:g,$to:b}=f;return!!wr(g,m)}function c({editor:f,element:h,view:m,state:g,oldState:b,from:y,to:k}){var K;const{doc:w,selection:v}=g,{empty:_}=v,C=!w.textBetween(y,k).length&&fa(g.selection);if(!m.hasFocus()||_||C&&f.isActive("link")&&!f.isActive("image"))return!1;const A=["image"],L=["toc","video","model-viewer"],M=v.node,P=(K=M==null?void 0:M.type)==null?void 0:K.name;return!(f.isActive("codeBlock")||L.indexOf(P)>=0||P&&!A.includes(P))}const d=l.computed(()=>{if(e.editor){const{state:f}=e.editor,{tr:h}=f,{selection:m}=h;return a(m)}else return!1}),u=l.computed(()=>{var f;return!r.value&&d.value&&!((f=e.editor)!=null&&f.isActive("image"))}),p=l.computed(()=>{var h,m;let f=e.menu;return r.value||((h=e.editor)!=null&&h.isActive("image")?f=d.value?Em:km:(m=e.editor)!=null&&m.isActive("table")?f=Cm:d.value&&(f=vm)),f.length>0?f:ym});return l.onMounted(()=>{r.value=!1}),(f,h)=>t.editor?(l.openBlock(),l.createElementBlock("section",kx,[l.createVNode(l.unref(q0),{class:l.normalizeClass(["bubble-menu",t.menuClass]),editor:t.editor,"should-show":c,"tippy-options":i.value},{default:l.withCtx(()=>[l.createElementVNode("section",Ex,[u.value?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[l.createVNode(l.unref(Re),{icon:"arrow_back",tooltip:l.unref(n)("link.back"),onClick:s},null,8,["tooltip"]),l.createVNode(l.unref(Yt),{vertical:""})],64)):l.createCommentVNode("",!0),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(p.value,(m,g)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:g},[m==="separator"?(l.openBlock(),l.createBlock(l.unref(Yt),{key:0,vertical:""})):typeof m=="string"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(l.unref(wa)(m)),{key:1,name:m,editor:t.editor},null,8,["name","editor"])):(l.openBlock(),l.createBlock(l.resolveDynamicComponent(m),{key:2,editor:t.editor},null,8,["editor"]))],64))),128))])]),_:1},8,["class","editor","tippy-options"])])):l.createCommentVNode("",!0)}}),Cx={key:0,class:"o-floating-menu"},_x={class:"container"},Sx=l.defineComponent({__name:"OFloatingMenu",props:{editor:{type:Jh},menu:{type:Array,default:function(){return[]}},tableToolbar:{type:Array,default:function(){return[]}},menuClass:{type:String,default:""}},setup(t){const e=t,n=l.ref(!1),o=l.ref({arrow:!1,duration:100,role:"popover",placement:"right",offset:[0,168]});function r(){n.value=!0}function i(d){const{schema:u}=e.editor,p=u.marks.link;if(!p||!d)return!1;const{$from:f,$to:h}=d;return!!wr(f,p)}const s=l.computed(()=>{if(e.editor){const{state:d}=e.editor,{tr:u}=d,{selection:p}=u;return i(p)}else return!1}),a=l.computed(()=>!n.value&&s.value),c=l.computed(()=>{let d=e.menu;return d.length>0?d:_m});return(d,u)=>t.editor?(l.openBlock(),l.createElementBlock("section",Cx,[l.createVNode(l.unref(K0),{class:l.normalizeClass(["floating-menu",t.menuClass]),editor:t.editor,"tippy-options":o.value},{default:l.withCtx(()=>[l.createElementVNode("section",_x,[a.value?(l.openBlock(),l.createBlock(l.unref(Re),{key:0,icon:"arrow_back",onClick:r})):l.createCommentVNode("",!0),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(c.value,(p,f)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:f},[p==="separator"?(l.openBlock(),l.createBlock(l.unref(Yt),{key:0,vertical:""})):typeof p=="string"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(l.unref(wa)(p)),{key:1,name:p,editor:t.editor},null,8,["name","editor"])):(l.openBlock(),l.createBlock(l.resolveDynamicComponent(p),{key:2,editor:t.editor},null,8,["editor"]))],64))),128))])]),_:1},8,["class","editor","tippy-options"])])):l.createCommentVNode("",!0)}});function jc(t,e){const n=e==null?void 0:e.posAtCoords(t);if(!n)return;let o=rs(n.pos,e);if(o!==e.dom){for(;o&&o.parentNode&&o.parentNode!==e.dom;)o=o.parentNode;if(o)return o}}function rs(t,e){return e.nodeDOM(t)||e.domAtPos(t).node}function Gc(t,e){const n=jc(t,e);if(n&&n.nodeType===1){const o=e.docView,r=o.nearestDesc(n,!0);return!r||r===o?null:r.posBefore}return null}function xx(t,e){let n,o;const r=e.resolve(t.from).node().type.spec.group==="blockContent",i=e.resolve(t.to).node().type.spec.group==="blockContent",s=Math.min(t.$anchor.depth,t.$head.depth);if(r&&i){const a=t.$from.start(s-1),c=t.$to.end(s-1);n=e.resolve(a-1).pos,o=e.resolve(c+1).pos}else n=t.from,o=t.to;return{from:n,to:o}}function Nx(t,e){const n=Gc(t,e.view);return n&&n>=0?{node:e.state.doc.nodeAt(n),pos:n}:{node:null,pos:n}}const xs=new xe("sideMenu");class Tx{constructor(){Xe(this,"hovered",!1);Xe(this,"coords",{left:0,top:0});Xe(this,"className","")}init(e){return this}apply({tr:e,oldState:n,newState:o}){return e.docChanged?this:this}setHover(e,n,o=""){this.hovered=e,this.coords=n,this.className=o}}class Ox{constructor({editor:e,element:n,view:o,tippyOptions:r={},updateDelay:i=250}){Xe(this,"editor");Xe(this,"element");Xe(this,"view");Xe(this,"preventHide",!1);Xe(this,"tippy");Xe(this,"tippyOptions");Xe(this,"updateDelay");Xe(this,"updateDebounceTimer");Xe(this,"mousedownHandler",()=>{this.preventHide=!0});Xe(this,"onDragStart",e=>{this.hide()});Xe(this,"blurHandler",({event:e})=>{var n;e!=null&&e.relatedTarget&&((n=this.element.parentNode)!=null&&n.contains(e.relatedTarget))||this.hide()});Xe(this,"tippyBlurHandler",e=>{this.blurHandler({event:e})});Xe(this,"handleDebouncedUpdate",(e,n)=>{const o=!(n!=null&&n.selection.eq(e.state.selection)),r=!(n!=null&&n.doc.eq(e.state.doc));!o&&!r||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,o,r,n)},this.updateDelay))});Xe(this,"updateHandler",(e,n,o,r)=>{var u,p;const{state:i,composing:s}=e,{coords:a}=xs.getState(i),c=jc(a,e),d=Gc(a,e);!c||d<=0||(this.createTooltip(),(p=this.tippy)==null||p.setProps({getReferenceClientRect:((u=this.tippyOptions)==null?void 0:u.getReferenceClientRect)||(()=>c.getBoundingClientRect())}),this.show())});this.editor=e,this.element=n,this.view=o,this.updateDelay=i,this.view.dom.addEventListener("dragstart",this.onDragStart),this.tippyOptions=r,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=bn(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"left",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){const{state:o}=e,r=!(n!=null&&n.selection.eq(e.state.selection)),i=!(n!=null&&n.doc.eq(e.state.doc));this.updateHandler(e,r,i,n)}show(){var e;(e=this.tippy)==null||e.show()}hide(){var e;(e=this.tippy)==null||e.hide()}destroy(){var e,n;(e=this.tippy)!=null&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)==null||n.destroy(),this.view.dom.removeEventListener("dragstart",this.onDragStart)}}const Mx=(t,e)=>{if(!t.dataTransfer)return;const n=e.view,o=n.dom.getBoundingClientRect(),r={left:o.left+o.width/2,top:t.clientY},i=Gc(r,n);if(i===null)return;const s=n.state.selection,a=n.state.doc;xx(s,a),n.dispatch(n.state.tr.setSelection(G.create(n.state.doc,i))),Rx(n,i);const c=n.state.selection.content(),{dom:d,text:u}=n.serializeForClipboard(c);t.dataTransfer.clearData(),t.dataTransfer.setData("text/html",d.innerHTML),t.dataTransfer.setData("text/plain",u),t.dataTransfer.effectAllowed="move",t.dataTransfer.setDragImage(Lo,0,0),n.dragging={slice:c,move:!0}},Ax=(t,e)=>{xm()};let Lo;function Rx(t,e,n=e){const o=t.domAtPos(e).node.cloneNode(!0),r=t.domAtPos(e).node,i=(p,f)=>Array.prototype.indexOf.call(p.children,f),s=p=>{let f=p,h=f.parentElement;for(;h;){if(h===t.dom)return f;f=h,h=f.parentElement}return f};let a=-1,c=-1;e===n?(a=i(r,s(rs(e,t))),c=a):(a=i(r,s(rs(e+1,t))),c=i(r,s(rs(n-1,t))));for(let p=r.childElementCount-1;p>=0;p--)(p>a||p<c)&&o.removeChild(o.children[p]);xm(),Lo=o;const u=t.dom.className.split(" ").filter(p=>p!=="ProseMirror"&&p!=="yiitap-root"&&p!=="yiitap-editor").join(" ");Lo.className+=" yiitap-dragging-preview "+u,document.body.appendChild(Lo)}function xm(){Lo!==void 0&&(document.body.removeChild(Lo),Lo=void 0)}class Dx{constructor(e){Xe(this,"options");Xe(this,"plugin");Xe(this,"sideMenuView");const n=new Tx;this.options=e,this.plugin=new Se({key:xs,props:{handleDOMEvents:{mouseover(o,r){const i={left:r.clientX,top:r.clientY},s=jc(i,o),a=(s==null?void 0:s.className)||"",c=n.className;a.indexOf("o-table-wrapper-view")>=0&&c.indexOf("o-table-wrapper-view")>=0||(n.setHover(!0,i,a),o.dispatch(o.state.tr.setMeta(xs,n)))}}},state:{init(o,r){return n.init(r)},apply(o,r,i,s){return n.apply({tr:o,oldState:i,newState:s})}},view:o=>(this.sideMenuView=new Ox({view:o,...e}),this.sideMenuView)})}dragstart(e){Mx(e,this.options.editor)}dragend(e){Ax(e,this.options.editor)}}const Ix=l.defineComponent({name:"SideMenu",props:{pluginKey:{type:[String,Object],default:"sideMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},tippyOptions:{type:Object,default:()=>({})}},setup(t,{expose:e,slots:n}){const o=l.ref(null),r=l.ref(),i=a=>{var c;(c=r.value)==null||c.dragstart(a)},s=a=>{var c;(c=r.value)==null||c.dragend(a)};return l.onMounted(()=>{const{pluginKey:a,editor:c,updateDelay:d,tippyOptions:u}=t;r.value=new Dx({updateDelay:d,editor:c,element:o.value,pluginKey:a,tippyOptions:u}),c.registerPlugin(r.value.plugin)}),l.onBeforeUnmount(()=>{const{pluginKey:a,editor:c}=t;c.unregisterPlugin(a)}),e({...t,dragstart:i,dragend:s}),()=>{var a;return l.h("div",{ref:o},(a=n.default)==null?void 0:a.call(n))}}}),Bx={key:0,class:"o-side-menu"},Lx={class:"container"},Px=l.defineComponent({__name:"OSideMenu",props:{editor:{type:cn,required:!0},menuClass:{type:String,default:""}},setup(t){const e=t,n=l.ref(null),o=l.ref(null),r=l.ref(0),i=l.computed(()=>({arrow:!1,duration:100,placement:"left"})),s=l.computed(()=>({editor:e.editor,node:o.value,decorations:[],selected:!1,extension:{},getPos:()=>r.value,pos:r.value,updateAttributes:c,deleteNode:a,view:void 0,innerDecorations:[],HTMLAttributes:void 0}));function a(){var m,g;const f=r.value,h=f+((m=o.value)==null?void 0:m.nodeSize);(g=e.editor)==null||g.commands.deleteRange({from:f,to:h})}function c(f){var h;(h=e.editor)==null||h.commands.command(({tr:m})=>{var g;return m.setNodeMarkup(r.value,void 0,{...(g=o.value)==null?void 0:g.attrs,...f}),!0})}function d({editor:f,transaction:h}){let m={left:0,top:0};const g=xs.getState(e.editor.view.state);if(g){m=g.coords;const b=Nx(m,f);b.node&&b.pos>0&&(o.value=b.node,r.value=b.pos)}}function u(f){var h;(h=n.value)==null||h.dragstart(f)}function p(f){var h;(h=n.value)==null||h.dragend(f)}return l.onMounted(()=>{var f;(f=e.editor)==null||f.on("transaction",d)}),(f,h)=>t.editor?(l.openBlock(),l.createElementBlock("section",Bx,[l.createVNode(l.unref(Ix),{ref_key:"menu",ref:n,class:l.normalizeClass(["side-menu",t.menuClass]),editor:t.editor,"tippy-options":i.value},{default:l.withCtx(()=>[l.createElementVNode("section",Lx,[o.value?(l.openBlock(),l.createBlock(l.unref(hm),l.normalizeProps(l.mergeProps({key:0},s.value)),null,16)):l.createCommentVNode("",!0),o.value?(l.openBlock(),l.createBlock(l.unref(mm),l.mergeProps({key:1},s.value,{onDragstart:u,onDragend:p}),null,16)):l.createCommentVNode("",!0)])]),_:1},8,["class","editor","tippy-options"])])):l.createCommentVNode("",!0)}});/**
112
+ `,"2) content: () => element.cloneNode(true)"].join(" "))}var l=r.reduce(function(c,u){var d=u&&d_(u,o);return d&&c.push(d),c},[]);return pi(t)?l[0]:l}dn.defaultProps=Gt;dn.setDefaultProps=a_;dn.currentInput=On;Object.assign({},Hh,{effect:function(e){var n=e.state,o={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,o.popper),n.styles=o,n.elements.arrow&&Object.assign(n.elements.arrow.style,o.arrow)}});dn.setDefaultProps({render:sm});class p_{constructor({editor:e,element:n,view:o,tippyOptions:r={},updateDelay:i=250,shouldShow:s}){this.preventHide=!1,this.shouldShow=({view:l,state:c,from:u,to:d})=>{const{doc:p,selection:f}=c,{empty:h}=f,m=!p.textBetween(u,d).length&&ga(c.selection),g=this.element.contains(document.activeElement);return!(!(l.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:l})=>{var c;if(this.preventHide){this.preventHide=!1;return}l!=null&&l.relatedTarget&&(!((c=this.element.parentNode)===null||c===void 0)&&c.contains(l.relatedTarget))||(l==null?void 0:l.relatedTarget)!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=l=>{this.blurHandler({event:l})},this.handleDebouncedUpdate=(l,c)=>{const u=!(c!=null&&c.selection.eq(l.state.selection)),d=!(c!=null&&c.doc.eq(l.state.doc));!u&&!d||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(l,u,d,c)},this.updateDelay))},this.updateHandler=(l,c,u,d)=>{var p,f,h;const{state:m,composing:g}=l,{selection:b}=m;if(g||!c&&!u)return;this.createTooltip();const{ranges:k}=b,E=Math.min(...k.map(_=>_.$from.pos)),v=Math.max(...k.map(_=>_.$to.pos));if(!((p=this.shouldShow)===null||p===void 0?void 0:p.call(this,{editor:this.editor,element:this.element,view:l,state:m,oldState:d,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(Ph(m.selection)){let _=l.nodeDOM(E);if(_){const R=_.dataset.nodeViewWrapper?_:_.querySelector("[data-node-view-wrapper]");if(R&&(_=R.firstChild),_)return _.getBoundingClientRect()}}return $h(l,E,v)})}),this.show()},this.editor=e,this.element=n,this.view=o,this.updateDelay=i,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=r,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=dn(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:o}=e,r=o.selection.from!==o.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,n);return}const i=!(n!=null&&n.selection.eq(e.state.selection)),s=!(n!=null&&n.doc.eq(e.state.doc));this.updateHandler(e,i,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 am=t=>new Ae({key:typeof t.pluginKey=="string"?new xe(t.pluginKey):t.pluginKey,view:e=>new p_({view:e,...t})});De.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[am({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});class f_{getTextContent(e){return Ih(e,{textSerializers:Ac(this.editor.schema)})}constructor({editor:e,element:n,view:o,tippyOptions:r={},shouldShow:i}){this.preventHide=!1,this.shouldShow=({view:s,state:l})=>{const{selection:c}=l,{$anchor:u,empty:d}=c,p=u.depth===1,f=u.parent.isTextblock&&!u.parent.type.spec.code&&!u.parent.textContent&&u.parent.childCount===0&&!this.getTextContent(u.parent);return!(!s.hasFocus()||!d||!p||!f||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:s})=>{var l;if(this.preventHide){this.preventHide=!1;return}s!=null&&s.relatedTarget&&(!((l=this.element.parentNode)===null||l===void 0)&&l.contains(s.relatedTarget))||(s==null?void 0:s.relatedTarget)!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=s=>{this.blurHandler({event:s})},this.editor=e,this.element=n,this.view=o,i&&(this.shouldShow=i),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=r,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=dn(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"right",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){var o,r,i;const{state:s}=e,{doc:l,selection:c}=s,{from:u,to:d}=c;if(n&&n.doc.eq(l)&&n.selection.eq(c))return;if(this.createTooltip(),!((o=this.shouldShow)===null||o===void 0?void 0:o.call(this,{editor:this.editor,view:e,state:s,oldState:n}))){this.hide();return}(r=this.tippy)===null||r===void 0||r.setProps({getReferenceClientRect:((i=this.tippyOptions)===null||i===void 0?void 0:i.getReferenceClientRect)||(()=>$h(e,u,d))}),this.show()}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const lm=t=>new Ae({key:typeof t.pluginKey=="string"?new xe(t.pluginKey):t.pluginKey,view:e=>new f_({view:e,...t})});De.create({name:"floatingMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"floatingMenu",shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[lm({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}});const h_=a.defineComponent({name:"BubbleMenu",props:{pluginKey:{type:[String,Object],default:"bubbleMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},tippyOptions:{type:Object,default:()=>({})},shouldShow:{type:Function,default:null}},setup(t,{slots:e}){const n=a.ref(null);return a.onMounted(()=>{const{updateDelay:o,editor:r,pluginKey:i,shouldShow:s,tippyOptions:l}=t;r.registerPlugin(am({updateDelay:o,editor:r,element:n.value,pluginKey:i,shouldShow:s,tippyOptions:l}))}),a.onBeforeUnmount(()=>{const{pluginKey:o,editor:r}=t;r.unregisterPlugin(o)}),()=>{var o;return a.h("div",{ref:n},(o=e.default)===null||o===void 0?void 0:o.call(e))}}});function np(t){return a.customRef((e,n)=>({get(){return e(),t},set(o){t=o,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}class cm extends Zt{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=np(this.view.state),this.reactiveExtensionStorage=np(this.extensionStorage),this.on("beforeTransaction",({nextState:n})=>{this.reactiveState.value=n,this.reactiveExtensionStorage.value=this.extensionStorage}),a.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,n){const o=super.registerPlugin(e,n);return this.reactiveState&&(this.reactiveState.value=o),o}unregisterPlugin(e){const n=super.unregisterPlugin(e);return this.reactiveState&&n&&(this.reactiveState.value=n),n}}const m_=a.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(t){const e=a.ref(),n=a.getCurrentInstance();return a.watchEffect(()=>{const o=t.editor;o&&o.options.element&&e.value&&a.nextTick(()=>{if(!e.value||!o.options.element.firstChild)return;const r=a.unref(e.value);e.value.append(...o.options.element.childNodes),o.contentComponent=n.ctx._,n&&(o.appContext={...n.appContext,provides:n.provides}),o.setOptions({element:r}),o.createNodeViews()})}),a.onBeforeUnmount(()=>{const o=t.editor;o&&(o.contentComponent=null,o.appContext=null)}),{rootEl:e}},render(){return a.h("div",{ref:t=>{this.rootEl=t}})}}),g_=a.defineComponent({name:"FloatingMenu",props:{pluginKey:{type:null,default:"floatingMenu"},editor:{type:Object,required:!0},tippyOptions:{type:Object,default:()=>({})},shouldShow:{type:Function,default:null}},setup(t,{slots:e}){const n=a.ref(null);return a.onMounted(()=>{const{pluginKey:o,editor:r,tippyOptions:i,shouldShow:s}=t;r.registerPlugin(lm({pluginKey:o,editor:r,element:n.value,tippyOptions:i,shouldShow:s}))}),a.onBeforeUnmount(()=>{const{pluginKey:o,editor:r}=t;r.unregisterPlugin(o)}),()=>{var o;return a.h("div",{ref:n},(o=e.default)===null||o===void 0?void 0:o.call(e))}}}),Pn=a.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return a.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),Uc=a.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var t,e;return a.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(t=this.$slots).default)===null||e===void 0?void 0:e.call(t))}}),b_=(t={})=>{const e=a.shallowRef();return a.onMounted(()=>{e.value=new cm(t)}),a.onBeforeUnmount(()=>{var n,o,r;const i=(n=e.value)===null||n===void 0?void 0:n.options.element,s=i==null?void 0:i.cloneNode(!0);(o=i==null?void 0:i.parentNode)===null||o===void 0||o.replaceChild(s,i),(r=e.value)===null||r===void 0||r.destroy()}),e};class qc{constructor(e,{props:n={},editor:o}){this.editor=o,this.component=a.markRaw(e),this.el=document.createElement("div"),this.props=a.reactive(n),this.renderedComponent=this.renderComponent()}get element(){return this.renderedComponent.el}get ref(){var e,n,o,r;return!((n=(e=this.renderedComponent.vNode)===null||e===void 0?void 0:e.component)===null||n===void 0)&&n.exposed?this.renderedComponent.vNode.component.exposed:(r=(o=this.renderedComponent.vNode)===null||o===void 0?void 0:o.component)===null||r===void 0?void 0:r.proxy}renderComponent(){let e=a.h(this.component,this.props);return this.editor.appContext&&(e.appContext=this.editor.appContext),typeof document<"u"&&this.el&&a.render(e,this.el),{vNode:e,destroy:()=>{this.el&&a.render(null,this.el),this.el=null,e=null},el:this.el?this.el.firstElementChild:null}}updateProps(e={}){Object.entries(e).forEach(([n,o])=>{this.props[n]=o}),this.renderComponent()}destroy(){this.renderedComponent.destroy()}}const ct={editor:{type:Object,required:!0},node:{type:Object,required:!0},decorations:{type:Object,required:!0},selected:{type:Boolean,required:!0},extension:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0},view:{type:Object,required:!0},innerDecorations:{type:Object,required:!0},HTMLAttributes:{type:Object,required:!0}};class y_ extends RE{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:(r={})=>this.updateAttributes(r),deleteNode:()=>this.deleteNode()},n=this.onDragStart.bind(this);this.decorationClasses=a.ref(this.getDecorationClasses());const o=a.defineComponent({extends:{...this.component},props:Object.keys(e),template:this.component.template,setup:r=>{var i,s;return a.provide("onDragStart",n),a.provide("decorationClasses",this.decorationClasses),(s=(i=this.component).setup)===null||s===void 0?void 0:s.call(i,r,{expose:()=>{}})},__scopeId:this.component.__scopeId,__cssModules:this.component.__cssModules,__name:this.component.__name,__file:this.component.__file});this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.renderer=new qc(o,{editor:this.editor,props:e})}get dom(){if(!this.renderer.element||!this.renderer.element.hasAttribute("data-node-view-wrapper"))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.dom.querySelector("[data-node-view-content]")}handleSelectionUpdate(){const{from:e,to:n}=this.editor.state.selection,o=this.getPos();if(typeof o=="number")if(e<=o&&n>=o+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(e,n,o){const r=i=>{this.decorationClasses.value=this.getDecorationClasses(),this.renderer.updateProps(i)};if(typeof this.options.update=="function"){const i=this.node,s=this.decorations,l=this.innerDecorations;return this.node=e,this.decorations=n,this.innerDecorations=o,this.options.update({oldNode:i,oldDecorations:s,newNode:e,newDecorations:n,oldInnerDecorations:l,innerDecorations:o,updateProps:()=>r({node:e,decorations:n,innerDecorations:o})})}return e.type!==this.node.type?!1:(e===this.node&&this.decorations===n&&this.innerDecorations===o||(this.node=e,this.decorations=n,this.innerDecorations=o,r({node:e,decorations:n,innerDecorations:o})),!0)}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element&&this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element&&this.renderer.element.classList.remove("ProseMirror-selectednode")}getDecorationClasses(){return this.decorations.map(e=>e.type.attrs.class).flat().join(" ")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate)}}function pn(t,e){return n=>{if(!n.editor.contentComponent)return{};const o=typeof t=="function"&&"__vccOpts"in t?t.__vccOpts:t;return new y_(o,n,e)}}const v_=/^\s*>\s$/,um=ze.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",_e(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[mr({find:v_,type:this.type})]}}),k_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,w_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,E_=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,__=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,C_=ln.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",_e(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[Wo({find:k_,type:this.type}),Wo({find:E_,type:this.type})]},addPasteRules(){return[ko({find:w_,type:this.type}),ko({find:__,type:this.type})]}}),S_="listItem",op="textStyle",rp=/^\s*([-+*])\s$/,x_=ze.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",_e(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(S_,this.editor.getAttributes(op)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=mr({find:rp,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=mr({find:rp,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(op),editor:this.editor})),[t]}}),N_=/(^|[^`])`([^`]+)`(?!`)/,T_=/(^|[^`])`([^`]+)`(?!`)/g,O_=ln.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",_e(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[Wo({find:N_,type:this.type})]},addPasteRules(){return[ko({find:T_,type:this.type})]}}),M_=/^```([a-z]+)?[\s\n]$/,A_=/^~~~([a-z]+)?[\s\n]$/,dm=ze.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,i=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(s=>s.startsWith(n)).map(s=>s.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",_e(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:o,empty:r}=n;if(!r||o.parent.type!==this.type)return!1;const i=o.parentOffset===o.parent.nodeSize-2,s=o.parent.textContent.endsWith(`
113
+
114
+ `);return!i||!s?!1:t.chain().command(({tr:l})=>(l.delete(o.pos-2,o.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:o}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type||!(r.parentOffset===r.parent.nodeSize-2))return!1;const l=r.after();return l===void 0?!1:o.nodeAt(l)?t.commands.command(({tr:u})=>(u.setSelection(ae.near(o.resolve(l))),!0)):t.commands.exitCode()}}},addInputRules(){return[Vl({find:M_,type:this.type,getAttributes:t=>({language:t[1]})}),Vl({find:A_,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Ae({key:new xe("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),o=e.clipboardData.getData("vscode-editor-data"),r=o?JSON.parse(o):void 0,i=r==null?void 0:r.mode;if(!n||!i)return!1;const{tr:s,schema:l}=t.state,c=l.text(n.replace(/\r\n?/g,`
115
+ `));return s.replaceSelectionWith(this.type.create({language:i},c)),s.selection.$from.parent.type!==this.type&&s.setSelection(ne.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}}),Kc=ze.create({name:"doc",topNode:!0,content:"block+"});function R_(t={}){return new Ae({view(e){return new B_(e,t)}})}class B_{constructor(e,n){var o;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(o=n.width)!==null&&o!==void 0?o:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{let i=s=>{this[r](s)};return e.dom.addEventListener(r,i),{name:r,handler:i}})}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,o;if(n){let l=e.nodeBefore,c=e.nodeAfter;if(l||c){let u=this.editorView.nodeDOM(this.cursorPos-(l?l.nodeSize:0));if(u){let d=u.getBoundingClientRect(),p=l?d.bottom:d.top;l&&c&&(p=(p+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),o={left:d.left,right:d.right,top:p-this.width/2,bottom:p+this.width/2}}}}if(!o){let l=this.editorView.coordsAtPos(this.cursorPos);o={left:l.left-this.width/2,right:l.left+this.width/2,top:l.top,bottom:l.bottom}}let r=this.editorView.dom.offsetParent;this.element||(this.element=r.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 i,s;if(!r||r==document.body&&getComputedStyle(r).position=="static")i=-pageXOffset,s=-pageYOffset;else{let l=r.getBoundingClientRect();i=l.left-r.scrollLeft,s=l.top-r.scrollTop}this.element.style.left=o.left-i+"px",this.element.style.top=o.top-s+"px",this.element.style.width=o.right-o.left+"px",this.element.style.height=o.bottom-o.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),o=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),r=o&&o.type.spec.disableDropCursor,i=typeof r=="function"?r(this.editorView,n,e):r;if(n&&!i){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Sf(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const D_=De.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[R_(this.options)]}});class Ze extends ae{constructor(e){super(e,e)}map(e,n){let o=e.resolve(n.map(this.head));return Ze.valid(o)?new Ze(o):ae.near(o)}content(){return V.empty}eq(e){return e instanceof Ze&&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 Ze(e.resolve(n.pos))}getBookmark(){return new Wc(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!I_(e)||!L_(e))return!1;let o=n.type.spec.allowGapCursor;if(o!=null)return o;let r=n.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,n,o=!1){e:for(;;){if(!o&&Ze.valid(e))return e;let r=e.pos,i=null;for(let s=e.depth;;s--){let l=e.node(s);if(n>0?e.indexAfter(s)<l.childCount:e.index(s)>0){i=l.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;r+=n;let c=e.doc.resolve(r);if(Ze.valid(c))return c}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!oe.isSelectable(i)){e=e.doc.resolve(r+i.nodeSize*n),o=!1;continue e}break}i=s,r+=n;let l=e.doc.resolve(r);if(Ze.valid(l))return l}return null}}}Ze.prototype.visible=!1;Ze.findFrom=Ze.findGapCursorFrom;ae.jsonID("gapcursor",Ze);class Wc{constructor(e){this.pos=e}map(e){return new Wc(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Ze.valid(n)?new Ze(n):ae.near(n)}}function I_(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),o=t.node(e);if(n==0){if(o.type.spec.isolating)return!0;continue}for(let r=o.child(n-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}}return!0}function L_(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),o=t.node(e);if(n==o.childCount){if(o.type.spec.isolating)return!0;continue}for(let r=o.child(n);;r=r.firstChild){if(r.childCount==0&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}}return!0}function P_(){return new Ae({props:{decorations:z_,createSelectionBetween(t,e,n){return e.pos==n.pos&&Ze.valid(n)?new Ze(n):null},handleClick:F_,handleKeyDown:$_,handleDOMEvents:{beforeinput:V_}}})}const $_=_c({ArrowLeft:Fi("horiz",-1),ArrowRight:Fi("horiz",1),ArrowUp:Fi("vert",-1),ArrowDown:Fi("vert",1)});function Fi(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(o,r,i){let s=o.selection,l=e>0?s.$to:s.$from,c=s.empty;if(s instanceof ne){if(!i.endOfTextblock(n)||l.depth==0)return!1;c=!1,l=o.doc.resolve(e>0?l.after():l.before())}let u=Ze.findGapCursorFrom(l,e,c);return u?(r&&r(o.tr.setSelection(new Ze(u))),!0):!1}}function F_(t,e,n){if(!t||!t.editable)return!1;let o=t.state.doc.resolve(e);if(!Ze.valid(o))return!1;let r=t.posAtCoords({left:n.clientX,top:n.clientY});return r&&r.inside>-1&&oe.isSelectable(t.state.doc.nodeAt(r.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Ze(o))),!0)}function V_(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Ze))return!1;let{$from:n}=t.state.selection,o=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!o)return!1;let r=A.empty;for(let s=o.length-1;s>=0;s--)r=A.from(o[s].createAndFill(null,r));let i=t.state.tr.replace(n.pos,n.pos,new V(r,0,0));return i.setSelection(ne.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function z_(t){if(!(t.selection instanceof Ze))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Ne.create(t.doc,[Ge.widget(t.selection.head,e,{key:"gapcursor"})])}const H_=De.create({name:"gapCursor",addProseMirrorPlugins(){return[P_()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=ve(j(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),U_=ze.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",_e(this.options.HTMLAttributes,t)]},renderText(){return`
116
+ `},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:o})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:r,storedMarks:i}=n;if(r.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:l}=o.extensionManager,c=i||r.$to.parentOffset&&r.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:d})=>{if(d&&c&&s){const p=c.filter(f=>l.includes(f.type.name));u.ensureMarks(p)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),pm=ze.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]}`,_e(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=>Vl({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Ts=200,ht=function(){};ht.prototype.append=function(e){return e.length?(e=ht.from(e),!this.length&&e||e.length<Ts&&this.leafAppend(e)||this.length<Ts&&e.leafPrepend(this)||this.appendInner(e)):this};ht.prototype.prepend=function(e){return e.length?ht.from(e).append(this):this};ht.prototype.appendInner=function(e){return new q_(this,e)};ht.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?ht.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};ht.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ht.prototype.forEach=function(e,n,o){n===void 0&&(n=0),o===void 0&&(o=this.length),n<=o?this.forEachInner(e,n,o,0):this.forEachInvertedInner(e,n,o,0)};ht.prototype.map=function(e,n,o){n===void 0&&(n=0),o===void 0&&(o=this.length);var r=[];return this.forEach(function(i,s){return r.push(e(i,s))},n,o),r};ht.from=function(e){return e instanceof ht?e:e&&e.length?new fm(e):ht.empty};var fm=function(t){function e(o){t.call(this),this.values=o}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(r,i){return r==0&&i==this.length?this:new e(this.values.slice(r,i))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,i,s,l){for(var c=i;c<s;c++)if(r(this.values[c],l+c)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,l){for(var c=i-1;c>=s;c--)if(r(this.values[c],l+c)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=Ts)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=Ts)return new e(r.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(ht);ht.empty=new fm([]);var q_=function(t){function e(n,o){t.call(this),this.left=n,this.right=o,this.length=n.length+o.length,this.depth=Math.max(n.depth,o.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(o){return o<this.left.length?this.left.get(o):this.right.get(o-this.left.length)},e.prototype.forEachInner=function(o,r,i,s){var l=this.left.length;if(r<l&&this.left.forEachInner(o,r,Math.min(i,l),s)===!1||i>l&&this.right.forEachInner(o,Math.max(r-l,0),Math.min(this.length,i)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(o,r,i,s){var l=this.left.length;if(r>l&&this.right.forEachInvertedInner(o,r-l,Math.max(i,l)-l,s+l)===!1||i<l&&this.left.forEachInvertedInner(o,Math.min(r,l),i,s)===!1)return!1},e.prototype.sliceInner=function(o,r){if(o==0&&r==this.length)return this;var i=this.left.length;return r<=i?this.left.slice(o,r):o>=i?this.right.slice(o-i,r-i):this.left.slice(o,i).append(this.right.slice(0,r-i))},e.prototype.leafAppend=function(o){var r=this.right.leafAppend(o);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(o){var r=this.left.leafPrepend(o);if(r)return new e(r,this.right)},e.prototype.appendInner=function(o){return this.left.depth>=Math.max(this.right.depth,o.depth)+1?new e(this.left,new e(this.right,o)):new e(this,o)},e}(ht);const K_=500;class bn{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let o=this.items.length;for(;;o--)if(this.items.get(o-1).selection){--o;break}let r,i;n&&(r=this.remapping(o,this.items.length),i=r.maps.length);let s=e.tr,l,c,u=[],d=[];return this.items.forEach((p,f)=>{if(!p.step){r||(r=this.remapping(o,f+1),i=r.maps.length),i--,d.push(p);return}if(r){d.push(new xn(p.map));let h=p.step.map(r.slice(i)),m;h&&s.maybeStep(h).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],u.push(new xn(m,void 0,void 0,u.length+d.length))),i--,m&&r.appendMap(m,i)}else s.maybeStep(p.step);if(p.selection)return l=r?p.selection.map(r.slice(i)):p.selection,c=new bn(this.items.slice(0,o).append(d.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:s,selection:l}}addTransform(e,n,o,r){let i=[],s=this.eventCount,l=this.items,c=!r&&l.length?l.get(l.length-1):null;for(let d=0;d<e.steps.length;d++){let p=e.steps[d].invert(e.docs[d]),f=new xn(e.mapping.maps[d],p,n),h;(h=c&&c.merge(f))&&(f=h,d?i.pop():l=l.slice(0,l.length-1)),i.push(f),n&&(s++,n=void 0),r||(c=f)}let u=s-o.depth;return u>j_&&(l=W_(l,u),s-=u),new bn(l.append(i),s)}remapping(e,n){let o=new oi;return this.items.forEach((r,i)=>{let s=r.mirrorOffset!=null&&i-r.mirrorOffset>=e?o.maps.length-r.mirrorOffset:void 0;o.appendMap(r.map,s)},e,n),o}addMaps(e){return this.eventCount==0?this:new bn(this.items.append(e.map(n=>new xn(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let o=[],r=Math.max(0,this.items.length-n),i=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},r);let c=n;this.items.forEach(f=>{let h=i.getMirror(--c);if(h==null)return;s=Math.min(s,h);let m=i.maps[h];if(f.step){let g=e.steps[h].invert(e.docs[h]),b=f.selection&&f.selection.map(i.slice(c+1,h));b&&l++,o.push(new xn(m,g,b))}else o.push(new xn(m))},r);let u=[];for(let f=n;f<s;f++)u.push(new xn(i.maps[f]));let d=this.items.slice(0,r).append(u).append(o),p=new bn(d,l);return p.emptyItemCount()>K_&&(p=p.compress(this.items.length-o.length)),p}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),o=n.maps.length,r=[],i=0;return this.items.forEach((s,l)=>{if(l>=e)r.push(s),s.selection&&i++;else if(s.step){let c=s.step.map(n.slice(o)),u=c&&c.getMap();if(o--,u&&n.appendMap(u,o),c){let d=s.selection&&s.selection.map(n.slice(o));d&&i++;let p=new xn(u.invert(),c,d),f,h=r.length-1;(f=r.length&&r[h].merge(p))?r[h]=f:r.push(p)}}else s.map&&o--},this.items.length,0),new bn(ht.from(r.reverse()),i)}}bn.empty=new bn(ht.empty,0);function W_(t,e){let n;return t.forEach((o,r)=>{if(o.selection&&e--==0)return n=r,!1}),t.slice(n)}class xn{constructor(e,n,o,r){this.map=e,this.step=n,this.selection=o,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new xn(n.getMap().invert(),n,this.selection)}}}class so{constructor(e,n,o,r,i){this.done=e,this.undone=n,this.prevRanges=o,this.prevTime=r,this.prevComposition=i}}const j_=20;function G_(t,e,n,o){let r=n.getMeta(Vo),i;if(r)return r.historyState;n.getMeta(X_)&&(t=new so(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(Vo))return s.getMeta(Vo).redo?new so(t.done.addTransform(n,void 0,o,ls(e)),t.undone,ip(n.mapping.maps),t.prevTime,t.prevComposition):new so(t.done,t.undone.addTransform(n,void 0,o,ls(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),c=t.prevTime==0||!s&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-o.newGroupDelay||!Y_(n,t.prevRanges)),u=s?rl(t.prevRanges,n.mapping):ip(n.mapping.maps);return new so(t.done.addTransform(n,c?e.selection.getBookmark():void 0,o,ls(e)),bn.empty,u,n.time,l??t.prevComposition)}else return(i=n.getMeta("rebased"))?new so(t.done.rebased(n,i),t.undone.rebased(n,i),rl(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new so(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),rl(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((o,r)=>{for(let i=0;i<e.length;i+=2)o<=e[i+1]&&r>=e[i]&&(n=!0)}),n}function ip(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((o,r,i,s)=>e.push(i,s));return e}function rl(t,e){if(!t)return null;let n=[];for(let o=0;o<t.length;o+=2){let r=e.map(t[o],1),i=e.map(t[o+1],-1);r<=i&&n.push(r,i)}return n}function J_(t,e,n){let o=ls(e),r=Vo.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,o);if(!i)return null;let s=i.selection.resolve(i.transform.doc),l=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),r,o),c=new so(n?l:i.remaining,n?i.remaining:l,null,0,-1);return i.transform.setSelection(s).setMeta(Vo,{redo:n,historyState:c})}let il=!1,sp=null;function ls(t){let e=t.plugins;if(sp!=e){il=!1,sp=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){il=!0;break}}return il}const Vo=new xe("history"),X_=new xe("closeHistory");function Z_(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Ae({key:Vo,state:{init(){return new so(bn.empty,bn.empty,null,0,-1)},apply(e,n,o){return G_(n,o,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let o=n.inputType,r=o=="historyUndo"?mm:o=="historyRedo"?gm:null;return r?(n.preventDefault(),r(e.state,e.dispatch)):!1}}}})}function hm(t,e){return(n,o)=>{let r=Vo.getState(n);if(!r||(t?r.undone:r.done).eventCount==0)return!1;if(o){let i=J_(r,n,t);i&&o(e?i.scrollIntoView():i)}return!0}}const mm=hm(!1,!0),gm=hm(!0,!0),Q_=De.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>mm(t,e),redo:()=>({state:t,dispatch:e})=>gm(t,e)}},addProseMirrorPlugins(){return[Z_(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()}}}),bm=ze.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",_e(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{const{selection:n}=e,{$from:o,$to:r}=n,i=t();return o.parentOffset===0?i.insertContentAt({from:Math.max(o.pos-1,0),to:r.pos},{type:this.name}):Ph(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({tr:s,dispatch:l})=>{var c;if(l){const{$to:u}=s.selection,d=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?s.setSelection(ne.create(s.doc,u.pos+1)):u.nodeAfter.isBlock?s.setSelection(oe.create(s.doc,u.pos)):s.setSelection(ne.create(s.doc,u.pos));else{const p=(c=u.parent.type.contentMatch.defaultType)===null||c===void 0?void 0:c.create();p&&(s.insert(d,p),s.setSelection(ne.create(s.doc,d+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[va({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),eC=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,tC=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,nC=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,oC=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,rC=ln.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",_e(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[Wo({find:eC,type:this.type}),Wo({find:nC,type:this.type})]},addPasteRules(){return[ko({find:tC,type:this.type}),ko({find:oC,type:this.type})]}}),iC=ze.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",_e(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)}}}),sC="listItem",ap="textStyle",lp=/^(\d+)\.\s$/,aC=ze.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",_e(this.options.HTMLAttributes,n),0]:["ol",_e(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(sC,this.editor.getAttributes(ap)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=mr({find:lp,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=mr({find:lp,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(ap)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),ym=ze.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",_e(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),lC=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,cC=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,uC=ln.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",_e(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[Wo({find:lC,type:this.type})]},addPasteRules(){return[ko({find:cC,type:this.type})]}}),vm=ze.create({name:"text",group:"inline"}),dC=De.create({name:"starterKit",addExtensions(){var t,e,n,o,r,i,s,l,c,u,d,p,f,h,m,g,b,y;const k=[];return this.options.bold!==!1&&k.push(C_.configure((t=this.options)===null||t===void 0?void 0:t.bold)),this.options.blockquote!==!1&&k.push(um.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bulletList!==!1&&k.push(x_.configure((n=this.options)===null||n===void 0?void 0:n.bulletList)),this.options.code!==!1&&k.push(O_.configure((o=this.options)===null||o===void 0?void 0:o.code)),this.options.codeBlock!==!1&&k.push(dm.configure((r=this.options)===null||r===void 0?void 0:r.codeBlock)),this.options.document!==!1&&k.push(Kc.configure((i=this.options)===null||i===void 0?void 0:i.document)),this.options.dropcursor!==!1&&k.push(D_.configure((s=this.options)===null||s===void 0?void 0:s.dropcursor)),this.options.gapcursor!==!1&&k.push(H_.configure((l=this.options)===null||l===void 0?void 0:l.gapcursor)),this.options.hardBreak!==!1&&k.push(U_.configure((c=this.options)===null||c===void 0?void 0:c.hardBreak)),this.options.heading!==!1&&k.push(pm.configure((u=this.options)===null||u===void 0?void 0:u.heading)),this.options.history!==!1&&k.push(Q_.configure((d=this.options)===null||d===void 0?void 0:d.history)),this.options.horizontalRule!==!1&&k.push(bm.configure((p=this.options)===null||p===void 0?void 0:p.horizontalRule)),this.options.italic!==!1&&k.push(rC.configure((f=this.options)===null||f===void 0?void 0:f.italic)),this.options.listItem!==!1&&k.push(iC.configure((h=this.options)===null||h===void 0?void 0:h.listItem)),this.options.orderedList!==!1&&k.push(aC.configure((m=this.options)===null||m===void 0?void 0:m.orderedList)),this.options.paragraph!==!1&&k.push(ym.configure((g=this.options)===null||g===void 0?void 0:g.paragraph)),this.options.strike!==!1&&k.push(uC.configure((b=this.options)===null||b===void 0?void 0:b.strike)),this.options.text!==!1&&k.push(vm.configure((y=this.options)===null||y===void 0?void 0:y.text)),k}}),pC=t=>{if(!t.children.length)return;const e=t.querySelectorAll("span");e&&e.forEach(n=>{var o,r;const i=n.getAttribute("style"),s=(r=(o=n.parentElement)===null||o===void 0?void 0:o.closest("span"))===null||r===void 0?void 0:r.getAttribute("style");n.setAttribute("style",`${s};${i}`)})},fC=ln.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&pC(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",_e(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(n,o)=>{if(n.isTextblock)return!0;n.marks.filter(r=>r.type===this.type).some(r=>Object.values(r.attrs).some(i=>!!i))||t.removeMark(o,o+n.nodeSize,this.type)}),!0}}}}),re=a.defineComponent({name:"ICon",__name:"OIcon",props:{name:{type:String,default:""},color:{type:String,default:""},small:{type:Boolean,default:!1}},setup(t){return(e,n)=>(a.openBlock(),a.createElementBlock("span",{class:a.normalizeClass(["o-icon",{small:t.small}]),style:a.normalizeStyle({color:t.color})},[a.createElementVNode("i",{class:a.normalizeClass(["yiitip-icon",`icon-${t.name}`])},null,2)],6))}}),km={deepseek:{baseURL:"https://api.deepseek.com/v1",name:"DeepSeek"},openai:{baseURL:"https://api.openai.com/v1",name:"OpenAI"}},jc=(t,e)=>{const n=km[t];return n?n[e]:null},Gc={writing:"You are a professional writing assistant. Please answer in [LANGUAGE]."},me={amber:"#ffc107",blue:"#2172e0",brown:"#795548",cyan:"#00bcd4",deepOrange:"#ff5722",deepPurple:"#673ab7",green:"#4caf50",indigo:"#3f51b5",lightBlue:"#03a9f4",lightGreen:"#8bc34a",lime:"#cddc39",orange:"#ff9800",purple:"#9c27b0",pink:"#e91e63",red:"#f44336",teal:"#009688",yellow:"#ffeb3b"},hC=[{label:"blue",value:"#2172e0",name:"blue"},{label:"indigo",value:"#3f51b5",name:"indigo"},{label:"cyan",value:"#00bcd4",name:"cyan"},{label:"teal",value:"#009688",name:"teal"},{label:"green",value:"#4caf50",name:"green"},{label:"deep-purple",value:"#673ab7",name:"deep-purple"},{label:"red",value:"#f44336",name:"red"},{label:"deep-orange",value:"#ff5722",name:"deep-orange"}],Sr=[{label:"editor.paragraph",value:"paragraph",icon:"title",color:"",style:!0,group:"label.basic"},{label:"editor.heading1",value:"heading",icon:"format_h1",color:me.blue,style:!0,options:{level:1}},{label:"editor.heading2",value:"heading",icon:"format_h2",color:me.blue,style:!0,options:{level:2}},{label:"editor.heading3",value:"heading",icon:"format_h3",color:me.blue,style:!0,options:{level:3}},{label:"editor.todoList",value:"taskList",icon:"check_box",color:me.indigo,style:!0},{label:"editor.unorderedList",value:"bulletList",icon:"format_list_bulleted",color:me.indigo,style:!0},{label:"editor.orderedList",value:"orderedList",icon:"format_list_numbered",color:me.indigo,style:!0},{label:"editor.blockquote",value:"blockquote",icon:"format_quote_open",color:me.brown,style:!0},{label:"editor.codeBlock",value:"codeBlock",icon:"code_braces",color:me.lightBlue,style:!0},{label:"editor.horizontal",value:"horizontalRule",icon:"horizontal_rule",color:me.blue},{label:"editor.callout",value:"callout",color:me.deepOrange,icon:"card_text",style:!1},{label:"editor.emoji",value:"emoji",icon:"emoji_emotions",color:me.blue}],hi=Sr.filter(t=>t.style),kr=[{label:"editor.aiBlock",value:"aiBlock",icon:"auto_awesome",color:me.purple,tips:"ai",group:"label.ai"},{label:"editor.callout",value:"callout",icon:"card_text",color:me.deepOrange,tips:"callout",group:"label.common"},{label:"editor.table",value:"table",icon:"window",tips:"table",color:me.cyan},{label:"editor.codeBlock",value:"codeBlock",icon:"code_braces",tips:"code",color:me.blue},{label:"editor.todoList",value:"taskList",icon:"check_box",tips:"task",color:me.indigo},{label:"label.image",value:"image",icon:"image",color:me.amber,tips:"image",group:"label.media"},{label:"label.video",value:"video",icon:"videocam",tips:"video",color:me.purple},{label:"label.model",value:"modelViewer",icon:"3d_rotation",tips:"model",color:me.purple}],wa=[...Sr,...kr],Wl=[{label:"editor.duplicate",value:"duplicate",icon:"content_copy",color:me.blue,tips:"Ctrl+D",group:"label.common",filter:"common"},{label:"editor.delete",value:"delete",icon:"delete",tips:"Ctrl+D",color:me.deepOrange,filter:"common"},{label:"label.replace",value:"replace",icon:"cached",tips:"Ctrl+R",color:me.blue,filter:"image,video,model"},{label:"label.color",value:"palette",icon:"palette",color:me.purple,filter:"callout",component:"OCalloutColorBoard"}],wm=[{label:"ai.improve_writing",value:"improve_writing",icon:"title",color:me.purple,group:"label.suggested",options:{prompt:"Improve writing of the following content: [CONTENT]"},tips:"improve"},{label:"ai.fix_spelling_grammar",value:"fix_spelling_grammar",icon:"spellcheck",color:me.purple,options:{prompt:"Fix spelling and grammar of the following content: [CONTENT]"},tips:"fix"},{label:"ai.enrich_with_emoji",value:"enrich_with_emoji",icon:"emoji_emotions",color:me.purple,options:{prompt:"Enrich the following content with Emoji: [CONTENT]"},tips:"emoji"},{label:"ai.translate",value:"translate",icon:"translate",color:me.purple,options:{prompt:"Translate the following content to [LANGUAGE]: [CONTENT]"},children:[{label:"language.chinese_simplified",value:"Simplified Chinese",icon:"language"},{label:"language.chinese_traditional",value:"Traditional Chinese",icon:"language"},{label:"language.german",value:"German",icon:"language"},{label:"language.french",value:"French",icon:"language"},{label:"language.japanese",value:"Japanese",icon:"language"},{label:"language.korean",value:"Korean",icon:"language"}]},{label:"ai.make_longer",value:"make_longer",icon:"subject",color:me.purple,options:{prompt:"Make following content longer: [CONTENT]"},group:"label.edit",tips:"long"},{label:"ai.make_shorter",value:"make_shorter",icon:"short_text",color:me.purple,options:{prompt:"Make following content shorter: [CONTENT]"},tips:"short"},{label:"ai.change_tone",value:"change_tone",icon:"invert_colors",color:me.purple,options:{prompt:"Change tone of the following content to [TONE]: [CONTENT]"},children:[{label:"ai.tone.formal",value:"Formal",icon:"invert_colors"},{label:"ai.tone.casual",value:"Casual",icon:"invert_colors"},{label:"ai.tone.friendly",value:"Friendly",icon:"invert_colors"},{label:"ai.tone.enthusiastic",value:"Enthusiastic",icon:"invert_colors"},{label:"ai.tone.authoritative",value:"Authoritative",icon:"invert_colors"},{label:"ai.tone.humorous",value:"Humorous",icon:"invert_colors"},{label:"ai.tone.inspirational",value:"Inspirational",icon:"invert_colors"},{label:"ai.tone.empathetic",value:"Empathetic",icon:"invert_colors"},{label:"ai.tone.mysterious",value:"Mysterious",icon:"invert_colors"}]},{label:"ai.explain",value:"explain",icon:"format_quote_open",color:me.purple,options:{prompt:"Improve writing of the following content: [CONTENT]"},tips:"explain",group:"label.think"}],Em=[{label:"ai.summarize",value:"summarize",icon:"notes",color:me.purple,options:{prompt:"Summarize the following content: [CONTENT]"},group:"label.suggested"},{label:"ai.continuation",value:"continuation",icon:"edit_note",color:me.purple,options:{prompt:"Continue writing with the content: [CONTENT]"}}],_m=["bold","italic","text-format-dropdown","separator","heading","font-family","text-color-dropdown","fore-color","back-color","clearFormat","separator","align-dropdown","separator","horizontalRule","blockquote","list-dropdown","codeBlock","link","image","video","modelViewer","table","callout","emoji","columns","aiBlock"],Cm=["table-group","separator","bold","italic","text-format-dropdown","separator","heading","font-family","text-color-dropdown","clearFormat","separator","align-dropdown","separator","horizontalRule","blockquote","list-dropdown","link","image"],Sm=["bold","strike","text-color-dropdown","clearFormat","separator","ai","separator","list-group","link","callout","separator","align-dropdown","more"],xm=["link-open","link-edit","linkUnset"],Nm=["align-group","separator","link"],Tm=["align-group","separator","link-open","link-edit","linkUnset"],Om=["heading","separator","italic","underline","font-family","separator","code","blockquote"],Mm=["table-group","separator","bold","italic","font-family","text-color-dropdown","separator","align-group"],mC=["table-group","separator","bold","italic","font-family","text-color-dropdown","separator","align-group"],Am=["style-dropdown","separator","bold","italic","text-color-dropdown","separator","align-dropdown"],gC=["table-group","separator","align-group"],bC={video:["youtube","youku","bilibili","qqvideo"],map:["google_map","amap","baidu_map"],design:["modao","lanhu","figma","canva","processon"],develop:["codepen"],data:["google_forms","jinshuju"],others:["iframe"]},yC=new zb({breaks:!0});function Yc(){const t=a.inject("aiOption"),e=a.ref(null);function n(){if(!t.value)return;const{provider:r,apiKey:i,baseURL:s}=t.value,l=s||jc(r,"baseURL");!r||!i||!l||(e.value=new Vb({apiKey:i,baseURL:l,dangerouslyAllowBrowser:!0}))}const o=async(r,i)=>{var s,l,c;if(!e.value)throw new Error("AI SDK is not initialized, please check AI options.");try{const u=await((s=e.value)==null?void 0:s.chat.completions.create({model:"deepseek-chat",messages:r,temperature:.7,stream:!0}));let d="";for await(const p of u){const f=((c=(l=p.choices[0])==null?void 0:l.delta)==null?void 0:c.content)||"";d+=f,i(f)}return d}catch(u){throw console.error("API Error:",u),new Error(u.message||"API request failed")}};return a.watch(()=>t,r=>{n()},{deep:!0}),a.onMounted(()=>{n()}),{md:yC,aiOption:t,createStreamingChatCompletion:o}}function Rm(){const t=a.ref(),e=a.ref(!1);function n(s){t.value=s,s.editor.on("selectionUpdate",i)}function o(){var s;(s=t.value)==null||s.editor.off("selectionUpdate",i)}const r=a.computed(()=>{var c;const s=(c=t.value)==null?void 0:c.getPos();if(typeof s!="number")return null;const l=t.value.editor.state.doc.nodeAt(s);return l?{start:s+1,end:s+l.nodeSize-1}:null}),i=()=>{if(!t.value)return;const{editor:s}=t.value;if(!s.isFocused){e.value=!1;return}const{selection:l}=s.state;l&&(e.value=(l==null?void 0:l.$from.pos)>=r.value.start&&(l==null?void 0:l.$to.pos)<=r.value.end)};return{isFocused:e,bind:n,unbind:o,checkFocus:i}}const cp={isoName:"en-us",name:"English",nativeName:"English (US)",diagram:{name:"Text Diagram",flow:"Flow Diagram",sequence:"Sequence Diagram",class:"Class Diagram",state:"State Diagram",gantt:"Gantt Diagram",tips:"Generation of diagram and chart from text in a similar manner as markdown"},editor:{add:"Add",addMore:"Add More",url:"URL",bold:"Bold",italic:"Italic",strikethrough:"Strikethrough",underline:"Underline",textFormat:"More text format",list:"List",unorderedList:"Unordered List",orderedList:"Ordered List",todoList:"Todo List",subscript:"Subscript",superscript:"Superscript",hyperlink:"Hyperlink",toggleFullscreen:"Toggle Fullscreen",quote:"Quote",left:"Left align",center:"Center align",right:"Right align",justify:"Justify align",print:"Print",outdent:"Decrease indentation",indent:"Increase indentation",indentDropdown:"Indent",removeFormat:"Remove formatting",formatting:"Formatting",fontFamily:"Font Family",defaultFont:"Default Font",fontSize:"Font Size",align:"Align",hr:"Insert Horizontal Rule",undo:"Undo",redo:"Redo",heading:"Heading & Paragraph",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",heading5:"Heading 5",headings:"Headings",paragraph:"Paragraph",code:"Code",codeBlock:"Code Block",size1:"Very small",size2:"A bit small",size3:"Normal",size4:"Medium-large",size5:"Big",size6:"Very big",size7:"Maximum",viewSource:"View Source",textColor:"Text Color",highlightColor:"Highlight Color",default:"Default",lineHeight:"Line Height",blockquote:"Blockquote",table:"Table",photo:"Insert Photo",video:"Insert Video",formula:"Formula",inlineFormula:"Inline",blockFormula:"Block",thirdPartyService:"Third party services",horizontal:"Horizontal Rule",callout:"Callout",emoji:"Emoji",defaultColor:"Default Color",noColor:"No Color",delete:"Delete",duplicate:"Duplicate",aiBlock:"AI Block"},label:{ai:"AI",cancel:"Cancel",color:"Color",edit:"Edit",write:"Write",link:"Link",linkAddress:"Link Address",ok:"Ok",preview:"Preview",template:"Template",example:"Example",submit:"Submit",settings:"Settings",remove:"Remove",replace:"Replace",help:"Help",back:"Back",styles:"Styles",basic:"Basic",basicBlocks:"Basic Blocks",common:"Common",media:"Media",image:"Image",video:"Video",model:"Model",modelViewer:"Model Viewer",more:"More",toc:"Table of Contents",untitled:"Untitled",typeForCommands:"Type '/' for commands",empty:"Empty",emptyTips:"Press Enter to continue with an empty note, or select following",copy:"Copy",cut:"Cut",search:"Search",think:"Think",suggested:"Suggested",noResults:"No results",generate:"Generate",generatedBy:"Generated by",update:"Update"},table:{cellBackground:"Cell Background",insert:"Insert Table",remove:"Remove Table",addColumn:"Add Column",selectColumn:"Select Column",removeColumn:"Remove Column",addRow:"Add Row",selectRow:"Select Row",removeRow:"Remove Row",merge:"Merge Cells",split:"Split Cells"},image:{preferences:"Image Preferences",ratio:"Ratio",size:"Size",width:"Width",height:"Height",src:"Image Source",caption:"Caption",link:"Link",lockAspectRatio:"Lock aspect ratio",unlockAspectRatio:"Unlock aspect ratio",original:"Original",small:"Small",medium:"Medium",large:"Large"},embed:{video:"Video",map:"Map",design:"Design",develop:"Develop",data:"Data",others:"Others",youtube:"Youtube",vimeo:"Vimeo",netflix:"Netflix",youku:"Youku",iqiyi:"iQiyi",bilibili:"Bilibili",qqvideo:"QQ Video",google_map:"Google Map",amap:"AMap",baidu_map:"Baidu Map",modao:"Modao",lanhu:"Lanhu",figma:"Figma",canva:"Canva",processon:"ProcessOn",codepen:"CodePen",google_forms:"Google Forms",jinshuju:"Jinshuju",iframe:"IFrame",linkTips:"Link or embed code",linkWarning:"Invalid link"},link:{back:"Back to main menu",edit:"Edit Link",off:"Disable Link",open:"Open Link",open_in_new_tab:"Open in new tab"},ai:{askAi:"Ask AI",tellAi:"Tell the AI what to write",improve_writing:"Improve writing",fix_spelling_grammar:"Fix spelling & grammar",enrich_with_emoji:"Enrich with Emoji",translate:"Translate to",make_longer:"Make longer",make_shorter:"Make shorter",continuation:"Continuation",change_tone:"Change tone",write:"Write anything",explain:"Explain",summarize:"Summarize",error:"Please provide correct AI configuration",tone:{formal:"Formal",casual:"Casual",friendly:"Friendly",enthusiastic:"Enthusiastic",authoritative:"Authoritative",humorous:"Humorous",inspirational:"Inspirational",empathetic:"Empathetic",mysterious:"Mysterious"}},language:{chinese_simplified:"Simplified Chinese",chinese_traditional:"Traditional Chinese",german:"German",french:"French",japanese:"Japanese",korean:"Korean"}},vC={isoName:"pl",nativeName:"Polski",diagram:{name:"Schemat tekstowy",flow:"Schemat przepływu",sequence:"Schemat sekwencji",class:"Schemat klas",state:"Diagram stanu",gantt:"Diagram Gantta",tips:"Generowanie diagramu i wykresu z tekstu w podobny sposób jak markdown"},editor:{add:"Dodaj",addMore:"Dodaj więcej",url:"URL",bold:"Pogrubienie",italic:"Kursywa",strikethrough:"Przekreślenie",underline:"Podkreślenie",textFormat:"More text format",unorderedList:"Lista wypunktowana",orderedList:"Lista numerowana",list:"List",todoList:"Lista rzeczy do zrobienia",subscript:"Indeks dolny",superscript:"Indeks górny",hyperlink:"Hiperłącze",toggleFullscreen:"Przełącz na tryb pełnoekranowy",quote:"Zacytuj",left:"Wyrównaj do lewej",center:"Wyrównaj do środka",right:"Wyrównaj do prawej",justify:"Wyjustuj",print:"Drukuj",outdent:"Zmniejsz wcięcie",indent:"Zwiększ wcięcie",indentDropdown:"Wcięcie",removeFormat:"Usuń formatowanie",formatting:"Formatowanie",fontFamily:"Nazwa czcionki",defaultFont:"Domyślna czcionka",fontSize:"Rozmiar czcionki",align:"Wyrównanie",hr:"Wstaw poziomą linię",undo:"Cofnij",redo:"Przywróć",heading:"Heading & Paragraph",heading1:"Nagłówek 1",heading2:"Nagłówek 2",heading3:"Nagłówek 3",heading4:"Nagłówek 4",heading5:"Nagłówek 5",headings:"Nagłówki",paragraph:"Paragraf",code:"Kod",codeBlock:"Blok kodu",size1:"Bardzo mała",size2:"Mała",size3:"Normalna",size4:"Średnio-duża",size5:"Duża",size6:"Bardzo duża",size7:"Maksymalna",viewSource:"Pokaż źródło",textColor:"Kolor czcionki",highlightColor:"Kolor wyróżnienia",default:"Dymyślny",lineHeight:"Wysokość linii",blockquote:"Cytat",table:"Tabela",photo:"Wstaw obraz",video:"Insert Video",formula:"Formuła",inlineFormula:"Formuła w treści",blockFormula:"Blokowa formuła",thirdPartyService:"Third party services",horizontal:"Horizontal Rule",callout:"Callout",emoji:"Emoji",defaultColor:"Default Color",noColor:"No Color",delete:"Delete",duplicate:"Duplicate"},label:{ai:"AI",cancel:"Anuluj",edit:"Edycja",link:"Łącze",linkAddress:"Adres łącza",ok:"Ok",preview:"Podgląd",template:"Szablon",example:"Example",submit:"Submit",settings:"Settings",remove:"Remove",help:"Help",back:"Back",styles:"Styles",basic:"Basic",basicBlocks:"Basic Blocks",common:"Common",media:"Media",image:"Image",video:"Video",model:"Model",modelViewer:"Model Viewer",toc:"Table of Contents",untitled:"Untitled",typeForCommands:"Type '/' for commands",empty:"Empty",emptyTips:"Press Enter to continue with an empty note, or select following",copy:"Copy",cut:"Cut",search:"Search"},table:{cellBackground:"Cell Background",insert:"Insert Table",remove:"Remove Table",addColumn:"Add Column",removeColumn:"Remove Column",addRow:"Add Row",removeRow:"Remove Row",merge:"Merge/Unmerge Cells"},image:{preferences:"Preferencje obrazu",ratio:"Ratio",size:"Rozmiar",width:"Szerokość",height:"Wysokość",src:"Źródło obrazu",caption:"Nagłówek",link:"Łącze",lockAspectRatio:"Lock aspect ratio",unlockAspectRatio:"Unlock aspect ratio",original:"Original",small:"Small",medium:"Medium",large:"Large"},embed:{video:"Video",map:"Map",design:"Design",develop:"Develop",data:"Data",others:"Others",youtube:"Youtube",vimeo:"Vimeo",netflix:"Netflix",youku:"Youku",iqiyi:"iQiyi",bilibili:"Bilibili",qqvideo:"QQ Video",google_map:"Google Map",amap:"AMap",baidu_map:"Baidu Map",modao:"Modao",lanhu:"Lanhu",figma:"Figma",canva:"Canva",processon:"ProcessOn",codepen:"CodePen",google_forms:"Google Forms",jinshuju:"Jinshuju",iframe:"IFrame",linkTips:"Link or embed code",linkWarning:"Invalid link"},link:{back:"Back to main menu",edit:"Edit Link",off:"Disable Link",open:"Open Link",open_in_new_tab:"Open in new tab"}},kC={isoName:"pt-br",nativeName:"Português (BR)",diagram:{name:"Diagrama de Texto",flow:"Diagrama de Fluxo",sequence:"Diagrama de sequência",class:"Diagrama de Classe",state:"Diagrama de Estado",gantt:"Diagrama de Gantt",tips:"Geração de diagrama ou gráfico a partir de texto semelhante a markdown"},editor:{add:"Adicionar",addMore:"Adicione Mais",url:"URL",bold:"Negrito",italic:"Itálico",strikethrough:"Tachar",underline:"Sublinhado",textFormat:"Mais formatos de textos",list:"Lista",unorderedList:"Lista com Marcadores",orderedList:"Lista Numerada",todoList:"Lista de afazer",subscript:"Subscrito",superscript:"Sobrescrito",hyperlink:"Hyperlink",toggleFullscreen:"Alternar tela-cheia",quote:"Citação",left:"Alinhar à esquerda",center:"Alinhar ao centro",right:"Alinhar à direita",justify:"Justificar",print:"Imprimir",outdent:"Diminuir recuo",indent:"Aumentar recuo",indentDropdown:"Recuo",removeFormat:"Limpar formatação",formatting:"Formatação",fontFamily:"Fonte",defaultFont:"Fonte Padrão",fontSize:"Tamanho da fontee",align:"Alinhamento",hr:"Linha Horizontal",undo:"Desfazer",redo:"Refazer",heading:"Heading & Paragraph",heading1:"Título 1",heading2:"Título 2",heading3:"Título 3",heading4:"Título 4",heading5:"Título 5",headings:"Estilos de Parágrafo",paragraph:"Parágrafo",code:"Código",codeBlock:"Bloco de Código",size1:"Muito Pequeno",size2:"Pequeno",size3:"Normal",size4:"Médio",size5:"Grande",size6:"Enorme",size7:"Máximo",viewSource:"Código Fonte",textColor:"Cor do texto",highlightColor:"Cor do fundo",default:"Padrão",lineHeight:"Espaço entre linhas",blockquote:"Bloco de citação",table:"Tabela",photo:"Inserir Foto",video:"Insert Video",formula:"Fórmula",inlineFormula:"Linha",blockFormula:"Bloco",thirdPartyService:"Serviços de terceiros",horizontal:"Horizontal Rule",callout:"Callout",emoji:"Emoji",defaultColor:"Default Color",noColor:"No Color",delete:"Delete",duplicate:"Duplicate"},label:{ai:"AI",cancel:"Cancelar",edit:"Editar",link:"Link",linkAddress:"Endereço do Link",ok:"Ok",preview:"Pré Visualização",template:"Modelo",example:"Exemplo",submit:"Enviar",settings:"Configurações",remove:"Excluir",help:"Ajuda",back:"Voltar",styles:"Styles",basic:"Basic",basicBlocks:"Basic Blocks",common:"Common",media:"Media",image:"Image",video:"Video",model:"Model",modelViewer:"Model Viewer",toc:"Table of Contents",untitled:"Untitled",typeForCommands:"Type '/' for commands",empty:"Empty",emptyTips:"Press Enter to continue with an empty note, or select following",copy:"Copy",cut:"Cut",search:"Search"},table:{cellBackground:"Cell Background",insert:"Insert Table",remove:"Remove Table",addColumn:"Add Column",removeColumn:"Remove Column",addRow:"Add Row",removeRow:"Remove Row",merge:"Merge/Unmerge Cells"},image:{preferences:"Preferências da Imagem",ratio:"Ratio",size:"Tamanho",width:"Largura",height:"Altura",src:"Origem da imagem",caption:"Legenda",link:"Link",lockAspectRatio:"Bloquear proporção",unlockAspectRatio:"Desbloquear proporção",original:"Original",small:"Small",medium:"Medium",large:"Large"},embed:{video:"Vídeo",map:"Mapa",design:"Design",develop:"Desenvolvimento",data:"Dados",others:"Outros",youtube:"Youtube",vimeo:"Vimeo",netflix:"Netflix",youku:"Youku",iqiyi:"iQiyi",bilibili:"Bilibili",qqvideo:"QQ Video",google_map:"Google Map",amap:"AMap",baidu_map:"Baidu Map",modao:"Modao",lanhu:"Lanhu",figma:"Figma",canva:"Canva",processon:"ProcessOn",codepen:"CodePen",google_forms:"Google Forms",jinshuju:"Jinshuju",iframe:"IFrame",linkTips:"Link or embed code",linkWarning:"Invalid link"},link:{back:"Back to main menu",edit:"Edit Link",off:"Disable Link",open:"Open Link",open_in_new_tab:"Open in new tab"}},up={isoName:"zh-hans",name:"Simplified Chinese",nativeName:"简体中文",diagram:{name:"文本绘图",flow:"流程图",sequence:"时序图",class:"类图",state:"状态图",gantt:"甘特图",tips:"使用Markdown风格文本生成流程图、顺序图、类图、状态图和甘特图"},editor:{add:"添加",addMore:"添加更多",url:"URL",bold:"粗体",italic:"斜体",strikethrough:"删除线",underline:"下划线",textFormat:"更多格式",list:"列表",unorderedList:"无序列表",orderedList:"有序列表",todoList:"任务列表",subscript:"下标",superscript:"上标",hyperlink:"超链接",toggleFullscreen:"全屏切换",quote:"引号",left:"左对齐",center:"居中对齐",right:"右对齐",justify:"两端对齐",print:"打印",outdent:"减少缩进",indent:"增加缩进",indentDropdown:"缩进",removeFormat:"清除格式",formatting:"格式化",fontFamily:"字体",defaultFont:"默认字体",fontSize:"字体大小",align:"对齐方式",hr:"插入分割线",undo:"撤消",redo:"重做",heading:"标题与段落",heading1:"标题一",heading2:"标题二",heading3:"标题三",heading4:"标题四",heading5:"标题五",headings:"标题",paragraph:"正文",code:"代码",codeBlock:"代码块",size1:"非常小",size2:"比较小",size3:"正常",size4:"中等偏大",size5:"大",size6:"非常大",size7:"超级大",viewSource:"查看资料",textColor:"文字颜色",highlightColor:"背景颜色",default:"默认",lineHeight:"行高",blockquote:"引用",table:"表格",photo:"图片",video:"视频",formula:"数学公式",inlineFormula:"行内公式",blockFormula:"块级公式",thirdPartyService:"第三方服务",horizontal:"水平线",callout:"高亮块",emoji:"表情",defaultColor:"默认颜色",noColor:"无色",delete:"删除",duplicate:"创建副本",aiBlock:"AI块"},label:{ai:"AI",cancel:"取消",color:"颜色",edit:"编辑",link:"链接",linkAddress:"链接地址",ok:"确定",preview:"预览",template:"模板",example:"示例",submit:"确定",settings:"设置",remove:"删除",replace:"替换",help:"帮助",back:"返回",styles:"样式",basic:"基础",basicBlocks:"基础块",common:"常用",media:"多媒体",image:"图片",video:"视频",model:"模型",modelViewer:"模型",more:"更多",toc:"目录",untitled:"未命名",typeForCommands:"输入 '/' 显示命令",empty:"空白页面",emptyTips:"按回车开始编辑,或从下方选择",copy:"复制",cut:"剪切",search:"搜索",think:"思考",noResults:"没有结果",generate:"生成",generatedBy:"生成自",update:"更新"},table:{cellBackground:"单元格背景色",insert:"插入表格",remove:"删除表格",addColumn:"添加列",selectColumn:"选择列",removeColumn:"删除列",addRow:"添加行",selectRow:"选择行",removeRow:"删除行",merge:"合并单元格",split:"拆分单元格"},image:{preferences:"图片设置",ratio:"比例",size:"尺寸",width:"宽度",height:"高度",src:"图片地址",caption:"图片说明",link:"链接",lockAspectRatio:"锁定长宽比",unlockAspectRatio:"解锁长宽比",original:"原始",small:"小",medium:"中",large:"大"},embed:{video:"视频",map:"地图",design:"设计",develop:"开发",data:"数据",others:"其它",youtube:"Youtube",vimeo:"Vimeo",netflix:"Netflix",youku:"优酷",iqiyi:"爱奇艺",bilibili:"Bilibili",qqvideo:"腾讯视频",google_map:"谷歌地图",amap:"高德地图",baidu_map:"百度",modao:"墨刀",lanhu:"蓝湖",figma:"Figma",canva:"Canva",processon:"ProcessOn",codepen:"CodePen",google_forms:"Google Forms",jinshuju:"金数据",iframe:"IFrame",linkTips:"链接或代码",linkWarning:"无效的链接"},link:{back:"返回主菜单",edit:"编辑链接",off:"取消链接",open:"打开链接",open_in_new_tab:"在新标签页打开"},ai:{askAi:"探索AI",tellAi:"告诉AI需要写什么",improve_writing:"文本润色",fix_spelling_grammar:"修正拼写和语法",enrich_with_emoji:"丰富表情符号",translate:"翻译成",make_longer:"扩写",make_shorter:"简化",continuation:"续写",change_tone:"调整语气",write:"Write anything",explain:"解释",summarize:"总结",error:"请提供正确的 AI 配置信息",tone:{formal:"正式",casual:"休闲",friendly:"友好",enthusiastic:"热情",authoritative:"权威",humorous:"幽默",inspirational:"鼓舞人心",empathetic:"同理心",mysterious:"神秘"}},language:{chinese_simplified:"简体中文",chinese_traditional:"繁体中文",german:"德语",french:"法语",japanese:"日语",korean:"韩语"}},wC={isoName:"zh-hant",name:"Traditional Chinese",nativeName:"繁體中文",diagram:{name:"文本繪圖",flow:"流程圖",sequence:"時序圖",class:"類圖",state:"狀態圖",gantt:"甘特圖",tips:"使用Markdown風格文本生成流程圖、順序圖、類圖、狀態圖和甘特圖"},editor:{add:"添加",addMore:"添加更多",url:"URL",bold:"粗體",italic:"斜體",strikethrough:"刪除線",underline:"下劃線",textFormat:"更多格式",list:"列表",unorderedList:"無序列表",orderedList:"有序列表",todoList:"任務列表",subscript:"下標",superscript:"上標",hyperlink:"超鏈接",toggleFullscreen:"全屏切換",quote:"引號",left:"左對齊",center:"居中對齊",right:"右對齊",justify:"兩端對齊",print:"打印",outdent:"減少縮進",indent:"增加縮進",indentDropdown:"縮進",removeFormat:"清除格式",formatting:"格式化",fontFamily:"字體",defaultFont:"默認字體",fontSize:"字體大小",align:"對齊方式",hr:"插入分割線",undo:"撤消",redo:"重做",heading:"標題與段落",heading1:"標題一",heading2:"標題二",heading3:"標題三",heading4:"標題四",heading5:"標題五",headings:"標題",paragraph:"正文",code:"代碼",codeBlock:"代碼塊",size1:"非常小",size2:"比較小",size3:"正常",size4:"中等偏大",size5:"大",size6:"非常大",size7:"超級大",viewSource:"查看資料",textColor:"文字顏色",highlightColor:"背景顏色",default:"默認",lineHeight:"行高",blockquote:"引用",table:"表格",photo:"圖片",video:"視頻",formula:"數學公式",inlineFormula:"行內公式",blockFormula:"塊級公式",thirdPartyService:"第三方服務",horizontal:"水平線",callout:"高亮塊",emoji:"表情",defaultColor:"默認顏色",noColor:"無色",delete:"刪除",duplicate:"創建副本"},label:{ai:"AI",cancel:"取消",edit:"編輯",link:"鏈接",linkAddress:"鏈接地址",ok:"確定",preview:"預覽",template:"模板",example:"示例",submit:"確定",settings:"設置",remove:"刪除",help:"幫助",back:"返回",styles:"樣式",basic:"基础",basicBlocks:"基础块",common:"常用",media:"多媒體",image:"圖片",video:"視頻",model:"模型",modelViewer:"模型",toc:"目錄",untitled:"未命名",typeForCommands:"輸入 '/' 顯示命令",empty:"空白页面",emptyTips:"按回车开始编辑,或从下方选择",copy:"複製",cut:"剪切",search:"搜索"},table:{cellBackground:"單元格背景色",insert:"插入表格",remove:"刪除表格",addColumn:"添加列",removeColumn:"刪除列",addRow:"添加行",removeRow:"刪除行",merge:"合併/拆分 單元格"},image:{preferences:"圖片設置",ratio:"比例",size:"尺寸",width:"寬度",height:"高度",src:"圖片地址",caption:"圖片說明",link:"鏈接",lockAspectRatio:"鎖定長寬比",unlockAspectRatio:"解鎖長寬比",original:"原始",small:"小",medium:"中",large:"大"},embed:{video:"視頻",map:"地圖",design:"設計",develop:"開發",data:"數據",others:"其它",youtube:"Youtube",vimeo:"Vimeo",netflix:"Netflix",youku:"優酷",iqiyi:"愛奇藝",bilibili:"Bilibili",qqvideo:"騰訊視頻",google_map:"谷歌地圖",amap:"高德地圖",baidu_map:"百度",modao:"墨刀",lanhu:"藍湖",figma:"Figma",canva:"Canva",processon:"ProcessOn",codepen:"CodePen",google_forms:"Google Forms",jinshuju:"金數據",iframe:"IFrame",linkTips:"鏈接或代碼",linkWarning:"無效的鏈接"},link:{back:"返回主菜單",edit:"編輯鏈接",off:"取消鏈接",open:"打開鏈接",open_in_new_tab:"在新標籤頁打開"}},Bm={en:cp,"en-us":cp,pl:vC,"pt-br":kC,zh:up,"zh-hans":up,"zh-hant":wC},EC="en",_C=Bm[EC],CC=t=>Bm[t]||_C;function ge(){const t=a.inject("locale",{value:"en"}),e=a.computed(()=>CC(t.value)),n=a.computed(()=>{var r;return((r=e.value)==null?void 0:r.name)||"English"});function o(r){return r.split(".").reduce((i,s)=>{if(i)return i[s]},e.value)}return{languageName:n,locale:t,message:e,tr:o}}function xr(){const t=a.inject("darkMode",{value:!1}),e=a.computed(()=>t.value?"dark":"light");return{darkMode:t,theme:e}}function Te(){const t=a.inject("isEditable",{value:!0});function e(o,r,i={}){if(!o.isEditable)return;const s=o==null?void 0:o.chain().focus(),l=o==null?void 0:o.commands;n(l,s,r,i)}function n(o,r,i,s={}){switch(console.log("command",i,s),i){case"aiBlock":r.toggleAiBlock().run();break;case"backColor":s.color?o.setHighlight({color:s.color}):o.unsetHighlight();break;case"blockquote":r.toggleBlockquote().run();break;case"bold":r.toggleBold().run();break;case"bulletList":r.toggleBulletList().run();break;case"callout":r.toggleCallout().run();break;case"clearFormat":r.unsetAllMarks().run();break;case"code":r.toggleCode().run();break;case"codeBlock":o.toggleCodeBlock({language:"bash"});break;case"content":o.insertContent(s.content);break;case"fontFamily":o.setFontFamily(s.fontFamily);break;case"foreColor":o.setColor(s.color);break;case"heading":r.toggleHeading(s).run();break;case"horizontalRule":r.setHorizontalRule().run();break;case"image":r.setImage({src:"init"}).run();break;case"imageUpdate":r.setImage(s).run();break;case"italic":r.toggleItalic().run();break;case"linkSet":r.extendMarkRange("link").setLink(s).run();break;case"linkUnset":r.extendMarkRange("link").unsetLink().run();break;case"orderedList":r.toggleOrderedList().run();break;case"paragraph":r.setParagraph().run();break;case"strike":r.toggleStrike().run();break;case"table":r.insertTable({rows:3,cols:3,withHeaderRow:!0}).run();break;case"tableAddColumn":r.addColumnAfter().run();break;case"tableAddRow":r.addRowAfter().run();break;case"tableCellAttribute":r.setCellAttribute(s.name,s.value).run();break;case"tableDeleteColumn":r.deleteColumn().run();break;case"tableDeleteRow":r.deleteRow().run();break;case"tableDelete":r.deleteTable().run();break;case"tableInsert":r.insertTable(s).run();break;case"tableMergeCells":r.mergeCells().run();break;case"tableSelectColumn":r.selectColumn(s.pos).run();break;case"tableSelectRow":r.selectRow(s.pos).run();break;case"tableSplitCell":r.splitCell().run();break;case"taskList":o.toggleTaskList();break;case"textAlign":r.setTextAlign(s.textAlign).run();break;case"underline":r.toggleUnderline().run();break;case"video":r.setVideo({src:"init"}).run()}}return{isEditable:t,run:e,onCommand:n}}const Qn=a.defineComponent({__name:"OTooltip",props:{placement:{type:String,default:"top"},trigger:{type:String,default:"mouseenter focus"},delay:{type:Number,default:100},duration:{type:Number,default:100},offset:{type:Object,default:function(){return[0,10]}}},setup(t){const e=t,{theme:n}=xr(),o=a.ref(),r=a.ref(),i=a.ref();function s(){i.value=dn(o.value,{appendTo:()=>document.body,animation:"perspective",content:r.value,duration:e.duration,delay:e.delay,interactive:!0,offset:e.offset,placement:e.placement,trigger:e.trigger})}function l(){i.value.setProps({theme:n.value})}return a.watch(n,c=>{l()}),a.onMounted(()=>{s()}),a.onUnmounted(()=>{i.value&&i.value.destroy()}),(c,u)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"triggerRef",ref:o,"data-tippy-role":"tooltip"},[a.renderSlot(c.$slots,"trigger"),a.createElementVNode("div",{ref_key:"contentRef",ref:r,class:"tooltip-content"},[a.renderSlot(c.$slots,"default")],512)],512))}}),Le=a.defineComponent({__name:"OMenubarBtn",props:{icon:{type:String,default:""},color:{type:String,default:""},background:{type:String,default:""},tooltip:{type:String,default:""},placement:{type:String,default:"top"},contentClass:{type:[String,Object],default:""},contentStyle:{type:[String,Object],default:""},iconClass:{type:[String,Object],default:""}},emits:["click"],setup(t,{emit:e}){const n=e;return(o,r)=>(a.openBlock(),a.createBlock(Qn,{class:"o-tooltip",placement:t.placement},{trigger:a.withCtx(()=>[a.createElementVNode("button",{class:a.normalizeClass(["o-menubar-btn o-command-btn o-btn",t.contentClass]),style:a.normalizeStyle(t.contentStyle),onClick:r[0]||(r[0]=i=>n("click",i))},[a.createVNode(re,{name:t.icon,color:t.color,class:a.normalizeClass(t.iconClass)},null,8,["name","color","class"]),a.renderSlot(o.$slots,"default")],6)]),default:a.withCtx(()=>[a.createTextVNode(" "+a.toDisplayString(t.tooltip),1)]),_:3},8,["placement"]))}}),SC=a.defineComponent({__name:"OSimpleCommandBtn",props:{name:{type:String,default:""},editor:{type:Object}},setup(t){const e=t,{run:n}=Te(),{tr:o}=ge(),r=a.computed(()=>({aiViewer:{icon:"auto_awesome",tooltip:o("label.ai")},blockquote:{icon:"format_quote_open",tooltip:o("editor.blockquote")},bold:{icon:"format_bold",tooltip:o("editor.bold")},callout:{icon:"card_text",tooltip:o("editor.callout")},clearFormat:{icon:"format_clear",tooltip:o("editor.removeFormat")},code:{icon:"code",tooltip:o("editor.code")},codeBlock:{icon:"code_braces",tooltip:o("editor.codeBlock")},columns:{icon:"splitscreen_vertical_add",tooltip:"Column",rotate:!0},horizontalRule:{icon:"horizontal_rule",tooltip:o("editor.hr")},italic:{icon:"format_italic",tooltip:o("editor.italic")},image:{icon:"image",tooltip:o("editor.photo")},linkUnset:{icon:"link_off",tooltip:o("link.off")},modelViewer:{icon:"3d_rotation",tooltip:o("label.modelViewer")},strike:{icon:"format_strikethrough",tooltip:o("editor.strikethrough")},underline:{icon:"format_underlined",tooltip:o("editor.underline")},video:{icon:"videocam",tooltip:o("editor.video")},aiBlock:{icon:"auto_awesome",tooltip:o("editor.aiBlock")}})),i=a.computed(()=>r.value[e.name]||{icon:"",isActive:!1,command:()=>{}});function s(){n(e.editor,e.name)}return(l,c)=>{var u;return a.openBlock(),a.createBlock(Le,{class:"o-simple-command-btn",icon:i.value.icon,tooltip:i.value.tooltip,"content-class":{"is-active":(u=t.editor)==null?void 0:u.isActive(t.name),"rotate-90":i.value.rotate},onClick:s},null,8,["icon","tooltip","content-class"])}}}),xC={class:"o-block-placeholder"},NC={class:"icon"},TC={class:"placeholder"},Jc=a.defineComponent({__name:"OBlockPlaceholder",props:{icon:{type:String,default:"image"},placeholder:{type:String,default:""}},setup(t){return(e,n)=>(a.openBlock(),a.createElementBlock("section",xC,[a.createElementVNode("div",NC,[a.createVNode(a.unref(re),{name:t.icon},null,8,["name"])]),a.createElementVNode("div",TC,a.toDisplayString(t.placeholder),1)]))}}),OC={class:"group o-tips"},MC={key:1,class:"item"},Ea=a.defineComponent({__name:"OBlockList",props:{items:{type:Array,required:!0},useKeyboard:{type:Boolean,required:!1}},emits:["select"],setup(t,{emit:e}){const n=t,o=e,{tr:r}=ge(),i=a.ref([]),s=(h,m)=>{h&&(i.value[m]=h)},l=a.ref(0);function c(h,m,g){o("select",h,g),i.value[m]&&i.value[m].setShow(!1)}function u(){l.value=(l.value+n.items.length-1)%n.items.length}function d(){l.value=(l.value+1)%n.items.length}function p(){c(n.items[l.value],l.value)}function f(h){switch(h.key){case"ArrowUp":h.preventDefault(),u();break;case"ArrowDown":h.preventDefault(),d();break;case"Enter":h.preventDefault(),p();break}}return a.watch(()=>n.useKeyboard,h=>{h?window.addEventListener("keydown",f):window.removeEventListener("keydown",f)}),a.onMounted(()=>{n.useKeyboard&&window.addEventListener("keydown",f)}),a.onBeforeUnmount(()=>{n.useKeyboard&&window.removeEventListener("keydown",f)}),(h,m)=>(a.openBlock(),a.createBlock(a.unref(Qt),{class:"o-block-list",hoverable:"",clickable:""},{default:a.withCtx(()=>[t.items.length?(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:0},a.renderList(t.items,(g,b)=>{var y;return a.openBlock(),a.createElementBlock(a.Fragment,{key:b},[g.group?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[b>0?(a.openBlock(),a.createBlock(a.unref(Lt),{key:0})):a.createCommentVNode("",!0),a.createElementVNode("div",OC,a.toDisplayString(a.unref(r)(g.group)),1)],64)):a.createCommentVNode("",!0),(y=g.children)!=null&&y.length?(a.openBlock(),a.createBlock(a.unref(Pe),{key:1,ref_for:!0,ref:k=>s(k,b),placement:"right-start",offset:[-10,16]},{trigger:a.withCtx(()=>[a.createVNode(a.unref(jl),{item:g,class:a.normalizeClass(["item",{"is-active":b===l.value}]),clickable:""},null,8,["item","class"])]),default:a.withCtx(()=>[a.createVNode(a.unref(Ea),{items:g.children,onSelect:k=>c(g,b,k)},null,8,["items","onSelect"])]),_:2},1536)):(a.openBlock(),a.createBlock(a.unref(jl),{key:2,item:g,class:a.normalizeClass(["item",{"is-active":b===l.value}]),clickable:"",onClick:k=>c(g,b)},null,8,["item","class","onClick"]))],64)}),128)):(a.openBlock(),a.createElementBlock("div",MC,a.toDisplayString(a.unref(r)("label.noResults")),1))]),_:1}))}}),AC={key:0,class:"o-tips"},jl=a.defineComponent({__name:"OBlockListItem",props:{item:{type:Object,required:!0}},emits:["select"],setup(t,{emit:e}){const{tr:n}=ge();return(o,r)=>(a.openBlock(),a.createBlock(a.unref(Ut),{class:"o-block-list-item",clickable:""},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{name:t.item.icon,color:t.item.color},null,8,["name","color"])]),suffix:a.withCtx(()=>{var i;return[t.item.tips?(a.openBlock(),a.createElementBlock("span",AC,a.toDisplayString(t.item.tips),1)):a.createCommentVNode("",!0),(i=t.item.children)!=null&&i.length?(a.openBlock(),a.createBlock(a.unref(re),{key:1,name:"navigate_next",class:"o-tips"})):a.createCommentVNode("",!0)]}),default:a.withCtx(()=>[a.createTextVNode(" "+a.toDisplayString(a.unref(n)(t.item.label)),1)]),_:1}))}}),RC={key:1,class:"group o-tips"},BC={class:"suffix o-tips"},DC={key:1,class:"item"},So=a.defineComponent({__name:"OBlockMenu",props:{editor:{type:Object,required:!0},node:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0},colorful:{type:Boolean,default:!1},showGroup:{type:Boolean,default:!1}},emits:["action"],setup(t,{emit:e}){const n=t,o=e,{tr:r}=ge(),i=a.ref([]),s=a.computed(()=>{var h;return(h=n.node)==null?void 0:h.type.name}),l=a.computed(()=>{const h=Wl.filter(g=>{var b;return((b=g.filter)==null?void 0:b.indexOf("common"))>=0}),m=Wl.filter(g=>{var b;return((b=g.filter)==null?void 0:b.indexOf(s.value))>=0});if(m.length>0){const g=m[0];g.group=`editor.${s.value}`}return[...h,...m]});function c(h){switch(h.component){case"OCalloutColorBoard":return Zc;default:return null}}function u(h){o("action",h),setTimeout(()=>{d(h)},0)}function d(h){switch(h.value){case"delete":n.deleteNode();break;case"duplicate":p();break}}function p(){var y,k,E;const h=n.node.nodeSize,m=n.getPos()+h,g=JSON.parse(JSON.stringify(n.node));(y=n.editor)==null||y.commands.insertContentAt(m,{type:"paragraph"}),(k=n.editor)==null||k.commands.insertContentAt(m,g);const b=m+h+1;(E=n.editor)==null||E.commands.focus(b)}function f(h,m){switch(console.log("select",h,m),m.name){case"backColor":n.updateAttributes({backColor:m.value});break;case"foreColor":n.updateAttributes({borderColor:m.value});break}}return(h,m)=>(a.openBlock(),a.createBlock(a.unref(Qt),{class:"o-block-menu",hoverable:"",clickable:""},{default:a.withCtx(()=>[l.value.length?(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:0},a.renderList(l.value,(g,b)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:b},[g.group?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[b>0?(a.openBlock(),a.createBlock(a.unref(Lt),{key:0})):a.createCommentVNode("",!0),t.showGroup?(a.openBlock(),a.createElementBlock("div",RC,a.toDisplayString(a.unref(r)(g.group)),1)):a.createCommentVNode("",!0)],64)):a.createCommentVNode("",!0),c(g)?(a.openBlock(),a.createBlock(a.unref(Pe),{key:1,ref_for:!0,ref:i.value[g.value],offset:[0,16],placement:"right"},{trigger:a.withCtx(()=>[a.createVNode(a.unref(Ut),{class:"item",clickable:""},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{name:g.icon,color:t.colorful?g.color:""},null,8,["name","color"])]),suffix:a.withCtx(()=>[a.createVNode(a.unref(re),{name:"navigate_next",class:"o-tips"})]),default:a.withCtx(()=>[a.createTextVNode(" "+a.toDisplayString(a.unref(r)(g.label)),1)]),_:2},1024)]),default:a.withCtx(()=>[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(c(g)),{onSelect:y=>f(g,y)},null,40,["onSelect"]))]),_:2},1536)):(a.openBlock(),a.createBlock(a.unref(Ut),{key:2,class:"item",clickable:"",onClick:y=>u(g)},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{name:g.icon,color:t.colorful?g.color:""},null,8,["name","color"])]),suffix:a.withCtx(()=>[a.createElementVNode("div",BC,a.toDisplayString(g.tips),1)]),default:a.withCtx(()=>[a.createTextVNode(" "+a.toDisplayString(a.unref(r)(g.label)),1)]),_:2},1032,["onClick"]))],64))),128)):(a.openBlock(),a.createElementBlock("div",DC,"No result"))]),_:1}))}}),Zn=a.defineComponent({__name:"OBlockPopover",props:{modelValue:{type:Boolean,default:!1},placement:{type:String,default:"bottom-center"},showArrow:{type:Boolean,default:!1},hideClickOutside:{type:Boolean,default:!1},tippyClass:{type:String,default:""},contentClass:{type:String,default:""},offset:{type:Object,default:function(){return[0,10]}}},emits:["update:modelValue","show","hide"],setup(t,{emit:e}){const n=t,o=e,r=a.ref();function i(l){o("update:modelValue",l)}function s(){console.log("click outside"),n.hideClickOutside&&o("update:modelValue",!1)}return a.watch(()=>n.modelValue,l=>{var c,u;l?(c=r.value)==null||c.setShow(!0):(u=r.value)==null||u.setShow(!1)}),a.onMounted(()=>{var l;n.modelValue&&((l=r.value)==null||l.setShow(!0))}),a.onUnmounted(()=>{var l;(l=r.value)==null||l.setShow(!1)}),(l,c)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,placement:t.placement,"tippy-class":t.tippyClass,"content-class":t.contentClass,trigger:"manual",arrow:t.showArrow,offset:t.offset,show:t.modelValue,"onUpdate:show":i,onClickoutside:s},{trigger:a.withCtx(()=>[a.renderSlot(l.$slots,"default")]),default:a.withCtx(()=>[a.renderSlot(l.$slots,"popover-content")]),_:3},8,["placement","tippy-class","content-class","arrow","offset","show"]))}}),IC={class:"o-block-toolbar editable-only"},LC={class:"button-group"},Xc=a.defineComponent({__name:"OBlockToolbar",props:{...ct,type:{type:String,default:"link"}},emits:["action"],setup(t,{emit:e}){const n=t,o=e,{locale:r,tr:i}=ge(),s=a.ref();function l(c){var u;o("action",c),(u=s.value)==null||u.setShow(!1)}return(c,u)=>(a.openBlock(),a.createElementBlock("div",IC,[a.createElementVNode("section",LC,[a.renderSlot(c.$slots,"default"),a.createVNode(a.unref(Pe),{ref_key:"popover",ref:s,placement:"bottom-end",size:"medium",trigger:"click","show-arrow":!1},{trigger:a.withCtx(()=>[a.createVNode(a.unref(lt),{icon:"more_horiz",tooltip:a.unref(i)("label.more")},null,8,["tooltip"])]),default:a.withCtx(()=>[a.createVNode(a.unref(So),a.mergeProps(n,{onAction:l}),null,16)]),_:1},512)])]))}}),PC={class:"o-callout-color-board"},$C={class:"fore-colors"},FC={class:"color-row"},VC={class:"color-row"},zC={class:"back-colors"},HC={class:"color-row"},UC={class:"color-row"},Zc=a.defineComponent({__name:"OCalloutColorBoard",props:{foreColor:{type:String,default:""},backColor:{type:String,default:""},activeColor:{type:String,default:""}},emits:["select"],setup(t,{emit:e}){const n=e;function o(s,l){n("select",{name:s,value:l.value})}const r=a.computed(()=>[{label:"Grey",value:"#e9e9e9"},{label:"Brown",value:"#ffd591"},{label:"Orange",value:"#ffbb96"},{label:"Yellow",value:"#fff08f"},{label:"Green",value:"#b7eb8f"},{label:"Blue",value:"#91d5ff"},{label:"Purple",value:"#d3adf7"},{label:"Pink",value:"#ffadd2"},{label:"Red",value:"#ffa39e"}]),i=a.computed(()=>[{label:"Grey",value:"#F5F5F5"},{label:"Brown",value:"#F4EEEE"},{label:"Orange",value:"#FAEBDD"},{label:"Yellow",value:"#FBF3DB"},{label:"Green",value:"#EDF3EC"},{label:"Blue",value:"#E7F3F8"},{label:"Purple",value:"#F6F3F9"},{label:"Pink",value:"#FAF1F5"},{label:"Red",value:"#FDEBEC"}]);return(s,l)=>(a.openBlock(),a.createElementBlock("section",PC,[a.createElementVNode("section",$C,[l[4]||(l[4]=a.createElementVNode("div",{class:"label o-tips"},"Border color",-1)),a.createElementVNode("div",FC,[a.createVNode(a.unref(Le),{icon:"slash_forward",tooltip:"No color","content-class":"border",onClick:l[0]||(l[0]=c=>o("foreColor",{value:""}))}),t.foreColor?(a.openBlock(),a.createBlock(a.unref(Le),{key:0,tooltip:"Last used","content-style":{borderColor:t.foreColor},onClick:l[1]||(l[1]=c=>o("foreColor",{value:t.foreColor}))},null,8,["content-style"])):a.createCommentVNode("",!0)]),a.createElementVNode("div",VC,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.value,(c,u)=>(a.openBlock(),a.createBlock(a.unref(Le),{key:`col-${u}`,tooltip:c.label,"content-style":{borderColor:c.value},onClick:d=>o("foreColor",c)},null,8,["tooltip","content-style","onClick"]))),128))])]),a.createElementVNode("section",zC,[l[5]||(l[5]=a.createElementVNode("div",{class:"label o-tips"},"Background",-1)),a.createElementVNode("div",HC,[a.createVNode(a.unref(Le),{icon:"slash_forward",tooltip:"Default Color","content-class":"border",onClick:l[2]||(l[2]=c=>o("backColor",{value:"#F5F5F5"}))}),t.backColor?(a.openBlock(),a.createBlock(a.unref(Le),{key:0,"content-style":{backgroundColor:t.backColor},tooltip:"Last used","content-class":"border",onClick:l[3]||(l[3]=c=>o("backColor",{value:t.backColor}))},null,8,["content-style"])):a.createCommentVNode("",!0)]),a.createElementVNode("div",UC,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(i.value,(c,u)=>(a.openBlock(),a.createBlock(a.unref(Le),{key:`col-${u}`,tooltip:c.label,"content-style":{backgroundColor:c.value},onClick:d=>o("backColor",c)},null,8,["tooltip","content-style","onClick"]))),128))])])]))}}),qC=a.defineComponent({__name:"OCalloutColorDropdown",props:{editor:{type:Object}},emits:["select"],setup(t,{emit:e}){const n=e,{tr:o}=ge(),{run:r}=Te(),i=a.ref(null),s=a.ref(""),l=a.ref("");function c(u,d){u==="foreColor"?(s.value=d,localStorage.setItem("yiitap.text-color.fore",d)):u==="backColor"&&(l.value=d,localStorage.setItem("yiitap.text-color.back",d)),n("select",u,d)}return a.onMounted(()=>{s.value=localStorage.getItem("yiitap.text-color.fore")||"",l.value=localStorage.getItem("yiitap.text-color.back")||""}),(u,d)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:i,placement:"bottom-center",trigger:"hover",arrow:""},{trigger:a.withCtx(()=>[a.createVNode(a.unref(lt),{icon:"palette",tooltip:a.unref(o)("editor.textColor")},{default:a.withCtx(()=>[a.createVNode(a.unref(re),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:a.withCtx(()=>{var p;return[a.createVNode(a.unref(Zc),{"fore-color":s.value,"back-color":l.value,"default-label":a.unref(o)("editor.defaultColor"),"active-color":(p=t.editor)==null?void 0:p.getAttributes("textStyle").color,onSelect:c},null,8,["fore-color","back-color","default-label","active-color"])]}),_:1},512))}}),xi=a.defineComponent({__name:"OContextMenu",props:{modelValue:{type:Boolean,default:!1},clientX:{type:Number,default:0},clientY:{type:Number,default:0},event:{type:Object,default:function(){return{}}}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,o=e,r=a.ref();a.computed(()=>{var l;return n.clientX||((l=n.event)==null?void 0:l.clientX)||0}),a.computed(()=>{var l;return n.clientY||((l=n.event)==null?void 0:l.clientY)||0});function i(l){o("update:modelValue",l)}function s(){o("update:modelValue",!1)}return a.watch(()=>n.modelValue,l=>{var c;l?setTimeout(()=>{var u;(u=r.value)==null||u.setShow(l)},0):(c=r.value)==null||c.setShow(l)}),(l,c)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,placement:"bottom-start",trigger:"manual",show:t.modelValue,"show-arrow":!1,event:t.event,"onUpdate:show":i,onClickoutside:s},{default:a.withCtx(()=>[a.renderSlot(l.$slots,"default")]),_:3},8,["show","event"]))}}),KC={class:"o-color-board"},WC={class:"cell-container"},jC={class:"label"},GC=["onClick"],_a=a.defineComponent({__name:"OColorBoard",props:{defaultColor:{type:String,default:""},defaultLabel:{type:String,default:""},activeColor:{type:String,default:""}},emits:["select"],setup(t,{emit:e}){const n=t,o=e;function r(c){o("select",c.hex)}function i(c){return n.activeColor===c}function s(c){return"abc"}const l=a.computed(()=>[[{label:"color",rgb:"rgb(0, 0, 0)",hex:"#000000"},{label:"color",rgb:"rgb(38, 38, 38)",hex:"#262626"},{label:"color",rgb:"rgb(89, 89, 89)",hex:"#595959"},{label:"color",rgb:"rgb(140, 140, 140)",hex:"#8c8c8c"},{label:"color",rgb:"rgb(191, 191, 191)",hex:"#bfbfbf"},{label:"color",rgb:"rgb(217, 217, 217)",hex:"#d9d9d9"},{label:"color",rgb:"rgb(233, 233, 233)",hex:"#e9e9e9"},{label:"color",rgb:"rgb(245, 245, 245)",hex:"#f5f5f5"},{label:"color",rgb:"rgb(250, 250, 250)",hex:"#fafafa",border:!0},{label:"color",rgb:"rgb(255, 255, 255)",hex:"#ffffff",border:!0}],[{label:"color",rgb:"rgb(245, 34, 45)",hex:"#f5222d"},{label:"color",rgb:"rgb(250, 84, 28)",hex:"#fa541c"},{label:"color",rgb:"rgb(250, 140, 22)",hex:"#fa8c16"},{label:"color",rgb:"rgb(250, 219, 20)",hex:"#fadb14"},{label:"color",rgb:"rgb(82, 196, 26)",hex:"#52c41a"},{label:"color",rgb:"rgb(19, 194, 194)",hex:"#13c2c2"},{label:"color",rgb:"rgb(24, 144, 255)",hex:"#1890ff"},{label:"color",rgb:"rgb(47, 84, 235)",hex:"#2f54eb"},{label:"color",rgb:"rgb(114, 46, 209)",hex:"#722ed1"},{label:"color",rgb:"rgb(235, 47, 150)",hex:"#eb2f96"}],[{label:"color",rgb:"rgb(255, 232, 230)",hex:"#ffe8e6"},{label:"color",rgb:"rgb(255, 236, 224)",hex:"#ffece0"},{label:"color",rgb:"rgb(255, 239, 209)",hex:"#ffefd1"},{label:"color",rgb:"rgb(255, 248, 189)",hex:"#fff8bd"},{label:"color",rgb:"rgb(228, 247, 210)",hex:"#e4f7d2"},{label:"color",rgb:"rgb(211, 245, 240)",hex:"#d3f5f0"},{label:"color",rgb:"rgb(212, 238, 252)",hex:"#d4eefc"},{label:"color",rgb:"rgb(222, 232, 252)",hex:"#dee8fc"},{label:"color",rgb:"rgb(239, 225, 250)",hex:"#efe1fa"},{label:"color",rgb:"rgb(250, 225, 235)",hex:"#fae1eb"}],[{label:"color",rgb:"rgb(255, 163, 158)",hex:"#ffa39e"},{label:"color",rgb:"rgb(255, 187, 150)",hex:"#ffbb96"},{label:"color",rgb:"rgb(255, 213, 145)",hex:"#ffd591"},{label:"color",rgb:"rgb(255, 240, 143)",hex:"#fff08f"},{label:"color",rgb:"rgb(183, 235, 143)",hex:"#b7eb8f"},{label:"color",rgb:"rgb(135, 232, 222)",hex:"#87e8de"},{label:"color",rgb:"rgb(145, 213, 255)",hex:"#91d5ff"},{label:"color",rgb:"rgb(173, 198, 255)",hex:"#adc6ff"},{label:"color",rgb:"rgb(211, 173, 247)",hex:"#d3adf7"},{label:"color",rgb:"rgb(255, 173, 210)",hex:"#ffadd2"}],[{label:"color",rgb:"rgb(255, 77, 79)",hex:"#ff4d4f"},{label:"color",rgb:"rgb(255, 122, 69)",hex:"#ff7a45"},{label:"color",rgb:"rgb(255, 169, 64)",hex:"#ffa940"},{label:"color",rgb:"rgb(255, 236, 61)",hex:"#ffec3d"},{label:"color",rgb:"rgb(115, 209, 61)",hex:"#73d13d"},{label:"color",rgb:"rgb(54, 207, 201)",hex:"#36cfc9"},{label:"color",rgb:"rgb(64, 169, 255)",hex:"#40a9ff"},{label:"color",rgb:"rgb(89, 126, 247)",hex:"#597ef7"},{label:"color",rgb:"rgb(146, 84, 222)",hex:"#9254de"},{label:"color",rgb:"rgb(247, 89, 171)",hex:"#f759ab"}],[{label:"color",rgb:"rgb(207, 19, 34)",hex:"#cf1322"},{label:"color",rgb:"rgb(212, 56, 13)",hex:"#d4380d"},{label:"color",rgb:"rgb(212, 107, 8)",hex:"#d46b08"},{label:"color",rgb:"rgb(212, 177, 6)",hex:"#d4b106"},{label:"color",rgb:"rgb(56, 158, 13)",hex:"#389e0d"},{label:"color",rgb:"rgb(8, 151, 156)",hex:"#08979c"},{label:"color",rgb:"rgb(9, 109, 217)",hex:"#096dd9"},{label:"color",rgb:"rgb(29, 57, 196)",hex:"#1d39c4"},{label:"color",rgb:"rgb(83, 29, 171)",hex:"#531dab"},{label:"color",rgb:"rgb(196, 29, 127)",hex:"#c41d7f"}],[{label:"color",rgb:"rgb(130, 0, 20)",hex:"#820014"},{label:"color",rgb:"rgb(135, 20, 0)",hex:"#871400"},{label:"color",rgb:"rgb(135, 56, 0)",hex:"#873800"},{label:"color",rgb:"rgb(97, 71, 0)",hex:"#614700"},{label:"color",rgb:"rgb(19, 82, 0)",hex:"#135200"},{label:"color",rgb:"rgb(0, 71, 79)",hex:"#00474f"},{label:"color",rgb:"rgb(0, 58, 140)",hex:"#003a8c"},{label:"color",rgb:"rgb(6, 17, 120)",hex:"#061178"},{label:"color",rgb:"rgb(34, 7, 94)",hex:"#22075e"},{label:"color",rgb:"rgb(120, 6, 80)",hex:"#780650"}]]);return(c,u)=>(a.openBlock(),a.createElementBlock("section",KC,[a.createElementVNode("div",{class:"default-color",onClick:u[0]||(u[0]=d=>r({hex:t.defaultColor}))},[a.createElementVNode("div",WC,[a.createElementVNode("div",{class:"cell border",style:a.normalizeStyle({background:t.defaultColor})},[a.createVNode(a.unref(re),{name:"slash_forward"})],4)]),a.createElementVNode("div",jC,a.toDisplayString(t.defaultLabel),1)]),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(l.value,(d,p)=>(a.openBlock(),a.createElementBlock("div",{class:"color-row",key:`row-${p}`},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(d,(f,h)=>(a.openBlock(),a.createElementBlock("div",{class:"",key:`col-${h}`},[a.createElementVNode("div",{class:"cell-container",onClick:m=>r(f)},[a.createElementVNode("div",{class:a.normalizeClass(["cell",{border:f.border}]),style:a.normalizeStyle({backgroundColor:f.hex})},[i(f.hex)?(a.openBlock(),a.createBlock(a.unref(re),{key:0,name:"done",style:a.normalizeStyle({color:s(f.rgb)})},null,8,["style"])):a.createCommentVNode("",!0)],6)],8,GC)]))),128))]))),128))]))}}),lt=a.defineComponent({__name:"OCommandBtn",props:{icon:{type:String,default:""},color:{type:String,default:""},background:{type:String,default:""},tooltip:{type:String,default:""},placement:{type:String,default:"top"},disabled:{type:Boolean,default:!1},contentClass:{type:[String,Object],default:""},contentStyle:{type:[String,Object],default:""},iconClass:{type:[String,Object],default:""}},emits:["click"],setup(t,{emit:e}){const n=e;return(o,r)=>(a.openBlock(),a.createBlock(a.unref(Qn),{placement:t.placement},{trigger:a.withCtx(()=>[a.createElementVNode("button",{class:a.normalizeClass(["o-menubar-btn o-command-btn o-btn",t.contentClass]),style:a.normalizeStyle(t.contentStyle),onClick:r[0]||(r[0]=i=>n("click",i))},[t.icon?(a.openBlock(),a.createBlock(a.unref(re),{key:0,name:t.icon,color:t.color,class:a.normalizeClass(t.iconClass)},null,8,["name","color","class"])):a.createCommentVNode("",!0),a.renderSlot(o.$slots,"default")],6)]),default:a.withCtx(()=>[a.createTextVNode(" "+a.toDisplayString(t.tooltip),1)]),_:3},8,["placement"]))}}),YC={key:0,class:"o-doc-toc toc"},JC={class:"mini-view"},XC={class:"toc__list"},ZC={class:"main-view o-scroll"},QC={class:"toc__title"},eS={class:"toc__list"},tS=["onClick"],nS=a.defineComponent({name:"ODocToc",__name:"ODocToc",props:{editor:{type:Zt},maxLevel:{type:Number,default:3}},emits:["docScroll"],setup(t,{expose:e,emit:n}){const o=t,r=n,{tr:i}=ge(),s=a.ref([]),l=a.ref("");function c(){var h;l.value=window.location.hash,(h=o.editor)==null||h.on("update",d),setTimeout(()=>{u(),d()},0)}function u(){const h=document.querySelector(".yiitap"),m=h==null?void 0:h.parentElement;m==null||m.addEventListener("scroll",p)}function d(){var m;const h=[];(m=o.editor)==null||m.state.doc.descendants((g,b)=>{if(g.type.name==="heading"){const y=g.attrs["data-id"];h.push({level:g.attrs.level,text:g.textContent,id:y})}}),s.value=h}function p(h){for(const m of s.value){const g=document.querySelector(`[data-id="${m.id}"]`);if(!g)continue;const b=g.getBoundingClientRect();if(b.top>=0&&b.top<window.innerHeight/2){l.value=m.id;break}}r("docScroll",h)}function f(h){l.value=h.id;const m=document.querySelector(`[data-id="${h.id}"]`);m&&m.scrollIntoView({behavior:"smooth",block:"start"})}return a.watch(()=>o.editor,h=>{c()}),e({onScroll:p,headings:s}),(h,m)=>s.value.length?(a.openBlock(),a.createElementBlock("section",YC,[a.createVNode(a.unref(Pe),{ref:"popover","tippy-class":"o-toc-popover",placement:"left-start",offset:[0,-50],delay:0,duration:100},{trigger:a.withCtx(()=>[a.createElementVNode("div",JC,[a.createElementVNode("ul",XC,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(s.value,(g,b)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:b},[g.level<=Math.max(Math.min(t.maxLevel,3),2)?(a.openBlock(),a.createElementBlock("li",{key:0,class:a.normalizeClass(["toc__item",[l.value===g.id?"selected":"",`toc__item--${g.level}`]])},null,2)):a.createCommentVNode("",!0)],64))),128))])])]),default:a.withCtx(()=>[a.createElementVNode("div",ZC,[a.createElementVNode("div",QC,a.toDisplayString(a.unref(i)("label.toc")),1),a.createElementVNode("ul",eS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(s.value,(g,b)=>(a.openBlock(),a.createElementBlock("li",{class:a.normalizeClass(["toc__item",`toc__item--${g.level}`]),key:b},[a.createElementVNode("span",{class:a.normalizeClass(["heading",{selected:l.value===g.id}]),onClick:y=>f(g)},a.toDisplayString(g.text),11,tS)],2))),128))])])]),_:1},512)])):a.createCommentVNode("",!0)}}),oS={class:"o-emoji-select"},rS={key:0},iS={class:"groups o-scroll"},sS={class:"items"},aS=["onClick"],lS={key:0,class:"groups-empty"},cS={class:"group-icons"},uS=["onClick"],Ca=a.defineComponent({__name:"OEmojiSelect",props:{items:{type:Array,required:!0},enableSearch:{type:Boolean,default:!1}},emits:["select"],setup(t,{emit:e}){const n=t,o=e,r=a.ref(null),i=a.ref(""),s=a.ref([]),l=a.ref([]),c=a.ref(0),u=a.computed(()=>i.value?s.value:n.items),d=a.computed(()=>{let m=!1;return u.value.map(g=>{m=m||g.emojis.length}),m});function p(){c.value=0,s.value=i.value?ei.filterEmojiGroups(i.value):[]}function f(m){o("select",m)}function h(m,g){c.value=g,l.value[g].scrollIntoView({behavior:"instant",block:"start"})}return a.onMounted(()=>{}),(m,g)=>(a.openBlock(),a.createElementBlock("section",oS,[t.enableSearch?(a.openBlock(),a.createElementBlock("div",rS,[a.createVNode(a.unref(Ln),{ref_key:"input",ref:r,modelValue:i.value,"onUpdate:modelValue":[g[0]||(g[0]=b=>i.value=b),p],type:"text",autofocus:"",clearable:""},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{name:"search",class:"o-tips"})]),_:1},8,["modelValue"])])):a.createCommentVNode("",!0),a.createElementVNode("section",iS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(u.value,(b,y)=>{var k;return a.withDirectives((a.openBlock(),a.createElementBlock("div",{key:`group-${y}`,class:"group"},[a.createElementVNode("header",{ref_for:!0,ref_key:"groupRefs",ref:l},a.toDisplayString(b.name),513),a.createElementVNode("section",sS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(b.emojis,(E,v)=>(a.openBlock(),a.createElementBlock("div",{key:`item-${v}`},[a.createElementVNode("div",{class:"item",onClick:C=>f(E)},a.toDisplayString(E.emoji),9,aS)]))),128))])],512)),[[a.vShow,(k=b.emojis)==null?void 0:k.length]])}),128)),d.value?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("div",lS,"没有记录"))]),a.createElementVNode("section",cS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(u.value,(b,y)=>(a.openBlock(),a.createBlock(a.unref(Qn),{key:`target-${y}`,delay:300},{trigger:a.withCtx(()=>{var k;return[a.withDirectives(a.createElementVNode("div",{class:a.normalizeClass(["item",{active:c.value===y}]),onClick:E=>h(b,y)},[a.createVNode(a.unref(re),{name:a.unref(ei.emojiGroupIcons)[b.slug]},null,8,["name"])],10,uS),[[a.vShow,(k=b.emojis)==null?void 0:k.length]])]}),default:a.withCtx(()=>[a.createTextVNode(" "+a.toDisplayString(b.name),1)]),_:2},1024))),128))])]))}}),sl=[{label:"Arduino",value:"arduino",icon:"code_blocks"},{label:"Bash",value:"bash",icon:"code_blocks"},{label:"C",value:"c",icon:"code_blocks"},{label:"C++",value:"cpp",icon:"code_blocks"},{label:"C#",value:"csharp",icon:"code_blocks"},{label:"CSS",value:"css",icon:"code_blocks"},{label:"Diff",value:"diff",icon:"code_blocks"},{label:"Go",value:"go",icon:"code_blocks"},{label:"GraphQL",value:"graphql",icon:"code_blocks"},{label:"Ini",value:"ini",icon:"code_blocks"},{label:"Java",value:"java",icon:"code_blocks"},{label:"JavaScript",value:"javascript",icon:"code_blocks"},{label:"JSON",value:"json",icon:"code_blocks"},{label:"Kotlin",value:"kotlin",icon:"code_blocks"},{label:"Less",value:"less",icon:"code_blocks"},{label:"Lua",value:"lua",icon:"code_blocks"},{label:"Makefile",value:"makefile",icon:"code_blocks"},{label:"Markdown",value:"markdown",icon:"code_blocks"},{label:"Objective-C",value:"objectivec",icon:"code_blocks"},{label:"Perl",value:"perl",icon:"code_blocks"},{label:"PHP",value:"php",icon:"code_blocks"},{label:"PHP-Template",value:"php-template",icon:"code_blocks"},{label:"Plain Text",value:"plaintext",icon:"code_blocks"},{label:"Python",value:"python",icon:"code_blocks"},{label:"Python-Repl",value:"python-repl",icon:"code_blocks"},{label:"R",value:"r",icon:"code_blocks"},{label:"Ruby",value:"ruby",icon:"code_blocks"},{label:"Rust",value:"rust",icon:"code_blocks"},{label:"Scss",value:"scss",icon:"code_blocks"},{label:"Shell",value:"shell",icon:"code_blocks"},{label:"SQL",value:"sql",icon:"code_blocks"},{label:"Swift",value:"swift",icon:"code_blocks"},{label:"TypeScript",value:"typescript",icon:"code_blocks"},{label:"VB.Net",value:"vbnet",icon:"code_blocks"},{label:"WebAssembly",value:"wasm",icon:"code_blocks"},{label:"XML",value:"xml",icon:"code_blocks"},{label:"YAML",value:"yaml",icon:"code_blocks"}],dS={class:"selected-language"},pS={class:"header"},fS={class:"o-scroll"},Dm=a.defineComponent({__name:"OLanguageDropdown",props:{language:{type:String,default:"shell"}},emits:["select"],setup(t,{emit:e}){const n=t,o=e,{tr:r}=ge(),i=a.ref(),s=a.ref(),l=a.ref(""),c=a.ref(0),u=a.ref(""),d=a.computed(()=>l.value?sl.filter(y=>y.value.toLowerCase().indexOf(l.value.toLowerCase())>=0):sl),p=a.computed(()=>sl.find(y=>y.value===u.value));function f(y){y&&setTimeout(()=>{var k;(k=s.value)==null||k.focus(),c.value=0,window.addEventListener("keyup",b)},0)}function h(){window.removeEventListener("keyup",b)}function m(y){h(),u.value=y.value,o("select",y.value)}function g(){m(d.value[c.value])}function b(y){if(d.value.length>0){switch(y.code){case"ArrowDown":c.value=c.value+1;break;case"ArrowUp":c.value=c.value-1;break;case"Enter":g();break}c.value>=d.value.length&&(c.value=0),c.value<0&&(c.value=d.value.length-1)}else c.value=0}return a.onMounted(()=>{u.value=n.language}),(y,k)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:i,placement:"bottom-start",trigger:"click","tippy-class":"o-language-popover","conten-class":"dropdown","onUpdate:show":f},{trigger:a.withCtx(()=>[a.createVNode(a.unref(St),{class:"o-dropdown-btn"},{default:a.withCtx(()=>{var E;return[a.createElementVNode("span",dS,a.toDisplayString((E=p.value)==null?void 0:E.label),1),a.createVNode(a.unref(re),{name:"arrow_drop_down",class:"arrow"})]}),_:1})]),default:a.withCtx(()=>[a.createElementVNode("header",pS,[a.createVNode(a.unref(Ln),{ref_key:"input",ref:s,modelValue:l.value,"onUpdate:modelValue":k[0]||(k[0]=E=>l.value=E),type:"text",placeholder:"Search",autofocus:"",clearable:""},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{name:"search",class:"o-tips"})]),_:1},8,["modelValue"])]),a.createElementVNode("section",fS,[a.createVNode(a.unref(Qt),{hoverable:"",clickable:""},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(d.value,(E,v)=>(a.openBlock(),a.createBlock(a.unref(Ut),{key:v,onClick:C=>m(E),class:a.normalizeClass({"is-active":E.value===u.value,"is-select":v===c.value})},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{name:E.icon},null,8,["name"])]),default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(E.label)+" ",1)]),_:2},1032,["onClick","class"]))),128))]),_:1})])]),_:1},512))}}),hS={class:"o-media-input"},mS={class:"fields"},gS={class:"actions"},Qc=a.defineComponent({__name:"OMediaInput",props:{val:{type:String,default:""},type:{type:String,default:""}},emits:["input"],setup(t,{emit:e}){const n=t,o=e,{tr:r}=ge(),i=a.ref(),s=a.ref(""),l=a.ref("");function c(){return l.value?(s.value="null",!0):(s.value="error",!1)}function u(){c()&&o("input",l.value)}return a.onMounted(()=>{l.value=n.val,setTimeout(()=>{var d;(d=i.value)==null||d.focus()},0)}),(d,p)=>(a.openBlock(),a.createElementBlock("section",hS,[a.createElementVNode("section",mS,[p[1]||(p[1]=a.createElementVNode("div",{class:"o-media-title"},"Link",-1)),a.createVNode(a.unref(Ln),{ref_key:"input",ref:i,modelValue:l.value,"onUpdate:modelValue":p[0]||(p[0]=f=>l.value=f),status:s.value,type:"text",autofocus:"",clearable:""},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{name:"link",class:"o-tips"})]),_:1},8,["modelValue","status"])]),a.createElementVNode("footer",gS,[a.createVNode(a.unref(St),{type:"info",onClick:u},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(a.unref(r)("label.ok")),1)]),_:1})])]))}}),bS={class:"o-meta-input"},yS={class:"header"},vS={class:"title"},kS={class:"fields"},wS={class:"actions"},eu=a.defineComponent({__name:"OMetaInput",props:{val:{type:String,default:""},title:{type:String,default:"Link"},type:{type:String,default:"link"},icon:{type:String,default:"link"},secondIcon:{type:String,default:""},secondLabel:{type:String,default:""}},emits:["cancel","confirm"],setup(t,{emit:e}){const n=t,o=e,{tr:r}=ge(),i=a.ref(null),s=a.ref("");function l(){console.log("confirm",s.value),o("confirm",s.value)}return a.onMounted(()=>{s.value=n.val,setTimeout(()=>{var c;(c=i.value)==null||c.focus()},0)}),(c,u)=>(a.openBlock(),a.createElementBlock("section",bS,[a.createElementVNode("section",yS,[a.createElementVNode("div",vS,a.toDisplayString(t.title),1),a.createElementVNode("div",null,[a.renderSlot(c.$slots,"header-right")])]),a.createElementVNode("section",kS,[a.createVNode(a.unref(Ln),{ref_key:"input",ref:i,modelValue:s.value,"onUpdate:modelValue":u[0]||(u[0]=d=>s.value=d),type:"text",autofocus:"",clearable:""},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{name:t.icon,class:"o-tips"},null,8,["name"])]),_:1},8,["modelValue"])]),a.createElementVNode("footer",wS,[a.createVNode(a.unref(St),{type:"tertiary",onClick:u[1]||(u[1]=d=>o("cancel"))},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(a.unref(r)("label.cancel")),1)]),_:1}),a.createVNode(a.unref(St),{type:"info",onClick:l},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(a.unref(r)("label.ok")),1)]),_:1})])]))}}),ES={class:"o-table-grid"},_S=["onMouseover"],Im=a.defineComponent({__name:"OTableGrid",emits:["select"],setup(t,{emit:e}){const n=e,o=a.ref(6),r=a.ref(6),i=a.ref(2),s=a.ref(2);function l(u,d){i.value=u,s.value=d,o.value===u&&o.value<10&&(o.value+=1),r.value===d&&r.value<10&&(r.value+=1)}function c(){n("select",{rows:i.value,cols:s.value,withHeaderRow:!0})}return(u,d)=>(a.openBlock(),a.createElementBlock("section",ES,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(o.value,(p,f)=>(a.openBlock(),a.createElementBlock("div",{class:"rows",key:`row-${f}`},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.value,(h,m)=>(a.openBlock(),a.createElementBlock("div",{key:`col-${m}`},[a.createElementVNode("div",{class:a.normalizeClass(["cell",{selected:p<=i.value&&h<=s.value}]),onMouseover:g=>l(p,h),onClick:c},null,42,_S)]))),128))]))),128)),a.createElementVNode("footer",null,a.toDisplayString(i.value)+" x "+a.toDisplayString(s.value),1)]))}}),CS={class:"o-table-cell-background o-button-group"},SS={class:"o-command-btn"},Lm=a.defineComponent({__name:"OTableCellBackground",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),r=a.ref(),i=a.ref("#ffec3d");function s(){l(i.value)}function l(c){r.value.setShow(!1),i.value=c,o(e.editor,"tableCellAttribute",{name:"background",value:i.value})}return(c,u)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom-start",trigger:"click"},{trigger:a.withCtx(()=>[a.createVNode(a.unref(Qn),{trigger:"hover"},{trigger:a.withCtx(()=>[a.createElementVNode("div",CS,[a.createElementVNode("div",{class:"o-command-btn label",onClick:a.withModifiers(s,["stop"])},[a.createVNode(a.unref(re),{name:"crop_16_9",class:"arrow"}),a.createElementVNode("div",{class:"indicator",style:a.normalizeStyle(`background: ${i.value}`)},null,4)]),a.createElementVNode("div",SS,[a.createVNode(a.unref(re),{name:"arrow_drop_down"})])])]),default:a.withCtx(()=>[a.createTextVNode(" "+a.toDisplayString(a.unref(n)("editor.highlightColor")),1)]),_:1})]),default:a.withCtx(()=>[a.createVNode(a.unref(_a),{"default-color":"","default-label":a.unref(n)("editor.noColor"),onSelect:l},null,8,["default-label"])]),_:1},512))}}),xS={class:"o-simple-color-board"},NS={class:"fore-colors"},TS={class:"color-row"},OS={class:"color-row"},MS={class:"back-colors"},AS={class:"color-row"},RS={class:"color-row"},Pm=a.defineComponent({__name:"OTextColorBoard",props:{foreColor:{type:String,default:""},backColor:{type:String,default:""},activeColor:{type:String,default:""}},emits:["select"],setup(t,{emit:e}){const n=e;function o(s,l){n("select",s,l.value)}const r=a.computed(()=>[{label:"Grey",value:"#787774"},{label:"Brown",value:"#9F6B53"},{label:"Orange",value:"#D9730D"},{label:"Yellow",value:"#CB912F"},{label:"Green",value:"#448361"},{label:"Blue",value:"#337EA9"},{label:"Purple",value:"#9065B0"},{label:"Pink",value:"#C14C8A"},{label:"Red",value:"#D44C47"}]),i=a.computed(()=>[{label:"Grey",value:"#F1F1EF"},{label:"Brown",value:"#F4EEEE"},{label:"Orange",value:"#FAEBDD"},{label:"Yellow",value:"#FBF3DB"},{label:"Green",value:"#EDF3EC"},{label:"Blue",value:"#E7F3F8"},{label:"Purple",value:"#F6F3F9"},{label:"Pink",value:"#FAF1F5"},{label:"Red",value:"#FDEBEC"}]);return(s,l)=>(a.openBlock(),a.createElementBlock("section",xS,[a.createElementVNode("section",NS,[l[4]||(l[4]=a.createElementVNode("div",{class:"label o-tips"},"Color",-1)),a.createElementVNode("div",TS,[a.createVNode(a.unref(Le),{icon:"format_text",tooltip:"Default color","content-class":"border",onClick:l[0]||(l[0]=c=>o("foreColor",{value:""}))}),t.foreColor?(a.openBlock(),a.createBlock(a.unref(Le),{key:0,icon:"format_text",color:t.foreColor,tooltip:"Last used","content-class":"border",onClick:l[1]||(l[1]=c=>o("foreColor",{value:t.foreColor}))},null,8,["color"])):a.createCommentVNode("",!0)]),a.createElementVNode("div",OS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.value,(c,u)=>(a.openBlock(),a.createBlock(a.unref(Le),{key:`col-${u}`,icon:"format_text",color:c.value,tooltip:c.label,onClick:d=>o("foreColor",c)},null,8,["color","tooltip","onClick"]))),128))])]),a.createElementVNode("section",MS,[l[5]||(l[5]=a.createElementVNode("div",{class:"label o-tips"},"Background",-1)),a.createElementVNode("div",AS,[a.createVNode(a.unref(Le),{icon:"slash_forward",tooltip:"No Color","content-class":"border",onClick:l[2]||(l[2]=c=>o("backColor",{value:""}))}),t.backColor?(a.openBlock(),a.createBlock(a.unref(Le),{key:0,icon:"format_text",tooltip:"Last used","content-class":"border","content-style":{backgroundColor:t.backColor},onClick:l[3]||(l[3]=c=>o("backColor",{value:t.backColor}))},null,8,["content-style"])):a.createCommentVNode("",!0)]),a.createElementVNode("div",RS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(i.value,(c,u)=>(a.openBlock(),a.createBlock(a.unref(Le),{key:`col-${u}`,icon:"format_text",tooltip:c.label,"content-style":{backgroundColor:c.value},onClick:d=>o("backColor",c)},null,8,["tooltip","content-style","onClick"]))),128))])])]))}});class BS{constructor(){Je(this,"instances",[])}error(e,n=3e3){this.show(e,"error",n)}info(e,n=3e3){this.show(e,"info",n)}success(e,n=3e3){this.show(e,"success",n)}warning(e,n=3e3){this.show(e,"warning",n)}show(e,n="info",o=3e3){const r=`
117
+ <div class="o-toast ${n}">
118
+ <i class="yiitip-icon icon-${n}"></i>
119
+ <span class="message">${e}</span>
120
+ </div>
121
+ `,i=dn(document.body,{arrow:!1,allowHTML:!0,placement:"top",theme:"toast-theme",trigger:"manual",appendTo:()=>document.body,animation:"shift-away",duration:500,content:r,onHidden:s=>{s.destroy(),this.instances=this.instances.filter(l=>l!==s)}});i.show(),o>0&&setTimeout(()=>{i.hide()},o),this.instances.push(i),this.repositionToasts()}repositionToasts(){this.instances.forEach((e,n)=>{e.setProps({placement:"bottom",offset:[0,n*55]})})}}const tu=new BS,jr=[{type:"paragraph",content:[]}],$m=[{type:"listItem",content:[{type:"paragraph",content:[]}]}],Fm=[{type:"taskItem",content:[{type:"paragraph",content:[]}]}],DS={class:"o-add-node-view"},IS={key:0,class:"view-main"},LS={class:"group o-tips"},PS={class:"panel"},$S={class:"group o-tips"},FS={key:1,class:"item"},VS={key:1,class:"view-emoji"},zS=a.defineComponent({__name:"AddNodeView",props:ct,emits:["action"],setup(t,{emit:e}){const n=t,o=e,{locale:r,tr:i}=ge(),{run:s}=Te(),l=a.ref("main"),c=a.ref(0);function u(f){const h=n.editor.chain();let m=null;switch(f.value){case"blockquote":m={content:jr};break;case"callout":m={content:jr,attrs:{icon:"💡"}};break;case"codeBlock":m={content:[],attrs:{language:"shell"}};break;case"emoji":m={type:"paragraph",content:[{type:"text",text:":"}]};break;case"heading":m={attrs:f.options};break;case"horizontalRule":m={};break;case"paragraph":m={content:[]};break;case"bulletList":case"orderedList":m={content:$m};break;case"taskList":m={content:Fm};break;case"table":setTimeout(()=>{h.insertContentAt(p.value,{type:"paragraph",content:[]}).insertTable({rows:3,cols:3,withHeaderRow:!0}).focus().run()},1);return;case"image":m={type:"paragraph",content:[{type:f.value,attrs:{src:"init"}}]};break;case"model-viewer":m={attrs:{src:"init"}};break}m&&(m.type=m.type||f.value,setTimeout(()=>{d.value?h.insertContent(m).focus().run():h.insertContentAt(p.value,m).focus().run()},1)),o("action",f)}const d=a.computed(()=>n.node.content.size===0),p=a.computed(()=>d.value?c.value:c.value+n.node.nodeSize);return a.onMounted(()=>{c.value=n.getPos()}),(f,h)=>(a.openBlock(),a.createElementBlock("section",DS,[l.value==="main"?(a.openBlock(),a.createElementBlock("section",IS,[a.createElementVNode("section",null,[a.createElementVNode("div",LS,a.toDisplayString(a.unref(i)("label.basic")),1),a.createElementVNode("section",PS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(Sr),(m,g)=>(a.openBlock(),a.createBlock(a.unref(Le),{key:g,icon:m.icon,tooltip:a.unref(i)(m.label),quaternary:"",onClick:b=>u(m)},null,8,["icon","tooltip","onClick"]))),128))])]),a.createVNode(a.unref(Qt),{hoverable:"",clickable:""},{default:a.withCtx(()=>[a.unref(kr).length?(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:0},a.renderList(a.unref(kr),(m,g)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:g},[m.group?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[g>0?(a.openBlock(),a.createBlock(a.unref(Lt),{key:0})):a.createCommentVNode("",!0),a.createElementVNode("div",$S,a.toDisplayString(a.unref(i)(m.group)),1)],64)):a.createCommentVNode("",!0),a.createVNode(a.unref(Ut),{class:"item",clickable:"",onClick:b=>u(m)},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{name:m.icon,color:m.color},null,8,["name","color"])]),default:a.withCtx(()=>[a.createTextVNode(" "+a.toDisplayString(a.unref(i)(m.label)),1)]),_:2},1032,["onClick"])],64))),128)):(a.openBlock(),a.createElementBlock("div",FS,"No result"))]),_:1})])):l.value==="emoji"?(a.openBlock(),a.createElementBlock("section",VS)):a.createCommentVNode("",!0)]))}}),HS=a.defineComponent({__name:"AddNode",props:ct,setup(t){const e=t,n=a.ref(null),o=a.ref(!1);function r(s){o.value=s}function i(){var s;(s=n.value)==null||s.setShow(!1),o.value=!1}return(s,l)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:n,placement:"left",trigger:"mouseenter",arrow:"","onUpdate:show":r},{trigger:a.withCtx(()=>[a.createElementVNode("div",{class:a.normalizeClass(["o-add-node",{"is-selected":o.value}])},[a.createVNode(a.unref(St),{type:"tertiary",class:"o-node-btn"},{default:a.withCtx(()=>[a.createVNode(a.unref(re),{name:"add",small:""})]),_:1})],2)]),default:a.withCtx(()=>[a.createVNode(zS,a.mergeProps(e,{onAction:i}),null,16)]),_:1},512))}}),US={class:"o-drag-node-view"},qS={key:0,class:"view-main"},KS={key:0},WS={class:"panel"},jS=a.defineComponent({__name:"DragNodeView",props:ct,emits:["action"],setup(t,{emit:e}){const n=t,o=e,{locale:r,tr:i}=ge(),{run:s,onCommand:l}=Te(),c=a.ref("main"),u=a.ref(["heading","codeBlock","paragraph"]),d=a.computed(()=>{var b,y;const g=(b=n.node)==null?void 0:b.content.content;if(g.length>0){const k=g[0];if(k.type.name==="image")return k.type.name}return(y=n.node)==null?void 0:y.type.name}),p=a.computed(()=>hi.find(g=>g.value===d.value));function f(g){var b;return g.value===d.value&&((b=n.editor)==null?void 0:b.isActive(d.value,g.options))}function h(g){switch(g.value){default:m(g);break}o("action",g)}function m(g){var E,v,C,_,R;const b=n.getPos();if(g.value===d.value&&u.value.indexOf(d.value)<0){const B=(E=n.editor)==null?void 0:E.isActive(d.value),N=(v=n.editor)==null?void 0:v.commands.lift(d.value);console.log("lift",d.value,B,N);return}const y=(C=n.editor)==null?void 0:C.commands,k=(_=n.editor)==null?void 0:_.chain().focus(b+1);console.log("runCommand",g),l(y,k,g.value,g.options),(R=n.editor)==null||R.commands.setNodeSelection(b)}return a.computed(()=>[{label:"editor.duplicate",value:"duplicate",icon:"content_copy",color:me.blue,tips:"Ctrl+D",group:"label.common"},{label:"editor.delete",value:"delete",icon:"delete",tips:"Ctrl+D",color:me.deepOrange}]),(g,b)=>(a.openBlock(),a.createElementBlock("section",US,[c.value==="main"?(a.openBlock(),a.createElementBlock("section",qS,[p.value?(a.openBlock(),a.createElementBlock("section",KS,[b[0]||(b[0]=a.createElementVNode("div",{class:"group o-tips"},"Turn into",-1)),a.createElementVNode("section",WS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(hi),(y,k)=>(a.openBlock(),a.createBlock(a.unref(Le),{key:k,icon:y.icon,tooltip:a.unref(i)(y.label),"content-class":{"is-active":f(y)},quaternary:"",onClick:E=>h(y)},null,8,["icon","tooltip","content-class","onClick"]))),128))])])):a.createCommentVNode("",!0),a.createVNode(a.unref(So),a.mergeProps(n,{colorful:"","show-group":"",onAction:h}),null,16)])):a.createCommentVNode("",!0)]))}}),GS=a.defineComponent({__name:"DragNode",props:ct,emits:["action"],setup(t,{emit:e}){const n=t,o=e,{run:r}=Te(),i=a.ref(null),s=a.ref(0),l=a.ref(!1),c=a.ref(["heading","codeBlock","paragraph"]),u=a.ref(!1),d=a.computed(()=>{var k,E;const y=(k=n.node)==null?void 0:k.content.content;if(y.length>0){const v=y[0];if(v.type.name==="image")return v.type.name}return(E=n.node)==null?void 0:E.type.name}),p=a.computed(()=>{var k;let y=d.value;return y==="heading"?{icon:`format_h${((k=n.node.attrs)==null?void 0:k.level)||1}`,color:me.blue}:(y==="table-wrapper"&&(y="table"),wa.find(E=>E.value===y)||{icon:"title"})});function f(y){var k;(k=i.value)==null||k.setShow(!1),o("action",y)}function h(y){l.value=y,console.log("show",y),y&&m()}function m(){var k;let y=n.getPos();c.value.includes(d.value)||(y+=1),(k=n.editor)==null||k.commands.setNodeSelection(y),s.value=y}function g(y){u.value=!0,setTimeout(()=>{u.value=!1},10)}function b(y){u.value=!1}return(y,k)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:i,placement:"left",size:"medium",trigger:"click",arrow:"","onUpdate:show":h},{trigger:a.withCtx(()=>[a.createElementVNode("div",{class:a.normalizeClass(["o-drag-node",{"is-selected":l.value,"is-dragging":u.value}]),contenteditable:"false",draggable:"true","data-drag-handle":"",onDragstart:g,onDragend:b},[a.createVNode(a.unref(St),{type:"tertiary",class:"o-node-btn"},{default:a.withCtx(()=>[a.createVNode(a.unref(re),{name:p.value.icon,color:p.value.color,small:""},null,8,["name","color"]),a.createVNode(a.unref(re),{name:"drag_indicator",small:""})]),_:1})],34)]),default:a.withCtx(()=>[a.createVNode(jS,a.mergeProps(n,{onAction:f}),null,16)]),_:1},512))}}),YS=a.defineComponent({__name:"index",props:ct,emits:["action"],setup(t,{emit:e}){const n=t,o=e,r=a.ref(!1),i=a.ref(0);a.ref(0);const s=a.computed(()=>l.value==="paragraph"&&n.node.content.size===0),l=a.computed(()=>{var f,h;const p=(f=n.node)==null?void 0:f.content.content;if(p.length>0){const m=p[0];if(m.type.name==="image")return m.type.name}return(h=n.node)==null?void 0:h.type.name}),c=a.computed(()=>{var p;return i.value||((p=n.node.attrs)==null?void 0:p.level)}),u=a.computed(()=>l.value==="heading"?`type-heading-${c.value}`:`type-${l.value}`);function d(p){o("action",p)}return a.onMounted(()=>{i.value=0}),(p,f)=>{var h;return(h=p.editor)!=null&&h.isEditable?(a.openBlock(),a.createElementBlock("section",{key:0,class:a.normalizeClass(["o-side-node",{"is-active":r.value,"is-empty":s.value}])},[a.createElementVNode("section",{class:a.normalizeClass(["action-container",u.value])},[a.createVNode(HS,a.normalizeProps(a.guardReactiveProps(n)),null,16),s.value?a.createCommentVNode("",!0):(a.openBlock(),a.createBlock(GS,a.mergeProps({key:0},n,{onAction:d}),null,16))],2)],2)):a.createCommentVNode("",!0)}}}),kn=a.defineComponent({__name:"ONodeView",props:ct,emits:["action"],setup(t,{emit:e}){const n=t,o=e,r=a.inject("sideNode",{value:!1});return a.computed(()=>{const i={};return n.node.attrs["data-id"]&&(i["data-id"]=n.node.attrs["data-id"]),i}),(i,s)=>(a.openBlock(),a.createBlock(a.unref(Uc),{class:"o-node-view","data-id":i.node.attrs["data-id"]},{default:a.withCtx(()=>{var l;return[a.unref(r)&&((l=i.editor)!=null&&l.isEditable)?(a.openBlock(),a.createBlock(YS,a.mergeProps({key:0},n,{onAction:s[0]||(s[0]=c=>o("action"))}),null,16)):a.createCommentVNode("",!0),a.renderSlot(i.$slots,"default")]}),_:3},8,["data-id"]))}}),JS={class:"o-add-node-view"},XS={key:0,class:"view-main"},ZS={class:"group o-tips"},QS={class:"panel"},ex={class:"group o-tips"},tx={key:1,class:"item"},nx=a.defineComponent({__name:"AddNodeView",props:{editor:{type:Object,required:!0},node:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0}},emits:["action"],setup(t,{emit:e}){const n=t,o=e,{locale:r,tr:i}=ge(),{run:s}=Te(),l=a.ref("main");function c(p){const f=n.editor.chain();let h=null;switch(p.value){case"aiBlock":h={content:jr,attrs:{icon:"💡"}};break;case"blockquote":h={content:jr};break;case"callout":h={content:jr,attrs:{icon:"💡"}};break;case"codeBlock":h={content:[],attrs:{language:"shell"}};break;case"emoji":h={type:"paragraph",content:[{type:"text",text:":"}]};break;case"heading":h={attrs:p.options};break;case"horizontalRule":h={};break;case"paragraph":h={content:[]};break;case"bulletList":case"orderedList":h={content:$m};break;case"taskList":h={content:Fm};break;case"table":setTimeout(()=>{f.insertContentAt(d.value,{type:"paragraph",content:[]}).insertTable({rows:3,cols:3,withHeaderRow:!0}).focus().run()},1),o("action",p);return;case"image":h={type:"paragraph",content:[{type:p.value,attrs:{src:"init"}}]};break;case"model-viewer":h={attrs:{src:"init"}};break}if(h){const m=d.value;h.type=h.type||p.value,setTimeout(()=>{u.value?f.insertContent(h).focus().run():f.insertContentAt(m,h).focus().run()},1)}o("action",p)}const u=a.computed(()=>{var p;return((p=n.node)==null?void 0:p.content.size)===0}),d=a.computed(()=>u.value?n.getPos():n.getPos()+n.node.nodeSize);return(p,f)=>(a.openBlock(),a.createElementBlock("section",JS,[l.value==="main"?(a.openBlock(),a.createElementBlock("section",XS,[a.createElementVNode("section",null,[a.createElementVNode("div",ZS,a.toDisplayString(a.unref(i)("label.basic")),1),a.createElementVNode("section",QS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(Sr),(h,m)=>(a.openBlock(),a.createBlock(a.unref(Le),{key:m,icon:h.icon,tooltip:a.unref(i)(h.label),quaternary:"",onClick:g=>c(h)},null,8,["icon","tooltip","onClick"]))),128))])]),a.createVNode(a.unref(Lt)),a.createVNode(a.unref(Qt),{hoverable:"",clickable:""},{default:a.withCtx(()=>[a.unref(kr).length?(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:0},a.renderList(a.unref(kr),(h,m)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:m},[h.group?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[m>0?(a.openBlock(),a.createBlock(a.unref(Lt),{key:0})):a.createCommentVNode("",!0),a.createElementVNode("div",ex,a.toDisplayString(a.unref(i)(h.group)),1)],64)):a.createCommentVNode("",!0),a.createVNode(a.unref(Ut),{class:"item",clickable:"",onClick:g=>c(h)},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{name:h.icon,color:h.color},null,8,["name","color"])]),default:a.withCtx(()=>[a.createTextVNode(" "+a.toDisplayString(a.unref(i)(h.label)),1)]),_:2},1032,["onClick"])],64))),128)):(a.openBlock(),a.createElementBlock("div",tx,"No result"))]),_:1})])):a.createCommentVNode("",!0)]))}}),Vm=a.defineComponent({__name:"AddNode",props:{editor:{type:Object,required:!0},node:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0}},setup(t){const e=t,n=a.ref(),o=a.ref(!1),r=a.computed(()=>{var c;return((c=e.node)==null?void 0:c.content.size)===0});a.computed(()=>r.value?e.getPos():e.getPos()+e.node.nodeSize);function i(c){o.value=c}function s(){var c;(c=n.value)==null||c.setShow(!0)}function l(){var c;(c=n.value)==null||c.setShow(!1),o.value=!1}return(c,u)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:n,placement:"left","content-class":"dropdown",trigger:"manual",offset:[0,4],"onUpdate:show":i},{trigger:a.withCtx(()=>[a.createElementVNode("div",{class:a.normalizeClass(["o-add-btn",{"is-selected":o.value}])},[a.createVNode(a.unref(St),{type:"tertiary",class:"o-node-btn",onClick:s},{default:a.withCtx(()=>[a.createVNode(a.unref(re),{name:"add",small:""})]),_:1})],2)]),default:a.withCtx(()=>[a.createVNode(nx,a.mergeProps(e,{onAction:l}),null,16)]),_:1},512))}}),ox={class:"o-drag-node-view"},rx={key:0,class:"view-main"},ix={key:0},sx={class:"panel"},ax=a.defineComponent({__name:"DragNodeView",props:{editor:{type:Object,required:!0},node:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0}},emits:["action"],setup(t,{emit:e}){const n=t,o=e,{locale:r,tr:i}=ge(),{run:s,onCommand:l}=Te(),c=a.ref("main"),u=a.ref(["heading","codeBlock","paragraph"]),d=a.computed(()=>{var b,y;const g=(b=n.node)==null?void 0:b.content.content;if(g.length>0){const k=g[0];if(k.type.name==="image")return k.type.name}return(y=n.node)==null?void 0:y.type.name}),p=a.computed(()=>hi.find(g=>g.value===d.value));function f(g){var b;return g.value===d.value&&((b=n.editor)==null?void 0:b.isActive(d.value,g.options))}function h(g){switch(g.value){case"delete":break;case"duplicate":break;default:m(g);break}o("action",g)}function m(g){var E,v,C,_,R;const b=n.getPos();if(g.value===d.value&&u.value.indexOf(d.value)<0){const B=(E=n.editor)==null?void 0:E.isActive(d.value),N=(v=n.editor)==null?void 0:v.commands.lift(d.value);console.log("lift",d.value,B,N);return}const y=(C=n.editor)==null?void 0:C.commands,k=(_=n.editor)==null?void 0:_.chain().focus(b+1);console.log("runCommand",g),l(y,k,g.value,g.options),(R=n.editor)==null||R.commands.focus()}return(g,b)=>(a.openBlock(),a.createElementBlock("section",ox,[c.value==="main"?(a.openBlock(),a.createElementBlock("section",rx,[p.value?(a.openBlock(),a.createElementBlock("section",ix,[b[0]||(b[0]=a.createElementVNode("div",{class:"group o-tips"},"Turn into",-1)),a.createElementVNode("section",sx,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(hi),(y,k)=>(a.openBlock(),a.createBlock(a.unref(Le),{key:k,icon:y.icon,tooltip:a.unref(i)(y.label),"content-class":{"is-active":f(y)},quaternary:"",onClick:E=>h(y)},null,8,["icon","tooltip","content-class","onClick"]))),128))])])):a.createCommentVNode("",!0),a.createVNode(a.unref(So),a.mergeProps(n,{colorful:"","show-group":"",onAction:h}),null,16)])):a.createCommentVNode("",!0)]))}}),zm=a.defineComponent({__name:"DragNode",props:{editor:{type:Object,required:!0},node:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0}},emits:["action","dragstart","dragend"],setup(t,{emit:e}){const n=t,o=e,{run:r}=Te(),i=a.ref(null),s=a.ref(!1),l=a.ref(["heading","codeBlock","paragraph"]),c=a.computed(()=>{var b,y,k;const g=(y=(b=n.node)==null?void 0:b.content)==null?void 0:y.content;if((g==null?void 0:g.length)>0){const E=g[0];if(E.type.name==="image")return E.type.name}return(k=n.node)==null?void 0:k.type.name}),u=a.computed(()=>{var b;let g=c.value;return g==="heading"?{icon:`format_h${((b=n.node.attrs)==null?void 0:b.level)||1}`,color:me.blue}:(g==="table-wrapper"&&(g="table"),wa.find(y=>y.value===g)||{icon:"title"})});function d(g){o("dragstart",g)}function p(g){o("dragend",g)}function f(g){var b;(b=i.value)==null||b.setShow(!1),o("action",g)}function h(g){s.value=g,g&&m()}function m(){var b;let g=n.getPos();l.value.includes(c.value)||(g+=1),(b=n.editor)==null||b.commands.setNodeSelection(g)}return a.watch(()=>n.getPos(),g=>{var b;(b=i.value)==null||b.setShow(!1)}),(g,b)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:i,placement:"left","content-class":"dropdown",trigger:"click",offset:[0,2],"onUpdate:show":h},{trigger:a.withCtx(()=>[a.createElementVNode("div",{class:a.normalizeClass(["o-drag-btn",{selected:s.value}]),contenteditable:"false",draggable:"true","data-drag-handle":"",onDragstart:d,onDragend:p},[a.createVNode(a.unref(St),{type:"tertiary",class:"o-node-btn"},{default:a.withCtx(()=>[a.createVNode(a.unref(re),{name:u.value.icon,color:u.value.color,small:""},null,8,["name","color"]),a.createVNode(a.unref(re),{name:"drag_indicator",small:""})]),_:1})],34)]),default:a.withCtx(()=>[a.createVNode(ax,a.mergeProps(n,{onAction:f}),null,16)]),_:1},512))}}),lx={key:0,class:"spinner"},cx={key:2,class:"o-btn__label"},St=a.defineComponent({__name:"OBtn",props:{icon:{type:String,default:""},iconClass:{type:[String,Object],default:""},label:{type:String,default:""},type:{type:String,default:""},loading:{type:Boolean,default:!1}},emits:["click"],setup(t,{emit:e}){const n=e;return(o,r)=>(a.openBlock(),a.createElementBlock("button",{class:a.normalizeClass(["o-btn",t.type?`type-${t.type}`:""]),onClick:r[0]||(r[0]=i=>n("click",i))},[t.loading?(a.openBlock(),a.createElementBlock("div",lx)):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[t.icon?(a.openBlock(),a.createBlock(a.unref(re),{key:0,name:t.icon,class:a.normalizeClass(t.iconClass)},null,8,["name","class"])):a.createCommentVNode("",!0)],64)),t.label?(a.openBlock(),a.createElementBlock("span",cx,a.toDisplayString(t.label),1)):a.createCommentVNode("",!0),a.renderSlot(o.$slots,"default")],2))}}),ux={class:"o-btn-group"},Hm=a.defineComponent({__name:"OBtnGroup",props:{icon:{type:String,default:""},iconClass:{type:[String,Object],default:""},label:{type:String,default:""},type:{type:String,default:""}},emits:["click"],setup(t,{emit:e}){return(n,o)=>(a.openBlock(),a.createElementBlock("div",ux,[a.renderSlot(n.$slots,"default")]))}}),dx={class:"o-checkbox"},px={class:"o-checkbox__main"},fx={class:"o-checkbox__suffix"},nu=a.defineComponent({__name:"OCheckbox",props:{modelValue:{type:Boolean,default:!1},label:{type:String,default:""}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,o=e,r=a.computed({get(){return n.modelValue},set(i){o("update:modelValue",i)}});return(i,s)=>(a.openBlock(),a.createElementBlock("div",dx,[a.createElementVNode("div",px,[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=l=>r.value=l),type:"checkbox"},null,512),[[a.vModelCheckbox,r.value]])]),a.createElementVNode("div",fx,a.toDisplayString(t.label),1)]))}}),Lt=a.defineComponent({__name:"ODivider",props:{vertical:{type:Boolean,default:!1}},setup(t){return(e,n)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["o-divider",{"o-divider-vertical":t.vertical}])},null,2))}}),hx={class:"o-input__prefix"},mx={class:"o-input__main"},gx=["placeholder"],bx={class:"o-input__suffix"},Ln=a.defineComponent({__name:"OInput",props:{modelValue:{type:String,default:""},placeholder:{type:String,default:""},clearable:{type:Boolean,default:!1},type:{type:String,default:""}},emits:["blur","focus","update:modelValue"],setup(t,{expose:e,emit:n}){const o=t,r=n,i=a.ref(null),s=a.computed({get(){return o.modelValue},set(u){r("update:modelValue",u)}});function l(){var u;(u=i.value)==null||u.focus()}function c(){s.value="",l()}return e({clear:c,focus:l}),(u,d)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["o-input",`type-${t.type}`])},[a.createElementVNode("div",hx,[a.renderSlot(u.$slots,"prefix")]),a.createElementVNode("div",mx,[a.withDirectives(a.createElementVNode("input",{ref_key:"input",ref:i,"onUpdate:modelValue":d[0]||(d[0]=p=>s.value=p),placeholder:t.placeholder,onFocus:d[1]||(d[1]=p=>r("focus")),onBlur:d[2]||(d[2]=p=>r("blur"))},null,40,gx),[[a.vModelText,s.value]])]),a.createElementVNode("div",bx,[a.renderSlot(u.$slots,"suffix"),t.clearable&&s.value?(a.openBlock(),a.createBlock(re,{key:0,name:"close",class:"clear o-tips",onClick:c})):a.createCommentVNode("",!0)])],2))}}),Qt=a.defineComponent({__name:"OList",props:{clickable:{type:Boolean,default:!1},hoverable:{type:Boolean,default:!1}},setup(t){return(e,n)=>(a.openBlock(),a.createElementBlock("ul",{class:a.normalizeClass(["o-list",{clickable:t.clickable,hoverable:t.hoverable}])},[a.renderSlot(e.$slots,"default")],2))}}),yx={class:"o-list-item"},vx={class:"o-list-item__prefix"},kx={class:"o-list-item__main"},wx={class:"o-list-item__suffix"},Ut=a.defineComponent({__name:"OListItem",props:{hoverable:{type:Boolean,default:!1}},setup(t){return(e,n)=>(a.openBlock(),a.createElementBlock("li",yx,[a.createElementVNode("div",vx,[a.renderSlot(e.$slots,"prefix")]),a.createElementVNode("div",kx,[a.renderSlot(e.$slots,"default")]),a.createElementVNode("div",wx,[a.renderSlot(e.$slots,"suffix")])]))}}),Pe=a.defineComponent({__name:"OPopover",props:{disable:{type:Boolean,default:!1},arrow:{type:Boolean,default:!1},offset:{type:Object,default:function(){return[0,10]}},placement:{type:String,default:"bottom-start"},trigger:{type:String,default:"mouseenter focus"},tippyClass:{type:String,default:"tippy"},contentClass:{type:String,default:""},event:{type:Object,default:function(){return{}}},delay:{type:Number,default:100},duration:{type:Number,default:200}},emits:["update:show"],setup(t,{expose:e,emit:n}){const o=t,r=n,{theme:i}=xr(),s=a.ref(null),l=a.ref(),c=a.ref();function u(h){var m,g,b,y;h?((g=c.value)==null||g.setProps({getReferenceClientRect:(m=o.event)!=null&&m.clientX?d:null}),(b=c.value)==null||b.show()):(y=c.value)==null||y.hide()}function d(){var h,m;return{width:0,height:0,left:o.event.clientX,right:o.event.clientX,top:o.event.clientY,bottom:o.event.clientY,x:((h=o.event)==null?void 0:h.clientX)||0,y:((m=o.event)==null?void 0:m.clientY)||0,toJSON:()=>{var g,b;return{width:100,height:100,left:((g=o.event)==null?void 0:g.clientX)||0,top:((b=o.event)==null?void 0:b.clientY)||0}}}}function p(){c.value=dn(s.value,{appendTo:()=>document.body,animation:"shift-away",arrow:o.arrow,content:l.value,duration:o.duration,delay:o.delay,interactive:!0,offset:o.offset,placement:o.placement,trigger:o.trigger,theme:i.value,onShow:h=>{h.popper.classList.add(o.tippyClass||"tippy"),r("update:show",!0)},onHide:h=>{r("update:show",!1)}})}function f(){c.value.setProps({theme:i.value})}return a.watch(i,h=>{f()}),e({setShow:u}),a.onMounted(()=>{p()}),a.onUnmounted(()=>{c.value&&c.value.destroy()}),(h,m)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"triggerRef",ref:s,"data-tippy-role":"popover",class:"o-popover"},[a.renderSlot(h.$slots,"trigger"),t.disable?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("div",{key:0,ref_key:"contentRef",ref:l,class:a.normalizeClass(["popover-content",t.contentClass])},[a.renderSlot(h.$slots,"default")],2))],512))}}),Um=[`
122
+ Certainly! Here's a detailed prompt you can use to instruct a Large Language Model (LLM) to act as a writing expert:
123
+
124
+ ---
125
+ `,`
126
+ **Prompt:**
127
+
128
+ "You are an expert writing assistant with extensive knowledge in crafting high-quality, engaging, and polished content across various genres and formats. Your expertise includes creative writing, technical writing, academic writing, business communication, and storytelling. Your goal is to assist users in generating, refining, and enhancing their written work while maintaining clarity, coherence, and style.
129
+ `,`
130
+ When responding to requests, follow these guidelines:
131
+
132
+ 1. **Understand the Purpose:** Clarify the intent, audience, and tone of the content before proceeding.
133
+ 2. **Provide Structure:** Offer clear outlines, logical flow, and well-organized ideas.
134
+ 3. **Enhance Creativity:** Use vivid language, metaphors, and storytelling techniques where appropriate.
135
+ 4. **Ensure Accuracy:** Fact-check information and maintain grammatical correctness.
136
+ 5. **Adapt to Style:** Match the tone, voice, and style to the user's needs (e.g., formal, casual, persuasive, descriptive).
137
+ 6. **Offer Suggestions:** Provide alternatives, improvements, or edits to elevate the quality of the text.
138
+ 7. **Be Concise:** Avoid unnecessary verbosity while ensuring the message is complete and impactful.
139
+ `,`
140
+ If the user provides a specific topic, text, or request, analyze it carefully and respond with tailored advice, examples, or revisions. If the request is vague, ask clarifying questions to better understand the user's needs.
141
+
142
+ Let’s begin! What type of writing assistance do you need today?"
143
+ `,`
144
+ ---
145
+
146
+ This prompt ensures the LLM acts as a professional writing assistant, capable of handling diverse writing tasks with precision and creativity. Let me know if you'd like further customization!
147
+ `],Ex=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,_x=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,qm=ln.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",_e(this.options.HTMLAttributes,t),0]},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[Wo({find:Ex,type:this.type})]},addPasteRules(){return[ko({find:_x,type:this.type})]}}),Km=De.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Ae({key:new xe("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:o}=this.editor,{anchor:r}=e,i=[];if(!n||!o)return Ne.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((c,u)=>{if(c.isText)return;if(!(r>=u&&r<=u+c.nodeSize-1))return!1;s+=1});let l=0;return t.descendants((c,u)=>{if(c.isText||!(r>=u&&r<=u+c.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";i.push(Ge.node(u,u+c.nodeSize,{class:this.options.className}))}),Ne.create(t,i)}}})]}}),Wm=De.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),jm=De.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()}}}),Cx=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Sx=ze.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",_e(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[va({find:Cx,type:this.type,getAttributes:t=>{const[,,e,n,o]=t;return{src:n,alt:e,title:o}}})]}}),xx="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Nx="ελ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",wr=(t,e)=>{for(const n in e)t[n]=e[n];return t},Gl="numeric",Yl="ascii",Jl="alpha",Gr="asciinumeric",Vr="alphanumeric",Xl="domain",Gm="emoji",Tx="scheme",Ox="slashscheme",al="whitespace";function Mx(t,e){return t in e||(e[t]=[]),e[t]}function Do(t,e,n){e[Gl]&&(e[Gr]=!0,e[Vr]=!0),e[Yl]&&(e[Gr]=!0,e[Jl]=!0),e[Gr]&&(e[Vr]=!0),e[Jl]&&(e[Vr]=!0),e[Vr]&&(e[Xl]=!0),e[Gm]&&(e[Xl]=!0);for(const o in e){const r=Mx(o,n);r.indexOf(t)<0&&r.push(t)}}function Ax(t,e){const n={};for(const o in e)e[o].indexOf(t)>=0&&(n[o]=!0);return n}function Ft(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Ft.groups={};Ft.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let o=0;o<e.jr.length;o++){const r=e.jr[o][0],i=e.jr[o][1];if(i&&r.test(t))return i}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,o){for(let r=0;r<t.length;r++)this.tt(t[r],e,n,o)},tr(t,e,n,o){o=o||Ft.groups;let r;return e&&e.j?r=e:(r=new Ft(e),n&&o&&Do(e,n,o)),this.jr.push([t,r]),r},ts(t,e,n,o){let r=this;const i=t.length;if(!i)return r;for(let s=0;s<i-1;s++)r=r.tt(t[s]);return r.tt(t[i-1],e,n,o)},tt(t,e,n,o){o=o||Ft.groups;const r=this;if(e&&e.j)return r.j[t]=e,e;const i=e;let s,l=r.go(t);if(l?(s=new Ft,wr(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new Ft,i){if(o)if(s.t&&typeof s.t=="string"){const c=wr(Ax(s.t,o),n);Do(i,c,o)}else n&&Do(i,n,o);s.t=i}return r.j[t]=s,s}};const ye=(t,e,n,o,r)=>t.ta(e,n,o,r),Xe=(t,e,n,o,r)=>t.tr(e,n,o,r),dp=(t,e,n,o,r)=>t.ts(e,n,o,r),D=(t,e,n,o,r)=>t.tt(e,n,o,r),Un="WORD",Zl="UWORD",Ym="ASCIINUMERICAL",Jm="ALPHANUMERICAL",mi="LOCALHOST",Ql="TLD",ec="UTLD",cs="SCHEME",rr="SLASH_SCHEME",ou="NUM",tc="WS",ru="NL",Yr="OPENBRACE",Jr="CLOSEBRACE",Os="OPENBRACKET",Ms="CLOSEBRACKET",As="OPENPAREN",Rs="CLOSEPAREN",Bs="OPENANGLEBRACKET",Ds="CLOSEANGLEBRACKET",Is="FULLWIDTHLEFTPAREN",Ls="FULLWIDTHRIGHTPAREN",Ps="LEFTCORNERBRACKET",$s="RIGHTCORNERBRACKET",Fs="LEFTWHITECORNERBRACKET",Vs="RIGHTWHITECORNERBRACKET",zs="FULLWIDTHLESSTHAN",Hs="FULLWIDTHGREATERTHAN",Us="AMPERSAND",iu="APOSTROPHE",qs="ASTERISK",ao="AT",Ks="BACKSLASH",Ws="BACKTICK",js="CARET",co="COLON",su="COMMA",Gs="DOLLAR",Nn="DOT",Ys="EQUALS",au="EXCLAMATION",nn="HYPHEN",Xr="PERCENT",Js="PIPE",Xs="PLUS",Zs="POUND",Zr="QUERY",lu="QUOTE",Xm="FULLWIDTHMIDDLEDOT",cu="SEMI",Tn="SLASH",Qr="TILDE",Qs="UNDERSCORE",Zm="EMOJI",ea="SYM";var Qm=Object.freeze({__proto__:null,WORD:Un,UWORD:Zl,ASCIINUMERICAL:Ym,ALPHANUMERICAL:Jm,LOCALHOST:mi,TLD:Ql,UTLD:ec,SCHEME:cs,SLASH_SCHEME:rr,NUM:ou,WS:tc,NL:ru,OPENBRACE:Yr,CLOSEBRACE:Jr,OPENBRACKET:Os,CLOSEBRACKET:Ms,OPENPAREN:As,CLOSEPAREN:Rs,OPENANGLEBRACKET:Bs,CLOSEANGLEBRACKET:Ds,FULLWIDTHLEFTPAREN:Is,FULLWIDTHRIGHTPAREN:Ls,LEFTCORNERBRACKET:Ps,RIGHTCORNERBRACKET:$s,LEFTWHITECORNERBRACKET:Fs,RIGHTWHITECORNERBRACKET:Vs,FULLWIDTHLESSTHAN:zs,FULLWIDTHGREATERTHAN:Hs,AMPERSAND:Us,APOSTROPHE:iu,ASTERISK:qs,AT:ao,BACKSLASH:Ks,BACKTICK:Ws,CARET:js,COLON:co,COMMA:su,DOLLAR:Gs,DOT:Nn,EQUALS:Ys,EXCLAMATION:au,HYPHEN:nn,PERCENT:Xr,PIPE:Js,PLUS:Xs,POUND:Zs,QUERY:Zr,QUOTE:lu,FULLWIDTHMIDDLEDOT:Xm,SEMI:cu,SLASH:Tn,TILDE:Qr,UNDERSCORE:Qs,EMOJI:Zm,SYM:ea});const zn=/[a-z]/,Br=new RegExp("\\p{L}","u"),ll=new RegExp("\\p{Emoji}","u"),Hn=/\d/,cl=/\s/,pp="\r",ul=`
148
+ `,Rx="️",Bx="‍",dl="";let Vi=null,zi=null;function Dx(t=[]){const e={};Ft.groups=e;const n=new Ft;Vi==null&&(Vi=fp(xx)),zi==null&&(zi=fp(Nx)),D(n,"'",iu),D(n,"{",Yr),D(n,"}",Jr),D(n,"[",Os),D(n,"]",Ms),D(n,"(",As),D(n,")",Rs),D(n,"<",Bs),D(n,">",Ds),D(n,"(",Is),D(n,")",Ls),D(n,"「",Ps),D(n,"」",$s),D(n,"『",Fs),D(n,"』",Vs),D(n,"<",zs),D(n,">",Hs),D(n,"&",Us),D(n,"*",qs),D(n,"@",ao),D(n,"`",Ws),D(n,"^",js),D(n,":",co),D(n,",",su),D(n,"$",Gs),D(n,".",Nn),D(n,"=",Ys),D(n,"!",au),D(n,"-",nn),D(n,"%",Xr),D(n,"|",Js),D(n,"+",Xs),D(n,"#",Zs),D(n,"?",Zr),D(n,'"',lu),D(n,"/",Tn),D(n,";",cu),D(n,"~",Qr),D(n,"_",Qs),D(n,"\\",Ks),D(n,"・",Xm);const o=Xe(n,Hn,ou,{[Gl]:!0});Xe(o,Hn,o);const r=Xe(o,zn,Ym,{[Gr]:!0}),i=Xe(o,Br,Jm,{[Vr]:!0}),s=Xe(n,zn,Un,{[Yl]:!0});Xe(s,Hn,r),Xe(s,zn,s),Xe(r,Hn,r),Xe(r,zn,r);const l=Xe(n,Br,Zl,{[Jl]:!0});Xe(l,zn),Xe(l,Hn,i),Xe(l,Br,l),Xe(i,Hn,i),Xe(i,zn),Xe(i,Br,i);const c=D(n,ul,ru,{[al]:!0}),u=D(n,pp,tc,{[al]:!0}),d=Xe(n,cl,tc,{[al]:!0});D(n,dl,d),D(u,ul,c),D(u,dl,d),Xe(u,cl,d),D(d,pp),D(d,ul),Xe(d,cl,d),D(d,dl,d);const p=Xe(n,ll,Zm,{[Gm]:!0});D(p,"#"),Xe(p,ll,p),D(p,Rx,p);const f=D(p,Bx);D(f,"#"),Xe(f,ll,p);const h=[[zn,s],[Hn,r]],m=[[zn,null],[Br,l],[Hn,i]];for(let g=0;g<Vi.length;g++)oo(n,Vi[g],Ql,Un,h);for(let g=0;g<zi.length;g++)oo(n,zi[g],ec,Zl,m);Do(Ql,{tld:!0,ascii:!0},e),Do(ec,{utld:!0,alpha:!0},e),oo(n,"file",cs,Un,h),oo(n,"mailto",cs,Un,h),oo(n,"http",rr,Un,h),oo(n,"https",rr,Un,h),oo(n,"ftp",rr,Un,h),oo(n,"ftps",rr,Un,h),Do(cs,{scheme:!0,ascii:!0},e),Do(rr,{slashscheme:!0,ascii:!0},e),t=t.sort((g,b)=>g[0]>b[0]?1:-1);for(let g=0;g<t.length;g++){const b=t[g][0],k=t[g][1]?{[Tx]:!0}:{[Ox]:!0};b.indexOf("-")>=0?k[Xl]=!0:zn.test(b)?Hn.test(b)?k[Gr]=!0:k[Yl]=!0:k[Gl]=!0,dp(n,b,b,k)}return dp(n,"localhost",mi,{ascii:!0}),n.jd=new Ft(ea),{start:n,tokens:wr({groups:e},Qm)}}function eg(t,e){const n=Ix(e.replace(/[A-Z]/g,l=>l.toLowerCase())),o=n.length,r=[];let i=0,s=0;for(;s<o;){let l=t,c=null,u=0,d=null,p=-1,f=-1;for(;s<o&&(c=l.go(n[s]));)l=c,l.accepts()?(p=0,f=0,d=l):p>=0&&(p+=n[s].length,f++),u+=n[s].length,i+=n[s].length,s++;i-=p,s-=f,u-=p,r.push({t:d.t,v:e.slice(i-u,i),s:i-u,e:i})}return r}function Ix(t){const e=[],n=t.length;let o=0;for(;o<n;){let r=t.charCodeAt(o),i,s=r<55296||r>56319||o+1===n||(i=t.charCodeAt(o+1))<56320||i>57343?t[o]:t.slice(o,o+2);e.push(s),o+=s.length}return e}function oo(t,e,n,o,r){let i;const s=e.length;for(let l=0;l<s-1;l++){const c=e[l];t.j[c]?i=t.j[c]:(i=new Ft(o),i.jr=r.slice(),t.j[c]=i),t=i}return i=new Ft(n),i.jr=r.slice(),t.j[e[s-1]]=i,i}function fp(t){const e=[],n=[];let o=0,r="0123456789";for(;o<t.length;){let i=0;for(;r.indexOf(t[o+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let s=parseInt(t.substring(o,o+i),10);s>0;s--)n.pop();o+=i}else n.push(t[o]),o++}return e}const gi={defaultProtocol:"http",events:null,format:hp,formatHref:hp,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function uu(t,e=null){let n=wr({},gi);t&&(n=wr(n,t instanceof uu?t.o:t));const o=n.ignoreTags,r=[];for(let i=0;i<o.length;i++)r.push(o[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=r}uu.prototype={o:gi,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const o=e!=null;let r=this.o[t];return r&&(typeof r=="object"?(r=n.t in r?r[n.t]:gi[t],typeof r=="function"&&o&&(r=r(e,n))):typeof r=="function"&&o&&(r=r(e,n.t,n)),r)},getObj(t,e,n){let o=this.o[t];return typeof o=="function"&&e!=null&&(o=o(e,n.t,n)),o},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function hp(t){return t}function tg(t,e){this.t="token",this.v=t,this.tk=e}tg.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),o=t.get("format",e,this);return n&&o.length>n?o.substring(0,n)+"…":o},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=gi.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")),o=t.get("formatHref",n,this),r=t.get("tagName",n,e),i=this.toFormattedString(t),s={},l=t.get("className",n,e),c=t.get("target",n,e),u=t.get("rel",n,e),d=t.getObj("attributes",n,e),p=t.getObj("events",n,e);return s.href=o,l&&(s.class=l),c&&(s.target=c),u&&(s.rel=u),d&&wr(s,d),{tagName:r,attributes:s,content:i,eventListeners:p}}};function Sa(t,e){class n extends tg{constructor(r,i){super(r,i),this.t=t}}for(const o in e)n.prototype[o]=e[o];return n.t=t,n}const mp=Sa("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),gp=Sa("text"),Lx=Sa("nl"),Hi=Sa("url",{isLink:!0,toHref(t=gi.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==mi&&t[1].t===co}}),tn=t=>new Ft(t);function Px({groups:t}){const e=t.domain.concat([Us,qs,ao,Ks,Ws,js,Gs,Ys,nn,ou,Xr,Js,Xs,Zs,Tn,ea,Qr,Qs]),n=[co,su,Nn,au,Xr,Zr,lu,cu,Bs,Ds,Yr,Jr,Ms,Os,As,Rs,Is,Ls,Ps,$s,Fs,Vs,zs,Hs],o=[Us,iu,qs,Ks,Ws,js,Gs,Ys,nn,Yr,Jr,Xr,Js,Xs,Zs,Zr,Tn,ea,Qr,Qs],r=tn(),i=D(r,Qr);ye(i,o,i),ye(i,t.domain,i);const s=tn(),l=tn(),c=tn();ye(r,t.domain,s),ye(r,t.scheme,l),ye(r,t.slashscheme,c),ye(s,o,i),ye(s,t.domain,s);const u=D(s,ao);D(i,ao,u),D(l,ao,u),D(c,ao,u);const d=D(i,Nn);ye(d,o,i),ye(d,t.domain,i);const p=tn();ye(u,t.domain,p),ye(p,t.domain,p);const f=D(p,Nn);ye(f,t.domain,p);const h=tn(mp);ye(f,t.tld,h),ye(f,t.utld,h),D(u,mi,h);const m=D(p,nn);D(m,nn,m),ye(m,t.domain,p),ye(h,t.domain,p),D(h,Nn,f),D(h,nn,m);const g=D(h,co);ye(g,t.numeric,mp);const b=D(s,nn),y=D(s,Nn);D(b,nn,b),ye(b,t.domain,s),ye(y,o,i),ye(y,t.domain,s);const k=tn(Hi);ye(y,t.tld,k),ye(y,t.utld,k),ye(k,t.domain,s),ye(k,o,i),D(k,Nn,y),D(k,nn,b),D(k,ao,u);const E=D(k,co),v=tn(Hi);ye(E,t.numeric,v);const C=tn(Hi),_=tn();ye(C,e,C),ye(C,n,_),ye(_,e,C),ye(_,n,_),D(k,Tn,C),D(v,Tn,C);const R=D(l,co),B=D(c,co),N=D(B,Tn),M=D(N,Tn);ye(l,t.domain,s),D(l,Nn,y),D(l,nn,b),ye(c,t.domain,s),D(c,Nn,y),D(c,nn,b),ye(R,t.domain,C),D(R,Tn,C),D(R,Zr,C),ye(M,t.domain,C),ye(M,e,C),D(M,Tn,C);const z=[[Yr,Jr],[Os,Ms],[As,Rs],[Bs,Ds],[Is,Ls],[Ps,$s],[Fs,Vs],[zs,Hs]];for(let G=0;G<z.length;G++){const[$,U]=z[G],q=D(C,$);D(_,$,q),D(q,U,C);const ee=tn(Hi);ye(q,e,ee);const S=tn();ye(q,n),ye(ee,e,ee),ye(ee,n,S),ye(S,e,ee),ye(S,n,S),D(ee,U,C),D(S,U,C)}return D(r,mi,k),D(r,ru,Lx),{start:r,tokens:Qm}}function $x(t,e,n){let o=n.length,r=0,i=[],s=[];for(;r<o;){let l=t,c=null,u=null,d=0,p=null,f=-1;for(;r<o&&!(c=l.go(n[r].t));)s.push(n[r++]);for(;r<o&&(u=c||l.go(n[r].t));)c=null,l=u,l.accepts()?(f=0,p=l):f>=0&&f++,r++,d++;if(f<0)r-=d,r<o&&(s.push(n[r]),r++);else{s.length>0&&(i.push(pl(gp,e,s)),s=[]),r-=f,d-=f;const h=p.t,m=n.slice(r-d,r);i.push(pl(h,e,m))}}return s.length>0&&i.push(pl(gp,e,s)),i}function pl(t,e,n){const o=n[0].s,r=n[n.length-1].e,i=e.slice(o,r);return new t(i,n)}const Fx=typeof console<"u"&&console&&console.warn||(()=>{}),Vx="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 zx(){return Ft.groups={},je.scanner=null,je.parser=null,je.tokenQueue=[],je.pluginQueue=[],je.customSchemes=[],je.initialized=!1,je}function bp(t,e=!1){if(je.initialized&&Fx(`linkifyjs: already initialized - will not register custom scheme "${t}" ${Vx}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
149
+ 1. Must only contain digits, lowercase ASCII letters or "-"
150
+ 2. Cannot start or end with "-"
151
+ 3. "-" cannot repeat`);je.customSchemes.push([t,e])}function Hx(){je.scanner=Dx(je.customSchemes);for(let t=0;t<je.tokenQueue.length;t++)je.tokenQueue[t][1]({scanner:je.scanner});je.parser=Px(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 du(t){return je.initialized||Hx(),$x(je.parser.start,t,eg(je.scanner.start,t))}du.scan=eg;function ng(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 o=new uu(n),r=du(t),i=[];for(let s=0;s<r.length;s++){const l=r[s];l.isLink&&(!e||l.t===e)&&o.check(l)&&i.push(l.toFormattedObject(o))}return i}function Ux(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function qx(t){return new Ae({key:new xe("autolink"),appendTransaction:(e,n,o)=>{const r=e.some(u=>u.docChanged)&&!n.doc.eq(o.doc),i=e.some(u=>u.getMeta("preventAutolink"));if(!r||i)return;const{tr:s}=o,l=jw(n.doc,[...e]);if(tE(l).forEach(({newRange:u})=>{const d=Yw(o.doc,u,h=>h.isTextblock);let p,f;if(d.length>1?(p=d[0],f=o.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ")):d.length&&o.doc.textBetween(u.from,u.to," "," ").endsWith(" ")&&(p=d[0],f=o.doc.textBetween(p.pos,u.to,void 0," ")),p&&f){const h=f.split(" ").filter(y=>y!=="");if(h.length<=0)return!1;const m=h[h.length-1],g=p.pos+f.lastIndexOf(m);if(!m)return!1;const b=du(m).map(y=>y.toObject(t.defaultProtocol));if(!Ux(b))return!1;b.filter(y=>y.isLink).map(y=>({...y,from:g+y.start+1,to:g+y.end+1})).filter(y=>o.schema.marks.code?!o.doc.rangeHasMark(y.from,y.to,o.schema.marks.code):!0).filter(y=>t.validate(y.value)).filter(y=>t.shouldAutoLink(y.value)).forEach(y=>{Bc(y.from,y.to,o.doc).some(k=>k.mark.type===t.type)||s.addMark(y.from,y.to,t.type.create({href:y.href}))})}}),!!s.steps.length)return s}})}function Kx(t){return new Ae({key:new xe("handleClickLink"),props:{handleClick:(e,n,o)=>{var r,i;if(o.button!==0||!e.editable)return!1;let s=o.target;const l=[];for(;s.nodeName!=="DIV";)l.push(s),s=s.parentNode;if(!l.find(f=>f.nodeName==="A"))return!1;const c=Lh(e.state,t.type.name),u=o.target,d=(r=u==null?void 0:u.href)!==null&&r!==void 0?r:c.href,p=(i=u==null?void 0:u.target)!==null&&i!==void 0?i:c.target;return u&&d?(window.open(d,p),!0):!1}}})}function Wx(t){return new Ae({key:new xe("handlePasteLink"),props:{handlePaste:(e,n,o)=>{const{state:r}=e,{selection:i}=r,{empty:s}=i;if(s)return!1;let l="";o.content.forEach(u=>{l+=u.textContent});const c=ng(l,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===l);return!l||!c?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}const jx=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function No(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(o=>{const r=typeof o=="string"?o:o.scheme;r&&n.push(r)}),!t||t.replace(jx,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const pu=ln.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"){bp(t);return}bp(t.scheme,t.optionalSlashes)})},onDestroy(){zx()},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)=>!!No(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=>!!No(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=>!!No(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",_e(this.options.HTMLAttributes,t),0]:["a",_e(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:o=>!!No(o,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:o=>!!No(o,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[ko({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:o}=this.options,r=ng(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!No(s,n),protocols:n,defaultProtocol:o}));r.length&&r.forEach(i=>e.push({text:i.value,data:{href:i.href},index:i.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(qx({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:o=>this.options.isAllowedUri(o,{defaultValidate:r=>!!No(r,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(Kx({type:this.type})),this.options.linkOnPaste&&t.push(Wx({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});function Gx(t){var e;const{char:n,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:l}=t,c=o&&!r,u=Fh(n),d=new RegExp(`\\s${u}$`),p=s?"^":"",f=r?"":u,h=c?new RegExp(`${p}${u}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${p}(?:^)?${u}[^\\s${f}]*`,"gm"),m=((e=l.nodeBefore)===null||e===void 0?void 0:e.isText)&&l.nodeBefore.text;if(!m)return null;const g=l.pos-m.length,b=Array.from(m.matchAll(h)).pop();if(!b||b.input===void 0||b.index===void 0)return null;const y=b.input.slice(Math.max(0,b.index-1),b.index),k=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(y);if(i!==null&&!k)return null;const E=g+b.index;let v=E+b[0].length;return c&&d.test(m.slice(v-1,v+1))&&(b[0]+=" ",v+=1),E<l.pos&&v>=l.pos?{range:{from:E,to:v},query:b[0].slice(n.length),text:b[0]}:null}const Yx=new xe("suggestion");function Jx({pluginKey:t=Yx,editor:e,char:n="@",allowSpaces:o=!1,allowToIncludeChar:r=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:l="span",decorationClass:c="suggestion",command:u=()=>null,items:d=()=>[],render:p=()=>({}),allow:f=()=>!0,findSuggestionMatch:h=Gx}){let m;const g=p==null?void 0:p(),b=new Ae({key:t,view(){return{update:async(y,k)=>{var E,v,C,_,R,B,N;const M=(E=this.key)===null||E===void 0?void 0:E.getState(k),z=(v=this.key)===null||v===void 0?void 0:v.getState(y.state),G=M.active&&z.active&&M.range.from!==z.range.from,$=!M.active&&z.active,U=M.active&&!z.active,q=!$&&!U&&M.query!==z.query,ee=$||G&&q,S=q||G,O=U||G&&q;if(!ee&&!S&&!O)return;const F=O&&!ee?M:z,J=y.dom.querySelector(`[data-decoration-id="${F.decorationId}"]`);m={editor:e,range:F.range,query:F.query,text:F.text,items:[],command:Q=>u({editor:e,range:F.range,props:Q}),decorationNode:J,clientRect:J?()=>{var Q;const{decorationId:ce}=(Q=this.key)===null||Q===void 0?void 0:Q.getState(e.state),Ce=y.dom.querySelector(`[data-decoration-id="${ce}"]`);return(Ce==null?void 0:Ce.getBoundingClientRect())||null}:null},ee&&((C=g==null?void 0:g.onBeforeStart)===null||C===void 0||C.call(g,m)),S&&((_=g==null?void 0:g.onBeforeUpdate)===null||_===void 0||_.call(g,m)),(S||ee)&&(m.items=await d({editor:e,query:F.query})),O&&((R=g==null?void 0:g.onExit)===null||R===void 0||R.call(g,m)),S&&((B=g==null?void 0:g.onUpdate)===null||B===void 0||B.call(g,m)),ee&&((N=g==null?void 0:g.onStart)===null||N===void 0||N.call(g,m))},destroy:()=>{var y;m&&((y=g==null?void 0:g.onExit)===null||y===void 0||y.call(g,m))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(y,k,E,v){const{isEditable:C}=e,{composing:_}=e.view,{selection:R}=y,{empty:B,from:N}=R,M={...k};if(M.composing=_,C&&(B||e.view.composing)){(N<k.range.from||N>k.range.to)&&!_&&!k.composing&&(M.active=!1);const z=h({char:n,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:R.$from}),G=`id_${Math.floor(Math.random()*4294967295)}`;z&&f({editor:e,state:v,range:z.range,isActive:k.active})?(M.active=!0,M.decorationId=k.decorationId?k.decorationId:G,M.range=z.range,M.query=z.query,M.text=z.text):M.active=!1}else M.active=!1;return M.active||(M.decorationId=null,M.range={from:0,to:0},M.query=null,M.text=null),M}},props:{handleKeyDown(y,k){var E;const{active:v,range:C}=b.getState(y.state);return v&&((E=g==null?void 0:g.onKeyDown)===null||E===void 0?void 0:E.call(g,{view:y,event:k,range:C}))||!1},decorations(y){const{active:k,range:E,decorationId:v}=b.getState(y);return k?Ne.create(y.doc,[Ge.inline(E.from,E.to,{nodeName:l,class:c,"data-decoration-id":v})]):null}}});return b}const Xx=new xe("mention"),Zx=ze.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({options:t,node:e}){var n;return`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e}){var n;return["span",_e(this.HTMLAttributes,t.HTMLAttributes),`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`]},suggestion:{char:"@",pluginKey:Xx,command:({editor:t,range:e,props:n})=>{var o,r,i;const s=t.view.state.selection.$to.nodeAfter;((o=s==null?void 0:s.text)===null||o===void 0?void 0:o.startsWith(" "))&&(e.to+=1),t.chain().focus().insertContentAt(e,[{type:this.name,attrs:n},{type:"text",text:" "}]).run(),(i=(r=t.view.dom.ownerDocument.defaultView)===null||r===void 0?void 0:r.getSelection())===null||i===void 0||i.collapseToEnd()},allow:({state:t,range:e})=>{const n=t.doc.resolve(e.from),o=t.schema.nodes[this.name];return!!n.parent.type.contentMatch.matchType(o)}}}},group:"inline",inline:!0,selectable:!1,atom:!0,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}:{}}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",_e({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t})];const n={...this.options};n.HTMLAttributes=_e({"data-type":this.name},this.options.HTMLAttributes,e);const o=this.options.renderHTML({options:n,node:t});return typeof o=="string"?["span",_e({"data-type":this.name},this.options.HTMLAttributes,e),o]:o},renderText({node:t}){return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel({options:this.options,node:t})):this.options.renderText({options:this.options,node:t})},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:o}=e,{empty:r,anchor:i}=o;return r?(e.doc.nodesBetween(i-1,i,(s,l)=>{if(s.type.name===this.name)return n=!0,t.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",l,l+s.nodeSize),!1}),n):!1})}},addProseMirrorPlugins(){return[Jx({editor:this.editor,...this.options.suggestion})]}}),Qx=/^\s*(\[([( |x])?\])\s$/,og=ze.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",_e(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:o})=>{const r=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),c=document.createElement("div");return i.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",u=>u.preventDefault()),l.addEventListener("change",u=>{if(!o.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:d}=u.target;o.isEditable&&typeof n=="function"&&o.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const f=n();if(typeof f!="number")return!1;const h=p.doc.nodeAt(f);return p.setNodeMarkup(f,void 0,{...h==null?void 0:h.attrs,checked:d}),!0}).run(),!o.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,d)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,d])=>{r.setAttribute(u,d)}),r.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,i.append(l,s),r.append(i,c),Object.entries(e).forEach(([u,d])=>{r.setAttribute(u,d)}),{dom:r,contentDOM:c,update:u=>u.type!==this.type?!1:(r.dataset.checked=u.attrs.checked,l.checked=u.attrs.checked,!0)}}},addInputRules(){return[mr({find:Qx,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),rg=ze.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",_e(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),ig=De.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e)}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),eN=t=>et({find:/--$/,replace:t??"—"}),tN=t=>et({find:/\.\.\.$/,replace:t??"…"}),nN=t=>et({find:/(?:^|[\s{[(<'"\u2018\u201C])(")$/,replace:t??"“"}),oN=t=>et({find:/"$/,replace:t??"”"}),rN=t=>et({find:/(?:^|[\s{[(<'"\u2018\u201C])(')$/,replace:t??"‘"}),iN=t=>et({find:/'$/,replace:t??"’"}),sN=t=>et({find:/<-$/,replace:t??"←"}),aN=t=>et({find:/->$/,replace:t??"→"}),lN=t=>et({find:/\(c\)$/,replace:t??"©"}),cN=t=>et({find:/\(tm\)$/,replace:t??"™"}),uN=t=>et({find:/\(sm\)$/,replace:t??"℠"}),dN=t=>et({find:/\(r\)$/,replace:t??"®"}),pN=t=>et({find:/(?:^|\s)(1\/2)\s$/,replace:t??"½"}),fN=t=>et({find:/\+\/-$/,replace:t??"±"}),hN=t=>et({find:/!=$/,replace:t??"≠"}),mN=t=>et({find:/<<$/,replace:t??"«"}),gN=t=>et({find:/>>$/,replace:t??"»"}),bN=t=>et({find:/\d+\s?([*x])\s?\d+$/,replace:t??"×"}),yN=t=>et({find:/\^2$/,replace:t??"²"}),vN=t=>et({find:/\^3$/,replace:t??"³"}),kN=t=>et({find:/(?:^|\s)(1\/4)\s$/,replace:t??"¼"}),wN=t=>et({find:/(?:^|\s)(3\/4)\s$/,replace:t??"¾"}),sg=De.create({name:"typography",addOptions(){return{closeDoubleQuote:"”",closeSingleQuote:"’",copyright:"©",ellipsis:"…",emDash:"—",laquo:"«",leftArrow:"←",multiplication:"×",notEqual:"≠",oneHalf:"½",oneQuarter:"¼",openDoubleQuote:"“",openSingleQuote:"‘",plusMinus:"±",raquo:"»",registeredTrademark:"®",rightArrow:"→",servicemark:"℠",superscriptThree:"³",superscriptTwo:"²",threeQuarters:"¾",trademark:"™"}},addInputRules(){const t=[];return this.options.emDash!==!1&&t.push(eN(this.options.emDash)),this.options.ellipsis!==!1&&t.push(tN(this.options.ellipsis)),this.options.openDoubleQuote!==!1&&t.push(nN(this.options.openDoubleQuote)),this.options.closeDoubleQuote!==!1&&t.push(oN(this.options.closeDoubleQuote)),this.options.openSingleQuote!==!1&&t.push(rN(this.options.openSingleQuote)),this.options.closeSingleQuote!==!1&&t.push(iN(this.options.closeSingleQuote)),this.options.leftArrow!==!1&&t.push(sN(this.options.leftArrow)),this.options.rightArrow!==!1&&t.push(aN(this.options.rightArrow)),this.options.copyright!==!1&&t.push(lN(this.options.copyright)),this.options.trademark!==!1&&t.push(cN(this.options.trademark)),this.options.servicemark!==!1&&t.push(uN(this.options.servicemark)),this.options.registeredTrademark!==!1&&t.push(dN(this.options.registeredTrademark)),this.options.oneHalf!==!1&&t.push(pN(this.options.oneHalf)),this.options.plusMinus!==!1&&t.push(fN(this.options.plusMinus)),this.options.notEqual!==!1&&t.push(hN(this.options.notEqual)),this.options.laquo!==!1&&t.push(mN(this.options.laquo)),this.options.raquo!==!1&&t.push(gN(this.options.raquo)),this.options.multiplication!==!1&&t.push(bN(this.options.multiplication)),this.options.superscriptTwo!==!1&&t.push(yN(this.options.superscriptTwo)),this.options.superscriptThree!==!1&&t.push(vN(this.options.superscriptThree)),this.options.oneQuarter!==!1&&t.push(kN(this.options.oneQuarter)),this.options.threeQuarters!==!1&&t.push(wN(this.options.threeQuarters)),t}}),ag=ln.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",_e(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()}}});var nc,oc;if(typeof WeakMap<"u"){let t=new WeakMap;nc=e=>t.get(e),oc=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;nc=o=>{for(let r=0;r<t.length;r+=2)if(t[r]==o)return t[r+1]},oc=(o,r)=>(n==10&&(n=0),t[n++]=o,t[n++]=r)}var Qe=class{constructor(t,e,n,o){this.width=t,this.height=e,this.map=n,this.problems=o}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const o=e%this.width,r=e/this.width|0;let i=o+1,s=r+1;for(let l=1;i<this.width&&this.map[e+l]==n;l++)i++;for(let l=1;s<this.height&&this.map[e+this.width*l]==n;l++)s++;return{left:o,top:r,right:i,bottom:s}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:o,right:r,top:i,bottom:s}=this.findCell(t);return e=="horiz"?(n<0?o==0:r==this.width)?null:this.map[i*this.width+(n<0?o-1:r)]:(n<0?i==0:s==this.height)?null:this.map[o+this.width*(n<0?i-1:s)]}rectBetween(t,e){const{left:n,right:o,top:r,bottom:i}=this.findCell(t),{left:s,right:l,top:c,bottom:u}=this.findCell(e);return{left:Math.min(n,s),top:Math.min(r,c),right:Math.max(o,l),bottom:Math.max(i,u)}}cellsInRect(t){const e=[],n={};for(let o=t.top;o<t.bottom;o++)for(let r=t.left;r<t.right;r++){const i=o*this.width+r,s=this.map[i];n[s]||(n[s]=!0,!(r==t.left&&r&&this.map[i-1]==s||o==t.top&&o&&this.map[i-this.width]==s)&&e.push(s))}return e}positionAt(t,e,n){for(let o=0,r=0;;o++){const i=r+n.child(o).nodeSize;if(o==t){let s=e+t*this.width;const l=(t+1)*this.width;for(;s<l&&this.map[s]<r;)s++;return s==l?i-1:this.map[s]}r=i}}static get(t){return nc(t)||oc(t,EN(t))}};function EN(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=_N(t),n=t.childCount,o=[];let r=0,i=null;const s=[];for(let u=0,d=e*n;u<d;u++)o[u]=0;for(let u=0,d=0;u<n;u++){const p=t.child(u);d++;for(let m=0;;m++){for(;r<o.length&&o[r]!=0;)r++;if(m==p.childCount)break;const g=p.child(m),{colspan:b,rowspan:y,colwidth:k}=g.attrs;for(let E=0;E<y;E++){if(E+u>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:d,n:y-E});break}const v=r+E*e;for(let C=0;C<b;C++){o[v+C]==0?o[v+C]=d:(i||(i=[])).push({type:"collision",row:u,pos:d,n:b-C});const _=k&&k[C];if(_){const R=(v+C)%e*2,B=s[R];B==null||B!=_&&s[R+1]==1?(s[R]=_,s[R+1]=1):B==_&&s[R+1]++}}}r+=b,d+=g.nodeSize}const f=(u+1)*e;let h=0;for(;r<f;)o[r++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:u,n:h}),d++}(e===0||n===0)&&(i||(i=[])).push({type:"zero_sized"});const l=new Qe(e,n,o,i);let c=!1;for(let u=0;!c&&u<s.length;u+=2)s[u]!=null&&s[u+1]<n&&(c=!0);return c&&CN(l,s,t),l}function _N(t){let e=-1,n=!1;for(let o=0;o<t.childCount;o++){const r=t.child(o);let i=0;if(n)for(let s=0;s<o;s++){const l=t.child(s);for(let c=0;c<l.childCount;c++){const u=l.child(c);s+u.attrs.rowspan>o&&(i+=u.attrs.colspan)}}for(let s=0;s<r.childCount;s++){const l=r.child(s);i+=l.attrs.colspan,l.attrs.rowspan>1&&(n=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function CN(t,e,n){t.problems||(t.problems=[]);const o={};for(let r=0;r<t.map.length;r++){const i=t.map[r];if(o[i])continue;o[i]=!0;const s=n.nodeAt(i);if(!s)throw new RangeError(`No cell with offset ${i} found`);let l=null;const c=s.attrs;for(let u=0;u<c.colspan;u++){const d=(r+u)%t.width,p=e[d*2];p!=null&&(!c.colwidth||c.colwidth[u]!=p)&&((l||(l=SN(c)))[u]=p)}l&&t.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function SN(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function xt(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const o=t.nodes[n],r=o.spec.tableRole;r&&(e[r]=o)}}return e}var uo=new xe("selectingCells");function Nr(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function xN(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function wn(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function xa(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=Nr(e.$head)||NN(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function NN(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function rc(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function TN(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function fu(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function lg(t,e,n){const o=t.node(-1),r=Qe.get(o),i=t.start(-1),s=r.nextCell(t.pos-i,e,n);return s==null?null:t.node(0).resolve(i+s)}function Go(t,e,n=1){const o={...t,colspan:t.colspan-n};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(e,n),o.colwidth.some(r=>r>0)||(o.colwidth=null)),o}function cg(t,e,n=1){const o={...t,colspan:t.colspan+n};if(o.colwidth){o.colwidth=o.colwidth.slice();for(let r=0;r<n;r++)o.colwidth.splice(e,0,0)}return o}function ON(t,e,n){const o=xt(e.type.schema).header_cell;for(let r=0;r<t.height;r++)if(e.nodeAt(t.map[n+r*t.width]).type!=o)return!1;return!0}var Ve=class qn extends ae{constructor(e,n=e){const o=e.node(-1),r=Qe.get(o),i=e.start(-1),s=r.rectBetween(e.pos-i,n.pos-i),l=e.node(0),c=r.cellsInRect(s).filter(d=>d!=n.pos-i);c.unshift(n.pos-i);const u=c.map(d=>{const p=o.nodeAt(d);if(!p)throw RangeError(`No cell with offset ${d} found`);const f=i+d+1;return new Mf(l.resolve(f),l.resolve(f+p.content.size))});super(u[0].$from,u[0].$to,u),this.$anchorCell=e,this.$headCell=n}map(e,n){const o=e.resolve(n.map(this.$anchorCell.pos)),r=e.resolve(n.map(this.$headCell.pos));if(rc(o)&&rc(r)&&fu(o,r)){const i=this.$anchorCell.node(-1)!=o.node(-1);return i&&this.isRowSelection()?qn.rowSelection(o,r):i&&this.isColSelection()?qn.colSelection(o,r):new qn(o,r)}return ne.between(o,r)}content(){const e=this.$anchorCell.node(-1),n=Qe.get(e),o=this.$anchorCell.start(-1),r=n.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o),i={},s=[];for(let c=r.top;c<r.bottom;c++){const u=[];for(let d=c*n.width+r.left,p=r.left;p<r.right;p++,d++){const f=n.map[d];if(i[f])continue;i[f]=!0;const h=n.findCell(f);let m=e.nodeAt(f);if(!m)throw RangeError(`No cell with offset ${f} found`);const g=r.left-h.left,b=h.right-r.right;if(g>0||b>0){let y=m.attrs;if(g>0&&(y=Go(y,0,g)),b>0&&(y=Go(y,y.colspan-b,b)),h.left<r.left){if(m=m.type.createAndFill(y),!m)throw RangeError(`Could not create cell with attrs ${JSON.stringify(y)}`)}else m=m.type.create(y,m.content)}if(h.top<r.top||h.bottom>r.bottom){const y={...m.attrs,rowspan:Math.min(h.bottom,r.bottom)-Math.max(h.top,r.top)};h.top<r.top?m=m.type.createAndFill(y):m=m.type.create(y,m.content)}u.push(m)}s.push(e.child(c).copy(A.from(u)))}const l=this.isColSelection()&&this.isRowSelection()?e:s;return new V(A.from(l),1,1)}replace(e,n=V.empty){const o=e.steps.length,r=this.ranges;for(let s=0;s<r.length;s++){const{$from:l,$to:c}=r[s],u=e.mapping.slice(o);e.replace(u.map(l.pos),u.map(c.pos),s?V.empty:n)}const i=ae.findFrom(e.doc.resolve(e.mapping.slice(o).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,n){this.replace(e,new V(A.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),o=Qe.get(n),r=this.$anchorCell.start(-1),i=o.cellsInRect(o.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let s=0;s<i.length;s++)e(n.nodeAt(i[s]),r+i[s])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const o=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(o,r)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const o=e.node(-1),r=Qe.get(o),i=e.start(-1),s=r.findCell(e.pos-i),l=r.findCell(n.pos-i),c=e.node(0);return s.top<=l.top?(s.top>0&&(e=c.resolve(i+r.map[s.left])),l.bottom<r.height&&(n=c.resolve(i+r.map[r.width*(r.height-1)+l.right-1]))):(l.top>0&&(n=c.resolve(i+r.map[l.left])),s.bottom<r.height&&(e=c.resolve(i+r.map[r.width*(r.height-1)+s.right-1]))),new qn(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=Qe.get(e),o=this.$anchorCell.start(-1),r=n.colCount(this.$anchorCell.pos-o),i=n.colCount(this.$headCell.pos-o);if(Math.min(r,i)>0)return!1;const s=r+this.$anchorCell.nodeAfter.attrs.colspan,l=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==n.width}eq(e){return e instanceof qn&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const o=e.node(-1),r=Qe.get(o),i=e.start(-1),s=r.findCell(e.pos-i),l=r.findCell(n.pos-i),c=e.node(0);return s.left<=l.left?(s.left>0&&(e=c.resolve(i+r.map[s.top*r.width])),l.right<r.width&&(n=c.resolve(i+r.map[r.width*(l.top+1)-1]))):(l.left>0&&(n=c.resolve(i+r.map[l.top*r.width])),s.right<r.width&&(e=c.resolve(i+r.map[r.width*(s.top+1)-1]))),new qn(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new qn(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,o=n){return new qn(e.resolve(n),e.resolve(o))}getBookmark(){return new MN(this.$anchorCell.pos,this.$headCell.pos)}};Ve.prototype.visible=!1;ae.jsonID("cell",Ve);var MN=class ug{constructor(e,n){this.anchor=e,this.head=n}map(e){return new ug(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),o=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&o.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&o.index()<o.parent.childCount&&fu(n,o)?new Ve(n,o):ae.near(o,1)}};function AN(t){if(!(t.selection instanceof Ve))return null;const e=[];return t.selection.forEachCell((n,o)=>{e.push(Ge.node(o,o+n.nodeSize,{class:"selectedCell"}))}),Ne.create(t.doc,e)}function RN({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,o=e.pos,r=t.depth;for(;r>=0&&!(t.after(r+1)<t.end(r));r--,n++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,o--);return n==o&&/row|table/.test(t.node(r).type.spec.tableRole)}function BN({$from:t,$to:e}){let n,o;for(let r=t.depth;r>0;r--){const i=t.node(r);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){n=i;break}}for(let r=e.depth;r>0;r--){const i=e.node(r);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){o=i;break}}return n!==o&&e.parentOffset===0}function DN(t,e,n){const o=(e||t).selection,r=(e||t).doc;let i,s;if(o instanceof oe&&(s=o.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")i=Ve.create(r,o.from);else if(s=="row"){const l=r.resolve(o.from+1);i=Ve.rowSelection(l,l)}else if(!n){const l=Qe.get(o.node),c=o.from+1,u=c+l.map[l.width*l.height-1];i=Ve.create(r,c+1,u)}}else o instanceof ne&&RN(o)?i=ne.create(r,o.from):o instanceof ne&&BN(o)&&(i=ne.create(r,o.$from.start(),o.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}var IN=new xe("fix-tables");function dg(t,e,n,o){const r=t.childCount,i=e.childCount;e:for(let s=0,l=0;s<i;s++){const c=e.child(s);for(let u=l,d=Math.min(r,s+3);u<d;u++)if(t.child(u)==c){l=u+1,n+=c.nodeSize;continue e}o(c,n),l<r&&t.child(l).sameMarkup(c)?dg(t.child(l),c,n+1,o):c.nodesBetween(0,c.content.size,o,n+1),n+=c.nodeSize}}function pg(t,e){let n;const o=(r,i)=>{r.type.spec.tableRole=="table"&&(n=LN(t,r,i,n))};return e?e.doc!=t.doc&&dg(e.doc,t.doc,0,o):t.doc.descendants(o),n}function LN(t,e,n,o){const r=Qe.get(e);if(!r.problems)return o;o||(o=t.tr);const i=[];for(let c=0;c<r.height;c++)i.push(0);for(let c=0;c<r.problems.length;c++){const u=r.problems[c];if(u.type=="collision"){const d=e.nodeAt(u.pos);if(!d)continue;const p=d.attrs;for(let f=0;f<p.rowspan;f++)i[u.row+f]+=u.n;o.setNodeMarkup(o.mapping.map(n+1+u.pos),null,Go(p,p.colspan-u.n,u.n))}else if(u.type=="missing")i[u.row]+=u.n;else if(u.type=="overlong_rowspan"){const d=e.nodeAt(u.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(n+1+u.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-u.n})}else if(u.type=="colwidth mismatch"){const d=e.nodeAt(u.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(n+1+u.pos),null,{...d.attrs,colwidth:u.colwidth})}else if(u.type=="zero_sized"){const d=o.mapping.map(n);o.delete(d,d+e.nodeSize)}}let s,l;for(let c=0;c<i.length;c++)i[c]&&(s==null&&(s=c),l=c);for(let c=0,u=n+1;c<r.height;c++){const d=e.child(c),p=u+d.nodeSize,f=i[c];if(f>0){let h="cell";d.firstChild&&(h=d.firstChild.type.spec.tableRole);const m=[];for(let b=0;b<f;b++){const y=xt(t.schema)[h].createAndFill();y&&m.push(y)}const g=(c==0||s==c-1)&&l==c?u+1:p-1;o.insert(o.mapping.map(g),m)}u=p}return o.setMeta(IN,{fixTables:!0})}function $n(t){const e=t.selection,n=xa(t),o=n.node(-1),r=n.start(-1),i=Qe.get(o);return{...e instanceof Ve?i.rectBetween(e.$anchorCell.pos-r,e.$headCell.pos-r):i.findCell(n.pos-r),tableStart:r,map:i,table:o}}function fg(t,{map:e,tableStart:n,table:o},r){let i=r>0?-1:0;ON(e,o,r+i)&&(i=r==0||r==e.width?null:0);for(let s=0;s<e.height;s++){const l=s*e.width+r;if(r>0&&r<e.width&&e.map[l-1]==e.map[l]){const c=e.map[l],u=o.nodeAt(c);t.setNodeMarkup(t.mapping.map(n+c),null,cg(u.attrs,r-e.colCount(c))),s+=u.attrs.rowspan-1}else{const c=i==null?xt(o.type.schema).cell:o.nodeAt(e.map[l+i]).type,u=e.positionAt(s,r,o);t.insert(t.mapping.map(n+u),c.createAndFill())}}return t}function PN(t,e){if(!wn(t))return!1;if(e){const n=$n(t);e(fg(t.tr,n,n.left))}return!0}function $N(t,e){if(!wn(t))return!1;if(e){const n=$n(t);e(fg(t.tr,n,n.right))}return!0}function FN(t,{map:e,table:n,tableStart:o},r){const i=t.mapping.maps.length;for(let s=0;s<e.height;){const l=s*e.width+r,c=e.map[l],u=n.nodeAt(c),d=u.attrs;if(r>0&&e.map[l-1]==c||r<e.width-1&&e.map[l+1]==c)t.setNodeMarkup(t.mapping.slice(i).map(o+c),null,Go(d,r-e.colCount(c)));else{const p=t.mapping.slice(i).map(o+c);t.delete(p,p+u.nodeSize)}s+=d.rowspan}}function VN(t,e){if(!wn(t))return!1;if(e){const n=$n(t),o=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let r=n.right-1;FN(o,n,r),r!=n.left;r--){const i=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!i)throw RangeError("No table found");n.table=i,n.map=Qe.get(i)}e(o)}return!0}function zN(t,e,n){var o;const r=xt(e.type.schema).header_cell;for(let i=0;i<t.width;i++)if(((o=e.nodeAt(t.map[i+n*t.width]))==null?void 0:o.type)!=r)return!1;return!0}function hg(t,{map:e,tableStart:n,table:o},r){var i;let s=n;for(let u=0;u<r;u++)s+=o.child(u).nodeSize;const l=[];let c=r>0?-1:0;zN(e,o,r+c)&&(c=r==0||r==e.height?null:0);for(let u=0,d=e.width*r;u<e.width;u++,d++)if(r>0&&r<e.height&&e.map[d]==e.map[d-e.width]){const p=e.map[d],f=o.nodeAt(p).attrs;t.setNodeMarkup(n+p,null,{...f,rowspan:f.rowspan+1}),u+=f.colspan-1}else{const p=c==null?xt(o.type.schema).cell:(i=o.nodeAt(e.map[d+c*e.width]))==null?void 0:i.type,f=p==null?void 0:p.createAndFill();f&&l.push(f)}return t.insert(s,xt(o.type.schema).row.create(null,l)),t}function HN(t,e){if(!wn(t))return!1;if(e){const n=$n(t);e(hg(t.tr,n,n.top))}return!0}function UN(t,e){if(!wn(t))return!1;if(e){const n=$n(t);e(hg(t.tr,n,n.bottom))}return!0}function qN(t,{map:e,table:n,tableStart:o},r){let i=0;for(let u=0;u<r;u++)i+=n.child(u).nodeSize;const s=i+n.child(r).nodeSize,l=t.mapping.maps.length;t.delete(i+o,s+o);const c=new Set;for(let u=0,d=r*e.width;u<e.width;u++,d++){const p=e.map[d];if(!c.has(p)){if(c.add(p),r>0&&p==e.map[d-e.width]){const f=n.nodeAt(p).attrs;t.setNodeMarkup(t.mapping.slice(l).map(p+o),null,{...f,rowspan:f.rowspan-1}),u+=f.colspan-1}else if(r<e.height&&p==e.map[d+e.width]){const f=n.nodeAt(p),h=f.attrs,m=f.type.create({...h,rowspan:f.attrs.rowspan-1},f.content),g=e.positionAt(r+1,u,n);t.insert(t.mapping.slice(l).map(o+g),m),u+=h.colspan-1}}}}function KN(t,e){if(!wn(t))return!1;if(e){const n=$n(t),o=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let r=n.bottom-1;qN(o,n,r),r!=n.top;r--){const i=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!i)throw RangeError("No table found");n.table=i,n.map=Qe.get(n.table)}e(o)}return!0}function yp(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function WN({width:t,height:e,map:n},o){let r=o.top*t+o.left,i=r,s=(o.bottom-1)*t+o.left,l=r+(o.right-o.left-1);for(let c=o.top;c<o.bottom;c++){if(o.left>0&&n[i]==n[i-1]||o.right<t&&n[l]==n[l+1])return!0;i+=t,l+=t}for(let c=o.left;c<o.right;c++){if(o.top>0&&n[r]==n[r-t]||o.bottom<e&&n[s]==n[s+t])return!0;r++,s++}return!1}function vp(t,e){const n=t.selection;if(!(n instanceof Ve)||n.$anchorCell.pos==n.$headCell.pos)return!1;const o=$n(t),{map:r}=o;if(WN(r,o))return!1;if(e){const i=t.tr,s={};let l=A.empty,c,u;for(let d=o.top;d<o.bottom;d++)for(let p=o.left;p<o.right;p++){const f=r.map[d*r.width+p],h=o.table.nodeAt(f);if(!(s[f]||!h))if(s[f]=!0,c==null)c=f,u=h;else{yp(h)||(l=l.append(h.content));const m=i.mapping.map(f+o.tableStart);i.delete(m,m+h.nodeSize)}}if(c==null||u==null)return!0;if(i.setNodeMarkup(c+o.tableStart,null,{...cg(u.attrs,u.attrs.colspan,o.right-o.left-u.attrs.colspan),rowspan:o.bottom-o.top}),l.size){const d=c+1+u.content.size,p=yp(u)?c+1:d;i.replaceWith(p+o.tableStart,d+o.tableStart,l)}i.setSelection(new Ve(i.doc.resolve(c+o.tableStart))),e(i)}return!0}function kp(t,e){const n=xt(t.schema);return jN(({node:o})=>n[o.type.spec.tableRole])(t,e)}function jN(t){return(e,n)=>{var o;const r=e.selection;let i,s;if(r instanceof Ve){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{if(i=xN(r.$from),!i)return!1;s=(o=Nr(r.$from))==null?void 0:o.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let l=i.attrs;const c=[],u=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const d=$n(e),p=e.tr;for(let h=0;h<d.right-d.left;h++)c.push(u?{...l,colwidth:u&&u[h]?[u[h]]:null}:l);let f;for(let h=d.top;h<d.bottom;h++){let m=d.map.positionAt(h,d.left,d.table);h==d.top&&(m+=i.nodeSize);for(let g=d.left,b=0;g<d.right;g++,b++)g==d.left&&h==d.top||p.insert(f=p.mapping.map(m+d.tableStart,1),t({node:i,row:h,col:g}).createAndFill(c[b]))}p.setNodeMarkup(s,t({node:i,row:d.top,col:d.left}),c[0]),r instanceof Ve&&p.setSelection(new Ve(p.doc.resolve(r.$anchorCell.pos),f?p.doc.resolve(f):void 0)),n(p)}return!0}}function GN(t,e){return function(n,o){if(!wn(n))return!1;const r=xa(n);if(r.nodeAfter.attrs[t]===e)return!1;if(o){const i=n.tr;n.selection instanceof Ve?n.selection.forEachCell((s,l)=>{s.attrs[t]!==e&&i.setNodeMarkup(l,null,{...s.attrs,[t]:e})}):i.setNodeMarkup(r.pos,null,{...r.nodeAfter.attrs,[t]:e}),o(i)}return!0}}function YN(t){return function(e,n){if(!wn(e))return!1;if(n){const o=xt(e.schema),r=$n(e),i=e.tr,s=r.map.cellsInRect(t=="column"?{left:r.left,top:0,right:r.right,bottom:r.map.height}:t=="row"?{left:0,top:r.top,right:r.map.width,bottom:r.bottom}:r),l=s.map(c=>r.table.nodeAt(c));for(let c=0;c<s.length;c++)l[c].type==o.header_cell&&i.setNodeMarkup(r.tableStart+s[c],o.cell,l[c].attrs);if(i.steps.length==0)for(let c=0;c<s.length;c++)i.setNodeMarkup(r.tableStart+s[c],o.header_cell,l[c].attrs);n(i)}return!0}}function wp(t,e,n){const o=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let r=0;r<o.length;r++){const i=e.table.nodeAt(o[r]);if(i&&i.type!==n.header_cell)return!1}return!0}function bi(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?YN(t):function(n,o){if(!wn(n))return!1;if(o){const r=xt(n.schema),i=$n(n),s=n.tr,l=wp("row",i,r),c=wp("column",i,r),d=(t==="column"?l:t==="row"?c:!1)?1:0,p=t=="column"?{left:0,top:d,right:1,bottom:i.map.height}:t=="row"?{left:d,top:0,right:i.map.width,bottom:1}:i,f=t=="column"?c?r.cell:r.header_cell:t=="row"?l?r.cell:r.header_cell:r.cell;i.map.cellsInRect(p).forEach(h=>{const m=h+i.tableStart,g=s.doc.nodeAt(m);g&&s.setNodeMarkup(m,f,g.attrs)}),o(s)}return!0}}bi("row",{useDeprecatedLogic:!0});bi("column",{useDeprecatedLogic:!0});var JN=bi("cell",{useDeprecatedLogic:!0});function XN(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let o=t.index(-1)-1,r=t.before();o>=0;o--){const i=t.node(-1).child(o),s=i.lastChild;if(s)return r-1-s.nodeSize;r-=i.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let o=t.indexAfter(-1),r=t.after();o<n.childCount;o++){const i=n.child(o);if(i.childCount)return r+1;r+=i.nodeSize}}return null}function Ep(t){return function(e,n){if(!wn(e))return!1;const o=XN(xa(e),t);if(o==null)return!1;if(n){const r=e.doc.resolve(o);n(e.tr.setSelection(ne.between(r,TN(r))).scrollIntoView())}return!0}}function ZN(t,e){const n=t.selection.$anchor;for(let o=n.depth;o>0;o--)if(n.node(o).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(o),n.after(o)).scrollIntoView()),!0;return!1}function Ui(t,e){const n=t.selection;if(!(n instanceof Ve))return!1;if(e){const o=t.tr,r=xt(t.schema).cell.createAndFill().content;n.forEachCell((i,s)=>{i.content.eq(r)||o.replace(o.mapping.map(s+1),o.mapping.map(s+i.nodeSize-1),new V(r,0,0))}),o.docChanged&&e(o)}return!0}function QN(t){if(!t.size)return null;let{content:e,openStart:n,openEnd:o}=t;for(;e.childCount==1&&(n>0&&o>0||e.child(0).type.spec.tableRole=="table");)n--,o--,e=e.child(0).content;const r=e.child(0),i=r.type.spec.tableRole,s=r.type.schema,l=[];if(i=="row")for(let c=0;c<e.childCount;c++){let u=e.child(c).content;const d=c?0:Math.max(0,n-1),p=c<e.childCount-1?0:Math.max(0,o-1);(d||p)&&(u=ic(xt(s).row,new V(u,d,p)).content),l.push(u)}else if(i=="cell"||i=="header_cell")l.push(n||o?ic(xt(s).row,new V(e,n,o)).content:e);else return null;return eT(s,l)}function eT(t,e){const n=[];for(let r=0;r<e.length;r++){const i=e[r];for(let s=i.childCount-1;s>=0;s--){const{rowspan:l,colspan:c}=i.child(s).attrs;for(let u=r;u<r+l;u++)n[u]=(n[u]||0)+c}}let o=0;for(let r=0;r<n.length;r++)o=Math.max(o,n[r]);for(let r=0;r<n.length;r++)if(r>=e.length&&e.push(A.empty),n[r]<o){const i=xt(t).cell.createAndFill(),s=[];for(let l=n[r];l<o;l++)s.push(i);e[r]=e[r].append(A.from(s))}return{height:e.length,width:o,rows:e}}function ic(t,e){const n=t.createAndFill();return new pc(n).replace(0,n.content.size,e).doc}function tT({width:t,height:e,rows:n},o,r){if(t!=o){const i=[],s=[];for(let l=0;l<n.length;l++){const c=n[l],u=[];for(let d=i[l]||0,p=0;d<o;p++){let f=c.child(p%c.childCount);d+f.attrs.colspan>o&&(f=f.type.createChecked(Go(f.attrs,f.attrs.colspan,d+f.attrs.colspan-o),f.content)),u.push(f),d+=f.attrs.colspan;for(let h=1;h<f.attrs.rowspan;h++)i[l+h]=(i[l+h]||0)+f.attrs.colspan}s.push(A.from(u))}n=s,t=o}if(e!=r){const i=[];for(let s=0,l=0;s<r;s++,l++){const c=[],u=n[l%e];for(let d=0;d<u.childCount;d++){let p=u.child(d);s+p.attrs.rowspan>r&&(p=p.type.create({...p.attrs,rowspan:Math.max(1,r-p.attrs.rowspan)},p.content)),c.push(p)}i.push(A.from(c))}n=i,e=r}return{width:t,height:e,rows:n}}function nT(t,e,n,o,r,i,s){const l=t.doc.type.schema,c=xt(l);let u,d;if(r>e.width)for(let p=0,f=0;p<e.height;p++){const h=n.child(p);f+=h.nodeSize;const m=[];let g;h.lastChild==null||h.lastChild.type==c.cell?g=u||(u=c.cell.createAndFill()):g=d||(d=c.header_cell.createAndFill());for(let b=e.width;b<r;b++)m.push(g);t.insert(t.mapping.slice(s).map(f-1+o),m)}if(i>e.height){const p=[];for(let m=0,g=(e.height-1)*e.width;m<Math.max(e.width,r);m++){const b=m>=e.width?!1:n.nodeAt(e.map[g+m]).type==c.header_cell;p.push(b?d||(d=c.header_cell.createAndFill()):u||(u=c.cell.createAndFill()))}const f=c.row.create(null,A.from(p)),h=[];for(let m=e.height;m<i;m++)h.push(f);t.insert(t.mapping.slice(s).map(o+n.nodeSize-2),h)}return!!(u||d)}function _p(t,e,n,o,r,i,s,l){if(s==0||s==e.height)return!1;let c=!1;for(let u=r;u<i;u++){const d=s*e.width+u,p=e.map[d];if(e.map[d-e.width]==p){c=!0;const f=n.nodeAt(p),{top:h,left:m}=e.findCell(p);t.setNodeMarkup(t.mapping.slice(l).map(p+o),null,{...f.attrs,rowspan:s-h}),t.insert(t.mapping.slice(l).map(e.positionAt(s,m,n)),f.type.createAndFill({...f.attrs,rowspan:h+f.attrs.rowspan-s})),u+=f.attrs.colspan-1}}return c}function Cp(t,e,n,o,r,i,s,l){if(s==0||s==e.width)return!1;let c=!1;for(let u=r;u<i;u++){const d=u*e.width+s,p=e.map[d];if(e.map[d-1]==p){c=!0;const f=n.nodeAt(p),h=e.colCount(p),m=t.mapping.slice(l).map(p+o);t.setNodeMarkup(m,null,Go(f.attrs,s-h,f.attrs.colspan-(s-h))),t.insert(m+f.nodeSize,f.type.createAndFill(Go(f.attrs,0,s-h))),u+=f.attrs.rowspan-1}}return c}function Sp(t,e,n,o,r){let i=n?t.doc.nodeAt(n-1):t.doc;if(!i)throw new Error("No table found");let s=Qe.get(i);const{top:l,left:c}=o,u=c+r.width,d=l+r.height,p=t.tr;let f=0;function h(){if(i=n?p.doc.nodeAt(n-1):p.doc,!i)throw new Error("No table found");s=Qe.get(i),f=p.mapping.maps.length}nT(p,s,i,n,u,d,f)&&h(),_p(p,s,i,n,c,u,l,f)&&h(),_p(p,s,i,n,c,u,d,f)&&h(),Cp(p,s,i,n,l,d,c,f)&&h(),Cp(p,s,i,n,l,d,u,f)&&h();for(let m=l;m<d;m++){const g=s.positionAt(m,c,i),b=s.positionAt(m,u,i);p.replace(p.mapping.slice(f).map(g+n),p.mapping.slice(f).map(b+n),new V(r.rows[m-l],0,0))}h(),p.setSelection(new Ve(p.doc.resolve(n+s.positionAt(l,c,i)),p.doc.resolve(n+s.positionAt(d-1,u-1,i)))),e(p)}var oT=_c({ArrowLeft:qi("horiz",-1),ArrowRight:qi("horiz",1),ArrowUp:qi("vert",-1),ArrowDown:qi("vert",1),"Shift-ArrowLeft":Ki("horiz",-1),"Shift-ArrowRight":Ki("horiz",1),"Shift-ArrowUp":Ki("vert",-1),"Shift-ArrowDown":Ki("vert",1),Backspace:Ui,"Mod-Backspace":Ui,Delete:Ui,"Mod-Delete":Ui});function us(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function qi(t,e){return(n,o,r)=>{if(!r)return!1;const i=n.selection;if(i instanceof Ve)return us(n,o,ae.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;const s=mg(r,t,e);if(s==null)return!1;if(t=="horiz")return us(n,o,ae.near(n.doc.resolve(i.head+e),e));{const l=n.doc.resolve(s),c=lg(l,t,e);let u;return c?u=ae.near(c,1):e<0?u=ae.near(n.doc.resolve(l.before(-1)),-1):u=ae.near(n.doc.resolve(l.after(-1)),1),us(n,o,u)}}}function Ki(t,e){return(n,o,r)=>{if(!r)return!1;const i=n.selection;let s;if(i instanceof Ve)s=i;else{const c=mg(r,t,e);if(c==null)return!1;s=new Ve(n.doc.resolve(c))}const l=lg(s.$headCell,t,e);return l?us(n,o,new Ve(s.$anchorCell,l)):!1}}function rT(t,e){const n=t.state.doc,o=Nr(n.resolve(e));return o?(t.dispatch(t.state.tr.setSelection(new Ve(o))),!0):!1}function iT(t,e,n){if(!wn(t.state))return!1;let o=QN(n);const r=t.state.selection;if(r instanceof Ve){o||(o={width:1,height:1,rows:[A.from(ic(xt(t.state.schema).cell,n))]});const i=r.$anchorCell.node(-1),s=r.$anchorCell.start(-1),l=Qe.get(i).rectBetween(r.$anchorCell.pos-s,r.$headCell.pos-s);return o=tT(o,l.right-l.left,l.bottom-l.top),Sp(t.state,t.dispatch,s,l,o),!0}else if(o){const i=xa(t.state),s=i.start(-1);return Sp(t.state,t.dispatch,s,Qe.get(i.node(-1)).findCell(i.pos-s),o),!0}else return!1}function sT(t,e){var n;if(e.ctrlKey||e.metaKey)return;const o=xp(t,e.target);let r;if(e.shiftKey&&t.state.selection instanceof Ve)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&o&&(r=Nr(t.state.selection.$anchor))!=null&&((n=fl(t,e))==null?void 0:n.pos)!=r.pos)i(r,e),e.preventDefault();else if(!o)return;function i(c,u){let d=fl(t,u);const p=uo.getState(t.state)==null;if(!d||!fu(c,d))if(p)d=c;else return;const f=new Ve(c,d);if(p||!t.state.selection.eq(f)){const h=t.state.tr.setSelection(f);p&&h.setMeta(uo,c.pos),t.dispatch(h)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",l),uo.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(uo,-1))}function l(c){const u=c,d=uo.getState(t.state);let p;if(d!=null)p=t.state.doc.resolve(d);else if(xp(t,u.target)!=o&&(p=fl(t,e),!p))return s();p&&i(p,u)}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",l)}function mg(t,e,n){if(!(t.state.selection instanceof ne))return null;const{$head:o}=t.state.selection;for(let r=o.depth-1;r>=0;r--){const i=o.node(r);if((n<0?o.index(r):o.indexAfter(r))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const l=o.before(r),c=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(c)?l:null}}return null}function xp(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function fl(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?Nr(t.state.doc.resolve(n.pos)):null}var aT=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),sc(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,sc(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function sc(t,e,n,o,r,i){var s;let l=0,c=!0,u=e.firstChild;const d=t.firstChild;if(d){for(let p=0,f=0;p<d.childCount;p++){const{colspan:h,colwidth:m}=d.child(p).attrs;for(let g=0;g<h;g++,f++){const b=r==f?i:m&&m[g],y=b?b+"px":"";if(l+=b||o,b||(c=!1),u)u.style.width!=y&&(u.style.width=y),u=u.nextSibling;else{const k=document.createElement("col");k.style.width=y,e.appendChild(k)}}}for(;u;){const p=u.nextSibling;(s=u.parentNode)==null||s.removeChild(u),u=p}c?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}var Yt=new xe("tableColumnResizing");function lT({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:o=aT,lastColumnResizable:r=!0}={}){const i=new Ae({key:Yt,state:{init(s,l){var c,u;const d=(u=(c=i.spec)==null?void 0:c.props)==null?void 0:u.nodeViews,p=xt(l.schema).table.name;return o&&d&&(d[p]=(f,h)=>new o(f,n,h)),new cT(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{const l=Yt.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{uT(s,l,t,r)},mouseleave:s=>{dT(s)},mousedown:(s,l)=>{pT(s,l,e,n)}},decorations:s=>{const l=Yt.getState(s);if(l&&l.activeHandle>-1)return bT(s,l.activeHandle)},nodeViews:{}}});return i}var cT=class ds{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,o=e.getMeta(Yt);if(o&&o.setHandle!=null)return new ds(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new ds(n.activeHandle,o.setDragging);if(n.activeHandle>-1&&e.docChanged){let r=e.mapping.map(n.activeHandle,-1);return rc(e.doc.resolve(r))||(r=-1),new ds(r,n.dragging)}return n}};function uT(t,e,n,o){if(!t.editable)return;const r=Yt.getState(t.state);if(r&&!r.dragging){const i=hT(e.target);let s=-1;if(i){const{left:l,right:c}=i.getBoundingClientRect();e.clientX-l<=n?s=Np(t,e,"left",n):c-e.clientX<=n&&(s=Np(t,e,"right",n))}if(s!=r.activeHandle){if(!o&&s!==-1){const l=t.state.doc.resolve(s),c=l.node(-1),u=Qe.get(c),d=l.start(-1);if(u.colCount(l.pos-d)+l.nodeAfter.attrs.colspan-1==u.width-1)return}gg(t,s)}}}function dT(t){if(!t.editable)return;const e=Yt.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&gg(t,-1)}function pT(t,e,n,o){var r;if(!t.editable)return!1;const i=(r=t.dom.ownerDocument.defaultView)!=null?r:window,s=Yt.getState(t.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const l=t.state.doc.nodeAt(s.activeHandle),c=fT(t,s.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(Yt,{setDragging:{startX:e.clientX,startWidth:c}}));function u(p){i.removeEventListener("mouseup",u),i.removeEventListener("mousemove",d);const f=Yt.getState(t.state);f!=null&&f.dragging&&(mT(t,f.activeHandle,Tp(f.dragging,p,n)),t.dispatch(t.state.tr.setMeta(Yt,{setDragging:null})))}function d(p){if(!p.which)return u(p);const f=Yt.getState(t.state);if(f&&f.dragging){const h=Tp(f.dragging,p,n);Op(t,f.activeHandle,h,o)}}return Op(t,s.activeHandle,c,o),i.addEventListener("mouseup",u),i.addEventListener("mousemove",d),e.preventDefault(),!0}function fT(t,e,{colspan:n,colwidth:o}){const r=o&&o[o.length-1];if(r)return r;const i=t.domAtPos(e);let l=i.node.childNodes[i.offset].offsetWidth,c=n;if(o)for(let u=0;u<n;u++)o[u]&&(l-=o[u],c--);return l/c}function hT(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function Np(t,e,n,o){const r=n=="right"?-o:o,i=t.posAtCoords({left:e.clientX+r,top:e.clientY});if(!i)return-1;const{pos:s}=i,l=Nr(t.state.doc.resolve(s));if(!l)return-1;if(n=="right")return l.pos;const c=Qe.get(l.node(-1)),u=l.start(-1),d=c.map.indexOf(l.pos-u);return d%c.width==0?-1:u+c.map[d-1]}function Tp(t,e,n){const o=e.clientX-t.startX;return Math.max(n,t.startWidth+o)}function gg(t,e){t.dispatch(t.state.tr.setMeta(Yt,{setHandle:e}))}function mT(t,e,n){const o=t.state.doc.resolve(e),r=o.node(-1),i=Qe.get(r),s=o.start(-1),l=i.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,c=t.state.tr;for(let u=0;u<i.height;u++){const d=u*i.width+l;if(u&&i.map[d]==i.map[d-i.width])continue;const p=i.map[d],f=r.nodeAt(p).attrs,h=f.colspan==1?0:l-i.colCount(p);if(f.colwidth&&f.colwidth[h]==n)continue;const m=f.colwidth?f.colwidth.slice():gT(f.colspan);m[h]=n,c.setNodeMarkup(s+p,null,{...f,colwidth:m})}c.docChanged&&t.dispatch(c)}function Op(t,e,n,o){const r=t.state.doc.resolve(e),i=r.node(-1),s=r.start(-1),l=Qe.get(i).colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1;let c=t.domAtPos(r.start(-1)).node;for(;c&&c.nodeName!="TABLE";)c=c.parentNode;c&&sc(i,c.firstChild,c,o,l,n)}function gT(t){return Array(t).fill(0)}function bT(t,e){var n;const o=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return Ne.empty;const s=Qe.get(i),l=r.start(-1),c=s.colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1;for(let u=0;u<s.height;u++){const d=c+u*s.width;if((c==s.width-1||s.map[d]!=s.map[d+1])&&(u==0||s.map[d]!=s.map[d-s.width])){const p=s.map[d],f=l+p+i.nodeAt(p).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",(n=Yt.getState(t))!=null&&n.dragging&&o.push(Ge.node(l+p,l+p+i.nodeAt(p).nodeSize,{class:"column-resize-dragging"})),o.push(Ge.widget(f,h))}}return Ne.create(t.doc,o)}function yT({allowTableNodeSelection:t=!1}={}){return new Ae({key:uo,state:{init(){return null},apply(e,n){const o=e.getMeta(uo);if(o!=null)return o==-1?null:o;if(n==null||!e.docChanged)return n;const{deleted:r,pos:i}=e.mapping.mapResult(n);return r?null:i}},props:{decorations:AN,handleDOMEvents:{mousedown:sT},createSelectionBetween(e){return uo.getState(e.state)!=null?e.state.selection:null},handleTripleClick:rT,handleKeyDown:oT,handlePaste:iT},appendTransaction(e,n,o){return DN(o,pg(o,n),t)}})}function ac(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function Mp(t,e,n,o,r,i){var s;let l=0,c=!0,u=e.firstChild;const d=t.firstChild;if(d!==null)for(let p=0,f=0;p<d.childCount;p+=1){const{colspan:h,colwidth:m}=d.child(p).attrs;for(let g=0;g<h;g+=1,f+=1){const b=r===f?i:m&&m[g],y=b?`${b}px`:"";if(l+=b||o,b||(c=!1),u){if(u.style.width!==y){const[k,E]=ac(o,b);u.style.setProperty(k,E)}u=u.nextSibling}else{const k=document.createElement("col"),[E,v]=ac(o,b);k.style.setProperty(E,v),e.appendChild(k)}}}for(;u;){const p=u.nextSibling;(s=u.parentNode)===null||s===void 0||s.removeChild(u),u=p}c?(n.style.width=`${l}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${l}px`)}class vT{constructor(e,n){this.node=e,this.cellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Mp(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,Mp(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function kT(t,e,n,o){let r=0,i=!0;const s=[],l=t.firstChild;if(!l)return{};for(let p=0,f=0;p<l.childCount;p+=1){const{colspan:h,colwidth:m}=l.child(p).attrs;for(let g=0;g<h;g+=1,f+=1){const b=n===f?o:m&&m[g];r+=b||e,b||(i=!1);const[y,k]=ac(e,b);s.push(["col",{style:`${y}: ${k}`}])}}const c=i?`${r}px`:"",u=i?"":`${r}px`;return{colgroup:["colgroup",{},...s],tableWidth:c,tableMinWidth:u}}function Ap(t,e){return t.createAndFill()}function wT(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const o=t.nodes[n];o.spec.tableRole&&(e[o.spec.tableRole]=o)}),t.cached.tableNodeTypes=e,e}function bg(t,e,n,o,r){const i=wT(t),s=[],l=[];for(let u=0;u<n;u+=1){const d=Ap(i.cell);if(d&&l.push(d),o){const p=Ap(i.header_cell);p&&s.push(p)}}const c=[];for(let u=0;u<e;u+=1)c.push(i.row.createChecked(null,o&&u===0?s:l));return i.table.createChecked(null,c)}function ET(t){return t instanceof Ve}const Wi=({editor:t})=>{const{selection:e}=t.state;if(!ET(e))return!1;let n=0;const o=Dh(e.ranges[0].$from,i=>i.type.name==="table");return o==null||o.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},yg=ze.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:vT,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:o,tableMinWidth:r}=kT(t,this.options.cellMinWidth);return["table",_e(this.options.HTMLAttributes,e,{style:o?`width: ${o}`:`min-width: ${r}`}),n,["tbody",0]]},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:o,dispatch:r,editor:i})=>{const s=bg(i.schema,t,e,n);if(r){const l=o.selection.from+1;o.replaceSelectionWith(s).scrollIntoView().setSelection(ne.near(o.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>PN(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>$N(t,e),deleteColumn:()=>({state:t,dispatch:e})=>VN(t,e),addRowBefore:()=>({state:t,dispatch:e})=>HN(t,e),addRowAfter:()=>({state:t,dispatch:e})=>UN(t,e),deleteRow:()=>({state:t,dispatch:e})=>KN(t,e),deleteTable:()=>({state:t,dispatch:e})=>ZN(t,e),mergeCells:()=>({state:t,dispatch:e})=>vp(t,e),splitCell:()=>({state:t,dispatch:e})=>kp(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>bi("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>bi("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>JN(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>vp(t,e)?!0:kp(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:o})=>GN(t,e)(n,o),goToNextCell:()=>({state:t,dispatch:e})=>Ep(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Ep(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&pg(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const o=Ve.create(e.doc,t.anchorCell,t.headCell);e.setSelection(o)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Wi,"Mod-Backspace":Wi,Delete:Wi,"Mod-Delete":Wi}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[lT({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],yT({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:ve(j(t,"tableRole",e))}}}),vg=ze.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(o=>parseInt(o,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",_e(this.options.HTMLAttributes,t),0]}}),kg=ze.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(o=>parseInt(o,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",_e(this.options.HTMLAttributes,t),0]}}),hu=ze.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",_e(this.options.HTMLAttributes,t),0]}});/**
117
152
  * Copyright 2025 Yiitap
118
153
  * @license MIT
119
- **/const ep=t=>{const e=/(#[0-9a-f]{3,6})\b/gi,n=[];return t.descendants((o,r)=>{o.text&&Array.from(o.text.matchAll(e)).forEach(i=>{const s=i[0],a=i.index||0,c=r+a,d=c+s.length,u=Ze.inline(c,d,{class:"color",style:`--color: ${s}`});n.push(u)})}),Me.create(t,n)},Nm=De.create({name:"colorHighlighter",addProseMirrorPlugins(){return[new Se({key:new xe("colorHighlighter"),state:{init(t,{doc:e}){return ep(e)},apply(t,e){return t.docChanged?ep(t.doc):e}},props:{decorations(t){return this.getState(t)}}})]}});/**
154
+ **/const Rp=t=>{const e=/(#[0-9a-f]{3,6})\b/gi,n=[];return t.descendants((o,r)=>{o.text&&Array.from(o.text.matchAll(e)).forEach(i=>{const s=i[0],l=i.index||0,c=r+l,u=c+s.length,d=Ge.inline(c,u,{class:"color",style:`--color: ${s}`});n.push(d)})}),Ne.create(t,n)},wg=De.create({name:"colorHighlighter",addProseMirrorPlugins(){return[new Ae({key:new xe("colorHighlighter"),state:{init(t,{doc:e}){return Rp(e)},apply(t,e){return t.docChanged?Rp(t.doc):e}},props:{decorations(t){return this.getState(t)}}})]}});/**
120
155
  * Copyright 2025 Yiitap
121
156
  * @license MIT
122
- **/const $x=De.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Se({key:new xe("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:o}=this.editor,{anchor:r}=e,i=[];if(!n||!o)return Me.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((c,d)=>{if(!c.isText){if(!(r>=d&&r<=d+c.nodeSize-1))return!1;s+=1}});let a=0;return t.descendants((c,d)=>{if(c.isText||!(r>=d&&r<=d+c.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";i.push(Ze.node(d,d+c.nodeSize,{class:this.options.className}))}),Me.create(t,i)}}})]}});/**
157
+ **/De.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Ae({key:new xe("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:o}=this.editor,{anchor:r}=e,i=[];if(!n||!o)return Ne.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((c,u)=>{if(!c.isText){if(!(r>=u&&r<=u+c.nodeSize-1))return!1;s+=1}});let l=0;return t.descendants((c,u)=>{if(c.isText||!(r>=u&&r<=u+c.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";i.push(Ge.node(u,u+c.nodeSize,{class:this.options.className}))}),Ne.create(t,i)}}})]}});/**
123
158
  * Copyright 2025 Yiitap
124
159
  * @license MIT
125
- **/const Tm=De.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Se({key:new xe("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:o}=e,r=[];return n?(t.descendants((i,s)=>{const a=o>=s&&o<=s+i.nodeSize,c=!i.isLeaf&&!i.childCount,d=this.options.showOnlyCurrent;if((a||!d)&&c){const u=[this.options.emptyNodeClass];this.editor.isEmpty&&u.push(this.options.emptyEditorClass);const p=Ze.node(s,s+i.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:i,pos:s,hasAnchor:a}):this.options.placeholder});r.push(p)}return this.options.includeChildren}),Me.create(t,r)):null}}})]}});var Ul,ql;if(typeof WeakMap<"u"){let t=new WeakMap;Ul=e=>t.get(e),ql=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;Ul=o=>{for(let r=0;r<t.length;r+=2)if(t[r]==o)return t[r+1]},ql=(o,r)=>(n==10&&(n=0),t[n++]=o,t[n++]=r)}var Ge=class{constructor(t,e,n,o){this.width=t,this.height=e,this.map=n,this.problems=o}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const o=e%this.width,r=e/this.width|0;let i=o+1,s=r+1;for(let a=1;i<this.width&&this.map[e+a]==n;a++)i++;for(let a=1;s<this.height&&this.map[e+this.width*a]==n;a++)s++;return{left:o,top:r,right:i,bottom:s}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:o,right:r,top:i,bottom:s}=this.findCell(t);return e=="horiz"?(n<0?o==0:r==this.width)?null:this.map[i*this.width+(n<0?o-1:r)]:(n<0?i==0:s==this.height)?null:this.map[o+this.width*(n<0?i-1:s)]}rectBetween(t,e){const{left:n,right:o,top:r,bottom:i}=this.findCell(t),{left:s,right:a,top:c,bottom:d}=this.findCell(e);return{left:Math.min(n,s),top:Math.min(r,c),right:Math.max(o,a),bottom:Math.max(i,d)}}cellsInRect(t){const e=[],n={};for(let o=t.top;o<t.bottom;o++)for(let r=t.left;r<t.right;r++){const i=o*this.width+r,s=this.map[i];n[s]||(n[s]=!0,!(r==t.left&&r&&this.map[i-1]==s||o==t.top&&o&&this.map[i-this.width]==s)&&e.push(s))}return e}positionAt(t,e,n){for(let o=0,r=0;;o++){const i=r+n.child(o).nodeSize;if(o==t){let s=e+t*this.width;const a=(t+1)*this.width;for(;s<a&&this.map[s]<r;)s++;return s==a?i-1:this.map[s]}r=i}}static get(t){return Ul(t)||ql(t,Fx(t))}};function Fx(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=Vx(t),n=t.childCount,o=[];let r=0,i=null;const s=[];for(let d=0,u=e*n;d<u;d++)o[d]=0;for(let d=0,u=0;d<n;d++){const p=t.child(d);u++;for(let m=0;;m++){for(;r<o.length&&o[r]!=0;)r++;if(m==p.childCount)break;const g=p.child(m),{colspan:b,rowspan:y,colwidth:k}=g.attrs;for(let w=0;w<y;w++){if(w+d>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:u,n:y-w});break}const v=r+w*e;for(let _=0;_<b;_++){o[v+_]==0?o[v+_]=u:(i||(i=[])).push({type:"collision",row:d,pos:u,n:b-_});const C=k&&k[_];if(C){const A=(v+_)%e*2,L=s[A];L==null||L!=C&&s[A+1]==1?(s[A]=C,s[A+1]=1):L==C&&s[A+1]++}}}r+=b,u+=g.nodeSize}const f=(d+1)*e;let h=0;for(;r<f;)o[r++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:d,n:h}),u++}(e===0||n===0)&&(i||(i=[])).push({type:"zero_sized"});const a=new Ge(e,n,o,i);let c=!1;for(let d=0;!c&&d<s.length;d+=2)s[d]!=null&&s[d+1]<n&&(c=!0);return c&&zx(a,s,t),a}function Vx(t){let e=-1,n=!1;for(let o=0;o<t.childCount;o++){const r=t.child(o);let i=0;if(n)for(let s=0;s<o;s++){const a=t.child(s);for(let c=0;c<a.childCount;c++){const d=a.child(c);s+d.attrs.rowspan>o&&(i+=d.attrs.colspan)}}for(let s=0;s<r.childCount;s++){const a=r.child(s);i+=a.attrs.colspan,a.attrs.rowspan>1&&(n=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function zx(t,e,n){t.problems||(t.problems=[]);const o={};for(let r=0;r<t.map.length;r++){const i=t.map[r];if(o[i])continue;o[i]=!0;const s=n.nodeAt(i);if(!s)throw new RangeError(`No cell with offset ${i} found`);let a=null;const c=s.attrs;for(let d=0;d<c.colspan;d++){const u=(r+d)%t.width,p=e[u*2];p!=null&&(!c.colwidth||c.colwidth[d]!=p)&&((a||(a=Hx(c)))[d]=p)}a&&t.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:a})}}function Hx(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Ct(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const o=t.nodes[n],r=o.spec.tableRole;r&&(e[r]=o)}}return e}var io=new xe("selectingCells");function _r(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function Ux(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function vn(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function Ca(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=_r(e.$head)||qx(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function qx(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function Wl(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function Wx(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Yc(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Om(t,e,n){const o=t.node(-1),r=Ge.get(o),i=t.start(-1),s=r.nextCell(t.pos-i,e,n);return s==null?null:t.node(0).resolve(i+s)}function Uo(t,e,n=1){const o={...t,colspan:t.colspan-n};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(e,n),o.colwidth.some(r=>r>0)||(o.colwidth=null)),o}function Mm(t,e,n=1){const o={...t,colspan:t.colspan+n};if(o.colwidth){o.colwidth=o.colwidth.slice();for(let r=0;r<n;r++)o.colwidth.splice(e,0,0)}return o}function Kx(t,e,n){const o=Ct(e.type.schema).header_cell;for(let r=0;r<t.height;r++)if(e.nodeAt(t.map[n+r*t.width]).type!=o)return!1;return!0}var Le=class Fn extends ee{constructor(e,n=e){const o=e.node(-1),r=Ge.get(o),i=e.start(-1),s=r.rectBetween(e.pos-i,n.pos-i),a=e.node(0),c=r.cellsInRect(s).filter(u=>u!=n.pos-i);c.unshift(n.pos-i);const d=c.map(u=>{const p=o.nodeAt(u);if(!p)throw RangeError(`No cell with offset ${u} found`);const f=i+u+1;return new vf(a.resolve(f),a.resolve(f+p.content.size))});super(d[0].$from,d[0].$to,d),this.$anchorCell=e,this.$headCell=n}map(e,n){const o=e.resolve(n.map(this.$anchorCell.pos)),r=e.resolve(n.map(this.$headCell.pos));if(Wl(o)&&Wl(r)&&Yc(o,r)){const i=this.$anchorCell.node(-1)!=o.node(-1);return i&&this.isRowSelection()?Fn.rowSelection(o,r):i&&this.isColSelection()?Fn.colSelection(o,r):new Fn(o,r)}return J.between(o,r)}content(){const e=this.$anchorCell.node(-1),n=Ge.get(e),o=this.$anchorCell.start(-1),r=n.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o),i={},s=[];for(let c=r.top;c<r.bottom;c++){const d=[];for(let u=c*n.width+r.left,p=r.left;p<r.right;p++,u++){const f=n.map[u];if(i[f])continue;i[f]=!0;const h=n.findCell(f);let m=e.nodeAt(f);if(!m)throw RangeError(`No cell with offset ${f} found`);const g=r.left-h.left,b=h.right-r.right;if(g>0||b>0){let y=m.attrs;if(g>0&&(y=Uo(y,0,g)),b>0&&(y=Uo(y,y.colspan-b,b)),h.left<r.left){if(m=m.type.createAndFill(y),!m)throw RangeError(`Could not create cell with attrs ${JSON.stringify(y)}`)}else m=m.type.create(y,m.content)}if(h.top<r.top||h.bottom>r.bottom){const y={...m.attrs,rowspan:Math.min(h.bottom,r.bottom)-Math.max(h.top,r.top)};h.top<r.top?m=m.type.createAndFill(y):m=m.type.create(y,m.content)}d.push(m)}s.push(e.child(c).copy(T.from(d)))}const a=this.isColSelection()&&this.isRowSelection()?e:s;return new $(T.from(a),1,1)}replace(e,n=$.empty){const o=e.steps.length,r=this.ranges;for(let s=0;s<r.length;s++){const{$from:a,$to:c}=r[s],d=e.mapping.slice(o);e.replace(d.map(a.pos),d.map(c.pos),s?$.empty:n)}const i=ee.findFrom(e.doc.resolve(e.mapping.slice(o).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,n){this.replace(e,new $(T.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),o=Ge.get(n),r=this.$anchorCell.start(-1),i=o.cellsInRect(o.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let s=0;s<i.length;s++)e(n.nodeAt(i[s]),r+i[s])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const o=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(o,r)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const o=e.node(-1),r=Ge.get(o),i=e.start(-1),s=r.findCell(e.pos-i),a=r.findCell(n.pos-i),c=e.node(0);return s.top<=a.top?(s.top>0&&(e=c.resolve(i+r.map[s.left])),a.bottom<r.height&&(n=c.resolve(i+r.map[r.width*(r.height-1)+a.right-1]))):(a.top>0&&(n=c.resolve(i+r.map[a.left])),s.bottom<r.height&&(e=c.resolve(i+r.map[r.width*(r.height-1)+s.right-1]))),new Fn(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=Ge.get(e),o=this.$anchorCell.start(-1),r=n.colCount(this.$anchorCell.pos-o),i=n.colCount(this.$headCell.pos-o);if(Math.min(r,i)>0)return!1;const s=r+this.$anchorCell.nodeAfter.attrs.colspan,a=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,a)==n.width}eq(e){return e instanceof Fn&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const o=e.node(-1),r=Ge.get(o),i=e.start(-1),s=r.findCell(e.pos-i),a=r.findCell(n.pos-i),c=e.node(0);return s.left<=a.left?(s.left>0&&(e=c.resolve(i+r.map[s.top*r.width])),a.right<r.width&&(n=c.resolve(i+r.map[r.width*(a.top+1)-1]))):(a.left>0&&(n=c.resolve(i+r.map[a.top*r.width])),s.right<r.width&&(e=c.resolve(i+r.map[r.width*(s.top+1)-1]))),new Fn(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Fn(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,o=n){return new Fn(e.resolve(n),e.resolve(o))}getBookmark(){return new jx(this.$anchorCell.pos,this.$headCell.pos)}};Le.prototype.visible=!1;ee.jsonID("cell",Le);var jx=class Am{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Am(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),o=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&o.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&o.index()<o.parent.childCount&&Yc(n,o)?new Le(n,o):ee.near(o,1)}};function Gx(t){if(!(t.selection instanceof Le))return null;const e=[];return t.selection.forEachCell((n,o)=>{e.push(Ze.node(o,o+n.nodeSize,{class:"selectedCell"}))}),Me.create(t.doc,e)}function Yx({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,o=e.pos,r=t.depth;for(;r>=0&&!(t.after(r+1)<t.end(r));r--,n++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,o--);return n==o&&/row|table/.test(t.node(r).type.spec.tableRole)}function Jx({$from:t,$to:e}){let n,o;for(let r=t.depth;r>0;r--){const i=t.node(r);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){n=i;break}}for(let r=e.depth;r>0;r--){const i=e.node(r);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){o=i;break}}return n!==o&&e.parentOffset===0}function Xx(t,e,n){const o=(e||t).selection,r=(e||t).doc;let i,s;if(o instanceof G&&(s=o.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")i=Le.create(r,o.from);else if(s=="row"){const a=r.resolve(o.from+1);i=Le.rowSelection(a,a)}else if(!n){const a=Ge.get(o.node),c=o.from+1,d=c+a.map[a.width*a.height-1];i=Le.create(r,c+1,d)}}else o instanceof J&&Yx(o)?i=J.create(r,o.from):o instanceof J&&Jx(o)&&(i=J.create(r,o.$from.start(),o.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}var Zx=new xe("fix-tables");function Rm(t,e,n,o){const r=t.childCount,i=e.childCount;e:for(let s=0,a=0;s<i;s++){const c=e.child(s);for(let d=a,u=Math.min(r,s+3);d<u;d++)if(t.child(d)==c){a=d+1,n+=c.nodeSize;continue e}o(c,n),a<r&&t.child(a).sameMarkup(c)?Rm(t.child(a),c,n+1,o):c.nodesBetween(0,c.content.size,o,n+1),n+=c.nodeSize}}function Dm(t,e){let n;const o=(r,i)=>{r.type.spec.tableRole=="table"&&(n=Qx(t,r,i,n))};return e?e.doc!=t.doc&&Rm(e.doc,t.doc,0,o):t.doc.descendants(o),n}function Qx(t,e,n,o){const r=Ge.get(e);if(!r.problems)return o;o||(o=t.tr);const i=[];for(let c=0;c<r.height;c++)i.push(0);for(let c=0;c<r.problems.length;c++){const d=r.problems[c];if(d.type=="collision"){const u=e.nodeAt(d.pos);if(!u)continue;const p=u.attrs;for(let f=0;f<p.rowspan;f++)i[d.row+f]+=d.n;o.setNodeMarkup(o.mapping.map(n+1+d.pos),null,Uo(p,p.colspan-d.n,d.n))}else if(d.type=="missing")i[d.row]+=d.n;else if(d.type=="overlong_rowspan"){const u=e.nodeAt(d.pos);if(!u)continue;o.setNodeMarkup(o.mapping.map(n+1+d.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-d.n})}else if(d.type=="colwidth mismatch"){const u=e.nodeAt(d.pos);if(!u)continue;o.setNodeMarkup(o.mapping.map(n+1+d.pos),null,{...u.attrs,colwidth:d.colwidth})}else if(d.type=="zero_sized"){const u=o.mapping.map(n);o.delete(u,u+e.nodeSize)}}let s,a;for(let c=0;c<i.length;c++)i[c]&&(s==null&&(s=c),a=c);for(let c=0,d=n+1;c<r.height;c++){const u=e.child(c),p=d+u.nodeSize,f=i[c];if(f>0){let h="cell";u.firstChild&&(h=u.firstChild.type.spec.tableRole);const m=[];for(let b=0;b<f;b++){const y=Ct(t.schema)[h].createAndFill();y&&m.push(y)}const g=(c==0||s==c-1)&&a==c?d+1:p-1;o.insert(o.mapping.map(g),m)}d=p}return o.setMeta(Zx,{fixTables:!0})}function In(t){const e=t.selection,n=Ca(t),o=n.node(-1),r=n.start(-1),i=Ge.get(o);return{...e instanceof Le?i.rectBetween(e.$anchorCell.pos-r,e.$headCell.pos-r):i.findCell(n.pos-r),tableStart:r,map:i,table:o}}function Im(t,{map:e,tableStart:n,table:o},r){let i=r>0?-1:0;Kx(e,o,r+i)&&(i=r==0||r==e.width?null:0);for(let s=0;s<e.height;s++){const a=s*e.width+r;if(r>0&&r<e.width&&e.map[a-1]==e.map[a]){const c=e.map[a],d=o.nodeAt(c);t.setNodeMarkup(t.mapping.map(n+c),null,Mm(d.attrs,r-e.colCount(c))),s+=d.attrs.rowspan-1}else{const c=i==null?Ct(o.type.schema).cell:o.nodeAt(e.map[a+i]).type,d=e.positionAt(s,r,o);t.insert(t.mapping.map(n+d),c.createAndFill())}}return t}function eN(t,e){if(!vn(t))return!1;if(e){const n=In(t);e(Im(t.tr,n,n.left))}return!0}function tN(t,e){if(!vn(t))return!1;if(e){const n=In(t);e(Im(t.tr,n,n.right))}return!0}function nN(t,{map:e,table:n,tableStart:o},r){const i=t.mapping.maps.length;for(let s=0;s<e.height;){const a=s*e.width+r,c=e.map[a],d=n.nodeAt(c),u=d.attrs;if(r>0&&e.map[a-1]==c||r<e.width-1&&e.map[a+1]==c)t.setNodeMarkup(t.mapping.slice(i).map(o+c),null,Uo(u,r-e.colCount(c)));else{const p=t.mapping.slice(i).map(o+c);t.delete(p,p+d.nodeSize)}s+=u.rowspan}}function oN(t,e){if(!vn(t))return!1;if(e){const n=In(t),o=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let r=n.right-1;nN(o,n,r),r!=n.left;r--){const i=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!i)throw RangeError("No table found");n.table=i,n.map=Ge.get(i)}e(o)}return!0}function rN(t,e,n){var o;const r=Ct(e.type.schema).header_cell;for(let i=0;i<t.width;i++)if(((o=e.nodeAt(t.map[i+n*t.width]))==null?void 0:o.type)!=r)return!1;return!0}function Bm(t,{map:e,tableStart:n,table:o},r){var i;let s=n;for(let d=0;d<r;d++)s+=o.child(d).nodeSize;const a=[];let c=r>0?-1:0;rN(e,o,r+c)&&(c=r==0||r==e.height?null:0);for(let d=0,u=e.width*r;d<e.width;d++,u++)if(r>0&&r<e.height&&e.map[u]==e.map[u-e.width]){const p=e.map[u],f=o.nodeAt(p).attrs;t.setNodeMarkup(n+p,null,{...f,rowspan:f.rowspan+1}),d+=f.colspan-1}else{const p=c==null?Ct(o.type.schema).cell:(i=o.nodeAt(e.map[u+c*e.width]))==null?void 0:i.type,f=p==null?void 0:p.createAndFill();f&&a.push(f)}return t.insert(s,Ct(o.type.schema).row.create(null,a)),t}function iN(t,e){if(!vn(t))return!1;if(e){const n=In(t);e(Bm(t.tr,n,n.top))}return!0}function sN(t,e){if(!vn(t))return!1;if(e){const n=In(t);e(Bm(t.tr,n,n.bottom))}return!0}function aN(t,{map:e,table:n,tableStart:o},r){let i=0;for(let d=0;d<r;d++)i+=n.child(d).nodeSize;const s=i+n.child(r).nodeSize,a=t.mapping.maps.length;t.delete(i+o,s+o);const c=new Set;for(let d=0,u=r*e.width;d<e.width;d++,u++){const p=e.map[u];if(!c.has(p)){if(c.add(p),r>0&&p==e.map[u-e.width]){const f=n.nodeAt(p).attrs;t.setNodeMarkup(t.mapping.slice(a).map(p+o),null,{...f,rowspan:f.rowspan-1}),d+=f.colspan-1}else if(r<e.height&&p==e.map[u+e.width]){const f=n.nodeAt(p),h=f.attrs,m=f.type.create({...h,rowspan:f.attrs.rowspan-1},f.content),g=e.positionAt(r+1,d,n);t.insert(t.mapping.slice(a).map(o+g),m),d+=h.colspan-1}}}}function lN(t,e){if(!vn(t))return!1;if(e){const n=In(t),o=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let r=n.bottom-1;aN(o,n,r),r!=n.top;r--){const i=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!i)throw RangeError("No table found");n.table=i,n.map=Ge.get(n.table)}e(o)}return!0}function tp(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function cN({width:t,height:e,map:n},o){let r=o.top*t+o.left,i=r,s=(o.bottom-1)*t+o.left,a=r+(o.right-o.left-1);for(let c=o.top;c<o.bottom;c++){if(o.left>0&&n[i]==n[i-1]||o.right<t&&n[a]==n[a+1])return!0;i+=t,a+=t}for(let c=o.left;c<o.right;c++){if(o.top>0&&n[r]==n[r-t]||o.bottom<e&&n[s]==n[s+t])return!0;r++,s++}return!1}function np(t,e){const n=t.selection;if(!(n instanceof Le)||n.$anchorCell.pos==n.$headCell.pos)return!1;const o=In(t),{map:r}=o;if(cN(r,o))return!1;if(e){const i=t.tr,s={};let a=T.empty,c,d;for(let u=o.top;u<o.bottom;u++)for(let p=o.left;p<o.right;p++){const f=r.map[u*r.width+p],h=o.table.nodeAt(f);if(!(s[f]||!h))if(s[f]=!0,c==null)c=f,d=h;else{tp(h)||(a=a.append(h.content));const m=i.mapping.map(f+o.tableStart);i.delete(m,m+h.nodeSize)}}if(c==null||d==null)return!0;if(i.setNodeMarkup(c+o.tableStart,null,{...Mm(d.attrs,d.attrs.colspan,o.right-o.left-d.attrs.colspan),rowspan:o.bottom-o.top}),a.size){const u=c+1+d.content.size,p=tp(d)?c+1:u;i.replaceWith(p+o.tableStart,u+o.tableStart,a)}i.setSelection(new Le(i.doc.resolve(c+o.tableStart))),e(i)}return!0}function op(t,e){const n=Ct(t.schema);return dN(({node:o})=>n[o.type.spec.tableRole])(t,e)}function dN(t){return(e,n)=>{var o;const r=e.selection;let i,s;if(r instanceof Le){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{if(i=Ux(r.$from),!i)return!1;s=(o=_r(r.$from))==null?void 0:o.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let a=i.attrs;const c=[],d=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});const u=In(e),p=e.tr;for(let h=0;h<u.right-u.left;h++)c.push(d?{...a,colwidth:d&&d[h]?[d[h]]:null}:a);let f;for(let h=u.top;h<u.bottom;h++){let m=u.map.positionAt(h,u.left,u.table);h==u.top&&(m+=i.nodeSize);for(let g=u.left,b=0;g<u.right;g++,b++)g==u.left&&h==u.top||p.insert(f=p.mapping.map(m+u.tableStart,1),t({node:i,row:h,col:g}).createAndFill(c[b]))}p.setNodeMarkup(s,t({node:i,row:u.top,col:u.left}),c[0]),r instanceof Le&&p.setSelection(new Le(p.doc.resolve(r.$anchorCell.pos),f?p.doc.resolve(f):void 0)),n(p)}return!0}}function uN(t,e){return function(n,o){if(!vn(n))return!1;const r=Ca(n);if(r.nodeAfter.attrs[t]===e)return!1;if(o){const i=n.tr;n.selection instanceof Le?n.selection.forEachCell((s,a)=>{s.attrs[t]!==e&&i.setNodeMarkup(a,null,{...s.attrs,[t]:e})}):i.setNodeMarkup(r.pos,null,{...r.nodeAfter.attrs,[t]:e}),o(i)}return!0}}function pN(t){return function(e,n){if(!vn(e))return!1;if(n){const o=Ct(e.schema),r=In(e),i=e.tr,s=r.map.cellsInRect(t=="column"?{left:r.left,top:0,right:r.right,bottom:r.map.height}:t=="row"?{left:0,top:r.top,right:r.map.width,bottom:r.bottom}:r),a=s.map(c=>r.table.nodeAt(c));for(let c=0;c<s.length;c++)a[c].type==o.header_cell&&i.setNodeMarkup(r.tableStart+s[c],o.cell,a[c].attrs);if(i.steps.length==0)for(let c=0;c<s.length;c++)i.setNodeMarkup(r.tableStart+s[c],o.header_cell,a[c].attrs);n(i)}return!0}}function rp(t,e,n){const o=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let r=0;r<o.length;r++){const i=e.table.nodeAt(o[r]);if(i&&i.type!==n.header_cell)return!1}return!0}function di(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?pN(t):function(n,o){if(!vn(n))return!1;if(o){const r=Ct(n.schema),i=In(n),s=n.tr,a=rp("row",i,r),c=rp("column",i,r),u=(t==="column"?a:t==="row"?c:!1)?1:0,p=t=="column"?{left:0,top:u,right:1,bottom:i.map.height}:t=="row"?{left:u,top:0,right:i.map.width,bottom:1}:i,f=t=="column"?c?r.cell:r.header_cell:t=="row"?a?r.cell:r.header_cell:r.cell;i.map.cellsInRect(p).forEach(h=>{const m=h+i.tableStart,g=s.doc.nodeAt(m);g&&s.setNodeMarkup(m,f,g.attrs)}),o(s)}return!0}}di("row",{useDeprecatedLogic:!0});di("column",{useDeprecatedLogic:!0});var fN=di("cell",{useDeprecatedLogic:!0});function hN(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let o=t.index(-1)-1,r=t.before();o>=0;o--){const i=t.node(-1).child(o),s=i.lastChild;if(s)return r-1-s.nodeSize;r-=i.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let o=t.indexAfter(-1),r=t.after();o<n.childCount;o++){const i=n.child(o);if(i.childCount)return r+1;r+=i.nodeSize}}return null}function ip(t){return function(e,n){if(!vn(e))return!1;const o=hN(Ca(e),t);if(o==null)return!1;if(n){const r=e.doc.resolve(o);n(e.tr.setSelection(J.between(r,Wx(r))).scrollIntoView())}return!0}}function mN(t,e){const n=t.selection.$anchor;for(let o=n.depth;o>0;o--)if(n.node(o).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(o),n.after(o)).scrollIntoView()),!0;return!1}function Li(t,e){const n=t.selection;if(!(n instanceof Le))return!1;if(e){const o=t.tr,r=Ct(t.schema).cell.createAndFill().content;n.forEachCell((i,s)=>{i.content.eq(r)||o.replace(o.mapping.map(s+1),o.mapping.map(s+i.nodeSize-1),new $(r,0,0))}),o.docChanged&&e(o)}return!0}function gN(t){if(!t.size)return null;let{content:e,openStart:n,openEnd:o}=t;for(;e.childCount==1&&(n>0&&o>0||e.child(0).type.spec.tableRole=="table");)n--,o--,e=e.child(0).content;const r=e.child(0),i=r.type.spec.tableRole,s=r.type.schema,a=[];if(i=="row")for(let c=0;c<e.childCount;c++){let d=e.child(c).content;const u=c?0:Math.max(0,n-1),p=c<e.childCount-1?0:Math.max(0,o-1);(u||p)&&(d=Kl(Ct(s).row,new $(d,u,p)).content),a.push(d)}else if(i=="cell"||i=="header_cell")a.push(n||o?Kl(Ct(s).row,new $(e,n,o)).content:e);else return null;return bN(s,a)}function bN(t,e){const n=[];for(let r=0;r<e.length;r++){const i=e[r];for(let s=i.childCount-1;s>=0;s--){const{rowspan:a,colspan:c}=i.child(s).attrs;for(let d=r;d<r+a;d++)n[d]=(n[d]||0)+c}}let o=0;for(let r=0;r<n.length;r++)o=Math.max(o,n[r]);for(let r=0;r<n.length;r++)if(r>=e.length&&e.push(T.empty),n[r]<o){const i=Ct(t).cell.createAndFill(),s=[];for(let a=n[r];a<o;a++)s.push(i);e[r]=e[r].append(T.from(s))}return{height:e.length,width:o,rows:e}}function Kl(t,e){const n=t.createAndFill();return new sc(n).replace(0,n.content.size,e).doc}function yN({width:t,height:e,rows:n},o,r){if(t!=o){const i=[],s=[];for(let a=0;a<n.length;a++){const c=n[a],d=[];for(let u=i[a]||0,p=0;u<o;p++){let f=c.child(p%c.childCount);u+f.attrs.colspan>o&&(f=f.type.createChecked(Uo(f.attrs,f.attrs.colspan,u+f.attrs.colspan-o),f.content)),d.push(f),u+=f.attrs.colspan;for(let h=1;h<f.attrs.rowspan;h++)i[a+h]=(i[a+h]||0)+f.attrs.colspan}s.push(T.from(d))}n=s,t=o}if(e!=r){const i=[];for(let s=0,a=0;s<r;s++,a++){const c=[],d=n[a%e];for(let u=0;u<d.childCount;u++){let p=d.child(u);s+p.attrs.rowspan>r&&(p=p.type.create({...p.attrs,rowspan:Math.max(1,r-p.attrs.rowspan)},p.content)),c.push(p)}i.push(T.from(c))}n=i,e=r}return{width:t,height:e,rows:n}}function vN(t,e,n,o,r,i,s){const a=t.doc.type.schema,c=Ct(a);let d,u;if(r>e.width)for(let p=0,f=0;p<e.height;p++){const h=n.child(p);f+=h.nodeSize;const m=[];let g;h.lastChild==null||h.lastChild.type==c.cell?g=d||(d=c.cell.createAndFill()):g=u||(u=c.header_cell.createAndFill());for(let b=e.width;b<r;b++)m.push(g);t.insert(t.mapping.slice(s).map(f-1+o),m)}if(i>e.height){const p=[];for(let m=0,g=(e.height-1)*e.width;m<Math.max(e.width,r);m++){const b=m>=e.width?!1:n.nodeAt(e.map[g+m]).type==c.header_cell;p.push(b?u||(u=c.header_cell.createAndFill()):d||(d=c.cell.createAndFill()))}const f=c.row.create(null,T.from(p)),h=[];for(let m=e.height;m<i;m++)h.push(f);t.insert(t.mapping.slice(s).map(o+n.nodeSize-2),h)}return!!(d||u)}function sp(t,e,n,o,r,i,s,a){if(s==0||s==e.height)return!1;let c=!1;for(let d=r;d<i;d++){const u=s*e.width+d,p=e.map[u];if(e.map[u-e.width]==p){c=!0;const f=n.nodeAt(p),{top:h,left:m}=e.findCell(p);t.setNodeMarkup(t.mapping.slice(a).map(p+o),null,{...f.attrs,rowspan:s-h}),t.insert(t.mapping.slice(a).map(e.positionAt(s,m,n)),f.type.createAndFill({...f.attrs,rowspan:h+f.attrs.rowspan-s})),d+=f.attrs.colspan-1}}return c}function ap(t,e,n,o,r,i,s,a){if(s==0||s==e.width)return!1;let c=!1;for(let d=r;d<i;d++){const u=d*e.width+s,p=e.map[u];if(e.map[u-1]==p){c=!0;const f=n.nodeAt(p),h=e.colCount(p),m=t.mapping.slice(a).map(p+o);t.setNodeMarkup(m,null,Uo(f.attrs,s-h,f.attrs.colspan-(s-h))),t.insert(m+f.nodeSize,f.type.createAndFill(Uo(f.attrs,0,s-h))),d+=f.attrs.rowspan-1}}return c}function lp(t,e,n,o,r){let i=n?t.doc.nodeAt(n-1):t.doc;if(!i)throw new Error("No table found");let s=Ge.get(i);const{top:a,left:c}=o,d=c+r.width,u=a+r.height,p=t.tr;let f=0;function h(){if(i=n?p.doc.nodeAt(n-1):p.doc,!i)throw new Error("No table found");s=Ge.get(i),f=p.mapping.maps.length}vN(p,s,i,n,d,u,f)&&h(),sp(p,s,i,n,c,d,a,f)&&h(),sp(p,s,i,n,c,d,u,f)&&h(),ap(p,s,i,n,a,u,c,f)&&h(),ap(p,s,i,n,a,u,d,f)&&h();for(let m=a;m<u;m++){const g=s.positionAt(m,c,i),b=s.positionAt(m,d,i);p.replace(p.mapping.slice(f).map(g+n),p.mapping.slice(f).map(b+n),new $(r.rows[m-a],0,0))}h(),p.setSelection(new Le(p.doc.resolve(n+s.positionAt(a,c,i)),p.doc.resolve(n+s.positionAt(u-1,d-1,i)))),e(p)}var kN=bc({ArrowLeft:Pi("horiz",-1),ArrowRight:Pi("horiz",1),ArrowUp:Pi("vert",-1),ArrowDown:Pi("vert",1),"Shift-ArrowLeft":$i("horiz",-1),"Shift-ArrowRight":$i("horiz",1),"Shift-ArrowUp":$i("vert",-1),"Shift-ArrowDown":$i("vert",1),Backspace:Li,"Mod-Backspace":Li,Delete:Li,"Mod-Delete":Li});function is(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Pi(t,e){return(n,o,r)=>{if(!r)return!1;const i=n.selection;if(i instanceof Le)return is(n,o,ee.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;const s=Lm(r,t,e);if(s==null)return!1;if(t=="horiz")return is(n,o,ee.near(n.doc.resolve(i.head+e),e));{const a=n.doc.resolve(s),c=Om(a,t,e);let d;return c?d=ee.near(c,1):e<0?d=ee.near(n.doc.resolve(a.before(-1)),-1):d=ee.near(n.doc.resolve(a.after(-1)),1),is(n,o,d)}}}function $i(t,e){return(n,o,r)=>{if(!r)return!1;const i=n.selection;let s;if(i instanceof Le)s=i;else{const c=Lm(r,t,e);if(c==null)return!1;s=new Le(n.doc.resolve(c))}const a=Om(s.$headCell,t,e);return a?is(n,o,new Le(s.$anchorCell,a)):!1}}function EN(t,e){const n=t.state.doc,o=_r(n.resolve(e));return o?(t.dispatch(t.state.tr.setSelection(new Le(o))),!0):!1}function wN(t,e,n){if(!vn(t.state))return!1;let o=gN(n);const r=t.state.selection;if(r instanceof Le){o||(o={width:1,height:1,rows:[T.from(Kl(Ct(t.state.schema).cell,n))]});const i=r.$anchorCell.node(-1),s=r.$anchorCell.start(-1),a=Ge.get(i).rectBetween(r.$anchorCell.pos-s,r.$headCell.pos-s);return o=yN(o,a.right-a.left,a.bottom-a.top),lp(t.state,t.dispatch,s,a,o),!0}else if(o){const i=Ca(t.state),s=i.start(-1);return lp(t.state,t.dispatch,s,Ge.get(i.node(-1)).findCell(i.pos-s),o),!0}else return!1}function CN(t,e){var n;if(e.ctrlKey||e.metaKey)return;const o=cp(t,e.target);let r;if(e.shiftKey&&t.state.selection instanceof Le)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&o&&(r=_r(t.state.selection.$anchor))!=null&&((n=ol(t,e))==null?void 0:n.pos)!=r.pos)i(r,e),e.preventDefault();else if(!o)return;function i(c,d){let u=ol(t,d);const p=io.getState(t.state)==null;if(!u||!Yc(c,u))if(p)u=c;else return;const f=new Le(c,u);if(p||!t.state.selection.eq(f)){const h=t.state.tr.setSelection(f);p&&h.setMeta(io,c.pos),t.dispatch(h)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",a),io.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(io,-1))}function a(c){const d=c,u=io.getState(t.state);let p;if(u!=null)p=t.state.doc.resolve(u);else if(cp(t,d.target)!=o&&(p=ol(t,e),!p))return s();p&&i(p,d)}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",a)}function Lm(t,e,n){if(!(t.state.selection instanceof J))return null;const{$head:o}=t.state.selection;for(let r=o.depth-1;r>=0;r--){const i=o.node(r);if((n<0?o.index(r):o.indexAfter(r))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const a=o.before(r),c=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(c)?a:null}}return null}function cp(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function ol(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?_r(t.state.doc.resolve(n.pos)):null}var _N=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),jl(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,jl(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function jl(t,e,n,o,r,i){var s;let a=0,c=!0,d=e.firstChild;const u=t.firstChild;if(u){for(let p=0,f=0;p<u.childCount;p++){const{colspan:h,colwidth:m}=u.child(p).attrs;for(let g=0;g<h;g++,f++){const b=r==f?i:m&&m[g],y=b?b+"px":"";if(a+=b||o,b||(c=!1),d)d.style.width!=y&&(d.style.width=y),d=d.nextSibling;else{const k=document.createElement("col");k.style.width=y,e.appendChild(k)}}}for(;d;){const p=d.nextSibling;(s=d.parentNode)==null||s.removeChild(d),d=p}c?(n.style.width=a+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=a+"px")}}var Kt=new xe("tableColumnResizing");function SN({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:o=_N,lastColumnResizable:r=!0}={}){const i=new Se({key:Kt,state:{init(s,a){var c,d;const u=(d=(c=i.spec)==null?void 0:c.props)==null?void 0:d.nodeViews,p=Ct(a.schema).table.name;return o&&u&&(u[p]=(f,h)=>new o(f,n,h)),new xN(-1,!1)},apply(s,a){return a.apply(s)}},props:{attributes:s=>{const a=Kt.getState(s);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,a)=>{NN(s,a,t,r)},mouseleave:s=>{TN(s)},mousedown:(s,a)=>{ON(s,a,e,n)}},decorations:s=>{const a=Kt.getState(s);if(a&&a.activeHandle>-1)return IN(s,a.activeHandle)},nodeViews:{}}});return i}var xN=class ss{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,o=e.getMeta(Kt);if(o&&o.setHandle!=null)return new ss(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new ss(n.activeHandle,o.setDragging);if(n.activeHandle>-1&&e.docChanged){let r=e.mapping.map(n.activeHandle,-1);return Wl(e.doc.resolve(r))||(r=-1),new ss(r,n.dragging)}return n}};function NN(t,e,n,o){if(!t.editable)return;const r=Kt.getState(t.state);if(r&&!r.dragging){const i=AN(e.target);let s=-1;if(i){const{left:a,right:c}=i.getBoundingClientRect();e.clientX-a<=n?s=dp(t,e,"left",n):c-e.clientX<=n&&(s=dp(t,e,"right",n))}if(s!=r.activeHandle){if(!o&&s!==-1){const a=t.state.doc.resolve(s),c=a.node(-1),d=Ge.get(c),u=a.start(-1);if(d.colCount(a.pos-u)+a.nodeAfter.attrs.colspan-1==d.width-1)return}Pm(t,s)}}}function TN(t){if(!t.editable)return;const e=Kt.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Pm(t,-1)}function ON(t,e,n,o){var r;if(!t.editable)return!1;const i=(r=t.dom.ownerDocument.defaultView)!=null?r:window,s=Kt.getState(t.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const a=t.state.doc.nodeAt(s.activeHandle),c=MN(t,s.activeHandle,a.attrs);t.dispatch(t.state.tr.setMeta(Kt,{setDragging:{startX:e.clientX,startWidth:c}}));function d(p){i.removeEventListener("mouseup",d),i.removeEventListener("mousemove",u);const f=Kt.getState(t.state);f!=null&&f.dragging&&(RN(t,f.activeHandle,up(f.dragging,p,n)),t.dispatch(t.state.tr.setMeta(Kt,{setDragging:null})))}function u(p){if(!p.which)return d(p);const f=Kt.getState(t.state);if(f&&f.dragging){const h=up(f.dragging,p,n);pp(t,f.activeHandle,h,o)}}return pp(t,s.activeHandle,c,o),i.addEventListener("mouseup",d),i.addEventListener("mousemove",u),e.preventDefault(),!0}function MN(t,e,{colspan:n,colwidth:o}){const r=o&&o[o.length-1];if(r)return r;const i=t.domAtPos(e);let a=i.node.childNodes[i.offset].offsetWidth,c=n;if(o)for(let d=0;d<n;d++)o[d]&&(a-=o[d],c--);return a/c}function AN(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function dp(t,e,n,o){const r=n=="right"?-o:o,i=t.posAtCoords({left:e.clientX+r,top:e.clientY});if(!i)return-1;const{pos:s}=i,a=_r(t.state.doc.resolve(s));if(!a)return-1;if(n=="right")return a.pos;const c=Ge.get(a.node(-1)),d=a.start(-1),u=c.map.indexOf(a.pos-d);return u%c.width==0?-1:d+c.map[u-1]}function up(t,e,n){const o=e.clientX-t.startX;return Math.max(n,t.startWidth+o)}function Pm(t,e){t.dispatch(t.state.tr.setMeta(Kt,{setHandle:e}))}function RN(t,e,n){const o=t.state.doc.resolve(e),r=o.node(-1),i=Ge.get(r),s=o.start(-1),a=i.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,c=t.state.tr;for(let d=0;d<i.height;d++){const u=d*i.width+a;if(d&&i.map[u]==i.map[u-i.width])continue;const p=i.map[u],f=r.nodeAt(p).attrs,h=f.colspan==1?0:a-i.colCount(p);if(f.colwidth&&f.colwidth[h]==n)continue;const m=f.colwidth?f.colwidth.slice():DN(f.colspan);m[h]=n,c.setNodeMarkup(s+p,null,{...f,colwidth:m})}c.docChanged&&t.dispatch(c)}function pp(t,e,n,o){const r=t.state.doc.resolve(e),i=r.node(-1),s=r.start(-1),a=Ge.get(i).colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1;let c=t.domAtPos(r.start(-1)).node;for(;c&&c.nodeName!="TABLE";)c=c.parentNode;c&&jl(i,c.firstChild,c,o,a,n)}function DN(t){return Array(t).fill(0)}function IN(t,e){var n;const o=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return Me.empty;const s=Ge.get(i),a=r.start(-1),c=s.colCount(r.pos-a)+r.nodeAfter.attrs.colspan-1;for(let d=0;d<s.height;d++){const u=c+d*s.width;if((c==s.width-1||s.map[u]!=s.map[u+1])&&(d==0||s.map[u]!=s.map[u-s.width])){const p=s.map[u],f=a+p+i.nodeAt(p).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",(n=Kt.getState(t))!=null&&n.dragging&&o.push(Ze.node(a+p,a+p+i.nodeAt(p).nodeSize,{class:"column-resize-dragging"})),o.push(Ze.widget(f,h))}}return Me.create(t.doc,o)}function BN({allowTableNodeSelection:t=!1}={}){return new Se({key:io,state:{init(){return null},apply(e,n){const o=e.getMeta(io);if(o!=null)return o==-1?null:o;if(n==null||!e.docChanged)return n;const{deleted:r,pos:i}=e.mapping.mapResult(n);return r?null:i}},props:{decorations:Gx,handleDOMEvents:{mousedown:CN},createSelectionBetween(e){return io.getState(e.state)!=null?e.state.selection:null},handleTripleClick:EN,handleKeyDown:kN,handlePaste:wN},appendTransaction(e,n,o){return Xx(o,Dm(o,n),t)}})}function Gl(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function fp(t,e,n,o,r,i){var s;let a=0,c=!0,d=e.firstChild;const u=t.firstChild;if(u!==null)for(let p=0,f=0;p<u.childCount;p+=1){const{colspan:h,colwidth:m}=u.child(p).attrs;for(let g=0;g<h;g+=1,f+=1){const b=r===f?i:m&&m[g],y=b?`${b}px`:"";if(a+=b||o,b||(c=!1),d){if(d.style.width!==y){const[k,w]=Gl(o,b);d.style.setProperty(k,w)}d=d.nextSibling}else{const k=document.createElement("col"),[w,v]=Gl(o,b);k.style.setProperty(w,v),e.appendChild(k)}}}for(;d;){const p=d.nextSibling;(s=d.parentNode)===null||s===void 0||s.removeChild(d),d=p}c?(n.style.width=`${a}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${a}px`)}class LN{constructor(e,n){this.node=e,this.cellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),fp(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,fp(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function PN(t,e,n,o){let r=0,i=!0;const s=[],a=t.firstChild;if(!a)return{};for(let p=0,f=0;p<a.childCount;p+=1){const{colspan:h,colwidth:m}=a.child(p).attrs;for(let g=0;g<h;g+=1,f+=1){const b=n===f?o:m&&m[g];r+=b||e,b||(i=!1);const[y,k]=Gl(e,b);s.push(["col",{style:`${y}: ${k}`}])}}const c=i?`${r}px`:"",d=i?"":`${r}px`;return{colgroup:["colgroup",{},...s],tableWidth:c,tableMinWidth:d}}function hp(t,e){return t.createAndFill()}function $N(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const o=t.nodes[n];o.spec.tableRole&&(e[o.spec.tableRole]=o)}),t.cached.tableNodeTypes=e,e}function $m(t,e,n,o,r){const i=$N(t),s=[],a=[];for(let d=0;d<n;d+=1){const u=hp(i.cell);if(u&&a.push(u),o){const p=hp(i.header_cell);p&&s.push(p)}}const c=[];for(let d=0;d<e;d+=1)c.push(i.row.createChecked(null,o&&d===0?s:a));return i.table.createChecked(null,c)}function FN(t){return t instanceof Le}const Fi=({editor:t})=>{const{selection:e}=t.state;if(!FN(e))return!1;let n=0;const o=wh(e.ranges[0].$from,i=>i.type.name==="table");return o==null||o.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},Fm=Ue.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:LN,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:o,tableMinWidth:r}=PN(t,this.options.cellMinWidth);return["table",Ce(this.options.HTMLAttributes,e,{style:o?`width: ${o}`:`min-width: ${r}`}),n,["tbody",0]]},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:o,dispatch:r,editor:i})=>{const s=$m(i.schema,t,e,n);if(r){const a=o.selection.from+1;o.replaceSelectionWith(s).scrollIntoView().setSelection(J.near(o.doc.resolve(a)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>eN(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>tN(t,e),deleteColumn:()=>({state:t,dispatch:e})=>oN(t,e),addRowBefore:()=>({state:t,dispatch:e})=>iN(t,e),addRowAfter:()=>({state:t,dispatch:e})=>sN(t,e),deleteRow:()=>({state:t,dispatch:e})=>lN(t,e),deleteTable:()=>({state:t,dispatch:e})=>mN(t,e),mergeCells:()=>({state:t,dispatch:e})=>np(t,e),splitCell:()=>({state:t,dispatch:e})=>op(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>di("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>di("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>fN(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>np(t,e)?!0:op(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:o})=>uN(t,e)(n,o),goToNextCell:()=>({state:t,dispatch:e})=>ip(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>ip(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&Dm(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const o=Le.create(e.doc,t.anchorCell,t.headCell);e.setSelection(o)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Fi,"Mod-Backspace":Fi,Delete:Fi,"Mod-Delete":Fi}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[SN({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],BN({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:me(U(t,"tableRole",e))}}});/**
160
+ **/const Eg=De.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Ae({key:new xe("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:o}=e,r=[];return n?(t.descendants((i,s)=>{const l=o>=s&&o<=s+i.nodeSize,c=!i.isLeaf&&!i.childCount,u=this.options.showOnlyCurrent;if((l||!u)&&c){const d=[this.options.emptyNodeClass];this.editor.isEmpty&&d.push(this.options.emptyEditorClass);const p=Ge.node(s,s+i.nodeSize,{class:d.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:i,pos:s,hasAnchor:l}):this.options.placeholder});r.push(p)}return this.options.includeChildren}),Ne.create(t,r)):null}}})]}});/**
126
161
  * Copyright 2025 Yiitap
127
162
  * @license MIT
128
- **/function mp(t,e,n,o,r,i){let s=0,a=!0,c=e.firstChild;const d=t.firstChild;for(let u=0,p=0;u<d.childCount;u+=1){const{colspan:f,colwidth:h}=d.child(u).attrs;for(let m=0;m<f;m+=1,p+=1){const g=r===p?i:h&&h[m],b=g?`${g}px`:"";if(s+=g||o,g||(a=!1),c)c.style.width!==b&&(c.style.width=b),c=c.nextSibling;else{const y=document.createElement("col");y.className=`col-${p}`,e.appendChild(y).style.width=b}}}for(;c;){const u=c.nextSibling;c.parentNode.removeChild(c),c=u}a?(n.style.width=`${s}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${s}px`)}class VN{constructor(e,n,o){this.node=e,this.cellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),mp(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,mp(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}const Vm=Fm.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{},resizable:!0,handleWidth:5,cellMinWidth:25,View:VN,lastColumnResizable:!0,allowTableNodeSelection:!1}},addCommands(){var t;return{...(t=this.parent)==null?void 0:t.call(this),insertTable:e=>({editor:n,commands:o,tr:r,dispatch:i})=>{const{rows:s=3,cols:a=3,withHeaderRow:c=!0}=e||{},d=$m(n.schema,s,a,c);if(i){const u=r.selection.anchor+1;o.insertContent({type:"table-wrapper",content:[d.toJSON()]}),r.scrollIntoView().setSelection(J.near(r.doc.resolve(u)))}return!0},deleteTable:()=>({state:e,dispatch:n})=>{const o=e.selection.$anchor;for(let r=o.depth;r>0;r--)if(o.node(r).type.name==="table-wrapper")return n&&n(e.tr.delete(o.before(r),o.after(r)).scrollIntoView()),!0;return!1},selectRow:e=>({tr:n,dispatch:o})=>{if(o){const r=n.doc.resolve(e),i=Le.rowSelection(r);n.setSelection(i)}return!0},selectColumn:e=>({tr:n,dispatch:o})=>{if(o){const r=n.doc.resolve(e),i=Le.colSelection(r);n.setSelection(i)}return!0}}}});/**
163
+ **/const Dr="selection-decoration",ji={BLUR:"blur",FOCUS:"focus"},_g=De.create({name:Dr,addProseMirrorPlugins(){return[new Ae({key:new xe(Dr),state:{init(t){return Ne.empty},apply:(t,e)=>{const{selection:n,doc:o}=t,r=t.getMeta(Dr),i=n&&n.from!==n.to;if(!i||(r==null?void 0:r.action)===ji.FOCUS)return Ne.empty;if(i&&(r==null?void 0:r.action)===ji.BLUR){const s=Ge.inline(n.from,n.to,{class:"selection-decoration-blur"});return Ne.create(o,[s])}return e}},props:{decorations(t){return this.getState(t)},handleDOMEvents:{blur:t=>{const{tr:e}=t.state,n=e.setMeta(Dr,{from:e.selection.from,to:e.selection.to,action:ji.BLUR});t.dispatch(n)},focus:t=>{const{tr:e}=t.state,n=e.setMeta(Dr,{from:e.selection.from,to:e.selection.to,action:ji.FOCUS});t.dispatch(n)}}}})]}});/**
129
164
  * Copyright 2025 Yiitap
130
165
  * @license MIT
131
- **/function zN({node:t,types:e}){return Array.isArray(e)&&e.includes(t.type)||t.type===e}function Vi({node:t,types:e}){return t?!zN({node:t,types:e}):!1}const zm=De.create({name:"trailingNode",addOptions(){return{node:"paragraph",notAfter:["paragraph"]}},addProseMirrorPlugins(){const t=new xe(this.name),e=Object.entries(this.editor.schema.nodes).map(([,n])=>n).filter(n=>this.options.notAfter.includes(n.name));return[new Se({key:t,appendTransaction:(n,o,r)=>{const{doc:i,tr:s,schema:a}=r,c=t.getState(r),d=i.content.size,u=a.nodes[this.options.node];if(!(!c||!u))return s.insert(d,u.create())},state:{init:(n,o)=>{const r=o.tr.doc.lastChild,i=(r==null?void 0:r.firstChild)??null;return Vi({node:r,types:e})||Vi({node:i,types:e})},apply:(n,o)=>{var s;if(!n.docChanged)return o;const r=n.doc.lastChild,i=((s=n.doc.lastChild)==null?void 0:s.firstChild)??null;return Vi({node:r,types:e})||Vi({node:i,types:e})}}})]}});var mt=[];for(var rl=0;rl<256;++rl)mt.push((rl+256).toString(16).slice(1));function HN(t,e=0){return(mt[t[e+0]]+mt[t[e+1]]+mt[t[e+2]]+mt[t[e+3]]+"-"+mt[t[e+4]]+mt[t[e+5]]+"-"+mt[t[e+6]]+mt[t[e+7]]+"-"+mt[t[e+8]]+mt[t[e+9]]+"-"+mt[t[e+10]]+mt[t[e+11]]+mt[t[e+12]]+mt[t[e+13]]+mt[t[e+14]]+mt[t[e+15]]).toLowerCase()}var zi,UN=new Uint8Array(16);function qN(){if(!zi&&(zi=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!zi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return zi(UN)}var WN=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const gp={randomUUID:WN};function KN(t,e,n){if(gp.randomUUID&&!t)return gp.randomUUID();t=t||{};var o=t.random||(t.rng||qN)();return o[6]=o[6]&15|64,o[8]=o[8]&63|128,HN(o)}/**
166
+ **/function Bp(t,e,n,o,r,i){let s=0,l=!0,c=e.firstChild;const u=t.firstChild;for(let d=0,p=0;d<u.childCount;d+=1){const{colspan:f,colwidth:h}=u.child(d).attrs;for(let m=0;m<f;m+=1,p+=1){const g=r===p?i:h&&h[m],b=g?`${g}px`:"";if(s+=g||o,g||(l=!1),c)c.style.width!==b&&(c.style.width=b),c=c.nextSibling;else{const y=document.createElement("col");y.className=`col-${p}`,e.appendChild(y).style.width=b}}}for(;c;){const d=c.nextSibling;c.parentNode.removeChild(c),c=d}l?(n.style.width=`${s}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${s}px`)}class _T{constructor(e,n,o){this.node=e,this.cellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Bp(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,Bp(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}const Cg=yg.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{},resizable:!0,handleWidth:5,cellMinWidth:25,View:_T,lastColumnResizable:!0,allowTableNodeSelection:!1}},addCommands(){var t;return{...(t=this.parent)==null?void 0:t.call(this),insertTable:e=>({editor:n,commands:o,tr:r,dispatch:i})=>{const{rows:s=3,cols:l=3,withHeaderRow:c=!0}=e||{},u=bg(n.schema,s,l,c);if(i){const d=r.selection.anchor+1;o.insertContent({type:"table-wrapper",content:[u.toJSON()]}),r.scrollIntoView().setSelection(ne.near(r.doc.resolve(d)))}return!0},deleteTable:()=>({state:e,dispatch:n})=>{const o=e.selection.$anchor;for(let r=o.depth;r>0;r--)if(o.node(r).type.name==="table-wrapper")return n&&n(e.tr.delete(o.before(r),o.after(r)).scrollIntoView()),!0;return!1},selectRow:e=>({tr:n,dispatch:o})=>{if(o){const r=n.doc.resolve(e),i=Ve.rowSelection(r);n.setSelection(i)}return!0},selectColumn:e=>({tr:n,dispatch:o})=>{if(o){const r=n.doc.resolve(e),i=Ve.colSelection(r);n.setSelection(i)}return!0}}}});/**
132
167
  * Copyright 2025 Yiitap
133
168
  * @license MIT
134
- **/const Hm=Ue.create({name:"uniqueID",priority:1e4,addOptions:()=>({attributeName:"data-id",types:["heading"],enableRender:!1,generateId:()=>KN()}),addGlobalAttributes(){return[{types:this.options.types,attributes:{[this.options.attributeName]:{default:null,parseHTML:t=>t.getAttribute(this.options.attributeName),renderHTML:t=>this.options.enableRender?{[this.options.attributeName]:t[this.options.attributeName]}:{}}}}]},addProseMirrorPlugins(){return[new Se({key:new xe(this.name),props:{transformPastedHTML:t=>{const e=new DOMParser().parseFromString(t,"text/html"),n=this.options.attributeName;return e.querySelectorAll(`[${n}]`).forEach(o=>{o.setAttribute(n,this.options.generateId())}),e.body.innerHTML}},appendTransaction:(t,e,n)=>{const o=n.tr,r=this.options.attributeName;let i=!1;return n.doc.descendants((s,a)=>{s.isText||!s.attrs[r]&&this.options.types.includes(s.type.name)&&(o.setNodeMarkup(a,void 0,{...s.attrs,[r]:this.options.generateId()}),i=!0)}),i?o:null}})]}});/**
169
+ **/function CT({node:t,types:e}){return Array.isArray(e)&&e.includes(t.type)||t.type===e}function Gi({node:t,types:e}){return t?!CT({node:t,types:e}):!1}const Sg=De.create({name:"trailingNode",addOptions(){return{node:"paragraph",notAfter:["paragraph"]}},addProseMirrorPlugins(){const t=new xe(this.name),e=Object.entries(this.editor.schema.nodes).map(([,n])=>n).filter(n=>this.options.notAfter.includes(n.name));return[new Ae({key:t,appendTransaction:(n,o,r)=>{const{doc:i,tr:s,schema:l}=r,c=t.getState(r),u=i.content.size,d=l.nodes[this.options.node];if(!(!c||!d))return s.insert(u,d.create())},state:{init:(n,o)=>{const r=o.tr.doc.lastChild,i=(r==null?void 0:r.firstChild)??null;return Gi({node:r,types:e})||Gi({node:i,types:e})},apply:(n,o)=>{var s;if(!n.docChanged)return o;const r=n.doc.lastChild,i=((s=n.doc.lastChild)==null?void 0:s.firstChild)??null;return Gi({node:r,types:e})||Gi({node:i,types:e})}}})]}});var bt=[];for(var hl=0;hl<256;++hl)bt.push((hl+256).toString(16).slice(1));function ST(t,e=0){return(bt[t[e+0]]+bt[t[e+1]]+bt[t[e+2]]+bt[t[e+3]]+"-"+bt[t[e+4]]+bt[t[e+5]]+"-"+bt[t[e+6]]+bt[t[e+7]]+"-"+bt[t[e+8]]+bt[t[e+9]]+"-"+bt[t[e+10]]+bt[t[e+11]]+bt[t[e+12]]+bt[t[e+13]]+bt[t[e+14]]+bt[t[e+15]]).toLowerCase()}var Yi,xT=new Uint8Array(16);function NT(){if(!Yi&&(Yi=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Yi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Yi(xT)}var TT=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Dp={randomUUID:TT};function OT(t,e,n){if(Dp.randomUUID&&!t)return Dp.randomUUID();t=t||{};var o=t.random||(t.rng||NT)();return o[6]=o[6]&15|64,o[8]=o[8]&63|128,ST(o)}/**
135
170
  * Copyright 2025 Yiitap
136
171
  * @license MIT
137
- **/function jN(t){var e;const{char:n,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:a}=t,c=o&&!r,d=lw(n),u=new RegExp(`\\s${d}$`),p=s?"^":"",f=r?"":d,h=c?new RegExp(`${p}${d}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${p}(?:^)?${d}[^\\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,b=Array.from(m.matchAll(h)).pop();if(!b||b.input===void 0||b.index===void 0)return null;const y=b.input.slice(Math.max(0,b.index-1),b.index),k=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(y);if(i!==null&&!k)return null;const w=g+b.index;let v=w+b[0].length;return c&&u.test(m.slice(v-1,v+1))&&(b[0]+=" ",v+=1),w<a.pos&&v>=a.pos?{range:{from:w,to:v},query:b[0].slice(n.length),text:b[0]}:null}const GN=new xe("suggestion");function Jc({pluginKey:t=GN,editor:e,char:n="@",allowSpaces:o=!1,allowToIncludeChar:r=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:a="span",decorationClass:c="suggestion",command:d=()=>null,items:u=()=>[],render:p=()=>({}),allow:f=()=>!0,findSuggestionMatch:h=jN}){let m;const g=p==null?void 0:p(),b=new Se({key:t,view(){return{update:async(y,k)=>{var w,v,_,C,A,L,M;const P=(w=this.key)===null||w===void 0?void 0:w.getState(k),K=(v=this.key)===null||v===void 0?void 0:v.getState(y.state),te=P.active&&K.active&&P.range.from!==K.range.from,de=!P.active&&K.active,ce=P.active&&!K.active,re=!de&&!ce&&P.query!==K.query,ie=de||te&&re,x=re||te,O=ce||te&&re;if(!ie&&!x&&!O)return;const V=O&&!ie?P:K,Y=y.dom.querySelector(`[data-decoration-id="${V.decorationId}"]`);m={editor:e,range:V.range,query:V.query,text:V.text,items:[],command:Q=>d({editor:e,range:V.range,props:Q}),decorationNode:Y,clientRect:Y?()=>{var Q;const{decorationId:fe}=(Q=this.key)===null||Q===void 0?void 0:Q.getState(e.state),Ne=y.dom.querySelector(`[data-decoration-id="${fe}"]`);return(Ne==null?void 0:Ne.getBoundingClientRect())||null}:null},ie&&((_=g==null?void 0:g.onBeforeStart)===null||_===void 0||_.call(g,m)),x&&((C=g==null?void 0:g.onBeforeUpdate)===null||C===void 0||C.call(g,m)),(x||ie)&&(m.items=await u({editor:e,query:V.query})),O&&((A=g==null?void 0:g.onExit)===null||A===void 0||A.call(g,m)),x&&((L=g==null?void 0:g.onUpdate)===null||L===void 0||L.call(g,m)),ie&&((M=g==null?void 0:g.onStart)===null||M===void 0||M.call(g,m))},destroy:()=>{var y;m&&((y=g==null?void 0:g.onExit)===null||y===void 0||y.call(g,m))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(y,k,w,v){const{isEditable:_}=e,{composing:C}=e.view,{selection:A}=y,{empty:L,from:M}=A,P={...k};if(P.composing=C,_&&(L||e.view.composing)){(M<k.range.from||M>k.range.to)&&!C&&!k.composing&&(P.active=!1);const K=h({char:n,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:A.$from}),te=`id_${Math.floor(Math.random()*4294967295)}`;K&&f({editor:e,state:v,range:K.range,isActive:k.active})?(P.active=!0,P.decorationId=k.decorationId?k.decorationId:te,P.range=K.range,P.query=K.query,P.text=K.text):P.active=!1}else P.active=!1;return P.active||(P.decorationId=null,P.range={from:0,to:0},P.query=null,P.text=null),P}},props:{handleKeyDown(y,k){var w;const{active:v,range:_}=b.getState(y.state);return v&&((w=g==null?void 0:g.onKeyDown)===null||w===void 0?void 0:w.call(g,{view:y,event:k,range:_}))||!1},decorations(y){const{active:k,range:w,decorationId:v}=b.getState(y);return k?Me.create(y.doc,[Ze.inline(w.from,w.to,{nodeName:a,class:c,"data-decoration-id":v})]):null}}});return b}const Um=De.create({name:"slash-command",addOptions(){return{suggestion:{char:"/",command:({editor:t,range:e,props:n})=>{n.command({editor:t,range:e})}}}},addProseMirrorPlugins(){return[Jc({pluginKey:new xe("slash-command"),editor:this.editor,...this.options.suggestion})]}}),qm=De.create({name:"colon-command",addOptions(){return{suggestion:{char:":",command:({editor:t,range:e,props:n})=>{n.command({editor:t,range:e})}}}},addProseMirrorPlugins(){return[Jc({pluginKey:new xe("colon-command"),editor:this.editor,...this.options.suggestion})]}}),Wm=De.create({name:"slash-zh-command",addOptions(){return{suggestion:{char:"、",command:({editor:t,range:e,props:n})=>{n.command({editor:t,range:e})}}}},addProseMirrorPlugins(){return[Jc({pluginKey:new xe("slash-zh-command"),editor:this.editor,...this.options.suggestion})]}}),YN=l.defineComponent({__name:"view",props:ut,setup(t){const e=t;return(n,o)=>(l.openBlock(),l.createBlock(l.unref(Dn),l.mergeProps(e,{class:"o-blockquote-view"}),{default:l.withCtx(()=>[l.createElementVNode("blockquote",null,[l.createVNode(l.unref(Gn))])]),_:1},16))}}),Km=Xh.extend({draggable:!0,addNodeView(){return yn(YN)}});/**
172
+ **/const xg=ze.create({name:"uniqueID",priority:1e4,addOptions:()=>({attributeName:"data-id",types:["heading"],enableRender:!1,generateId:()=>OT()}),addGlobalAttributes(){return[{types:this.options.types,attributes:{[this.options.attributeName]:{default:null,parseHTML:t=>t.getAttribute(this.options.attributeName),renderHTML:t=>this.options.enableRender?{[this.options.attributeName]:t[this.options.attributeName]}:{}}}}]},addProseMirrorPlugins(){return[new Ae({key:new xe(this.name),props:{transformPastedHTML:t=>{const e=new DOMParser().parseFromString(t,"text/html"),n=this.options.attributeName;return e.querySelectorAll(`[${n}]`).forEach(o=>{o.setAttribute(n,this.options.generateId())}),e.body.innerHTML}},appendTransaction:(t,e,n)=>{const o=n.tr,r=this.options.attributeName;let i=!1;return n.doc.descendants((s,l)=>{s.isText||!s.attrs[r]&&this.options.types.includes(s.type.name)&&(o.setNodeMarkup(l,void 0,{...s.attrs,[r]:this.options.generateId()}),i=!0)}),i?o:null}})]}});/**
138
173
  * Copyright 2025 Yiitap
139
174
  * @license MIT
140
- **/const JN=Ue.create({name:"callout",group:"block",content:"block+",draggable:!0,addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{icon:{default:"🌾"},borderColor:{default:"#dddddd"},borderColorDark:{default:"#333333"},backColor:{default:"#eeeeee"},backColorDark:{default:"rgba(101, 117, 133, 0.16)"}}},parseHTML(){return[{tag:'div[data-type="callout"]'}]},renderHTML({HTMLAttributes:t}){return["div",Ce(t,{"data-type":"callout"}),0]},addCommands(){return{setCallout:()=>({commands:t})=>t.wrapIn(this.name),toggleCallout:()=>({commands:t})=>t.toggleWrap(this.name),unsetCallout:()=>({commands:t})=>t.lift(this.name)}}}),XN={class:"callout-container"},ZN={class:"callout-icon"},QN={class:"callout-content"},eT=l.defineComponent({__name:"view",props:ut,setup(t){const e=t,{theme:n}=Ei(),{isEditable:o}=we(),r=l.ref(!1),i=l.ref(!1),s=l.ref({}),a=l.ref(null),c=l.computed(()=>{const{selection:v}=e.editor.view.state,_=v.from,C=e.getPos(),A=C+e.node.nodeSize;return _>=C&&_<=A}),d=l.computed({get(){return e.node.attrs.backColor},set(v){e.updateAttributes({backColor:v})}}),u=l.computed({get(){return e.node.attrs.backColorDark},set(v){e.updateAttributes({backColorDark:v})}}),p=l.computed({get(){return e.node.attrs.borderColor},set(v){e.updateAttributes({borderColor:v})}}),f=l.computed({get(){return e.node.attrs.borderColorDark},set(v){e.updateAttributes({borderColorDark:v})}}),h=l.computed(()=>n.value==="dark"?u.value:d.value),m=l.computed(()=>n.value==="dark"?f.value:p.value);function g(v){e.updateAttributes({icon:v})}function b(v){switch(r.value=!1,v.value){case"palette":k(!0);break}}function y(v){r.value=!0,s.value=v}function k(v){i.value=v}function w(v,_){var C;switch(v){case"backColor":d.value=_;break;case"foreColor":p.value=_;break;case"icon":g(_.emoji),(C=a.value)==null||C.setShow(!1);break}}return l.watch(c,v=>{k(v)}),(v,_)=>(l.openBlock(),l.createBlock(l.unref(Dn),l.mergeProps(e,{class:"o-callout-view",style:`--callout-border-color: ${m.value}; --callout-back-color: ${h.value}`,onContextmenu:l.withModifiers(y,["prevent"])}),{default:l.withCtx(()=>[l.createElementVNode("div",XN,[l.createVNode(l.unref(Pe),{ref_key:"iconPopover",ref:a,placement:"bottom-start",trigger:"click",offset:[0,0],disable:!l.unref(o)},{trigger:l.withCtx(()=>[l.createElementVNode("div",ZN,l.toDisplayString(v.node.attrs.icon),1)]),default:l.withCtx(()=>[l.createVNode(l.unref(Ea),{items:l.unref(Yr.emojiGroups),onSelect:_[0]||(_[0]=C=>w("icon",C)),"enable-search":""},null,8,["items"])]),_:1},8,["disable"]),l.createElementVNode("div",QN,[l.createVNode(l.unref(Gn))]),l.unref(o)?(l.openBlock(),l.createBlock(l.unref(va),{key:0,modelValue:r.value,"onUpdate:modelValue":_[1]||(_[1]=C=>r.value=C),event:s.value},{default:l.withCtx(()=>[l.createVNode(l.unref(Wo),l.mergeProps(e,{onAction:b}),null,16)]),_:1},8,["modelValue","event"])):l.createCommentVNode("",!0)])]),_:1},16,["style"]))}}),jm=JN.extend({addNodeView(){return yn(eT)}});function tT(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Gm(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],o=typeof n;(o==="object"||o==="function")&&!Object.isFrozen(n)&&Gm(n)}),t}class bp{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function Ym(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function uo(t,...e){const n=Object.create(null);for(const o in t)n[o]=t[o];return e.forEach(function(o){for(const r in o)n[r]=o[r]}),n}const nT="</span>",yp=t=>!!t.scope,oT=(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((o,r)=>`${o}${"_".repeat(r+1)}`)].join(" ")}return`${e}${t}`};class rT{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=Ym(e)}openNode(e){if(!yp(e))return;const n=oT(e.scope,{prefix:this.classPrefix});this.span(n)}closeNode(e){yp(e)&&(this.buffer+=nT)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}}const vp=(t={})=>{const e={children:[]};return Object.assign(e,t),e};class Xc{constructor(){this.rootNode=vp(),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=vp({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(o=>this._walk(e,o)),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=>{Xc._collapse(n)}))}}class iT extends Xc{constructor(e){super(),this.options=e}addText(e){e!==""&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,n){const o=e.root;n&&(o.scope=`language:${n}`),this.add(o)}toHTML(){return new rT(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function ui(t){return t?typeof t=="string"?t:t.source:null}function Jm(t){return jo("(?=",t,")")}function sT(t){return jo("(?:",t,")*")}function aT(t){return jo("(?:",t,")?")}function jo(...t){return t.map(n=>ui(n)).join("")}function lT(t){const e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function Zc(...t){return"("+(lT(t).capture?"":"?:")+t.map(o=>ui(o)).join("|")+")"}function Xm(t){return new RegExp(t.toString()+"|").exec("").length-1}function cT(t,e){const n=t&&t.exec(e);return n&&n.index===0}const dT=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Qc(t,{joinWith:e}){let n=0;return t.map(o=>{n+=1;const r=n;let i=ui(o),s="";for(;i.length>0;){const a=dT.exec(i);if(!a){s+=i;break}s+=i.substring(0,a.index),i=i.substring(a.index+a[0].length),a[0][0]==="\\"&&a[1]?s+="\\"+String(Number(a[1])+r):(s+=a[0],a[0]==="("&&n++)}return s}).map(o=>`(${o})`).join(e)}const uT=/\b\B/,Zm="[a-zA-Z]\\w*",ed="[a-zA-Z_]\\w*",Qm="\\b\\d+(\\.\\d+)?",eg="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",tg="\\b(0b[01]+)",pT="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",fT=(t={})=>{const e=/^#![ ]*\//;return t.binary&&(t.begin=jo(e,/.*\b/,t.binary,/\b.*/)),uo({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(n,o)=>{n.index!==0&&o.ignoreMatch()}},t)},pi={begin:"\\\\[\\s\\S]",relevance:0},hT={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[pi]},mT={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[pi]},gT={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/},_a=function(t,e,n={}){const o=uo({scope:"comment",begin:t,end:e,contains:[]},n);o.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 r=Zc("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 o.contains.push({begin:jo(/[ ]+/,"(",r,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),o},bT=_a("//","$"),yT=_a("/\\*","\\*/"),vT=_a("#","$"),kT={scope:"number",begin:Qm,relevance:0},ET={scope:"number",begin:eg,relevance:0},wT={scope:"number",begin:tg,relevance:0},CT={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[pi,{begin:/\[/,end:/\]/,relevance:0,contains:[pi]}]},_T={scope:"title",begin:Zm,relevance:0},ST={scope:"title",begin:ed,relevance:0},xT={begin:"\\.\\s*"+ed,relevance:0},NT=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 Hi=Object.freeze({__proto__:null,APOS_STRING_MODE:hT,BACKSLASH_ESCAPE:pi,BINARY_NUMBER_MODE:wT,BINARY_NUMBER_RE:tg,COMMENT:_a,C_BLOCK_COMMENT_MODE:yT,C_LINE_COMMENT_MODE:bT,C_NUMBER_MODE:ET,C_NUMBER_RE:eg,END_SAME_AS_BEGIN:NT,HASH_COMMENT_MODE:vT,IDENT_RE:Zm,MATCH_NOTHING_RE:uT,METHOD_GUARD:xT,NUMBER_MODE:kT,NUMBER_RE:Qm,PHRASAL_WORDS_MODE:gT,QUOTE_STRING_MODE:mT,REGEXP_MODE:CT,RE_STARTERS_RE:pT,SHEBANG:fT,TITLE_MODE:_T,UNDERSCORE_IDENT_RE:ed,UNDERSCORE_TITLE_MODE:ST});function TT(t,e){t.input[t.index-1]==="."&&e.ignoreMatch()}function OT(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className)}function MT(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=TT,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0))}function AT(t,e){Array.isArray(t.illegal)&&(t.illegal=Zc(...t.illegal))}function RT(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 DT(t,e){t.relevance===void 0&&(t.relevance=1)}const IT=(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(o=>{delete t[o]}),t.keywords=n.keywords,t.begin=jo(n.beforeMatch,Jm(n.begin)),t.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},t.relevance=0,delete n.beforeMatch},BT=["of","and","for","in","not","or","if","then","parent","list","value"],LT="keyword";function ng(t,e,n=LT){const o=Object.create(null);return typeof t=="string"?r(n,t.split(" ")):Array.isArray(t)?r(n,t):Object.keys(t).forEach(function(i){Object.assign(o,ng(t[i],e,i))}),o;function r(i,s){e&&(s=s.map(a=>a.toLowerCase())),s.forEach(function(a){const c=a.split("|");o[c[0]]=[i,PT(c[0],c[1])]})}}function PT(t,e){return e?Number(e):$T(t)?0:1}function $T(t){return BT.includes(t.toLowerCase())}const kp={},Po=t=>{console.error(t)},Ep=(t,...e)=>{console.log(`WARN: ${t}`,...e)},Xo=(t,e)=>{kp[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),kp[`${t}/${e}`]=!0)},Ns=new Error;function og(t,e,{key:n}){let o=0;const r=t[n],i={},s={};for(let a=1;a<=e.length;a++)s[a+o]=r[a],i[a+o]=!0,o+=Xm(e[a-1]);t[n]=s,t[n]._emit=i,t[n]._multi=!0}function FT(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw Po("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Ns;if(typeof t.beginScope!="object"||t.beginScope===null)throw Po("beginScope must be object"),Ns;og(t,t.begin,{key:"beginScope"}),t.begin=Qc(t.begin,{joinWith:""})}}function VT(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw Po("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Ns;if(typeof t.endScope!="object"||t.endScope===null)throw Po("endScope must be object"),Ns;og(t,t.end,{key:"endScope"}),t.end=Qc(t.end,{joinWith:""})}}function zT(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope)}function HT(t){zT(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),FT(t),VT(t)}function UT(t){function e(s,a){return new RegExp(ui(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,c){c.position=this.position++,this.matchIndexes[this.matchAt]=c,this.regexes.push([c,a]),this.matchAt+=Xm(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const a=this.regexes.map(c=>c[1]);this.matcherRe=e(Qc(a,{joinWith:"|"}),!0),this.lastIndex=0}exec(a){this.matcherRe.lastIndex=this.lastIndex;const c=this.matcherRe.exec(a);if(!c)return null;const d=c.findIndex((p,f)=>f>0&&p!==void 0),u=this.matchIndexes[d];return c.splice(0,d),Object.assign(c,u)}}class o{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 c=new n;return this.rules.slice(a).forEach(([d,u])=>c.addRule(d,u)),c.compile(),this.multiRegexes[a]=c,c}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(a,c){this.rules.push([a,c]),c.type==="begin"&&this.count++}exec(a){const c=this.getMatcher(this.regexIndex);c.lastIndex=this.lastIndex;let d=c.exec(a);if(this.resumingScanAtSamePosition()&&!(d&&d.index===this.lastIndex)){const u=this.getMatcher(0);u.lastIndex=this.lastIndex+1,d=u.exec(a)}return d&&(this.regexIndex+=d.position+1,this.regexIndex===this.count&&this.considerAll()),d}}function r(s){const a=new o;return s.contains.forEach(c=>a.addRule(c.begin,{rule:c,type:"begin"})),s.terminatorEnd&&a.addRule(s.terminatorEnd,{type:"end"}),s.illegal&&a.addRule(s.illegal,{type:"illegal"}),a}function i(s,a){const c=s;if(s.isCompiled)return c;[OT,RT,HT,IT].forEach(u=>u(s,a)),t.compilerExtensions.forEach(u=>u(s,a)),s.__beforeBegin=null,[MT,AT,DT].forEach(u=>u(s,a)),s.isCompiled=!0;let d=null;return typeof s.keywords=="object"&&s.keywords.$pattern&&(s.keywords=Object.assign({},s.keywords),d=s.keywords.$pattern,delete s.keywords.$pattern),d=d||/\w+/,s.keywords&&(s.keywords=ng(s.keywords,t.case_insensitive)),c.keywordPatternRe=e(d,!0),a&&(s.begin||(s.begin=/\B|\b/),c.beginRe=e(c.begin),!s.end&&!s.endsWithParent&&(s.end=/\B|\b/),s.end&&(c.endRe=e(c.end)),c.terminatorEnd=ui(c.end)||"",s.endsWithParent&&a.terminatorEnd&&(c.terminatorEnd+=(s.end?"|":"")+a.terminatorEnd)),s.illegal&&(c.illegalRe=e(s.illegal)),s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map(function(u){return qT(u==="self"?s:u)})),s.contains.forEach(function(u){i(u,c)}),s.starts&&i(s.starts,a),c.matcher=r(c),c}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=uo(t.classNameAliases||{}),i(t)}function rg(t){return t?t.endsWithParent||rg(t.starts):!1}function qT(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return uo(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:rg(t)?uo(t,{starts:t.starts?uo(t.starts):null}):Object.isFrozen(t)?uo(t):t}var WT="11.10.0";class KT extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}}const il=Ym,wp=uo,Cp=Symbol("nomatch"),jT=7,ig=function(t){const e=Object.create(null),n=Object.create(null),o=[];let r=!0;const i="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:iT};function c(x){return a.noHighlightRe.test(x)}function d(x){let O=x.className+" ";O+=x.parentNode?x.parentNode.className:"";const V=a.languageDetectRe.exec(O);if(V){const Y=M(V[1]);return Y||(Ep(i.replace("{}",V[1])),Ep("Falling back to no-highlight mode for this block.",x)),Y?V[1]:"no-highlight"}return O.split(/\s+/).find(Y=>c(Y)||M(Y))}function u(x,O,V){let Y="",Q="";typeof O=="object"?(Y=x,V=O.ignoreIllegals,Q=O.language):(Xo("10.7.0","highlight(lang, code, ...args) has been deprecated."),Xo("10.7.0",`Please use highlight(code, options) instead.
141
- https://github.com/highlightjs/highlight.js/issues/2277`),Q=x,Y=O),V===void 0&&(V=!0);const fe={code:Y,language:Q};re("before:highlight",fe);const Ne=fe.result?fe.result:p(fe.language,fe.code,V);return Ne.code=fe.code,re("after:highlight",Ne),Ne}function p(x,O,V,Y){const Q=Object.create(null);function fe(I,z){return I.keywords[z]}function Ne(){if(!Z.keywords){Ie.addText(ke);return}let I=0;Z.keywordPatternRe.lastIndex=0;let z=Z.keywordPatternRe.exec(ke),ue="";for(;z;){ue+=ke.substring(I,z.index);const Ee=le.case_insensitive?z[0].toLowerCase():z[0],Qe=fe(Z,Ee);if(Qe){const[Ht,Sr]=Qe;if(Ie.addText(ue),ue="",Q[Ee]=(Q[Ee]||0)+1,Q[Ee]<=jT&&(xt+=Sr),Ht.startsWith("_"))ue+=z[0];else{const S=le.classNameAliases[Ht]||Ht;Fe(z[0],S)}}else ue+=z[0];I=Z.keywordPatternRe.lastIndex,z=Z.keywordPatternRe.exec(ke)}ue+=ke.substring(I),Ie.addText(ue)}function rt(){if(ke==="")return;let I=null;if(typeof Z.subLanguage=="string"){if(!e[Z.subLanguage]){Ie.addText(ke);return}I=p(Z.subLanguage,ke,!0,St[Z.subLanguage]),St[Z.subLanguage]=I._top}else I=h(ke,Z.subLanguage.length?Z.subLanguage:null);Z.relevance>0&&(xt+=I.relevance),Ie.__addSublanguage(I._emitter,I.language)}function Te(){Z.subLanguage!=null?rt():Ne(),ke=""}function Fe(I,z){I!==""&&(Ie.startScope(z),Ie.addText(I),Ie.endScope())}function Vt(I,z){let ue=1;const Ee=z.length-1;for(;ue<=Ee;){if(!I._emit[ue]){ue++;continue}const Qe=le.classNameAliases[I[ue]]||I[ue],Ht=z[ue];Qe?Fe(Ht,Qe):(ke=Ht,Ne(),ke=""),ue++}}function pt(I,z){return I.scope&&typeof I.scope=="string"&&Ie.openNode(le.classNameAliases[I.scope]||I.scope),I.beginScope&&(I.beginScope._wrap?(Fe(ke,le.classNameAliases[I.beginScope._wrap]||I.beginScope._wrap),ke=""):I.beginScope._multi&&(Vt(I.beginScope,z),ke="")),Z=Object.create(I,{parent:{value:Z}}),Z}function Xt(I,z,ue){let Ee=cT(I.endRe,ue);if(Ee){if(I["on:end"]){const Qe=new bp(I);I["on:end"](z,Qe),Qe.isMatchIgnored&&(Ee=!1)}if(Ee){for(;I.endsParent&&I.parent;)I=I.parent;return I}}if(I.endsWithParent)return Xt(I.parent,z,ue)}function ft(I){return Z.matcher.regexIndex===0?(ke+=I[0],1):(Nt=!0,0)}function Zt(I){const z=I[0],ue=I.rule,Ee=new bp(ue),Qe=[ue.__beforeBegin,ue["on:begin"]];for(const Ht of Qe)if(Ht&&(Ht(I,Ee),Ee.isMatchIgnored))return ft(z);return ue.skip?ke+=z:(ue.excludeBegin&&(ke+=z),Te(),!ue.returnBegin&&!ue.excludeBegin&&(ke=z)),pt(ue,I),ue.returnBegin?0:z.length}function kn(I){const z=I[0],ue=O.substring(I.index),Ee=Xt(Z,I,ue);if(!Ee)return Cp;const Qe=Z;Z.endScope&&Z.endScope._wrap?(Te(),Fe(z,Z.endScope._wrap)):Z.endScope&&Z.endScope._multi?(Te(),Vt(Z.endScope,I)):Qe.skip?ke+=z:(Qe.returnEnd||Qe.excludeEnd||(ke+=z),Te(),Qe.excludeEnd&&(ke=z));do Z.scope&&Ie.closeNode(),!Z.skip&&!Z.subLanguage&&(xt+=Z.relevance),Z=Z.parent;while(Z!==Ee.parent);return Ee.starts&&pt(Ee.starts,I),Qe.returnEnd?0:z.length}function un(){const I=[];for(let z=Z;z!==le;z=z.parent)z.scope&&I.unshift(z.scope);I.forEach(z=>Ie.openNode(z))}let zt={};function pn(I,z){const ue=z&&z[0];if(ke+=I,ue==null)return Te(),0;if(zt.type==="begin"&&z.type==="end"&&zt.index===z.index&&ue===""){if(ke+=O.slice(z.index,z.index+1),!r){const Ee=new Error(`0 width match regex (${x})`);throw Ee.languageName=x,Ee.badRule=zt.rule,Ee}return 1}if(zt=z,z.type==="begin")return Zt(z);if(z.type==="illegal"&&!V){const Ee=new Error('Illegal lexeme "'+ue+'" for mode "'+(Z.scope||"<unnamed>")+'"');throw Ee.mode=Z,Ee}else if(z.type==="end"){const Ee=kn(z);if(Ee!==Cp)return Ee}if(z.type==="illegal"&&ue==="")return 1;if(fn>1e5&&fn>z.index*3)throw new Error("potential infinite loop, way more iterations than matches");return ke+=ue,ue.length}const le=M(x);if(!le)throw Po(i.replace("{}",x)),new Error('Unknown language: "'+x+'"');const It=UT(le);let vt="",Z=Y||It;const St={},Ie=new a.__emitter(a);un();let ke="",xt=0,Je=0,fn=0,Nt=!1;try{if(le.__emitTokens)le.__emitTokens(O,Ie);else{for(Z.matcher.considerAll();;){fn++,Nt?Nt=!1:Z.matcher.considerAll(),Z.matcher.lastIndex=Je;const I=Z.matcher.exec(O);if(!I)break;const z=O.substring(Je,I.index),ue=pn(z,I);Je=I.index+ue}pn(O.substring(Je))}return Ie.finalize(),vt=Ie.toHTML(),{language:x,value:vt,relevance:xt,illegal:!1,_emitter:Ie,_top:Z}}catch(I){if(I.message&&I.message.includes("Illegal"))return{language:x,value:il(O),illegal:!0,relevance:0,_illegalBy:{message:I.message,index:Je,context:O.slice(Je-100,Je+100),mode:I.mode,resultSoFar:vt},_emitter:Ie};if(r)return{language:x,value:il(O),illegal:!1,relevance:0,errorRaised:I,_emitter:Ie,_top:Z};throw I}}function f(x){const O={value:il(x),illegal:!1,relevance:0,_top:s,_emitter:new a.__emitter(a)};return O._emitter.addText(x),O}function h(x,O){O=O||a.languages||Object.keys(e);const V=f(x),Y=O.filter(M).filter(K).map(Te=>p(Te,x,!1));Y.unshift(V);const Q=Y.sort((Te,Fe)=>{if(Te.relevance!==Fe.relevance)return Fe.relevance-Te.relevance;if(Te.language&&Fe.language){if(M(Te.language).supersetOf===Fe.language)return 1;if(M(Fe.language).supersetOf===Te.language)return-1}return 0}),[fe,Ne]=Q,rt=fe;return rt.secondBest=Ne,rt}function m(x,O,V){const Y=O&&n[O]||V;x.classList.add("hljs"),x.classList.add(`language-${Y}`)}function g(x){let O=null;const V=d(x);if(c(V))return;if(re("before:highlightElement",{el:x,language:V}),x.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",x);return}if(x.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(x)),a.throwUnescapedHTML))throw new KT("One of your code blocks includes unescaped HTML.",x.innerHTML);O=x;const Y=O.textContent,Q=V?u(Y,{language:V,ignoreIllegals:!0}):h(Y);x.innerHTML=Q.value,x.dataset.highlighted="yes",m(x,V,Q.language),x.result={language:Q.language,re:Q.relevance,relevance:Q.relevance},Q.secondBest&&(x.secondBest={language:Q.secondBest.language,relevance:Q.secondBest.relevance}),re("after:highlightElement",{el:x,result:Q,text:Y})}function b(x){a=wp(a,x)}const y=()=>{v(),Xo("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function k(){v(),Xo("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let w=!1;function v(){if(document.readyState==="loading"){w=!0;return}document.querySelectorAll(a.cssSelector).forEach(g)}function _(){w&&v()}typeof window<"u"&&window.addEventListener&&window.addEventListener("DOMContentLoaded",_,!1);function C(x,O){let V=null;try{V=O(t)}catch(Y){if(Po("Language definition for '{}' could not be registered.".replace("{}",x)),r)Po(Y);else throw Y;V=s}V.name||(V.name=x),e[x]=V,V.rawDefinition=O.bind(null,t),V.aliases&&P(V.aliases,{languageName:x})}function A(x){delete e[x];for(const O of Object.keys(n))n[O]===x&&delete n[O]}function L(){return Object.keys(e)}function M(x){return x=(x||"").toLowerCase(),e[x]||e[n[x]]}function P(x,{languageName:O}){typeof x=="string"&&(x=[x]),x.forEach(V=>{n[V.toLowerCase()]=O})}function K(x){const O=M(x);return O&&!O.disableAutodetect}function te(x){x["before:highlightBlock"]&&!x["before:highlightElement"]&&(x["before:highlightElement"]=O=>{x["before:highlightBlock"](Object.assign({block:O.el},O))}),x["after:highlightBlock"]&&!x["after:highlightElement"]&&(x["after:highlightElement"]=O=>{x["after:highlightBlock"](Object.assign({block:O.el},O))})}function de(x){te(x),o.push(x)}function ce(x){const O=o.indexOf(x);O!==-1&&o.splice(O,1)}function re(x,O){const V=x;o.forEach(function(Y){Y[V]&&Y[V](O)})}function ie(x){return Xo("10.7.0","highlightBlock will be removed entirely in v12.0"),Xo("10.7.0","Please use highlightElement now."),g(x)}Object.assign(t,{highlight:u,highlightAuto:h,highlightAll:v,highlightElement:g,highlightBlock:ie,configure:b,initHighlighting:y,initHighlightingOnLoad:k,registerLanguage:C,unregisterLanguage:A,listLanguages:L,getLanguage:M,registerAliases:P,autoDetection:K,inherit:wp,addPlugin:de,removePlugin:ce}),t.debugMode=function(){r=!1},t.safeMode=function(){r=!0},t.versionString=WT,t.regex={concat:jo,lookahead:Jm,either:Zc,optional:aT,anyNumberOfTimes:sT};for(const x in Hi)typeof Hi[x]=="object"&&Gm(Hi[x]);return Object.assign(t,Hi),t},vr=ig({});vr.newInstance=()=>ig({});var GT=vr;vr.HighlightJS=vr;vr.default=vr;var YT=tT(GT);function sg(t,e=[]){return t.map(n=>{const o=[...e,...n.properties?n.properties.className:[]];return n.children?sg(n.children,o):{text:n.value,classes:o}}).flat()}function _p(t){return t.value||t.children||[]}function JT(t){return!!YT.getLanguage(t)}function Sp({doc:t,name:e,lowlight:n,defaultLanguage:o}){const r=[];return Il(t,i=>i.type.name===e).forEach(i=>{var s;let a=i.pos+1;const c=i.node.attrs.language||o,d=n.listLanguages(),u=c&&(d.includes(c)||JT(c)||!((s=n.registered)===null||s===void 0)&&s.call(n,c))?_p(n.highlight(c,i.node.textContent)):_p(n.highlightAuto(i.node.textContent));sg(u).forEach(p=>{const f=a+p.text.length;if(p.classes.length){const h=Ze.inline(a,f,{class:p.classes.join(" ")});r.push(h)}a=f})}),Me.create(t,r)}function XT(t){return typeof t=="function"}function ZT({name:t,lowlight:e,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(r=>XT(e[r])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const o=new Se({key:new xe("lowlight"),state:{init:(r,{doc:i})=>Sp({doc:i,name:t,lowlight:e,defaultLanguage:n}),apply:(r,i,s,a)=>{const c=s.selection.$head.parent.type.name,d=a.selection.$head.parent.type.name,u=Il(s.doc,f=>f.type.name===t),p=Il(a.doc,f=>f.type.name===t);return r.docChanged&&([c,d].includes(t)||p.length!==u.length||r.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)))?Sp({doc:r.doc,name:t,lowlight:e,defaultLanguage:n}):i.map(r.mapping,r.doc)}},props:{decorations(r){return o.getState(r)}}});return o}const QT=Zh.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))||[],ZT({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}});function e1(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),o="decltype\\(auto\\)",r="[a-zA-Z_]\\w*::",s="(?!struct)("+o+"|"+e.optional(r)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",a={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},d={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},p={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(d,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(r)+t.IDENT_RE,relevance:0},h=e.optional(r)+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"],b=["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"],y=["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:b},_={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},C=[_,p,a,n,t.C_BLOCK_COMMENT_MODE,u,d],A={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},L={className:"function",begin:"("+s+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:v,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:o,keywords:v,relevance:0},{begin:h,returnBegin:!0,contains:[f],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[d,u]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,d,u,a,{begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,d,u,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,p]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:v,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(A,L,_,C,[p,{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 t1(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=e1(t),o=n.keywords;return o.type=[...o.type,...e.type],o.literal=[...o.literal,...e.literal],o.built_in=[...o.built_in,...e.built_in],o._hints=e._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function n1(t){const e=t.regex,n={},o={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:e.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},o]});const r={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},i=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,r]};r.contains.push(a);const c={match:/\\"/},d={className:"string",begin:/'/,end:/'/},u={match:/\\'/},p={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"],b=["true","false"],y={match:/(\/[a-z._-]+)+/},k=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],w=["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"],_=["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:b,built_in:[...k,...w,"set","shopt",...v,..._]},contains:[h,t.SHEBANG(),m,p,i,s,y,a,c,d,u,n]}}function o1(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),o="decltype\\(auto\\)",r="[a-zA-Z_]\\w*::",s="("+o+"|"+e.optional(r)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",a={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},d={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},p={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(d,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(r)+t.IDENT_RE,relevance:0},h=e.optional(r)+t.IDENT_RE+"\\s*\\(",b={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"},y=[p,a,n,t.C_BLOCK_COMMENT_MODE,u,d],k={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:b,contains:y.concat([{begin:/\(/,end:/\)/,keywords:b,contains:y.concat(["self"]),relevance:0}]),relevance:0},w={begin:"("+s+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:b,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:o,keywords:b,relevance:0},{begin:h,returnBegin:!0,contains:[t.inherit(f,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,d,u,a,{begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,d,u,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,p]};return{name:"C",aliases:["h"],keywords:b,disableAutodetect:!0,illegal:"</",contains:[].concat(k,w,y,[p,{begin:t.IDENT_RE+"::",keywords:b},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},t.TITLE_MODE]}]),exports:{preprocessor:p,strings:d,keywords:b}}}function r1(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),o="decltype\\(auto\\)",r="[a-zA-Z_]\\w*::",s="(?!struct)("+o+"|"+e.optional(r)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",a={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},d={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},p={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(d,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(r)+t.IDENT_RE,relevance:0},h=e.optional(r)+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"],b=["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"],y=["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:b},_={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},C=[_,p,a,n,t.C_BLOCK_COMMENT_MODE,u,d],A={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},L={className:"function",begin:"("+s+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:v,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:o,keywords:v,relevance:0},{begin:h,returnBegin:!0,contains:[f],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[d,u]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,d,u,a,{begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,d,u,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,p]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:v,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(A,L,_,C,[p,{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 i1(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"],o=["default","false","null","true"],r=["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"],i=["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:r.concat(i),built_in:e,literal:o},a=t.inherit(t.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),c={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},d={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},u={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},p=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]},b=t.inherit(g,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]});f.contains=[g,m,u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,c,t.C_BLOCK_COMMENT_MODE],h.contains=[b,m,p,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,c,t.inherit(t.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const y={variants:[d,g,m,u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},k={begin:"<",end:">",contains:[{beginKeywords:"in out"},a]},w=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"}},y,c,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},a,k,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,k,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:"("+w+"\\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,k],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,relevance:0,contains:[y,c,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},v]}}const s1=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_-]*/}}),a1=["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"],l1=["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"],c1=[...a1,...l1],d1=["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(),u1=["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(),p1=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),f1=["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 h1(t){const e=t.regex,n=s1(t),o={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},r="and or not only",i=/@-?\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,o,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:":("+u1.join("|")+")"},{begin:":(:)?("+p1.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+f1.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:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:r,attribute:d1.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+c1.join("|")+")\\b"}]}}function m1(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 g1(t){const i={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:i,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:i,illegal:/["']/}]}]}}function b1(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 y1(t){const e=t.regex,n={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:t.NUMBER_RE}]},o=t.COMMENT();o.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const r={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},i={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:[o,i,r,s,n,"self"],relevance:0},c=/[A-Za-z0-9_-]+/,d=/"(\\"|[^"])*"/,u=/'[^']*'/,p=e.either(c,d,u),f=e.concat(p,"(\\s*\\.\\s*",p,")*",e.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[o,{className:"section",begin:/\[+/,end:/\]+/},{begin:f,className:"attr",starts:{end:/$/,contains:[o,a,i,r,s,n]}}]}}var tr="[0-9](_*[0-9])*",Ui=`\\.(${tr})`,qi="[0-9a-fA-F](_*[0-9a-fA-F])*",xp={className:"number",variants:[{begin:`(\\b(${tr})((${Ui})|\\.)?|(${Ui}))[eE][+-]?(${tr})[fFdD]?\\b`},{begin:`\\b(${tr})((${Ui})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Ui})[fFdD]?\\b`},{begin:`\\b(${tr})[fFdD]\\b`},{begin:`\\b0[xX]((${qi})\\.?|(${qi})?\\.(${qi}))[pP][+-]?(${tr})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${qi})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function ag(t,e,n){return n===-1?"":t.replace(e,o=>ag(t,e,n-1))}function v1(t){const e=t.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",o=n+ag("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),c={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"]},d={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},u={className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[t.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:c,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:["(?:"+o+"\\s+)",t.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:c,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[d,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,xp,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},xp,d]}}const Np="[A-Za-z$_][0-9A-Za-z$_]*",k1=["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"],E1=["true","false","null","undefined","NaN","Infinity"],lg=["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"],cg=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],dg=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],w1=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],C1=[].concat(dg,lg,cg);function _1(t){const e=t.regex,n=(O,{after:V})=>{const Y="</"+O[0].slice(1);return O.input.indexOf(Y,V)!==-1},o=Np,r={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(O,V)=>{const Y=O[0].length+O.index,Q=O.input[Y];if(Q==="<"||Q===","){V.ignoreMatch();return}Q===">"&&(n(O,{after:Y})||V.ignoreMatch());let fe;const Ne=O.input.substring(Y);if(fe=Ne.match(/^\s*=/)){V.ignoreMatch();return}if((fe=Ne.match(/^\s+extends\s+/))&&fe.index===0){V.ignoreMatch();return}}},a={$pattern:Np,keyword:k1,literal:E1,built_in:C1,"variable.language":w1},c="[0-9](_?[0-9])*",d=`\\.(${c})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",p={className:"number",variants:[{begin:`(\\b(${u})((${d})|\\.)?|(${d}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${d})\\b|\\.)?|(${d})\\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"}},b={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,f]},k={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:o+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},w=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,h,m,g,b,{match:/\$\d+/},p];f.contains=w.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(w)});const v=[].concat(k,f.contains),_=v.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(v)}]),C={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:_},A={variants:[{match:[/class/,/\s+/,o,/\s+/,/extends/,/\s+/,e.concat(o,"(",e.concat(/\./,o),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,o],scope:{1:"keyword",3:"title.class"}}]},L={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:{_:[...lg,...cg]}},M={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},P={variants:[{match:[/function/,/\s+/,o,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[C],illegal:/%/},K={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function te(O){return e.concat("(?!",O.join("|"),")")}const de={match:e.concat(/\b/,te([...dg,"super","import"].map(O=>`${O}\\s*\\(`)),o,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},ce={begin:e.concat(/\./,e.lookahead(e.concat(o,/(?![0-9A-Za-z$_(])/))),end:o,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},re={match:[/get|set/,/\s+/,o,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},C]},ie="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",x={match:[/const|var|let/,/\s+/,o,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(ie)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[C]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:_,CLASS_REFERENCE:L},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),M,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,h,m,g,b,k,{match:/\$\d+/},p,L,{scope:"attr",match:o+e.lookahead(":"),relevance:0},x,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[k,t.REGEXP_MODE,{className:"function",begin:ie,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:_}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:i},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},P,{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:o,className:"title.function"})]},{match:/\.\.\./,relevance:0},ce,{match:"\\$"+o,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[C]},de,K,A,re,{match:/\$[(.]/}]}}function S1(t){const e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},o=["true","false","null"],r={scope:"literal",beginKeywords:o.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:o},contains:[e,n,t.QUOTE_STRING_MODE,r,t.C_NUMBER_MODE,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var nr="[0-9](_*[0-9])*",Wi=`\\.(${nr})`,Ki="[0-9a-fA-F](_*[0-9a-fA-F])*",x1={className:"number",variants:[{begin:`(\\b(${nr})((${Wi})|\\.)?|(${Wi}))[eE][+-]?(${nr})[fFdD]?\\b`},{begin:`\\b(${nr})((${Wi})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Wi})[fFdD]?\\b`},{begin:`\\b(${nr})[fFdD]\\b`},{begin:`\\b0[xX]((${Ki})\\.?|(${Ki})?\\.(${Ki}))[pP][+-]?(${nr})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Ki})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function N1(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+/}]}},o={className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"@"},r={className:"subst",begin:/\$\{/,end:/\}/,contains:[t.C_NUMBER_MODE]},i={className:"variable",begin:"\\$"+t.UNDERSCORE_IDENT_RE},s={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[i,r]},{begin:"'",end:"'",illegal:/\n/,contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[t.BACKSLASH_ESCAPE,i,r]}]};r.contains.push(s);const a={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+t.UNDERSCORE_IDENT_RE+")?"},c={className:"meta",begin:"@"+t.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[t.inherit(s,{className:"string"}),"self"]}]},d=x1,u=t.COMMENT("/\\*","\\*/",{contains:[t.C_BLOCK_COMMENT_MODE]}),p={variants:[{className:"type",begin:t.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},f=p;return f.variants[1].contains=[p],p.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,o,a,c,{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:[p,t.C_LINE_COMMENT_MODE,u],relevance:0},t.C_LINE_COMMENT_MODE,u,a,c,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,c]},s,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
142
- `},d]}}const T1=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_-]*/}}),O1=["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"],M1=["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"],A1=[...O1,...M1],R1=["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(),ug=["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(),pg=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),D1=["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(),I1=ug.concat(pg).sort().reverse();function B1(t){const e=T1(t),n=I1,o="and or not only",r="[\\w-]+",i="("+r+"|@\\{"+r+"\\})",s=[],a=[],c=function(w){return{className:"string",begin:"~?"+w+".*?"+w}},d=function(w,v,_){return{className:w,begin:v,relevance:_}},u={$pattern:/[a-z-]+/,keyword:o,attribute:R1.join(" ")},p={begin:"\\(",end:"\\)",contains:a,keywords:u,relevance:0};a.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,c("'"),c('"'),e.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},e.HEXCOLOR,p,d("variable","@@?"+r,10),d("variable","@\\{"+r+"\\}"),d("built_in","~?`[^`]*?`"),{className:"attribute",begin:r+"\\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:i+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+D1.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}},b={className:"variable",variants:[{begin:"@"+r+"\\s*:",relevance:15},{begin:"@"+r}],starts:{end:"[;}]",returnEnd:!0,contains:f}},y={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:i,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,h,d("keyword","all\\b"),d("variable","@\\{"+r+"\\}"),{begin:"\\b("+A1.join("|")+")\\b",className:"selector-tag"},e.CSS_NUMBER_MODE,d("selector-tag",i,0),d("selector-id","#"+i),d("selector-class","\\."+i,0),d("selector-tag","&",0),e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+ug.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+pg.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:f},{begin:"!important"},e.FUNCTION_DISPATCH]},k={begin:r+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[y]};return s.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,g,b,k,m,y,h,e.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:s}}function L1(t){const e="\\[=*\\[",n="\\]=*\\]",o={begin:e,end:n,contains:["self"]},r=[t.COMMENT("--(?!"+e+")","$"),t.COMMENT("--"+e,n,{contains:[o],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:r.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:r}].concat(r)},t.C_NUMBER_MODE,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{className:"string",begin:e,end:n,contains:[o],relevance:5}])}}function P1(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]},o={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]},r={begin:"^"+t.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},i={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,o,r,i,s]}}function $1(t){const e=t.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},o={begin:"^[-\\*]{3,}",end:"$"},r={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}]},i={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+.-]*/,c={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}]},d={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}]},p=t.inherit(d,{contains:[]}),f=t.inherit(u,{contains:[]});d.contains.push(f),u.contains.push(p);let h=[n,c];return[d,u,p,f].forEach(y=>{y.contains=y.contains.concat(h)}),h=h.concat(d,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,i,d,u,{className:"quote",begin:"^>\\s+",contains:h,end:"$"},r,o,c,s,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function F1(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"]},c={$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:"("+c.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:c,contains:[t.UNDERSCORE_TITLE_MODE]},{begin:"\\."+t.UNDERSCORE_IDENT_RE,relevance:0}]}}function V1(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"],o=/[dualxmsipngr]{0,12}/,r={$pattern:/[\w.]+/,keyword:n.join(" ")},i={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:r},s={begin:/->\{/,end:/\}/},a={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},c={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]},d={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,i,c],p=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],f=(g,b,y="\\1")=>{const k=y==="\\1"?y:e.concat(y,b);return e.concat(e.concat("(?:",g,")"),b,/(?:\\.|[^\\\/])*?/,k,/(?:\\.|[^\\\/])*?/,y,o)},h=(g,b,y)=>e.concat(e.concat("(?:",g,")"),b,/(?:\\.|[^\\\/])*?/,y,o),m=[c,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}]},d,{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(...p,{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(...p,{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,d]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return i.contains=m,s.contains=m,{name:"Perl",aliases:["pl","pm"],keywords:r,contains:m}}function z1(t){const e=t.regex,n=/(?![A-Za-z0-9])(?![$])/,o=e.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),r=e.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),i=e.concat(/[A-Z]+/,n),s={scope:"variable",match:"\\$+"+o},a={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},c={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},d=t.inherit(t.APOS_STRING_MODE,{illegal:null}),u=t.inherit(t.QUOTE_STRING_MODE,{illegal:null,contains:t.QUOTE_STRING_MODE.contains.concat(c)}),p={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:t.QUOTE_STRING_MODE.contains.concat(c),"on:begin":(ce,re)=>{re.data._beginMatch=ce[1]||ce[2]},"on:end":(ce,re)=>{re.data._beginMatch!==ce[1]&&re.ignoreMatch()}},f=t.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),h=`[
143
- ]`,m={scope:"string",variants:[u,d,p,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},b=["false","null","true"],y=["__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"],k=["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:y,literal:(ce=>{const re=[];return ce.forEach(ie=>{re.push(ie),ie.toLowerCase()===ie?re.push(ie.toUpperCase()):re.push(ie.toLowerCase())}),re})(b),built_in:k},_=ce=>ce.map(re=>re.replace(/\|\d+$/,"")),C={variants:[{match:[/new/,e.concat(h,"+"),e.concat("(?!",_(k).join("\\b|"),"\\b)"),r],scope:{1:"keyword",4:"title.class"}}]},A=e.concat(o,"\\b(?!\\()"),L={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),A],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[r,e.concat(/::/,e.lookahead(/(?!class\b)/)),A],scope:{1:"title.class",3:"variable.constant"}},{match:[r,e.concat("::",e.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[r,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},M={scope:"attr",match:e.concat(o,e.lookahead(":"),e.lookahead(/(?!::)/))},P={relevance:0,begin:/\(/,end:/\)/,keywords:v,contains:[M,s,L,t.C_BLOCK_COMMENT_MODE,m,g,C]},K={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",_(y).join("\\b|"),"|",_(k).join("\\b|"),"\\b)"),o,e.concat(h,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[P]};P.contains.push(K);const te=[M,L,t.C_BLOCK_COMMENT_MODE,m,g,C],de={begin:e.concat(/#\[\s*\\?/,e.either(r,i)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:b,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:b,keyword:["new","array"]},contains:["self",...te]},...te,{scope:"meta",variants:[{match:r},{match:i}]}]};return{case_insensitive:!1,keywords:v,contains:[de,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,K,L,{match:[/const/,/\s/,o],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",de,s,L,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 H1(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 U1(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function q1(t){const e=t.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),o=["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:o,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"]},c={className:"meta",begin:/^(>>>|\.\.\.) /},d={className:"subst",begin:/\{/,end:/\}/,keywords:a,illegal:/#/},u={begin:/\{\{/,relevance:0},p={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,c,u,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,c,u,d]},{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,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,u,d]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},f="[0-9](_?[0-9])*",h=`(\\b(${f}))?\\.(${f})|\\b(${f})\\.`,m=`\\b|${o.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})`}]},b={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:a,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},y={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:["self",c,g,p,t.HASH_COMMENT_MODE]}]};return d.contains=[p,g,c],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:a,illegal:/(<\/|\?)|=>/,contains:[c,g,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},p,b,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[y]},{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,y,p]}]}}function W1(t){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function K1(t){const e=t.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,o=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]?/),r=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,i=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:[r,o]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,o]},{scope:{1:"punctuation",2:"number"},match:[i,o]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,o]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:r},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:i},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function j1(t){const e=t.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",o=e.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),r=e.concat(o,/(::\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]+"},c={begin:"#<",end:">"},d=[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},p={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=[p,{variants:[{match:[/class\s+/,r,/\s+<\s+/,r]},{match:[/\b(class|module)\s+/,r]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:s},{match:[/(include|extend)\s+/,r],scope:{2:"title.class"},keywords:s},{relevance:0,match:[r,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:o,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:[p,{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(c,d),relevance:0}].concat(c,d);u.contains=C,g.contains=C;const P=[{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 d.unshift(c),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:s,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(P).concat(d).concat(C)}}function G1(t){const e=t.regex,n=/(r#)?/,o=e.concat(n,t.UNDERSCORE_IDENT_RE),r=e.concat(n,t.IDENT_RE),i={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let|for|while|if|else|match\b)/,r,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"],c=["true","false","Some","None","Ok","Err"],d=["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:c,built_in:d},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+/,o],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,o],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,o,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,o],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,o],className:{1:"keyword",3:"title.class"}},{begin:t.IDENT_RE+"::",keywords:{keyword:"Self",built_in:d,type:u}},{className:"punctuation",begin:"->"},i]}}const Y1=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_-]*/}}),J1=["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"],X1=["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"],Z1=[...J1,...X1],Q1=["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(),eO=["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(),tO=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),nO=["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 oO(t){const e=Y1(t),n=tO,o=eO,r="@[a-z-]+",i="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("+Z1.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+o.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},a,{begin:/\(/,end:/\)/,contains:[e.CSS_NUMBER_MODE]},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+nO.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:r,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:Q1.join(" ")},contains:[{begin:r,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 rO(t){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function iO(t){const e=t.regex,n=t.COMMENT("--","$"),o={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},r={begin:/"/,end:/"/,contains:[{match:/""/}]},i=["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"],c=["add","asc","collation","desc","final","first","last","view"],d=["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"],p=["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=[...d,...c].filter(_=>!u.includes(_)),g={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},b={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},y={match:e.concat(/\b/,e.either(...h),/\s*\(/),relevance:0,keywords:{built_in:h}};function k(_){return e.concat(/\b/,e.either(..._.map(C=>C.replace(/\s+/,"\\s+"))),/\b/)}const w={scope:"keyword",match:k(f),relevance:0};function v(_,{exceptions:C,when:A}={}){const L=A;return C=C||[],_.map(M=>M.match(/\|\d+$/)||C.includes(M)?M:L(M)?`${M}|0`:M)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:v(m,{when:_=>_.length<3}),literal:i,type:a,built_in:p},contains:[{scope:"type",match:k(s)},w,y,g,o,r,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,b]}}function fg(t){return t?typeof t=="string"?t:t.source:null}function Mr(t){return Be("(?=",t,")")}function Be(...t){return t.map(n=>fg(n)).join("")}function sO(t){const e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function Ot(...t){return"("+(sO(t).capture?"":"?:")+t.map(o=>fg(o)).join("|")+")"}const td=t=>Be(/\b/,t,/\w$/.test(t)?/\b/:/\B/),aO=["Protocol","Type"].map(td),Tp=["init","self"].map(td),lO=["Any","Self"],sl=["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"],Op=["false","nil","true"],cO=["assignment","associativity","higherThan","left","lowerThan","none","right"],dO=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],Mp=["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"],hg=Ot(/[/=\-+!*%<>&|^~?]/,/[\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]/),mg=Ot(hg,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),al=Be(hg,mg,"*"),gg=Ot(/[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]/),Ts=Ot(gg,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Cn=Be(gg,Ts,"*"),ji=Be(/[A-Z]/,Ts,"*"),uO=["attached","autoclosure",Be(/convention\(/,Ot("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Be(/objc\(/,Cn,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],pO=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function fO(t){const e={match:/\s+/,relevance:0},n=t.COMMENT("/\\*","\\*/",{contains:["self"]}),o=[t.C_LINE_COMMENT_MODE,n],r={match:[/\./,Ot(...aO,...Tp)],className:{2:"keyword"}},i={match:Be(/\./,Ot(...sl)),relevance:0},s=sl.filter(le=>typeof le=="string").concat(["_|0"]),a=sl.filter(le=>typeof le!="string").concat(lO).map(td),c={variants:[{className:"keyword",match:Ot(...a,...Tp)}]},d={$pattern:Ot(/\b\w+/,/#\w+/),keyword:s.concat(dO),literal:Op},u=[r,i,c],p={match:Be(/\./,Ot(...Mp)),relevance:0},f={className:"built_in",match:Be(/\b/,Ot(...Mp),/(?=\()/)},h=[p,f],m={match:/->/,relevance:0},g={className:"operator",relevance:0,variants:[{match:al},{match:`\\.(\\.|${mg})+`}]},b=[m,g],y="([0-9]_*)+",k="([0-9a-fA-F]_*)+",w={className:"number",relevance:0,variants:[{match:`\\b(${y})(\\.(${y}))?([eE][+-]?(${y}))?\\b`},{match:`\\b0x(${k})(\\.(${k}))?([pP][+-]?(${y}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},v=(le="")=>({className:"subst",variants:[{match:Be(/\\/,le,/[0\\tnr"']/)},{match:Be(/\\/,le,/u\{[0-9a-fA-F]{1,8}\}/)}]}),_=(le="")=>({className:"subst",match:Be(/\\/,le,/[\t ]*(?:[\r\n]|\r\n)/)}),C=(le="")=>({className:"subst",label:"interpol",begin:Be(/\\/,le,/\(/),end:/\)/}),A=(le="")=>({begin:Be(le,/"""/),end:Be(/"""/,le),contains:[v(le),_(le),C(le)]}),L=(le="")=>({begin:Be(le,/"/),end:Be(/"/,le),contains:[v(le),C(le)]}),M={className:"string",variants:[A(),A("#"),A("##"),A("###"),L(),L("#"),L("##"),L("###")]},P=[t.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[t.BACKSLASH_ESCAPE]}],K={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:P},te=le=>{const It=Be(le,/\//),vt=Be(/\//,le);return{begin:It,end:vt,contains:[...P,{scope:"comment",begin:`#(?!.*${vt})`,end:/$/}]}},de={scope:"regexp",variants:[te("###"),te("##"),te("#"),K]},ce={match:Be(/`/,Cn,/`/)},re={className:"variable",match:/\$\d+/},ie={className:"variable",match:`\\$${Ts}+`},x=[ce,re,ie],O={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:pO,contains:[...b,w,M]}]}},V={scope:"keyword",match:Be(/@/,Ot(...uO),Mr(Ot(/\(/,/\s+/)))},Y={scope:"meta",match:Be(/@/,Cn)},Q=[O,V,Y],fe={match:Mr(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Be(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Ts,"+")},{className:"type",match:ji,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Be(/\s+&\s+/,Mr(ji)),relevance:0}]},Ne={begin:/</,end:/>/,keywords:d,contains:[...o,...u,...Q,m,fe]};fe.contains.push(Ne);const rt={match:Be(Cn,/\s*:/),keywords:"_|0",relevance:0},Te={begin:/\(/,end:/\)/,relevance:0,keywords:d,contains:["self",rt,...o,de,...u,...h,...b,w,M,...x,...Q,fe]},Fe={begin:/</,end:/>/,keywords:"repeat each",contains:[...o,fe]},Vt={begin:Ot(Mr(Be(Cn,/\s*:/)),Mr(Be(Cn,/\s+/,Cn,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Cn}]},pt={begin:/\(/,end:/\)/,keywords:d,contains:[Vt,...o,...u,...b,w,M,...Q,fe,Te],endsParent:!0,illegal:/["']/},Xt={match:[/(func|macro)/,/\s+/,Ot(ce.match,Cn,al)],className:{1:"keyword",3:"title.function"},contains:[Fe,pt,e],illegal:[/\[/,/%/]},ft={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[Fe,pt,e],illegal:/\[|%/},Zt={match:[/operator/,/\s+/,al],className:{1:"keyword",3:"title"}},kn={begin:[/precedencegroup/,/\s+/,ji],className:{1:"keyword",3:"title"},contains:[fe],keywords:[...cO,...Op],end:/}/},un={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},zt={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},pn={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,Cn,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:d,contains:[Fe,...u,{begin:/:/,end:/\{/,keywords:d,contains:[{scope:"title.class.inherited",match:ji},...u],relevance:0}]};for(const le of M.variants){const It=le.contains.find(Z=>Z.label==="interpol");It.keywords=d;const vt=[...u,...h,...b,w,M,...x];It.contains=[...vt,{begin:/\(/,end:/\)/,contains:["self",...vt]}]}return{name:"Swift",keywords:d,contains:[...o,Xt,ft,un,zt,pn,Zt,kn,{beginKeywords:"import",end:/$/,contains:[...o],relevance:0},de,...u,...h,...b,w,M,...x,...Q,fe,Te]}}const Os="[A-Za-z$_][0-9A-Za-z$_]*",bg=["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"],yg=["true","false","null","undefined","NaN","Infinity"],vg=["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"],kg=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Eg=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],wg=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Cg=[].concat(Eg,vg,kg);function hO(t){const e=t.regex,n=(O,{after:V})=>{const Y="</"+O[0].slice(1);return O.input.indexOf(Y,V)!==-1},o=Os,r={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(O,V)=>{const Y=O[0].length+O.index,Q=O.input[Y];if(Q==="<"||Q===","){V.ignoreMatch();return}Q===">"&&(n(O,{after:Y})||V.ignoreMatch());let fe;const Ne=O.input.substring(Y);if(fe=Ne.match(/^\s*=/)){V.ignoreMatch();return}if((fe=Ne.match(/^\s+extends\s+/))&&fe.index===0){V.ignoreMatch();return}}},a={$pattern:Os,keyword:bg,literal:yg,built_in:Cg,"variable.language":wg},c="[0-9](_?[0-9])*",d=`\\.(${c})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",p={className:"number",variants:[{begin:`(\\b(${u})((${d})|\\.)?|(${d}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${d})\\b|\\.)?|(${d})\\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"}},b={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,f]},k={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:o+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},w=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,h,m,g,b,{match:/\$\d+/},p];f.contains=w.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(w)});const v=[].concat(k,f.contains),_=v.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(v)}]),C={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:_},A={variants:[{match:[/class/,/\s+/,o,/\s+/,/extends/,/\s+/,e.concat(o,"(",e.concat(/\./,o),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,o],scope:{1:"keyword",3:"title.class"}}]},L={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:{_:[...vg,...kg]}},M={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},P={variants:[{match:[/function/,/\s+/,o,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[C],illegal:/%/},K={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function te(O){return e.concat("(?!",O.join("|"),")")}const de={match:e.concat(/\b/,te([...Eg,"super","import"].map(O=>`${O}\\s*\\(`)),o,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},ce={begin:e.concat(/\./,e.lookahead(e.concat(o,/(?![0-9A-Za-z$_(])/))),end:o,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},re={match:[/get|set/,/\s+/,o,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},C]},ie="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",x={match:[/const|var|let/,/\s+/,o,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(ie)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[C]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:_,CLASS_REFERENCE:L},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),M,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,h,m,g,b,k,{match:/\$\d+/},p,L,{scope:"attr",match:o+e.lookahead(":"),relevance:0},x,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[k,t.REGEXP_MODE,{className:"function",begin:ie,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:_}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:i},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},P,{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:o,className:"title.function"})]},{match:/\.\.\./,relevance:0},ce,{match:"\\$"+o,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[C]},de,K,A,re,{match:/\$[(.]/}]}}function mO(t){const e=t.regex,n=hO(t),o=Os,r=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},s={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:r},contains:[n.exports.CLASS_REFERENCE]},a={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},c=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],d={$pattern:Os,keyword:bg.concat(c),literal:yg,built_in:Cg.concat(r),"variable.language":wg},u={className:"meta",begin:"@"+o},p=(g,b,y)=>{const k=g.contains.findIndex(w=>w.label===b);if(k===-1)throw new Error("can not find mode to replace");g.contains.splice(k,1,y)};Object.assign(n.keywords,d),n.exports.PARAMS_CONTAINS.push(u);const f=n.contains.find(g=>g.scope==="attr"),h=Object.assign({},f,{match:e.concat(o,e.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,f,h]),n.contains=n.contains.concat([u,i,s,h]),p(n,"shebang",t.SHEBANG()),p(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 gO(t){const e=t.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},o={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},r=/\d{1,2}\/\d{1,2}\/\d{4}/,i=/\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}/,c={className:"literal",variants:[{begin:e.concat(/# */,e.either(i,r),/ *#/)},{begin:e.concat(/# */,a,/ *#/)},{begin:e.concat(/# */,s,/ *#/)},{begin:e.concat(/# */,e.either(i,r),/ +/,e.either(s,a),/ *#/)}]},d={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+:/},p=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,o,c,d,u,p,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 bO(t){t.regex;const e=t.COMMENT(/\(;/,/;\)/);e.contains.push("self");const n=t.COMMENT(/;;/,/$/),o=["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"],r={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},i={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/},c={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},d={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:o},contains:[n,e,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},i,s,r,t.QUOTE_STRING_MODE,c,d,a]}}function yO(t){const e=t.regex,n=e.concat(/[\p{L}_]/u,e.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),o=/[\p{L}0-9._:-]+/u,r={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},i={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},s=t.inherit(i,{begin:/\(/,end:/\)/}),a=t.inherit(t.APOS_STRING_MODE,{className:"string"}),c=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),d={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:o,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[r]},{begin:/'/,end:/'/,contains:[r]},{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:[i,c,a,s,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[i,s,c,a]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},r,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[d],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[d],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:d}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function vO(t){const e="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",o={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},r={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},i={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,r]},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},b=[o,{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,i,s],y=[...b];return y.pop(),y.push(a),h.contains=y,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:b}}const kO={arduino:t1,bash:n1,c:o1,cpp:r1,csharp:i1,css:h1,diff:m1,go:g1,graphql:b1,ini:y1,java:v1,javascript:_1,json:S1,kotlin:N1,less:B1,lua:L1,makefile:P1,markdown:$1,objectivec:F1,perl:V1,php:z1,"php-template":H1,plaintext:U1,python:q1,"python-repl":W1,r:K1,ruby:j1,rust:G1,scss:oO,shell:rO,sql:iO,swift:fO,typescript:mO,vbnet:gO,wasm:bO,xml:yO,yaml:vO};function EO(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ll,Ap;function wO(){if(Ap)return ll;Ap=1;function t(E){return E instanceof Map?E.clear=E.delete=E.set=function(){throw new Error("map is read-only")}:E instanceof Set&&(E.add=E.clear=E.delete=function(){throw new Error("set is read-only")}),Object.freeze(E),Object.getOwnPropertyNames(E).forEach(N=>{const B=E[N],se=typeof B;(se==="object"||se==="function")&&!Object.isFrozen(B)&&t(B)}),E}class e{constructor(N){N.data===void 0&&(N.data={}),this.data=N.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(E){return E.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function o(E,...N){const B=Object.create(null);for(const se in E)B[se]=E[se];return N.forEach(function(se){for(const qe in se)B[qe]=se[qe]}),B}const r="</span>",i=E=>!!E.scope,s=(E,{prefix:N})=>{if(E.startsWith("language:"))return E.replace("language:","language-");if(E.includes(".")){const B=E.split(".");return[`${N}${B.shift()}`,...B.map((se,qe)=>`${se}${"_".repeat(qe+1)}`)].join(" ")}return`${N}${E}`};class a{constructor(N,B){this.buffer="",this.classPrefix=B.classPrefix,N.walk(this)}addText(N){this.buffer+=n(N)}openNode(N){if(!i(N))return;const B=s(N.scope,{prefix:this.classPrefix});this.span(B)}closeNode(N){i(N)&&(this.buffer+=r)}value(){return this.buffer}span(N){this.buffer+=`<span class="${N}">`}}const c=(E={})=>{const N={children:[]};return Object.assign(N,E),N};class d{constructor(){this.rootNode=c(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(N){this.top.children.push(N)}openNode(N){const B=c({scope:N});this.add(B),this.stack.push(B)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(N){return this.constructor._walk(N,this.rootNode)}static _walk(N,B){return typeof B=="string"?N.addText(B):B.children&&(N.openNode(B),B.children.forEach(se=>this._walk(N,se)),N.closeNode(B)),N}static _collapse(N){typeof N!="string"&&N.children&&(N.children.every(B=>typeof B=="string")?N.children=[N.children.join("")]:N.children.forEach(B=>{d._collapse(B)}))}}class u extends d{constructor(N){super(),this.options=N}addText(N){N!==""&&this.add(N)}startScope(N){this.openNode(N)}endScope(){this.closeNode()}__addSublanguage(N,B){const se=N.root;B&&(se.scope=`language:${B}`),this.add(se)}toHTML(){return new a(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function p(E){return E?typeof E=="string"?E:E.source:null}function f(E){return g("(?=",E,")")}function h(E){return g("(?:",E,")*")}function m(E){return g("(?:",E,")?")}function g(...E){return E.map(B=>p(B)).join("")}function b(E){const N=E[E.length-1];return typeof N=="object"&&N.constructor===Object?(E.splice(E.length-1,1),N):{}}function y(...E){return"("+(b(E).capture?"":"?:")+E.map(se=>p(se)).join("|")+")"}function k(E){return new RegExp(E.toString()+"|").exec("").length-1}function w(E,N){const B=E&&E.exec(N);return B&&B.index===0}const v=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function _(E,{joinWith:N}){let B=0;return E.map(se=>{B+=1;const qe=B;let Ve=p(se),W="";for(;Ve.length>0;){const H=v.exec(Ve);if(!H){W+=Ve;break}W+=Ve.substring(0,H.index),Ve=Ve.substring(H.index+H[0].length),H[0][0]==="\\"&&H[1]?W+="\\"+String(Number(H[1])+qe):(W+=H[0],H[0]==="("&&B++)}return W}).map(se=>`(${se})`).join(N)}const C=/\b\B/,A="[a-zA-Z]\\w*",L="[a-zA-Z_]\\w*",M="\\b\\d+(\\.\\d+)?",P="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",K="\\b(0b[01]+)",te="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",de=(E={})=>{const N=/^#![ ]*\//;return E.binary&&(E.begin=g(N,/.*\b/,E.binary,/\b.*/)),o({scope:"meta",begin:N,end:/$/,relevance:0,"on:begin":(B,se)=>{B.index!==0&&se.ignoreMatch()}},E)},ce={begin:"\\\\[\\s\\S]",relevance:0},re={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[ce]},ie={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[ce]},x={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/},O=function(E,N,B={}){const se=o({scope:"comment",begin:E,end:N,contains:[]},B);se.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const qe=y("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 se.contains.push({begin:g(/[ ]+/,"(",qe,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),se},V=O("//","$"),Y=O("/\\*","\\*/"),Q=O("#","$"),fe={scope:"number",begin:M,relevance:0},Ne={scope:"number",begin:P,relevance:0},rt={scope:"number",begin:K,relevance:0},Te={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[ce,{begin:/\[/,end:/\]/,relevance:0,contains:[ce]}]},Fe={scope:"title",begin:A,relevance:0},Vt={scope:"title",begin:L,relevance:0},pt={begin:"\\.\\s*"+L,relevance:0};var ft=Object.freeze({__proto__:null,APOS_STRING_MODE:re,BACKSLASH_ESCAPE:ce,BINARY_NUMBER_MODE:rt,BINARY_NUMBER_RE:K,COMMENT:O,C_BLOCK_COMMENT_MODE:Y,C_LINE_COMMENT_MODE:V,C_NUMBER_MODE:Ne,C_NUMBER_RE:P,END_SAME_AS_BEGIN:function(E){return Object.assign(E,{"on:begin":(N,B)=>{B.data._beginMatch=N[1]},"on:end":(N,B)=>{B.data._beginMatch!==N[1]&&B.ignoreMatch()}})},HASH_COMMENT_MODE:Q,IDENT_RE:A,MATCH_NOTHING_RE:C,METHOD_GUARD:pt,NUMBER_MODE:fe,NUMBER_RE:M,PHRASAL_WORDS_MODE:x,QUOTE_STRING_MODE:ie,REGEXP_MODE:Te,RE_STARTERS_RE:te,SHEBANG:de,TITLE_MODE:Fe,UNDERSCORE_IDENT_RE:L,UNDERSCORE_TITLE_MODE:Vt});function Zt(E,N){E.input[E.index-1]==="."&&N.ignoreMatch()}function kn(E,N){E.className!==void 0&&(E.scope=E.className,delete E.className)}function un(E,N){N&&E.beginKeywords&&(E.begin="\\b("+E.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",E.__beforeBegin=Zt,E.keywords=E.keywords||E.beginKeywords,delete E.beginKeywords,E.relevance===void 0&&(E.relevance=0))}function zt(E,N){Array.isArray(E.illegal)&&(E.illegal=y(...E.illegal))}function pn(E,N){if(E.match){if(E.begin||E.end)throw new Error("begin & end are not supported with match");E.begin=E.match,delete E.match}}function le(E,N){E.relevance===void 0&&(E.relevance=1)}const It=(E,N)=>{if(!E.beforeMatch)return;if(E.starts)throw new Error("beforeMatch cannot be used with starts");const B=Object.assign({},E);Object.keys(E).forEach(se=>{delete E[se]}),E.keywords=B.keywords,E.begin=g(B.beforeMatch,f(B.begin)),E.starts={relevance:0,contains:[Object.assign(B,{endsParent:!0})]},E.relevance=0,delete B.beforeMatch},vt=["of","and","for","in","not","or","if","then","parent","list","value"],Z="keyword";function St(E,N,B=Z){const se=Object.create(null);return typeof E=="string"?qe(B,E.split(" ")):Array.isArray(E)?qe(B,E):Object.keys(E).forEach(function(Ve){Object.assign(se,St(E[Ve],N,Ve))}),se;function qe(Ve,W){N&&(W=W.map(H=>H.toLowerCase())),W.forEach(function(H){const ae=H.split("|");se[ae[0]]=[Ve,Ie(ae[0],ae[1])]})}}function Ie(E,N){return N?Number(N):ke(E)?0:1}function ke(E){return vt.includes(E.toLowerCase())}const xt={},Je=E=>{console.error(E)},fn=(E,...N)=>{console.log(`WARN: ${E}`,...N)},Nt=(E,N)=>{xt[`${E}/${N}`]||(console.log(`Deprecated as of ${E}. ${N}`),xt[`${E}/${N}`]=!0)},I=new Error;function z(E,N,{key:B}){let se=0;const qe=E[B],Ve={},W={};for(let H=1;H<=N.length;H++)W[H+se]=qe[H],Ve[H+se]=!0,se+=k(N[H-1]);E[B]=W,E[B]._emit=Ve,E[B]._multi=!0}function ue(E){if(Array.isArray(E.begin)){if(E.skip||E.excludeBegin||E.returnBegin)throw Je("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),I;if(typeof E.beginScope!="object"||E.beginScope===null)throw Je("beginScope must be object"),I;z(E,E.begin,{key:"beginScope"}),E.begin=_(E.begin,{joinWith:""})}}function Ee(E){if(Array.isArray(E.end)){if(E.skip||E.excludeEnd||E.returnEnd)throw Je("skip, excludeEnd, returnEnd not compatible with endScope: {}"),I;if(typeof E.endScope!="object"||E.endScope===null)throw Je("endScope must be object"),I;z(E,E.end,{key:"endScope"}),E.end=_(E.end,{joinWith:""})}}function Qe(E){E.scope&&typeof E.scope=="object"&&E.scope!==null&&(E.beginScope=E.scope,delete E.scope)}function Ht(E){Qe(E),typeof E.beginScope=="string"&&(E.beginScope={_wrap:E.beginScope}),typeof E.endScope=="string"&&(E.endScope={_wrap:E.endScope}),ue(E),Ee(E)}function Sr(E){function N(W,H){return new RegExp(p(W),"m"+(E.case_insensitive?"i":"")+(E.unicodeRegex?"u":"")+(H?"g":""))}class B{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(H,ae){ae.position=this.position++,this.matchIndexes[this.matchAt]=ae,this.regexes.push([ae,H]),this.matchAt+=k(H)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const H=this.regexes.map(ae=>ae[1]);this.matcherRe=N(_(H,{joinWith:"|"}),!0),this.lastIndex=0}exec(H){this.matcherRe.lastIndex=this.lastIndex;const ae=this.matcherRe.exec(H);if(!ae)return null;const st=ae.findIndex((Nr,xa)=>xa>0&&Nr!==void 0),et=this.matchIndexes[st];return ae.splice(0,st),Object.assign(ae,et)}}class se{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(H){if(this.multiRegexes[H])return this.multiRegexes[H];const ae=new B;return this.rules.slice(H).forEach(([st,et])=>ae.addRule(st,et)),ae.compile(),this.multiRegexes[H]=ae,ae}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(H,ae){this.rules.push([H,ae]),ae.type==="begin"&&this.count++}exec(H){const ae=this.getMatcher(this.regexIndex);ae.lastIndex=this.lastIndex;let st=ae.exec(H);if(this.resumingScanAtSamePosition()&&!(st&&st.index===this.lastIndex)){const et=this.getMatcher(0);et.lastIndex=this.lastIndex+1,st=et.exec(H)}return st&&(this.regexIndex+=st.position+1,this.regexIndex===this.count&&this.considerAll()),st}}function qe(W){const H=new se;return W.contains.forEach(ae=>H.addRule(ae.begin,{rule:ae,type:"begin"})),W.terminatorEnd&&H.addRule(W.terminatorEnd,{type:"end"}),W.illegal&&H.addRule(W.illegal,{type:"illegal"}),H}function Ve(W,H){const ae=W;if(W.isCompiled)return ae;[kn,pn,Ht,It].forEach(et=>et(W,H)),E.compilerExtensions.forEach(et=>et(W,H)),W.__beforeBegin=null,[un,zt,le].forEach(et=>et(W,H)),W.isCompiled=!0;let st=null;return typeof W.keywords=="object"&&W.keywords.$pattern&&(W.keywords=Object.assign({},W.keywords),st=W.keywords.$pattern,delete W.keywords.$pattern),st=st||/\w+/,W.keywords&&(W.keywords=St(W.keywords,E.case_insensitive)),ae.keywordPatternRe=N(st,!0),H&&(W.begin||(W.begin=/\B|\b/),ae.beginRe=N(ae.begin),!W.end&&!W.endsWithParent&&(W.end=/\B|\b/),W.end&&(ae.endRe=N(ae.end)),ae.terminatorEnd=p(ae.end)||"",W.endsWithParent&&H.terminatorEnd&&(ae.terminatorEnd+=(W.end?"|":"")+H.terminatorEnd)),W.illegal&&(ae.illegalRe=N(W.illegal)),W.contains||(W.contains=[]),W.contains=[].concat(...W.contains.map(function(et){return q(et==="self"?W:et)})),W.contains.forEach(function(et){Ve(et,ae)}),W.starts&&Ve(W.starts,H),ae.matcher=qe(ae),ae}if(E.compilerExtensions||(E.compilerExtensions=[]),E.contains&&E.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return E.classNameAliases=o(E.classNameAliases||{}),Ve(E)}function S(E){return E?E.endsWithParent||S(E.starts):!1}function q(E){return E.variants&&!E.cachedVariants&&(E.cachedVariants=E.variants.map(function(N){return o(E,{variants:null},N)})),E.cachedVariants?E.cachedVariants:S(E)?o(E,{starts:E.starts?o(E.starts):null}):Object.isFrozen(E)?o(E):E}var ne="11.11.1";class _e extends Error{constructor(N,B){super(N),this.name="HTMLInjectionError",this.html=B}}const be=n,it=o,Tt=Symbol("nomatch"),Jn=7,xr=function(E){const N=Object.create(null),B=Object.create(null),se=[];let qe=!0;const Ve="Could not find the language '{}', did you forget to load/include a language module?",W={disableAutodetect:!0,name:"Plain text",contains:[]};let H={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:u};function ae(D){return H.noHighlightRe.test(D)}function st(D){let X=D.className+" ";X+=D.parentNode?D.parentNode.className:"";const ve=H.languageDetectRe.exec(X);if(ve){const ze=Xn(ve[1]);return ze||(fn(Ve.replace("{}",ve[1])),fn("Falling back to no-highlight mode for this block.",D)),ze?ve[1]:"no-highlight"}return X.split(/\s+/).find(ze=>ae(ze)||Xn(ze))}function et(D,X,ve){let ze="",nt="";typeof X=="object"?(ze=D,ve=X.ignoreIllegals,nt=X.language):(Nt("10.7.0","highlight(lang, code, ...args) has been deprecated."),Nt("10.7.0",`Please use highlight(code, options) instead.
144
- https://github.com/highlightjs/highlight.js/issues/2277`),nt=D,ze=X),ve===void 0&&(ve=!0);const hn={code:ze,language:nt};Ci("before:highlight",hn);const Zn=hn.result?hn.result:Nr(hn.language,hn.code,ve);return Zn.code=hn.code,Ci("after:highlight",Zn),Zn}function Nr(D,X,ve,ze){const nt=Object.create(null);function hn(F,j){return F.keywords[j]}function Zn(){if(!pe.keywords){ht.addText(He);return}let F=0;pe.keywordPatternRe.lastIndex=0;let j=pe.keywordPatternRe.exec(He),ge="";for(;j;){ge+=He.substring(F,j.index);const Ae=wn.case_insensitive?j[0].toLowerCase():j[0],kt=hn(pe,Ae);if(kt){const[Bn,hb]=kt;if(ht.addText(ge),ge="",nt[Ae]=(nt[Ae]||0)+1,nt[Ae]<=Jn&&(xi+=hb),Bn.startsWith("_"))ge+=j[0];else{const mb=wn.classNameAliases[Bn]||Bn;En(j[0],mb)}}else ge+=j[0];F=pe.keywordPatternRe.lastIndex,j=pe.keywordPatternRe.exec(He)}ge+=He.substring(F),ht.addText(ge)}function _i(){if(He==="")return;let F=null;if(typeof pe.subLanguage=="string"){if(!N[pe.subLanguage]){ht.addText(He);return}F=Nr(pe.subLanguage,He,!0,yd[pe.subLanguage]),yd[pe.subLanguage]=F._top}else F=Na(He,pe.subLanguage.length?pe.subLanguage:null);pe.relevance>0&&(xi+=F.relevance),ht.__addSublanguage(F._emitter,F.language)}function Ut(){pe.subLanguage!=null?_i():Zn(),He=""}function En(F,j){F!==""&&(ht.startScope(j),ht.addText(F),ht.endScope())}function hd(F,j){let ge=1;const Ae=j.length-1;for(;ge<=Ae;){if(!F._emit[ge]){ge++;continue}const kt=wn.classNameAliases[F[ge]]||F[ge],Bn=j[ge];kt?En(Bn,kt):(He=Bn,Zn(),He=""),ge++}}function md(F,j){return F.scope&&typeof F.scope=="string"&&ht.openNode(wn.classNameAliases[F.scope]||F.scope),F.beginScope&&(F.beginScope._wrap?(En(He,wn.classNameAliases[F.beginScope._wrap]||F.beginScope._wrap),He=""):F.beginScope._multi&&(hd(F.beginScope,j),He="")),pe=Object.create(F,{parent:{value:pe}}),pe}function gd(F,j,ge){let Ae=w(F.endRe,ge);if(Ae){if(F["on:end"]){const kt=new e(F);F["on:end"](j,kt),kt.isMatchIgnored&&(Ae=!1)}if(Ae){for(;F.endsParent&&F.parent;)F=F.parent;return F}}if(F.endsWithParent)return gd(F.parent,j,ge)}function cb(F){return pe.matcher.regexIndex===0?(He+=F[0],1):(Aa=!0,0)}function db(F){const j=F[0],ge=F.rule,Ae=new e(ge),kt=[ge.__beforeBegin,ge["on:begin"]];for(const Bn of kt)if(Bn&&(Bn(F,Ae),Ae.isMatchIgnored))return cb(j);return ge.skip?He+=j:(ge.excludeBegin&&(He+=j),Ut(),!ge.returnBegin&&!ge.excludeBegin&&(He=j)),md(ge,F),ge.returnBegin?0:j.length}function ub(F){const j=F[0],ge=X.substring(F.index),Ae=gd(pe,F,ge);if(!Ae)return Tt;const kt=pe;pe.endScope&&pe.endScope._wrap?(Ut(),En(j,pe.endScope._wrap)):pe.endScope&&pe.endScope._multi?(Ut(),hd(pe.endScope,F)):kt.skip?He+=j:(kt.returnEnd||kt.excludeEnd||(He+=j),Ut(),kt.excludeEnd&&(He=j));do pe.scope&&ht.closeNode(),!pe.skip&&!pe.subLanguage&&(xi+=pe.relevance),pe=pe.parent;while(pe!==Ae.parent);return Ae.starts&&md(Ae.starts,F),kt.returnEnd?0:j.length}function pb(){const F=[];for(let j=pe;j!==wn;j=j.parent)j.scope&&F.unshift(j.scope);F.forEach(j=>ht.openNode(j))}let Si={};function bd(F,j){const ge=j&&j[0];if(He+=F,ge==null)return Ut(),0;if(Si.type==="begin"&&j.type==="end"&&Si.index===j.index&&ge===""){if(He+=X.slice(j.index,j.index+1),!qe){const Ae=new Error(`0 width match regex (${D})`);throw Ae.languageName=D,Ae.badRule=Si.rule,Ae}return 1}if(Si=j,j.type==="begin")return db(j);if(j.type==="illegal"&&!ve){const Ae=new Error('Illegal lexeme "'+ge+'" for mode "'+(pe.scope||"<unnamed>")+'"');throw Ae.mode=pe,Ae}else if(j.type==="end"){const Ae=ub(j);if(Ae!==Tt)return Ae}if(j.type==="illegal"&&ge==="")return He+=`
145
- `,1;if(Ma>1e5&&Ma>j.index*3)throw new Error("potential infinite loop, way more iterations than matches");return He+=ge,ge.length}const wn=Xn(D);if(!wn)throw Je(Ve.replace("{}",D)),new Error('Unknown language: "'+D+'"');const fb=Sr(wn);let Oa="",pe=ze||fb;const yd={},ht=new H.__emitter(H);pb();let He="",xi=0,wo=0,Ma=0,Aa=!1;try{if(wn.__emitTokens)wn.__emitTokens(X,ht);else{for(pe.matcher.considerAll();;){Ma++,Aa?Aa=!1:pe.matcher.considerAll(),pe.matcher.lastIndex=wo;const F=pe.matcher.exec(X);if(!F)break;const j=X.substring(wo,F.index),ge=bd(j,F);wo=F.index+ge}bd(X.substring(wo))}return ht.finalize(),Oa=ht.toHTML(),{language:D,value:Oa,relevance:xi,illegal:!1,_emitter:ht,_top:pe}}catch(F){if(F.message&&F.message.includes("Illegal"))return{language:D,value:be(X),illegal:!0,relevance:0,_illegalBy:{message:F.message,index:wo,context:X.slice(wo-100,wo+100),mode:F.mode,resultSoFar:Oa},_emitter:ht};if(qe)return{language:D,value:be(X),illegal:!1,relevance:0,errorRaised:F,_emitter:ht,_top:pe};throw F}}function xa(D){const X={value:be(D),illegal:!1,relevance:0,_top:W,_emitter:new H.__emitter(H)};return X._emitter.addText(D),X}function Na(D,X){X=X||H.languages||Object.keys(N);const ve=xa(D),ze=X.filter(Xn).filter(fd).map(Ut=>Nr(Ut,D,!1));ze.unshift(ve);const nt=ze.sort((Ut,En)=>{if(Ut.relevance!==En.relevance)return En.relevance-Ut.relevance;if(Ut.language&&En.language){if(Xn(Ut.language).supersetOf===En.language)return 1;if(Xn(En.language).supersetOf===Ut.language)return-1}return 0}),[hn,Zn]=nt,_i=hn;return _i.secondBest=Zn,_i}function Zg(D,X,ve){const ze=X&&B[X]||ve;D.classList.add("hljs"),D.classList.add(`language-${ze}`)}function Ta(D){let X=null;const ve=st(D);if(ae(ve))return;if(Ci("before:highlightElement",{el:D,language:ve}),D.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",D);return}if(D.children.length>0&&(H.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(D)),H.throwUnescapedHTML))throw new _e("One of your code blocks includes unescaped HTML.",D.innerHTML);X=D;const ze=X.textContent,nt=ve?et(ze,{language:ve,ignoreIllegals:!0}):Na(ze);D.innerHTML=nt.value,D.dataset.highlighted="yes",Zg(D,ve,nt.language),D.result={language:nt.language,re:nt.relevance,relevance:nt.relevance},nt.secondBest&&(D.secondBest={language:nt.secondBest.language,relevance:nt.secondBest.relevance}),Ci("after:highlightElement",{el:D,result:nt,text:ze})}function Qg(D){H=it(H,D)}const eb=()=>{wi(),Nt("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function tb(){wi(),Nt("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let ud=!1;function wi(){function D(){wi()}if(document.readyState==="loading"){ud||window.addEventListener("DOMContentLoaded",D,!1),ud=!0;return}document.querySelectorAll(H.cssSelector).forEach(Ta)}function nb(D,X){let ve=null;try{ve=X(E)}catch(ze){if(Je("Language definition for '{}' could not be registered.".replace("{}",D)),qe)Je(ze);else throw ze;ve=W}ve.name||(ve.name=D),N[D]=ve,ve.rawDefinition=X.bind(null,E),ve.aliases&&pd(ve.aliases,{languageName:D})}function ob(D){delete N[D];for(const X of Object.keys(B))B[X]===D&&delete B[X]}function rb(){return Object.keys(N)}function Xn(D){return D=(D||"").toLowerCase(),N[D]||N[B[D]]}function pd(D,{languageName:X}){typeof D=="string"&&(D=[D]),D.forEach(ve=>{B[ve.toLowerCase()]=X})}function fd(D){const X=Xn(D);return X&&!X.disableAutodetect}function ib(D){D["before:highlightBlock"]&&!D["before:highlightElement"]&&(D["before:highlightElement"]=X=>{D["before:highlightBlock"](Object.assign({block:X.el},X))}),D["after:highlightBlock"]&&!D["after:highlightElement"]&&(D["after:highlightElement"]=X=>{D["after:highlightBlock"](Object.assign({block:X.el},X))})}function sb(D){ib(D),se.push(D)}function ab(D){const X=se.indexOf(D);X!==-1&&se.splice(X,1)}function Ci(D,X){const ve=D;se.forEach(function(ze){ze[ve]&&ze[ve](X)})}function lb(D){return Nt("10.7.0","highlightBlock will be removed entirely in v12.0"),Nt("10.7.0","Please use highlightElement now."),Ta(D)}Object.assign(E,{highlight:et,highlightAuto:Na,highlightAll:wi,highlightElement:Ta,highlightBlock:lb,configure:Qg,initHighlighting:eb,initHighlightingOnLoad:tb,registerLanguage:nb,unregisterLanguage:ob,listLanguages:rb,getLanguage:Xn,registerAliases:pd,autoDetection:fd,inherit:it,addPlugin:sb,removePlugin:ab}),E.debugMode=function(){qe=!1},E.safeMode=function(){qe=!0},E.versionString=ne,E.regex={concat:g,lookahead:f,either:y,optional:m,anyNumberOfTimes:h};for(const D in ft)typeof ft[D]=="object"&&t(ft[D]);return Object.assign(E,ft),E},Bt=xr({});return Bt.newInstance=()=>xr({}),ll=Bt,Bt.HighlightJS=Bt,Bt.default=Bt,ll}var CO=wO();const _O=EO(CO),Rp={},SO="hljs-";function xO(t){const e=_O.newInstance();return t&&i(t),{highlight:n,highlightAuto:o,listLanguages:r,register:i,registerAlias:s,registered:a};function n(c,d,u){const p=u||Rp,f=typeof p.prefix=="string"?p.prefix:SO;if(!e.getLanguage(c))throw new Error("Unknown language: `"+c+"` is not registered");e.configure({__emitter:NO,classPrefix:f});const h=e.highlight(d,{ignoreIllegals:!0,language:c});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 o(c,d){const p=(d||Rp).subset||r();let f=-1,h=0,m;for(;++f<p.length;){const g=p[f];if(!e.getLanguage(g))continue;const b=n(g,c,d);b.data&&b.data.relevance!==void 0&&b.data.relevance>h&&(h=b.data.relevance,m=b)}return m||{type:"root",children:[],data:{language:void 0,relevance:h}}}function r(){return e.listLanguages()}function i(c,d){if(typeof c=="string")e.registerLanguage(c,d);else{let u;for(u in c)Object.hasOwn(c,u)&&e.registerLanguage(u,c[u])}}function s(c,d){if(typeof c=="string")e.registerAliases(typeof d=="string"?d:[...d],{languageName:c});else{let u;for(u in c)if(Object.hasOwn(c,u)){const p=c[u];e.registerAliases(typeof p=="string"?p:[...p],{languageName:u})}}}function a(c){return!!e.getLanguage(c)}}class NO{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],o=n.children[n.children.length-1];o&&o.type==="text"?o.value+=e:n.children.push({type:"text",value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,n){const o=this.stack[this.stack.length-1],r=e.root.children;n?o.children.push({type:"element",tagName:"span",properties:{className:[n]},children:r}):o.children.push(...r)}openNode(e){const n=this,o=e.split(".").map(function(s,a){return a?s+"_".repeat(a):n.options.classPrefix+s}),r=this.stack[this.stack.length-1],i={type:"element",tagName:"span",properties:{className:o},children:[]};r.children.push(i),this.stack.push(i)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}/**
175
+ **/function MT(t){var e;const{char:n,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:l}=t,c=o&&!r,u=Fh(n),d=new RegExp(`\\s${u}$`),p=s?"^":"",f=r?"":u,h=c?new RegExp(`${p}${u}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${p}(?:^)?${u}[^\\s${f}]*`,"gm"),m=((e=l.nodeBefore)===null||e===void 0?void 0:e.isText)&&l.nodeBefore.text;if(!m)return null;const g=l.pos-m.length,b=Array.from(m.matchAll(h)).pop();if(!b||b.input===void 0||b.index===void 0)return null;const y=b.input.slice(Math.max(0,b.index-1),b.index),k=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(y);if(i!==null&&!k)return null;const E=g+b.index;let v=E+b[0].length;return c&&d.test(m.slice(v-1,v+1))&&(b[0]+=" ",v+=1),E<l.pos&&v>=l.pos?{range:{from:E,to:v},query:b[0].slice(n.length),text:b[0]}:null}const AT=new xe("suggestion");function Na({pluginKey:t=AT,editor:e,char:n="@",allowSpaces:o=!1,allowToIncludeChar:r=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:l="span",decorationClass:c="suggestion",command:u=()=>null,items:d=()=>[],render:p=()=>({}),allow:f=()=>!0,findSuggestionMatch:h=MT}){let m;const g=p==null?void 0:p(),b=new Ae({key:t,view(){return{update:async(y,k)=>{var E,v,C,_,R,B,N;const M=(E=this.key)===null||E===void 0?void 0:E.getState(k),z=(v=this.key)===null||v===void 0?void 0:v.getState(y.state),G=M.active&&z.active&&M.range.from!==z.range.from,$=!M.active&&z.active,U=M.active&&!z.active,q=!$&&!U&&M.query!==z.query,ee=$||G&&q,S=q||G,O=U||G&&q;if(!ee&&!S&&!O)return;const F=O&&!ee?M:z,J=y.dom.querySelector(`[data-decoration-id="${F.decorationId}"]`);m={editor:e,range:F.range,query:F.query,text:F.text,items:[],command:Q=>u({editor:e,range:F.range,props:Q}),decorationNode:J,clientRect:J?()=>{var Q;const{decorationId:ce}=(Q=this.key)===null||Q===void 0?void 0:Q.getState(e.state),Ce=y.dom.querySelector(`[data-decoration-id="${ce}"]`);return(Ce==null?void 0:Ce.getBoundingClientRect())||null}:null},ee&&((C=g==null?void 0:g.onBeforeStart)===null||C===void 0||C.call(g,m)),S&&((_=g==null?void 0:g.onBeforeUpdate)===null||_===void 0||_.call(g,m)),(S||ee)&&(m.items=await d({editor:e,query:F.query})),O&&((R=g==null?void 0:g.onExit)===null||R===void 0||R.call(g,m)),S&&((B=g==null?void 0:g.onUpdate)===null||B===void 0||B.call(g,m)),ee&&((N=g==null?void 0:g.onStart)===null||N===void 0||N.call(g,m))},destroy:()=>{var y;m&&((y=g==null?void 0:g.onExit)===null||y===void 0||y.call(g,m))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(y,k,E,v){const{isEditable:C}=e,{composing:_}=e.view,{selection:R}=y,{empty:B,from:N}=R,M={...k};if(M.composing=_,C&&(B||e.view.composing)){(N<k.range.from||N>k.range.to)&&!_&&!k.composing&&(M.active=!1);const z=h({char:n,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:R.$from}),G=`id_${Math.floor(Math.random()*4294967295)}`;z&&f({editor:e,state:v,range:z.range,isActive:k.active})?(M.active=!0,M.decorationId=k.decorationId?k.decorationId:G,M.range=z.range,M.query=z.query,M.text=z.text):M.active=!1}else M.active=!1;return M.active||(M.decorationId=null,M.range={from:0,to:0},M.query=null,M.text=null),M}},props:{handleKeyDown(y,k){var E;const{active:v,range:C}=b.getState(y.state);return v&&((E=g==null?void 0:g.onKeyDown)===null||E===void 0?void 0:E.call(g,{view:y,event:k,range:C}))||!1},decorations(y){const{active:k,range:E,decorationId:v}=b.getState(y);return k?Ne.create(y.doc,[Ge.inline(E.from,E.to,{nodeName:l,class:c,"data-decoration-id":v})]):null}}});return b}const RT=De.create({name:"char-command",addOptions(){return{pluginKey:"char-command",suggestion:{char:"/",command:({editor:t,range:e,props:n})=>{n.command({editor:t,range:e})}}}},addProseMirrorPlugins(){return[Na({pluginKey:new xe(this.options.pluginKey),editor:this.editor,...this.options.suggestion})]}}),BT=De.create({name:"colon-command",addOptions(){return{suggestion:{char:":",command:({editor:t,range:e,props:n})=>{n.command({editor:t,range:e})}}}},addProseMirrorPlugins(){return[Na({pluginKey:new xe("colon-command"),editor:this.editor,...this.options.suggestion})]}}),DT=De.create({name:"slash-command",addOptions(){return{suggestion:{char:"/",command:({editor:t,range:e,props:n})=>{n.command({editor:t,range:e})}}}},addProseMirrorPlugins(){return[Na({pluginKey:new xe("slash-command"),editor:this.editor,...this.options.suggestion})]}}),IT=De.create({name:"slash-zh-command",addOptions(){return{suggestion:{char:"、",command:({editor:t,range:e,props:n})=>{n.command({editor:t,range:e})}}}},addProseMirrorPlugins(){return[Na({pluginKey:new xe("slash-zh-command"),editor:this.editor,...this.options.suggestion})]}});/**
146
176
  * Copyright 2025 Yiitap
147
177
  * @license MIT
148
- **/function TO(t){const e=document.createElement("textarea");e.value=t,e.contentEditable="true",e.style.position="fixed",document.body.appendChild(e),e.focus(),e.select();const n=document.execCommand("copy");return e.remove(),n}function OO(t){return navigator.clipboard!==void 0?navigator.clipboard.writeText(t):new Promise((e,n)=>{const o=TO(t);o?e(!0):n(o)})}const MO={class:"code-block-toolbar"},AO={class:"wrap editable"},RO={class:"wrap"},DO={class:"language readonly"},IO=l.defineComponent({__name:"view",props:ut,setup(t){const e=t,n=l.ref("content_copy"),o=l.computed({get(){return e.node.attrs.language},set(d){e.updateAttributes({language:d})}}),r=l.computed({get(){return e.node.attrs.wrap},set(d){e.updateAttributes({wrap:d})}}),i=l.computed(()=>r.value?"text_select_move_down":"format_text_wrap");function s(d){o.value=d}function a(){const d=e.node.content.content[0].text;OO(d).then(()=>{n.value="done",setTimeout(()=>{n.value="content_copy"},2e3)})}function c(){r.value=!r.value}return(d,u)=>(l.openBlock(),l.createBlock(l.unref(Dn),l.mergeProps(e,{class:"o-code-block-view"}),{default:l.withCtx(()=>[l.createElementVNode("div",MO,[l.createElementVNode("div",AO,[l.createVNode(l.unref(lm),{language:o.value,onSelect:s},null,8,["language"])]),l.createElementVNode("div",RO,[l.createElementVNode("div",DO,l.toDisplayString(o.value),1),l.createVNode(l.unref(Re),{icon:i.value,"icon-class":{"rotate-270":r.value},tooltip:"Wrap",class:"editable",onClick:c},null,8,["icon","icon-class"]),l.createVNode(l.unref(Re),{icon:n.value,tooltip:"Copy",onClick:a},null,8,["icon"])])]),l.createElementVNode("pre",null,[l.createVNode(l.unref(Gn),{as:"code",class:l.normalizeClass({wrap:r.value})},null,8,["class"])])]),_:1},16))}}),BO=xO(kO),_g=QT.extend({draggable:!0,addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),wrap:{default:!0,rendered:!1}}},addNodeView(){return yn(IO)}}).configure({languageClassPrefix:"language-",defaultLanguage:"bash",lowlight:BO}),LO=l.defineComponent({__name:"view",props:ut,setup(t){const e=t,n=l.computed(()=>e.node.attrs.level);return(o,r)=>(l.openBlock(),l.createBlock(l.unref(Dn),l.mergeProps(e,{class:["o-heading-view",`h${n.value}`],style:`text-align: ${o.node.attrs.textAlign}`}),{default:l.withCtx(()=>[l.createVNode(l.unref(Gn))]),_:1},16,["class","style"]))}}),Sg=em.extend({draggable:!0,addNodeView(){return yn(LO)}}),PO={class:"horizontal"},$O=l.defineComponent({__name:"view",props:ut,setup(t){const e=t;return(n,o)=>(l.openBlock(),l.createBlock(l.unref(Dn),l.mergeProps(e,{class:"o-horizontal-view"}),{default:l.withCtx(()=>[l.createElementVNode("div",PO,[l.createVNode(l.unref(Gn),{as:"div",class:"divider"})])]),_:1},16))}}),xg=im.extend({draggable:!0,addNodeView(){return yn($O)}});/**
178
+ **/const LT=ze.create({name:"aiBlock",group:"block",content:"block+",draggable:!0,addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{provider:{default:""},prompt:{default:""},time:{default:0}}},parseHTML(){return[{tag:'div[data-type="aiBlock"]'}]},renderHTML({HTMLAttributes:t}){return["div",_e(t,{"data-type":"aiBlock"}),0]},addCommands(){return{setAiBlock:()=>({commands:t})=>t.wrapIn(this.name),toggleAiBlock:()=>({commands:t})=>t.toggleWrap(this.name),unsetAiBlock:()=>({commands:t})=>t.lift(this.name),updateAiBlock:(t,e)=>({editor:n,tr:o,dispatch:r})=>{const i=o.doc.nodeAt(t);if(!i||i.type.name!==this.name)return console.error("Invalid node type."),!1;try{const s=An.fromJSON(n.schema,e),l=i.copy(s.content);return o.replaceWith(t,t+i.nodeSize,l),r==null?void 0:r(o)}catch(s){return console.error("Invalid content structure:",s),!1}}}},addKeyboardShortcuts(){return{"Mod-a":({editor:t})=>{var s;const{state:e,view:n}=t,{selection:o,tr:r}=e,{$from:i}=o;if(((s=i.node(-1))==null?void 0:s.type.name)===this.name){const l=i.start(-1)+1,c=i.end(-1)-1,u=ne.create(r.doc,l,c);return r.setSelection(u),n.dispatch(r),!0}return!1}}}}),PT={class:"o-scroll"},$T={class:"view-main"},FT={class:"block-container"},VT={class:"block-content"},zT={key:0,class:"edit-prompt"},HT={key:1},UT={"data-tippy-role":"tooltip"},qT={class:"label"},KT={class:"block-container"},WT={class:"block-content"},jT=a.defineComponent({__name:"view",props:ct,setup(t){const e=t,{md:n,aiOption:o,createStreamingChatCompletion:r}=Yc(),{languageName:i,tr:s}=ge(),{isFocused:l,bind:c,unbind:u,checkFocus:d}=Rm(),{theme:p}=xr(),{isEditable:f}=Te(),{getPos:h}=e,m=a.ref(null),g=a.ref(""),b=a.ref(!1),y=a.ref({}),k=a.ref(!1),E=a.ref(!1),v=a.ref(""),C=a.ref(null),_=a.ref(!1),R=a.ref(!1),B=a.computed(()=>({role:"system",content:Gc.writing.replace("[LANGUAGE]",i.value)})),N=a.ref([B.value]),M=a.computed(()=>!e.node.textContent),z=a.computed(()=>Em),G=a.computed({get(){return e.node.attrs.provider},set(X){e.updateAttributes({provider:X})}}),$=a.computed({get(){return e.node.attrs.prompt},set(X){e.updateAttributes({prompt:X})}}),U=a.computed({get(){return e.node.attrs.time},set(X){e.updateAttributes({time:X})}});function q(){g.value=$.value,M.value&&!$.value&&setTimeout(()=>{var X;(X=m.value)==null||X.focus()},0)}function ee(){setTimeout(()=>{},0)}function S(){v.value="edit",setTimeout(()=>{var X;(X=C.value)==null||X.focus()},0)}function O(){G.value=o.value.provider,$.value=g.value,U.value=Date.now(),_.value=!0,v.value&&(v.value=""),R.value?J():F()}async function F(){const X=h();let be="";N.value.push({role:"user",content:$.value}),N.value[0].role==="system"&&(N.value.shift(),N.value.unshift(B.value));try{const ke=await r(N.value,Ye=>{be+=Ye,N.value=[...N.value.slice(0,-1),{role:"assistant",content:be}];const tt=lc(n.render(be));Q(X,tt)})}catch(ke){N.value.pop(),console.error(ke),tu.error(s("ai.error"))}_.value=!1}async function J(){const X=h();let be="";try{for(const ke of Um){await new Promise(tt=>setTimeout(tt,500)),be+=ke;const Ye=lc(n.render(be));Q(X,Ye)}}catch(ke){console.error(ke)}_.value=!1}function Q(X,be){var Ye;const ke=e.node.toJSON();ke.content=be.content,(Ye=e.editor)==null||Ye.commands.updateAiBlock(X,ke),e.editor.commands.setNodeSelection(X),e.editor.view.focus(),ce()}function ce(){const be=e.node.content.lastChild;if(be&&be.attrs["data-id"]){const ke=be.attrs["data-id"],Ye=document.querySelector(`[data-id="${ke}"]`);Ye&&Ye.scrollIntoView({behavior:"smooth",block:"center"})}}function Ce(X){b.value=!1,X.value}function ot(X,be){be?g.value=s(be.label):g.value=s(X.label),k.value=!1}function Re(X){b.value=!0,y.value=X}return a.watch(()=>e.node.content,X=>{d()}),a.watch(M,X=>{X&&(E.value=!1)}),a.watch(l,X=>{X&&!M.value&&setTimeout(()=>{g.value=$.value,v.value="",E.value=X},100)}),a.onMounted(()=>{q(),c(e)}),a.onBeforeUnmount(()=>{u()}),(X,be)=>(a.openBlock(),a.createBlock(a.unref(kn),a.mergeProps(e,{class:["o-ai-block-view",{"is-empty":M.value,"has-focus":a.unref(l)}],onContextmenu:a.withModifiers(Re,["prevent"])}),{default:a.withCtx(()=>[M.value?(a.openBlock(),a.createBlock(a.unref(Zn),{key:0,modelValue:k.value,"onUpdate:modelValue":be[1]||(be[1]=ke=>k.value=ke),placement:"bottom-start","tippy-class":"ai-block-popover",offset:[0,14]},{"popover-content":a.withCtx(()=>[a.createElementVNode("section",PT,[a.createElementVNode("section",$T,[a.createVNode(a.unref(Ea),{items:z.value,onSelect:ot,"use-keyboard":k.value},null,8,["items","use-keyboard"])])])]),default:a.withCtx(()=>[a.createElementVNode("div",FT,[a.createElementVNode("div",VT,[a.createVNode(a.unref(Ln),{ref_key:"inputRef",ref:m,modelValue:g.value,"onUpdate:modelValue":be[0]||(be[0]=ke=>g.value=ke),placeholder:a.unref(s)("ai.tellAi"),type:"text",autofocus:"",clearable:"",onFocus:ee},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{name:"auto_awesome"})]),suffix:a.withCtx(()=>[a.createVNode(a.unref(yn),{icon:"arrow_back","icon-class":"rotate-90",tooltip:a.unref(s)("label.generate"),loading:_.value,onClick:O},null,8,["tooltip","loading"])]),_:1},8,["modelValue","placeholder"])])])]),_:1},8,["modelValue"])):a.createCommentVNode("",!0),a.withDirectives(a.createVNode(a.unref(Zn),{modelValue:E.value,"onUpdate:modelValue":be[4]||(be[4]=ke=>E.value=ke),placement:"top-end","tippy-class":"ai-block-update-popover",offset:[0,18]},{"popover-content":a.withCtx(()=>[v.value==="edit"?(a.openBlock(),a.createElementBlock("section",zT,[a.createVNode(a.unref(Ln),{ref_key:"updateInputRef",ref:C,modelValue:g.value,"onUpdate:modelValue":be[2]||(be[2]=ke=>g.value=ke),placeholder:a.unref(s)("ai.tellAi"),type:"text",autofocus:"",clearable:""},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{name:"auto_awesome"})]),suffix:a.withCtx(()=>[a.createVNode(a.unref(yn),{icon:"arrow_back","icon-class":"rotate-90",tooltip:a.unref(s)("label.generate"),loading:_.value,onClick:O},null,8,["tooltip","loading"])]),_:1},8,["modelValue","placeholder"])])):(a.openBlock(),a.createElementBlock("section",HT,[a.createVNode(a.unref(Hm),null,{default:a.withCtx(()=>[a.createElementVNode("div",UT,[a.createVNode(a.unref(St),{icon:"auto_awesome",onClick:S},{default:a.withCtx(()=>[a.createElementVNode("span",qT,a.toDisplayString(a.unref(s)("label.generatedBy"))+" "+a.toDisplayString(a.unref(jc)(G.value,"name")||"AI"),1)]),_:1})]),a.createVNode(a.unref(yn),{icon:"autorenew",tooltip:a.unref(s)("label.update"),loading:_.value,onClick:O},null,8,["tooltip","loading"])]),_:1})]))]),default:a.withCtx(()=>[a.createElementVNode("div",KT,[a.createElementVNode("div",WT,[a.createVNode(a.unref(Pn))]),a.unref(f)?(a.openBlock(),a.createBlock(a.unref(xi),{key:0,modelValue:b.value,"onUpdate:modelValue":be[3]||(be[3]=ke=>b.value=ke),event:y.value},{default:a.withCtx(()=>[a.createVNode(a.unref(So),a.mergeProps(e,{onAction:Ce}),null,16)]),_:1},8,["modelValue","event"])):a.createCommentVNode("",!0)])]),_:1},8,["modelValue"]),[[a.vShow,!M.value]])]),_:1},16,["class"]))}}),Ng=LT.extend({addNodeView(){return pn(jT)}}),GT=a.defineComponent({__name:"view",props:ct,setup(t){const e=t;return(n,o)=>(a.openBlock(),a.createBlock(a.unref(kn),a.mergeProps(e,{class:"o-blockquote-view"}),{default:a.withCtx(()=>[a.createElementVNode("blockquote",null,[a.createVNode(a.unref(Pn))])]),_:1},16))}}),Tg=um.extend({draggable:!0,addNodeView(){return pn(GT)}});/**
149
179
  * Copyright 2025 Yiitap
150
180
  * @license MIT
151
- **/const FO=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,VO=Ue.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",Ce(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[ga({find:FO,type:this.type,getAttributes:t=>{const[,,e,n,o]=t;return{src:n,alt:e,title:o}}})]}}),zO=VO.extend({draggable:!0,addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),size:{default:"",rendered:!1},ratio:{default:"",rendered:!1},isDraggable:{default:!0,renderHTML:e=>({})}}},renderHTML({node:t,HTMLAttributes:e}){return e.size=t.attrs.size,e.ratio=t.attrs.ratio,["img",Ce(this.options.HTMLAttributes,e)]}}),HO={key:1,class:"image-container"},UO={key:1},qO=l.defineComponent({__name:"view",props:ut,setup(t){const e=t,{isEditable:n}=we(),o=l.ref(!1),r=l.ref(!1),i=l.ref({}),s=l.ref(null),a=l.ref(!1),c=l.computed(()=>e.node.attrs),d=l.computed({get(){return e.node.attrs.src},set(y){e.updateAttributes({src:y})}}),u=l.computed({get(){return e.node.attrs.title},set(y){e.updateAttributes({title:y})}});function p(){a.value=!0,setTimeout(()=>{var y;(y=s.value)==null||y.focus()},0)}function f(){a.value=!1}function h(){d.value==="init"&&b(!0)}function m(y){switch(o.value=!1,y.value){case"replace":b(!0);break}}function g(y){d.value=y,b(!1)}function b(y){r.value=y}return l.onMounted(()=>{b(d.value==="init")}),(y,k)=>{var w;return l.openBlock(),l.createBlock(l.unref(Dn),l.mergeProps(e,{class:["o-image-view",{"with-caption":c.value.alt,"with-ratio":c.value.ratio,readonly:!((w=y.editor)!=null&&w.isEditable),init:d.value==="init"}],size:c.value.size,as:"div",onClick:h}),{default:l.withCtx(()=>[l.createVNode(l.unref(yr),{modelValue:r.value,"onUpdate:modelValue":k[1]||(k[1]=v=>r.value=v),placement:d.value==="init"?"bottom":"top","show-arrow":""},{"popover-content":l.withCtx(()=>[l.createVNode(l.unref(qc),{val:d.value==="init"?"":d.value,type:"image",onInput:g},null,8,["val"])]),default:l.withCtx(()=>{var v;return[d.value==="init"?(l.openBlock(),l.createBlock(l.unref(Vc),{key:0,icon:"image",placeholder:"Add an image"})):(l.openBlock(),l.createElementBlock("div",HO,[l.unref(n)?(l.openBlock(),l.createBlock(l.unref(zc),l.mergeProps({key:0},e,{onAction:m}),{default:l.withCtx(()=>[l.createVNode(l.unref(Re),{icon:"subtitles",tooltip:"image.caption",onClick:p})]),_:1},16)):l.createCommentVNode("",!0),l.createElementVNode("img",l.mergeProps(c.value,{draggable:"true","data-drag-handle":""}),null,16),l.createElementVNode("div",{class:"caption",onClick:p},[(v=y.editor)!=null&&v.isEditable&&a.value?(l.openBlock(),l.createBlock(l.unref(Ko),{key:0,ref_key:"captionInput",ref:s,class:"caption-input",modelValue:u.value,"onUpdate:modelValue":k[0]||(k[0]=_=>u.value=_),type:"text",placeholder:"Input caption",autosize:"",onBlur:f},null,8,["modelValue"])):(l.openBlock(),l.createElementBlock("span",UO,l.toDisplayString(u.value),1))])]))]}),_:1},8,["modelValue","placement"]),l.createVNode(l.unref(va),{modelValue:o.value,"onUpdate:modelValue":k[2]||(k[2]=v=>o.value=v),event:i.value},{default:l.withCtx(()=>[l.createVNode(l.unref(Wo),l.mergeProps(e,{onAction:m}),null,16)]),_:1},8,["modelValue","event"])]),_:1},16,["class","size"])}}}),Ng=zO.extend({addNodeView(){return yn(qO)}}).configure({inline:!0}),WO="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",KO="ελ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",kr=(t,e)=>{for(const n in e)t[n]=e[n];return t},Yl="numeric",Jl="ascii",Xl="alpha",Ur="asciinumeric",Br="alphanumeric",Zl="domain",Tg="emoji",jO="scheme",GO="slashscheme",cl="whitespace";function YO(t,e){return t in e||(e[t]=[]),e[t]}function Oo(t,e,n){e[Yl]&&(e[Ur]=!0,e[Br]=!0),e[Jl]&&(e[Ur]=!0,e[Xl]=!0),e[Ur]&&(e[Br]=!0),e[Xl]&&(e[Br]=!0),e[Br]&&(e[Zl]=!0),e[Tg]&&(e[Zl]=!0);for(const o in e){const r=YO(o,n);r.indexOf(t)<0&&r.push(t)}}function JO(t,e){const n={};for(const o in e)e[o].indexOf(t)>=0&&(n[o]=!0);return n}function Lt(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Lt.groups={};Lt.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let o=0;o<e.jr.length;o++){const r=e.jr[o][0],i=e.jr[o][1];if(i&&r.test(t))return i}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,o){for(let r=0;r<t.length;r++)this.tt(t[r],e,n,o)},tr(t,e,n,o){o=o||Lt.groups;let r;return e&&e.j?r=e:(r=new Lt(e),n&&o&&Oo(e,n,o)),this.jr.push([t,r]),r},ts(t,e,n,o){let r=this;const i=t.length;if(!i)return r;for(let s=0;s<i-1;s++)r=r.tt(t[s]);return r.tt(t[i-1],e,n,o)},tt(t,e,n,o){o=o||Lt.groups;const r=this;if(e&&e.j)return r.j[t]=e,e;const i=e;let s,a=r.go(t);if(a?(s=new Lt,kr(s.j,a.j),s.jr.push.apply(s.jr,a.jr),s.jd=a.jd,s.t=a.t):s=new Lt,i){if(o)if(s.t&&typeof s.t=="string"){const c=kr(JO(s.t,o),n);Oo(i,c,o)}else n&&Oo(i,n,o);s.t=i}return r.j[t]=s,s}};const he=(t,e,n,o,r)=>t.ta(e,n,o,r),Ke=(t,e,n,o,r)=>t.tr(e,n,o,r),Dp=(t,e,n,o,r)=>t.ts(e,n,o,r),R=(t,e,n,o,r)=>t.tt(e,n,o,r),Vn="WORD",Ql="UWORD",Og="ASCIINUMERICAL",Mg="ALPHANUMERICAL",fi="LOCALHOST",ec="TLD",tc="UTLD",as="SCHEME",or="SLASH_SCHEME",nd="NUM",nc="WS",od="NL",qr="OPENBRACE",Wr="CLOSEBRACE",Ms="OPENBRACKET",As="CLOSEBRACKET",Rs="OPENPAREN",Ds="CLOSEPAREN",Is="OPENANGLEBRACKET",Bs="CLOSEANGLEBRACKET",Ls="FULLWIDTHLEFTPAREN",Ps="FULLWIDTHRIGHTPAREN",$s="LEFTCORNERBRACKET",Fs="RIGHTCORNERBRACKET",Vs="LEFTWHITECORNERBRACKET",zs="RIGHTWHITECORNERBRACKET",Hs="FULLWIDTHLESSTHAN",Us="FULLWIDTHGREATERTHAN",qs="AMPERSAND",rd="APOSTROPHE",Ws="ASTERISK",oo="AT",Ks="BACKSLASH",js="BACKTICK",Gs="CARET",so="COLON",id="COMMA",Ys="DOLLAR",Sn="DOT",Js="EQUALS",sd="EXCLAMATION",en="HYPHEN",Kr="PERCENT",Xs="PIPE",Zs="PLUS",Qs="POUND",jr="QUERY",ad="QUOTE",Ag="FULLWIDTHMIDDLEDOT",ld="SEMI",xn="SLASH",Gr="TILDE",ea="UNDERSCORE",Rg="EMOJI",ta="SYM";var Dg=Object.freeze({__proto__:null,WORD:Vn,UWORD:Ql,ASCIINUMERICAL:Og,ALPHANUMERICAL:Mg,LOCALHOST:fi,TLD:ec,UTLD:tc,SCHEME:as,SLASH_SCHEME:or,NUM:nd,WS:nc,NL:od,OPENBRACE:qr,CLOSEBRACE:Wr,OPENBRACKET:Ms,CLOSEBRACKET:As,OPENPAREN:Rs,CLOSEPAREN:Ds,OPENANGLEBRACKET:Is,CLOSEANGLEBRACKET:Bs,FULLWIDTHLEFTPAREN:Ls,FULLWIDTHRIGHTPAREN:Ps,LEFTCORNERBRACKET:$s,RIGHTCORNERBRACKET:Fs,LEFTWHITECORNERBRACKET:Vs,RIGHTWHITECORNERBRACKET:zs,FULLWIDTHLESSTHAN:Hs,FULLWIDTHGREATERTHAN:Us,AMPERSAND:qs,APOSTROPHE:rd,ASTERISK:Ws,AT:oo,BACKSLASH:Ks,BACKTICK:js,CARET:Gs,COLON:so,COMMA:id,DOLLAR:Ys,DOT:Sn,EQUALS:Js,EXCLAMATION:sd,HYPHEN:en,PERCENT:Kr,PIPE:Xs,PLUS:Zs,POUND:Qs,QUERY:jr,QUOTE:ad,FULLWIDTHMIDDLEDOT:Ag,SEMI:ld,SLASH:xn,TILDE:Gr,UNDERSCORE:ea,EMOJI:Rg,SYM:ta});const Pn=/[a-z]/,Ar=new RegExp("\\p{L}","u"),dl=new RegExp("\\p{Emoji}","u"),$n=/\d/,ul=/\s/,Ip="\r",pl=`
152
- `,XO="️",ZO="‍",fl="";let Gi=null,Yi=null;function QO(t=[]){const e={};Lt.groups=e;const n=new Lt;Gi==null&&(Gi=Bp(WO)),Yi==null&&(Yi=Bp(KO)),R(n,"'",rd),R(n,"{",qr),R(n,"}",Wr),R(n,"[",Ms),R(n,"]",As),R(n,"(",Rs),R(n,")",Ds),R(n,"<",Is),R(n,">",Bs),R(n,"(",Ls),R(n,")",Ps),R(n,"「",$s),R(n,"」",Fs),R(n,"『",Vs),R(n,"』",zs),R(n,"<",Hs),R(n,">",Us),R(n,"&",qs),R(n,"*",Ws),R(n,"@",oo),R(n,"`",js),R(n,"^",Gs),R(n,":",so),R(n,",",id),R(n,"$",Ys),R(n,".",Sn),R(n,"=",Js),R(n,"!",sd),R(n,"-",en),R(n,"%",Kr),R(n,"|",Xs),R(n,"+",Zs),R(n,"#",Qs),R(n,"?",jr),R(n,'"',ad),R(n,"/",xn),R(n,";",ld),R(n,"~",Gr),R(n,"_",ea),R(n,"\\",Ks),R(n,"・",Ag);const o=Ke(n,$n,nd,{[Yl]:!0});Ke(o,$n,o);const r=Ke(o,Pn,Og,{[Ur]:!0}),i=Ke(o,Ar,Mg,{[Br]:!0}),s=Ke(n,Pn,Vn,{[Jl]:!0});Ke(s,$n,r),Ke(s,Pn,s),Ke(r,$n,r),Ke(r,Pn,r);const a=Ke(n,Ar,Ql,{[Xl]:!0});Ke(a,Pn),Ke(a,$n,i),Ke(a,Ar,a),Ke(i,$n,i),Ke(i,Pn),Ke(i,Ar,i);const c=R(n,pl,od,{[cl]:!0}),d=R(n,Ip,nc,{[cl]:!0}),u=Ke(n,ul,nc,{[cl]:!0});R(n,fl,u),R(d,pl,c),R(d,fl,u),Ke(d,ul,u),R(u,Ip),R(u,pl),Ke(u,ul,u),R(u,fl,u);const p=Ke(n,dl,Rg,{[Tg]:!0});R(p,"#"),Ke(p,dl,p),R(p,XO,p);const f=R(p,ZO);R(f,"#"),Ke(f,dl,p);const h=[[Pn,s],[$n,r]],m=[[Pn,null],[Ar,a],[$n,i]];for(let g=0;g<Gi.length;g++)Qn(n,Gi[g],ec,Vn,h);for(let g=0;g<Yi.length;g++)Qn(n,Yi[g],tc,Ql,m);Oo(ec,{tld:!0,ascii:!0},e),Oo(tc,{utld:!0,alpha:!0},e),Qn(n,"file",as,Vn,h),Qn(n,"mailto",as,Vn,h),Qn(n,"http",or,Vn,h),Qn(n,"https",or,Vn,h),Qn(n,"ftp",or,Vn,h),Qn(n,"ftps",or,Vn,h),Oo(as,{scheme:!0,ascii:!0},e),Oo(or,{slashscheme:!0,ascii:!0},e),t=t.sort((g,b)=>g[0]>b[0]?1:-1);for(let g=0;g<t.length;g++){const b=t[g][0],k=t[g][1]?{[jO]:!0}:{[GO]:!0};b.indexOf("-")>=0?k[Zl]=!0:Pn.test(b)?$n.test(b)?k[Ur]=!0:k[Jl]=!0:k[Yl]=!0,Dp(n,b,b,k)}return Dp(n,"localhost",fi,{ascii:!0}),n.jd=new Lt(ta),{start:n,tokens:kr({groups:e},Dg)}}function Ig(t,e){const n=eM(e.replace(/[A-Z]/g,a=>a.toLowerCase())),o=n.length,r=[];let i=0,s=0;for(;s<o;){let a=t,c=null,d=0,u=null,p=-1,f=-1;for(;s<o&&(c=a.go(n[s]));)a=c,a.accepts()?(p=0,f=0,u=a):p>=0&&(p+=n[s].length,f++),d+=n[s].length,i+=n[s].length,s++;i-=p,s-=f,d-=p,r.push({t:u.t,v:e.slice(i-d,i),s:i-d,e:i})}return r}function eM(t){const e=[],n=t.length;let o=0;for(;o<n;){let r=t.charCodeAt(o),i,s=r<55296||r>56319||o+1===n||(i=t.charCodeAt(o+1))<56320||i>57343?t[o]:t.slice(o,o+2);e.push(s),o+=s.length}return e}function Qn(t,e,n,o,r){let i;const s=e.length;for(let a=0;a<s-1;a++){const c=e[a];t.j[c]?i=t.j[c]:(i=new Lt(o),i.jr=r.slice(),t.j[c]=i),t=i}return i=new Lt(n),i.jr=r.slice(),t.j[e[s-1]]=i,i}function Bp(t){const e=[],n=[];let o=0,r="0123456789";for(;o<t.length;){let i=0;for(;r.indexOf(t[o+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let s=parseInt(t.substring(o,o+i),10);s>0;s--)n.pop();o+=i}else n.push(t[o]),o++}return e}const hi={defaultProtocol:"http",events:null,format:Lp,formatHref:Lp,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function cd(t,e=null){let n=kr({},hi);t&&(n=kr(n,t instanceof cd?t.o:t));const o=n.ignoreTags,r=[];for(let i=0;i<o.length;i++)r.push(o[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=r}cd.prototype={o:hi,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const o=e!=null;let r=this.o[t];return r&&(typeof r=="object"?(r=n.t in r?r[n.t]:hi[t],typeof r=="function"&&o&&(r=r(e,n))):typeof r=="function"&&o&&(r=r(e,n.t,n)),r)},getObj(t,e,n){let o=this.o[t];return typeof o=="function"&&e!=null&&(o=o(e,n.t,n)),o},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function Lp(t){return t}function Bg(t,e){this.t="token",this.v=t,this.tk=e}Bg.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),o=t.get("format",e,this);return n&&o.length>n?o.substring(0,n)+"…":o},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=hi.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")),o=t.get("formatHref",n,this),r=t.get("tagName",n,e),i=this.toFormattedString(t),s={},a=t.get("className",n,e),c=t.get("target",n,e),d=t.get("rel",n,e),u=t.getObj("attributes",n,e),p=t.getObj("events",n,e);return s.href=o,a&&(s.class=a),c&&(s.target=c),d&&(s.rel=d),u&&kr(s,u),{tagName:r,attributes:s,content:i,eventListeners:p}}};function Sa(t,e){class n extends Bg{constructor(r,i){super(r,i),this.t=t}}for(const o in e)n.prototype[o]=e[o];return n.t=t,n}const Pp=Sa("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),$p=Sa("text"),tM=Sa("nl"),Ji=Sa("url",{isLink:!0,toHref(t=hi.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==fi&&t[1].t===so}}),Qt=t=>new Lt(t);function nM({groups:t}){const e=t.domain.concat([qs,Ws,oo,Ks,js,Gs,Ys,Js,en,nd,Kr,Xs,Zs,Qs,xn,ta,Gr,ea]),n=[so,id,Sn,sd,Kr,jr,ad,ld,Is,Bs,qr,Wr,As,Ms,Rs,Ds,Ls,Ps,$s,Fs,Vs,zs,Hs,Us],o=[qs,rd,Ws,Ks,js,Gs,Ys,Js,en,qr,Wr,Kr,Xs,Zs,Qs,jr,xn,ta,Gr,ea],r=Qt(),i=R(r,Gr);he(i,o,i),he(i,t.domain,i);const s=Qt(),a=Qt(),c=Qt();he(r,t.domain,s),he(r,t.scheme,a),he(r,t.slashscheme,c),he(s,o,i),he(s,t.domain,s);const d=R(s,oo);R(i,oo,d),R(a,oo,d),R(c,oo,d);const u=R(i,Sn);he(u,o,i),he(u,t.domain,i);const p=Qt();he(d,t.domain,p),he(p,t.domain,p);const f=R(p,Sn);he(f,t.domain,p);const h=Qt(Pp);he(f,t.tld,h),he(f,t.utld,h),R(d,fi,h);const m=R(p,en);R(m,en,m),he(m,t.domain,p),he(h,t.domain,p),R(h,Sn,f),R(h,en,m);const g=R(h,so);he(g,t.numeric,Pp);const b=R(s,en),y=R(s,Sn);R(b,en,b),he(b,t.domain,s),he(y,o,i),he(y,t.domain,s);const k=Qt(Ji);he(y,t.tld,k),he(y,t.utld,k),he(k,t.domain,s),he(k,o,i),R(k,Sn,y),R(k,en,b),R(k,oo,d);const w=R(k,so),v=Qt(Ji);he(w,t.numeric,v);const _=Qt(Ji),C=Qt();he(_,e,_),he(_,n,C),he(C,e,_),he(C,n,C),R(k,xn,_),R(v,xn,_);const A=R(a,so),L=R(c,so),M=R(L,xn),P=R(M,xn);he(a,t.domain,s),R(a,Sn,y),R(a,en,b),he(c,t.domain,s),R(c,Sn,y),R(c,en,b),he(A,t.domain,_),R(A,xn,_),R(A,jr,_),he(P,t.domain,_),he(P,e,_),R(P,xn,_);const K=[[qr,Wr],[Ms,As],[Rs,Ds],[Is,Bs],[Ls,Ps],[$s,Fs],[Vs,zs],[Hs,Us]];for(let te=0;te<K.length;te++){const[de,ce]=K[te],re=R(_,de);R(C,de,re),R(re,ce,_);const ie=Qt(Ji);he(re,e,ie);const x=Qt();he(re,n),he(ie,e,ie),he(ie,n,x),he(x,e,ie),he(x,n,x),R(ie,ce,_),R(x,ce,_)}return R(r,fi,k),R(r,od,tM),{start:r,tokens:Dg}}function oM(t,e,n){let o=n.length,r=0,i=[],s=[];for(;r<o;){let a=t,c=null,d=null,u=0,p=null,f=-1;for(;r<o&&!(c=a.go(n[r].t));)s.push(n[r++]);for(;r<o&&(d=c||a.go(n[r].t));)c=null,a=d,a.accepts()?(f=0,p=a):f>=0&&f++,r++,u++;if(f<0)r-=u,r<o&&(s.push(n[r]),r++);else{s.length>0&&(i.push(hl($p,e,s)),s=[]),r-=f,u-=f;const h=p.t,m=n.slice(r-u,r);i.push(hl(h,e,m))}}return s.length>0&&i.push(hl($p,e,s)),i}function hl(t,e,n){const o=n[0].s,r=n[n.length-1].e,i=e.slice(o,r);return new t(i,n)}const rM=typeof console<"u"&&console&&console.warn||(()=>{}),iM="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",We={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function sM(){return Lt.groups={},We.scanner=null,We.parser=null,We.tokenQueue=[],We.pluginQueue=[],We.customSchemes=[],We.initialized=!1,We}function Fp(t,e=!1){if(We.initialized&&rM(`linkifyjs: already initialized - will not register custom scheme "${t}" ${iM}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
153
- 1. Must only contain digits, lowercase ASCII letters or "-"
154
- 2. Cannot start or end with "-"
155
- 3. "-" cannot repeat`);We.customSchemes.push([t,e])}function aM(){We.scanner=QO(We.customSchemes);for(let t=0;t<We.tokenQueue.length;t++)We.tokenQueue[t][1]({scanner:We.scanner});We.parser=nM(We.scanner.tokens);for(let t=0;t<We.pluginQueue.length;t++)We.pluginQueue[t][1]({scanner:We.scanner,parser:We.parser});return We.initialized=!0,We}function dd(t){return We.initialized||aM(),oM(We.parser.start,t,Ig(We.scanner.start,t))}dd.scan=Ig;function Lg(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 o=new cd(n),r=dd(t),i=[];for(let s=0;s<r.length;s++){const a=r[s];a.isLink&&(!e||a.t===e)&&o.check(a)&&i.push(a.toFormattedObject(o))}return i}function lM(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function cM(t){return new Se({key:new xe("autolink"),appendTransaction:(e,n,o)=>{const r=e.some(d=>d.docChanged)&&!n.doc.eq(o.doc),i=e.some(d=>d.getMeta("preventAutolink"));if(!r||i)return;const{tr:s}=o,a=_E(n.doc,[...e]);if(ME(a).forEach(({newRange:d})=>{const u=xE(o.doc,d,h=>h.isTextblock);let p,f;if(u.length>1?(p=u[0],f=o.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ")):u.length&&o.doc.textBetween(d.from,d.to," "," ").endsWith(" ")&&(p=u[0],f=o.doc.textBetween(p.pos,d.to,void 0," ")),p&&f){const h=f.split(" ").filter(y=>y!=="");if(h.length<=0)return!1;const m=h[h.length-1],g=p.pos+f.lastIndexOf(m);if(!m)return!1;const b=dd(m).map(y=>y.toObject(t.defaultProtocol));if(!lM(b))return!1;b.filter(y=>y.isLink).map(y=>({...y,from:g+y.start+1,to:g+y.end+1})).filter(y=>o.schema.marks.code?!o.doc.rangeHasMark(y.from,y.to,o.schema.marks.code):!0).filter(y=>t.validate(y.value)).filter(y=>t.shouldAutoLink(y.value)).forEach(y=>{Nc(y.from,y.to,o.doc).some(k=>k.mark.type===t.type)||s.addMark(y.from,y.to,t.type.create({href:y.href}))})}}),!!s.steps.length)return s}})}function dM(t){return new Se({key:new xe("handleClickLink"),props:{handleClick:(e,n,o)=>{var r,i;if(o.button!==0||!e.editable)return!1;let s=o.target;const a=[];for(;s.nodeName!=="DIV";)a.push(s),s=s.parentNode;if(!a.find(f=>f.nodeName==="A"))return!1;const c=_h(e.state,t.type.name),d=o.target,u=(r=d==null?void 0:d.href)!==null&&r!==void 0?r:c.href,p=(i=d==null?void 0:d.target)!==null&&i!==void 0?i:c.target;return d&&u?(window.open(u,p),!0):!1}}})}function uM(t){return new Se({key:new xe("handlePasteLink"),props:{handlePaste:(e,n,o)=>{const{state:r}=e,{selection:i}=r,{empty:s}=i;if(s)return!1;let a="";o.content.forEach(d=>{a+=d.textContent});const c=Lg(a,{defaultProtocol:t.defaultProtocol}).find(d=>d.isLink&&d.value===a);return!a||!c?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}const pM=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function Co(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(o=>{const r=typeof o=="string"?o:o.scheme;r&&n.push(r)}),!t||t.replace(pM,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const Pg=sn.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"){Fp(t);return}Fp(t.scheme,t.optionalSlashes)})},onDestroy(){sM()},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)=>!!Co(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=>!!Co(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=>!!Co(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Ce(this.options.HTMLAttributes,t),0]:["a",Ce(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:o=>!!Co(o,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:o=>!!Co(o,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[bo({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:o}=this.options,r=Lg(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!Co(s,n),protocols:n,defaultProtocol:o}));r.length&&r.forEach(i=>e.push({text:i.value,data:{href:i.href},index:i.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(cM({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:o=>this.options.isAllowedUri(o,{defaultValidate:r=>!!Co(r,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(dM({type:this.type})),this.options.linkOnPaste&&t.push(uM({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});function fM(t){return new Se({key:new xe("handleClickSelectLink"),props:{handleClick:(e,n,o)=>{const{schema:r,doc:i,tr:s}=e.state,a=wr(i.resolve(n),r.marks.link);if(!a)return!1;const c=i.resolve(a.from),d=i.resolve(a.to),u=s.setSelection(new J(c,d));return e.dispatch(u),!0}}})}const $g=Pg.extend({addProseMirrorPlugins(){var t;return[...((t=this.parent)==null?void 0:t.call(this))||[],fM({type:this.type})]}}).configure({openOnClick:!1}),hM=l.defineComponent({__name:"view",props:ut,setup(t){const e=t;return(n,o)=>(l.openBlock(),l.createBlock(l.unref(Dn),l.mergeProps(e,{class:"o-paragraph-view"}),{default:l.withCtx(()=>[l.createVNode(l.unref(Gn),{as:"p",style:l.normalizeStyle(`text-align: ${n.node.attrs.textAlign}`)},null,8,["style"])]),_:1},16))}}),Fg=sm.extend({draggable:!1,addNodeView(){return yn(hM,{stopEvent:()=>!1})}}),Vg=Ue.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(o=>parseInt(o,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",Ce(this.options.HTMLAttributes,t),0]}}),mM={class:"add"},gM=l.defineComponent({__name:"view",props:ut,setup(t){const e=t,{tr:n}=ye(),{isEditable:o,run:r}=we(),i=l.ref(!1);function s(){i.value=!0}function a(){c("tableSelectRow",{pos:e.getPos()})}function c(d,u={}){d==="tableDeleteRow"&&(i.value=!1),setTimeout(()=>{r(e.editor,d,u)},0)}return(d,u)=>(l.openBlock(),l.createBlock(l.unref(Pc),l.mergeProps({class:"o-table-cell-view",as:"td"},d.node.attrs,{style:{background:d.node.attrs.background}}),{default:l.withCtx(()=>[l.unref(o)?(l.openBlock(),l.createBlock(l.unref(yr),{key:0,modelValue:i.value,"onUpdate:modelValue":u[2]||(u[2]=p=>i.value=p),placement:"left-start","tippy-class":"o-row-popover",offset:[-6,26],"hide-click-outside":""},{"popover-content":l.withCtx(()=>[l.createVNode(l.unref(ot),{icon:"select_all",placement:"left",tooltip:l.unref(n)("table.selectRow"),onClick:a},null,8,["tooltip"]),l.createVNode(l.unref(ot),{icon:"delete",placement:"left",tooltip:l.unref(n)("table.removeRow"),onClick:u[1]||(u[1]=p=>c("tableDeleteRow"))},null,8,["tooltip"])]),default:l.withCtx(()=>[l.createElementVNode("section",{class:l.normalizeClass(["row-handler",{active:i.value}]),onClick:s},[l.createElementVNode("div",mM,[u[3]||(u[3]=l.createElementVNode("div",{class:"indicator"},[l.createElementVNode("svg",{width:"3",height:"3",viewBox:"0 0 3 3",fill:"none"},[l.createElementVNode("circle",{cx:"1.5",cy:"1.5",r:"1.5",fill:"#BBBFC4"})])],-1)),l.createVNode(l.unref(_s),{icon:"add_circle",color:l.unref(Oe).blue,tooltip:l.unref(n)("table.addRow"),placement:"left",onClick:u[0]||(u[0]=l.withModifiers(p=>c("tableAddRow"),["stop"]))},null,8,["color","tooltip"])])],2)]),_:1},8,["modelValue"])):l.createCommentVNode("",!0),l.createVNode(l.unref(Gn))]),_:1},16,["style"]))}}),zg=Vg.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),background:{default:""}}},addNodeView(){return yn(gM,{stopEvent:()=>!1})}}),Hg=Ue.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(o=>parseInt(o,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",Ce(this.options.HTMLAttributes,t),0]}}),bM={class:"add"},yM={class:"add"},vM=l.defineComponent({__name:"view",props:ut,setup(t){const e=t,{tr:n}=ye(),{isEditable:o,run:r}=we(),i=l.ref(!1),s=l.ref(!1);function a(){setTimeout(()=>{i.value=!0},0)}function c(){s.value=!0}function d(){i.value=!1,p("tableSelectColumn",{pos:e.getPos()})}function u(){p("tableSelectRow",{pos:e.getPos()})}function p(f,h={}){f==="tableDeleteRow"?s.value=!1:f==="tableDeleteColumn"&&(i.value=!1),setTimeout(()=>{r(e.editor,f,h)},0)}return(f,h)=>(l.openBlock(),l.createBlock(l.unref(Pc),l.mergeProps({class:"o-table-header-view",as:"th"},f.node.attrs,{style:{background:f.node.attrs.background}}),{default:l.withCtx(()=>[l.unref(o)?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[l.createVNode(l.unref(yr),{modelValue:i.value,"onUpdate:modelValue":h[2]||(h[2]=m=>i.value=m),placement:"top","tippy-class":"o-column-popover",offset:[0,20],"hide-click-outside":""},{"popover-content":l.withCtx(()=>[l.createVNode(l.unref(ot),{icon:"select_all",tooltip:l.unref(n)("table.selectColumn"),onClick:d},null,8,["tooltip"]),l.createVNode(l.unref(ot),{icon:"delete",tooltip:l.unref(n)("table.removeColumn"),onClick:h[1]||(h[1]=m=>p("tableDeleteColumn"))},null,8,["tooltip"])]),default:l.withCtx(()=>[l.createElementVNode("section",{class:l.normalizeClass(["col-handler",{active:i.value}]),onClick:a},[l.createElementVNode("div",bM,[h[6]||(h[6]=l.createElementVNode("div",{class:"indicator"},[l.createElementVNode("svg",{width:"3",height:"3",viewBox:"0 0 3 3",fill:"none"},[l.createElementVNode("circle",{cx:"1.5",cy:"1.5",r:"1.5",fill:"#BBBFC4"})])],-1)),l.createVNode(l.unref(_s),{icon:"add_circle",color:l.unref(Oe).blue,tooltip:l.unref(n)("table.addColumn"),onClick:h[0]||(h[0]=l.withModifiers(m=>p("tableAddColumn"),["stop"]))},null,8,["color","tooltip"])])],2)]),_:1},8,["modelValue"]),l.createVNode(l.unref(yr),{modelValue:s.value,"onUpdate:modelValue":h[5]||(h[5]=m=>s.value=m),placement:"left-start","tippy-class":"o-row-popover",offset:[-6,26],"hide-click-outside":""},{"popover-content":l.withCtx(()=>[l.createVNode(l.unref(ot),{icon:"select_all",placement:"left",tooltip:l.unref(n)("table.selectRow"),onClick:u},null,8,["tooltip"]),l.createVNode(l.unref(ot),{icon:"delete",placement:"left",tooltip:l.unref(n)("table.removeRow"),onClick:h[4]||(h[4]=m=>p("tableDeleteRow"))},null,8,["tooltip"])]),default:l.withCtx(()=>[l.createElementVNode("section",{class:l.normalizeClass(["row-handler",{active:s.value}]),onClick:c},[l.createElementVNode("div",yM,[h[7]||(h[7]=l.createElementVNode("div",{class:"indicator"},[l.createElementVNode("svg",{width:"3",height:"3",viewBox:"0 0 3 3",fill:"none"},[l.createElementVNode("circle",{cx:"1.5",cy:"1.5",r:"1.5",fill:"#BBBFC4"})])],-1)),l.createVNode(l.unref(_s),{icon:"add_circle",color:l.unref(Oe).blue,tooltip:l.unref(n)("table.addRow"),placement:"left",onClick:h[3]||(h[3]=l.withModifiers(m=>p("tableAddRow"),["stop"]))},null,8,["color","tooltip"])])],2)]),_:1},8,["modelValue"])],64)):l.createCommentVNode("",!0),l.createVNode(l.unref(Gn))]),_:1},16,["style"]))}}),Ug=Hg.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),background:{default:""}}},addNodeView(){return yn(vM,{stopEvent:()=>!1})}});/**
181
+ **/const YT=ze.create({name:"callout",group:"block",content:"block+",draggable:!0,addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{icon:{default:"🌾"},borderColor:{default:"#dddddd"},borderColorDark:{default:"#333333"},backColor:{default:"#eeeeee"},backColorDark:{default:"rgba(101, 117, 133, 0.16)"}}},parseHTML(){return[{tag:'div[data-type="callout"]'}]},renderHTML({HTMLAttributes:t}){return["div",_e(t,{"data-type":"callout"}),0]},addCommands(){return{setCallout:()=>({commands:t})=>t.wrapIn(this.name),toggleCallout:()=>({commands:t})=>t.toggleWrap(this.name),unsetCallout:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-a":({editor:t})=>{var s;const{state:e,view:n}=t,{selection:o,tr:r}=e,{$from:i}=o;if(((s=i.node(-1))==null?void 0:s.type.name)===this.name){const l=i.start(-1)+1,c=i.end(-1)-1,u=ne.create(r.doc,l,c);return r.setSelection(u),n.dispatch(r),!0}return!1}}}}),JT={class:"callout-container"},XT={class:"callout-icon"},ZT={class:"callout-content"},QT=a.defineComponent({__name:"view",props:ct,setup(t){const e=t,{theme:n}=xr(),{isEditable:o}=Te(),r=a.ref(!1),i=a.ref(!1),s=a.ref({}),l=a.ref(null),c=a.computed(()=>{const{selection:v}=e.editor.view.state,C=v.from,_=e.getPos(),R=_+e.node.nodeSize;return C>=_&&C<=R}),u=a.computed({get(){return e.node.attrs.backColor},set(v){e.updateAttributes({backColor:v})}}),d=a.computed({get(){return e.node.attrs.backColorDark},set(v){e.updateAttributes({backColorDark:v})}}),p=a.computed({get(){return e.node.attrs.borderColor},set(v){e.updateAttributes({borderColor:v})}}),f=a.computed({get(){return e.node.attrs.borderColorDark},set(v){e.updateAttributes({borderColorDark:v})}}),h=a.computed(()=>n.value==="dark"?d.value:u.value),m=a.computed(()=>n.value==="dark"?f.value:p.value);function g(v){e.updateAttributes({icon:v})}function b(v){switch(r.value=!1,v.value){case"palette":k(!0);break}}function y(v){r.value=!0,s.value=v}function k(v){i.value=v}function E(v,C){var _;switch(v){case"backColor":u.value=C;break;case"foreColor":p.value=C;break;case"icon":g(C.emoji),(_=l.value)==null||_.setShow(!1);break}}return a.watch(c,v=>{k(v)}),(v,C)=>(a.openBlock(),a.createBlock(a.unref(kn),a.mergeProps(e,{class:"o-callout-view",style:`--callout-border-color: ${m.value}; --callout-back-color: ${h.value}`,onContextmenu:a.withModifiers(y,["prevent"])}),{default:a.withCtx(()=>[a.createElementVNode("div",JT,[a.createVNode(a.unref(Pe),{ref_key:"iconPopover",ref:l,placement:"bottom-start",trigger:"click",offset:[0,0],disable:!a.unref(o)},{trigger:a.withCtx(()=>[a.createElementVNode("div",XT,a.toDisplayString(v.node.attrs.icon),1)]),default:a.withCtx(()=>[a.createVNode(a.unref(Ca),{items:a.unref(ei.emojiGroups),onSelect:C[0]||(C[0]=_=>E("icon",_)),"enable-search":""},null,8,["items"])]),_:1},8,["disable"]),a.createElementVNode("div",ZT,[a.createVNode(a.unref(Pn))]),a.unref(o)?(a.openBlock(),a.createBlock(a.unref(xi),{key:0,modelValue:r.value,"onUpdate:modelValue":C[1]||(C[1]=_=>r.value=_),event:s.value},{default:a.withCtx(()=>[a.createVNode(a.unref(So),a.mergeProps(e,{onAction:b}),null,16)]),_:1},8,["modelValue","event"])):a.createCommentVNode("",!0)])]),_:1},16,["style"]))}}),Og=YT.extend({addNodeView(){return pn(QT)}});function e1(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Mg(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],o=typeof n;(o==="object"||o==="function")&&!Object.isFrozen(n)&&Mg(n)}),t}class Ip{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function Ag(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function mo(t,...e){const n=Object.create(null);for(const o in t)n[o]=t[o];return e.forEach(function(o){for(const r in o)n[r]=o[r]}),n}const t1="</span>",Lp=t=>!!t.scope,n1=(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((o,r)=>`${o}${"_".repeat(r+1)}`)].join(" ")}return`${e}${t}`};class o1{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=Ag(e)}openNode(e){if(!Lp(e))return;const n=n1(e.scope,{prefix:this.classPrefix});this.span(n)}closeNode(e){Lp(e)&&(this.buffer+=t1)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}}const Pp=(t={})=>{const e={children:[]};return Object.assign(e,t),e};class mu{constructor(){this.rootNode=Pp(),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=Pp({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(o=>this._walk(e,o)),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=>{mu._collapse(n)}))}}class r1 extends mu{constructor(e){super(),this.options=e}addText(e){e!==""&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,n){const o=e.root;n&&(o.scope=`language:${n}`),this.add(o)}toHTML(){return new o1(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function yi(t){return t?typeof t=="string"?t:t.source:null}function Rg(t){return Jo("(?=",t,")")}function i1(t){return Jo("(?:",t,")*")}function s1(t){return Jo("(?:",t,")?")}function Jo(...t){return t.map(n=>yi(n)).join("")}function a1(t){const e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function gu(...t){return"("+(a1(t).capture?"":"?:")+t.map(o=>yi(o)).join("|")+")"}function Bg(t){return new RegExp(t.toString()+"|").exec("").length-1}function l1(t,e){const n=t&&t.exec(e);return n&&n.index===0}const c1=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function bu(t,{joinWith:e}){let n=0;return t.map(o=>{n+=1;const r=n;let i=yi(o),s="";for(;i.length>0;){const l=c1.exec(i);if(!l){s+=i;break}s+=i.substring(0,l.index),i=i.substring(l.index+l[0].length),l[0][0]==="\\"&&l[1]?s+="\\"+String(Number(l[1])+r):(s+=l[0],l[0]==="("&&n++)}return s}).map(o=>`(${o})`).join(e)}const u1=/\b\B/,Dg="[a-zA-Z]\\w*",yu="[a-zA-Z_]\\w*",Ig="\\b\\d+(\\.\\d+)?",Lg="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Pg="\\b(0b[01]+)",d1="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",p1=(t={})=>{const e=/^#![ ]*\//;return t.binary&&(t.begin=Jo(e,/.*\b/,t.binary,/\b.*/)),mo({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(n,o)=>{n.index!==0&&o.ignoreMatch()}},t)},vi={begin:"\\\\[\\s\\S]",relevance:0},f1={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[vi]},h1={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[vi]},m1={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/},Ta=function(t,e,n={}){const o=mo({scope:"comment",begin:t,end:e,contains:[]},n);o.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 r=gu("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 o.contains.push({begin:Jo(/[ ]+/,"(",r,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),o},g1=Ta("//","$"),b1=Ta("/\\*","\\*/"),y1=Ta("#","$"),v1={scope:"number",begin:Ig,relevance:0},k1={scope:"number",begin:Lg,relevance:0},w1={scope:"number",begin:Pg,relevance:0},E1={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[vi,{begin:/\[/,end:/\]/,relevance:0,contains:[vi]}]},_1={scope:"title",begin:Dg,relevance:0},C1={scope:"title",begin:yu,relevance:0},S1={begin:"\\.\\s*"+yu,relevance:0},x1=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 Ji=Object.freeze({__proto__:null,APOS_STRING_MODE:f1,BACKSLASH_ESCAPE:vi,BINARY_NUMBER_MODE:w1,BINARY_NUMBER_RE:Pg,COMMENT:Ta,C_BLOCK_COMMENT_MODE:b1,C_LINE_COMMENT_MODE:g1,C_NUMBER_MODE:k1,C_NUMBER_RE:Lg,END_SAME_AS_BEGIN:x1,HASH_COMMENT_MODE:y1,IDENT_RE:Dg,MATCH_NOTHING_RE:u1,METHOD_GUARD:S1,NUMBER_MODE:v1,NUMBER_RE:Ig,PHRASAL_WORDS_MODE:m1,QUOTE_STRING_MODE:h1,REGEXP_MODE:E1,RE_STARTERS_RE:d1,SHEBANG:p1,TITLE_MODE:_1,UNDERSCORE_IDENT_RE:yu,UNDERSCORE_TITLE_MODE:C1});function N1(t,e){t.input[t.index-1]==="."&&e.ignoreMatch()}function T1(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className)}function O1(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=N1,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0))}function M1(t,e){Array.isArray(t.illegal)&&(t.illegal=gu(...t.illegal))}function A1(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 R1(t,e){t.relevance===void 0&&(t.relevance=1)}const B1=(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(o=>{delete t[o]}),t.keywords=n.keywords,t.begin=Jo(n.beforeMatch,Rg(n.begin)),t.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},t.relevance=0,delete n.beforeMatch},D1=["of","and","for","in","not","or","if","then","parent","list","value"],I1="keyword";function $g(t,e,n=I1){const o=Object.create(null);return typeof t=="string"?r(n,t.split(" ")):Array.isArray(t)?r(n,t):Object.keys(t).forEach(function(i){Object.assign(o,$g(t[i],e,i))}),o;function r(i,s){e&&(s=s.map(l=>l.toLowerCase())),s.forEach(function(l){const c=l.split("|");o[c[0]]=[i,L1(c[0],c[1])]})}}function L1(t,e){return e?Number(e):P1(t)?0:1}function P1(t){return D1.includes(t.toLowerCase())}const $p={},zo=t=>{console.error(t)},Fp=(t,...e)=>{console.log(`WARN: ${t}`,...e)},er=(t,e)=>{$p[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),$p[`${t}/${e}`]=!0)},ta=new Error;function Fg(t,e,{key:n}){let o=0;const r=t[n],i={},s={};for(let l=1;l<=e.length;l++)s[l+o]=r[l],i[l+o]=!0,o+=Bg(e[l-1]);t[n]=s,t[n]._emit=i,t[n]._multi=!0}function $1(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw zo("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),ta;if(typeof t.beginScope!="object"||t.beginScope===null)throw zo("beginScope must be object"),ta;Fg(t,t.begin,{key:"beginScope"}),t.begin=bu(t.begin,{joinWith:""})}}function F1(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw zo("skip, excludeEnd, returnEnd not compatible with endScope: {}"),ta;if(typeof t.endScope!="object"||t.endScope===null)throw zo("endScope must be object"),ta;Fg(t,t.end,{key:"endScope"}),t.end=bu(t.end,{joinWith:""})}}function V1(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope)}function z1(t){V1(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),$1(t),F1(t)}function H1(t){function e(s,l){return new RegExp(yi(s),"m"+(t.case_insensitive?"i":"")+(t.unicodeRegex?"u":"")+(l?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(l,c){c.position=this.position++,this.matchIndexes[this.matchAt]=c,this.regexes.push([c,l]),this.matchAt+=Bg(l)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const l=this.regexes.map(c=>c[1]);this.matcherRe=e(bu(l,{joinWith:"|"}),!0),this.lastIndex=0}exec(l){this.matcherRe.lastIndex=this.lastIndex;const c=this.matcherRe.exec(l);if(!c)return null;const u=c.findIndex((p,f)=>f>0&&p!==void 0),d=this.matchIndexes[u];return c.splice(0,u),Object.assign(c,d)}}class o{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(l){if(this.multiRegexes[l])return this.multiRegexes[l];const c=new n;return this.rules.slice(l).forEach(([u,d])=>c.addRule(u,d)),c.compile(),this.multiRegexes[l]=c,c}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(l,c){this.rules.push([l,c]),c.type==="begin"&&this.count++}exec(l){const c=this.getMatcher(this.regexIndex);c.lastIndex=this.lastIndex;let u=c.exec(l);if(this.resumingScanAtSamePosition()&&!(u&&u.index===this.lastIndex)){const d=this.getMatcher(0);d.lastIndex=this.lastIndex+1,u=d.exec(l)}return u&&(this.regexIndex+=u.position+1,this.regexIndex===this.count&&this.considerAll()),u}}function r(s){const l=new o;return s.contains.forEach(c=>l.addRule(c.begin,{rule:c,type:"begin"})),s.terminatorEnd&&l.addRule(s.terminatorEnd,{type:"end"}),s.illegal&&l.addRule(s.illegal,{type:"illegal"}),l}function i(s,l){const c=s;if(s.isCompiled)return c;[T1,A1,z1,B1].forEach(d=>d(s,l)),t.compilerExtensions.forEach(d=>d(s,l)),s.__beforeBegin=null,[O1,M1,R1].forEach(d=>d(s,l)),s.isCompiled=!0;let u=null;return typeof s.keywords=="object"&&s.keywords.$pattern&&(s.keywords=Object.assign({},s.keywords),u=s.keywords.$pattern,delete s.keywords.$pattern),u=u||/\w+/,s.keywords&&(s.keywords=$g(s.keywords,t.case_insensitive)),c.keywordPatternRe=e(u,!0),l&&(s.begin||(s.begin=/\B|\b/),c.beginRe=e(c.begin),!s.end&&!s.endsWithParent&&(s.end=/\B|\b/),s.end&&(c.endRe=e(c.end)),c.terminatorEnd=yi(c.end)||"",s.endsWithParent&&l.terminatorEnd&&(c.terminatorEnd+=(s.end?"|":"")+l.terminatorEnd)),s.illegal&&(c.illegalRe=e(s.illegal)),s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map(function(d){return U1(d==="self"?s:d)})),s.contains.forEach(function(d){i(d,c)}),s.starts&&i(s.starts,l),c.matcher=r(c),c}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=mo(t.classNameAliases||{}),i(t)}function Vg(t){return t?t.endsWithParent||Vg(t.starts):!1}function U1(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return mo(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:Vg(t)?mo(t,{starts:t.starts?mo(t.starts):null}):Object.isFrozen(t)?mo(t):t}var q1="11.10.0";class K1 extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}}const ml=Ag,Vp=mo,zp=Symbol("nomatch"),W1=7,zg=function(t){const e=Object.create(null),n=Object.create(null),o=[];let r=!0;const i="Could not find the language '{}', did you forget to load/include a language module?",s={disableAutodetect:!0,name:"Plain text",contains:[]};let l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:r1};function c(S){return l.noHighlightRe.test(S)}function u(S){let O=S.className+" ";O+=S.parentNode?S.parentNode.className:"";const F=l.languageDetectRe.exec(O);if(F){const J=N(F[1]);return J||(Fp(i.replace("{}",F[1])),Fp("Falling back to no-highlight mode for this block.",S)),J?F[1]:"no-highlight"}return O.split(/\s+/).find(J=>c(J)||N(J))}function d(S,O,F){let J="",Q="";typeof O=="object"?(J=S,F=O.ignoreIllegals,Q=O.language):(er("10.7.0","highlight(lang, code, ...args) has been deprecated."),er("10.7.0",`Please use highlight(code, options) instead.
182
+ https://github.com/highlightjs/highlight.js/issues/2277`),Q=S,J=O),F===void 0&&(F=!0);const ce={code:J,language:Q};q("before:highlight",ce);const Ce=ce.result?ce.result:p(ce.language,ce.code,F);return Ce.code=ce.code,q("after:highlight",Ce),Ce}function p(S,O,F,J){const Q=Object.create(null);function ce(L,K){return L.keywords[K]}function Ce(){if(!se.keywords){$e.addText(Oe);return}let L=0;se.keywordPatternRe.lastIndex=0;let K=se.keywordPatternRe.exec(Oe),fe="";for(;K;){fe+=Oe.substring(L,K.index);const Me=pe.case_insensitive?K[0].toLowerCase():K[0],rt=ce(se,Me);if(rt){const[Kt,Tr]=rt;if($e.addText(fe),fe="",Q[Me]=(Q[Me]||0)+1,Q[Me]<=W1&&(Ot+=Tr),Kt.startsWith("_"))fe+=K[0];else{const x=pe.classNameAliases[Kt]||Kt;X(K[0],x)}}else fe+=K[0];L=se.keywordPatternRe.lastIndex,K=se.keywordPatternRe.exec(Oe)}fe+=Oe.substring(L),$e.addText(fe)}function ot(){if(Oe==="")return;let L=null;if(typeof se.subLanguage=="string"){if(!e[se.subLanguage]){$e.addText(Oe);return}L=p(se.subLanguage,Oe,!0,Tt[se.subLanguage]),Tt[se.subLanguage]=L._top}else L=h(Oe,se.subLanguage.length?se.subLanguage:null);se.relevance>0&&(Ot+=L.relevance),$e.__addSublanguage(L._emitter,L.language)}function Re(){se.subLanguage!=null?ot():Ce(),Oe=""}function X(L,K){L!==""&&($e.startScope(K),$e.addText(L),$e.endScope())}function be(L,K){let fe=1;const Me=K.length-1;for(;fe<=Me;){if(!L._emit[fe]){fe++;continue}const rt=pe.classNameAliases[L[fe]]||L[fe],Kt=K[fe];rt?X(Kt,rt):(Oe=Kt,Ce(),Oe=""),fe++}}function ke(L,K){return L.scope&&typeof L.scope=="string"&&$e.openNode(pe.classNameAliases[L.scope]||L.scope),L.beginScope&&(L.beginScope._wrap?(X(Oe,pe.classNameAliases[L.beginScope._wrap]||L.beginScope._wrap),Oe=""):L.beginScope._multi&&(be(L.beginScope,K),Oe="")),se=Object.create(L,{parent:{value:se}}),se}function Ye(L,K,fe){let Me=l1(L.endRe,fe);if(Me){if(L["on:end"]){const rt=new Ip(L);L["on:end"](K,rt),rt.isMatchIgnored&&(Me=!1)}if(Me){for(;L.endsParent&&L.parent;)L=L.parent;return L}}if(L.endsWithParent)return Ye(L.parent,K,fe)}function tt(L){return se.matcher.regexIndex===0?(Oe+=L[0],1):(Mt=!0,0)}function en(L){const K=L[0],fe=L.rule,Me=new Ip(fe),rt=[fe.__beforeBegin,fe["on:begin"]];for(const Kt of rt)if(Kt&&(Kt(L,Me),Me.isMatchIgnored))return tt(K);return fe.skip?Oe+=K:(fe.excludeBegin&&(Oe+=K),Re(),!fe.returnBegin&&!fe.excludeBegin&&(Oe=K)),ke(fe,L),fe.returnBegin?0:K.length}function En(L){const K=L[0],fe=O.substring(L.index),Me=Ye(se,L,fe);if(!Me)return zp;const rt=se;se.endScope&&se.endScope._wrap?(Re(),X(K,se.endScope._wrap)):se.endScope&&se.endScope._multi?(Re(),be(se.endScope,L)):rt.skip?Oe+=K:(rt.returnEnd||rt.excludeEnd||(Oe+=K),Re(),rt.excludeEnd&&(Oe=K));do se.scope&&$e.closeNode(),!se.skip&&!se.subLanguage&&(Ot+=se.relevance),se=se.parent;while(se!==Me.parent);return Me.starts&&ke(Me.starts,L),rt.returnEnd?0:K.length}function fn(){const L=[];for(let K=se;K!==pe;K=K.parent)K.scope&&L.unshift(K.scope);L.forEach(K=>$e.openNode(K))}let qt={};function hn(L,K){const fe=K&&K[0];if(Oe+=L,fe==null)return Re(),0;if(qt.type==="begin"&&K.type==="end"&&qt.index===K.index&&fe===""){if(Oe+=O.slice(K.index,K.index+1),!r){const Me=new Error(`0 width match regex (${S})`);throw Me.languageName=S,Me.badRule=qt.rule,Me}return 1}if(qt=K,K.type==="begin")return en(K);if(K.type==="illegal"&&!F){const Me=new Error('Illegal lexeme "'+fe+'" for mode "'+(se.scope||"<unnamed>")+'"');throw Me.mode=se,Me}else if(K.type==="end"){const Me=En(K);if(Me!==zp)return Me}if(K.type==="illegal"&&fe==="")return 1;if(mn>1e5&&mn>K.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Oe+=fe,fe.length}const pe=N(S);if(!pe)throw zo(i.replace("{}",S)),new Error('Unknown language: "'+S+'"');const Pt=H1(pe);let wt="",se=J||Pt;const Tt={},$e=new l.__emitter(l);fn();let Oe="",Ot=0,nt=0,mn=0,Mt=!1;try{if(pe.__emitTokens)pe.__emitTokens(O,$e);else{for(se.matcher.considerAll();;){mn++,Mt?Mt=!1:se.matcher.considerAll(),se.matcher.lastIndex=nt;const L=se.matcher.exec(O);if(!L)break;const K=O.substring(nt,L.index),fe=hn(K,L);nt=L.index+fe}hn(O.substring(nt))}return $e.finalize(),wt=$e.toHTML(),{language:S,value:wt,relevance:Ot,illegal:!1,_emitter:$e,_top:se}}catch(L){if(L.message&&L.message.includes("Illegal"))return{language:S,value:ml(O),illegal:!0,relevance:0,_illegalBy:{message:L.message,index:nt,context:O.slice(nt-100,nt+100),mode:L.mode,resultSoFar:wt},_emitter:$e};if(r)return{language:S,value:ml(O),illegal:!1,relevance:0,errorRaised:L,_emitter:$e,_top:se};throw L}}function f(S){const O={value:ml(S),illegal:!1,relevance:0,_top:s,_emitter:new l.__emitter(l)};return O._emitter.addText(S),O}function h(S,O){O=O||l.languages||Object.keys(e);const F=f(S),J=O.filter(N).filter(z).map(Re=>p(Re,S,!1));J.unshift(F);const Q=J.sort((Re,X)=>{if(Re.relevance!==X.relevance)return X.relevance-Re.relevance;if(Re.language&&X.language){if(N(Re.language).supersetOf===X.language)return 1;if(N(X.language).supersetOf===Re.language)return-1}return 0}),[ce,Ce]=Q,ot=ce;return ot.secondBest=Ce,ot}function m(S,O,F){const J=O&&n[O]||F;S.classList.add("hljs"),S.classList.add(`language-${J}`)}function g(S){let O=null;const F=u(S);if(c(F))return;if(q("before:highlightElement",{el:S,language:F}),S.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",S);return}if(S.children.length>0&&(l.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(S)),l.throwUnescapedHTML))throw new K1("One of your code blocks includes unescaped HTML.",S.innerHTML);O=S;const J=O.textContent,Q=F?d(J,{language:F,ignoreIllegals:!0}):h(J);S.innerHTML=Q.value,S.dataset.highlighted="yes",m(S,F,Q.language),S.result={language:Q.language,re:Q.relevance,relevance:Q.relevance},Q.secondBest&&(S.secondBest={language:Q.secondBest.language,relevance:Q.secondBest.relevance}),q("after:highlightElement",{el:S,result:Q,text:J})}function b(S){l=Vp(l,S)}const y=()=>{v(),er("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function k(){v(),er("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let E=!1;function v(){if(document.readyState==="loading"){E=!0;return}document.querySelectorAll(l.cssSelector).forEach(g)}function C(){E&&v()}typeof window<"u"&&window.addEventListener&&window.addEventListener("DOMContentLoaded",C,!1);function _(S,O){let F=null;try{F=O(t)}catch(J){if(zo("Language definition for '{}' could not be registered.".replace("{}",S)),r)zo(J);else throw J;F=s}F.name||(F.name=S),e[S]=F,F.rawDefinition=O.bind(null,t),F.aliases&&M(F.aliases,{languageName:S})}function R(S){delete e[S];for(const O of Object.keys(n))n[O]===S&&delete n[O]}function B(){return Object.keys(e)}function N(S){return S=(S||"").toLowerCase(),e[S]||e[n[S]]}function M(S,{languageName:O}){typeof S=="string"&&(S=[S]),S.forEach(F=>{n[F.toLowerCase()]=O})}function z(S){const O=N(S);return O&&!O.disableAutodetect}function G(S){S["before:highlightBlock"]&&!S["before:highlightElement"]&&(S["before:highlightElement"]=O=>{S["before:highlightBlock"](Object.assign({block:O.el},O))}),S["after:highlightBlock"]&&!S["after:highlightElement"]&&(S["after:highlightElement"]=O=>{S["after:highlightBlock"](Object.assign({block:O.el},O))})}function $(S){G(S),o.push(S)}function U(S){const O=o.indexOf(S);O!==-1&&o.splice(O,1)}function q(S,O){const F=S;o.forEach(function(J){J[F]&&J[F](O)})}function ee(S){return er("10.7.0","highlightBlock will be removed entirely in v12.0"),er("10.7.0","Please use highlightElement now."),g(S)}Object.assign(t,{highlight:d,highlightAuto:h,highlightAll:v,highlightElement:g,highlightBlock:ee,configure:b,initHighlighting:y,initHighlightingOnLoad:k,registerLanguage:_,unregisterLanguage:R,listLanguages:B,getLanguage:N,registerAliases:M,autoDetection:z,inherit:Vp,addPlugin:$,removePlugin:U}),t.debugMode=function(){r=!1},t.safeMode=function(){r=!0},t.versionString=q1,t.regex={concat:Jo,lookahead:Rg,either:gu,optional:s1,anyNumberOfTimes:i1};for(const S in Ji)typeof Ji[S]=="object"&&Mg(Ji[S]);return Object.assign(t,Ji),t},Er=zg({});Er.newInstance=()=>zg({});var j1=Er;Er.HighlightJS=Er;Er.default=Er;var G1=e1(j1);function Hg(t,e=[]){return t.map(n=>{const o=[...e,...n.properties?n.properties.className:[]];return n.children?Hg(n.children,o):{text:n.value,classes:o}}).flat()}function Hp(t){return t.value||t.children||[]}function Y1(t){return!!G1.getLanguage(t)}function Up({doc:t,name:e,lowlight:n,defaultLanguage:o}){const r=[];return $l(t,i=>i.type.name===e).forEach(i=>{var s;let l=i.pos+1;const c=i.node.attrs.language||o,u=n.listLanguages(),d=c&&(u.includes(c)||Y1(c)||!((s=n.registered)===null||s===void 0)&&s.call(n,c))?Hp(n.highlight(c,i.node.textContent)):Hp(n.highlightAuto(i.node.textContent));Hg(d).forEach(p=>{const f=l+p.text.length;if(p.classes.length){const h=Ge.inline(l,f,{class:p.classes.join(" ")});r.push(h)}l=f})}),Ne.create(t,r)}function J1(t){return typeof t=="function"}function X1({name:t,lowlight:e,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(r=>J1(e[r])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const o=new Ae({key:new xe("lowlight"),state:{init:(r,{doc:i})=>Up({doc:i,name:t,lowlight:e,defaultLanguage:n}),apply:(r,i,s,l)=>{const c=s.selection.$head.parent.type.name,u=l.selection.$head.parent.type.name,d=$l(s.doc,f=>f.type.name===t),p=$l(l.doc,f=>f.type.name===t);return r.docChanged&&([c,u].includes(t)||p.length!==d.length||r.steps.some(f=>f.from!==void 0&&f.to!==void 0&&d.some(h=>h.pos>=f.from&&h.pos+h.node.nodeSize<=f.to)))?Up({doc:r.doc,name:t,lowlight:e,defaultLanguage:n}):i.map(r.mapping,r.doc)}},props:{decorations(r){return o.getState(r)}}});return o}const Z1=dm.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))||[],X1({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}});function Q1(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),o="decltype\\(auto\\)",r="[a-zA-Z_]\\w*::",s="(?!struct)("+o+"|"+e.optional(r)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",l={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},p={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(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(r)+t.IDENT_RE,relevance:0},h=e.optional(r)+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"],b=["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"],y=["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:b},C={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},_=[C,p,l,n,t.C_BLOCK_COMMENT_MODE,d,u],R={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:v,contains:_.concat([{begin:/\(/,end:/\)/,keywords:v,contains:_.concat(["self"]),relevance:0}]),relevance:0},B={className:"function",begin:"("+s+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:v,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:o,keywords:v,relevance:0},{begin:h,returnBegin:!0,contains:[f],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,t.C_BLOCK_COMMENT_MODE,p]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:v,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(R,B,C,_,[p,{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",l]},{begin:t.IDENT_RE+"::",keywords:v},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function eO(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=Q1(t),o=n.keywords;return o.type=[...o.type,...e.type],o.literal=[...o.literal,...e.literal],o.built_in=[...o.built_in,...e.built_in],o._hints=e._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function tO(t){const e=t.regex,n={},o={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:e.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},o]});const r={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},i=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"})]}},l={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,n,r]};r.contains.push(l);const c={match:/\\"/},u={className:"string",begin:/'/,end:/'/},d={match:/\\'/},p={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"],b=["true","false"],y={match:/(\/[a-z._-]+)+/},k=["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"],C=["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:b,built_in:[...k,...E,"set","shopt",...v,...C]},contains:[h,t.SHEBANG(),m,p,i,s,y,l,c,u,d,n]}}function nO(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),o="decltype\\(auto\\)",r="[a-zA-Z_]\\w*::",s="("+o+"|"+e.optional(r)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",l={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},p={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(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(r)+t.IDENT_RE,relevance:0},h=e.optional(r)+t.IDENT_RE+"\\s*\\(",b={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"},y=[p,l,n,t.C_BLOCK_COMMENT_MODE,d,u],k={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:b,contains:y.concat([{begin:/\(/,end:/\)/,keywords:b,contains:y.concat(["self"]),relevance:0}]),relevance:0},E={begin:"("+s+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:b,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:o,keywords:b,relevance:0},{begin:h,returnBegin:!0,contains:[t.inherit(f,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,t.C_BLOCK_COMMENT_MODE,p]};return{name:"C",aliases:["h"],keywords:b,disableAutodetect:!0,illegal:"</",contains:[].concat(k,E,y,[p,{begin:t.IDENT_RE+"::",keywords:b},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},t.TITLE_MODE]}]),exports:{preprocessor:p,strings:u,keywords:b}}}function oO(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),o="decltype\\(auto\\)",r="[a-zA-Z_]\\w*::",s="(?!struct)("+o+"|"+e.optional(r)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",l={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},p={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(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(r)+t.IDENT_RE,relevance:0},h=e.optional(r)+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"],b=["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"],y=["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:b},C={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},_=[C,p,l,n,t.C_BLOCK_COMMENT_MODE,d,u],R={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:v,contains:_.concat([{begin:/\(/,end:/\)/,keywords:v,contains:_.concat(["self"]),relevance:0}]),relevance:0},B={className:"function",begin:"("+s+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:v,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:o,keywords:v,relevance:0},{begin:h,returnBegin:!0,contains:[f],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,t.C_BLOCK_COMMENT_MODE,p]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:v,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(R,B,C,_,[p,{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",l]},{begin:t.IDENT_RE+"::",keywords:v},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function rO(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"],o=["default","false","null","true"],r=["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"],i=["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:r.concat(i),built_in:e,literal:o},l=t.inherit(t.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),c={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},u={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},d={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},p=t.inherit(d,{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]},b=t.inherit(g,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]});f.contains=[g,m,d,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,c,t.C_BLOCK_COMMENT_MODE],h.contains=[b,m,p,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,c,t.inherit(t.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const y={variants:[u,g,m,d,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},k={begin:"<",end:">",contains:[{beginKeywords:"in out"},l]},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"}},y,c,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},l,k,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[l,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[l,k,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,k],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,relevance:0,contains:[y,c,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},v]}}const iO=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_-]*/}}),sO=["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"],aO=["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"],lO=[...sO,...aO],cO=["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(),uO=["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(),dO=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),pO=["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 fO(t){const e=t.regex,n=iO(t),o={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},r="and or not only",i=/@-?\w[\w]*(-\w+)*/,s="[a-zA-Z-][a-zA-Z0-9_-]*",l=[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,o,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:":("+uO.join("|")+")"},{begin:":(:)?("+dO.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+pO.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...l,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...l,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:e.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:r,attribute:cO.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...l,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+lO.join("|")+")\\b"}]}}function hO(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 mO(t){const i={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:i,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:i,illegal:/["']/}]}]}}function gO(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 bO(t){const e=t.regex,n={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:t.NUMBER_RE}]},o=t.COMMENT();o.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const r={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},i={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:"'"}]},l={begin:/\[/,end:/\]/,contains:[o,i,r,s,n,"self"],relevance:0},c=/[A-Za-z0-9_-]+/,u=/"(\\"|[^"])*"/,d=/'[^']*'/,p=e.either(c,u,d),f=e.concat(p,"(\\s*\\.\\s*",p,")*",e.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[o,{className:"section",begin:/\[+/,end:/\]+/},{begin:f,className:"attr",starts:{end:/$/,contains:[o,l,i,r,s,n]}}]}}var ir="[0-9](_*[0-9])*",Xi=`\\.(${ir})`,Zi="[0-9a-fA-F](_*[0-9a-fA-F])*",qp={className:"number",variants:[{begin:`(\\b(${ir})((${Xi})|\\.)?|(${Xi}))[eE][+-]?(${ir})[fFdD]?\\b`},{begin:`\\b(${ir})((${Xi})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Xi})[fFdD]?\\b`},{begin:`\\b(${ir})[fFdD]\\b`},{begin:`\\b0[xX]((${Zi})\\.?|(${Zi})?\\.(${Zi}))[pP][+-]?(${ir})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Zi})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Ug(t,e,n){return n===-1?"":t.replace(e,o=>Ug(t,e,n-1))}function yO(t){const e=t.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",o=n+Ug("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),c={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"]},u={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},d={className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[t.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:c,illegal:/<\/|#/,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[t.BACKSLASH_ESCAPE]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[e.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[d,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+o+"\\s+)",t.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:c,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,qp,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},qp,u]}}const Kp="[A-Za-z$_][0-9A-Za-z$_]*",vO=["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"],kO=["true","false","null","undefined","NaN","Infinity"],qg=["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"],Kg=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Wg=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],wO=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],EO=[].concat(Wg,qg,Kg);function _O(t){const e=t.regex,n=(O,{after:F})=>{const J="</"+O[0].slice(1);return O.input.indexOf(J,F)!==-1},o=Kp,r={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(O,F)=>{const J=O[0].length+O.index,Q=O.input[J];if(Q==="<"||Q===","){F.ignoreMatch();return}Q===">"&&(n(O,{after:J})||F.ignoreMatch());let ce;const Ce=O.input.substring(J);if(ce=Ce.match(/^\s*=/)){F.ignoreMatch();return}if((ce=Ce.match(/^\s+extends\s+/))&&ce.index===0){F.ignoreMatch();return}}},l={$pattern:Kp,keyword:vO,literal:kO,built_in:EO,"variable.language":wO},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",p={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\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:l,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"}},b={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,f]},k={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:o+"(?=\\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,b,{match:/\$\d+/},p];f.contains=E.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(E)});const v=[].concat(k,f.contains),C=v.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(v)}]),_={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:C},R={variants:[{match:[/class/,/\s+/,o,/\s+/,/extends/,/\s+/,e.concat(o,"(",e.concat(/\./,o),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,o],scope:{1:"keyword",3:"title.class"}}]},B={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:{_:[...qg,...Kg]}},N={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},M={variants:[{match:[/function/,/\s+/,o,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[_],illegal:/%/},z={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function G(O){return e.concat("(?!",O.join("|"),")")}const $={match:e.concat(/\b/,G([...Wg,"super","import"].map(O=>`${O}\\s*\\(`)),o,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},U={begin:e.concat(/\./,e.lookahead(e.concat(o,/(?![0-9A-Za-z$_(])/))),end:o,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},q={match:[/get|set/,/\s+/,o,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},_]},ee="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",S={match:[/const|var|let/,/\s+/,o,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(ee)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[_]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:C,CLASS_REFERENCE:B},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),N,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,h,m,g,b,k,{match:/\$\d+/},p,B,{scope:"attr",match:o+e.lookahead(":"),relevance:0},S,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[k,t.REGEXP_MODE,{className:"function",begin:ee,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:l,contains:C}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:i},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},M,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[_,t.inherit(t.TITLE_MODE,{begin:o,className:"title.function"})]},{match:/\.\.\./,relevance:0},U,{match:"\\$"+o,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[_]},$,z,R,q,{match:/\$[(.]/}]}}function CO(t){const e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},o=["true","false","null"],r={scope:"literal",beginKeywords:o.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:o},contains:[e,n,t.QUOTE_STRING_MODE,r,t.C_NUMBER_MODE,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var sr="[0-9](_*[0-9])*",Qi=`\\.(${sr})`,es="[0-9a-fA-F](_*[0-9a-fA-F])*",SO={className:"number",variants:[{begin:`(\\b(${sr})((${Qi})|\\.)?|(${Qi}))[eE][+-]?(${sr})[fFdD]?\\b`},{begin:`\\b(${sr})((${Qi})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Qi})[fFdD]?\\b`},{begin:`\\b(${sr})[fFdD]\\b`},{begin:`\\b0[xX]((${es})\\.?|(${es})?\\.(${es}))[pP][+-]?(${sr})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${es})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function xO(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+/}]}},o={className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"@"},r={className:"subst",begin:/\$\{/,end:/\}/,contains:[t.C_NUMBER_MODE]},i={className:"variable",begin:"\\$"+t.UNDERSCORE_IDENT_RE},s={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[i,r]},{begin:"'",end:"'",illegal:/\n/,contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[t.BACKSLASH_ESCAPE,i,r]}]};r.contains.push(s);const l={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+t.UNDERSCORE_IDENT_RE+")?"},c={className:"meta",begin:"@"+t.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[t.inherit(s,{className:"string"}),"self"]}]},u=SO,d=t.COMMENT("/\\*","\\*/",{contains:[t.C_BLOCK_COMMENT_MODE]}),p={variants:[{className:"type",begin:t.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},f=p;return f.variants[1].contains=[p],p.variants[1].contains=[f],{name:"Kotlin",aliases:["kt","kts"],keywords:e,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),t.C_LINE_COMMENT_MODE,d,n,o,l,c,{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:[p,t.C_LINE_COMMENT_MODE,d],relevance:0},t.C_LINE_COMMENT_MODE,d,l,c,s,t.C_NUMBER_MODE]},d]},{begin:[/class|interface|trait/,/\s+/,t.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},t.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},l,c]},s,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
183
+ `},u]}}const NO=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_-]*/}}),TO=["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"],OO=["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"],MO=[...TO,...OO],AO=["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(),jg=["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(),Gg=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),RO=["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(),BO=jg.concat(Gg).sort().reverse();function DO(t){const e=NO(t),n=BO,o="and or not only",r="[\\w-]+",i="("+r+"|@\\{"+r+"\\})",s=[],l=[],c=function(E){return{className:"string",begin:"~?"+E+".*?"+E}},u=function(E,v,C){return{className:E,begin:v,relevance:C}},d={$pattern:/[a-z-]+/,keyword:o,attribute:AO.join(" ")},p={begin:"\\(",end:"\\)",contains:l,keywords:d,relevance:0};l.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,c("'"),c('"'),e.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},e.HEXCOLOR,p,u("variable","@@?"+r,10),u("variable","@\\{"+r+"\\}"),u("built_in","~?`[^`]*?`"),{className:"attribute",begin:r+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},e.IMPORTANT,{beginKeywords:"and not"},e.FUNCTION_DISPATCH);const f=l.concat({begin:/\{/,end:/\}/,contains:s}),h={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(l)},m={begin:i+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+RO.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:l}}]},g={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:d,returnEnd:!0,contains:l,relevance:0}},b={className:"variable",variants:[{begin:"@"+r+"\\s*:",relevance:15},{begin:"@"+r}],starts:{end:"[;}]",returnEnd:!0,contains:f}},y={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:i,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,h,u("keyword","all\\b"),u("variable","@\\{"+r+"\\}"),{begin:"\\b("+MO.join("|")+")\\b",className:"selector-tag"},e.CSS_NUMBER_MODE,u("selector-tag",i,0),u("selector-id","#"+i),u("selector-class","\\."+i,0),u("selector-tag","&",0),e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+jg.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+Gg.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:f},{begin:"!important"},e.FUNCTION_DISPATCH]},k={begin:r+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[y]};return s.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,g,b,k,m,y,h,e.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:s}}function IO(t){const e="\\[=*\\[",n="\\]=*\\]",o={begin:e,end:n,contains:["self"]},r=[t.COMMENT("--(?!"+e+")","$"),t.COMMENT("--"+e,n,{contains:[o],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:r.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:r}].concat(r)},t.C_NUMBER_MODE,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{className:"string",begin:e,end:n,contains:[o],relevance:5}])}}function LO(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]},o={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]},r={begin:"^"+t.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},i={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,o,r,i,s]}}function PO(t){const e=t.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},o={begin:"^[-\\*]{3,}",end:"$"},r={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}]},i={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}]},l=/[A-Za-z][A-Za-z0-9+.-]*/,c={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:e.concat(/\[.+?\]\(/,l,/:\/\/.*?\)/),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}]},u={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},d={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},p=t.inherit(u,{contains:[]}),f=t.inherit(d,{contains:[]});u.contains.push(f),d.contains.push(p);let h=[n,c];return[u,d,p,f].forEach(y=>{y.contains=y.contains.concat(h)}),h=h.concat(u,d),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:h},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:h}]}]},n,i,u,d,{className:"quote",begin:"^>\\s+",contains:h,end:"$"},r,o,c,s,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function $O(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_]*/,l={"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"]},c={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:l,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:"("+c.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:c,contains:[t.UNDERSCORE_TITLE_MODE]},{begin:"\\."+t.UNDERSCORE_IDENT_RE,relevance:0}]}}function FO(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"],o=/[dualxmsipngr]{0,12}/,r={$pattern:/[\w.]+/,keyword:n.join(" ")},i={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:r},s={begin:/->\{/,end:/\}/},l={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},c={scope:"variable",variants:[{begin:/\$\d/},{begin:e.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[l]},u={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},d=[t.BACKSLASH_ESCAPE,i,c],p=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],f=(g,b,y="\\1")=>{const k=y==="\\1"?y:e.concat(y,b);return e.concat(e.concat("(?:",g,")"),b,/(?:\\.|[^\\\/])*?/,k,/(?:\\.|[^\\\/])*?/,y,o)},h=(g,b,y)=>e.concat(e.concat("(?:",g,")"),b,/(?:\\.|[^\\\/])*?/,y,o),m=[c,t.HASH_COMMENT_MODE,t.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),s,{className:"string",contains:d,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},u,{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(...p,{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(...p,{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,l]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,l,u]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return i.contains=m,s.contains=m,{name:"Perl",aliases:["pl","pm"],keywords:r,contains:m}}function VO(t){const e=t.regex,n=/(?![A-Za-z0-9])(?![$])/,o=e.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),r=e.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),i=e.concat(/[A-Z]+/,n),s={scope:"variable",match:"\\$+"+o},l={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},c={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},u=t.inherit(t.APOS_STRING_MODE,{illegal:null}),d=t.inherit(t.QUOTE_STRING_MODE,{illegal:null,contains:t.QUOTE_STRING_MODE.contains.concat(c)}),p={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:t.QUOTE_STRING_MODE.contains.concat(c),"on:begin":(U,q)=>{q.data._beginMatch=U[1]||U[2]},"on:end":(U,q)=>{q.data._beginMatch!==U[1]&&q.ignoreMatch()}},f=t.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),h=`[
184
+ ]`,m={scope:"string",variants:[d,u,p,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},b=["false","null","true"],y=["__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"],k=["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:y,literal:(U=>{const q=[];return U.forEach(ee=>{q.push(ee),ee.toLowerCase()===ee?q.push(ee.toUpperCase()):q.push(ee.toLowerCase())}),q})(b),built_in:k},C=U=>U.map(q=>q.replace(/\|\d+$/,"")),_={variants:[{match:[/new/,e.concat(h,"+"),e.concat("(?!",C(k).join("\\b|"),"\\b)"),r],scope:{1:"keyword",4:"title.class"}}]},R=e.concat(o,"\\b(?!\\()"),B={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),R],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[r,e.concat(/::/,e.lookahead(/(?!class\b)/)),R],scope:{1:"title.class",3:"variable.constant"}},{match:[r,e.concat("::",e.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[r,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},N={scope:"attr",match:e.concat(o,e.lookahead(":"),e.lookahead(/(?!::)/))},M={relevance:0,begin:/\(/,end:/\)/,keywords:v,contains:[N,s,B,t.C_BLOCK_COMMENT_MODE,m,g,_]},z={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",C(y).join("\\b|"),"|",C(k).join("\\b|"),"\\b)"),o,e.concat(h,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[M]};M.contains.push(z);const G=[N,B,t.C_BLOCK_COMMENT_MODE,m,g,_],$={begin:e.concat(/#\[\s*\\?/,e.either(r,i)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:b,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:b,keyword:["new","array"]},contains:["self",...G]},...G,{scope:"meta",variants:[{match:r},{match:i}]}]};return{case_insensitive:!1,keywords:v,contains:[$,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}]}},l,{scope:"variable.language",match:/\$this\b/},s,z,B,{match:[/const/,/\s/,o],scope:{1:"keyword",3:"variable.constant"}},_,{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",$,s,B,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 zO(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 HO(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function UO(t){const e=t.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),o=["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"],l={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:o,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"]},c={className:"meta",begin:/^(>>>|\.\.\.) /},u={className:"subst",begin:/\{/,end:/\}/,keywords:l,illegal:/#/},d={begin:/\{\{/,relevance:0},p={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,c,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,c,d,u]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[t.BACKSLASH_ESCAPE,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,d,u]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},f="[0-9](_?[0-9])*",h=`(\\b(${f}))?\\.(${f})|\\b(${f})\\.`,m=`\\b|${o.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})`}]},b={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:l,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},y={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:["self",c,g,p,t.HASH_COMMENT_MODE]}]};return u.contains=[p,g,c],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:l,illegal:/(<\/|\?)|=>/,contains:[c,g,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},p,b,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[y]},{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,y,p]}]}}function qO(t){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function KO(t){const e=t.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,o=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]?/),r=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,i=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:[r,o]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,o]},{scope:{1:"punctuation",2:"number"},match:[i,o]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,o]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:r},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:i},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function WO(t){const e=t.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",o=e.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),r=e.concat(o,/(::\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"]},l={className:"doctag",begin:"@[A-Za-z]+"},c={begin:"#<",end:">"},u=[t.COMMENT("#","$",{contains:[l]}),t.COMMENT("^=begin","^=end",{contains:[l],relevance:10}),t.COMMENT("^__END__",t.MATCH_NOTHING_RE)],d={className:"subst",begin:/#\{/,end:/\}/,keywords:s},p={className:"string",contains:[t.BACKSLASH_ESCAPE,d],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:e.concat(/<<[-~]?'?/,e.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[t.BACKSLASH_ESCAPE,d]})]}]},f="[1-9](_?[0-9])*|0",h="[0-9](_?[0-9])*",m={className:"number",relevance:0,variants:[{begin:`\\b(${f})(\\.(${h}))?([eE][+-]?(${h})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},g={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:s}]},_=[p,{variants:[{match:[/class\s+/,r,/\s+<\s+/,r]},{match:[/\b(class|module)\s+/,r]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:s},{match:[/(include|extend)\s+/,r],scope:{2:"title.class"},keywords:s},{relevance:0,match:[r,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:o,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:[p,{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,d],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(c,u),relevance:0}].concat(c,u);d.contains=_,g.contains=_;const M=[{begin:/^\s*=>/,starts:{end:"$",contains:_}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:s,contains:_}}];return u.unshift(c),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:s,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(M).concat(u).concat(_)}}function jO(t){const e=t.regex,n=/(r#)?/,o=e.concat(n,t.UNDERSCORE_IDENT_RE),r=e.concat(n,t.IDENT_RE),i={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let|for|while|if|else|match\b)/,r,e.lookahead(/\s*\(/))},s="([ui](8|16|32|64|128|size)|f(32|64))?",l=["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"],c=["true","false","Some","None","Ok","Err"],u=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],d=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:t.IDENT_RE+"!?",type:d,keyword:l,literal:c,built_in:u},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+/,o],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,o],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,o,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,o],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,o],className:{1:"keyword",3:"title.class"}},{begin:t.IDENT_RE+"::",keywords:{keyword:"Self",built_in:u,type:d}},{className:"punctuation",begin:"->"},i]}}const GO=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_-]*/}}),YO=["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"],JO=["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"],XO=[...YO,...JO],ZO=["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(),QO=["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(),eM=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),tM=["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 nM(t){const e=GO(t),n=eM,o=QO,r="@[a-z-]+",i="and or not only",l={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("+XO.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+o.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},l,{begin:/\(/,end:/\)/,contains:[e.CSS_NUMBER_MODE]},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+tM.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,l,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:r,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:ZO.join(" ")},contains:[{begin:r,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},l,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,e.HEXCOLOR,e.CSS_NUMBER_MODE]},e.FUNCTION_DISPATCH]}}function oM(t){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function rM(t){const e=t.regex,n=t.COMMENT("--","$"),o={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},r={begin:/"/,end:/"/,contains:[{match:/""/}]},i=["true","false","unknown"],s=["double precision","large object","with timezone","without timezone"],l=["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"],c=["add","asc","collation","desc","final","first","last","view"],u=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],d=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],p=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],f=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],h=d,m=[...u,...c].filter(C=>!d.includes(C)),g={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},b={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},y={match:e.concat(/\b/,e.either(...h),/\s*\(/),relevance:0,keywords:{built_in:h}};function k(C){return e.concat(/\b/,e.either(...C.map(_=>_.replace(/\s+/,"\\s+"))),/\b/)}const E={scope:"keyword",match:k(f),relevance:0};function v(C,{exceptions:_,when:R}={}){const B=R;return _=_||[],C.map(N=>N.match(/\|\d+$/)||_.includes(N)?N:B(N)?`${N}|0`:N)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:v(m,{when:C=>C.length<3}),literal:i,type:l,built_in:p},contains:[{scope:"type",match:k(s)},E,y,g,o,r,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,b]}}function Yg(t){return t?typeof t=="string"?t:t.source:null}function Ir(t){return Fe("(?=",t,")")}function Fe(...t){return t.map(n=>Yg(n)).join("")}function iM(t){const e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function Rt(...t){return"("+(iM(t).capture?"":"?:")+t.map(o=>Yg(o)).join("|")+")"}const vu=t=>Fe(/\b/,t,/\w$/.test(t)?/\b/:/\B/),sM=["Protocol","Type"].map(vu),Wp=["init","self"].map(vu),aM=["Any","Self"],gl=["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"],jp=["false","nil","true"],lM=["assignment","associativity","higherThan","left","lowerThan","none","right"],cM=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],Gp=["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"],Jg=Rt(/[/=\-+!*%<>&|^~?]/,/[\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]/),Xg=Rt(Jg,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),bl=Fe(Jg,Xg,"*"),Zg=Rt(/[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]/),na=Rt(Zg,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Sn=Fe(Zg,na,"*"),ts=Fe(/[A-Z]/,na,"*"),uM=["attached","autoclosure",Fe(/convention\(/,Rt("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Fe(/objc\(/,Sn,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],dM=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function pM(t){const e={match:/\s+/,relevance:0},n=t.COMMENT("/\\*","\\*/",{contains:["self"]}),o=[t.C_LINE_COMMENT_MODE,n],r={match:[/\./,Rt(...sM,...Wp)],className:{2:"keyword"}},i={match:Fe(/\./,Rt(...gl)),relevance:0},s=gl.filter(pe=>typeof pe=="string").concat(["_|0"]),l=gl.filter(pe=>typeof pe!="string").concat(aM).map(vu),c={variants:[{className:"keyword",match:Rt(...l,...Wp)}]},u={$pattern:Rt(/\b\w+/,/#\w+/),keyword:s.concat(cM),literal:jp},d=[r,i,c],p={match:Fe(/\./,Rt(...Gp)),relevance:0},f={className:"built_in",match:Fe(/\b/,Rt(...Gp),/(?=\()/)},h=[p,f],m={match:/->/,relevance:0},g={className:"operator",relevance:0,variants:[{match:bl},{match:`\\.(\\.|${Xg})+`}]},b=[m,g],y="([0-9]_*)+",k="([0-9a-fA-F]_*)+",E={className:"number",relevance:0,variants:[{match:`\\b(${y})(\\.(${y}))?([eE][+-]?(${y}))?\\b`},{match:`\\b0x(${k})(\\.(${k}))?([pP][+-]?(${y}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},v=(pe="")=>({className:"subst",variants:[{match:Fe(/\\/,pe,/[0\\tnr"']/)},{match:Fe(/\\/,pe,/u\{[0-9a-fA-F]{1,8}\}/)}]}),C=(pe="")=>({className:"subst",match:Fe(/\\/,pe,/[\t ]*(?:[\r\n]|\r\n)/)}),_=(pe="")=>({className:"subst",label:"interpol",begin:Fe(/\\/,pe,/\(/),end:/\)/}),R=(pe="")=>({begin:Fe(pe,/"""/),end:Fe(/"""/,pe),contains:[v(pe),C(pe),_(pe)]}),B=(pe="")=>({begin:Fe(pe,/"/),end:Fe(/"/,pe),contains:[v(pe),_(pe)]}),N={className:"string",variants:[R(),R("#"),R("##"),R("###"),B(),B("#"),B("##"),B("###")]},M=[t.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[t.BACKSLASH_ESCAPE]}],z={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:M},G=pe=>{const Pt=Fe(pe,/\//),wt=Fe(/\//,pe);return{begin:Pt,end:wt,contains:[...M,{scope:"comment",begin:`#(?!.*${wt})`,end:/$/}]}},$={scope:"regexp",variants:[G("###"),G("##"),G("#"),z]},U={match:Fe(/`/,Sn,/`/)},q={className:"variable",match:/\$\d+/},ee={className:"variable",match:`\\$${na}+`},S=[U,q,ee],O={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:dM,contains:[...b,E,N]}]}},F={scope:"keyword",match:Fe(/@/,Rt(...uM),Ir(Rt(/\(/,/\s+/)))},J={scope:"meta",match:Fe(/@/,Sn)},Q=[O,F,J],ce={match:Ir(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Fe(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,na,"+")},{className:"type",match:ts,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Fe(/\s+&\s+/,Ir(ts)),relevance:0}]},Ce={begin:/</,end:/>/,keywords:u,contains:[...o,...d,...Q,m,ce]};ce.contains.push(Ce);const ot={match:Fe(Sn,/\s*:/),keywords:"_|0",relevance:0},Re={begin:/\(/,end:/\)/,relevance:0,keywords:u,contains:["self",ot,...o,$,...d,...h,...b,E,N,...S,...Q,ce]},X={begin:/</,end:/>/,keywords:"repeat each",contains:[...o,ce]},be={begin:Rt(Ir(Fe(Sn,/\s*:/)),Ir(Fe(Sn,/\s+/,Sn,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Sn}]},ke={begin:/\(/,end:/\)/,keywords:u,contains:[be,...o,...d,...b,E,N,...Q,ce,Re],endsParent:!0,illegal:/["']/},Ye={match:[/(func|macro)/,/\s+/,Rt(U.match,Sn,bl)],className:{1:"keyword",3:"title.function"},contains:[X,ke,e],illegal:[/\[/,/%/]},tt={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[X,ke,e],illegal:/\[|%/},en={match:[/operator/,/\s+/,bl],className:{1:"keyword",3:"title"}},En={begin:[/precedencegroup/,/\s+/,ts],className:{1:"keyword",3:"title"},contains:[ce],keywords:[...lM,...jp],end:/}/},fn={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},qt={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},hn={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,Sn,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:u,contains:[X,...d,{begin:/:/,end:/\{/,keywords:u,contains:[{scope:"title.class.inherited",match:ts},...d],relevance:0}]};for(const pe of N.variants){const Pt=pe.contains.find(se=>se.label==="interpol");Pt.keywords=u;const wt=[...d,...h,...b,E,N,...S];Pt.contains=[...wt,{begin:/\(/,end:/\)/,contains:["self",...wt]}]}return{name:"Swift",keywords:u,contains:[...o,Ye,tt,fn,qt,hn,en,En,{beginKeywords:"import",end:/$/,contains:[...o],relevance:0},$,...d,...h,...b,E,N,...S,...Q,ce,Re]}}const oa="[A-Za-z$_][0-9A-Za-z$_]*",Qg=["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"],eb=["true","false","null","undefined","NaN","Infinity"],tb=["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"],nb=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],ob=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],rb=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],ib=[].concat(ob,tb,nb);function fM(t){const e=t.regex,n=(O,{after:F})=>{const J="</"+O[0].slice(1);return O.input.indexOf(J,F)!==-1},o=oa,r={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(O,F)=>{const J=O[0].length+O.index,Q=O.input[J];if(Q==="<"||Q===","){F.ignoreMatch();return}Q===">"&&(n(O,{after:J})||F.ignoreMatch());let ce;const Ce=O.input.substring(J);if(ce=Ce.match(/^\s*=/)){F.ignoreMatch();return}if((ce=Ce.match(/^\s+extends\s+/))&&ce.index===0){F.ignoreMatch();return}}},l={$pattern:oa,keyword:Qg,literal:eb,built_in:ib,"variable.language":rb},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",p={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\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:l,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"}},b={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,f]},k={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:o+"(?=\\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,b,{match:/\$\d+/},p];f.contains=E.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(E)});const v=[].concat(k,f.contains),C=v.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(v)}]),_={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:C},R={variants:[{match:[/class/,/\s+/,o,/\s+/,/extends/,/\s+/,e.concat(o,"(",e.concat(/\./,o),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,o],scope:{1:"keyword",3:"title.class"}}]},B={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:{_:[...tb,...nb]}},N={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},M={variants:[{match:[/function/,/\s+/,o,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[_],illegal:/%/},z={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function G(O){return e.concat("(?!",O.join("|"),")")}const $={match:e.concat(/\b/,G([...ob,"super","import"].map(O=>`${O}\\s*\\(`)),o,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},U={begin:e.concat(/\./,e.lookahead(e.concat(o,/(?![0-9A-Za-z$_(])/))),end:o,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},q={match:[/get|set/,/\s+/,o,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},_]},ee="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",S={match:[/const|var|let/,/\s+/,o,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(ee)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[_]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:C,CLASS_REFERENCE:B},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),N,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,h,m,g,b,k,{match:/\$\d+/},p,B,{scope:"attr",match:o+e.lookahead(":"),relevance:0},S,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[k,t.REGEXP_MODE,{className:"function",begin:ee,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:l,contains:C}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:i},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},M,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[_,t.inherit(t.TITLE_MODE,{begin:o,className:"title.function"})]},{match:/\.\.\./,relevance:0},U,{match:"\\$"+o,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[_]},$,z,R,q,{match:/\$[(.]/}]}}function hM(t){const e=t.regex,n=fM(t),o=oa,r=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},s={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:r},contains:[n.exports.CLASS_REFERENCE]},l={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},c=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],u={$pattern:oa,keyword:Qg.concat(c),literal:eb,built_in:ib.concat(r),"variable.language":rb},d={className:"meta",begin:"@"+o},p=(g,b,y)=>{const k=g.contains.findIndex(E=>E.label===b);if(k===-1)throw new Error("can not find mode to replace");g.contains.splice(k,1,y)};Object.assign(n.keywords,u),n.exports.PARAMS_CONTAINS.push(d);const f=n.contains.find(g=>g.scope==="attr"),h=Object.assign({},f,{match:e.concat(o,e.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,f,h]),n.contains=n.contains.concat([d,i,s,h]),p(n,"shebang",t.SHEBANG()),p(n,"use_strict",l);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 mM(t){const e=t.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},o={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},r=/\d{1,2}\/\d{1,2}\/\d{4}/,i=/\d{4}-\d{1,2}-\d{1,2}/,s=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,l=/\d{1,2}(:\d{1,2}){1,2}/,c={className:"literal",variants:[{begin:e.concat(/# */,e.either(i,r),/ *#/)},{begin:e.concat(/# */,l,/ *#/)},{begin:e.concat(/# */,s,/ *#/)},{begin:e.concat(/# */,e.either(i,r),/ +/,e.either(s,l),/ *#/)}]},u={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},d={className:"label",begin:/^\w+:/},p=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,o,c,u,d,p,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 gM(t){t.regex;const e=t.COMMENT(/\(;/,/;\)/);e.contains.push("self");const n=t.COMMENT(/;;/,/$/),o=["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"],r={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},i={className:"variable",begin:/\$[\w_]+/},s={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},l={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/},c={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},u={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:o},contains:[n,e,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},i,s,r,t.QUOTE_STRING_MODE,c,u,l]}}function bM(t){const e=t.regex,n=e.concat(/[\p{L}_]/u,e.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),o=/[\p{L}0-9._:-]+/u,r={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},i={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},s=t.inherit(i,{begin:/\(/,end:/\)/}),l=t.inherit(t.APOS_STRING_MODE,{className:"string"}),c=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),u={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:o,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[r]},{begin:/'/,end:/'/,contains:[r]},{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:[i,c,l,s,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[i,s,c,l]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},r,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[u],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[u],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:u}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function yM(t){const e="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",o={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},r={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},i={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,r]},l=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},b=[o,{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,i,s],y=[...b];return y.pop(),y.push(l),h.contains=y,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:b}}const vM={arduino:eO,bash:tO,c:nO,cpp:oO,csharp:rO,css:fO,diff:hO,go:mO,graphql:gO,ini:bO,java:yO,javascript:_O,json:CO,kotlin:xO,less:DO,lua:IO,makefile:LO,markdown:PO,objectivec:$O,perl:FO,php:VO,"php-template":zO,plaintext:HO,python:UO,"python-repl":qO,r:KO,ruby:WO,rust:jO,scss:nM,shell:oM,sql:rM,swift:pM,typescript:hM,vbnet:mM,wasm:gM,xml:bM,yaml:yM};function kM(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var yl,Yp;function wM(){if(Yp)return yl;Yp=1;function t(w){return w instanceof Map?w.clear=w.delete=w.set=function(){throw new Error("map is read-only")}:w instanceof Set&&(w.add=w.clear=w.delete=function(){throw new Error("set is read-only")}),Object.freeze(w),Object.getOwnPropertyNames(w).forEach(T=>{const P=w[T],ue=typeof P;(ue==="object"||ue==="function")&&!Object.isFrozen(P)&&t(P)}),w}class e{constructor(T){T.data===void 0&&(T.data={}),this.data=T.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(w){return w.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function o(w,...T){const P=Object.create(null);for(const ue in w)P[ue]=w[ue];return T.forEach(function(ue){for(const We in ue)P[We]=ue[We]}),P}const r="</span>",i=w=>!!w.scope,s=(w,{prefix:T})=>{if(w.startsWith("language:"))return w.replace("language:","language-");if(w.includes(".")){const P=w.split(".");return[`${T}${P.shift()}`,...P.map((ue,We)=>`${ue}${"_".repeat(We+1)}`)].join(" ")}return`${T}${w}`};class l{constructor(T,P){this.buffer="",this.classPrefix=P.classPrefix,T.walk(this)}addText(T){this.buffer+=n(T)}openNode(T){if(!i(T))return;const P=s(T.scope,{prefix:this.classPrefix});this.span(P)}closeNode(T){i(T)&&(this.buffer+=r)}value(){return this.buffer}span(T){this.buffer+=`<span class="${T}">`}}const c=(w={})=>{const T={children:[]};return Object.assign(T,w),T};class u{constructor(){this.rootNode=c(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(T){this.top.children.push(T)}openNode(T){const P=c({scope:T});this.add(P),this.stack.push(P)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(T){return this.constructor._walk(T,this.rootNode)}static _walk(T,P){return typeof P=="string"?T.addText(P):P.children&&(T.openNode(P),P.children.forEach(ue=>this._walk(T,ue)),T.closeNode(P)),T}static _collapse(T){typeof T!="string"&&T.children&&(T.children.every(P=>typeof P=="string")?T.children=[T.children.join("")]:T.children.forEach(P=>{u._collapse(P)}))}}class d extends u{constructor(T){super(),this.options=T}addText(T){T!==""&&this.add(T)}startScope(T){this.openNode(T)}endScope(){this.closeNode()}__addSublanguage(T,P){const ue=T.root;P&&(ue.scope=`language:${P}`),this.add(ue)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function p(w){return w?typeof w=="string"?w:w.source:null}function f(w){return g("(?=",w,")")}function h(w){return g("(?:",w,")*")}function m(w){return g("(?:",w,")?")}function g(...w){return w.map(P=>p(P)).join("")}function b(w){const T=w[w.length-1];return typeof T=="object"&&T.constructor===Object?(w.splice(w.length-1,1),T):{}}function y(...w){return"("+(b(w).capture?"":"?:")+w.map(ue=>p(ue)).join("|")+")"}function k(w){return new RegExp(w.toString()+"|").exec("").length-1}function E(w,T){const P=w&&w.exec(T);return P&&P.index===0}const v=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function C(w,{joinWith:T}){let P=0;return w.map(ue=>{P+=1;const We=P;let Ue=p(ue),Z="";for(;Ue.length>0;){const W=v.exec(Ue);if(!W){Z+=Ue;break}Z+=Ue.substring(0,W.index),Ue=Ue.substring(W.index+W[0].length),W[0][0]==="\\"&&W[1]?Z+="\\"+String(Number(W[1])+We):(Z+=W[0],W[0]==="("&&P++)}return Z}).map(ue=>`(${ue})`).join(T)}const _=/\b\B/,R="[a-zA-Z]\\w*",B="[a-zA-Z_]\\w*",N="\\b\\d+(\\.\\d+)?",M="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",z="\\b(0b[01]+)",G="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",$=(w={})=>{const T=/^#![ ]*\//;return w.binary&&(w.begin=g(T,/.*\b/,w.binary,/\b.*/)),o({scope:"meta",begin:T,end:/$/,relevance:0,"on:begin":(P,ue)=>{P.index!==0&&ue.ignoreMatch()}},w)},U={begin:"\\\\[\\s\\S]",relevance:0},q={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[U]},ee={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[U]},S={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/},O=function(w,T,P={}){const ue=o({scope:"comment",begin:w,end:T,contains:[]},P);ue.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 We=y("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 ue.contains.push({begin:g(/[ ]+/,"(",We,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),ue},F=O("//","$"),J=O("/\\*","\\*/"),Q=O("#","$"),ce={scope:"number",begin:N,relevance:0},Ce={scope:"number",begin:M,relevance:0},ot={scope:"number",begin:z,relevance:0},Re={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[U,{begin:/\[/,end:/\]/,relevance:0,contains:[U]}]},X={scope:"title",begin:R,relevance:0},be={scope:"title",begin:B,relevance:0},ke={begin:"\\.\\s*"+B,relevance:0};var tt=Object.freeze({__proto__:null,APOS_STRING_MODE:q,BACKSLASH_ESCAPE:U,BINARY_NUMBER_MODE:ot,BINARY_NUMBER_RE:z,COMMENT:O,C_BLOCK_COMMENT_MODE:J,C_LINE_COMMENT_MODE:F,C_NUMBER_MODE:Ce,C_NUMBER_RE:M,END_SAME_AS_BEGIN:function(w){return Object.assign(w,{"on:begin":(T,P)=>{P.data._beginMatch=T[1]},"on:end":(T,P)=>{P.data._beginMatch!==T[1]&&P.ignoreMatch()}})},HASH_COMMENT_MODE:Q,IDENT_RE:R,MATCH_NOTHING_RE:_,METHOD_GUARD:ke,NUMBER_MODE:ce,NUMBER_RE:N,PHRASAL_WORDS_MODE:S,QUOTE_STRING_MODE:ee,REGEXP_MODE:Re,RE_STARTERS_RE:G,SHEBANG:$,TITLE_MODE:X,UNDERSCORE_IDENT_RE:B,UNDERSCORE_TITLE_MODE:be});function en(w,T){w.input[w.index-1]==="."&&T.ignoreMatch()}function En(w,T){w.className!==void 0&&(w.scope=w.className,delete w.className)}function fn(w,T){T&&w.beginKeywords&&(w.begin="\\b("+w.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",w.__beforeBegin=en,w.keywords=w.keywords||w.beginKeywords,delete w.beginKeywords,w.relevance===void 0&&(w.relevance=0))}function qt(w,T){Array.isArray(w.illegal)&&(w.illegal=y(...w.illegal))}function hn(w,T){if(w.match){if(w.begin||w.end)throw new Error("begin & end are not supported with match");w.begin=w.match,delete w.match}}function pe(w,T){w.relevance===void 0&&(w.relevance=1)}const Pt=(w,T)=>{if(!w.beforeMatch)return;if(w.starts)throw new Error("beforeMatch cannot be used with starts");const P=Object.assign({},w);Object.keys(w).forEach(ue=>{delete w[ue]}),w.keywords=P.keywords,w.begin=g(P.beforeMatch,f(P.begin)),w.starts={relevance:0,contains:[Object.assign(P,{endsParent:!0})]},w.relevance=0,delete P.beforeMatch},wt=["of","and","for","in","not","or","if","then","parent","list","value"],se="keyword";function Tt(w,T,P=se){const ue=Object.create(null);return typeof w=="string"?We(P,w.split(" ")):Array.isArray(w)?We(P,w):Object.keys(w).forEach(function(Ue){Object.assign(ue,Tt(w[Ue],T,Ue))}),ue;function We(Ue,Z){T&&(Z=Z.map(W=>W.toLowerCase())),Z.forEach(function(W){const de=W.split("|");ue[de[0]]=[Ue,$e(de[0],de[1])]})}}function $e(w,T){return T?Number(T):Oe(w)?0:1}function Oe(w){return wt.includes(w.toLowerCase())}const Ot={},nt=w=>{console.error(w)},mn=(w,...T)=>{console.log(`WARN: ${w}`,...T)},Mt=(w,T)=>{Ot[`${w}/${T}`]||(console.log(`Deprecated as of ${w}. ${T}`),Ot[`${w}/${T}`]=!0)},L=new Error;function K(w,T,{key:P}){let ue=0;const We=w[P],Ue={},Z={};for(let W=1;W<=T.length;W++)Z[W+ue]=We[W],Ue[W+ue]=!0,ue+=k(T[W-1]);w[P]=Z,w[P]._emit=Ue,w[P]._multi=!0}function fe(w){if(Array.isArray(w.begin)){if(w.skip||w.excludeBegin||w.returnBegin)throw nt("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),L;if(typeof w.beginScope!="object"||w.beginScope===null)throw nt("beginScope must be object"),L;K(w,w.begin,{key:"beginScope"}),w.begin=C(w.begin,{joinWith:""})}}function Me(w){if(Array.isArray(w.end)){if(w.skip||w.excludeEnd||w.returnEnd)throw nt("skip, excludeEnd, returnEnd not compatible with endScope: {}"),L;if(typeof w.endScope!="object"||w.endScope===null)throw nt("endScope must be object"),L;K(w,w.end,{key:"endScope"}),w.end=C(w.end,{joinWith:""})}}function rt(w){w.scope&&typeof w.scope=="object"&&w.scope!==null&&(w.beginScope=w.scope,delete w.scope)}function Kt(w){rt(w),typeof w.beginScope=="string"&&(w.beginScope={_wrap:w.beginScope}),typeof w.endScope=="string"&&(w.endScope={_wrap:w.endScope}),fe(w),Me(w)}function Tr(w){function T(Z,W){return new RegExp(p(Z),"m"+(w.case_insensitive?"i":"")+(w.unicodeRegex?"u":"")+(W?"g":""))}class P{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(W,de){de.position=this.position++,this.matchIndexes[this.matchAt]=de,this.regexes.push([de,W]),this.matchAt+=k(W)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const W=this.regexes.map(de=>de[1]);this.matcherRe=T(C(W,{joinWith:"|"}),!0),this.lastIndex=0}exec(W){this.matcherRe.lastIndex=this.lastIndex;const de=this.matcherRe.exec(W);if(!de)return null;const dt=de.findIndex((Mr,Ma)=>Ma>0&&Mr!==void 0),it=this.matchIndexes[dt];return de.splice(0,dt),Object.assign(de,it)}}class ue{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(W){if(this.multiRegexes[W])return this.multiRegexes[W];const de=new P;return this.rules.slice(W).forEach(([dt,it])=>de.addRule(dt,it)),de.compile(),this.multiRegexes[W]=de,de}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(W,de){this.rules.push([W,de]),de.type==="begin"&&this.count++}exec(W){const de=this.getMatcher(this.regexIndex);de.lastIndex=this.lastIndex;let dt=de.exec(W);if(this.resumingScanAtSamePosition()&&!(dt&&dt.index===this.lastIndex)){const it=this.getMatcher(0);it.lastIndex=this.lastIndex+1,dt=it.exec(W)}return dt&&(this.regexIndex+=dt.position+1,this.regexIndex===this.count&&this.considerAll()),dt}}function We(Z){const W=new ue;return Z.contains.forEach(de=>W.addRule(de.begin,{rule:de,type:"begin"})),Z.terminatorEnd&&W.addRule(Z.terminatorEnd,{type:"end"}),Z.illegal&&W.addRule(Z.illegal,{type:"illegal"}),W}function Ue(Z,W){const de=Z;if(Z.isCompiled)return de;[En,hn,Kt,Pt].forEach(it=>it(Z,W)),w.compilerExtensions.forEach(it=>it(Z,W)),Z.__beforeBegin=null,[fn,qt,pe].forEach(it=>it(Z,W)),Z.isCompiled=!0;let dt=null;return typeof Z.keywords=="object"&&Z.keywords.$pattern&&(Z.keywords=Object.assign({},Z.keywords),dt=Z.keywords.$pattern,delete Z.keywords.$pattern),dt=dt||/\w+/,Z.keywords&&(Z.keywords=Tt(Z.keywords,w.case_insensitive)),de.keywordPatternRe=T(dt,!0),W&&(Z.begin||(Z.begin=/\B|\b/),de.beginRe=T(de.begin),!Z.end&&!Z.endsWithParent&&(Z.end=/\B|\b/),Z.end&&(de.endRe=T(de.end)),de.terminatorEnd=p(de.end)||"",Z.endsWithParent&&W.terminatorEnd&&(de.terminatorEnd+=(Z.end?"|":"")+W.terminatorEnd)),Z.illegal&&(de.illegalRe=T(Z.illegal)),Z.contains||(Z.contains=[]),Z.contains=[].concat(...Z.contains.map(function(it){return Y(it==="self"?Z:it)})),Z.contains.forEach(function(it){Ue(it,de)}),Z.starts&&Ue(Z.starts,W),de.matcher=We(de),de}if(w.compilerExtensions||(w.compilerExtensions=[]),w.contains&&w.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return w.classNameAliases=o(w.classNameAliases||{}),Ue(w)}function x(w){return w?w.endsWithParent||x(w.starts):!1}function Y(w){return w.variants&&!w.cachedVariants&&(w.cachedVariants=w.variants.map(function(T){return o(w,{variants:null},T)})),w.cachedVariants?w.cachedVariants:x(w)?o(w,{starts:w.starts?o(w.starts):null}):Object.isFrozen(w)?o(w):w}var le="11.11.1";class Be extends Error{constructor(T,P){super(T),this.name="HTMLInjectionError",this.html=P}}const Ee=n,ut=o,At=Symbol("nomatch"),eo=7,Or=function(w){const T=Object.create(null),P=Object.create(null),ue=[];let We=!0;const Ue="Could not find the language '{}', did you forget to load/include a language module?",Z={disableAutodetect:!0,name:"Plain text",contains:[]};let W={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:d};function de(I){return W.noHighlightRe.test(I)}function dt(I){let ie=I.className+" ";ie+=I.parentNode?I.parentNode.className:"";const Se=W.languageDetectRe.exec(ie);if(Se){const qe=to(Se[1]);return qe||(mn(Ue.replace("{}",Se[1])),mn("Falling back to no-highlight mode for this block.",I)),qe?Se[1]:"no-highlight"}return ie.split(/\s+/).find(qe=>de(qe)||to(qe))}function it(I,ie,Se){let qe="",at="";typeof ie=="object"?(qe=I,Se=ie.ignoreIllegals,at=ie.language):(Mt("10.7.0","highlight(lang, code, ...args) has been deprecated."),Mt("10.7.0",`Please use highlight(code, options) instead.
185
+ https://github.com/highlightjs/highlight.js/issues/2277`),at=I,qe=ie),Se===void 0&&(Se=!0);const gn={code:qe,language:at};Ti("before:highlight",gn);const no=gn.result?gn.result:Mr(gn.language,gn.code,Se);return no.code=gn.code,Ti("after:highlight",no),no}function Mr(I,ie,Se,qe){const at=Object.create(null);function gn(H,te){return H.keywords[te]}function no(){if(!he.keywords){gt.addText(Ke);return}let H=0;he.keywordPatternRe.lastIndex=0;let te=he.keywordPatternRe.exec(Ke),we="";for(;te;){we+=Ke.substring(H,te.index);const Ie=Cn.case_insensitive?te[0].toLowerCase():te[0],Et=gn(he,Ie);if(Et){const[Fn,Lb]=Et;if(gt.addText(we),we="",at[Ie]=(at[Ie]||0)+1,at[Ie]<=eo&&(Ai+=Lb),Fn.startsWith("_"))we+=te[0];else{const Pb=Cn.classNameAliases[Fn]||Fn;_n(te[0],Pb)}}else we+=te[0];H=he.keywordPatternRe.lastIndex,te=he.keywordPatternRe.exec(Ke)}we+=Ke.substring(H),gt.addText(we)}function Oi(){if(Ke==="")return;let H=null;if(typeof he.subLanguage=="string"){if(!T[he.subLanguage]){gt.addText(Ke);return}H=Mr(he.subLanguage,Ke,!0,Ou[he.subLanguage]),Ou[he.subLanguage]=H._top}else H=Aa(Ke,he.subLanguage.length?he.subLanguage:null);he.relevance>0&&(Ai+=H.relevance),gt.__addSublanguage(H._emitter,H.language)}function Wt(){he.subLanguage!=null?Oi():no(),Ke=""}function _n(H,te){H!==""&&(gt.startScope(te),gt.addText(H),gt.endScope())}function Su(H,te){let we=1;const Ie=te.length-1;for(;we<=Ie;){if(!H._emit[we]){we++;continue}const Et=Cn.classNameAliases[H[we]]||H[we],Fn=te[we];Et?_n(Fn,Et):(Ke=Fn,no(),Ke=""),we++}}function xu(H,te){return H.scope&&typeof H.scope=="string"&&gt.openNode(Cn.classNameAliases[H.scope]||H.scope),H.beginScope&&(H.beginScope._wrap?(_n(Ke,Cn.classNameAliases[H.beginScope._wrap]||H.beginScope._wrap),Ke=""):H.beginScope._multi&&(Su(H.beginScope,te),Ke="")),he=Object.create(H,{parent:{value:he}}),he}function Nu(H,te,we){let Ie=E(H.endRe,we);if(Ie){if(H["on:end"]){const Et=new e(H);H["on:end"](te,Et),Et.isMatchIgnored&&(Ie=!1)}if(Ie){for(;H.endsParent&&H.parent;)H=H.parent;return H}}if(H.endsWithParent)return Nu(H.parent,te,we)}function Ab(H){return he.matcher.regexIndex===0?(Ke+=H[0],1):(Ia=!0,0)}function Rb(H){const te=H[0],we=H.rule,Ie=new e(we),Et=[we.__beforeBegin,we["on:begin"]];for(const Fn of Et)if(Fn&&(Fn(H,Ie),Ie.isMatchIgnored))return Ab(te);return we.skip?Ke+=te:(we.excludeBegin&&(Ke+=te),Wt(),!we.returnBegin&&!we.excludeBegin&&(Ke=te)),xu(we,H),we.returnBegin?0:te.length}function Bb(H){const te=H[0],we=ie.substring(H.index),Ie=Nu(he,H,we);if(!Ie)return At;const Et=he;he.endScope&&he.endScope._wrap?(Wt(),_n(te,he.endScope._wrap)):he.endScope&&he.endScope._multi?(Wt(),Su(he.endScope,H)):Et.skip?Ke+=te:(Et.returnEnd||Et.excludeEnd||(Ke+=te),Wt(),Et.excludeEnd&&(Ke=te));do he.scope&&gt.closeNode(),!he.skip&&!he.subLanguage&&(Ai+=he.relevance),he=he.parent;while(he!==Ie.parent);return Ie.starts&&xu(Ie.starts,H),Et.returnEnd?0:te.length}function Db(){const H=[];for(let te=he;te!==Cn;te=te.parent)te.scope&&H.unshift(te.scope);H.forEach(te=>gt.openNode(te))}let Mi={};function Tu(H,te){const we=te&&te[0];if(Ke+=H,we==null)return Wt(),0;if(Mi.type==="begin"&&te.type==="end"&&Mi.index===te.index&&we===""){if(Ke+=ie.slice(te.index,te.index+1),!We){const Ie=new Error(`0 width match regex (${I})`);throw Ie.languageName=I,Ie.badRule=Mi.rule,Ie}return 1}if(Mi=te,te.type==="begin")return Rb(te);if(te.type==="illegal"&&!Se){const Ie=new Error('Illegal lexeme "'+we+'" for mode "'+(he.scope||"<unnamed>")+'"');throw Ie.mode=he,Ie}else if(te.type==="end"){const Ie=Bb(te);if(Ie!==At)return Ie}if(te.type==="illegal"&&we==="")return Ke+=`
186
+ `,1;if(Da>1e5&&Da>te.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Ke+=we,we.length}const Cn=to(I);if(!Cn)throw nt(Ue.replace("{}",I)),new Error('Unknown language: "'+I+'"');const Ib=Tr(Cn);let Ba="",he=qe||Ib;const Ou={},gt=new W.__emitter(W);Db();let Ke="",Ai=0,xo=0,Da=0,Ia=!1;try{if(Cn.__emitTokens)Cn.__emitTokens(ie,gt);else{for(he.matcher.considerAll();;){Da++,Ia?Ia=!1:he.matcher.considerAll(),he.matcher.lastIndex=xo;const H=he.matcher.exec(ie);if(!H)break;const te=ie.substring(xo,H.index),we=Tu(te,H);xo=H.index+we}Tu(ie.substring(xo))}return gt.finalize(),Ba=gt.toHTML(),{language:I,value:Ba,relevance:Ai,illegal:!1,_emitter:gt,_top:he}}catch(H){if(H.message&&H.message.includes("Illegal"))return{language:I,value:Ee(ie),illegal:!0,relevance:0,_illegalBy:{message:H.message,index:xo,context:ie.slice(xo-100,xo+100),mode:H.mode,resultSoFar:Ba},_emitter:gt};if(We)return{language:I,value:Ee(ie),illegal:!1,relevance:0,errorRaised:H,_emitter:gt,_top:he};throw H}}function Ma(I){const ie={value:Ee(I),illegal:!1,relevance:0,_top:Z,_emitter:new W.__emitter(W)};return ie._emitter.addText(I),ie}function Aa(I,ie){ie=ie||W.languages||Object.keys(T);const Se=Ma(I),qe=ie.filter(to).filter(Cu).map(Wt=>Mr(Wt,I,!1));qe.unshift(Se);const at=qe.sort((Wt,_n)=>{if(Wt.relevance!==_n.relevance)return _n.relevance-Wt.relevance;if(Wt.language&&_n.language){if(to(Wt.language).supersetOf===_n.language)return 1;if(to(_n.language).supersetOf===Wt.language)return-1}return 0}),[gn,no]=at,Oi=gn;return Oi.secondBest=no,Oi}function kb(I,ie,Se){const qe=ie&&P[ie]||Se;I.classList.add("hljs"),I.classList.add(`language-${qe}`)}function Ra(I){let ie=null;const Se=dt(I);if(de(Se))return;if(Ti("before:highlightElement",{el:I,language:Se}),I.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",I);return}if(I.children.length>0&&(W.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(I)),W.throwUnescapedHTML))throw new Be("One of your code blocks includes unescaped HTML.",I.innerHTML);ie=I;const qe=ie.textContent,at=Se?it(qe,{language:Se,ignoreIllegals:!0}):Aa(qe);I.innerHTML=at.value,I.dataset.highlighted="yes",kb(I,Se,at.language),I.result={language:at.language,re:at.relevance,relevance:at.relevance},at.secondBest&&(I.secondBest={language:at.secondBest.language,relevance:at.secondBest.relevance}),Ti("after:highlightElement",{el:I,result:at,text:qe})}function wb(I){W=ut(W,I)}const Eb=()=>{Ni(),Mt("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function _b(){Ni(),Mt("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Eu=!1;function Ni(){function I(){Ni()}if(document.readyState==="loading"){Eu||window.addEventListener("DOMContentLoaded",I,!1),Eu=!0;return}document.querySelectorAll(W.cssSelector).forEach(Ra)}function Cb(I,ie){let Se=null;try{Se=ie(w)}catch(qe){if(nt("Language definition for '{}' could not be registered.".replace("{}",I)),We)nt(qe);else throw qe;Se=Z}Se.name||(Se.name=I),T[I]=Se,Se.rawDefinition=ie.bind(null,w),Se.aliases&&_u(Se.aliases,{languageName:I})}function Sb(I){delete T[I];for(const ie of Object.keys(P))P[ie]===I&&delete P[ie]}function xb(){return Object.keys(T)}function to(I){return I=(I||"").toLowerCase(),T[I]||T[P[I]]}function _u(I,{languageName:ie}){typeof I=="string"&&(I=[I]),I.forEach(Se=>{P[Se.toLowerCase()]=ie})}function Cu(I){const ie=to(I);return ie&&!ie.disableAutodetect}function Nb(I){I["before:highlightBlock"]&&!I["before:highlightElement"]&&(I["before:highlightElement"]=ie=>{I["before:highlightBlock"](Object.assign({block:ie.el},ie))}),I["after:highlightBlock"]&&!I["after:highlightElement"]&&(I["after:highlightElement"]=ie=>{I["after:highlightBlock"](Object.assign({block:ie.el},ie))})}function Tb(I){Nb(I),ue.push(I)}function Ob(I){const ie=ue.indexOf(I);ie!==-1&&ue.splice(ie,1)}function Ti(I,ie){const Se=I;ue.forEach(function(qe){qe[Se]&&qe[Se](ie)})}function Mb(I){return Mt("10.7.0","highlightBlock will be removed entirely in v12.0"),Mt("10.7.0","Please use highlightElement now."),Ra(I)}Object.assign(w,{highlight:it,highlightAuto:Aa,highlightAll:Ni,highlightElement:Ra,highlightBlock:Mb,configure:wb,initHighlighting:Eb,initHighlightingOnLoad:_b,registerLanguage:Cb,unregisterLanguage:Sb,listLanguages:xb,getLanguage:to,registerAliases:_u,autoDetection:Cu,inherit:ut,addPlugin:Tb,removePlugin:Ob}),w.debugMode=function(){We=!1},w.safeMode=function(){We=!0},w.versionString=le,w.regex={concat:g,lookahead:f,either:y,optional:m,anyNumberOfTimes:h};for(const I in tt)typeof tt[I]=="object"&&t(tt[I]);return Object.assign(w,tt),w},$t=Or({});return $t.newInstance=()=>Or({}),yl=$t,$t.HighlightJS=$t,$t.default=$t,yl}var EM=wM();const _M=kM(EM),Jp={},CM="hljs-";function SM(t){const e=_M.newInstance();return t&&i(t),{highlight:n,highlightAuto:o,listLanguages:r,register:i,registerAlias:s,registered:l};function n(c,u,d){const p=d||Jp,f=typeof p.prefix=="string"?p.prefix:CM;if(!e.getLanguage(c))throw new Error("Unknown language: `"+c+"` is not registered");e.configure({__emitter:xM,classPrefix:f});const h=e.highlight(u,{ignoreIllegals:!0,language:c});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 o(c,u){const p=(u||Jp).subset||r();let f=-1,h=0,m;for(;++f<p.length;){const g=p[f];if(!e.getLanguage(g))continue;const b=n(g,c,u);b.data&&b.data.relevance!==void 0&&b.data.relevance>h&&(h=b.data.relevance,m=b)}return m||{type:"root",children:[],data:{language:void 0,relevance:h}}}function r(){return e.listLanguages()}function i(c,u){if(typeof c=="string")e.registerLanguage(c,u);else{let d;for(d in c)Object.hasOwn(c,d)&&e.registerLanguage(d,c[d])}}function s(c,u){if(typeof c=="string")e.registerAliases(typeof u=="string"?u:[...u],{languageName:c});else{let d;for(d in c)if(Object.hasOwn(c,d)){const p=c[d];e.registerAliases(typeof p=="string"?p:[...p],{languageName:d})}}}function l(c){return!!e.getLanguage(c)}}class xM{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],o=n.children[n.children.length-1];o&&o.type==="text"?o.value+=e:n.children.push({type:"text",value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,n){const o=this.stack[this.stack.length-1],r=e.root.children;n?o.children.push({type:"element",tagName:"span",properties:{className:[n]},children:r}):o.children.push(...r)}openNode(e){const n=this,o=e.split(".").map(function(s,l){return l?s+"_".repeat(l):n.options.classPrefix+s}),r=this.stack[this.stack.length-1],i={type:"element",tagName:"span",properties:{className:o},children:[]};r.children.push(i),this.stack.push(i)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}/**
187
+ * Copyright 2025 Yiitap
188
+ * @license MIT
189
+ **/function NM(t){const e=document.createElement("textarea");e.value=t,e.contentEditable="true",e.style.position="fixed",document.body.appendChild(e),e.focus(),e.select();const n=document.execCommand("copy");return e.remove(),n}function TM(t){return navigator.clipboard!==void 0?navigator.clipboard.writeText(t):new Promise((e,n)=>{const o=NM(t);o?e(!0):n(o)})}const OM={class:"code-block-toolbar"},MM={class:"wrap editable"},AM={class:"wrap"},RM={class:"language readonly"},BM=a.defineComponent({__name:"view",props:ct,setup(t){const e=t,n=a.ref("content_copy"),o=a.computed({get(){return e.node.attrs.language},set(u){e.updateAttributes({language:u})}}),r=a.computed({get(){return e.node.attrs.wrap},set(u){e.updateAttributes({wrap:u})}}),i=a.computed(()=>r.value?"text_select_move_down":"format_text_wrap");function s(u){o.value=u}function l(){const u=e.node.content.content[0].text;TM(u).then(()=>{n.value="done",setTimeout(()=>{n.value="content_copy"},2e3)})}function c(){r.value=!r.value}return(u,d)=>(a.openBlock(),a.createBlock(a.unref(kn),a.mergeProps(e,{class:"o-code-block-view"}),{default:a.withCtx(()=>[a.createElementVNode("div",OM,[a.createElementVNode("div",MM,[a.createVNode(a.unref(Dm),{language:o.value,onSelect:s},null,8,["language"])]),a.createElementVNode("div",AM,[a.createElementVNode("div",RM,a.toDisplayString(o.value),1),a.createVNode(a.unref(Le),{icon:i.value,"icon-class":{"rotate-270":r.value},tooltip:"Wrap",class:"editable",onClick:c},null,8,["icon","icon-class"]),a.createVNode(a.unref(Le),{icon:n.value,tooltip:"Copy",onClick:l},null,8,["icon"])])]),a.createElementVNode("pre",null,[a.createVNode(a.unref(Pn),{as:"code",class:a.normalizeClass({wrap:r.value})},null,8,["class"])])]),_:1},16))}}),DM=SM(vM),sb=Z1.extend({draggable:!0,addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),wrap:{default:!0,rendered:!1}}},addNodeView(){return pn(BM)}}).configure({languageClassPrefix:"language-",defaultLanguage:"bash",lowlight:DM}),IM=a.defineComponent({__name:"view",props:ct,setup(t){const e=t,n=a.computed(()=>e.node.attrs.level);return(o,r)=>(a.openBlock(),a.createBlock(a.unref(kn),a.mergeProps(e,{class:["o-heading-view",`h${n.value}`],style:`text-align: ${o.node.attrs.textAlign}`}),{default:a.withCtx(()=>[a.createVNode(a.unref(Pn))]),_:1},16,["class","style"]))}}),ab=pm.extend({draggable:!0,addNodeView(){return pn(IM)}}),LM={class:"horizontal"},PM=a.defineComponent({__name:"view",props:ct,setup(t){const e=t;return(n,o)=>(a.openBlock(),a.createBlock(a.unref(kn),a.mergeProps(e,{class:"o-horizontal-view"}),{default:a.withCtx(()=>[a.createElementVNode("div",LM,[a.createVNode(a.unref(Pn),{as:"div",class:"divider"})])]),_:1},16))}}),lb=bm.extend({draggable:!0,addNodeView(){return pn(PM)}});/**
190
+ * Copyright 2025 Yiitap
191
+ * @license MIT
192
+ **/const $M=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,FM=ze.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",_e(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[va({find:$M,type:this.type,getAttributes:t=>{const[,,e,n,o]=t;return{src:n,alt:e,title:o}}})]}}),VM=FM.extend({draggable:!0,addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),size:{default:"",rendered:!1},ratio:{default:"",rendered:!1},isDraggable:{default:!0,renderHTML:e=>({})}}},renderHTML({node:t,HTMLAttributes:e}){return e.size=t.attrs.size,e.ratio=t.attrs.ratio,["img",_e(this.options.HTMLAttributes,e)]}}),zM={key:1,class:"image-container"},HM={key:1},UM=a.defineComponent({__name:"view",props:ct,setup(t){const e=t,{isEditable:n}=Te(),o=a.ref(!1),r=a.ref(!1),i=a.ref({}),s=a.ref(null),l=a.ref(!1),c=a.computed(()=>e.node.attrs),u=a.computed({get(){return e.node.attrs.src},set(y){e.updateAttributes({src:y})}}),d=a.computed({get(){return e.node.attrs.title},set(y){e.updateAttributes({title:y})}});function p(){l.value=!0,setTimeout(()=>{var y;(y=s.value)==null||y.focus()},0)}function f(){l.value=!1}function h(){u.value==="init"&&b(!0)}function m(y){switch(o.value=!1,y.value){case"replace":b(!0);break}}function g(y){u.value=y,b(!1)}function b(y){r.value=y}return a.onMounted(()=>{b(u.value==="init")}),(y,k)=>{var E;return a.openBlock(),a.createBlock(a.unref(kn),a.mergeProps(e,{class:["o-image-view",{"with-caption":c.value.alt,"with-ratio":c.value.ratio,readonly:!((E=y.editor)!=null&&E.isEditable),init:u.value==="init"}],size:c.value.size,as:"div",onClick:h}),{default:a.withCtx(()=>[a.createVNode(a.unref(Zn),{modelValue:r.value,"onUpdate:modelValue":k[1]||(k[1]=v=>r.value=v),placement:u.value==="init"?"bottom":"top","show-arrow":""},{"popover-content":a.withCtx(()=>[a.createVNode(a.unref(Qc),{val:u.value==="init"?"":u.value,type:"image",onInput:g},null,8,["val"])]),default:a.withCtx(()=>{var v;return[u.value==="init"?(a.openBlock(),a.createBlock(a.unref(Jc),{key:0,icon:"image",placeholder:"Add an image"})):(a.openBlock(),a.createElementBlock("div",zM,[a.unref(n)?(a.openBlock(),a.createBlock(a.unref(Xc),a.mergeProps({key:0},e,{onAction:m}),{default:a.withCtx(()=>[a.createVNode(a.unref(Le),{icon:"subtitles",tooltip:"image.caption",onClick:p})]),_:1},16)):a.createCommentVNode("",!0),a.createElementVNode("img",a.mergeProps(c.value,{draggable:"true","data-drag-handle":""}),null,16),a.createElementVNode("div",{class:"caption",onClick:p},[(v=y.editor)!=null&&v.isEditable&&l.value?(a.openBlock(),a.createBlock(a.unref(Ln),{key:0,ref_key:"captionInput",ref:s,class:"caption-input",modelValue:d.value,"onUpdate:modelValue":k[0]||(k[0]=C=>d.value=C),type:"text",placeholder:"Input caption",autosize:"",onBlur:f},null,8,["modelValue"])):(a.openBlock(),a.createElementBlock("span",HM,a.toDisplayString(d.value),1))])]))]}),_:1},8,["modelValue","placement"]),a.createVNode(a.unref(xi),{modelValue:o.value,"onUpdate:modelValue":k[2]||(k[2]=v=>o.value=v),event:i.value},{default:a.withCtx(()=>[a.createVNode(a.unref(So),a.mergeProps(e,{onAction:m}),null,16)]),_:1},8,["modelValue","event"])]),_:1},16,["class","size"])}}}),cb=VM.extend({addNodeView(){return pn(UM)}}).configure({inline:!0});function qM(t){return new Ae({key:new xe("handleClickSelectLink"),props:{handleClick:(e,n,o)=>{const{schema:r,doc:i,tr:s}=e.state,l=Cr(i.resolve(n),r.marks.link);if(!l)return!1;const c=i.resolve(l.from),u=i.resolve(l.to),d=s.setSelection(new ne(c,u));return e.dispatch(d),!0}}})}const KM=pu.extend({addProseMirrorPlugins(){var t;return[...((t=this.parent)==null?void 0:t.call(this))||[],qM({type:this.type})]}}).configure({openOnClick:!1}),WM=a.defineComponent({__name:"view",props:ct,setup(t){const e=t;return(n,o)=>(a.openBlock(),a.createBlock(a.unref(kn),a.mergeProps(e,{class:"o-paragraph-view"}),{default:a.withCtx(()=>[a.createVNode(a.unref(Pn),{as:"p",style:a.normalizeStyle(`text-align: ${n.node.attrs.textAlign}`)},null,8,["style"])]),_:1},16))}}),ub=ym.extend({draggable:!1,addNodeView(){return pn(WM,{stopEvent:()=>!1})}}),jM={class:"add"},GM=a.defineComponent({__name:"view",props:ct,setup(t){const e=t,{tr:n}=ge(),{isEditable:o,run:r}=Te(),i=a.ref(!1);function s(){i.value=!0}function l(){c("tableSelectRow",{pos:e.getPos()})}function c(u,d={}){u==="tableDeleteRow"&&(i.value=!1),setTimeout(()=>{r(e.editor,u,d)},0)}return(u,d)=>(a.openBlock(),a.createBlock(a.unref(Uc),a.mergeProps({class:"o-table-cell-view",as:"td"},u.node.attrs,{style:{background:u.node.attrs.background}}),{default:a.withCtx(()=>[a.unref(o)?(a.openBlock(),a.createBlock(a.unref(Zn),{key:0,modelValue:i.value,"onUpdate:modelValue":d[2]||(d[2]=p=>i.value=p),placement:"left-start","tippy-class":"o-row-popover",offset:[-6,26],"hide-click-outside":""},{"popover-content":a.withCtx(()=>[a.createVNode(a.unref(lt),{icon:"select_all",placement:"left",tooltip:a.unref(n)("table.selectRow"),onClick:l},null,8,["tooltip"]),a.createVNode(a.unref(lt),{icon:"delete",placement:"left",tooltip:a.unref(n)("table.removeRow"),onClick:d[1]||(d[1]=p=>c("tableDeleteRow"))},null,8,["tooltip"])]),default:a.withCtx(()=>[a.createElementVNode("section",{class:a.normalizeClass(["row-handler",{active:i.value}]),onClick:s},[a.createElementVNode("div",jM,[d[3]||(d[3]=a.createElementVNode("div",{class:"indicator"},[a.createElementVNode("svg",{width:"3",height:"3",viewBox:"0 0 3 3",fill:"none"},[a.createElementVNode("circle",{cx:"1.5",cy:"1.5",r:"1.5",fill:"#BBBFC4"})])],-1)),a.createVNode(a.unref(yn),{icon:"add_circle",color:a.unref(me).blue,tooltip:a.unref(n)("table.addRow"),placement:"left",onClick:d[0]||(d[0]=a.withModifiers(p=>c("tableAddRow"),["stop"]))},null,8,["color","tooltip"])])],2)]),_:1},8,["modelValue"])):a.createCommentVNode("",!0),a.createVNode(a.unref(Pn))]),_:1},16,["style"]))}}),db=vg.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),background:{default:""}}},addNodeView(){return pn(GM,{stopEvent:()=>!1})}}),YM={class:"add"},JM={class:"add"},XM=a.defineComponent({__name:"view",props:ct,setup(t){const e=t,{tr:n}=ge(),{isEditable:o,run:r}=Te(),i=a.ref(!1),s=a.ref(!1);function l(){setTimeout(()=>{i.value=!0},0)}function c(){s.value=!0}function u(){i.value=!1,p("tableSelectColumn",{pos:e.getPos()})}function d(){p("tableSelectRow",{pos:e.getPos()})}function p(f,h={}){f==="tableDeleteRow"?s.value=!1:f==="tableDeleteColumn"&&(i.value=!1),setTimeout(()=>{r(e.editor,f,h)},0)}return(f,h)=>(a.openBlock(),a.createBlock(a.unref(Uc),a.mergeProps({class:"o-table-header-view",as:"th"},f.node.attrs,{style:{background:f.node.attrs.background}}),{default:a.withCtx(()=>[a.unref(o)?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createVNode(a.unref(Zn),{modelValue:i.value,"onUpdate:modelValue":h[2]||(h[2]=m=>i.value=m),placement:"top","tippy-class":"o-column-popover",offset:[0,20],"hide-click-outside":""},{"popover-content":a.withCtx(()=>[a.createVNode(a.unref(lt),{icon:"select_all",tooltip:a.unref(n)("table.selectColumn"),onClick:u},null,8,["tooltip"]),a.createVNode(a.unref(lt),{icon:"delete",tooltip:a.unref(n)("table.removeColumn"),onClick:h[1]||(h[1]=m=>p("tableDeleteColumn"))},null,8,["tooltip"])]),default:a.withCtx(()=>[a.createElementVNode("section",{class:a.normalizeClass(["col-handler",{active:i.value}]),onClick:l},[a.createElementVNode("div",YM,[h[6]||(h[6]=a.createElementVNode("div",{class:"indicator"},[a.createElementVNode("svg",{width:"3",height:"3",viewBox:"0 0 3 3",fill:"none"},[a.createElementVNode("circle",{cx:"1.5",cy:"1.5",r:"1.5",fill:"#BBBFC4"})])],-1)),a.createVNode(a.unref(yn),{icon:"add_circle",color:a.unref(me).blue,tooltip:a.unref(n)("table.addColumn"),onClick:h[0]||(h[0]=a.withModifiers(m=>p("tableAddColumn"),["stop"]))},null,8,["color","tooltip"])])],2)]),_:1},8,["modelValue"]),a.createVNode(a.unref(Zn),{modelValue:s.value,"onUpdate:modelValue":h[5]||(h[5]=m=>s.value=m),placement:"left-start","tippy-class":"o-row-popover",offset:[-6,26],"hide-click-outside":""},{"popover-content":a.withCtx(()=>[a.createVNode(a.unref(lt),{icon:"select_all",placement:"left",tooltip:a.unref(n)("table.selectRow"),onClick:d},null,8,["tooltip"]),a.createVNode(a.unref(lt),{icon:"delete",placement:"left",tooltip:a.unref(n)("table.removeRow"),onClick:h[4]||(h[4]=m=>p("tableDeleteRow"))},null,8,["tooltip"])]),default:a.withCtx(()=>[a.createElementVNode("section",{class:a.normalizeClass(["row-handler",{active:s.value}]),onClick:c},[a.createElementVNode("div",JM,[h[7]||(h[7]=a.createElementVNode("div",{class:"indicator"},[a.createElementVNode("svg",{width:"3",height:"3",viewBox:"0 0 3 3",fill:"none"},[a.createElementVNode("circle",{cx:"1.5",cy:"1.5",r:"1.5",fill:"#BBBFC4"})])],-1)),a.createVNode(a.unref(yn),{icon:"add_circle",color:a.unref(me).blue,tooltip:a.unref(n)("table.addRow"),placement:"left",onClick:h[3]||(h[3]=a.withModifiers(m=>p("tableAddRow"),["stop"]))},null,8,["color","tooltip"])])],2)]),_:1},8,["modelValue"])],64)):a.createCommentVNode("",!0),a.createVNode(a.unref(Pn))]),_:1},16,["style"]))}}),pb=kg.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),background:{default:""}}},addNodeView(){return pn(XM,{stopEvent:()=>!1})}});/**
156
193
  * Copyright 2025 Yiitap
157
194
  * @license MIT
158
- **/const kM=Ue.create({name:"table-wrapper",group:"block",content:"table",draggable:!0,parseHTML(){return[{tag:"table-wrapper"}]},renderHTML({HTMLAttributes:t}){return["table-wrapper",Ce(t),0]}}),EM=l.defineComponent({__name:"view",props:ut,setup(t){const e=t,n=l.inject("sideNode",{value:!1}),o=l.ref(!1),r=l.computed(()=>{const{selection:s}=e.editor.view.state,a=s.from,c=e.getPos(),d=c+e.node.nodeSize;return a>=c&&a<=d});function i(s){o.value=s}return l.watch(r,s=>{i(s)}),(s,a)=>(l.openBlock(),l.createBlock(l.unref(Dn),l.mergeProps(e,{class:["o-table-wrapper-view",{"side-node-enabled":l.unref(n)}]}),{default:l.withCtx(()=>[l.createVNode(l.unref(Gn),{as:"table"})]),_:1},16,["class"]))}}),qg=kM.extend({addNodeView(){return yn(EM,{stopEvent:()=>!1})}});/**
195
+ **/const ZM=ze.create({name:"table-wrapper",group:"block",content:"table",draggable:!0,parseHTML(){return[{tag:"table-wrapper"}]},renderHTML({HTMLAttributes:t}){return["table-wrapper",_e(t),0]}}),QM=a.defineComponent({__name:"view",props:ct,setup(t){const e=t,n=a.inject("sideNode",{value:!1}),o=a.ref(!1),r=a.computed(()=>{const{selection:s}=e.editor.view.state,l=s.from,c=e.getPos(),u=c+e.node.nodeSize;return l>=c&&l<=u});function i(s){o.value=s}return a.watch(r,s=>{console.log("isFocused",e.node.attrs),i(s)}),(s,l)=>(a.openBlock(),a.createBlock(a.unref(kn),a.mergeProps(e,{class:["o-table-wrapper-view",{"side-node-enabled":a.unref(n)}]}),{default:a.withCtx(()=>[a.createVNode(a.unref(Pn),{as:"table"})]),_:1},16,["class"]))}}),fb=ZM.extend({addNodeView(){return pn(QM,{stopEvent:()=>!1})}});/**
159
196
  * Copyright 2025 Yiitap
160
197
  * @license MIT
161
- **/const wM=/(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,CM=Ue.create({name:"video",draggable:!0,addOptions(){return{inline:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},addAttributes(){return{caption:{default:"",rendered:!1},src:{default:null,parseHTML:t=>{var e;return((e=t.firstElementChild)==null?void 0:e.src)??""}}}},parseHTML(){return[{tag:"video"}]},renderHTML({node:t,HTMLAttributes:e}){return["video",{caption:t.attrs.caption},["source",Ce(this.options.HTMLAttributes,e)]]},addCommands(){return{setVideo:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[ga({find:wM,type:this.type,getAttributes:t=>{const[e]=t;return{src:e}}})]}}),_M={key:1,class:"video-container"},SM={key:1},xM=l.defineComponent({__name:"view",props:ut,setup(t){const e=t,{isEditable:n}=we(),o=l.ref(!1),r=l.ref({}),i=l.ref(null),s=l.ref(!1),a=l.ref(!1),c=l.computed({get(){return e.node.attrs.caption},set(y){e.updateAttributes({caption:y})}}),d=l.computed({get(){return e.node.attrs.src},set(y){e.updateAttributes({src:y})}});function u(y){switch(o.value=!1,y.value){case"replace":b(!0);break}}function p(){s.value=!0,setTimeout(()=>{var y;(y=i.value)==null||y.focus()},0)}function f(){s.value=!1}function h(){d.value==="init"&&b(!0)}function m(y){o.value=!0,r.value=y}function g(y){d.value=y,b(!1)}function b(y){a.value=y}return l.onMounted(()=>{b(d.value==="init")}),(y,k)=>{var w;return l.openBlock(),l.createBlock(l.unref(Dn),l.mergeProps(e,{class:["o-video-view",{readonly:!((w=y.editor)!=null&&w.isEditable),init:d.value==="init"}],as:"div",onContextmenu:l.withModifiers(m,["prevent"]),onClick:h}),{default:l.withCtx(()=>[l.createVNode(l.unref(yr),{modelValue:a.value,"onUpdate:modelValue":k[1]||(k[1]=v=>a.value=v),placement:d.value==="init"?"bottom":"top"},{"popover-content":l.withCtx(()=>[l.createVNode(l.unref(qc),{val:d.value==="init"?"":d.value,type:"video",onInput:g},null,8,["val"])]),default:l.withCtx(()=>{var v;return[d.value==="init"?(l.openBlock(),l.createBlock(l.unref(Vc),{key:0,icon:"videocam",placeholder:"Add a video"})):(l.openBlock(),l.createElementBlock("div",_M,[k[3]||(k[3]=l.createElementVNode("div",{class:"video-cover"},null,-1)),l.unref(n)?(l.openBlock(),l.createBlock(l.unref(zc),l.mergeProps({key:0},e,{onAction:u}),{default:l.withCtx(()=>[l.createVNode(l.unref(Re),{icon:"subtitles",tooltip:"image.caption",onClick:p})]),_:1},16)):l.createCommentVNode("",!0),l.createElementVNode("video",l.mergeProps(y.node.attrs,{draggable:"true","data-drag-handle":"",controls:""}),[l.createElementVNode("source",l.normalizeProps(l.guardReactiveProps(y.node.attrs)),null,16)],16),l.createElementVNode("div",{class:"caption",onClick:p},[(v=y.editor)!=null&&v.isEditable&&s.value?(l.openBlock(),l.createBlock(l.unref(Ko),{key:0,ref_key:"captionInput",ref:i,class:"caption-input",modelValue:c.value,"onUpdate:modelValue":k[0]||(k[0]=_=>c.value=_),type:"text",placeholder:"Input caption",autosize:"",onBlur:f},null,8,["modelValue"])):(l.openBlock(),l.createElementBlock("span",SM,l.toDisplayString(c.value),1))])]))]}),_:1},8,["modelValue","placement"]),l.createVNode(l.unref(va),{modelValue:o.value,"onUpdate:modelValue":k[2]||(k[2]=v=>o.value=v),event:r.value},{default:l.withCtx(()=>[l.createVNode(l.unref(Wo),l.mergeProps(e,{onAction:u}),null,16)]),_:1},8,["modelValue","event"])]),_:1},16,["class"])}}}),Wg=CM.extend({addNodeView(){return yn(xM)}}),Kg=["BackColor","Focus","FontFamily","ForeColor","Table","TaskItem","TaskList","TextAlign","Typography","Underline","OHorizontalRule","OUniqueID"],jg=["BackColor","Blockquote","Bold","BulletList","Code","CodeBlockLowlight","Focus","FontFamily","ForeColor","HorizontalRule","Image","Italic","Link","ListItem","OrderedList","Strike","Table","TaskItem","TaskList","TextAlign","Typography","Underline"],Gg=["OBlockquote","OCallout","OCodeBlock","OColon","OColorHighlighter","OColumnExtension","ODiagram","ODoc","ODraggableItem","OEmbed","OFocus","OFontFamily","OFormatClear","OHeading","OHorizontalRule","OIframe","OImage","OIndent","OInsertHtml","OKatexBlock","OKatexInline","OLineHeight","OLink","OModelViewer","OParagraph","OPrint","OSlash","OSlashZh","OTOC","OTableWrapper","OTitle","OTodoItem","OTrailingNode","OUniqueID","OVideo"],Yg=[...jg,...Gg],NM=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,TM=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,OM=sn.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",Ce(this.options.HTMLAttributes,t),0]},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[zo({find:NM,type:this.type})]},addPasteRules(){return[bo({find:TM,type:this.type})]}}),MM=De.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Se({key:new xe("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:o}=this.editor,{anchor:r}=e,i=[];if(!n||!o)return Me.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((c,d)=>{if(c.isText)return;if(!(r>=d&&r<=d+c.nodeSize-1))return!1;s+=1});let a=0;return t.descendants((c,d)=>{if(c.isText||!(r>=d&&r<=d+c.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";i.push(Ze.node(d,d+c.nodeSize,{class:this.options.className}))}),Me.create(t,i)}}})]}}),AM=De.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),RM=De.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()}}}),DM=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,IM=Ue.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",Ce(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[ga({find:DM,type:this.type,getAttributes:t=>{const[,,e,n,o]=t;return{src:n,alt:e,title:o}}})]}}),BM=/^\s*(\[([( |x])?\])\s$/,LM=Ue.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Ce(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:o})=>{const r=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),c=document.createElement("div");return i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",d=>d.preventDefault()),a.addEventListener("change",d=>{if(!o.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:u}=d.target;o.isEditable&&typeof n=="function"&&o.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const f=n();if(typeof f!="number")return!1;const h=p.doc.nodeAt(f);return p.setNodeMarkup(f,void 0,{...h==null?void 0:h.attrs,checked:u}),!0}).run(),!o.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,u)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,u])=>{r.setAttribute(d,u)}),r.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,s),r.append(i,c),Object.entries(e).forEach(([d,u])=>{r.setAttribute(d,u)}),{dom:r,contentDOM:c,update:d=>d.type!==this.type?!1:(r.dataset.checked=d.attrs.checked,a.checked=d.attrs.checked,!0)}}},addInputRules(){return[pr({find:BM,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),PM=Ue.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",Ce(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),$M=De.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e)}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),FM=t=>Ye({find:/--$/,replace:t??"—"}),VM=t=>Ye({find:/\.\.\.$/,replace:t??"…"}),zM=t=>Ye({find:/(?:^|[\s{[(<'"\u2018\u201C])(")$/,replace:t??"“"}),HM=t=>Ye({find:/"$/,replace:t??"”"}),UM=t=>Ye({find:/(?:^|[\s{[(<'"\u2018\u201C])(')$/,replace:t??"‘"}),qM=t=>Ye({find:/'$/,replace:t??"’"}),WM=t=>Ye({find:/<-$/,replace:t??"←"}),KM=t=>Ye({find:/->$/,replace:t??"→"}),jM=t=>Ye({find:/\(c\)$/,replace:t??"©"}),GM=t=>Ye({find:/\(tm\)$/,replace:t??"™"}),YM=t=>Ye({find:/\(sm\)$/,replace:t??"℠"}),JM=t=>Ye({find:/\(r\)$/,replace:t??"®"}),XM=t=>Ye({find:/(?:^|\s)(1\/2)\s$/,replace:t??"½"}),ZM=t=>Ye({find:/\+\/-$/,replace:t??"±"}),QM=t=>Ye({find:/!=$/,replace:t??"≠"}),eA=t=>Ye({find:/<<$/,replace:t??"«"}),tA=t=>Ye({find:/>>$/,replace:t??"»"}),nA=t=>Ye({find:/\d+\s?([*x])\s?\d+$/,replace:t??"×"}),oA=t=>Ye({find:/\^2$/,replace:t??"²"}),rA=t=>Ye({find:/\^3$/,replace:t??"³"}),iA=t=>Ye({find:/(?:^|\s)(1\/4)\s$/,replace:t??"¼"}),sA=t=>Ye({find:/(?:^|\s)(3\/4)\s$/,replace:t??"¾"}),aA=De.create({name:"typography",addOptions(){return{closeDoubleQuote:"”",closeSingleQuote:"’",copyright:"©",ellipsis:"…",emDash:"—",laquo:"«",leftArrow:"←",multiplication:"×",notEqual:"≠",oneHalf:"½",oneQuarter:"¼",openDoubleQuote:"“",openSingleQuote:"‘",plusMinus:"±",raquo:"»",registeredTrademark:"®",rightArrow:"→",servicemark:"℠",superscriptThree:"³",superscriptTwo:"²",threeQuarters:"¾",trademark:"™"}},addInputRules(){const t=[];return this.options.emDash!==!1&&t.push(FM(this.options.emDash)),this.options.ellipsis!==!1&&t.push(VM(this.options.ellipsis)),this.options.openDoubleQuote!==!1&&t.push(zM(this.options.openDoubleQuote)),this.options.closeDoubleQuote!==!1&&t.push(HM(this.options.closeDoubleQuote)),this.options.openSingleQuote!==!1&&t.push(UM(this.options.openSingleQuote)),this.options.closeSingleQuote!==!1&&t.push(qM(this.options.closeSingleQuote)),this.options.leftArrow!==!1&&t.push(WM(this.options.leftArrow)),this.options.rightArrow!==!1&&t.push(KM(this.options.rightArrow)),this.options.copyright!==!1&&t.push(jM(this.options.copyright)),this.options.trademark!==!1&&t.push(GM(this.options.trademark)),this.options.servicemark!==!1&&t.push(YM(this.options.servicemark)),this.options.registeredTrademark!==!1&&t.push(JM(this.options.registeredTrademark)),this.options.oneHalf!==!1&&t.push(XM(this.options.oneHalf)),this.options.plusMinus!==!1&&t.push(ZM(this.options.plusMinus)),this.options.notEqual!==!1&&t.push(QM(this.options.notEqual)),this.options.laquo!==!1&&t.push(eA(this.options.laquo)),this.options.raquo!==!1&&t.push(tA(this.options.raquo)),this.options.multiplication!==!1&&t.push(nA(this.options.multiplication)),this.options.superscriptTwo!==!1&&t.push(oA(this.options.superscriptTwo)),this.options.superscriptThree!==!1&&t.push(rA(this.options.superscriptThree)),this.options.oneQuarter!==!1&&t.push(iA(this.options.oneQuarter)),this.options.threeQuarters!==!1&&t.push(sA(this.options.threeQuarters)),t}}),lA=sn.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",Ce(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()}}}),Jg=Ue.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Ce(this.options.HTMLAttributes,t),0]}}),cA={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:Object},range:{type:Object}},setup(){const{locale:t,tr:e}=ye(),{onCommand:n}=we();return{locale:t,tr:e,onCommand:n}},data(){return{view:"main",selectedIndex:0}},components:{ODivider:Yt,OIcon:oe,OList:dn,OListItem:Jt},watch:{items(){this.selectedIndex=0}},methods:{onClick(t){switch(t.value){default:this.run(t);break}return!0},run(t){const e=this.editor.chain().focus().deleteRange(this.range),n=this.editor.commands;switch(t.value){case"codeBlock":n.deleteRange(this.range),this.editor.commands.setCodeBlock({language:"bash"});break;case"content":n.deleteRange(this.range),this.editor.commands.insertContent(t.options.content);break;case"emoji":n.deleteRange(this.range),this.editor.commands.insertContent(":");break;case"taskList":n.deleteRange(this.range),this.editor.commands.toggleTaskList();break;default:this.onCommand(n,e,t.value,t.options);break}},onKeyDown({event:t}){return t.key==="ArrowUp"?(this.upHandler(),!0):t.key==="ArrowDown"?(this.downHandler(),!0):t.key==="Enter"?(this.enterHandler(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length},enterHandler(){this.selectItem(this.selectedIndex)},selectItem(t){const e=this.items[t];e&&this.onClick(e)},setEmoji(t){this.onClick({value:"content",options:{content:t}})}},computed:{basicBlocks(){return Cr.slice(1)}},mounted(){this.selectedIndex=0}},dA={key:0,class:"view-main"},uA={class:"group o-tips"},pA={class:"o-tips"},fA={key:1,class:"item"},hA={key:1,class:"view-emoji"},mA={key:2,class:"view-emoji"};function gA(t,e,n,o,r,i){const s=l.resolveComponent("o-divider"),a=l.resolveComponent("o-icon"),c=l.resolveComponent("o-list-item"),d=l.resolveComponent("o-list");return l.openBlock(),l.createElementBlock("section",{class:l.normalizeClass(["o-slash-view o-shadow-3 o-menu o-scroll",`view-${r.view}`])},[r.view==="main"?(l.openBlock(),l.createElementBlock("section",dA,[l.createVNode(d,{hoverable:"",clickable:""},{default:l.withCtx(()=>[n.items.length?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(n.items,(u,p)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:p},[u.group?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[p>0?(l.openBlock(),l.createBlock(s,{key:0})):l.createCommentVNode("",!0),l.createElementVNode("div",uA,l.toDisplayString(o.tr(u.group)),1)],64)):l.createCommentVNode("",!0),l.createVNode(c,{class:l.normalizeClass(["item",{"is-active":p===r.selectedIndex}]),clickable:"",onClick:f=>i.onClick(u)},{prefix:l.withCtx(()=>[l.createVNode(a,{name:u.icon,color:u.color},null,8,["name","color"])]),suffix:l.withCtx(()=>[l.createElementVNode("span",pA,l.toDisplayString(u.tips),1)]),default:l.withCtx(()=>[l.createTextVNode(" "+l.toDisplayString(o.tr(u.label)),1)]),_:2},1032,["class","onClick"])],64))),128)):(l.openBlock(),l.createElementBlock("div",fA,"No result"))]),_:1})])):r.view==="emoji"?(l.openBlock(),l.createElementBlock("section",hA)):r.view==="ai"?(l.openBlock(),l.createElementBlock("section",mA)):l.createCommentVNode("",!0)],2)}const bA=Uc(cA,[["render",gA]]),Vp={items:({query:t})=>ya.filter(e=>e.value.toLowerCase().startsWith(t.toLowerCase())),render:()=>{let t,e;return{onStart:n=>{t=new $c(bA,{props:n,editor:n.editor}),e=bn("body",{getReferenceClientRect:n.clientRect,appendTo:()=>document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start",arrow:!1,onShow:o=>{o.popper.classList.add("slash-tippy")}})},onUpdate(n){t.updateProps(n),e[0].setProps({getReferenceClientRect:n.clientRect})},onKeyDown(n){var o;return n.event.key==="Escape"?(e[0].hide(),t.destroy(),!0):(o=t.ref)==null?void 0:o.onKeyDown(n)},onExit(){e[0].destroy(),t.destroy()}}}},yA={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:Object},range:{type:Object}},setup(){const{locale:t,tr:e}=ye(),{run:n}=we();return{locale:t,tr:e,run:n}},data(){return{view:"main"}},components:{OEmojiSelect:Ea},methods:{onSelect(t){this.editor.commands.deleteRange(this.range),this.editor.commands.insertContent(t.emoji),this.editor.chain().focus()},onKeyDown({event:t}){return!1}}},vA={class:"o-colon-view"};function kA(t,e,n,o,r,i){const s=l.resolveComponent("o-emoji-select");return l.openBlock(),l.createElementBlock("section",vA,[l.createVNode(s,{items:n.items,onSelect:i.onSelect},null,8,["items","onSelect"])])}const EA=Uc(yA,[["render",kA]]),wA={items:({query:t})=>Yr.filterEmojiGroups(t),render:()=>{let t,e;return{onStart:n=>{t=new $c(EA,{props:n,editor:n.editor}),e=bn("body",{getReferenceClientRect:n.clientRect,appendTo:()=>document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start",arrow:!1,onShow(o){o.popper.classList.add("emoji-tippy")}})},onUpdate(n){t.updateProps(n),e[0].setProps({getReferenceClientRect:n.clientRect})},onKeyDown(n){var o;return n.event.key==="Escape"?(e[0].hide(),t.destroy(),!0):(o=t.ref)==null?void 0:o.onKeyDown(n)},onExit(){e[0].destroy(),t.destroy()}}}},CA={BackColor:OM.configure({multicolor:!0}),Focus:MM,ForeColor:RM,FontFamily:AM,Image:IM,Link:Pg,TextAlign:$M.configure({types:["heading","paragraph"]}),TaskItem:LM,TaskList:PM.configure({itemTypeName:"taskItem"}),Underline:lA,Typography:aA,OColon:qm.configure({suggestion:wA}),OSlash:Um.configure({suggestion:Vp}),OSlashZh:Wm.configure({suggestion:Vp}),OBlockquote:Km,OCallout:jm,OCodeBlock:_g,OColorHighlighter:Nm,OHeading:Sg,OHorizontalRule:xg,OImage:Ng,OLink:$g.configure({openOnClick:!1}),OParagraph:Fg,OTrailingNode:zm,OUniqueID:Hm.configure({attributeName:"data-id",enableRender:!1,types:["blockquote","codeBlock","callout","heading","image","paragraph","table-wrapper","video"]}),OVideo:Wg};class _A{constructor(e){return CA[e]}}const SA=[qg,Vm.configure({resizable:!0}),Jg,Ug,zg];Fm.configure({resizable:!0});const xA=["data-theme"],Xg=l.defineComponent({name:"YiiEditor",__name:"YiiEditor",props:{content:{type:[String,Object],default:""},editable:{type:Boolean,default:!0},locale:{type:String,default:"en"},darkMode:{type:Boolean,default:!1},showMainMenu:{type:Boolean,default:!1},showBubbleMenu:{type:Boolean,default:!1},showFloatingMenu:{type:Boolean,default:!1},showSideMenu:{type:Boolean,default:!1},showSideNode:{type:Boolean,default:!1},extensions:{type:Array,default:()=>[]},mainMenu:{type:Array,default:()=>[]},tableMenu:{type:Array,default:()=>[]},bubbleMenu:{type:Array,default:()=>[]},floatingMenu:{type:Array,default:()=>[]},pageView:{type:String,default:"page",validator:t=>["page","full"].includes(t)}},emits:["transaction","update"],setup(t,{expose:e,emit:n}){const o=t,r=n,{tr:i}=ye(),s=l.ref(!1),a=l.ref(!0),c=l.ref("en"),d=l.ref(!1);l.provide("darkMode",s),l.provide("isEditable",a),l.provide("locale",c),l.provide("sideNode",d);const u=l.computed(()=>b()),p=j0({editable:o.editable,content:o.content,extensions:u.value,onUpdate:()=>{var w,v;const y=(w=p.value)==null?void 0:w.getJSON(),k=(v=p.value)==null?void 0:v.getHTML();r("update",{json:y,html:k})},onTransaction:({editor:y,transaction:k})=>{r("transaction",{editor:y,transaction:k})}}),f=l.computed(()=>({editor:p.value,menu:o.mainMenu})),h=l.computed(()=>({editor:p.value,menu:o.bubbleMenu})),m=l.computed(()=>({editor:p.value,menu:o.floatingMenu})),g=l.computed(()=>({editor:p.value,menu:[]}));function b(){const y=[];o.extensions.includes("OColumn")||y.push(Qh.extend({content:"heading block*"})),y.push(Tm.configure({placeholder:({editor:w,node:v,pos:_})=>{if(v.type.name==="heading"){const C=v.attrs.level;return _>0?`H${C}`:i("label.untitled")}else return v.type.name==="paragraph"?i("label.typeForCommands"):""}})),y.push(qC),y.push(HC.configure({document:!1,blockquote:o.extensions.includes("OBlockquote")?!1:{},codeBlock:!1,heading:o.extensions.includes("OHeading")?!1:{levels:[1,2,3,4,5]},paragraph:o.extensions.includes("OParagraph")?!1:{},dropcursor:{width:5,color:"skyblue",class:"yiitap-dropcursor"},horizontalRule:!1}));const k=Kg.concat(o.extensions);for(const w of k)if(typeof w=="string"){if(!Yg.includes(w))continue;switch(w){case"Table":y.push(...SA);break;default:try{const v=new _A(w);y.push(v)}catch(v){console.error(v.message)}break}}else y.push(w);return y}return l.watch(()=>o.darkMode,y=>{s.value=y}),l.watch(()=>o.locale,y=>{c.value=y}),l.watch(()=>o.editable,y=>{var k;(k=p.value)==null||k.setEditable(y),a.value=y}),l.onBeforeMount(()=>{s.value=o.darkMode,c.value=o.locale,d.value=!o.showSideMenu&&o.showSideNode}),e({editor:p,darkMode:s,locale:c}),(y,k)=>{var w,v,_;return l.openBlock(),l.createElementBlock("main",{class:"yiitap yiitap-editor","data-theme":s.value?"dark":""},[t.showMainMenu?(l.openBlock(),l.createBlock(Sm,l.mergeProps({key:0},f.value,{class:"desktop-only"}),{left:l.withCtx(()=>[l.renderSlot(y.$slots,"toolbar-left")]),right:l.withCtx(()=>[l.renderSlot(y.$slots,"toolbar-right")]),_:3},16)):l.createCommentVNode("",!0),(w=l.unref(p))!=null&&w.isEditable&&t.showBubbleMenu?(l.openBlock(),l.createBlock(wx,l.normalizeProps(l.mergeProps({key:1},h.value)),null,16)):l.createCommentVNode("",!0),(v=l.unref(p))!=null&&v.isEditable&&t.showFloatingMenu?(l.openBlock(),l.createBlock(Sx,l.normalizeProps(l.mergeProps({key:2},m.value)),null,16)):l.createCommentVNode("",!0),(_=l.unref(p))!=null&&_.isEditable&&t.showSideMenu?(l.openBlock(),l.createBlock(Px,l.normalizeProps(l.mergeProps({key:3},g.value)),null,16)):l.createCommentVNode("",!0),l.createVNode(l.unref(W0),{class:l.normalizeClass(["editor-content",`${t.pageView}-view`]),editor:l.unref(p)},null,8,["class","editor"])],8,xA)}}}),NA={installed:!1,spellcheck:!0,install(t){this.installed=!0,t.component("YiiEditor",Xg)}};exports.AddNode=hm;exports.BasicBlocks=Cr;exports.BlockMenus=Hl;exports.Blocks=ya;exports.BuiltinExtensions=Yg;exports.CommonBlocks=br;exports.DefaultBubble=ym;exports.DefaultEmbedServices=sx;exports.DefaultExtensions=Kg;exports.DefaultFloating=_m;exports.DefaultMenu=gm;exports.DragNode=mm;exports.ExtendedExtensions=Gg;exports.ImageBubble=km;exports.ImageLinkBubble=Em;exports.LinkBubble=vm;exports.MoreBubble=wm;exports.OBlockMenu=Wo;exports.OBlockPlaceholder=Vc;exports.OBlockPopover=yr;exports.OBlockToolbar=zc;exports.OBlockquote=Km;exports.OBtn=Dt;exports.OCallout=jm;exports.OCalloutColorBoard=Hc;exports.OCalloutColorDropdown=f_;exports.OCheckbox=Kc;exports.OCodeBlock=_g;exports.OColonCommand=qm;exports.OColorBoard=ka;exports.OColorHighlighter=Nm;exports.OCommandBtn=ot;exports.OCommonBtn=_s;exports.OContextMenu=va;exports.ODivider=Yt;exports.ODocToc=x_;exports.OEmojiSelect=Ea;exports.OFocus=$x;exports.OHeading=Sg;exports.OHorizontalRule=xg;exports.OIcon=oe;exports.OImage=Ng;exports.OInput=Ko;exports.OLanguageDropdown=lm;exports.OLink=$g;exports.OList=dn;exports.OListItem=Jt;exports.OMainMenu=Sm;exports.OMediaInput=qc;exports.OMenubarBtn=Re;exports.OMetaInput=Wc;exports.ONodeView=Dn;exports.OParagraph=Fg;exports.OPlaceholder=Tm;exports.OPopover=Pe;exports.OSlashCommand=Um;exports.OSlashZhCommand=Wm;exports.OTable=Vm;exports.OTableCell=zg;exports.OTableCellBackground=dm;exports.OTableGrid=cm;exports.OTableHeader=Ug;exports.OTableWrapper=qg;exports.OTextColorBoard=um;exports.OTooltip=Yn;exports.OTrailingNode=zm;exports.OUniqueID=Hm;exports.OVideo=Wg;exports.StyleBlocks=ci;exports.TableBubble=Cm;exports.TableFloating=ix;exports.TableMenu=bm;exports.TableWrapperBubble=rx;exports.TipTapExtensions=jg;exports.YiiEditor=Xg;exports.YiiEditorPlugin=NA;exports.useI18n=ye;exports.useTheme=Ei;exports.useTiptap=we;
198
+ **/const eA=/(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,tA=ze.create({name:"video",draggable:!0,addOptions(){return{inline:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},addAttributes(){return{caption:{default:"",rendered:!1},src:{default:null,parseHTML:t=>{var e;return((e=t.firstElementChild)==null?void 0:e.src)??""}}}},parseHTML(){return[{tag:"video"}]},renderHTML({node:t,HTMLAttributes:e}){return["video",{caption:t.attrs.caption},["source",_e(this.options.HTMLAttributes,e)]]},addCommands(){return{setVideo:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[va({find:eA,type:this.type,getAttributes:t=>{const[e]=t;return{src:e}}})]}}),nA={key:1,class:"video-container"},oA={key:1},rA=a.defineComponent({__name:"view",props:ct,setup(t){const e=t,{isEditable:n}=Te(),o=a.ref(!1),r=a.ref({}),i=a.ref(null),s=a.ref(!1),l=a.ref(!1),c=a.computed({get(){return e.node.attrs.caption},set(y){e.updateAttributes({caption:y})}}),u=a.computed({get(){return e.node.attrs.src},set(y){e.updateAttributes({src:y})}});function d(y){switch(o.value=!1,y.value){case"replace":b(!0);break}}function p(){s.value=!0,setTimeout(()=>{var y;(y=i.value)==null||y.focus()},0)}function f(){s.value=!1}function h(){u.value==="init"&&b(!0)}function m(y){o.value=!0,r.value=y}function g(y){u.value=y,b(!1)}function b(y){l.value=y}return a.onMounted(()=>{b(u.value==="init")}),(y,k)=>{var E;return a.openBlock(),a.createBlock(a.unref(kn),a.mergeProps(e,{class:["o-video-view",{readonly:!((E=y.editor)!=null&&E.isEditable),init:u.value==="init"}],as:"div",onContextmenu:a.withModifiers(m,["prevent"]),onClick:h}),{default:a.withCtx(()=>[a.createVNode(a.unref(Zn),{modelValue:l.value,"onUpdate:modelValue":k[1]||(k[1]=v=>l.value=v),placement:u.value==="init"?"bottom":"top"},{"popover-content":a.withCtx(()=>[a.createVNode(a.unref(Qc),{val:u.value==="init"?"":u.value,type:"video",onInput:g},null,8,["val"])]),default:a.withCtx(()=>{var v;return[u.value==="init"?(a.openBlock(),a.createBlock(a.unref(Jc),{key:0,icon:"videocam",placeholder:"Add a video"})):(a.openBlock(),a.createElementBlock("div",nA,[k[3]||(k[3]=a.createElementVNode("div",{class:"video-cover"},null,-1)),a.unref(n)?(a.openBlock(),a.createBlock(a.unref(Xc),a.mergeProps({key:0},e,{onAction:d}),{default:a.withCtx(()=>[a.createVNode(a.unref(Le),{icon:"subtitles",tooltip:"image.caption",onClick:p})]),_:1},16)):a.createCommentVNode("",!0),a.createElementVNode("video",a.mergeProps(y.node.attrs,{draggable:"true","data-drag-handle":"",controls:""}),[a.createElementVNode("source",a.normalizeProps(a.guardReactiveProps(y.node.attrs)),null,16)],16),a.createElementVNode("div",{class:"caption",onClick:p},[(v=y.editor)!=null&&v.isEditable&&s.value?(a.openBlock(),a.createBlock(a.unref(Ln),{key:0,ref_key:"captionInput",ref:i,class:"caption-input",modelValue:c.value,"onUpdate:modelValue":k[0]||(k[0]=C=>c.value=C),type:"text",placeholder:"Input caption",autosize:"",onBlur:f},null,8,["modelValue"])):(a.openBlock(),a.createElementBlock("span",oA,a.toDisplayString(c.value),1))])]))]}),_:1},8,["modelValue","placement"]),a.createVNode(a.unref(xi),{modelValue:o.value,"onUpdate:modelValue":k[2]||(k[2]=v=>o.value=v),event:r.value},{default:a.withCtx(()=>[a.createVNode(a.unref(So),a.mergeProps(e,{onAction:d}),null,16)]),_:1},8,["modelValue","event"])]),_:1},16,["class"])}}}),hb=tA.extend({addNodeView(){return pn(rA)}}),iA=["BackColor","Focus","FontFamily","ForeColor","Table","TaskItem","TaskList","TextAlign","Typography","Underline","OHorizontalRule","OSelectionDecoration","OUniqueID"],sA=["BackColor","Bold","BulletList","Code","CodeBlockLowlight","Focus","FontFamily","ForeColor","HorizontalRule","Image","Italic","Link","ListItem","Mention","OrderedList","Strike","Table","TaskItem","TaskList","TextAlign","Typography","Underline"],aA=["OAiBlock","OBlockquote","OCallout","OCharCommand","OCodeBlock","OColon","OColorHighlighter","OFocus","OHeading","OHorizontalRule","OImage","OLink","OParagraph","OSelectionDecoration","OSlash","OSlashZh","OTableWrapper","OTrailingNode","OUniqueID","OVideo"],lA=[...sA,...aA],cA=[Kc,qm,Km,Wm,jm,pu,Zx,og,rg,ig,sg,ag,hu,vm,Ng,Tg,wg,Og,RT,sb,ab,lb,cb,ub,Eg,_g,Cg,db,pb,fb,Sg,xg,hb],lc=t=>Xw(t,cA),uA={key:0,class:"o-ai-menu"},dA={key:0,class:"o-scroll"},pA={class:"view-main"},fA={key:1,class:"view-output"},hA={class:"action-container"},mA={class:"actions"},gA={key:0,class:"o-scroll"},bA=["innerHTML"],yA={class:"ai-io-panel"},vA={class:"o-flex o-item-center actions"},mb=a.defineComponent({__name:"OAiMenu",props:{editor:{type:Zt,required:!0},menuClass:{type:String,default:""}},emits:["confirm"],setup(t,{emit:e}){const n=t,o=e,{md:r,aiOption:i,createStreamingChatCompletion:s}=Yc(),{languageName:l,tr:c}=ge(),u=a.ref(),d=a.ref(!1),p=a.ref(""),f=a.ref(""),h=a.ref("main"),m=a.ref(""),g=a.ref(!1),b=a.ref(!1),y=a.computed(()=>({role:"system",content:Gc.writing.replace("[LANGUAGE]",l.value)})),k=a.ref([{role:"system",content:"You are an assistant. Please answer in [LANGUAGE]."}]),E=a.computed(()=>wm.filter($=>$.value.indexOf(p.value)>=0));function v(){const{from:$,to:U}=n.editor.state.selection;return n.editor.state.doc.textBetween($,U,"")}function C(){setTimeout(()=>{d.value=!0},0)}function _($,U){switch(U&&(d.value=!0),m.value=$.options.prompt.replaceAll("[CONTENT]",v()),$.value){case"translate":m.value=m.value.replace("[LANGUAGE]",U.value);break;case"change_tone":m.value=m.value.replace("[TONE]",U.value);break}return p.value=c($.label),N(),!0}function R(){var $;G(),($=u.value)==null||$.focus()}function B(){const $=lc(f.value);let U=0;for(const q of $.content){const ee=An.fromJSON(n.editor.schema,q);U+=ee.nodeSize}n.editor.chain().focus().deleteSelection().insertContent($.content).setTextSelection({from:n.editor.state.selection.from,to:n.editor.state.selection.from+U+1}).run(),G(),d.value=!1,setTimeout(()=>{o("confirm")},0)}function N(){h.value="output",g.value=!0,b.value?z():M()}async function M(){let $="";k.value.push({role:"user",content:m.value}),k.value[0].role==="system"&&(k.value.shift(),k.value.unshift(y.value));try{const U=await s(k.value,q=>{$+=q,k.value=[...k.value.slice(0,-1),{role:"assistant",content:$}],f.value=r.render($)})}catch(U){k.value.pop(),console.error(U),tu.error(c("ai.error"))}g.value=!1}async function z(){let $="";for(const U of Um)await new Promise(q=>setTimeout(q,500)),$+=U,f.value=r.render($);g.value=!1}function G(){h.value="main",f.value="",p.value=""}return a.onMounted(()=>{setTimeout(()=>{var $;($=u.value)==null||$.focus(),d.value=!0},300)}),($,U)=>t.editor?(a.openBlock(),a.createElementBlock("section",uA,[a.createVNode(a.unref(Zn),{modelValue:d.value,"onUpdate:modelValue":U[1]||(U[1]=q=>d.value=q),placement:"bottom-start","tippy-class":"ai-menu-popover","content-class":""},{"popover-content":a.withCtx(()=>[h.value==="main"?(a.openBlock(),a.createElementBlock("div",dA,[a.createElementVNode("section",pA,[a.createVNode(a.unref(Ea),{items:E.value,onSelect:_,"use-keyboard":d.value},null,8,["items","use-keyboard"])])])):a.createCommentVNode("",!0),h.value==="output"?(a.openBlock(),a.createElementBlock("section",fA,[a.createElementVNode("div",hA,[a.createElementVNode("div",null,[a.createVNode(a.unref(re),{name:"auto_awesome",class:"o-tips"})]),a.createElementVNode("div",mA,[a.createVNode(a.unref(yn),{icon:"arrow_back","icon-class":"rotate-90",tooltip:"Confirm",loading:g.value,onClick:B},null,8,["loading"]),g.value?a.createCommentVNode("",!0):(a.openBlock(),a.createBlock(a.unref(yn),{key:0,icon:"close",tooltip:"Cancel",onClick:R}))])]),f.value?(a.openBlock(),a.createElementBlock("div",gA,[a.createElementVNode("div",{class:"tiptap output",innerHTML:f.value},null,8,bA)])):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0)]),default:a.withCtx(()=>[a.createElementVNode("section",yA,[a.createVNode(a.unref(Ln),{ref_key:"inputRef",ref:u,class:"caption-input",modelValue:p.value,"onUpdate:modelValue":U[0]||(U[0]=q=>p.value=q),type:"text",placeholder:a.unref(c)("ai.askAi"),autofocus:"",onFocus:C},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{name:"auto_awesome",class:"o-tips"})]),suffix:a.withCtx(()=>[a.createElementVNode("div",vA,[a.createVNode(a.unref(yn),{icon:"keyboard_return",tooltip:"Submit"})])]),_:1},8,["modelValue","placeholder"])])]),_:1},8,["modelValue"])])):a.createCommentVNode("",!0)}}),kA={key:0,class:"spinner"},yn=a.defineComponent({__name:"OCommonBtn",props:{icon:{type:String,default:""},color:{type:String,default:""},background:{type:String,default:""},tooltip:{type:String,default:""},placement:{type:String,default:"top"},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},contentClass:{type:[String,Object],default:""},contentStyle:{type:[String,Object],default:""},iconClass:{type:[String,Object],default:""}},emits:["click"],setup(t,{emit:e}){const n=t,o=e;function r(){n.loading||o("click")}return(i,s)=>(a.openBlock(),a.createBlock(a.unref(Qn),{placement:t.placement},{trigger:a.withCtx(()=>[a.createElementVNode("div",{class:a.normalizeClass(["o-menubar-btn o-command-btn o-btn",t.contentClass]),style:a.normalizeStyle(t.contentStyle),onClick:a.withModifiers(r,["stop"])},[t.loading?(a.openBlock(),a.createElementBlock("div",kA)):(a.openBlock(),a.createBlock(a.unref(re),{key:1,name:t.icon,color:t.color,class:a.normalizeClass(t.iconClass)},null,8,["name","color","class"])),a.renderSlot(i.$slots,"default")],6)]),default:a.withCtx(()=>[a.createTextVNode(" "+a.toDisplayString(t.tooltip),1)]),_:3},8,["placement"]))}}),wA=a.defineComponent({__name:"OAiBtn",props:{name:{type:String,default:""},editor:{type:Object}},setup(t){const{tr:e}=ge();return(n,o)=>(a.openBlock(),a.createBlock(yn,{"content-class":"o-ai-btn",icon:"auto_awesome",color:a.unref(me).purple,tooltip:a.unref(e)("ai.askAi")},null,8,["color","tooltip"]))}}),EA=a.defineComponent({__name:"OAlignDropdown",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),r=a.ref(null),i=a.computed(()=>[{label:n("editor.left"),value:"left",icon:"format_align_center"},{label:n("editor.center"),value:"center",icon:"format_align_center"},{label:n("editor.right"),value:"right",icon:"format_align_right"},{label:n("editor.justify"),value:"justify",icon:"format_align_justify"}]);function s(l){var c;(c=r.value)==null||c.setShow(!1),o(e.editor,"textAlign",{textAlign:l})}return(l,c)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",size:"medium",trigger:"click","show-arrow":!1},{trigger:a.withCtx(()=>[a.createVNode(a.unref(lt),{icon:"format_align_center","content-class":"o-align-dropdown dropdown",tooltip:a.unref(n)("editor.align")},{default:a.withCtx(()=>[a.createVNode(a.unref(re),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:a.withCtx(()=>[a.createVNode(a.unref(Qt),{hoverable:"",clickable:""},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(i.value,(u,d)=>{var p;return a.openBlock(),a.createBlock(a.unref(Ut),{key:d,class:a.normalizeClass({"is-active":(p=t.editor)==null?void 0:p.isActive({textAlign:u.value})}),onClick:f=>s(u.value)},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{name:u.icon},null,8,["name"])]),suffix:a.withCtx(()=>{var f;return[(f=t.editor)!=null&&f.isActive({textAlign:u.value})?(a.openBlock(),a.createBlock(a.unref(re),{key:0,name:"done",small:""})):a.createCommentVNode("",!0)]}),default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(u.label)+" ",1)]),_:2},1032,["class","onClick"])}),128))]),_:1})]),_:1},512))}}),_A={class:"o-align-group"},CA=a.defineComponent({__name:"OAlignGroup",props:{editor:{type:Zt}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),r=a.computed(()=>[{label:n("editor.left"),value:"left",icon:"format_align_left"},{label:n("editor.center"),value:"center",icon:"format_align_center"},{label:n("editor.right"),value:"right",icon:"format_align_right"}]);function i(s){o(e.editor,"textAlign",{textAlign:s.value})}return(s,l)=>(a.openBlock(),a.createElementBlock("div",_A,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.value,(c,u)=>{var d;return a.openBlock(),a.createBlock(Le,{key:u,icon:c.icon,tooltip:c.label,"content-class":{"is-active":(d=t.editor)==null?void 0:d.isActive({textAlign:c.value})},onClick:p=>i(c)},null,8,["icon","tooltip","content-class","onClick"])}),128))]))}}),SA={class:"o-back-color-dropdown o-button-group"},xA=a.defineComponent({__name:"OBackColorDropdown",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),r=a.ref(null),i=a.ref("#ffec3d");function s(){l(i.value)}function l(c){r.value.setShow(!1),i.value=c,o(e.editor,"backColor",{color:c})}return(c,u)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:a.withCtx(()=>[a.createVNode(a.unref(Qn),{trigger:"hover"},{trigger:a.withCtx(()=>[a.createElementVNode("div",SA,[a.createVNode(a.unref(St),{icon:"ink_highlighter",class:"o-command-btn label",onClick:a.withModifiers(s,["stop"])},{default:a.withCtx(()=>[a.createElementVNode("div",{class:"indicator",style:a.normalizeStyle(`background: ${i.value}`)},null,4)]),_:1}),a.createVNode(a.unref(St),{icon:"arrow_drop_down",class:"o-command-btn"})])]),default:a.withCtx(()=>[a.createTextVNode(" "+a.toDisplayString(a.unref(n)("editor.highlightColor")),1)]),_:1})]),default:a.withCtx(()=>{var d;return[a.createVNode(a.unref(_a),{"default-color":"","default-label":a.unref(n)("editor.noColor"),"active-color":(d=t.editor)==null?void 0:d.getAttributes("highlight").color,onSelect:l},null,8,["default-label","active-color"])]}),_:1},512))}}),NA=a.defineComponent({__name:"OEmojiBtn",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),r=a.ref(null);function i(s){var l;(l=r.value)==null||l.setShow(!1),o(e.editor,"content",{content:s.emoji})}return(s,l)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn","tippy-class":"o-emoji-popover",placement:"bottom",trigger:"click",arrow:""},{trigger:a.withCtx(()=>[a.createVNode(a.unref(lt),{icon:"emoji_emotions","content-class":"o-emoji-btn",tooltip:a.unref(n)("editor.emoji")},null,8,["tooltip"])]),default:a.withCtx(()=>[a.createVNode(a.unref(Ca),{items:a.unref(ei.emojiGroups),onSelect:i,"enable-search":""},null,8,["items"])]),_:1},512))}}),TA=a.defineComponent({__name:"OFontFamilyDropdown",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),r=a.ref(null),i=a.computed(()=>[{label:n("editor.default"),value:"system-ui"},{label:"Arial",value:"Arial",separator:!0},{label:"Arial Black",value:"Arial Black"},{label:"Georgia",value:"Georgia"},{label:"Impact",value:"Impact"},{label:"Helvetica",value:"Helvetica"},{label:"Roboto",value:"Roboto"},{label:"Tahoma",value:"Tahoma"},{label:"Times New Roman",value:"Times New Roman"},{label:"Verdana",value:"Verdana"},{label:"Courier New",value:"Courier New",separator:!0},{label:"Monaco",value:"Monaco"},{label:"Monospace",value:"monospace"}]);function s(l){var c;(c=r.value)==null||c.setShow(!1),o(e.editor,"fontFamily",{fontFamily:l})}return(l,c)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:a.withCtx(()=>[a.createVNode(a.unref(lt),{icon:"format_font","content-class":"o-font-family-dropdown dropdown",tooltip:a.unref(n)("editor.fontFamily")},{default:a.withCtx(()=>[a.createVNode(a.unref(re),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:a.withCtx(()=>[a.createVNode(a.unref(Qt),{hoverable:"",clickable:""},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(i.value,(u,d)=>{var p;return a.openBlock(),a.createElementBlock(a.Fragment,{key:d},[u.separator?(a.openBlock(),a.createBlock(a.unref(Lt),{key:0})):a.createCommentVNode("",!0),a.createVNode(a.unref(Ut),{class:a.normalizeClass({"is-active":(p=t.editor)==null?void 0:p.isActive("textStyle",{fontFamily:u.value})}),onClick:f=>s(u.value)},{suffix:a.withCtx(()=>{var f;return[(f=t.editor)!=null&&f.isActive("textStyle",{fontFamily:u.value})?(a.openBlock(),a.createBlock(a.unref(re),{key:0,name:"done",small:""})):a.createCommentVNode("",!0)]}),default:a.withCtx(()=>[a.createElementVNode("span",{style:a.normalizeStyle(`font-family: ${u.value}`)},a.toDisplayString(u.label),5)]),_:2},1032,["class","onClick"])],64)}),128))]),_:1})]),_:1},512))}}),OA={class:"o-fore-color-dropdown o-button-group"},MA=a.defineComponent({__name:"OForeColorDropdown",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),r=a.ref(null),i=a.ref("#ff4d4f");function s(){l(i.value)}function l(c){var u;(u=r.value)==null||u.setShow(!1),i.value=c,o(e.editor,"foreColor",{color:c})}return(c,u)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:a.withCtx(()=>[a.createVNode(a.unref(Qn),null,{trigger:a.withCtx(()=>[a.createElementVNode("div",OA,[a.createVNode(a.unref(St),{icon:"format_color_text",class:"o-command-btn label",onClick:a.withModifiers(s,["stop"])},{default:a.withCtx(()=>[a.createElementVNode("div",{class:"indicator",style:a.normalizeStyle(`background: ${i.value}`)},null,4)]),_:1}),a.createVNode(a.unref(St),{icon:"arrow_drop_down",class:"o-command-btn"})])]),default:a.withCtx(()=>[a.createTextVNode(" "+a.toDisplayString(a.unref(n)("editor.textColor")),1)]),_:1})]),default:a.withCtx(()=>{var d;return[a.createVNode(a.unref(_a),{"default-color":"","default-label":a.unref(n)("editor.defaultColor"),"active-color":(d=t.editor)==null?void 0:d.getAttributes("textStyle").color,onSelect:l},null,8,["default-label","active-color"])]}),_:1},512))}}),AA=a.defineComponent({__name:"OHeadingDropdown",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),r=a.ref(null),i=a.computed(()=>[{label:n("editor.paragraph"),value:"paragraph",valueAlt:"",icon:"title"},{label:n("editor.heading1"),value:"heading",valueAlt:1,icon:"format_h1",separator:!0},{label:n("editor.heading2"),value:"heading",valueAlt:2,icon:"format_h2"},{label:n("editor.heading3"),value:"heading",valueAlt:3,icon:"format_h3"},{label:n("editor.heading4"),value:"heading",valueAlt:4,icon:"format_h4"},{label:n("editor.heading5"),value:"heading",valueAlt:5,icon:"format_h5"}]);function s(c){var u,d;return c.value==="heading"?(u=e.editor)==null?void 0:u.isActive(c.value,{level:c.valueAlt}):(d=e.editor)==null?void 0:d.isActive(c.value)}function l(c){var u;(u=r.value)==null||u.setShow(!1),o(e.editor,c.value,{level:c.valueAlt})}return(c,u)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:a.withCtx(()=>[a.createVNode(a.unref(lt),{icon:"format_header_pound","content-class":"o-heading-dropdown dropdown",tooltip:a.unref(n)("editor.heading")},{default:a.withCtx(()=>[a.createVNode(a.unref(re),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:a.withCtx(()=>[a.createVNode(a.unref(Qt),{hoverable:"",clickable:""},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(i.value,(d,p)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:p},[d.separator?(a.openBlock(),a.createBlock(a.unref(Lt),{key:0})):a.createCommentVNode("",!0),a.createVNode(a.unref(Ut),{class:a.normalizeClass({"is-active":s(d)}),onClick:f=>l(d)},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{name:d.icon},null,8,["name"])]),suffix:a.withCtx(()=>[s(d)?(a.openBlock(),a.createBlock(a.unref(re),{key:0,name:"done",small:""})):a.createCommentVNode("",!0)]),default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(d.label)+" ",1)]),_:2},1032,["class","onClick"])],64))),128))]),_:1})]),_:1},512))}}),RA={class:"o-list-dropdown o-button-group"},BA=a.defineComponent({__name:"OListDropdown",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),r=a.ref(null),i=a.ref();function s(){o(e.editor,i.value.value)}function l(u){r.value.setShow(!1),i.value=u,o(e.editor,u.value)}const c=a.computed(()=>[{label:n("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:n("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:n("editor.todoList"),value:"taskList",icon:"check_box"}]);return a.onMounted(()=>{i.value=c.value[0]}),(u,d)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",size:"medium",trigger:"click","show-arrow":!1},{trigger:a.withCtx(()=>[a.createVNode(a.unref(Qn),{trigger:"hover"},{trigger:a.withCtx(()=>{var p;return[a.createElementVNode("div",RA,[a.createVNode(a.unref(St),{icon:(p=i.value)==null?void 0:p.icon,class:"o-command-btn",onClick:a.withModifiers(s,["stop"])},null,8,["icon"]),a.createVNode(a.unref(St),{icon:"arrow_drop_down",class:"o-command-btn"})])]}),default:a.withCtx(()=>{var p;return[a.createTextVNode(" "+a.toDisplayString((p=i.value)==null?void 0:p.label),1)]}),_:1})]),default:a.withCtx(()=>[a.createVNode(a.unref(Qt),{hoverable:"",clickable:""},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(c.value,(p,f)=>{var h;return a.openBlock(),a.createBlock(a.unref(Ut),{key:f,class:a.normalizeClass({"is-active":(h=t.editor)==null?void 0:h.isActive(p.value)}),onClick:m=>l(p)},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{name:p.icon},null,8,["name"])]),suffix:a.withCtx(()=>{var m;return[(m=t.editor)!=null&&m.isActive(p.value)?(a.openBlock(),a.createBlock(a.unref(re),{key:0,name:"done",small:""})):a.createCommentVNode("",!0)]}),default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(p.label)+" ",1)]),_:2},1032,["class","onClick"])}),128))]),_:1})]),_:1},512))}}),DA={class:"o-list-group"},IA=a.defineComponent({__name:"OListGroup",props:{editor:{type:Zt,required:!0}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),r=a.computed(()=>[{label:n("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:n("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:n("editor.todoList"),value:"taskList",icon:"check_box"}]);function i(s){o(e.editor,s.value)}return(s,l)=>(a.openBlock(),a.createElementBlock("div",DA,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.value,(c,u)=>{var d;return a.openBlock(),a.createBlock(Le,{key:u,icon:c.icon,tooltip:c.label,"content-class":{"is-active":(d=t.editor)==null?void 0:d.isActive(c.value)},onClick:p=>i(c)},null,8,["icon","tooltip","content-class","onClick"])}),128))]))}}),LA=a.defineComponent({__name:"OLinkBtn",props:{editor:{type:Zt}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),r=a.ref(),i=a.ref(!1),s=a.ref(""),l=a.ref(!0);function c(){var f;s.value="",l.value=!0;const p=(f=e.editor)==null?void 0:f.getAttributes("link");p!=null&&p.href&&(s.value=p.href,l.value=p.target==="_blank",console.log("show",i.value,p,l.value))}function u(){var p;(p=r.value)==null||p.setShow(!1)}function d(p){var f;p?o(e.editor,"linkSet",{href:p,target:l.value?"_blank":""}):o(e.editor,"linkUnset"),(f=r.value)==null||f.setShow(!1)}return(p,f)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:"",show:i.value,"onUpdate:show":[f[1]||(f[1]=h=>i.value=h),c]},{trigger:a.withCtx(()=>{var h;return[a.createVNode(a.unref(lt),{icon:"link","content-class":{"is-active":(h=t.editor)==null?void 0:h.isActive("link")},tooltip:a.unref(n)("editor.hyperlink")},null,8,["content-class","tooltip"])]}),default:a.withCtx(()=>[i.value?(a.openBlock(),a.createBlock(a.unref(eu),{key:0,title:a.unref(n)("editor.hyperlink"),val:s.value,icon:"link",onCancel:u,onConfirm:d},{"header-right":a.withCtx(()=>[a.createVNode(a.unref(nu),{modelValue:l.value,"onUpdate:modelValue":f[0]||(f[0]=h=>l.value=h),label:a.unref(n)("link.open_in_new_tab")},null,8,["modelValue","label"])]),_:1},8,["title","val"])):a.createCommentVNode("",!0)]),_:1},8,["show"]))}}),PA=a.defineComponent({__name:"OLinkEditBtn",props:{editor:{type:Zt,required:!0}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),r=a.ref(),i=a.ref(!1),s=a.ref(""),l=a.ref(!0);function c(){var f;s.value="",l.value=!0;const p=(f=e.editor)==null?void 0:f.getAttributes("link");p!=null&&p.href&&(s.value=p.href,l.value=p.target==="_blank")}function u(){var p;(p=r.value)==null||p.setShow(!1)}function d(p){var f;p?o(e.editor,"linkSet",{href:p,target:l.value?"_blank":""}):o(e.editor,"linkUnset"),(f=r.value)==null||f.setShow(!1)}return(p,f)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:"",show:i.value,"onUpdate:show":[f[1]||(f[1]=h=>i.value=h),c]},{trigger:a.withCtx(()=>[a.createVNode(a.unref(lt),{icon:"edit",tooltip:a.unref(n)("link.edit")},null,8,["tooltip"])]),default:a.withCtx(()=>[i.value?(a.openBlock(),a.createBlock(a.unref(eu),{key:0,title:a.unref(n)("link.edit"),val:s.value,icon:"link",onCancel:u,onConfirm:d},{"header-right":a.withCtx(()=>[a.createVNode(a.unref(nu),{modelValue:l.value,"onUpdate:modelValue":f[0]||(f[0]=h=>l.value=h),label:a.unref(n)("link.open_in_new_tab")},null,8,["modelValue","label"])]),_:1},8,["title","val"])):a.createCommentVNode("",!0)]),_:1},8,["show"]))}}),$A=a.defineComponent({__name:"OLinkOpenBtn",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ge();function o(){var i;const r=(i=e.editor)==null?void 0:i.getAttributes("link");r!=null&&r.href&&window.open(r.href,"target")}return(r,i)=>(a.openBlock(),a.createBlock(Le,{icon:"open_in_new",tooltip:a.unref(n)("link.open"),"content-class":"o-link-open-btn",onClick:o},null,8,["tooltip"]))}}),FA={class:"o-command-btn"},VA={class:"o-more-bubble"},zA=a.defineComponent({__name:"OMoreBubble",props:{editor:{type:Zt,required:!0}},setup(t){const e=a.ref();return(n,o)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:e,offset:[4,10],class:"o-simple-command-btn","content-class":"o-more-bubble-popover",placement:"top-end",size:"medium",trigger:"mouseenter"},{trigger:a.withCtx(()=>[a.createElementVNode("div",FA,[a.createVNode(a.unref(re),{name:"more_horiz"})])]),default:a.withCtx(()=>[a.createElementVNode("section",VA,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(Om),(r,i)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:i},[r==="separator"?(a.openBlock(),a.createBlock(a.unref(Lt),{key:0,vertical:""})):typeof r=="string"?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(a.unref(Oa)(r)),{key:1,name:r,editor:t.editor},null,8,["name","editor"])):a.createCommentVNode("",!0)],64))),128))])]),_:1},512))}}),HA=a.defineComponent({__name:"OStyleDropdown",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),r=a.ref(null),i=a.computed(()=>[{label:n("editor.paragraph"),value:"paragraph",icon:"title"},{label:n("editor.heading1"),value:"heading",icon:"format_h1",options:{level:1}},{label:n("editor.heading2"),value:"heading",icon:"format_h2",options:{level:2}},{label:n("editor.heading3"),value:"heading",icon:"format_h3",options:{level:3}},{label:n("editor.todoList"),value:"taskList",icon:"check_box"},{label:n("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:n("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:n("editor.blockquote"),value:"blockquote",icon:"format_quote_open"},{label:n("editor.removeFormat"),value:"clearFormat",icon:"format_clear",separator:!0}]);function s(c){var u;return(u=e.editor)==null?void 0:u.isActive(c.value,c.options)}function l(c){r.value.setShow(!1),o(e.editor,c.value,c.options)}return(c,u)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click"},{trigger:a.withCtx(()=>[a.createVNode(a.unref(lt),{icon:"format_paint","content-class":"o-style-dropdown o-command-btn dropdown",tooltip:a.unref(n)("label.styles")},{default:a.withCtx(()=>[a.createVNode(a.unref(re),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:a.withCtx(()=>[a.createVNode(a.unref(Qt),{hoverable:"",clickable:""},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(i.value,(d,p)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:p},[d.separator?(a.openBlock(),a.createBlock(a.unref(Lt),{key:0})):a.createCommentVNode("",!0),a.createVNode(a.unref(Ut),{class:a.normalizeClass({"is-active":s(d)}),onClick:f=>l(d)},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{name:d.icon},null,8,["name"])]),suffix:a.withCtx(()=>[s(d)?(a.openBlock(),a.createBlock(a.unref(re),{key:0,name:"done",small:""})):a.createCommentVNode("",!0)]),default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(d.label)+" ",1)]),_:2},1032,["class","onClick"])],64))),128))]),_:1})]),_:1},512))}}),UA=a.defineComponent({__name:"OTableBtn",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),r=a.ref(null);function i(s){var l;(l=r.value)==null||l.setShow(!1),o(e.editor,"tableInsert",s)}return(s,l)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:""},{trigger:a.withCtx(()=>[a.createVNode(a.unref(lt),{icon:"window","content-class":"o-table-btn",tooltip:a.unref(n)("table.insert")},null,8,["tooltip"])]),default:a.withCtx(()=>[a.createVNode(a.unref(Im),{onSelect:i})]),_:1},512))}}),qA={class:"o-table-group"},KA=a.defineComponent({__name:"OTableGroup",props:{editor:{type:Zt,required:!0}},setup(t){const{tr:e}=ge(),{run:n}=Te();return(o,r)=>{var i,s;return a.openBlock(),a.createElementBlock("section",qA,[(i=t.editor)!=null&&i.can().mergeCells()?(a.openBlock(),a.createBlock(a.unref(Le),{key:0,icon:"cell_merge",tooltip:a.unref(e)("table.merge"),onClick:r[0]||(r[0]=l=>a.unref(n)(t.editor,"tableMergeCells"))},null,8,["tooltip"])):a.createCommentVNode("",!0),(s=t.editor)!=null&&s.can().splitCell()?(a.openBlock(),a.createBlock(a.unref(Le),{key:1,icon:"splitscreen_left",tooltip:a.unref(e)("table.split"),onClick:r[1]||(r[1]=l=>a.unref(n)(t.editor,"tableSplitCell"))},null,8,["tooltip"])):a.createCommentVNode("",!0),a.createVNode(a.unref(Lm),{editor:t.editor},null,8,["editor"])])}}}),WA=a.defineComponent({__name:"OTextColorDropdown",props:{editor:{type:Zt}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),r=a.ref(null),i=a.ref(""),s=a.ref("");function l(c,u){c==="foreColor"?(i.value=u,localStorage.setItem("yiitap.text-color.fore",u)):c==="backColor"&&(s.value=u,localStorage.setItem("yiitap.text-color.back",u)),r.value.setShow(!1),o(e.editor,c,{color:u})}return a.onMounted(()=>{i.value=localStorage.getItem("yiitap.text-color.fore")||"",s.value=localStorage.getItem("yiitap.text-color.back")||""}),(c,u)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:a.withCtx(()=>[a.createVNode(a.unref(lt),{icon:"format_text","content-class":"o-text-color-dropdown dropdown",tooltip:a.unref(n)("editor.textColor")},{default:a.withCtx(()=>[a.createVNode(a.unref(re),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:a.withCtx(()=>{var d;return[a.createVNode(a.unref(Pm),{"fore-color":i.value,"back-color":s.value,"default-label":a.unref(n)("editor.defaultColor"),"active-color":(d=t.editor)==null?void 0:d.getAttributes("textStyle").color,onSelect:l},null,8,["fore-color","back-color","default-label","active-color"])]}),_:1},512))}}),jA=a.defineComponent({__name:"OTextFormatDropdown",props:{editor:{type:Zt}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),r=a.ref(),i=a.computed(()=>[{label:n("editor.strikethrough"),value:"strike",icon:"format_strikethrough"},{label:n("editor.underline"),value:"underline",icon:"format_underlined"},{label:n("editor.code"),value:"code",icon:"code"}]);function s(l){var c;(c=r.value)==null||c.setShow(!1),o(e.editor,l)}return(l,c)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:a.withCtx(()=>[a.createVNode(a.unref(lt),{icon:"title","content-class":"o-text-format-dropdown dropdown",tooltip:a.unref(n)("editor.textFormat")},{default:a.withCtx(()=>[a.createVNode(a.unref(re),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:a.withCtx(()=>[a.createVNode(a.unref(Qt),{hoverable:"",clickable:""},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(i.value,(u,d)=>{var p;return a.openBlock(),a.createBlock(a.unref(Ut),{key:d,class:a.normalizeClass({"is-active":(p=t.editor)==null?void 0:p.isActive(u.value)}),onClick:f=>s(u.value)},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{name:u.icon},null,8,["name"])]),suffix:a.withCtx(()=>{var f;return[(f=t.editor)!=null&&f.isActive(u.value)?(a.openBlock(),a.createBlock(a.unref(re),{key:0,name:"done",small:""})):a.createCommentVNode("",!0)]}),default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(u.label)+" ",1)]),_:2},1032,["class","onClick"])}),128))]),_:1})]),_:1},512))}}),GA={ai:wA,"align-dropdown":EA,"align-group":CA,"back-color":xA,"font-family":TA,"fore-color":MA,heading:AA,"list-dropdown":BA,"list-group":IA,link:LA,"link-edit":PA,"link-open":$A,emoji:NA,more:zA,"style-dropdown":HA,table:UA,"table-group":KA,"text-color-dropdown":WA,"text-format-dropdown":jA},Oa=t=>GA[t]||SC,YA={class:"o-main-menu"},JA={class:"left"},XA={class:"right"},gb=a.defineComponent({__name:"OMainMenu",props:{editor:{type:Object},menu:{type:Array,default:function(){return[]}}},setup(t){const e=t,n=a.computed(()=>{var r;let o=e.menu;return(r=e.editor)!=null&&r.isActive("table")&&(o=Cm),o.length>0?o:_m});return(o,r)=>(a.openBlock(),a.createElementBlock("section",YA,[a.createElementVNode("section",JA,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.value,(i,s)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:s},[i==="separator"?(a.openBlock(),a.createBlock(a.unref(Lt),{key:0,vertical:""})):typeof i=="string"?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(a.unref(Oa)(i)),{key:1,name:i,editor:t.editor},null,8,["name","editor"])):(a.openBlock(),a.createBlock(a.resolveDynamicComponent(i),{key:2,editor:t.editor},null,8,["editor"]))],64))),128)),a.renderSlot(o.$slots,"left")]),a.createElementVNode("section",XA,[a.renderSlot(o.$slots,"right")])]))}}),ZA={key:0},QA={key:1,class:"container"},eR=a.defineComponent({__name:"OBubbleMenu",props:{editor:{type:Zt},menu:{type:Array,default:function(){return[]}},tableToolbar:{type:Array,default:function(){return[]}},menuClass:{type:String,default:""}},setup(t){const e=t,{tr:n}=ge(),{theme:o}=xr(),r=a.ref(!1),i=a.ref(!1),s=a.ref(!1),l=a.ref({duration:100,placement:"bottom-start",role:"popover",trigger:"manual",arrow:!1,onShow:()=>{r.value=!1,i.value=!1,s.value=!1},onHide:()=>{s.value=!1}});function c(){r.value=!0}function u(b){b==="ai"&&(i.value=!0)}function d(){s.value=!0}function p(b){const{schema:y}=e.editor,k=y.marks.link;if(!k||!b)return!1;const{$from:E,$to:v}=b;return!!Cr(E,k)}function f({editor:b,element:y,view:k,state:E,oldState:v,from:C,to:_}){var q;const{doc:R,selection:B}=E,{empty:N}=B,M=!R.textBetween(C,_).length&&ga(E.selection);if(!k.hasFocus()||N||s.value||M&&b.isActive("link")&&!b.isActive("image"))return!1;const z=["image"],G=["toc","video","model-viewer"],$=B.node,U=(q=$==null?void 0:$.type)==null?void 0:q.name;return!(b.isActive("codeBlock")||G.indexOf(U)>=0||U&&!z.includes(U))}const h=a.computed(()=>{if(e.editor){const{state:b}=e.editor,{tr:y}=b,{selection:k}=y;return p(k)}else return!1}),m=a.computed(()=>{var b;return!r.value&&h.value&&!((b=e.editor)!=null&&b.isActive("image"))}),g=a.computed(()=>{var y,k;let b=e.menu;return r.value||((y=e.editor)!=null&&y.isActive("image")?b=h.value?Tm:Nm:(k=e.editor)!=null&&k.isActive("table")?b=Mm:h.value&&(b=xm)),b.length>0?b:Sm});return a.onMounted(()=>{r.value=!1}),(b,y)=>t.editor?(a.openBlock(),a.createElementBlock("section",ZA,[a.createVNode(a.unref(h_),{class:a.normalizeClass(["o-bubble-menu",t.menuClass]),editor:t.editor,"should-show":f,"tippy-options":l.value},{default:a.withCtx(()=>[i.value?(a.openBlock(),a.createBlock(a.unref(mb),{key:0,editor:t.editor,onConfirm:d},null,8,["editor"])):(a.openBlock(),a.createElementBlock("section",QA,[m.value?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createVNode(a.unref(Le),{icon:"arrow_back",tooltip:a.unref(n)("link.back"),onClick:c},null,8,["tooltip"]),a.createVNode(a.unref(Lt),{vertical:""})],64)):a.createCommentVNode("",!0),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(g.value,(k,E)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:E},[k==="separator"?(a.openBlock(),a.createBlock(a.unref(Lt),{key:0,vertical:""})):typeof k=="string"?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(a.unref(Oa)(k)),{key:1,name:k,editor:t.editor,onClick:v=>u(k)},null,8,["name","editor","onClick"])):(a.openBlock(),a.createBlock(a.resolveDynamicComponent(k),{key:2,editor:t.editor},null,8,["editor"]))],64))),128))]))]),_:1},8,["class","editor","tippy-options"])])):a.createCommentVNode("",!0)}}),tR={key:0},nR={class:"container"},oR=a.defineComponent({__name:"OFloatingMenu",props:{editor:{type:cm},menu:{type:Array,default:function(){return[]}},tableToolbar:{type:Array,default:function(){return[]}},menuClass:{type:String,default:""}},setup(t){const e=t,n=a.ref(!1),o=a.ref({arrow:!1,duration:100,role:"popover",placement:"right",offset:[0,168]});function r(){n.value=!0}function i(u){const{schema:d}=e.editor,p=d.marks.link;if(!p||!u)return!1;const{$from:f,$to:h}=u;return!!Cr(f,p)}const s=a.computed(()=>{if(e.editor){const{state:u}=e.editor,{tr:d}=u,{selection:p}=d;return i(p)}else return!1}),l=a.computed(()=>!n.value&&s.value),c=a.computed(()=>{let u=e.menu;return u.length>0?u:Am});return(u,d)=>t.editor?(a.openBlock(),a.createElementBlock("section",tR,[a.createVNode(a.unref(g_),{class:a.normalizeClass(["o-floating-menu",t.menuClass]),editor:t.editor,"tippy-options":o.value},{default:a.withCtx(()=>[a.createElementVNode("section",nR,[l.value?(a.openBlock(),a.createBlock(a.unref(Le),{key:0,icon:"arrow_back",onClick:r})):a.createCommentVNode("",!0),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(c.value,(p,f)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:f},[p==="separator"?(a.openBlock(),a.createBlock(a.unref(Lt),{key:0,vertical:""})):typeof p=="string"?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(a.unref(Oa)(p)),{key:1,name:p,editor:t.editor},null,8,["name","editor"])):(a.openBlock(),a.createBlock(a.resolveDynamicComponent(p),{key:2,editor:t.editor},null,8,["editor"]))],64))),128))])]),_:1},8,["class","editor","tippy-options"])])):a.createCommentVNode("",!0)}});function ku(t,e){const n=e==null?void 0:e.posAtCoords(t);if(!n)return;let o=ps(n.pos,e);if(o!==e.dom){for(;o&&o.parentNode&&o.parentNode!==e.dom;)o=o.parentNode;if(o)return o}}function ps(t,e){return e.nodeDOM(t)||e.domAtPos(t).node}function wu(t,e){const n=ku(t,e);if(n&&n.nodeType===1){const o=e.docView,r=o.nearestDesc(n,!0);return!r||r===o?null:r.posBefore}return null}function rR(t,e){let n,o;const r=e.resolve(t.from).node().type.spec.group==="blockContent",i=e.resolve(t.to).node().type.spec.group==="blockContent",s=Math.min(t.$anchor.depth,t.$head.depth);if(r&&i){const l=t.$from.start(s-1),c=t.$to.end(s-1);n=e.resolve(l-1).pos,o=e.resolve(c+1).pos}else n=t.from,o=t.to;return{from:n,to:o}}function iR(t,e){const n=wu(t,e.view);return n&&n>=0?{node:e.state.doc.nodeAt(n),pos:n}:{node:null,pos:n}}const ra=new xe("sideMenu");class sR{constructor(){Je(this,"hovered",!1);Je(this,"coords",{left:0,top:0});Je(this,"className","")}init(e){return this}apply({tr:e,oldState:n,newState:o}){return e.docChanged?this:this}setHover(e,n,o=""){this.hovered=e,this.coords=n,this.className=o}}class aR{constructor({editor:e,element:n,view:o,tippyOptions:r={},updateDelay:i=250}){Je(this,"editor");Je(this,"element");Je(this,"view");Je(this,"preventHide",!1);Je(this,"tippy");Je(this,"tippyOptions");Je(this,"updateDelay");Je(this,"updateDebounceTimer");Je(this,"mousedownHandler",()=>{this.preventHide=!0});Je(this,"onDragStart",e=>{this.hide()});Je(this,"blurHandler",({event:e})=>{var n;e!=null&&e.relatedTarget&&((n=this.element.parentNode)!=null&&n.contains(e.relatedTarget))||this.hide()});Je(this,"tippyBlurHandler",e=>{this.blurHandler({event:e})});Je(this,"handleDebouncedUpdate",(e,n)=>{const o=!(n!=null&&n.selection.eq(e.state.selection)),r=!(n!=null&&n.doc.eq(e.state.doc));!o&&!r||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,o,r,n)},this.updateDelay))});Je(this,"updateHandler",(e,n,o,r)=>{var d,p;const{state:i,composing:s}=e,{coords:l}=ra.getState(i),c=ku(l,e),u=wu(l,e);!c||u<=0||(this.createTooltip(),(p=this.tippy)==null||p.setProps({getReferenceClientRect:((d=this.tippyOptions)==null?void 0:d.getReferenceClientRect)||(()=>c.getBoundingClientRect())}),this.show())});this.editor=e,this.element=n,this.view=o,this.updateDelay=i,this.view.dom.addEventListener("dragstart",this.onDragStart),this.tippyOptions=r,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=dn(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"left",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){const{state:o}=e,r=!(n!=null&&n.selection.eq(e.state.selection)),i=!(n!=null&&n.doc.eq(e.state.doc));this.updateHandler(e,r,i,n)}show(){var e;(e=this.tippy)==null||e.show()}hide(){var e;(e=this.tippy)==null||e.hide()}destroy(){var e,n;(e=this.tippy)!=null&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)==null||n.destroy(),this.view.dom.removeEventListener("dragstart",this.onDragStart)}}const lR=(t,e)=>{if(!t.dataTransfer)return;const n=e.view,o=n.dom.getBoundingClientRect(),r={left:o.left+o.width/2,top:t.clientY},i=wu(r,n);if(i===null)return;const s=n.state.selection,l=n.state.doc;rR(s,l),n.dispatch(n.state.tr.setSelection(oe.create(n.state.doc,i))),uR(n,i);const c=n.state.selection.content(),{dom:u,text:d}=n.serializeForClipboard(c);t.dataTransfer.clearData(),t.dataTransfer.setData("text/html",u.innerHTML),t.dataTransfer.setData("text/plain",d),t.dataTransfer.effectAllowed="move",t.dataTransfer.setDragImage(Ho,0,0),n.dragging={slice:c,move:!0}},cR=(t,e)=>{bb()};let Ho;function uR(t,e,n=e){const o=t.domAtPos(e).node.cloneNode(!0),r=t.domAtPos(e).node,i=(p,f)=>Array.prototype.indexOf.call(p.children,f),s=p=>{let f=p,h=f.parentElement;for(;h;){if(h===t.dom)return f;f=h,h=f.parentElement}return f};let l=-1,c=-1;e===n?(l=i(r,s(ps(e,t))),c=l):(l=i(r,s(ps(e+1,t))),c=i(r,s(ps(n-1,t))));for(let p=r.childElementCount-1;p>=0;p--)(p>l||p<c)&&o.removeChild(o.children[p]);bb(),Ho=o;const d=t.dom.className.split(" ").filter(p=>p!=="ProseMirror"&&p!=="yiitap-root"&&p!=="yiitap-editor").join(" ");Ho.className+=" yiitap-dragging-preview "+d,document.body.appendChild(Ho)}function bb(){Ho!==void 0&&(document.body.removeChild(Ho),Ho=void 0)}class dR{constructor(e){Je(this,"options");Je(this,"plugin");Je(this,"sideMenuView");const n=new sR;this.options=e,this.plugin=new Ae({key:ra,props:{handleDOMEvents:{mouseover(o,r){const i={left:r.clientX,top:r.clientY},s=ku(i,o),l=(s==null?void 0:s.className)||"",c=n.className;l.indexOf("o-table-wrapper-view")>=0&&c.indexOf("o-table-wrapper-view")>=0||(n.setHover(!0,i,l),o.dispatch(o.state.tr.setMeta(ra,n)))}}},state:{init(o,r){return n.init(r)},apply(o,r,i,s){return n.apply({tr:o,oldState:i,newState:s})}},view:o=>(this.sideMenuView=new aR({view:o,...e}),this.sideMenuView)})}dragstart(e){lR(e,this.options.editor)}dragend(e){cR(e,this.options.editor)}}const pR=a.defineComponent({name:"SideMenu",props:{pluginKey:{type:[String,Object],default:"sideMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},tippyOptions:{type:Object,default:()=>({})}},setup(t,{expose:e,slots:n}){const o=a.ref(null),r=a.ref(),i=l=>{var c;(c=r.value)==null||c.dragstart(l)},s=l=>{var c;(c=r.value)==null||c.dragend(l)};return a.onMounted(()=>{const{pluginKey:l,editor:c,updateDelay:u,tippyOptions:d}=t;r.value=new dR({updateDelay:u,editor:c,element:o.value,pluginKey:l,tippyOptions:d}),c.registerPlugin(r.value.plugin)}),a.onBeforeUnmount(()=>{const{pluginKey:l,editor:c}=t;c.unregisterPlugin(l)}),e({...t,dragstart:i,dragend:s}),()=>{var l;return a.h("div",{ref:o},(l=n.default)==null?void 0:l.call(n))}}}),fR={key:0,class:"o-side-menu"},hR={class:"container"},mR=a.defineComponent({__name:"OSideMenu",props:{editor:{type:Zt,required:!0},menuClass:{type:String,default:""}},setup(t){const e=t,n=a.ref(null),o=a.ref(null),r=a.ref(0),i=a.computed(()=>({arrow:!1,duration:100,placement:"left"})),s=a.computed(()=>({editor:e.editor,node:o.value,decorations:[],selected:!1,extension:{},getPos:()=>r.value,pos:r.value,updateAttributes:c,deleteNode:l,view:void 0,innerDecorations:[],HTMLAttributes:void 0}));function l(){var m,g;const f=r.value,h=f+((m=o.value)==null?void 0:m.nodeSize);(g=e.editor)==null||g.commands.deleteRange({from:f,to:h})}function c(f){var h;(h=e.editor)==null||h.commands.command(({tr:m})=>{var g;return m.setNodeMarkup(r.value,void 0,{...(g=o.value)==null?void 0:g.attrs,...f}),!0})}function u({editor:f,transaction:h}){let m={left:0,top:0};const g=ra.getState(e.editor.view.state);if(g){m=g.coords;const b=iR(m,f);b.node&&b.pos>0&&(o.value=b.node,r.value=b.pos)}}function d(f){var h;(h=n.value)==null||h.dragstart(f)}function p(f){var h;(h=n.value)==null||h.dragend(f)}return a.onMounted(()=>{var f;(f=e.editor)==null||f.on("transaction",u)}),(f,h)=>t.editor?(a.openBlock(),a.createElementBlock("section",fR,[a.createVNode(a.unref(pR),{ref_key:"menu",ref:n,class:a.normalizeClass(["side-menu",t.menuClass]),editor:t.editor,"tippy-options":i.value},{default:a.withCtx(()=>[a.createElementVNode("section",hR,[o.value?(a.openBlock(),a.createBlock(a.unref(Vm),a.normalizeProps(a.mergeProps({key:0},s.value)),null,16)):a.createCommentVNode("",!0),o.value?(a.openBlock(),a.createBlock(a.unref(zm),a.mergeProps({key:1},s.value,{onDragstart:d,onDragend:p}),null,16)):a.createCommentVNode("",!0)])]),_:1},8,["class","editor","tippy-options"])])):a.createCommentVNode("",!0)}}),gR={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:Object},range:{type:Object}},setup(){const{locale:t,tr:e}=ge(),{onCommand:n}=Te();return{locale:t,tr:e,onCommand:n}},data(){return{view:"main",selectedIndex:0}},components:{ODivider:Lt,OIcon:re,OList:Qt,OListItem:Ut},watch:{items(){this.selectedIndex=0}},methods:{onClick(t){switch(t.value){default:this.run(t);break}return!0},run(t){const e=this.editor.chain().focus().deleteRange(this.range),n=this.editor.commands;switch(t.value){case"codeBlock":n.deleteRange(this.range),this.editor.commands.setCodeBlock({language:"bash"});break;case"content":n.deleteRange(this.range),this.editor.commands.insertContent(t.options.content);break;case"emoji":n.deleteRange(this.range),this.editor.commands.insertContent(":");break;case"taskList":n.deleteRange(this.range),this.editor.commands.toggleTaskList();break;default:this.onCommand(n,e,t.value,t.options);break}},onKeyDown({event:t}){return t.key==="ArrowUp"?(this.upHandler(),!0):t.key==="ArrowDown"?(this.downHandler(),!0):t.key==="Enter"?(this.enterHandler(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length},enterHandler(){this.selectItem(this.selectedIndex)},selectItem(t){const e=this.items[t];e&&this.onClick(e)},setEmoji(t){this.onClick({value:"content",options:{content:t}})}},computed:{basicBlocks(){return Sr.slice(1)}},mounted(){this.selectedIndex=0}},yb=(t,e)=>{const n=t.__vccOpts||t;for(const[o,r]of e)n[o]=r;return n},bR={key:0,class:"view-main"},yR={class:"group o-tips"},vR={class:"o-tips"},kR={key:1,class:"item"},wR={key:1,class:"view-emoji"},ER={key:2,class:"view-emoji"};function _R(t,e,n,o,r,i){const s=a.resolveComponent("o-divider"),l=a.resolveComponent("o-icon"),c=a.resolveComponent("o-list-item"),u=a.resolveComponent("o-list");return a.openBlock(),a.createElementBlock("section",{class:a.normalizeClass(["o-slash-view o-shadow-3 o-menu o-scroll",`view-${r.view}`])},[r.view==="main"?(a.openBlock(),a.createElementBlock("section",bR,[a.createVNode(u,{hoverable:"",clickable:""},{default:a.withCtx(()=>[n.items.length?(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:0},a.renderList(n.items,(d,p)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:p},[d.group?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[p>0?(a.openBlock(),a.createBlock(s,{key:0})):a.createCommentVNode("",!0),a.createElementVNode("div",yR,a.toDisplayString(o.tr(d.group)),1)],64)):a.createCommentVNode("",!0),a.createVNode(c,{class:a.normalizeClass(["item",{"is-active":p===r.selectedIndex}]),clickable:"",onClick:f=>i.onClick(d)},{prefix:a.withCtx(()=>[a.createVNode(l,{name:d.icon,color:d.color},null,8,["name","color"])]),suffix:a.withCtx(()=>[a.createElementVNode("span",vR,a.toDisplayString(d.tips),1)]),default:a.withCtx(()=>[a.createTextVNode(" "+a.toDisplayString(o.tr(d.label)),1)]),_:2},1032,["class","onClick"])],64))),128)):(a.openBlock(),a.createElementBlock("div",kR,"No result"))]),_:1})])):r.view==="emoji"?(a.openBlock(),a.createElementBlock("section",wR)):r.view==="ai"?(a.openBlock(),a.createElementBlock("section",ER)):a.createCommentVNode("",!0)],2)}const CR=yb(gR,[["render",_R]]),Xp={items:({query:t})=>wa.filter(e=>e.value.toLowerCase().startsWith(t.toLowerCase())),render:()=>{let t,e;return{onStart:n=>{t=new qc(CR,{props:n,editor:n.editor}),n.clientRect&&(e=dn("body",{getReferenceClientRect:n.clientRect,appendTo:()=>document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start",arrow:!1,onShow:o=>{o.popper.classList.add("slash-tippy")}}))},onUpdate(n){t.updateProps(n),e[0].setProps({getReferenceClientRect:n.clientRect})},onKeyDown(n){var o;return n.event.key==="Escape"?(e[0].hide(),t.destroy(),!0):(o=t.ref)==null?void 0:o.onKeyDown(n)},onExit(){e[0].destroy(),t.destroy()}}}},SR={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:Object},range:{type:Object}},setup(){const{locale:t,tr:e}=ge(),{run:n}=Te();return{locale:t,tr:e,run:n}},data(){return{view:"main"}},components:{OEmojiSelect:Ca},methods:{onSelect(t){this.editor.commands.deleteRange(this.range),this.editor.commands.insertContent(t.emoji),this.editor.chain().focus()},onKeyDown({event:t}){return!1}}},xR={class:"o-colon-view"};function NR(t,e,n,o,r,i){const s=a.resolveComponent("o-emoji-select");return a.openBlock(),a.createElementBlock("section",xR,[a.createVNode(s,{items:n.items,onSelect:i.onSelect},null,8,["items","onSelect"])])}const TR=yb(SR,[["render",NR]]),OR={items:({query:t})=>ei.filterEmojiGroups(t),render:()=>{let t,e;return{onStart:n=>{t=new qc(TR,{props:n,editor:n.editor}),n.clientRect&&(e=dn("body",{getReferenceClientRect:n.clientRect,appendTo:()=>document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start",arrow:!1,onShow(o){o.popper.classList.add("emoji-tippy")}}))},onUpdate(n){t.updateProps(n),e[0].setProps({getReferenceClientRect:n.clientRect})},onKeyDown(n){var o;return n.event.key==="Escape"?(e[0].hide(),t.destroy(),!0):(o=t.ref)==null?void 0:o.onKeyDown(n)},onExit(){e[0].destroy(),t.destroy()}}}},MR={BackColor:qm.configure({multicolor:!0}),Focus:Km,ForeColor:jm,FontFamily:Wm,Image:Sx,Link:pu,TextAlign:ig.configure({types:["heading","paragraph"]}),TaskItem:og,TaskList:rg.configure({itemTypeName:"taskItem"}),Underline:ag,Typography:sg,OAiBlock:Ng,OColon:BT.configure({suggestion:OR}),OSlash:DT.configure({suggestion:Xp}),OSlashZh:IT.configure({suggestion:Xp}),OBlockquote:Tg,OCallout:Og,OCodeBlock:sb,OColorHighlighter:wg,OHeading:ab,OHorizontalRule:lb,OImage:cb,OLink:KM.configure({openOnClick:!1}),OParagraph:ub,OSelectionDecoration:_g,OTrailingNode:Sg,OUniqueID:xg.configure({attributeName:"data-id",enableRender:!1,types:["blockquote","codeBlock","callout","heading","image","paragraph","table-wrapper","video"]}),OVideo:hb};class AR{constructor(e){return MR[e]}}const RR=[fb,Cg.configure({resizable:!0}),hu,pb,db];yg.configure({resizable:!0});const BR=["data-theme"],vb=a.defineComponent({name:"YiiEditor",__name:"YiiEditor",props:{content:{type:[String,Object],default:""},editable:{type:Boolean,default:!0},locale:{type:String,default:"en"},darkMode:{type:Boolean,default:!1},showMainMenu:{type:Boolean,default:!1},showBubbleMenu:{type:Boolean,default:!1},showFloatingMenu:{type:Boolean,default:!1},showSideMenu:{type:Boolean,default:!1},showSideNode:{type:Boolean,default:!1},extensions:{type:Array,default:()=>[]},mainMenu:{type:Array,default:()=>[]},tableMenu:{type:Array,default:()=>[]},bubbleMenu:{type:Array,default:()=>[]},floatingMenu:{type:Array,default:()=>[]},pageView:{type:String,default:"page",validator:t=>["page","full"].includes(t)},aiOption:{type:Object,default:()=>{}}},emits:["transaction","update"],setup(t,{expose:e,emit:n}){const o=t,r=n,{tr:i}=ge(),s=a.ref(!1),l=a.ref(!0),c=a.ref("en"),u=a.ref(!1),d=a.ref();a.provide("darkMode",s),a.provide("isEditable",l),a.provide("locale",c),a.provide("sideNode",u),a.provide("aiOption",d);const p=a.computed(()=>y()),f=b_({editable:o.editable,content:o.content,extensions:p.value,onUpdate:()=>{var v,C;const k=(v=f.value)==null?void 0:v.getJSON(),E=(C=f.value)==null?void 0:C.getHTML();r("update",{json:k,html:E})},onTransaction:({editor:k,transaction:E})=>{r("transaction",{editor:k,transaction:E})}}),h=a.computed(()=>({editor:f.value,menu:o.mainMenu})),m=a.computed(()=>({editor:f.value,menu:o.bubbleMenu})),g=a.computed(()=>({editor:f.value,menu:o.floatingMenu})),b=a.computed(()=>({editor:f.value,menu:[]}));function y(){const k=[];o.extensions.includes("OColumn")||k.push(Kc.extend({content:"heading block*"})),k.push(Eg.configure({placeholder:({editor:v,node:C,pos:_})=>{if(C.type.name==="heading"){const R=C.attrs.level;return _>0?`H${R}`:i("label.untitled")}else return C.type.name==="paragraph"?i("label.typeForCommands"):""}})),k.push(fC),k.push(dC.configure({document:!1,blockquote:o.extensions.includes("OBlockquote")?!1:{},codeBlock:!1,heading:o.extensions.includes("OHeading")?!1:{levels:[1,2,3,4,5]},paragraph:o.extensions.includes("OParagraph")?!1:{},dropcursor:{width:5,color:"skyblue",class:"yiitap-dropcursor"},horizontalRule:!1}));const E=iA.concat(o.extensions);for(const v of E)if(typeof v=="string"){if(!lA.includes(v))continue;switch(v){case"Table":k.push(...RR);break;default:try{const C=new AR(v);k.push(C)}catch(C){console.error(C.message)}break}}else k.push(v);return k}return a.watch(()=>o.darkMode,k=>{s.value=k}),a.watch(()=>o.locale,k=>{c.value=k}),a.watch(()=>o.aiOption,k=>{d.value=k},{deep:!0}),a.watch(()=>o.editable,k=>{var E;(E=f.value)==null||E.setEditable(k),l.value=k}),a.onBeforeMount(()=>{d.value=o.aiOption,s.value=o.darkMode,c.value=o.locale,u.value=!o.showSideMenu&&o.showSideNode}),e({editor:f,darkMode:s,locale:c}),(k,E)=>{var v,C,_;return a.openBlock(),a.createElementBlock("main",{class:"yiitap yiitap-editor","data-theme":s.value?"dark":""},[t.showMainMenu?(a.openBlock(),a.createBlock(gb,a.mergeProps({key:0},h.value,{class:"desktop-only"}),{left:a.withCtx(()=>[a.renderSlot(k.$slots,"toolbar-left")]),right:a.withCtx(()=>[a.renderSlot(k.$slots,"toolbar-right")]),_:3},16)):a.createCommentVNode("",!0),(v=a.unref(f))!=null&&v.isEditable&&t.showBubbleMenu?(a.openBlock(),a.createBlock(eR,a.normalizeProps(a.mergeProps({key:1},m.value)),null,16)):a.createCommentVNode("",!0),(C=a.unref(f))!=null&&C.isEditable&&t.showFloatingMenu?(a.openBlock(),a.createBlock(oR,a.normalizeProps(a.mergeProps({key:2},g.value)),null,16)):a.createCommentVNode("",!0),(_=a.unref(f))!=null&&_.isEditable&&t.showSideMenu?(a.openBlock(),a.createBlock(mR,a.normalizeProps(a.mergeProps({key:3},b.value)),null,16)):a.createCommentVNode("",!0),a.createVNode(a.unref(m_),{class:a.normalizeClass(["editor-content",`${t.pageView}-view`]),editor:a.unref(f)},null,8,["class","editor"])],8,BR)}}}),DR={installed:!1,spellcheck:!0,install(t){this.installed=!0,t.component("YiiEditor",vb)}};exports.AddNode=Vm;exports.AiBlocks=Em;exports.AiProviders=km;exports.AskAiBlocks=wm;exports.BasicBlocks=Sr;exports.BlockMenus=Wl;exports.Blocks=wa;exports.Color=me;exports.ColorList=hC;exports.CommonBlocks=kr;exports.DefaultBubble=Sm;exports.DefaultEmbedServices=bC;exports.DefaultFloating=Am;exports.DefaultMenu=_m;exports.DragNode=zm;exports.ImageBubble=Nm;exports.ImageLinkBubble=Tm;exports.LinkBubble=xm;exports.MoreBubble=Om;exports.OAiMenu=mb;exports.OBlockList=Ea;exports.OBlockListItem=jl;exports.OBlockMenu=So;exports.OBlockPlaceholder=Jc;exports.OBlockPopover=Zn;exports.OBlockToolbar=Xc;exports.OBtn=St;exports.OBtnGroup=Hm;exports.OCalloutColorBoard=Zc;exports.OCalloutColorDropdown=qC;exports.OCheckbox=nu;exports.OColorBoard=_a;exports.OCommandBtn=lt;exports.OCommonBtn=yn;exports.OContextMenu=xi;exports.ODivider=Lt;exports.ODocToc=nS;exports.OEmojiSelect=Ca;exports.OIcon=re;exports.OInput=Ln;exports.OLanguageDropdown=Dm;exports.OList=Qt;exports.OListItem=Ut;exports.OMainMenu=gb;exports.OMediaInput=Qc;exports.OMenubarBtn=Le;exports.OMetaInput=eu;exports.ONodeView=kn;exports.OPopover=Pe;exports.OTableCellBackground=Lm;exports.OTableGrid=Im;exports.OTextColorBoard=Pm;exports.OToast=tu;exports.OTooltip=Qn;exports.Prompts=Gc;exports.StyleBlocks=hi;exports.TableBubble=Mm;exports.TableFloating=gC;exports.TableMenu=Cm;exports.TableWrapperBubble=mC;exports.YiiEditor=vb;exports.YiiEditorPlugin=DR;exports.getProviderProp=jc;exports.useAi=Yc;exports.useI18n=ge;exports.useNodeView=Rm;exports.useTheme=xr;exports.useTiptap=Te;
162
199
  //# sourceMappingURL=index.cjs.map