@yiitap/vue 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -0
  3. package/dist/index.cjs +125 -0
  4. package/dist/index.js +125 -0
  5. package/dist/index.mjs +44015 -0
  6. package/dist/vue.css +1 -0
  7. package/package.json +97 -0
  8. package/types/components/YiiEditor.vue.d.ts +203 -0
  9. package/types/components/buttons/OAlignDropdown.vue.d.ts +10 -0
  10. package/types/components/buttons/OAlignGroup.vue.d.ts +11 -0
  11. package/types/components/buttons/OBackColorDropdown.vue.d.ts +10 -0
  12. package/types/components/buttons/OFontFamilyDropdown.vue.d.ts +10 -0
  13. package/types/components/buttons/OForeColorDropdown.vue.d.ts +10 -0
  14. package/types/components/buttons/OHeadingDropdown.vue.d.ts +10 -0
  15. package/types/components/buttons/OLinkBtn.vue.d.ts +13 -0
  16. package/types/components/buttons/OLinkEditBtn.vue.d.ts +13 -0
  17. package/types/components/buttons/OLinkOpenBtn.vue.d.ts +10 -0
  18. package/types/components/buttons/OListDropdown.vue.d.ts +10 -0
  19. package/types/components/buttons/OListGroup.vue.d.ts +13 -0
  20. package/types/components/buttons/OMoreBubble.vue.d.ts +13 -0
  21. package/types/components/buttons/OSimpleCommandBtn.vue.d.ts +20 -0
  22. package/types/components/buttons/OStyleDropdown.vue.d.ts +10 -0
  23. package/types/components/buttons/OTableBtn.vue.d.ts +10 -0
  24. package/types/components/buttons/OTableGroup.vue.d.ts +13 -0
  25. package/types/components/buttons/OTextColorDropdown.vue.d.ts +13 -0
  26. package/types/components/buttons/OTextFormatDropdown.vue.d.ts +13 -0
  27. package/types/components/common/OBlockPlaceholder.vue.d.ts +23 -0
  28. package/types/components/common/OBlockPopover.vue.d.ts +75 -0
  29. package/types/components/common/OCalloutColorBoard.vue.d.ts +36 -0
  30. package/types/components/common/OCalloutColorDropdown.vue.d.ts +14 -0
  31. package/types/components/common/OColorBoard.vue.d.ts +36 -0
  32. package/types/components/common/OCommandBtn.vue.d.ts +97 -0
  33. package/types/components/common/OCommonBtn.vue.d.ts +97 -0
  34. package/types/components/common/OContextMenu.vue.d.ts +52 -0
  35. package/types/components/common/OLanguageDropdown.vue.d.ts +18 -0
  36. package/types/components/common/OMediaInput.vue.d.ts +27 -0
  37. package/types/components/common/OMenubarBtn.vue.d.ts +81 -0
  38. package/types/components/common/OMetaInput.vue.d.ts +72 -0
  39. package/types/components/common/OTableCellBackground.vue.d.ts +10 -0
  40. package/types/components/common/OTableGrid.vue.d.ts +6 -0
  41. package/types/components/common/OTextColorBoard.vue.d.ts +36 -0
  42. package/types/components/common/o-side-menu/DragNodeMenu.vue.d.ts +64 -0
  43. package/types/components/index.d.ts +30 -0
  44. package/types/components/menu.d.ts +1 -0
  45. package/types/components/menus/OBubbleMenu.vue.d.ts +38 -0
  46. package/types/components/menus/OFloatingMenu.vue.d.ts +38 -0
  47. package/types/components/menus/OMainMenu.vue.d.ts +28 -0
  48. package/types/components/menus/OSideMenu.vue.d.ts +23 -0
  49. package/types/components/menus/side-menu/index.d.ts +2 -0
  50. package/types/components/ui/OBtn.vue.d.ts +43 -0
  51. package/types/components/ui/OCheckbox.vue.d.ts +27 -0
  52. package/types/components/ui/ODivider.vue.d.ts +14 -0
  53. package/types/components/ui/OIcon.vue.d.ts +32 -0
  54. package/types/components/ui/OInput.vue.d.ts +51 -0
  55. package/types/components/ui/OList.vue.d.ts +30 -0
  56. package/types/components/ui/OListItem.vue.d.ts +23 -0
  57. package/types/components/ui/OPopover.vue.d.ts +86 -0
  58. package/types/components/ui/OTooltip.d.ts +16 -0
  59. package/types/components/ui/OTooltip.vue.d.ts +32 -0
  60. package/types/constants/block.d.ts +5 -0
  61. package/types/constants/color.d.ts +5 -0
  62. package/types/constants/demo-article.d.ts +7 -0
  63. package/types/constants/empty-block.d.ts +21 -0
  64. package/types/constants/language.d.ts +1 -0
  65. package/types/constants/menu.d.ts +31 -0
  66. package/types/extensions/blockquote/index.d.ts +3 -0
  67. package/types/extensions/callout/index.d.ts +21 -0
  68. package/types/extensions/code-block/index.d.ts +3 -0
  69. package/types/extensions/color-highlighter/index.d.ts +3 -0
  70. package/types/extensions/color-highlighter/utils.d.ts +3 -0
  71. package/types/extensions/dynamic.d.ts +11 -0
  72. package/types/extensions/focus/index.d.ts +10 -0
  73. package/types/extensions/heading/index.d.ts +7 -0
  74. package/types/extensions/horizontal-rule/index.d.ts +2 -0
  75. package/types/extensions/image/index.d.ts +3 -0
  76. package/types/extensions/index.d.ts +22 -0
  77. package/types/extensions/link/helpers/clickSelectHandler.d.ts +2 -0
  78. package/types/extensions/link/index.d.ts +3 -0
  79. package/types/extensions/paragraph/index.d.ts +2 -0
  80. package/types/extensions/placeholder/index.d.ts +17 -0
  81. package/types/extensions/side-menu/index.d.ts +2 -0
  82. package/types/extensions/side-menu/side-menu-plugin.d.ts +72 -0
  83. package/types/extensions/side-menu/utils.d.ts +50 -0
  84. package/types/extensions/slash/index.d.ts +3 -0
  85. package/types/extensions/slash/slash-zh.d.ts +3 -0
  86. package/types/extensions/slash/slash.d.ts +6 -0
  87. package/types/extensions/slash/suggestion.d.ts +18 -0
  88. package/types/extensions/slash/view.new.vue.d.ts +36 -0
  89. package/types/extensions/slash/view.vue.d.ts +54 -0
  90. package/types/extensions/table/TableView.d.ts +18 -0
  91. package/types/extensions/table/index.d.ts +11 -0
  92. package/types/extensions/table-cell/index.d.ts +3 -0
  93. package/types/extensions/table-header/index.d.ts +3 -0
  94. package/types/extensions/table-wrapper/index.d.ts +3 -0
  95. package/types/extensions/trailing-node/index.d.ts +3 -0
  96. package/types/extensions/unique-id/index.d.ts +2 -0
  97. package/types/extensions/unique-id/unique-id.d.ts +2 -0
  98. package/types/extensions/unique-id-simple/index.d.ts +8 -0
  99. package/types/extensions/video/index.d.ts +11 -0
  100. package/types/hooks/index.d.ts +3 -0
  101. package/types/hooks/useI18n.d.ts +7 -0
  102. package/types/hooks/useTheme.d.ts +6 -0
  103. package/types/hooks/useTiptap.d.ts +5 -0
  104. package/types/i18n/index.d.ts +4 -0
  105. package/types/i18n/messages/en.d.ts +185 -0
  106. package/types/i18n/messages/pl.d.ts +182 -0
  107. package/types/i18n/messages/pt-br.d.ts +182 -0
  108. package/types/i18n/messages/zh-hans.d.ts +185 -0
  109. package/types/i18n/messages/zh-hant.d.ts +182 -0
  110. package/types/index.d.ts +10 -0
  111. package/types/utils/copy-to-clipboard.d.ts +1 -0
  112. package/types/utils/uuid.d.ts +1 -0
package/dist/index.js ADDED
@@ -0,0 +1,125 @@
1
+ var YiiEditor=function(de,l){"use strict";var Qv=Object.defineProperty;var eR=(de,l,je)=>l in de?Qv(de,l,{enumerable:!0,configurable:!0,writable:!0,value:je}):de[l]=je;var $e=(de,l,je)=>eR(de,typeof l!="symbol"?l+"":l,je);/**
2
+ * Copyright 2025 Yiitap
3
+ * @license MIT
4
+ **/function je(n){this.content=n}je.prototype={constructor:je,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,o=r.find(n),i=r.content.slice();return o==-1?i.push(t||n,e):(i[o+1]=e,t&&(i[o]=t)),new je(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new je(t)},addToStart:function(n,e){return new je([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new je(t)},addBefore:function(n,e,t){var r=this.remove(e),o=r.content.slice(),i=r.find(n);return o.splice(i==-1?o.length:i,0,e,t),new je(o)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=je.from(n),n.size?new je(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=je.from(n),n.size?new je(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=je.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},je.from=function(n){if(n instanceof je)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new je(e)};function Id(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let o=n.child(r),i=e.child(r);if(o==i){t+=o.nodeSize;continue}if(!o.sameMarkup(i))return t;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)t++;return t}if(o.content.size||i.content.size){let s=Id(o.content,i.content,t+1);if(s!=null)return s}t+=o.nodeSize}}function Bd(n,e,t,r){for(let o=n.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:t,b:r};let s=n.child(--o),a=e.child(--i),c=s.nodeSize;if(s==a){t-=c,r-=c;continue}if(!s.sameMarkup(a))return{a:t,b:r};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++,t--,r--;return{a:t,b:r}}if(s.content.size||a.content.size){let d=Bd(s.content,a.content,t-1,r-1);if(d)return d}t-=c,r-=c}}class x{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,o=0,i){for(let s=0,a=0;a<t;s++){let c=this.content[s],d=a+c.nodeSize;if(d>e&&r(c,o+a,i||null,s)!==!1&&c.content.size){let u=a+1;c.nodesBetween(Math.max(0,e-u),Math.min(c.content.size,t-u),r,o+u)}a=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,o){let i="",s=!0;return this.nodesBetween(e,t,(a,c)=>{let d=a.isText?a.text.slice(Math.max(e,c)-c,t-c):a.isLeaf?o?typeof o=="function"?o(a):o:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&d||a.isTextblock)&&r&&(s?s=!1:i+=r),i+=d},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(o[o.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new x(o,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],o=0;if(t>e)for(let i=0,s=0;s<t;i++){let a=this.content[i],c=s+a.nodeSize;c>e&&((s<e||c>t)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,t-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,t-s-1))),r.push(a),o+=a.nodeSize),s=c}return new x(r,o)}cutByIndex(e,t){return e==t?x.empty:e==0&&t==this.content.length?this:new x(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let o=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return o[e]=t,new x(o,i)}addToStart(e){return new x([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new x(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let o=this.content[t];e(o,r,t),r+=o.nodeSize}}findDiffStart(e,t=0){return Id(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Bd(this,e,t,r)}findIndex(e,t=-1){if(e==0)return $i(0,e);if(e==this.size)return $i(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,o=0;;r++){let i=this.child(r),s=o+i.nodeSize;if(s>=e)return s==e||t>0?$i(r+1,s):$i(r,o);o=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return x.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new x(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return x.empty;let t,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(t||(t=e.slice(0,o)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new x(t||e,r)}static from(e){if(!e)return x.empty;if(e instanceof x)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new x([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}x.empty=new x([],0);const Ha={index:0,offset:0};function $i(n,e){return Ha.index=n,Ha.offset=e,Ha}function Fi(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Fi(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Fi(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let De=class Ad{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,o)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Fi(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let o=r.create(t.attrs);return r.checkAttrs(o.attrs),o}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Ad.none;if(e instanceof Ad)return[e];let t=e.slice();return t.sort((r,o)=>r.type.rank-o.type.rank),t}};De.none=[];class Io extends Error{}class M{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Pd(this.content,e+this.openStart,t);return r&&new M(r,this.openStart,this.openEnd)}removeBetween(e,t){return new M(Ld(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return M.empty;let r=t.openStart||0,o=t.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new M(x.fromJSON(e,t.content),r,o)}static maxOpen(e,t=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)o++;return new M(e,r,o)}}M.empty=new M(x.empty,0,0);function Ld(n,e,t){let{index:r,offset:o}=n.findIndex(e),i=n.maybeChild(r),{index:s,offset:a}=n.findIndex(t);if(o==e||i.isText){if(a!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(Ld(i.content,e-o-1,t-o-1)))}function Pd(n,e,t,r){let{index:o,offset:i}=n.findIndex(e),s=n.maybeChild(o);if(i==e||s.isText)return n.cut(0,e).append(t).append(n.cut(e));let a=Pd(s.content,e-i-1,t);return a&&n.replaceChild(o,s.copy(a))}function rb(n,e,t){if(t.openStart>n.depth)throw new Io("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Io("Inconsistent open depths");return $d(n,e,t,0)}function $d(n,e,t,r){let o=n.index(r),i=n.node(r);if(o==e.index(r)&&r<n.depth-t.openStart){let s=$d(n,e,t,r+1);return i.copy(i.content.replaceChild(o,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let s=n.parent,a=s.content;return Tr(s,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:s,end:a}=ob(t,n);return Tr(i,zd(n,s,a,e,r))}else return Tr(i,zi(n,e,r))}function Fd(n,e){if(!e.type.compatibleContent(n.type))throw new Io("Cannot join "+e.type.name+" onto "+n.type.name)}function Ua(n,e,t){let r=n.node(t);return Fd(r,e.node(t)),r}function Nr(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Bo(n,e,t,r){let o=(e||n).node(t),i=0,s=e?e.index(t):o.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(Nr(n.nodeAfter,r),i++));for(let a=i;a<s;a++)Nr(o.child(a),r);e&&e.depth==t&&e.textOffset&&Nr(e.nodeBefore,r)}function Tr(n,e){return n.type.checkContent(e),n.copy(e)}function zd(n,e,t,r,o){let i=n.depth>o&&Ua(n,e,o+1),s=r.depth>o&&Ua(t,r,o+1),a=[];return Bo(null,n,o,a),i&&s&&e.index(o)==t.index(o)?(Fd(i,s),Nr(Tr(i,zd(n,e,t,r,o+1)),a)):(i&&Nr(Tr(i,zi(n,e,o+1)),a),Bo(e,t,o,a),s&&Nr(Tr(s,zi(t,r,o+1)),a)),Bo(r,null,o,a),new x(a)}function zi(n,e,t){let r=[];if(Bo(null,n,t,r),n.depth>t){let o=Ua(n,e,t+1);Nr(Tr(o,zi(n,e,t+1)),r)}return Bo(e,null,t,r),new x(r)}function ob(n,e){let t=e.depth-n.openStart,o=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)o=e.node(i).copy(x.from(o));return{start:o.resolveNoCache(n.openStart+t),end:o.resolveNoCache(o.content.size-n.openEnd-t)}}class Lo{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(t);return r?e.child(t).cut(r):o}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],o=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return De.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),o=e.maybeChild(t);if(!r){let a=r;r=o,o=a}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Vi(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],o=0,i=t;for(let s=e;;){let{index:a,offset:c}=s.content.findIndex(i),d=i-c;if(r.push(s,a,o+c),!d||(s=s.child(a),s.isText))break;i=d-1,o+=c+1}return new Lo(t,r,i)}static resolveCached(e,t){let r=Vd.get(e);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==t)return s}else Vd.set(e,r=new ib);let o=r.elts[r.i]=Lo.resolve(e,t);return r.i=(r.i+1)%sb,o}}class ib{constructor(){this.elts=[],this.i=0}}const sb=12,Vd=new WeakMap;class Vi{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const ab=Object.create(null);let Qn=class vd{constructor(e,t,r,o=De.none){this.type=e,this.attrs=t,this.marks=o,this.content=r||x.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,o=0){this.content.nodesBetween(e,t,r,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,o){return this.content.textBetween(e,t,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Fi(this.attrs,t||e.defaultAttrs||ab)&&De.sameSet(this.marks,r||De.none)}copy(e=null){return e==this.content?this:new vd(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new vd(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return M.empty;let o=this.resolve(e),i=this.resolve(t),s=r?0:o.sharedDepth(t),a=o.start(s),d=o.node(s).content.cut(o.pos-a,i.pos-a);return new M(d,o.depth-s,i.depth-s)}replace(e,t,r){return rb(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:o}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(o==e||t.isText)return t;e-=o+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let o=this.content.child(t-1);return{node:o,index:t-1,offset:r-o.nodeSize}}resolve(e){return Lo.resolveCached(this,e)}resolveNoCache(e){return Lo.resolve(this,e)}rangeHasMark(e,t,r){let o=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Hd(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=x.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),a=s&&s.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let c=o;c<i;c++)if(!this.type.allowsMarks(r.child(c).marks))return!1;return!0}canReplaceWith(e,t,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,t);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=De.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!De.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let o=x.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,o,r);return i.type.checkAttrs(i.attrs),i}};Qn.prototype.text=void 0;class Hi extends Qn{constructor(e,t,r,o){if(super(e,t,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Hd(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Hi(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Hi(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Hd(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Or{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new lb(e,t);if(r.next==null)return Or.empty;let o=Ud(r);r.next&&r.err("Unexpected trailing text");let i=mb(hb(o));return gb(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let o=this;for(let i=t;o&&i<r;i++)o=o.matchType(e.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let o=[this];function i(s,a){let c=s.matchFragment(e,r);if(c&&(!t||c.validEnd))return x.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())&&o.indexOf(p)==-1){o.push(p);let f=i(p,a.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(e)){let s=[];for(let a=o;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 t)&&(!o.type||c.validEnd)&&(r.push({match:a.contentMatch,type:a,via:o}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&t(r.next[o].next)}return t(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
5
+ `)}}Or.empty=new Or(!0);class lb{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Ud(n){let e=[];do e.push(cb(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function cb(n){let e=[];do e.push(db(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function db(n){let e=fb(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=ub(n,e);else break;return e}function Wd(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function ub(n,e){let t=Wd(n),r=t;return n.eat(",")&&(n.next!="}"?r=Wd(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function pb(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let o=[];for(let i in t){let s=t[i];s.isInGroup(e)&&o.push(s)}return o.length==0&&n.err("No node type or group '"+e+"' found"),o}function fb(n){if(n.eat("(")){let e=Ud(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=pb(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function hb(n){let e=[[]];return o(i(n,0),t()),e;function t(){return e.push([])-1}function r(s,a,c){let d={term:c,to:a};return e[s].push(d),d}function o(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;o(d,a=t())}else if(s.type=="star"){let c=t();return r(a,c),o(i(s.expr,c),c),[r(c)]}else if(s.type=="plus"){let c=t();return o(i(s.expr,a),c),o(i(s.expr,c),c),[r(c)]}else{if(s.type=="opt")return[r(a)].concat(i(s.expr,a));if(s.type=="range"){let c=a;for(let d=0;d<s.min;d++){let u=t();o(i(s.expr,c),u),c=u}if(s.max==-1)o(i(s.expr,c),c);else for(let d=s.min;d<s.max;d++){let u=t();r(c,u),o(i(s.expr,c),u),c=u}return[r(c)]}else{if(s.type=="name")return[r(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function qd(n,e){return e-n}function Kd(n,e){let t=[];return r(e),t.sort(qd);function r(o){let i=n[o];if(i.length==1&&!i[0].term)return r(i[0].to);t.push(o);for(let s=0;s<i.length;s++){let{term:a,to:c}=i[s];!a&&t.indexOf(c)==-1&&r(c)}}}function mb(n){let e=Object.create(null);return t(Kd(n,0));function t(r){let o=[];r.forEach(s=>{n[s].forEach(({term:a,to:c})=>{if(!a)return;let d;for(let u=0;u<o.length;u++)o[u][0]==a&&(d=o[u][1]);Kd(n,c).forEach(u=>{d||o.push([a,d=[]]),d.indexOf(u)==-1&&d.push(u)})})});let i=e[r.join(",")]=new Or(r.indexOf(n.length-1)>-1);for(let s=0;s<o.length;s++){let a=o[s][1].sort(qd);i.next.push({type:o[s][0],next:e[a.join(",")]||t(a)})}return i}}function gb(n,e){for(let t=0,r=[n];t<r.length;t++){let o=r[t],i=!o.validEnd,s=[];for(let a=0;a<o.next.length;a++){let{type:c,next:d}=o.next[a];s.push(c.name),i&&!(c.isText||c.hasRequiredAttrs())&&(i=!1),r.indexOf(d)==-1&&r.push(d)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Gd(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function jd(n,e){let t=Object.create(null);for(let r in n){let o=e&&e[r];if(o===void 0){let i=n[r];if(i.hasDefault)o=i.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=o}return t}function Jd(n,e,t,r){for(let o in e)if(!(o in n))throw new RangeError(`Unsupported attribute ${o} for ${t} of type ${o}`);for(let o in n){let i=n[o];i.validate&&i.validate(e[o])}}function Yd(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new yb(n,r,e[r]);return t}let Xd=class tb{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Yd(e,r.attrs),this.defaultAttrs=Gd(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Or.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:jd(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Qn(this,this.computeAttrs(e),x.from(t),De.setFrom(r))}createChecked(e=null,t,r){return t=x.from(t),this.checkContent(t),new Qn(this,this.computeAttrs(e),t,De.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=x.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let o=this.contentMatch.matchFragment(t),i=o&&o.fillBefore(x.empty,!0);return i?new Qn(this,e,t.append(i),De.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Jd(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:De.none:e}static compile(e,t){let r=Object.create(null);e.forEach((i,s)=>r[i]=new tb(i,t,s));let o=t.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function bb(n,e,t){let r=t.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${i}`)}}class yb{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?bb(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Po{constructor(e,t,r,o){this.name=e,this.rank=t,this.schema=r,this.spec=o,this.attrs=Yd(e,o.attrs),this.excluded=null;let i=Gd(this.attrs);this.instance=i?new De(this,i):null}create(e=null){return!e&&this.instance?this.instance:new De(this,jd(this.attrs,e))}static compile(e,t){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new Po(i,o++,t,s)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Jd(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Zd{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let o in e)t[o]=e[o];t.nodes=je.from(e.nodes),t.marks=je.from(e.marks||{}),this.nodes=Xd.compile(this.spec.nodes,this),this.marks=Po.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=Or.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?Qd(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:Qd(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,t=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Xd){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,o)}text(e,t){let r=this.nodes.text;return new Hi(r,r.defaultAttrs,e,De.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return Qn.fromJSON(this,e)}markFromJSON(e){return De.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Qd(n,e){let t=[];for(let r=0;r<e.length;r++){let o=e[r],i=n.marks[o],s=i;if(i)t.push(i);else for(let a in n.marks){let c=n.marks[a];(o=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(o)>-1)&&t.push(s=c)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function kb(n){return n.tag!=null}function Eb(n){return n.style!=null}class er{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(o=>{if(kb(o))this.tags.push(o);else if(Eb(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=e.nodes[o.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new ru(this,t,!1);return r.addAll(e,De.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new ru(this,t,!0);return r.addAll(e,De.none,t.from,t.to),M.maxOpen(r.finish())}matchTag(e,t,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(_b(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,t,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],a=s.style;if(!(a.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(s.getAttrs){let c=s.getAttrs(t);if(c===!1)continue;s.attrs=c||void 0}return s}}}static schemaRules(e){let t=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s<t.length;s++){let a=t[s];if((a.priority==null?50:a.priority)<i)break}t.splice(s,0,o)}for(let o in e.marks){let i=e.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=ou(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=ou(s)),s.node||s.ignore||s.mark||(s.node=o)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new er(e,er.schemaRules(e)))}}const eu={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},wb={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},tu={ol:!0,ul:!0},$o=1,Wa=2,Ui=4;function nu(n,e,t){return e!=null?(e?$o:0)|(e==="full"?Wa:0):n&&n.whitespace=="pre"?$o|Wa:t&-5}class Wi{constructor(e,t,r,o,i,s){this.type=e,this.attrs=t,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=De.none,this.match=i||(s&Ui?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(x.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&$o)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let t=x.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(x.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!eu.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class ru{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=t.topNode,i,s=nu(null,t.preserveWhitespace,0)|(r?Ui:0);o?i=new Wi(o.type,o.attrs,De.none,!0,t.topMatch||o.type.contentMatch,s):r?i=new Wi(null,null,De.none,!0,null,s):i=new Wi(e.schema.topNodeType,null,De.none,!0,null,s),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,o=this.top,i=o.options&Wa?"full":this.localPreserveWS||(o.options&$o)>0;if(i==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)i!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,`
6
+ `);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let s=o.content[o.content.length-1],a=e.previousSibling;(!s||a&&a.nodeName=="BR"||s.isText&&/[ \t\r\n\u000c]$/.test(s.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),t),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let o=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),a;tu.hasOwnProperty(s)&&this.parser.normalizeLists&&Cb(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(c?c.ignore:wb.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!c||c.skip||c.closeParent){c&&c.closeParent?this.open=Math.max(0,this.open-1):c&&c.skip.nodeType&&(e=c.skip);let d,u=this.needsBlock;if(eu.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,t);break e}let p=c&&c.skip?t:this.readStyles(e,t);p&&this.addAll(e,p),d&&this.sync(i),this.needsBlock=u}else{let d=this.readStyles(e,t);d&&this.addElementByRule(e,c,d,c.consuming===!1?a:void 0)}this.localPreserveWS=o}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
7
+ `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],s=r.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?t=t.filter(d=>!c.clearMark(d)):t=t.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)a=c;else break}}return t}addElementByRule(e,t,r,o){let i,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),r)||this.leafFallback(e,r);else{let c=this.enter(s,t.attrs||null,r,t.preserveWhitespace);c&&(i=!0,r=c)}else{let c=this.parser.schema.marks[t.mark];r=r.concat(c.create(t.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,r));else{let c=e;typeof t.contentElement=="string"?c=e.querySelector(t.contentElement):typeof t.contentElement=="function"?c=t.contentElement(e):t.contentElement&&(c=t.contentElement),this.findAround(e,c,!0),this.addAll(c,r),this.findAround(e,c,!1)}i&&this.sync(a)&&this.open--}addAll(e,t,r,o){let i=r||0;for(let s=r?e.childNodes[r]:e.firstChild,a=o==null?null:e.childNodes[o];s!=a;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,t);this.findAtPoint(e,i)}findPlace(e,t){let r,o;for(let i=this.open;i>=0;i--){let s=this.nodes[i],a=s.findWrapping(e);if(a&&(!r||r.length>a.length)&&(r=a,o=s,!a.length)||s.solid)break}if(!r)return null;this.sync(o);for(let i=0;i<r.length;i++)t=this.enterInner(r[i],null,t,!1);return t}insertNode(e,t){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(t=this.enterInner(o,null,t))}let r=this.findPlace(e,t);if(r){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let i=De.none;for(let s of r.concat(e.marks))(o.type?o.type.allowsMarkType(s.type):iu(s.type,e.type))&&(i=s.addToSet(i));return o.content.push(e.mark(i)),!0}return!1}enter(e,t,r,o){let i=this.findPlace(e.create(t),r);return i&&(i=this.enterInner(e,t,r,!0,o)),i}enterInner(e,t,r,o=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let a=nu(e,i,s.options);s.options&Ui&&s.content.length==0&&(a|=Ui);let c=De.none;return r=r.filter(d=>(s.type?s.type.allowsMarkType(d.type):iu(d.type,e))?(c=d.addToSet(c),!1):!0),this.nodes.push(new Wi(e,t,c,o,null,a)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=$o)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&t.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(a,c)=>{for(;a>=0;a--){let d=t[a];if(d==""){if(a==t.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&&o?this.nodes[c].type:r&&c>=i?r.node(c-i).type:null;if(!u||u.name!=d&&!u.isInGroup(d))return!1;c--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function Cb(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&tu.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function _b(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function ou(n){let e={};for(let t in n)e[t]=n[t];return e}function iu(n,e){let t=e.schema.nodes;for(let r in t){let o=t[r];if(!o.allowsMarkType(n))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(o.contentMatch))return!0}}class Mr{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=qa(t).createDocumentFragment());let o=r,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;)o=i.pop()[1];for(;c<s.marks.length;){let d=s.marks[c++],u=this.serializeMark(d,s.isInline,t);u&&(i.push([d,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(s,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:o}=qi(qa(t),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,o)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let o=e.marks.length-1;o>=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let o=this.marks[e.type.name];return o&&qi(qa(r),o(e,t),null,e.attrs)}static renderSpec(e,t,r=null,o){return qi(e,t,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Mr(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=su(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return su(e.marks)}}function su(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function qa(n){return n.document||window.document}const au=new WeakMap;function Sb(n){let e=au.get(n);return e===void 0&&au.set(n,e=xb(n)),e}function xb(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let o=0;o<r.length;o++)t(r[o]);else for(let o in r)t(r[o])}return t(n),e}function qi(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let o=e[0],i;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=Sb(r))&&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=o.indexOf(" ");s>0&&(t=o.slice(0,s),o=o.slice(s+1));let a,c=t?n.createElementNS(t,o):n.createElement(o),d=e[1],u=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){u=2;for(let 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}=qi(n,f,t,r);if(c.appendChild(h),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:c,contentDOM:a}}const lu=65535,cu=Math.pow(2,16);function Nb(n,e){return n+e*cu}function du(n){return n&lu}function Tb(n){return(n-(n&lu))/cu}const uu=1,pu=2,Ki=4,fu=8;let Ka=class{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&fu)>0}get deletedBefore(){return(this.delInfo&(uu|Ki))>0}get deletedAfter(){return(this.delInfo&(pu|Ki))>0}get deletedAcross(){return(this.delInfo&Ki)>0}},Ar=class Do{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Do.empty)return Do.empty}recover(e){let t=0,r=du(e);if(!this.inverted)for(let o=0;o<r;o++)t+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+t+Tb(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let o=0,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=this.ranges[a+s],p=c+d;if(e<=p){let f=d?e==c?-1:e==p?1:t:t,h=c+o+(f<0?0:u);if(r)return h;let m=e==(t<0?c:p)?null:Nb(a/3,e-c),g=e==c?pu:e==p?uu:Ki;return(t<0?e!=c:e!=p)&&(g|=fu),new Ka(h,g,m)}o+=u-d}return r?e+o:new Ka(e+o,0,null)}touches(e,t){let r=0,o=du(t),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=c+d;if(e<=u&&a==o*3)return!0;r+=this.ranges[a+s]-d}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],a=s-(this.inverted?i:0),c=s+(this.inverted?0:i),d=this.ranges[o+t],u=this.ranges[o+r];e(a,a+d,c,c+u),i+=u-d}}invert(){return new Do(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Do.empty:new Do(e<0?[0,-e,0]:[0,0,e])}};Ar.empty=new Ar([]);let Ob=class $a{constructor(e=[],t,r=0,o=e.length){this.maps=e,this.mirror=t,this.from=r,this.to=o}slice(e=0,t=this.maps.length){return new $a(this.maps,this.mirror,e,t)}copy(){return new $a(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),t!=null&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,r=this.maps.length;t<e.maps.length;t++){let o=e.getMirror(t);this.appendMap(e.maps[t],o!=null&&o<t?r+o:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this.maps.length+e.maps.length;t>=0;t--){let o=e.getMirror(t);this.appendMap(e.maps[t].invert(),o!=null&&o>t?r-o-1:void 0)}}invert(){let e=new $a;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let o=0;for(let i=this.from;i<this.to;i++){let s=this.maps[i],a=s.mapResult(e,t);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}}o|=a.delInfo,e=a.pos}return r?e:new Ka(e,o,null)}};const Ga=Object.create(null);let Et=class{getMap(){return Ar.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ga[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Ga)throw new RangeError("Duplicate use of step JSON ID "+e);return Ga[e]=t,t.prototype.jsonID=e,t}},Tt=class Ii{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Ii(e,null)}static fail(e){return new Ii(null,e)}static fromReplace(e,t,r,o){try{return Ii.ok(e.replace(t,r,o))}catch(i){if(i instanceof Io)return Ii.fail(i.message);throw i}}};function ja(n,e,t){let r=[];for(let o=0;o<n.childCount;o++){let i=n.child(o);i.content.size&&(i=i.copy(ja(i.content,e,i))),i.isInline&&(i=e(i,t,o)),r.push(i)}return x.fromArray(r)}let Ja=class Bi extends Et{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new M(ja(t.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),t.openStart,t.openEnd);return Tt.fromReplace(e,this.from,this.to,i)}invert(){return new Fo(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Bi(t.pos,r.pos,this.mark)}merge(e){return e instanceof Bi&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Bi(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Bi(t.from,t.to,e.markFromJSON(t.mark))}};Et.jsonID("addMark",Ja);let Fo=class Li extends Et{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new M(ja(t.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),t.openStart,t.openEnd);return Tt.fromReplace(e,this.from,this.to,r)}invert(){return new Ja(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Li(t.pos,r.pos,this.mark)}merge(e){return e instanceof Li&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Li(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Li(t.from,t.to,e.markFromJSON(t.mark))}};Et.jsonID("removeMark",Fo);let Ya=class Pi extends Et{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Tt.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Tt.fromReplace(e,this.pos,this.pos+1,new M(x.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let o=0;o<t.marks.length;o++)if(!t.marks[o].isInSet(r))return new Pi(this.pos,t.marks[o]);return new Pi(this.pos,this.mark)}}return new Xa(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Pi(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Pi(t.pos,e.markFromJSON(t.mark))}};Et.jsonID("addNodeMark",Ya);let Xa=class Rd extends Et{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Tt.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Tt.fromReplace(e,this.pos,this.pos+1,new M(x.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Ya(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Rd(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Rd(t.pos,e.markFromJSON(t.mark))}};Et.jsonID("removeNodeMark",Xa);let $n=class Qr extends Et{constructor(e,t,r,o=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=o}apply(e){return this.structure&&Za(e,this.from,this.to)?Tt.fail("Structure replace would overwrite content"):Tt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ar([this.from,this.to-this.from,this.slice.size])}invert(e){return new Qr(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new Qr(t.pos,Math.max(t.pos,r.pos),this.slice)}merge(e){if(!(e instanceof Qr)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?M.empty:new M(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Qr(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?M.empty:new M(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Qr(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Qr(t.from,t.to,M.fromJSON(e,t.slice),!!t.structure)}};Et.jsonID("replace",$n);let vr=class Fa extends Et{constructor(e,t,r,o,i,s,a=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=a}apply(e){if(this.structure&&(Za(e,this.from,this.gapFrom)||Za(e,this.gapTo,this.to)))return Tt.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Tt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?Tt.fromReplace(e,this.from,this.to,r):Tt.fail("Content does not fit in gap")}getMap(){return new Ar([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Fa(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=e.map(this.gapFrom,-1),i=e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||o<t.pos||i>r.pos?null:new Fa(t.pos,r.pos,o,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,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Fa(t.from,t.to,t.gapFrom,t.gapTo,M.fromJSON(e,t.slice),t.insert,!!t.structure)}};Et.jsonID("replaceAround",vr);function Za(n,e,t){let r=n.resolve(e),o=t-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function Mb(n,e,t,r){let o=[],i=[],s,a;n.doc.nodesBetween(e,t,(c,d,u)=>{if(!c.isInline)return;let p=c.marks;if(!r.isInSet(p)&&u.type.allowsMarkType(r.type)){let f=Math.max(d,e),h=Math.min(d+c.nodeSize,t),m=r.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:o.push(s=new Fo(f,h,p[g])));a&&a.to==f?a.to=h:i.push(a=new Ja(f,h,r))}}),o.forEach(c=>n.step(c)),i.forEach(c=>n.step(c))}function Ab(n,e,t,r){let o=[],i=0;n.doc.nodesBetween(e,t,(s,a)=>{if(!s.isInline)return;i++;let c=null;if(r instanceof Po){let d=s.marks,u;for(;u=r.isInSet(d);)(c||(c=[])).push(u),d=u.removeFromSet(d)}else r?r.isInSet(s.marks)&&(c=[r]):c=s.marks;if(c&&c.length){let d=Math.min(a+s.nodeSize,t);for(let u=0;u<c.length;u++){let p=c[u],f;for(let h=0;h<o.length;h++){let m=o[h];m.step==i-1&&p.eq(o[h].style)&&(f=m)}f?(f.to=d,f.step=i):o.push({style:p,from:Math.max(a,e),to:d,step:i})}}}),o.forEach(s=>n.step(new Fo(s.from,s.to,s.style)))}function vb(n,e,t,r=t.contentMatch){let o=n.doc.nodeAt(e),i=[],s=e+1;for(let a=0;a<o.childCount;a++){let c=o.child(a),d=s+c.nodeSize,u=r.matchType(c.type);if(!u)i.push(new $n(s,d,M.empty));else{r=u;for(let p=0;p<c.marks.length;p++)t.allowsMarkType(c.marks[p].type)||n.step(new Fo(s,d,c.marks[p]));if(c.isText&&!t.spec.code){let p,f=/\r?\n|\r/g,h;for(;p=f.exec(c.text);)h||(h=new M(x.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),i.push(new $n(s+p.index,s+p.index+p[0].length,h))}}s=d}if(!r.validEnd){let a=r.fillBefore(x.empty,!0);n.replace(s,s,new M(a,0,0))}for(let a=i.length-1;a>=0;a--)n.step(i[a])}function Rb(n,e,t){let{$from:r,$to:o,depth:i}=e,s=r.before(i+1),a=o.after(i+1),c=s,d=a,u=x.empty,p=0;for(let m=i,g=!1;m>t;m--)g||r.index(m)>0?(g=!0,u=x.from(r.node(m).copy(u)),p++):c--;let f=x.empty,h=0;for(let m=i,g=!1;m>t;m--)g||o.after(m+1)<o.end(m)?(g=!0,f=x.from(o.node(m).copy(f)),h++):d++;n.step(new vr(c,d,s,a,new M(u.append(f),p,h),u.size-p,!0))}function Db(n,e,t){let r=x.empty;for(let s=t.length-1;s>=0;s--){if(r.size){let a=t[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=x.from(t[s].type.create(t[s].attrs,r))}let o=e.start,i=e.end;n.step(new vr(o,i,o,i,new M(r,0,0),t.length,!0))}function Ib(n,e,t,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(s,a)=>{if(s.isTextblock&&!s.hasMarkup(r,o)&&Bb(n.doc,n.mapping.slice(i).map(a),r)){n.clearIncompatible(n.mapping.slice(i).map(a,1),r);let c=n.mapping.slice(i),d=c.map(a,1),u=c.map(a+s.nodeSize,1);return n.step(new vr(d,u,d+1,u-1,new M(x.from(r.create(o,null,s.marks)),0,0),1,!0)),!1}})}function Bb(n,e,t){let r=n.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,t)}function Lb(n,e,t,r,o){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let s=t.create(r,null,o||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,s);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new vr(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new M(x.from(s),0,0),1,!0))}function Pb(n,e,t=1,r){let o=n.doc.resolve(e),i=x.empty,s=x.empty;for(let a=o.depth,c=o.depth-t,d=t-1;a>c;a--,d--){i=x.from(o.node(a).copy(i));let u=r&&r[d];s=x.from(u?u.type.create(u.attrs,s):o.node(a).copy(s))}n.step(new $n(e,e,new M(i.append(s),t,t),!0))}function $b(n,e,t){let r=new $n(e-t,e+t,M.empty,!0);n.step(r)}function Fb(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,t))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,t))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function zb(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let o=t.content;for(let i=0;i<t.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(t.openStart==0&&t.size?2:1);i++)for(let s=r.depth;s>=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,c=r.index(s)+(a>0?1:0),d=r.node(s),u=!1;if(i==1)u=d.canReplace(c,c,o);else{let p=d.contentMatchAt(c).findWrapping(o.firstChild.type);u=p&&d.canReplaceWith(c,c,p[0])}if(u)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function Vb(n,e,t=e,r=M.empty){if(e==t&&!r.size)return null;let o=n.resolve(e),i=n.resolve(t);return hu(o,i,r)?new $n(e,t,r):new Hb(o,i,r).fit()}function hu(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}let Hb=class{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=x.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=x.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,s=r.depth,a=o.depth;for(;s&&a&&i.childCount==1;)i=i.firstChild.content,s--,a--;let c=new M(i,s,a);return e>-1?new vr(r.pos,e,this.$to.pos,this.$to.end(),c,t):c.size||r.pos!=this.$to.pos?new $n(r.pos,o.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let i=t.firstChild;if(t.childCount>1&&(o=0),i.type.spec.isolating&&o<=r){e=r;break}t=i.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=Qa(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let a=this.depth;a>=0;a--){let{type:c,match:d}=this.frontier[a],u,p=null;if(t==1&&(s?d.matchType(s.type)||(p=d.fillBefore(x.from(s),!1)):i&&c.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:p};if(t==2&&s&&(u=d.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:u};if(i&&d.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=Qa(e,t);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new M(e,t+1,Math.max(r,o.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=Qa(e,t);if(o.childCount<=1&&t>0){let i=e.size-t<=t+o.size;this.unplaced=new M(zo(e,t-1,1),t-1,i?t-1:r)}else this.unplaced=new M(zo(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:o,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let s=this.unplaced,a=r?r.content:s.content,c=s.openStart-e,d=0,u=[],{match:p,type:f}=this.frontier[t];if(o){for(let g=0;g<o.childCount;g++)u.push(o.child(g));p=p.matchFragment(o)}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(mu(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=Vo(this.placed,t,x.from(u)),this.frontier[t].match=p,m&&h<0&&r&&r.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?M.empty:new M(zo(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new M(zo(s.content,e,d),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!el(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:o}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=el(e,t,o,r,i);if(s){for(let a=t-1;a>=0;a--){let{match:c,type:d}=this.frontier[a],u=el(e,a,d,c,!0);if(!u||u.childCount)continue e}return{depth:t,fit:s,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Vo(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,t=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=Vo(this.placed,this.depth,x.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(x.empty,!0);t.childCount&&(this.placed=Vo(this.placed,this.frontier.length,t))}};function zo(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(zo(n.firstChild.content,e-1,t)))}function Vo(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Vo(n.lastChild.content,e-1,t)))}function Qa(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function mu(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,mu(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(x.empty,!0)))),n.copy(r)}function el(n,e,t,r,o){let i=n.node(e),s=o?n.indexAfter(e):n.index(e);if(s==i.childCount&&!t.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!Ub(t,i.content,s)?a:null}function Ub(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function Wb(n){return n.spec.defining||n.spec.definingForContent}function qb(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let o=n.doc.resolve(e),i=n.doc.resolve(t);if(hu(o,i,r))return n.step(new $n(e,t,r));let s=bu(o,n.doc.resolve(t));s[s.length-1]==0&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let f=o.depth,h=o.pos-1;f>0;f--,h--){let m=o.node(f).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(f)>-1?a=f:o.before(f)==h&&s.splice(1,0,-f)}let c=s.indexOf(a),d=[],u=r.openStart;for(let f=r.content,h=0;;h++){let m=f.firstChild;if(d.push(m),h==r.openStart)break;f=m.content}for(let f=u-1;f>=0;f--){let h=d[f],m=Wb(h.type);if(m&&!h.sameMarkup(o.node(Math.abs(a)-1)))u=f;else if(m||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+u+1)%(r.openStart+1),m=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 E=o.node(b-1),C=o.index(b-1);if(E.canReplaceWith(C,C,m.type,m.marks))return n.replace(o.before(b),y?i.after(b):t,new M(gu(r.content,0,r.openStart,h),h,r.openEnd))}}let p=n.steps.length;for(let f=s.length-1;f>=0&&(n.replace(e,t,r),!(n.steps.length>p));f--){let h=s[f];h<0||(e=o.before(h),t=i.after(h))}}function gu(n,e,t,r,o){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(gu(i.content,e+1,t,r,i)))}if(e>r){let i=o.contentMatchAt(0),s=i.fillBefore(n).append(n);n=s.append(i.matchFragment(s).fillBefore(x.empty,!0))}return n}function Kb(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let o=Fb(n.doc,e,r.type);o!=null&&(e=t=o)}n.replaceRange(e,t,new M(x.from(r),0,0))}function Gb(n,e,t){let r=n.doc.resolve(e),o=n.doc.resolve(t),i=bu(r,o);for(let s=0;s<i.length;s++){let a=i[s],c=s==i.length-1;if(c&&a==0||r.node(a).type.contentMatch.validEnd)return n.delete(r.start(a),o.end(a));if(a>0&&(c||r.node(a-1).canReplace(r.index(a-1),o.indexAfter(a-1))))return n.delete(r.before(a),o.after(a))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(e-r.start(s)==r.depth-s&&t>r.end(s)&&o.end(s)-t!=o.depth-s)return n.delete(r.before(s),t);n.delete(e,t)}function bu(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let o=r;o>=0;o--){let i=n.start(o);if(i<n.pos-(n.depth-o)||e.end(o)>e.pos+(e.depth-o)||n.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==n.depth&&o==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&t.push(o)}return t}let yu=class za extends Et{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return Tt.fail("No node at attribute step's position");let r=Object.create(null);for(let i in t.attrs)r[i]=t.attrs[i];r[this.attr]=this.value;let o=t.type.create(r,null,t.marks);return Tt.fromReplace(e,this.pos,this.pos+1,new M(x.from(o),0,t.isLeaf?0:1))}getMap(){return Ar.empty}invert(e){return new za(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new za(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new za(t.pos,t.attr,t.value)}};Et.jsonID("attr",yu);let ku=class Dd extends Et{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let o in e.attrs)t[o]=e.attrs[o];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return Tt.ok(r)}getMap(){return Ar.empty}invert(e){return new Dd(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Dd(t.attr,t.value)}};Et.jsonID("docAttr",ku);let eo=class extends Error{};eo=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},eo.prototype=Object.create(Error.prototype),eo.prototype.constructor=eo,eo.prototype.name="TransformError";let jb=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ob}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new eo(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=M.empty){let o=Vb(this.doc,e,t,r);return o&&this.step(o),this}replaceWith(e,t,r){return this.replace(e,t,new M(x.from(r),0,0))}delete(e,t){return this.replace(e,t,M.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return qb(this,e,t,r),this}replaceRangeWith(e,t,r){return Kb(this,e,t,r),this}deleteRange(e,t){return Gb(this,e,t),this}lift(e,t){return Rb(this,e,t),this}join(e,t=1){return $b(this,e,t),this}wrap(e,t){return Db(this,e,t),this}setBlockType(e,t=e,r,o=null){return Ib(this,e,t,r,o),this}setNodeMarkup(e,t,r=null,o){return Lb(this,e,t,r,o),this}setNodeAttribute(e,t,r){return this.step(new yu(e,t,r)),this}setDocAttribute(e,t){return this.step(new ku(e,t)),this}addNodeMark(e,t){return this.step(new Ya(e,t)),this}removeNodeMark(e,t){if(!(t instanceof De)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new Xa(e,t)),this}split(e,t=1,r){return Pb(this,e,t,r),this}addMark(e,t,r){return Mb(this,e,t,r),this}removeMark(e,t,r){return Ab(this,e,t,r),this}clearIncompatible(e,t,r){return vb(this,e,t,r),this}};const tl=Object.create(null);class Q{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new Eu(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=M.empty){let r=t.content.lastChild,o=null;for(let a=0;a<t.openEnd;a++)o=r,r=r.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?M.empty:t),a==0&&_u(e,i,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{$from:s,$to:a}=o[i],c=e.mapping.slice(r),d=c.map(s.pos),u=c.map(a.pos);i?e.deleteRange(d,u):(e.replaceRangeWith(d,u,t),_u(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let o=e.parent.inlineContent?new J(e):to(e.node(0),e.parent,e.pos,e.index(),t,r);if(o)return o;for(let i=e.depth-1;i>=0;i--){let s=t<0?to(e.node(0),e.node(i),e.before(i+1),e.index(i),t,r):to(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,r);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Ut(e.node(0))}static atStart(e){return to(e,e,0,0,1)||new Ut(e)}static atEnd(e){return to(e,e,e.content.size,e.childCount,-1)||new Ut(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=tl[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in tl)throw new RangeError("Duplicate use of selection JSON ID "+e);return tl[e]=t,t.prototype.jsonID=e,t}getBookmark(){return J.between(this.$anchor,this.$head).getBookmark()}}Q.prototype.visible=!0;class Eu{constructor(e,t){this.$from=e,this.$to=t}}let wu=!1;function Cu(n){!wu&&!n.parent.inlineContent&&(wu=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class J extends Q{constructor(e,t=e){Cu(e),Cu(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return Q.near(r);let o=e.resolve(t.map(this.anchor));return new J(o.parent.inlineContent?o:r,r)}replace(e,t=M.empty){if(super.replace(e,t),t==M.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof J&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Gi(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new J(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let o=e.resolve(t);return new this(o,r==t?o:e.resolve(r))}static between(e,t,r){let o=e.pos-t.pos;if((!r||o)&&(r=o>=0?1:-1),!t.parent.inlineContent){let i=Q.findFrom(t,r,!0)||Q.findFrom(t,-r,!0);if(i)t=i.$head;else return Q.near(t,r)}return e.parent.inlineContent||(o==0?e=t:(e=(Q.findFrom(e,-r,!0)||Q.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=o<0&&(e=t))),new J(e,t)}}Q.jsonID("text",J);class Gi{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Gi(e.map(this.anchor),e.map(this.head))}resolve(e){return J.between(e.resolve(this.anchor),e.resolve(this.head))}}class K extends Q{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:o}=t.mapResult(this.anchor),i=e.resolve(o);return r?Q.near(i):new K(i)}content(){return new M(x.from(this.node),0,0)}eq(e){return e instanceof K&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new nl(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new K(e.resolve(t.anchor))}static create(e,t){return new K(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}K.prototype.visible=!1,Q.jsonID("node",K);class nl{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Gi(r,r):new nl(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&K.isSelectable(r)?new K(t):Q.near(t)}}class Ut extends Q{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=M.empty){if(t==M.empty){e.delete(0,e.doc.content.size);let r=Q.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ut(e)}map(e){return new Ut(e)}eq(e){return e instanceof Ut}getBookmark(){return Jb}}Q.jsonID("all",Ut);const Jb={map(){return this},resolve(n){return new Ut(n)}};function to(n,e,t,r,o,i=!1){if(e.inlineContent)return J.create(n,t);for(let s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){let a=e.child(s);if(a.isAtom){if(!i&&K.isSelectable(a))return K.create(n,t-(o<0?a.nodeSize:0))}else{let c=to(n,a,t+o,o<0?a.childCount:0,o,i);if(c)return c}t+=a.nodeSize*o}return null}function _u(n,e,t){let r=n.steps.length-1;if(r<e)return;let o=n.steps[r];if(!(o instanceof $n||o instanceof vr))return;let i=n.mapping.maps[r],s;i.forEach((a,c,d,u)=>{s==null&&(s=u)}),n.setSelection(Q.near(n.doc.resolve(s),t))}const Su=1,xu=2,Nu=4;class Yb extends jb{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|Su)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&Su)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=xu,this}ensureMarks(e){return De.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&xu)>0}addStep(e,t){super.addStep(e,t),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,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||De.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let o=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(t);i=r==t?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,o.text(e,i)),this.selection.empty||this.setSelection(Q.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Nu,this}get scrolledIntoView(){return(this.updated&Nu)>0}}function Tu(n,e){return!e||!n?n:n.bind(e)}class Ho{constructor(e,t,r){this.name=e,this.init=Tu(t.init,r),this.apply=Tu(t.apply,r)}}const Xb=[new Ho("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Ho("selection",{init(n,e){return n.selection||Q.atStart(e.doc)},apply(n){return n.selection}}),new Ho("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Ho("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class rl{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Xb.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Ho(r.key,r.spec.state,r))})}}class no{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),o=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let a=this.config.plugins[s];if(a.spec.appendTransaction){let c=o?o[s].n:0,d=o?o[s].state:this,u=c<t.length&&a.spec.appendTransaction.call(a,c?t.slice(c):t,d,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!o){o=[];for(let p=0;p<this.config.plugins.length;p++)o.push(p<s?{state:r,n:t.length}:{state:this,n:0})}t.push(u),r=r.applyInner(u),i=!0}o&&(o[s]={state:r,n:t.length})}}if(!i)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new no(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let i=r[o];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new Yb(this)}static create(e){let t=new rl(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new no(t);for(let o=0;o<t.fields.length;o++)r[t.fields[o].name]=t.fields[o].init(e,r);return r}reconfigure(e){let t=new rl(this.schema,e.plugins),r=t.fields,o=new no(t);for(let i=0;i<r.length;i++){let s=r[i].name;o[s]=this.hasOwnProperty(s)?this[s]:r[i].init(e,o)}return o}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[r],i=o.spec.state;i&&i.toJSON&&(t[r]=i.toJSON.call(o,this[o.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new rl(e.schema,e.plugins),i=new no(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=Qn.fromJSON(e.schema,t.doc);else if(s.name=="selection")i.selection=Q.fromJSON(i.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let c=r[a],d=c.spec.state;if(c.key==s.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){i[s.name]=d.fromJSON.call(c,e,t[a],i);return}}i[s.name]=s.init(e,i)}}),i}}function Ou(n,e,t){for(let r in n){let o=n[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=Ou(o,e,{})),t[r]=o}return t}class Ne{constructor(e){this.spec=e,this.props={},e.props&&Ou(e.props,this,this.props),this.key=e.key?e.key.key:Mu("plugin")}getState(e){return e[this.key]}}const ol=Object.create(null);function Mu(n){return n in ol?n+"$"+ ++ol[n]:(ol[n]=0,n+"$")}class Fe{constructor(e="key"){this.key=Mu(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Au=65535,vu=Math.pow(2,16);function Zb(n,e){return n+e*vu}function Ru(n){return n&Au}function Qb(n){return(n-(n&Au))/vu}const Du=1,Iu=2,ji=4,Bu=8;class il{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Bu)>0}get deletedBefore(){return(this.delInfo&(Du|ji))>0}get deletedAfter(){return(this.delInfo&(Iu|ji))>0}get deletedAcross(){return(this.delInfo&ji)>0}}class Wt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Wt.empty)return Wt.empty}recover(e){let t=0,r=Ru(e);if(!this.inverted)for(let o=0;o<r;o++)t+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+t+Qb(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let o=0,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=this.ranges[a+s],p=c+d;if(e<=p){let f=d?e==c?-1:e==p?1:t:t,h=c+o+(f<0?0:u);if(r)return h;let m=e==(t<0?c:p)?null:Zb(a/3,e-c),g=e==c?Iu:e==p?Du:ji;return(t<0?e!=c:e!=p)&&(g|=Bu),new il(h,g,m)}o+=u-d}return r?e+o:new il(e+o,0,null)}touches(e,t){let r=0,o=Ru(t),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=c+d;if(e<=u&&a==o*3)return!0;r+=this.ranges[a+s]-d}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],a=s-(this.inverted?i:0),c=s+(this.inverted?0:i),d=this.ranges[o+t],u=this.ranges[o+r];e(a,a+d,c,c+u),i+=u-d}}invert(){return new Wt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Wt.empty:new Wt(e<0?[0,-e,0]:[0,0,e])}}Wt.empty=new Wt([]);class ro{constructor(e=[],t,r=0,o=e.length){this.maps=e,this.mirror=t,this.from=r,this.to=o}slice(e=0,t=this.maps.length){return new ro(this.maps,this.mirror,e,t)}copy(){return new ro(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),t!=null&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,r=this.maps.length;t<e.maps.length;t++){let o=e.getMirror(t);this.appendMap(e.maps[t],o!=null&&o<t?r+o:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this.maps.length+e.maps.length;t>=0;t--){let o=e.getMirror(t);this.appendMap(e.maps[t].invert(),o!=null&&o>t?r-o-1:void 0)}}invert(){let e=new ro;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let o=0;for(let i=this.from;i<this.to;i++){let s=this.maps[i],a=s.mapResult(e,t);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}}o|=a.delInfo,e=a.pos}return r?e:new il(e,o,null)}}const sl=Object.create(null);class wt{getMap(){return Wt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=sl[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in sl)throw new RangeError("Duplicate use of step JSON ID "+e);return sl[e]=t,t.prototype.jsonID=e,t}}class tt{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new tt(e,null)}static fail(e){return new tt(null,e)}static fromReplace(e,t,r,o){try{return tt.ok(e.replace(t,r,o))}catch(i){if(i instanceof Io)return tt.fail(i.message);throw i}}}function al(n,e,t){let r=[];for(let o=0;o<n.childCount;o++){let i=n.child(o);i.content.size&&(i=i.copy(al(i.content,e,i))),i.isInline&&(i=e(i,t,o)),r.push(i)}return x.fromArray(r)}class tr extends wt{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new M(al(t.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),t.openStart,t.openEnd);return tt.fromReplace(e,this.from,this.to,i)}invert(){return new wn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new tr(t.pos,r.pos,this.mark)}merge(e){return e instanceof tr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new tr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new tr(t.from,t.to,e.markFromJSON(t.mark))}}wt.jsonID("addMark",tr);class wn extends wt{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new M(al(t.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),t.openStart,t.openEnd);return tt.fromReplace(e,this.from,this.to,r)}invert(){return new tr(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new wn(t.pos,r.pos,this.mark)}merge(e){return e instanceof wn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new wn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new wn(t.from,t.to,e.markFromJSON(t.mark))}}wt.jsonID("removeMark",wn);class nr extends wt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return tt.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return tt.fromReplace(e,this.pos,this.pos+1,new M(x.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let o=0;o<t.marks.length;o++)if(!t.marks[o].isInSet(r))return new nr(this.pos,t.marks[o]);return new nr(this.pos,this.mark)}}return new oo(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new nr(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new nr(t.pos,e.markFromJSON(t.mark))}}wt.jsonID("addNodeMark",nr);class oo extends wt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return tt.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return tt.fromReplace(e,this.pos,this.pos+1,new M(x.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new nr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new oo(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new oo(t.pos,e.markFromJSON(t.mark))}}wt.jsonID("removeNodeMark",oo);class pt extends wt{constructor(e,t,r,o=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=o}apply(e){return this.structure&&ll(e,this.from,this.to)?tt.fail("Structure replace would overwrite content"):tt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Wt([this.from,this.to-this.from,this.slice.size])}invert(e){return new pt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new pt(t.pos,Math.max(t.pos,r.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 t=this.slice.size+e.slice.size==0?M.empty:new M(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new pt(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?M.empty:new M(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new pt(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new pt(t.from,t.to,M.fromJSON(e,t.slice),!!t.structure)}}wt.jsonID("replace",pt);class ft extends wt{constructor(e,t,r,o,i,s,a=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=a}apply(e){if(this.structure&&(ll(e,this.from,this.gapFrom)||ll(e,this.gapTo,this.to)))return tt.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return tt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?tt.fromReplace(e,this.from,this.to,r):tt.fail("Content does not fit in gap")}getMap(){return new Wt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new ft(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||o<t.pos||i>r.pos?null:new ft(t.pos,r.pos,o,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,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ft(t.from,t.to,t.gapFrom,t.gapTo,M.fromJSON(e,t.slice),t.insert,!!t.structure)}}wt.jsonID("replaceAround",ft);function ll(n,e,t){let r=n.resolve(e),o=t-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function ey(n,e,t,r){let o=[],i=[],s,a;n.doc.nodesBetween(e,t,(c,d,u)=>{if(!c.isInline)return;let p=c.marks;if(!r.isInSet(p)&&u.type.allowsMarkType(r.type)){let f=Math.max(d,e),h=Math.min(d+c.nodeSize,t),m=r.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:o.push(s=new wn(f,h,p[g])));a&&a.to==f?a.to=h:i.push(a=new tr(f,h,r))}}),o.forEach(c=>n.step(c)),i.forEach(c=>n.step(c))}function ty(n,e,t,r){let o=[],i=0;n.doc.nodesBetween(e,t,(s,a)=>{if(!s.isInline)return;i++;let c=null;if(r instanceof Po){let d=s.marks,u;for(;u=r.isInSet(d);)(c||(c=[])).push(u),d=u.removeFromSet(d)}else r?r.isInSet(s.marks)&&(c=[r]):c=s.marks;if(c&&c.length){let d=Math.min(a+s.nodeSize,t);for(let u=0;u<c.length;u++){let p=c[u],f;for(let h=0;h<o.length;h++){let m=o[h];m.step==i-1&&p.eq(o[h].style)&&(f=m)}f?(f.to=d,f.step=i):o.push({style:p,from:Math.max(a,e),to:d,step:i})}}}),o.forEach(s=>n.step(new wn(s.from,s.to,s.style)))}function cl(n,e,t,r=t.contentMatch,o=!0){let i=n.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=r.matchType(d.type);if(!p)s.push(new pt(a,u,M.empty));else{r=p;for(let f=0;f<d.marks.length;f++)t.allowsMarkType(d.marks[f].type)||n.step(new wn(a,u,d.marks[f]));if(o&&d.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,m;for(;f=h.exec(d.text);)m||(m=new M(x.from(t.schema.text(" ",t.allowedMarks(d.marks))),0,0)),s.push(new pt(a+f.index,a+f.index+f[0].length,m))}}a=u}if(!r.validEnd){let c=r.fillBefore(x.empty,!0);n.replace(a,a,new M(c,0,0))}for(let c=s.length-1;c>=0;c--)n.step(s[c])}function ny(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function io(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let o=n.$from.node(r),i=n.$from.index(r),s=n.$to.indexAfter(r);if(r<n.depth&&o.canReplace(i,s,t))return r;if(r==0||o.type.spec.isolating||!ny(o,i,s))break}return null}function ry(n,e,t){let{$from:r,$to:o,depth:i}=e,s=r.before(i+1),a=o.after(i+1),c=s,d=a,u=x.empty,p=0;for(let m=i,g=!1;m>t;m--)g||r.index(m)>0?(g=!0,u=x.from(r.node(m).copy(u)),p++):c--;let f=x.empty,h=0;for(let m=i,g=!1;m>t;m--)g||o.after(m+1)<o.end(m)?(g=!0,f=x.from(o.node(m).copy(f)),h++):d++;n.step(new ft(c,d,s,a,new M(u.append(f),p,h),u.size-p,!0))}function dl(n,e,t=null,r=n){let o=oy(n,e),i=o&&iy(r,e);return i?o.map(Lu).concat({type:e,attrs:t}).concat(i.map(Lu)):null}function Lu(n){return{type:n,attrs:null}}function oy(n,e){let{parent:t,startIndex:r,endIndex:o}=n,i=t.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return t.canReplaceWith(r,o,s)?i:null}function iy(n,e){let{parent:t,startIndex:r,endIndex:o}=n,i=t.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let c=(s.length?s[s.length-1]:e).contentMatch;for(let d=r;c&&d<o;d++)c=c.matchType(t.child(d).type);return!c||!c.validEnd?null:s}function sy(n,e,t){let r=x.empty;for(let s=t.length-1;s>=0;s--){if(r.size){let a=t[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=x.from(t[s].type.create(t[s].attrs,r))}let o=e.start,i=e.end;n.step(new ft(o,i,o,i,new M(r,0,0),t.length,!0))}function ay(n,e,t,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(s,a)=>{let c=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,c)&&ly(n.doc,n.mapping.slice(i).map(a),r)){let d=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!m?d=!1:!h&&m&&(d=!0)}d===!1&&$u(n,s,a,i),cl(n,n.mapping.slice(i).map(a,1),r,void 0,d===null);let u=n.mapping.slice(i),p=u.map(a,1),f=u.map(a+s.nodeSize,1);return n.step(new ft(p,f,p+1,f-1,new M(x.from(r.create(c,null,s.marks)),0,0),1,!0)),d===!0&&Pu(n,s,a,i),!1}})}function Pu(n,e,t,r){e.forEach((o,i)=>{if(o.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(o.text);){let c=n.mapping.slice(r).map(t+1+i+s.index);n.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function $u(n,e,t,r){e.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=n.mapping.slice(r).map(t+1+i);n.replaceWith(s,s+1,e.type.schema.text(`
8
+ `))}})}function ly(n,e,t){let r=n.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,t)}function cy(n,e,t,r,o){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let s=t.create(r,null,o||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,s);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new ft(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new M(x.from(s),0,0),1,!0))}function Fn(n,e,t=1,r){let o=n.resolve(e),i=o.depth-t,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let d=o.depth-1,u=t-2;d>i;d--,u--){let p=o.node(d),f=o.index(d);if(p.type.spec.isolating)return!1;let h=p.content.cutByIndex(f,p.childCount),m=r&&r[u+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[u]||p;if(!p.canReplace(f+1,p.childCount)||!g.type.validContent(h))return!1}let a=o.indexAfter(i),c=r&&r[0];return o.node(i).canReplaceWith(a,a,c?c.type:o.node(i+1).type)}function dy(n,e,t=1,r){let o=n.doc.resolve(e),i=x.empty,s=x.empty;for(let a=o.depth,c=o.depth-t,d=t-1;a>c;a--,d--){i=x.from(o.node(a).copy(i));let u=r&&r[d];s=x.from(u?u.type.create(u.attrs,s):o.node(a).copy(s))}n.step(new pt(e,e,new M(i.append(s),t,t),!0))}function rr(n,e){let t=n.resolve(e),r=t.index();return Fu(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function uy(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let o=0;o<e.childCount;o++){let i=e.child(o),s=i.type==r?n.type.schema.nodes.text:i.type;if(t=t.matchType(s),!t||!n.type.allowsMarks(i.marks))return!1}return t.validEnd}function Fu(n,e){return!!(n&&e&&!n.isLeaf&&uy(n,e))}function Ji(n,e,t=-1){let r=n.resolve(e);for(let o=r.depth;;o--){let i,s,a=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):t>0?(i=r.node(o+1),a++,s=r.node(o).maybeChild(a)):(i=r.node(o).maybeChild(a-1),s=r.node(o+1)),i&&!i.isTextblock&&Fu(i,s)&&r.node(o).canReplace(a,a+1))return e;if(o==0)break;e=t<0?r.before(o):r.after(o)}}function py(n,e,t){let r=null,{linebreakReplacement:o}=n.doc.type.schema,i=n.doc.resolve(e-t),s=i.node().type;if(o&&s.inlineContent){let u=s.whitespace=="pre",p=!!s.contentMatch.matchType(o);u&&!p?r=!1:!u&&p&&(r=!0)}let a=n.steps.length;if(r===!1){let u=n.doc.resolve(e+t);$u(n,u.node(),u.before(),a)}s.inlineContent&&cl(n,e+t-1,s,i.node().contentMatchAt(i.index()),r==null);let c=n.mapping.slice(a),d=c.map(e-t);if(n.step(new pt(d,c.map(e+t,-1),M.empty,!0)),r===!0){let u=n.doc.resolve(d);Pu(n,u.node(),u.before(),n.steps.length)}return n}function fy(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,t))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,t))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function hy(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let o=t.content;for(let i=0;i<t.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(t.openStart==0&&t.size?2:1);i++)for(let s=r.depth;s>=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,c=r.index(s)+(a>0?1:0),d=r.node(s),u=!1;if(i==1)u=d.canReplace(c,c,o);else{let p=d.contentMatchAt(c).findWrapping(o.firstChild.type);u=p&&d.canReplaceWith(c,c,p[0])}if(u)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function Yi(n,e,t=e,r=M.empty){if(e==t&&!r.size)return null;let o=n.resolve(e),i=n.resolve(t);return zu(o,i,r)?new pt(e,t,r):new my(o,i,r).fit()}function zu(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class my{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=x.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=x.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,s=r.depth,a=o.depth;for(;s&&a&&i.childCount==1;)i=i.firstChild.content,s--,a--;let c=new M(i,s,a);return e>-1?new ft(r.pos,e,this.$to.pos,this.$to.end(),c,t):c.size||r.pos!=this.$to.pos?new pt(r.pos,o.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let i=t.firstChild;if(t.childCount>1&&(o=0),i.type.spec.isolating&&o<=r){e=r;break}t=i.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=ul(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let a=this.depth;a>=0;a--){let{type:c,match:d}=this.frontier[a],u,p=null;if(t==1&&(s?d.matchType(s.type)||(p=d.fillBefore(x.from(s),!1)):i&&c.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:p};if(t==2&&s&&(u=d.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:u};if(i&&d.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=ul(e,t);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new M(e,t+1,Math.max(r,o.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=ul(e,t);if(o.childCount<=1&&t>0){let i=e.size-t<=t+o.size;this.unplaced=new M(Uo(e,t-1,1),t-1,i?t-1:r)}else this.unplaced=new M(Uo(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:o,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let s=this.unplaced,a=r?r.content:s.content,c=s.openStart-e,d=0,u=[],{match:p,type:f}=this.frontier[t];if(o){for(let g=0;g<o.childCount;g++)u.push(o.child(g));p=p.matchFragment(o)}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(Vu(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=Wo(this.placed,t,x.from(u)),this.frontier[t].match=p,m&&h<0&&r&&r.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?M.empty:new M(Uo(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new M(Uo(s.content,e,d),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!pl(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:o}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=pl(e,t,o,r,i);if(s){for(let a=t-1;a>=0;a--){let{match:c,type:d}=this.frontier[a],u=pl(e,a,d,c,!0);if(!u||u.childCount)continue e}return{depth:t,fit:s,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Wo(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,t=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=Wo(this.placed,this.depth,x.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(x.empty,!0);t.childCount&&(this.placed=Wo(this.placed,this.frontier.length,t))}}function Uo(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Uo(n.firstChild.content,e-1,t)))}function Wo(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Wo(n.lastChild.content,e-1,t)))}function ul(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Vu(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,Vu(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(x.empty,!0)))),n.copy(r)}function pl(n,e,t,r,o){let i=n.node(e),s=o?n.indexAfter(e):n.index(e);if(s==i.childCount&&!t.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!gy(t,i.content,s)?a:null}function gy(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function by(n){return n.spec.defining||n.spec.definingForContent}function yy(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let o=n.doc.resolve(e),i=n.doc.resolve(t);if(zu(o,i,r))return n.step(new pt(e,t,r));let s=Uu(o,n.doc.resolve(t));s[s.length-1]==0&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let f=o.depth,h=o.pos-1;f>0;f--,h--){let m=o.node(f).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(f)>-1?a=f:o.before(f)==h&&s.splice(1,0,-f)}let c=s.indexOf(a),d=[],u=r.openStart;for(let f=r.content,h=0;;h++){let m=f.firstChild;if(d.push(m),h==r.openStart)break;f=m.content}for(let f=u-1;f>=0;f--){let h=d[f],m=by(h.type);if(m&&!h.sameMarkup(o.node(Math.abs(a)-1)))u=f;else if(m||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+u+1)%(r.openStart+1),m=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 E=o.node(b-1),C=o.index(b-1);if(E.canReplaceWith(C,C,m.type,m.marks))return n.replace(o.before(b),y?i.after(b):t,new M(Hu(r.content,0,r.openStart,h),h,r.openEnd))}}let p=n.steps.length;for(let f=s.length-1;f>=0&&(n.replace(e,t,r),!(n.steps.length>p));f--){let h=s[f];h<0||(e=o.before(h),t=i.after(h))}}function Hu(n,e,t,r,o){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(Hu(i.content,e+1,t,r,i)))}if(e>r){let i=o.contentMatchAt(0),s=i.fillBefore(n).append(n);n=s.append(i.matchFragment(s).fillBefore(x.empty,!0))}return n}function ky(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let o=fy(n.doc,e,r.type);o!=null&&(e=t=o)}n.replaceRange(e,t,new M(x.from(r),0,0))}function Ey(n,e,t){let r=n.doc.resolve(e),o=n.doc.resolve(t),i=Uu(r,o);for(let s=0;s<i.length;s++){let a=i[s],c=s==i.length-1;if(c&&a==0||r.node(a).type.contentMatch.validEnd)return n.delete(r.start(a),o.end(a));if(a>0&&(c||r.node(a-1).canReplace(r.index(a-1),o.indexAfter(a-1))))return n.delete(r.before(a),o.after(a))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(e-r.start(s)==r.depth-s&&t>r.end(s)&&o.end(s)-t!=o.depth-s&&r.start(s-1)==o.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),o.index(s-1)))return n.delete(r.before(s),t);n.delete(e,t)}function Uu(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let o=r;o>=0;o--){let i=n.start(o);if(i<n.pos-(n.depth-o)||e.end(o)>e.pos+(e.depth-o)||n.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==n.depth&&o==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&t.push(o)}return t}class so extends wt{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return tt.fail("No node at attribute step's position");let r=Object.create(null);for(let i in t.attrs)r[i]=t.attrs[i];r[this.attr]=this.value;let o=t.type.create(r,null,t.marks);return tt.fromReplace(e,this.pos,this.pos+1,new M(x.from(o),0,t.isLeaf?0:1))}getMap(){return Wt.empty}invert(e){return new so(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new so(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new so(t.pos,t.attr,t.value)}}wt.jsonID("attr",so);class qo extends wt{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let o in e.attrs)t[o]=e.attrs[o];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return tt.ok(r)}getMap(){return Wt.empty}invert(e){return new qo(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new qo(t.attr,t.value)}}wt.jsonID("docAttr",qo);let ao=class extends Error{};ao=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},ao.prototype=Object.create(Error.prototype),ao.prototype.constructor=ao,ao.prototype.name="TransformError";class Wu{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ro}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new ao(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=M.empty){let o=Yi(this.doc,e,t,r);return o&&this.step(o),this}replaceWith(e,t,r){return this.replace(e,t,new M(x.from(r),0,0))}delete(e,t){return this.replace(e,t,M.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return yy(this,e,t,r),this}replaceRangeWith(e,t,r){return ky(this,e,t,r),this}deleteRange(e,t){return Ey(this,e,t),this}lift(e,t){return ry(this,e,t),this}join(e,t=1){return py(this,e,t),this}wrap(e,t){return sy(this,e,t),this}setBlockType(e,t=e,r,o=null){return ay(this,e,t,r,o),this}setNodeMarkup(e,t,r=null,o){return cy(this,e,t,r,o),this}setNodeAttribute(e,t,r){return this.step(new so(e,t,r)),this}setDocAttribute(e,t){return this.step(new qo(e,t)),this}addNodeMark(e,t){return this.step(new nr(e,t)),this}removeNodeMark(e,t){if(!(t instanceof De)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new oo(e,t)),this}split(e,t=1,r){return dy(this,e,t,r),this}addMark(e,t,r){return ey(this,e,t,r),this}removeMark(e,t,r){return ty(this,e,t,r),this}clearIncompatible(e,t,r){return cl(this,e,t,r),this}}const ht=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Ko=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let fl=null;const zn=function(n,e,t){let r=fl||(fl=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},wy=function(){fl=null},Rr=function(n,e,t,r){return t&&(qu(n,e,t,r,-1)||qu(n,e,t,r,1))},Cy=/^(img|br|input|textarea|hr)$/i;function qu(n,e,t,r,o){for(;;){if(n==t&&e==r)return!0;if(e==(o<0?0:en(n))){let i=n.parentNode;if(!i||i.nodeType!=1||Go(n)||Cy.test(n.nodeName)||n.contentEditable=="false")return!1;e=ht(n)+(o<0?0:1),n=i}else if(n.nodeType==1){if(n=n.childNodes[e+(o<0?-1:0)],n.contentEditable=="false")return!1;e=o<0?en(n):0}else return!1}}function en(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function _y(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=en(n)}else if(n.parentNode&&!Go(n))e=ht(n),n=n.parentNode;else return null}}function Sy(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!Go(n))e=ht(n)+1,n=n.parentNode;else return null}}function xy(n,e,t){for(let r=e==0,o=e==en(n);r||o;){if(n==t)return!0;let i=ht(n);if(n=n.parentNode,!n)return!1;r=r&&i==0,o=o&&i==en(n)}}function Go(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const Xi=function(n){return n.focusNode&&Rr(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Dr(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Ny(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Ty(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(en(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(en(r.startContainer),r.startOffset)}}}const Cn=typeof navigator<"u"?navigator:null,Ku=typeof document<"u"?document:null,or=Cn&&Cn.userAgent||"",hl=/Edge\/(\d+)/.exec(or),Gu=/MSIE \d/.exec(or),ml=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(or),Pt=!!(Gu||ml||hl),ir=Gu?document.documentMode:ml?+ml[1]:hl?+hl[1]:0,fn=!Pt&&/gecko\/(\d+)/i.test(or);fn&&+(/Firefox\/(\d+)/.exec(or)||[0,0])[1];const gl=!Pt&&/Chrome\/(\d+)/.exec(or),Ct=!!gl,ju=gl?+gl[1]:0,Ot=!Pt&&!!Cn&&/Apple Computer/.test(Cn.vendor),lo=Ot&&(/Mobile\/\w+/.test(or)||!!Cn&&Cn.maxTouchPoints>2),tn=lo||(Cn?/Mac/.test(Cn.platform):!1),Oy=Cn?/Win/.test(Cn.platform):!1,Vn=/Android \d/.test(or),jo=!!Ku&&"webkitFontSmoothing"in Ku.documentElement.style,My=jo?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Ay(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function Hn(n,e){return typeof n=="number"?n:n[e]}function vy(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function Ju(n,e,t){let r=n.someProp("scrollThreshold")||0,o=n.someProp("scrollMargin")||5,i=n.dom.ownerDocument;for(let s=t||n.dom;s;s=Ko(s)){if(s.nodeType!=1)continue;let a=s,c=a==i.body,d=c?Ay(i):vy(a),u=0,p=0;if(e.top<d.top+Hn(r,"top")?p=-(d.top-e.top+Hn(o,"top")):e.bottom>d.bottom-Hn(r,"bottom")&&(p=e.bottom-e.top>d.bottom-d.top?e.top+Hn(o,"top")-d.top:e.bottom-d.bottom+Hn(o,"bottom")),e.left<d.left+Hn(r,"left")?u=-(d.left-e.left+Hn(o,"left")):e.right>d.right-Hn(r,"right")&&(u=e.right-d.right+Hn(o,"right")),u||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 Ry(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,o;for(let i=(e.left+e.right)/2,s=t+1;s<Math.min(innerHeight,e.bottom);s+=5){let a=n.root.elementFromPoint(i,s);if(!a||a==n.dom||!n.dom.contains(a))continue;let c=a.getBoundingClientRect();if(c.top>=t-20){r=a,o=c.top;break}}return{refDOM:r,refTop:o,stack:Yu(n.dom)}}function Yu(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Ko(r));return e}function Dy({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;Xu(t,r==0?0:r-e)}function Xu(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:o,left:i}=n[t];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let co=null;function Iy(n){if(n.setActive)return n.setActive();if(co)return n.focus(co);let e=Yu(n);n.focus(co==null?{get preventScroll(){return co={preventScroll:!0},!0}}:void 0),co||(co=!1,Xu(e,0))}function Zu(n,e){let t,r=2e8,o,i=0,s=e.top,a=e.top,c,d;for(let u=n.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<r){t=u,r=g,o=g&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&g&&(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});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(i=p+1)}}return!t&&c&&(t=c,o=d,r=0),t&&t.nodeType==3?By(t,o):!t||r&&t.nodeType==1?{node:n,offset:i}:Zu(t,o)}function By(n,e){let t=n.nodeValue.length,r=document.createRange();for(let o=0;o<t;o++){r.setEnd(n,o+1),r.setStart(n,o);let i=sr(r,1);if(i.top!=i.bottom&&bl(e,i))return{node:n,offset:o+(e.left>=(i.left+i.right)/2?1:0)}}return{node:n,offset:0}}function bl(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function Ly(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function Py(n,e,t){let{node:r,offset:o}=Zu(e,t),i=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();i=s.left!=s.right&&t.left>(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(r,o,i)}function $y(n,e,t,r){let o=-1;for(let i=e,s=!1;i!=n.dom;){let a=n.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>r.left||c.top>r.top?o=a.posBefore:(!s&&c.right<r.left||c.bottom<r.top)&&(o=a.posAfter),s=!0),!a.contentDOM&&o<0&&!a.node.isText))return(a.node.isBlock?r.top<(c.top+c.bottom)/2:r.left<(c.left+c.right)/2)?a.posBefore:a.posAfter;i=a.dom.parentNode}return o>-1?o:n.docView.posFromDOM(e,t,-1)}function Qu(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),i=o;;){let s=n.childNodes[i];if(s.nodeType==1){let a=s.getClientRects();for(let c=0;c<a.length;c++){let d=a[c];if(bl(e,d))return Qu(s,e,d)}}if((i=(i+1)%r)==o)break}return n}function Fy(n,e){let t=n.dom.ownerDocument,r,o=0,i=Ty(t,e.left,e.top);i&&({node:r,offset:o}=i);let s=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),a;if(!s||!n.dom.contains(s.nodeType!=1?s.parentNode:s)){let d=n.dom.getBoundingClientRect();if(!bl(e,d)||(s=Qu(n.dom,e,d),!s))return null}if(Ot)for(let d=s;r&&d;d=Ko(d))d.draggable&&(r=void 0);if(s=Ly(s,e),r){if(fn&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let u=r.childNodes[o],p;u.nodeName=="IMG"&&(p=u.getBoundingClientRect()).right<=e.left&&p.bottom>e.top&&o++}let d;jo&&o&&r.nodeType==1&&(d=r.childNodes[o-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=e.top&&o--,r==n.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=n.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(a=$y(n,r,o,e))}a==null&&(a=Py(n,s,e));let c=n.docView.nearestDesc(s,!0);return{pos:a,inside:c?c.posAtStart-c.border:-1}}function ep(n){return n.top<n.bottom||n.left<n.right}function sr(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(ep(r))return r}return Array.prototype.find.call(t,ep)||n.getBoundingClientRect()}const zy=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function tp(n,e,t){let{node:r,offset:o,atom:i}=n.docView.domFromPos(e,t<0?-1:1),s=jo||fn;if(r.nodeType==3)if(s&&(zy.test(r.nodeValue)||(t<0?!o:o==r.nodeValue.length))){let c=sr(zn(r,o,o),t);if(fn&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let d=sr(zn(r,o-1,o-1),-1);if(d.top==c.top){let u=sr(zn(r,o,o+1),-1);if(u.top!=c.top)return Jo(u,u.left<d.left)}}return c}else{let c=o,d=o,u=t<0?1:-1;return t<0&&!o?(d++,u=-1):t>=0&&o==r.nodeValue.length?(c--,u=1):t<0?c--:d++,Jo(sr(zn(r,c,d),u),u<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&o&&(t<0||o==en(r))){let c=r.childNodes[o-1];if(c.nodeType==1)return yl(c.getBoundingClientRect(),!1)}if(i==null&&o<en(r)){let c=r.childNodes[o];if(c.nodeType==1)return yl(c.getBoundingClientRect(),!0)}return yl(r.getBoundingClientRect(),t>=0)}if(i==null&&o&&(t<0||o==en(r))){let c=r.childNodes[o-1],d=c.nodeType==3?zn(c,en(c)-(s?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(d)return Jo(sr(d,1),!1)}if(i==null&&o<en(r)){let c=r.childNodes[o];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 Jo(sr(d,-1),!0)}return Jo(sr(r.nodeType==3?zn(r):r,-t),t>=0)}function Jo(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function yl(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function np(n,e,t){let r=n.state,o=n.root.activeElement;r!=e&&n.updateState(e),o!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),o!=n.dom&&o&&o.focus()}}function Vy(n,e,t){let r=e.selection,o=t=="up"?r.$from:r.$to;return np(n,e,()=>{let{node:i}=n.docView.domFromPos(o.pos,t=="up"?-1:1);for(;;){let a=n.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode}let s=tp(n,o.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&&(t=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const Hy=/[\u0590-\u08ac]/;function Uy(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=n.domSelection();return a?!Hy.test(r.parent.textContent)||!a.modify?t=="left"||t=="backward"?i:s:np(n,e,()=>{let{focusNode:c,focusOffset:d,anchorNode:u,anchorOffset:p}=n.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",t,"character");let h=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:m,focusOffset:g}=n.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}):r.pos==r.start()||r.pos==r.end()}let rp=null,op=null,ip=!1;function Wy(n,e,t){return rp==e&&op==t?ip:(rp=e,op=t,ip=t=="up"||t=="down"?Vy(n,e,t):Uy(n,e,t))}const nn=0,sp=1,Ir=2,_n=3;class Yo{constructor(e,t,r,o){this.parent=e,this.children=t,this.dom=r,this.contentDOM=o,this.dirty=nn,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let o=this.children[t];if(o==e)return r;r+=o.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let i,s;if(e==this.contentDOM)i=e.childNodes[t-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[t];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 o;if(e==this.dom&&this.contentDOM)o=t>ht(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&t==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,o=e;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!t||i.node))if(r&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let o=e;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let o=this.children[t],i=r+o.size;if(r==e&&i!=r){for(;!o.border&&o.children.length;)for(let s=0;s<o.children.length;s++){let a=o.children[s];if(a.size){o=a;break}}return o}if(e<i)return o.descAt(e-r-o.border);r=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let i=0;r<this.children.length;r++){let s=this.children[r],a=i+s.size;if(a>e||s instanceof cp){o=e-i;break}i=a}if(o)return this.children[r].domFromPos(o-this.children[r].border,t);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof ap&&i.side>=0;r--);if(t<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&t&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,t):{node:this.contentDOM,offset:i?ht(i.dom)+1:0}}else{let i,s=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,t):{node:this.contentDOM,offset:i?ht(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,i=-1;for(let s=r,a=0;;a++){let c=this.children[a],d=s+c.size;if(o==-1&&e<=d){let u=s+c.border;if(e>=u&&t<=d-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,t,u);e=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)){o=ht(f.dom)+1;break}e-=f.size}o==-1&&(o=0)}if(o>-1&&(d>t||a==this.children.length-1)){t=d;for(let u=a+1;u<this.children.length;u++){let p=this.children[u];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(-1)){i=ht(p.dom);break}t+=p.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=d}return{node:this.contentDOM,from:e,to:t,fromOffset:o,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,o=!1){let i=Math.min(e,t),s=Math.max(e,t);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,t-m-g.border,r,o);m=b}let a=this.domFromPos(e,e?-1:1),c=t==e?a:this.domFromPos(t,t?-1:1),d=r.root.getSelection(),u=r.domSelectionRange(),p=!1;if((fn||Ot)&&e==t){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:ht(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(fn&&u.focusNode&&u.focusNode!=c.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(o=!0)}if(!(o||p&&Ot)&&Rr(a.node,a.offset,u.anchorNode,u.anchorOffset)&&Rr(c.node,c.offset,u.focusNode,u.focusOffset))return;let f=!1;if((d.extend||e==t)&&!p){d.collapse(a.node,a.offset);try{e!=t&&d.extend(c.node,c.offset),f=!0}catch{}}if(!f){if(e>t){let m=a;a=c,c=m}let h=document.createRange();h.setEnd(c.node,c.offset),h.setStart(a.node,a.offset),d.removeAllRanges(),d.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,o=0;o<this.children.length;o++){let i=this.children[o],s=r+i.size;if(r==s?e<=s&&t>=r:e<s&&t>r){let a=r+i.border,c=s-i.border;if(e>=a&&t<=c){this.dirty=e==r||t==s?Ir:sp,e==a&&t==c&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=_n:i.markDirty(e-a,t-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Ir:_n}r=s}this.dirty=Ir}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?Ir:sp;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class ap extends Yo{constructor(e,t,r,o){let i,s=t.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!t.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=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==nn&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class qy extends Yo{constructor(e,t,r,o){super(e,[],t,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Br extends Yo{constructor(e,t,r,o,i){super(e,[],r,o),this.mark=t,this.spec=i}static create(e,t,r,o){let i=o.nodeViews[t.type.name],s=i&&i(t,o,r);return(!s||!s.dom)&&(s=Mr.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new Br(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&_n||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=_n&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=nn){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=nn}}slice(e,t,r){let o=Br.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;t<s&&(i=El(i,t,s,r)),e>0&&(i=El(i,0,e,r));for(let a=0;a<i.length;a++)i[a].parent=o;return o.children=i,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class ar extends Yo{constructor(e,t,r,o,i,s,a,c,d){super(e,[],i,s),this.node=t,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=a}static create(e,t,r,o,i,s){let a=i.nodeViews[t.type.name],c,d=a&&a(t,i,()=>{if(!c)return s;if(c.parent)return c.parent.posBeforeChild(c)},r,o),u=d&&d.dom,p=d&&d.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:p}=Mr.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!p&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let f=u;return u=pp(u,r,t),d?c=new Ky(e,t,r,o,u,p||null,f,d,i,s+1):t.isText?new Zi(e,t,r,o,u,f,i):new ar(e,t,r,o,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 t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>x.empty)}return e}matchesNode(e,t,r){return this.dirty==nn&&e.eq(this.node)&&Qi(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,o=t,i=e.composing?this.localCompositionInfo(e,t):null,s=i&&i.pos>-1?i:null,a=i&&i.pos<0,c=new jy(this,s&&s.node,e);Xy(this.node,this.innerDeco,(d,u,p)=>{d.spec.marks?c.syncToMarks(d.spec.marks,r,e):d.type.side>=0&&!p&&c.syncToMarks(u==this.node.childCount?De.none:this.node.child(u).marks,r,e),c.placeWidget(d,e,o)},(d,u,p,f)=>{c.syncToMarks(d.marks,r,e);let h;c.findNodeMatch(d,u,p,f)||a&&e.state.selection.from>o&&e.state.selection.to<o+d.nodeSize&&(h=c.findIndexWithChild(i.node))>-1&&c.updateNodeAt(d,u,p,h,e)||c.updateNextNode(d,u,p,e,f,o)||c.addNode(d,u,p,e,o),o+=d.nodeSize}),c.syncToMarks([],r,e),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==Ir)&&(s&&this.protectLocalComposition(e,s),dp(this.contentDOM,this.children,e),lo&&Zy(this.dom))}localCompositionInfo(e,t){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof J)||r<t||o>t+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,r-t,o-t);return a<0?null:{node:i,pos:a,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:o}){if(this.getDesc(t))return;let i=t;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 qy(this,i,t,o);e.input.compositionNodes.push(s),this.children=El(this.children,r,r+o.length,e,s)}update(e,t,r,o){return this.dirty==_n||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,o),!0)}updateInner(e,t,r,o){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=nn}updateOuterDeco(e){if(Qi(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=up(this.dom,this.nodeDOM,kl(this.outerDeco,this.node,t),kl(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.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 lp(n,e,t,r,o){pp(r,e,n);let i=new ar(void 0,n,e,t,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class Zi extends ar{constructor(e,t,r,o,i,s,a){super(e,t,r,o,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,t,r,o){return this.dirty==_n||this.dirty!=nn&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=nn||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=nn,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let o=this.node.cut(e,t),i=document.createTextNode(o.text);return new Zi(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=_n)}get domAtom(){return!1}isText(e){return this.node.text==e}}class cp extends Yo{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==nn&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Ky extends ar{constructor(e,t,r,o,i,s,a,c,d,u){super(e,t,r,o,i,s,a,d,u),this.spec=c}update(e,t,r,o){if(this.dirty==_n)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,r);return i&&this.updateInner(e,t,r,o),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,o){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function dp(n,e,t){let r=n.firstChild,o=!1;for(let i=0;i<e.length;i++){let s=e[i],a=s.dom;if(a.parentNode==n){for(;a!=r;)r=fp(r),o=!0;r=r.nextSibling}else o=!0,n.insertBefore(a,r);if(s instanceof Br){let c=r?r.previousSibling:n.lastChild;dp(s.contentDOM,s.children,t),r=c?c.nextSibling:n.firstChild}}for(;r;)r=fp(r),o=!0;o&&t.trackWrites==n&&(t.trackWrites=null)}const Xo=function(n){n&&(this.nodeName=n)};Xo.prototype=Object.create(null);const Lr=[new Xo];function kl(n,e,t){if(n.length==0)return Lr;let r=t?Lr[0]:new Xo,o=[r];for(let i=0;i<n.length;i++){let s=n[i].type.attrs;if(s){s.nodeName&&o.push(r=new Xo(s.nodeName));for(let a in s){let c=s[a];c!=null&&(t&&o.length==1&&o.push(r=new Xo(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+c:a=="style"?r.style=(r.style?r.style+";":"")+c:a!="nodeName"&&(r[a]=c))}}}return o}function up(n,e,t,r){if(t==Lr&&r==Lr)return e;let o=e;for(let i=0;i<r.length;i++){let s=r[i],a=t[i];if(i){let c;a&&a.nodeName==s.nodeName&&o!=n&&(c=o.parentNode)&&c.nodeName.toLowerCase()==s.nodeName||(c=document.createElement(s.nodeName),c.pmIsDeco=!0,c.appendChild(o),a=Lr[0]),o=c}Gy(o,a||Lr[0],s)}return o}function Gy(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],o=t.class?t.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&n.classList.remove(r[i]);for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&n.classList.add(o[i]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(e.style);)n.style.removeProperty(o[1])}t.style&&(n.style.cssText+=t.style)}}function pp(n,e,t){return up(n,n,Lr,kl(e,t,n.nodeType!=1))}function Qi(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function fp(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class jy{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Jy(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r){let o=0,i=this.stack.length>>1,s=Math.min(i,e.length);for(;o<s&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<i;)this.destroyRest(),this.top.dirty=nn,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=Br.create(this.top,e[i],t,r);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,i++}}findNodeMatch(e,t,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,r))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,t,r)&&!this.preMatch.matched.has(d)){i=a;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,r,o,i){let s=this.top.children[o];return s.dirty==_n&&s.dom==s.contentDOM&&(s.dirty=Ir),s.update(e,t,r,i)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}e=t}}updateNextNode(e,t,r,o,i,s){for(let a=this.index;a<this.top.children.length;a++){let c=this.top.children[a];if(c instanceof ar){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!=_n&&Qi(t,c.outerDeco));if(!f&&c.update(e,t,r,o))return this.destroyBetween(this.index,a),c.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(p=this.recreateWrapper(c,e,t,r,o,s)))return this.destroyBetween(this.index,a),this.top.children[this.index]=p,p.contentDOM&&(p.dirty=Ir,p.updateChildren(o,s+1),p.dirty=nn),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,o,i,s){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Qi(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let a=ar.create(this.top,t,r,o,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,t,r,o,i){let s=ar.create(this.top,e,t,r,o,i);s.contentDOM&&s.updateChildren(o,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,t,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(e)&&(e==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let i=new ap(this.top,e,t,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Br;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Zi)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Ot||Ct)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let o=new cp(this.top,[],r,null);t!=this.top?t.children.push(o):t.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Jy(n,e){let t=e,r=t.children.length,o=n.childCount,i=new Map,s=[];e:for(;o>0;){let a;for(;;)if(r){let d=t.children[r-1];if(d instanceof Br)t=d,r=d.children.length;else{a=d,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let c=a.node;if(c){if(c!=n.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}function Yy(n,e){return n.type.side-e.type.side}function Xy(n,e,t,r){let o=e.locals(n),i=0;if(o.length==0){for(let d=0;d<n.childCount;d++){let u=n.child(d);r(u,o,e.forChild(i,u),d),i+=u.nodeSize}return}let s=0,a=[],c=null;for(let d=0;;){let u,p;for(;s<o.length&&o[s].to==i;){let b=o[s++];b.widget&&(u?(p||(p=[u])).push(b):u=b)}if(u)if(p){p.sort(Yy);for(let b=0;b<p.length;b++)t(p[b],d,!!c)}else t(u,d,!!c);let f,h;if(c)h=-1,f=c,c=null;else if(d<n.childCount)h=d,f=n.child(d++);else break;for(let b=0;b<a.length;b++)a[b].to<=i&&a.splice(b--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)a.push(o[s++]);let m=i+f.nodeSize;if(f.isText){let b=m;s<o.length&&o[s].from<b&&(b=o[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<o.length&&o[s].to<m;)s++;let g=f.isInline&&!f.isLeaf?a.filter(b=>!b.inline):a.slice();r(f,g,e.forChild(i,f),h),i=m}}function Zy(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function Qy(n,e,t,r){for(let o=0,i=0;o<n.childCount&&i<=r;){let s=n.child(o++),a=i;if(i+=s.nodeSize,!s.isText)continue;let c=s.text;for(;o<n.childCount;){let d=n.child(o++);if(i+=d.nodeSize,!d.isText)break;c+=d.text}if(i>=t){if(i>=r&&c.slice(r-e.length-a,r-a)==e)return r-e.length;let d=a<r?c.lastIndexOf(e,r-a-1):-1;if(d>=0&&d+e.length+a>=t)return a+d;if(t==r&&c.length>=r+e.length-a&&c.slice(r-a,r-a+e.length)==e)return r}}return-1}function El(n,e,t,r,o){let i=[];for(let s=0,a=0;s<n.length;s++){let c=n[s],d=a,u=a+=c.size;d>=t||u<=e?i.push(c):(d<e&&i.push(c.slice(0,e-d,r)),o&&(i.push(o),o=void 0),u>t&&i.push(c.slice(t-d,c.size,r)))}return i}function wl(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let o=n.docView.nearestDesc(t.focusNode),i=o&&o.size==0,s=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(s<0)return null;let a=r.resolve(s),c,d;if(Xi(t)){for(c=s;o&&!o.node;)o=o.parent;let p=o.node;if(o&&p.isAtom&&K.isSelectable(p)&&o.parent&&!(p.isInline&&xy(t.focusNode,t.focusOffset,o.dom))){let f=o.posBefore;d=new K(s==f?a:r.resolve(f))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let p=s,f=s;for(let h=0;h<t.rangeCount;h++){let m=t.getRangeAt(h);p=Math.min(p,n.docView.posFromDOM(m.startContainer,m.startOffset,1)),f=Math.max(f,n.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(p<0)return null;[c,s]=f==n.state.selection.anchor?[f,p]:[p,f],a=r.resolve(s)}else c=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(c<0)return null}let u=r.resolve(c);if(!d){let p=e=="pointer"||n.state.selection.head<a.pos&&!i?1:-1;d=_l(n,u,a,p)}return d}function hp(n){return n.editable?n.hasFocus():wp(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Un(n,e=!1){let t=n.state.selection;if(yp(n,t),!!hp(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&Ct){let r=n.domSelectionRange(),o=n.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&Rr(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)tk(n);else{let{anchor:r,head:o}=t,i,s;mp&&!(t instanceof J)&&(t.$from.parent.inlineContent||(i=gp(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=gp(n,t.to))),n.docView.setSelection(r,o,n,e),mp&&(i&&bp(i),s&&bp(s)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&ek(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const mp=Ot||Ct&&ju<63;function gp(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),o=r<t.childNodes.length?t.childNodes[r]:null,i=r?t.childNodes[r-1]:null;if(Ot&&o&&o.contentEditable=="false")return Cl(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return Cl(o);if(i)return Cl(i)}}function Cl(n){return n.contentEditable="true",Ot&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function bp(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function ek(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,o=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=o)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!hp(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function tk(n){let e=n.domSelection(),t=document.createRange();if(!e)return;let r=n.cursorWrapper.dom,o=r.nodeName=="IMG";o?t.setStart(r.parentNode,ht(r)+1):t.setStart(r,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!o&&!n.state.selection.visible&&Pt&&ir<=11&&(r.disabled=!0,r.disabled=!1)}function yp(n,e){if(e instanceof K){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(kp(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else kp(n)}function kp(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function _l(n,e,t,r){return n.someProp("createSelectionBetween",o=>o(n,e,t))||J.between(e,t,r)}function Ep(n){return n.editable&&!n.hasFocus()?!1:wp(n)}function wp(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function nk(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return Rr(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Sl(n,e){let{$anchor:t,$head:r}=n.selection,o=e>0?t.max(r):t.min(r),i=o.parent.inlineContent?o.depth?n.doc.resolve(e>0?o.after():o.before()):null:o;return i&&Q.findFrom(i,e)}function lr(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Cp(n,e,t){let r=n.state.selection;if(r instanceof J)if(t.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=n.state.doc.resolve(o.pos+i.nodeSize*(e<0?-1:1));return lr(n,new J(r.$anchor,s))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let o=Sl(n.state,e);return o&&o instanceof K?lr(n,o):!1}else if(!(tn&&t.indexOf("m")>-1)){let o=r.$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return!1;let a=e<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=n.docView.descAt(a))&&!s.contentDOM?K.isSelectable(i)?lr(n,new K(e<0?n.state.doc.resolve(o.pos-i.nodeSize):o)):jo?lr(n,new J(n.state.doc.resolve(e<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof K&&r.node.isInline)return lr(n,new J(e>0?r.$to:r.$from));{let o=Sl(n.state,e);return o?lr(n,o):!1}}}function es(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Zo(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function uo(n,e){return e<0?rk(n):ok(n)}function rk(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let o,i,s=!1;for(fn&&t.nodeType==1&&r<es(t)&&Zo(t.childNodes[r],-1)&&(s=!0);;)if(r>0){if(t.nodeType!=1)break;{let a=t.childNodes[r-1];if(Zo(a,-1))o=t,i=--r;else if(a.nodeType==3)t=a,r=t.nodeValue.length;else break}}else{if(_p(t))break;{let a=t.previousSibling;for(;a&&Zo(a,-1);)o=t.parentNode,i=ht(a),a=a.previousSibling;if(a)t=a,r=es(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}s?xl(n,t,r):o&&xl(n,o,i)}function ok(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let o=es(t),i,s;for(;;)if(r<o){if(t.nodeType!=1)break;let a=t.childNodes[r];if(Zo(a,1))i=t,s=++r;else break}else{if(_p(t))break;{let a=t.nextSibling;for(;a&&Zo(a,1);)i=a.parentNode,s=ht(a)+1,a=a.nextSibling;if(a)t=a,r=0,o=es(t);else{if(t=t.parentNode,t==n.dom)break;r=o=0}}}i&&xl(n,i,s)}function _p(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function ik(n,e){for(;n&&e==n.childNodes.length&&!Go(n);)e=ht(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function sk(n,e){for(;n&&!e&&!Go(n);)e=ht(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function xl(n,e,t){if(e.nodeType!=3){let i,s;(s=ik(e,t))?(e=s,t=0):(i=sk(e,t))&&(e=i,t=i.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Xi(r)){let i=document.createRange();i.setEnd(e,t),i.setStart(e,t),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:o}=n;setTimeout(()=>{n.state==o&&Un(n)},50)}function Sp(n,e){let t=n.state.doc.resolve(e);if(!(Ct||Oy)&&t.parent.inlineContent){let o=n.coordsAtPos(e);if(e>t.start()){let i=n.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left<o.left?"ltr":"rtl"}if(e<t.end()){let i=n.coordsAtPos(e+1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left>o.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function xp(n,e,t){let r=n.state.selection;if(r instanceof J&&!r.empty||t.indexOf("s")>-1||tn&&t.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=Sl(n.state,e);if(s&&s instanceof K)return lr(n,s)}if(!o.parent.inlineContent){let s=e<0?o:i,a=r instanceof Ut?Q.near(s,e):Q.findFrom(s,e);return a?lr(n,a):!1}return!1}function Np(n,e){if(!(n.state.selection instanceof J))return!0;let{$head:t,$anchor:r,empty:o}=n.state.selection;if(!t.sameParent(r))return!0;if(!o)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let s=n.state.tr;return e<0?s.delete(t.pos-i.nodeSize,t.pos):s.delete(t.pos,t.pos+i.nodeSize),n.dispatch(s),!0}return!1}function Tp(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function ak(n){if(!Ot||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Tp(n,r,"true"),setTimeout(()=>Tp(n,r,"false"),20)}return!1}function lk(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function ck(n,e){let t=e.keyCode,r=lk(e);if(t==8||tn&&t==72&&r=="c")return Np(n,-1)||uo(n,-1);if(t==46&&!e.shiftKey||tn&&t==68&&r=="c")return Np(n,1)||uo(n,1);if(t==13||t==27)return!0;if(t==37||tn&&t==66&&r=="c"){let o=t==37?Sp(n,n.state.selection.from)=="ltr"?-1:1:-1;return Cp(n,o,r)||uo(n,o)}else if(t==39||tn&&t==70&&r=="c"){let o=t==39?Sp(n,n.state.selection.from)=="ltr"?1:-1:1;return Cp(n,o,r)||uo(n,o)}else{if(t==38||tn&&t==80&&r=="c")return xp(n,-1,r)||uo(n,-1);if(t==40||tn&&t==78&&r=="c")return ak(n)||xp(n,1,r)||uo(n,1);if(r==(tn?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Nl(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:r,openStart:o,openEnd:i}=e;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let h=r.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let s=n.someProp("clipboardSerializer")||Mr.fromSchema(n.state.schema),a=Bp(),c=a.createElement("div");c.appendChild(s.serializeFragment(r,{document:a}));let d=c.firstChild,u,p=0;for(;d&&d.nodeType==1&&(u=Dp[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",`${o} ${i}${p?` -${p}`:""} ${JSON.stringify(t)}`);let f=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,`
10
+
11
+ `);return{dom:c,text:f,slice:e}}function Op(n,e,t,r,o){let i=o.parent.type.spec.code,s,a;if(!t&&!e)return null;let c=e&&(r||i||!t);if(c){if(n.someProp("transformPastedText",f=>{e=f(e,i||r,n)}),i)return e?new M(x.from(n.state.schema.text(e.replace(/\r\n?/g,`
12
+ `))),0,0):M.empty;let p=n.someProp("clipboardTextParser",f=>f(e,o,r,n));if(p)a=p;else{let f=o.marks(),{schema:h}=n.state,m=Mr.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 n.someProp("transformPastedHTML",p=>{t=p(t,n)}),s=fk(t),jo&&hk(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=(n.someProp("clipboardParser")||n.someProp("domParser")||er.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(c||u),context:o,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!dk.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)a=mk(Rp(a,+u[1],+u[2]),u[4]);else if(a=M.maxOpen(uk(a.content,o),!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=Rp(a,p,f)}return n.someProp("transformPasted",p=>{a=p(a,n)}),a}const dk=/^(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 uk(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.index(t)),i,s=[];if(n.forEach(a=>{if(!s)return;let c=o.findWrapping(a.type),d;if(!c)return s=null;if(d=s.length&&i.length&&Ap(c,i,a,s[s.length-1],0))s[s.length-1]=d;else{s.length&&(s[s.length-1]=vp(s[s.length-1],i.length));let u=Mp(a,c);s.push(u),o=o.matchType(u.type),i=c}}),s)return x.from(s)}return n}function Mp(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,x.from(n));return n}function Ap(n,e,t,r,o){if(o<n.length&&o<e.length&&n[o]==e[o]){let i=Ap(n,e,t,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==n.length-1?t.type:n[o+1]))return r.copy(r.content.append(x.from(Mp(t,n,o+1))))}}function vp(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,vp(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(x.empty,!0);return n.copy(t.append(r))}function Tl(n,e,t,r,o,i){let s=e<0?n.firstChild:n.lastChild,a=s.content;return n.childCount>1&&(i=0),o<r-1&&(a=Tl(a,e,t,r,o+1,i)),o>=t&&(a=e<0?s.contentMatchAt(0).fillBefore(a,i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(x.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(a))}function Rp(n,e,t){return e<n.openStart&&(n=new M(Tl(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new M(Tl(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Dp={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 Ip=null;function Bp(){return Ip||(Ip=document.implementation.createHTMLDocument("title"))}let Ol=null;function pk(n){let e=window.trustedTypes;return e?(Ol||(Ol=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Ol.createHTML(n)):n}function fk(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Bp().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),o;if((o=r&&Dp[r[1].toLowerCase()])&&(n=o.map(i=>"<"+i+">").join("")+n+o.map(i=>"</"+i+">").reverse().join("")),t.innerHTML=pk(n),o)for(let i=0;i<o.length;i++)t=t.querySelector(o[i])||t;return t}function hk(n){let e=n.querySelectorAll(Ct?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function mk(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:o,openStart:i,openEnd:s}=n;for(let a=r.length-2;a>=0;a-=2){let c=t.nodes[r[a]];if(!c||c.hasRequiredAttrs())break;o=x.from(c.create(r[a+1],o)),i++,s++}return new M(o,i,s)}const Mt={},At={},gk={touchstart:!0,touchmove:!0};class bk{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 yk(n){for(let e in Mt){let t=Mt[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{Ek(n,r)&&!Al(n,r)&&(n.editable||!(r.type in At))&&t(n,r)},gk[e]?{passive:!0}:void 0)}Ot&&n.dom.addEventListener("input",()=>null),Ml(n)}function cr(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function kk(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function Ml(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Al(n,r))})}function Al(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function Ek(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function wk(n,e){!Al(n,e)&&Mt[e.type]&&(n.editable||!(e.type in At))&&Mt[e.type](n,e)}At.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Pp(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Vn&&Ct&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),lo&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",o=>o(n,Dr(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||ck(n,t)?t.preventDefault():cr(n,"key")},At.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)},At.keypress=(n,e)=>{let t=e;if(Pp(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||tn&&t.metaKey)return;if(n.someProp("handleKeyPress",o=>o(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof J)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(t.charCode);!/[\r\n]/.test(o)&&!n.someProp("handleTextInput",i=>i(n,r.$from.pos,r.$to.pos,o))&&n.dispatch(n.state.tr.insertText(o).scrollIntoView()),t.preventDefault()}};function ts(n){return{left:n.clientX,top:n.clientY}}function Ck(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function vl(n,e,t,r,o){if(r==-1)return!1;let i=n.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(n.someProp(e,a=>s>i.depth?a(n,t,i.nodeAfter,i.before(s),o,!0):a(n,t,i.node(s),i.before(s),o,!1)))return!0;return!1}function po(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function _k(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&K.isSelectable(r)?(po(n,new K(t)),!0):!1}function Sk(n,e){if(e==-1)return!1;let t=n.state.selection,r,o;t instanceof K&&(r=t.node);let i=n.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let a=s>i.depth?i.nodeAfter:i.node(s);if(K.isSelectable(a)){r&&t.$from.depth>0&&s>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?o=i.before(t.$from.depth):o=i.before(s);break}}return o!=null?(po(n,K.create(n.state.doc,o)),!0):!1}function xk(n,e,t,r,o){return vl(n,"handleClickOn",e,t,r)||n.someProp("handleClick",i=>i(n,e,r))||(o?Sk(n,t):_k(n,t))}function Nk(n,e,t,r){return vl(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",o=>o(n,e,r))}function Tk(n,e,t,r){return vl(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",o=>o(n,e,r))||Ok(n,t,r)}function Ok(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(po(n,J.create(r,0,r.content.size)),!0):!1;let o=r.resolve(e);for(let i=o.depth+1;i>0;i--){let s=i>o.depth?o.nodeAfter:o.node(i),a=o.before(i);if(s.inlineContent)po(n,J.create(r,a+1,a+1+s.content.size));else if(K.isSelectable(s))po(n,K.create(r,a));else continue;return!0}}function Rl(n){return ns(n)}const Lp=tn?"metaKey":"ctrlKey";Mt.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Rl(n),o=Date.now(),i="singleClick";o-n.input.lastClick.time<500&&Ck(t,n.input.lastClick)&&!t[Lp]&&(n.input.lastClick.type=="singleClick"?i="doubleClick":n.input.lastClick.type=="doubleClick"&&(i="tripleClick")),n.input.lastClick={time:o,x:t.clientX,y:t.clientY,type:i};let s=n.posAtCoords(ts(t));s&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Mk(n,s,t,!!r)):(i=="doubleClick"?Nk:Tk)(n,s.pos,s.inside,t)?t.preventDefault():cr(n,"pointer"))};class Mk{constructor(e,t,r,o){this.view=e,this.pos=t,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Lp],this.allowDefault=r.shiftKey;let i,s;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),s=t.inside;else{let u=e.state.doc.resolve(t.pos);i=u.parent,s=u.depth?u.before():0}const a=o?null:r.target,c=a?e.docView.nearestDesc(a,!0):null;this.target=c&&c.dom.nodeType==1?c.dom:null;let{selection:d}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||d instanceof K&&d.from<=s&&d.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&fn&&!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)),cr(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(()=>Un(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(ts(e))),this.updateAllowDefault(e),this.allowDefault||!t?cr(this.view,"pointer"):xk(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ot&&this.mightDrag&&!this.mightDrag.node.isAtom||Ct&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(po(this.view,Q.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):cr(this.view,"pointer")}move(e){this.updateAllowDefault(e),cr(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)}}Mt.touchstart=n=>{n.input.lastTouch=Date.now(),Rl(n),cr(n,"pointer")},Mt.touchmove=n=>{n.input.lastTouch=Date.now(),cr(n,"pointer")},Mt.contextmenu=n=>Rl(n);function Pp(n,e){return n.composing?!0:Ot&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Ak=Vn?5e3:-1;At.compositionstart=At.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof J&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),ns(n,!0),n.markCursor=null;else if(ns(n,!e.selection.empty),fn&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&o.nodeType==1&&i!=0;){let s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){let a=n.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else o=s,i=-1}}n.input.composing=!0}$p(n,Ak)},At.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,$p(n,20))};function $p(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>ns(n),e))}function Fp(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Rk());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function vk(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=_y(e.focusNode,e.focusOffset),r=Sy(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let o=r.pmViewDesc,i=n.domObserver.lastChangedTextNode;if(t==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let s=t.pmViewDesc;if(!(!s||!s.isText(t.nodeValue)))return r}}return t||r}function Rk(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function ns(n,e=!1){if(!(Vn&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Fp(n),e||n.docView&&n.docView.dirty){let t=wl(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!n.state.selection.empty?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function Dk(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Qo=Pt&&ir<15||lo&&My<604;Mt.copy=At.cut=(n,e)=>{let t=e,r=n.state.selection,o=t.type=="cut";if(r.empty)return;let i=Qo?null:t.clipboardData,s=r.content(),{dom:a,text:c}=Nl(n,s);i?(t.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",c)):Dk(n,a),o&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Ik(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Bk(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?ei(n,r.value,null,o,e):ei(n,r.textContent,r.innerHTML,o,e)},50)}function ei(n,e,t,r,o){let i=Op(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",c=>c(n,o,i||M.empty)))return!0;if(!i)return!1;let s=Ik(i),a=s?n.state.tr.replaceSelectionWith(s,r):n.state.tr.replaceSelection(i);return n.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function zp(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}At.paste=(n,e)=>{let t=e;if(n.composing&&!Vn)return;let r=Qo?null:t.clipboardData,o=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&ei(n,zp(r),r.getData("text/html"),o,t)?t.preventDefault():Bk(n,t)};class Vp{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const Hp=tn?"altKey":"ctrlKey";Mt.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let o=n.state.selection,i=o.empty?null:n.posAtCoords(ts(t)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof K?o.to-1:o.to))){if(r&&r.mightDrag)s=K.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let p=n.docView.nearestDesc(t.target,!0);p&&p.node.type.spec.draggable&&p!=n.docView&&(s=K.create(n.state.doc,p.posBefore))}}let a=(s||n.state.selection).content(),{dom:c,text:d,slice:u}=Nl(n,a);(!t.dataTransfer.files.length||!Ct||ju>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Qo?"Text":"text/html",c.innerHTML),t.dataTransfer.effectAllowed="copyMove",Qo||t.dataTransfer.setData("text/plain",d),n.dragging=new Vp(u,!t[Hp],s)},Mt.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)},At.dragover=At.dragenter=(n,e)=>e.preventDefault(),At.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let o=n.posAtCoords(ts(t));if(!o)return;let i=n.state.doc.resolve(o.pos),s=r&&r.slice;s?n.someProp("transformPasted",m=>{s=m(s,n)}):s=Op(n,zp(t.dataTransfer),Qo?null:t.dataTransfer.getData("text/html"),!1,i);let a=!!(r&&!t[Hp]);if(n.someProp("handleDrop",m=>m(n,t,s||M.empty,a))){t.preventDefault();return}if(!s)return;t.preventDefault();let c=s?hy(n.state.doc,i.pos,s):i.pos;c==null&&(c=i.pos);let d=n.state.tr;if(a){let{node:m}=r;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&&K.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))d.setSelection(new K(h));else{let m=d.mapping.map(c);d.mapping.maps[d.mapping.maps.length-1].forEach((g,b,y,E)=>m=E),d.setSelection(_l(n,h,d.doc.resolve(m)))}n.focus(),n.dispatch(d.setMeta("uiEvent","drop"))},Mt.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&Un(n)},20))},Mt.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)},Mt.beforeinput=(n,e)=>{if(Ct&&Vn&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",i=>i(n,Dr(8,"Backspace")))))return;let{$cursor:o}=n.state.selection;o&&o.pos>0&&n.dispatch(n.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let n in At)Mt[n]=At[n];function ti(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class rs{constructor(e,t){this.toDOM=e,this.spec=t||Pr,this.side=this.spec.side||0}map(e,t,r,o){let{pos:i,deleted:s}=e.mapResult(t.from+o,this.side<0?-1:1);return s?null:new Qe(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof rs&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&ti(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class dr{constructor(e,t){this.attrs=e,this.spec=t||Pr}map(e,t,r,o){let i=e.map(t.from+o,this.spec.inclusiveStart?-1:1)-r,s=e.map(t.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new Qe(i,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof dr&&ti(this.attrs,e.attrs)&&ti(this.spec,e.spec)}static is(e){return e.type instanceof dr}destroy(){}}class Dl{constructor(e,t){this.attrs=e,this.spec=t||Pr}map(e,t,r,o){let i=e.mapResult(t.from+o,1);if(i.deleted)return null;let s=e.mapResult(t.to+o,-1);return s.deleted||s.pos<=i.pos?null:new Qe(i.pos-r,s.pos-r,this)}valid(e,t){let{index:r,offset:o}=e.content.findIndex(t.from),i;return o==t.from&&!(i=e.child(r)).isText&&o+i.nodeSize==t.to}eq(e){return this==e||e instanceof Dl&&ti(this.attrs,e.attrs)&&ti(this.spec,e.spec)}destroy(){}}class Qe{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Qe(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new Qe(e,e,new rs(t,r))}static inline(e,t,r,o){return new Qe(e,t,new dr(r,o))}static node(e,t,r,o){return new Qe(e,t,new Dl(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof dr}get widget(){return this.type instanceof rs}}const fo=[],Pr={};class Te{constructor(e,t){this.local=e.length?e:fo,this.children=t.length?t:fo}static create(e,t){return t.length?is(t,e,0,Pr):_t}find(e,t,r){let o=[];return this.findInner(e??0,t??1e9,o,0,r),o}findInner(e,t,r,o,i){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=t&&a.to>=e&&(!i||i(a.spec))&&r.push(a.copy(a.from+o,a.to+o))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){let a=this.children[s]+1;this.children[s+2].findInner(e-a,t-a,r,o+a,i)}}map(e,t,r){return this==_t||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Pr)}mapInner(e,t,r,o,i){let s;for(let a=0;a<this.local.length;a++){let c=this.local[a].map(e,r,o);c&&c.type.valid(t,c)?(s||(s=[])).push(c):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?Lk(this.children,s||[],e,t,r,o,i):s?new Te(s.sort($r),fo):_t}add(e,t){return t.length?this==_t?Te.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let o,i=0;e.forEach((a,c)=>{let d=c+r,u;if(u=Wp(t,a,d)){for(o||(o=this.children.slice());i<o.length&&o[i]<c;)i+=3;o[i]==c?o[i+2]=o[i+2].addInner(a,u,d+1):o.splice(i,0,c,c+a.nodeSize,is(u,a,d+1,Pr)),i+=3}});let s=Up(i?qp(t):t,-r);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||s.splice(a--,1);return new Te(s.length?this.local.concat(s).sort($r):this.local,o||this.children)}remove(e){return e.length==0||this==_t?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,o=this.local;for(let i=0;i<r.length;i+=3){let s,a=r[i]+t,c=r[i+1]+t;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;r==this.children&&(r=this.children.slice());let d=r[i+2].removeInner(s,a+1);d!=_t?r[i+2]=d:(r.splice(i,3),i-=3)}if(o.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let a=0;a<o.length;a++)o[a].eq(s,t)&&(o==this.local&&(o=this.local.slice()),o.splice(a--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new Te(o,r):_t}forChild(e,t){if(this==_t)return this;if(t.isLeaf)return Te.empty;let r,o;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let i=e+1,s=i+t.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 dr){let d=Math.max(i,c.from)-i,u=Math.min(s,c.to)-i;d<u&&(o||(o=[])).push(c.copy(d,u))}}if(o){let a=new Te(o.sort($r),fo);return r?new ur([a,r]):a}return r||_t}eq(e){if(this==e)return!0;if(!(e instanceof Te)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Il(this.localsInner(e))}localsInner(e){if(this==_t)return fo;if(e.inlineContent||!this.local.some(dr.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof dr||t.push(this.local[r]);return t}forEachSet(e){e(this)}}Te.empty=new Te([],[]),Te.removeOverlap=Il;const _t=Te.empty;class ur{constructor(e){this.members=e}map(e,t){const r=this.members.map(o=>o.map(e,t,Pr));return ur.from(r)}forChild(e,t){if(t.isLeaf)return Te.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(e,t);i!=_t&&(i instanceof ur?r=r.concat(i.members):r.push(i))}return ur.from(r)}eq(e){if(!(e instanceof ur)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let o=0;o<this.members.length;o++){let i=this.members[o].localsInner(e);if(i.length)if(!t)t=i;else{r&&(t=t.slice(),r=!1);for(let s=0;s<i.length;s++)t.push(i[s])}}return t?Il(r?t:t.sort($r)):fo}static from(e){switch(e.length){case 0:return _t;case 1:return e[0];default:return new ur(e.every(t=>t instanceof Te)?e:e.reduce((t,r)=>t.concat(r instanceof Te?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Lk(n,e,t,r,o,i,s){let a=n.slice();for(let d=0,u=i;d<t.maps.length;d++){let p=0;t.maps[d].forEach((f,h,m,g)=>{let b=g-m-(h-f);for(let y=0;y<a.length;y+=3){let E=a[y+1];if(E<0||f>E+u-p)continue;let C=a[y]+u-p;h>=C?a[y+1]=f<=C?-2:-1:f>=u&&b&&(a[y]+=b,a[y+1]+=b)}p+=b}),u=t.maps[d].map(u,-1)}let c=!1;for(let d=0;d<a.length;d+=3)if(a[d+1]<0){if(a[d+1]==-2){c=!0,a[d+1]=-1;continue}let u=t.map(n[d]+i),p=u-o;if(p<0||p>=r.content.size){c=!0;continue}let f=t.map(n[d+1]+i,-1),h=f-o,{index:m,offset:g}=r.content.findIndex(p),b=r.maybeChild(m);if(b&&g==p&&g+b.nodeSize==h){let y=a[d+2].mapInner(t,b,u+1,n[d]+i+1,s);y!=_t?(a[d]=p,a[d+1]=h,a[d+2]=y):(a[d+1]=-2,c=!0)}else c=!0}if(c){let d=Pk(a,n,e,t,o,i,s),u=is(d,r,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 Te(e.sort($r),a)}function Up(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let o=n[r];t.push(new Qe(o.from+e,o.to+e,o.type))}return t}function Pk(n,e,t,r,o,i,s){function a(c,d){for(let u=0;u<c.local.length;u++){let p=c.local[u].map(r,o,d);p?t.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<n.length;c+=3)n[c+1]==-1&&a(n[c+2],e[c]+i+1);return t}function Wp(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,o=null;for(let i=0,s;i<n.length;i++)(s=n[i])&&s.from>t&&s.to<r&&((o||(o=[])).push(s),n[i]=null);return o}function qp(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function is(n,e,t,r){let o=[],i=!1;e.forEach((a,c)=>{let d=Wp(n,a,c+t);if(d){i=!0;let u=is(d,a,t+c+1,r);u!=_t&&o.push(c,c+a.nodeSize,u)}});let s=Up(i?qp(n):n,-t).sort($r);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||o.length?new Te(s,o):_t}function $r(n,e){return n.from-e.from||n.to-e.to}function Il(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let o=t+1;o<e.length;o++){let i=e[o];if(i.from==r.from){i.to!=r.to&&(e==n&&(e=n.slice()),e[o]=i.copy(i.from,r.to),Kp(e,o+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,i.from),Kp(e,o,r.copy(i.from,r.to)));break}}}return e}function Kp(n,e,t){for(;e<n.length&&$r(t,n[e])>0;)e++;n.splice(e,0,t)}function Bl(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=_t&&e.push(r)}),n.cursorWrapper&&e.push(Te.create(n.state.doc,[n.cursorWrapper.deco])),ur.from(e)}const $k={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Fk=Pt&&ir<=11;class zk{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 Vk{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new zk,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);Pt&&ir<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),Fk&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,$k)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Ep(this.view)){if(this.suppressingSelectionUpdates)return Un(this.view);if(Pt&&ir<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Rr(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let i=e.focusNode;i;i=Ko(i))t.add(i);for(let i=e.anchorNode;i;i=Ko(i))if(t.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Ep(e)&&!this.ignoreSelectionChange(r),i=-1,s=-1,a=!1,c=[];if(e.editable)for(let u=0;u<t.length;u++){let p=this.registerMutation(t[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(fn&&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||Wk(e,p)!=h)&&f.remove()}}}let d=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Xi(r)&&(d=wl(e))&&d.eq(Q.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Un(e),this.currentSelection.set(r)):(i>-1||o)&&(i>-1&&(e.docView.markDirty(i,s),Hk(e)),this.handleDOMChange(i,s,a,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Un(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let p=e.addedNodes[u];t.push(p),p.nodeType==3&&(this.lastChangedTextNode=p)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let o=e.previousSibling,i=e.nextSibling;if(Pt&&ir<=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)&&(o=p),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f)}let s=o&&o.parentNode==e.target?ht(o)+1:0,a=r.localPosFromDOM(e.target,s,-1),c=i&&i.parentNode==e.target?ht(i):e.target.childNodes.length,d=r.localPosFromDOM(e.target,c,1);return{from:a,to:d}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Gp=new WeakMap,jp=!1;function Hk(n){if(!Gp.has(n)&&(Gp.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=fn,jp)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."),jp=!0}}function Jp(n,e){let t=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset,s=n.domAtPos(n.state.selection.anchor);return Rr(s.node,s.offset,o,i)&&([t,r,o,i]=[o,i,t,r]),{anchorNode:t,anchorOffset:r,focusNode:o,focusOffset:i}}function Uk(n,e){if(e.getComposedRanges){let o=e.getComposedRanges(n.root)[0];if(o)return Jp(n,o)}let t;function r(o){o.preventDefault(),o.stopImmediatePropagation(),t=o.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?Jp(n,t):null}function Wk(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function qk(n,e,t){let{node:r,fromOffset:o,toOffset:i,from:s,to:a}=n.docView.parseRange(e,t),c=n.domSelectionRange(),d,u=c.anchorNode;if(u&&n.dom.contains(u.nodeType==1?u:u.parentNode)&&(d=[{node:u,offset:c.anchorOffset}],Xi(c)||d.push({node:c.focusNode,offset:c.focusOffset})),Ct&&n.input.lastKeyCode===8)for(let b=i;b>o;b--){let y=r.childNodes[b-1],E=y.pmViewDesc;if(y.nodeName=="BR"&&!E){i=b;break}if(!E||E.size)break}let p=n.state.doc,f=n.someProp("domParser")||er.fromSchema(n.state.schema),h=p.resolve(s),m=null,g=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:o,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:Kk,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 Kk(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(Ot&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||Ot&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Gk=/^(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 jk(n,e,t,r,o){let i=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let v=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,$=wl(n,v);if($&&!n.state.selection.eq($)){if(Ct&&Vn&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",te=>te(n,Dr(13,"Enter"))))return;let Y=n.state.tr.setSelection($);v=="pointer"?Y.setMeta("pointer",!0):v=="key"&&Y.scrollIntoView(),i&&Y.setMeta("composition",i),n.dispatch(Y)}return}let s=n.state.doc.resolve(e),a=s.sharedDepth(t);e=s.before(a+1),t=n.state.doc.resolve(t).after(a+1);let c=n.state.selection,d=qk(n,e,t),u=n.state.doc,p=u.slice(d.from,d.to),f,h;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(f=n.state.selection.to,h="end"):(f=n.state.selection.from,h="start"),n.input.lastKeyCode=null;let m=Xk(p.content,d.doc.content,d.from,f,h);if(m&&n.input.domChangeCount++,(lo&&n.input.lastIOSEnter>Date.now()-225||Vn)&&o.some(v=>v.nodeType==1&&!Gk.test(v.nodeName))&&(!m||m.endA>=m.endB)&&n.someProp("handleKeyDown",v=>v(n,Dr(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof J&&!c.empty&&c.$head.sameParent(c.$anchor)&&!n.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(d.sel){let v=Yp(n,n.state.doc,d.sel);if(v&&!v.eq(n.state.selection)){let $=n.state.tr.setSelection(v);i&&$.setMeta("composition",i),n.dispatch($)}}return}n.state.selection.from<n.state.selection.to&&m.start==m.endB&&n.state.selection instanceof J&&(m.start>n.state.selection.from&&m.start<=n.state.selection.from+2&&n.state.selection.from>=d.from?m.start=n.state.selection.from:m.endA<n.state.selection.to&&m.endA>=n.state.selection.to-2&&n.state.selection.to<=d.to&&(m.endB+=n.state.selection.to-m.endA,m.endA=n.state.selection.to)),Pt&&ir<=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),E=g.sameParent(b)&&g.parent.inlineContent&&y.end()>=m.endA,C;if((lo&&n.input.lastIOSEnter>Date.now()-225&&(!E||o.some(v=>v.nodeName=="DIV"||v.nodeName=="P"))||!E&&g.pos<d.doc.content.size&&!g.sameParent(b)&&(C=Q.findFrom(d.doc.resolve(g.pos+1),1,!0))&&C.head==b.pos)&&n.someProp("handleKeyDown",v=>v(n,Dr(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&Yk(u,m.start,m.endA,g,b)&&n.someProp("handleKeyDown",v=>v(n,Dr(8,"Backspace")))){Vn&&Ct&&n.domObserver.suppressSelectionUpdates();return}Ct&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),Vn&&!E&&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(()=>{n.someProp("handleKeyDown",function(v){return v(n,Dr(13,"Enter"))})},20));let k=m.start,S=m.endA,_,D,B;if(E){if(g.pos==b.pos)Pt&&ir<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Un(n),20)),_=n.state.tr.delete(k,S),D=u.resolve(m.start).marksAcross(u.resolve(m.endA));else if(m.endA==m.endB&&(B=Jk(g.parent.content.cut(g.parentOffset,b.parentOffset),y.parent.content.cut(y.parentOffset,m.endA-y.start()))))_=n.state.tr,B.type=="add"?_.addMark(k,S,B.mark):_.removeMark(k,S,B.mark);else if(g.parent.child(g.index()).isText&&g.index()==b.index()-(b.textOffset?0:1)){let v=g.parent.textBetween(g.parentOffset,b.parentOffset);if(n.someProp("handleTextInput",$=>$(n,k,S,v)))return;_=n.state.tr.insertText(v,k,S)}}if(_||(_=n.state.tr.replace(k,S,d.doc.slice(m.start-d.from,m.endB-d.from))),d.sel){let v=Yp(n,_.doc,d.sel);v&&!(Ct&&n.composing&&v.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(v.head==k||v.head==_.mapping.map(S)-1)||Pt&&v.empty&&v.head==k)&&_.setSelection(v)}D&&_.ensureMarks(D),i&&_.setMeta("composition",i),n.dispatch(_.scrollIntoView())}function Yp(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:_l(n,e.resolve(t.anchor),e.resolve(t.head))}function Jk(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,o=t,i=r,s,a,c;for(let u=0;u<r.length;u++)o=r[u].removeFromSet(o);for(let u=0;u<t.length;u++)i=t[u].removeFromSet(i);if(o.length==1&&i.length==0)a=o[0],s="add",c=u=>u.mark(a.addToSet(u.marks));else if(o.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(x.from(d).eq(n))return{mark:a,type:s}}function Yk(n,e,t,r,o){if(t-e<=o.pos-r.pos||Ll(r,!0,!1)<o.pos)return!1;let i=n.resolve(e);if(!r.parent.isTextblock){let a=i.nodeAfter;return a!=null&&t==e+a.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=n.resolve(Ll(i,!0,!0));return!s.parent.isTextblock||s.pos>t||Ll(s,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function Ll(n,e,t){let r=n.depth,o=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,o++,e=!1;if(t){let i=n.node(r).maybeChild(n.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function Xk(n,e,t,r,o){let i=n.findDiffStart(e,t);if(i==null)return null;let{a:s,b:a}=n.findDiffEnd(e,t+n.size,t+e.size);if(o=="end"){let c=Math.max(0,i-Math.min(s,a));r-=s+c-i}if(s<i&&n.size<e.size){let c=r<=i&&r>=s?i-r:0;i-=c,i&&i<e.size&&Xp(e.textBetween(i-1,i+1))&&(i+=c?1:-1),a=i+(a-s),s=i}else if(a<i){let c=r<=i&&r>=a?i-r:0;i-=c,i&&i<n.size&&Xp(n.textBetween(i-1,i+1))&&(i+=c?1:-1),s=i+(s-a),a=i}return{start:i,endA:s,endB:a}}function Xp(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class Zk{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new bk,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(nf),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=ef(this),Qp(this),this.nodeViews=tf(this),this.docView=lp(this.state.doc,Zp(this),Bl(this),this.dom,this),this.domObserver=new Vk(this,(r,o,i,s)=>jk(this,r,o,i,s)),this.domObserver.start(),yk(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Ml(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(nf),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let o=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(Fp(this),s=!0),this.state=e;let a=o.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=tf(this);eE(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Ml(this),this.editable=ef(this),Qp(this);let c=Bl(this),d=Zp(this),u=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",p=i||!this.docView.matchesNode(e.doc,d,c);(p||!e.selection.eq(o.selection))&&(s=!0);let f=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&Ry(this);if(s){this.domObserver.stop();let h=p&&(Pt||Ct)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&Qk(o.selection,e.selection);if(p){let m=Ct?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=vk(this)),(i||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=lp(e.doc,d,c,this.dom,this)),m&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&nk(this))?Un(this,h):(yp(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&Dy(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof K){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Ju(this,t.getBoundingClientRect(),e)}else Ju(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){let r=e.node,o=-1;if(this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let i=r.from+(this.state.doc.content.size-t.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new Vp(e.slice,e.move,o<0?void 0:K.create(this.state.doc,o))}someProp(e,t){let r=this._props&&this._props[e],o;if(r!=null&&(o=t?t(r):r))return o;for(let s=0;s<this.directPlugins.length;s++){let a=this.directPlugins[s].props[e];if(a!=null&&(o=t?t(a):a))return o}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let a=i[s].props[e];if(a!=null&&(o=t?t(a):a))return o}}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&&Iy(this.dom),Un(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Fy(this,e)}coordsAtPos(e,t=1){return tp(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let o=this.docView.posFromDOM(e,t,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,t){return Wy(this,t||this.state,e)}pasteHTML(e,t){return ei(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return ei(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Nl(this,e)}destroy(){this.docView&&(kk(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Bl(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,wy())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return wk(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?Ot&&this.root.nodeType===11&&Ny(this.dom.ownerDocument)==this.dom&&Uk(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function Zp(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[Qe.node(0,n.state.doc.content.size,e)]}function Qp(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:Qe.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function ef(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Qk(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function tf(n){let e=Object.create(null);function t(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function eE(n,e){let t=0,r=0;for(let o in n){if(n[o]!=e[o])return!0;t++}for(let o in e)r++;return t!=r}function nf(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var pr={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:"'"},ss={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},tE=typeof navigator<"u"&&/Mac/.test(navigator.platform),nE=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),mt=0;mt<10;mt++)pr[48+mt]=pr[96+mt]=String(mt);for(var mt=1;mt<=24;mt++)pr[mt+111]="F"+mt;for(var mt=65;mt<=90;mt++)pr[mt]=String.fromCharCode(mt+32),ss[mt]=String.fromCharCode(mt);for(var Pl in pr)ss.hasOwnProperty(Pl)||(ss[Pl]=pr[Pl]);function rE(n){var e=tE&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||nE&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?ss:pr)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const oE=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function iE(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,o,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))r=!0;else if(/^(c|ctrl|control)$/i.test(c))o=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))oE?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+c)}return r&&(t="Alt-"+t),o&&(t="Ctrl-"+t),s&&(t="Meta-"+t),i&&(t="Shift-"+t),t}function sE(n){let e=Object.create(null);for(let t in n)e[iE(t)]=n[t];return e}function $l(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function aE(n){return new Ne({props:{handleKeyDown:Fl(n)}})}function Fl(n){let e=sE(n);return function(t,r){let o=rE(r),i,s=e[$l(o,r)];if(s&&s(t.state,t.dispatch,t))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let a=e[$l(o,r,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((r.shiftKey||r.altKey||r.metaKey||o.charCodeAt(0)>127)&&(i=pr[r.keyCode])&&i!=o){let a=e[$l(i,r)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}const zl=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function rf(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const of=(n,e,t)=>{let r=rf(n,t);if(!r)return!1;let o=Vl(r);if(!o){let s=r.blockRange(),a=s&&io(s);return a==null?!1:(e&&e(n.tr.lift(s,a).scrollIntoView()),!0)}let i=o.nodeBefore;if(hf(n,o,e,-1))return!0;if(r.parent.content.size==0&&(ho(i,"end")||K.isSelectable(i)))for(let s=r.depth;;s--){let a=Yi(n.doc,r.before(s),r.after(s),M.empty);if(a&&a.slice.size<a.to-a.from){if(e){let c=n.tr.step(a);c.setSelection(ho(i,"end")?Q.findFrom(c.doc.resolve(c.mapping.map(o.pos,-1)),-1):K.create(c.doc,o.pos-i.nodeSize)),e(c.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return i.isAtom&&o.depth==r.depth-1?(e&&e(n.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1},lE=(n,e,t)=>{let r=rf(n,t);if(!r)return!1;let o=Vl(r);return o?sf(n,o,e):!1},cE=(n,e,t)=>{let r=lf(n,t);if(!r)return!1;let o=Hl(r);return o?sf(n,o,e):!1};function sf(n,e,t){let r=e.nodeBefore,o=r,i=e.pos-1;for(;!o.isTextblock;i--){if(o.type.spec.isolating)return!1;let u=o.lastChild;if(!u)return!1;o=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=Yi(n.doc,i,c,M.empty);if(!d||d.from!=i||d instanceof pt&&d.slice.size>=c-i)return!1;if(t){let u=n.tr.step(d);u.setSelection(J.create(u.doc,i)),t(u.scrollIntoView())}return!0}function ho(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const af=(n,e,t)=>{let{$head:r,empty:o}=n.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;i=Vl(r)}let s=i&&i.nodeBefore;return!s||!K.isSelectable(s)?!1:(e&&e(n.tr.setSelection(K.create(n.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function Vl(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function lf(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const cf=(n,e,t)=>{let r=lf(n,t);if(!r)return!1;let o=Hl(r);if(!o)return!1;let i=o.nodeAfter;if(hf(n,o,e,1))return!0;if(r.parent.content.size==0&&(ho(i,"start")||K.isSelectable(i))){let s=Yi(n.doc,r.before(),r.after(),M.empty);if(s&&s.slice.size<s.to-s.from){if(e){let a=n.tr.step(s);a.setSelection(ho(i,"start")?Q.findFrom(a.doc.resolve(a.mapping.map(o.pos)),1):K.create(a.doc,a.mapping.map(o.pos))),e(a.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(e&&e(n.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},df=(n,e,t)=>{let{$head:r,empty:o}=n.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;i=Hl(r)}let s=i&&i.nodeAfter;return!s||!K.isSelectable(s)?!1:(e&&e(n.tr.setSelection(K.create(n.doc,i.pos)).scrollIntoView()),!0)};function Hl(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const dE=(n,e)=>{let t=n.selection,r=t instanceof K,o;if(r){if(t.node.isTextblock||!rr(n.doc,t.from))return!1;o=t.from}else if(o=Ji(n.doc,t.from,-1),o==null)return!1;if(e){let i=n.tr.join(o);r&&i.setSelection(K.create(i.doc,o-n.doc.resolve(o).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},uE=(n,e)=>{let t=n.selection,r;if(t instanceof K){if(t.node.isTextblock||!rr(n.doc,t.to))return!1;r=t.to}else if(r=Ji(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},pE=(n,e)=>{let{$from:t,$to:r}=n.selection,o=t.blockRange(r),i=o&&io(o);return i==null?!1:(e&&e(n.tr.lift(o,i).scrollIntoView()),!0)},uf=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
13
+ `).scrollIntoView()),!0)};function Ul(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const fE=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let o=t.node(-1),i=t.indexAfter(-1),s=Ul(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(e){let a=t.after(),c=n.tr.replaceWith(a,a,s.createAndFill());c.setSelection(Q.near(c.doc.resolve(a),1)),e(c.scrollIntoView())}return!0},pf=(n,e)=>{let t=n.selection,{$from:r,$to:o}=t;if(t instanceof Ut||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Ul(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=n.tr.insert(s,i.createAndFill());a.setSelection(J.create(a.doc,s+1)),e(a.scrollIntoView())}return!0},ff=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let i=t.before();if(Fn(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let r=t.blockRange(),o=r&&io(r);return o==null?!1:(e&&e(n.tr.lift(r,o).scrollIntoView()),!0)};function hE(n){return(e,t)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof K&&e.selection.node.isBlock)return!r.parentOffset||!Fn(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],s,a,c=!1,d=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){c=r.end(h)==r.pos+(r.depth-h),d=r.start(h)==r.pos-(r.depth-h),a=Ul(r.node(h-1).contentMatchAt(r.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 Ut)&&u.deleteSelection();let p=u.mapping.map(r.pos),f=Fn(u.doc,p,i.length,i);if(f||(i[0]=a?{type:a}:null,f=Fn(u.doc,p,i.length,i)),u.split(p,i.length,i),!c&&d&&r.node(s).type!=a){let h=u.mapping.map(r.before(s)),m=u.doc.resolve(h);a&&r.node(s-1).canReplaceWith(m.index(),m.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(s)),a)}return t&&t(u.scrollIntoView()),!0}}const mE=hE(),gE=(n,e)=>{let{$from:t,to:r}=n.selection,o,i=t.sharedDepth(r);return i==0?!1:(o=t.before(i),e&&e(n.tr.setSelection(K.create(n.doc,o))),!0)};function bE(n,e,t){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(o.isTextblock||rr(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function hf(n,e,t,r){let o=e.nodeBefore,i=e.nodeAfter,s,a,c=o.type.spec.isolating||i.type.spec.isolating;if(!c&&bE(n,e,t))return!0;let d=!c&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(s=(a=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&a.matchType(s[0]||i.type).validEnd){if(t){let h=e.pos+i.nodeSize,m=x.empty;for(let y=s.length-1;y>=0;y--)m=x.from(s[y].create(null,m));m=x.from(o.copy(m));let g=n.tr.step(new ft(e.pos-1,h,e.pos,h,new M(m,1,0),s.length,!0)),b=g.doc.resolve(h+2*s.length);b.nodeAfter&&b.nodeAfter.type==o.type&&rr(g.doc,b.pos)&&g.join(b.pos),t(g.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&c?null:Q.findFrom(e,1),p=u&&u.$from.blockRange(u.$to),f=p&&io(p);if(f!=null&&f>=e.depth)return t&&t(n.tr.lift(p,f).scrollIntoView()),!0;if(d&&ho(i,"start",!0)&&ho(o,"end")){let h=o,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(t){let y=x.empty;for(let C=m.length-1;C>=0;C--)y=x.from(m[C].copy(y));let E=n.tr.step(new ft(e.pos-m.length,e.pos+i.nodeSize,e.pos+b,e.pos+i.nodeSize-b,new M(y,m.length,0),0,!0));t(E.scrollIntoView())}return!0}}return!1}function mf(n){return function(e,t){let r=e.selection,o=n<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(t&&t(e.tr.setSelection(J.create(e.doc,n<0?o.start(i):o.end(i)))),!0):!1}}const yE=mf(-1),kE=mf(1);function EE(n,e=null){return function(t,r){let{$from:o,$to:i}=t.selection,s=o.blockRange(i),a=s&&dl(s,n,e);return a?(r&&r(t.tr.wrap(s,a).scrollIntoView()),!0):!1}}function gf(n,e=null){return function(t,r){let o=!1;for(let i=0;i<t.selection.ranges.length&&!o;i++){let{$from:{pos:s},$to:{pos:a}}=t.selection.ranges[i];t.doc.nodesBetween(s,a,(c,d)=>{if(o)return!1;if(!(!c.isTextblock||c.hasMarkup(n,e)))if(c.type==n)o=!0;else{let u=t.doc.resolve(d),p=u.index();o=u.parent.canReplaceWith(p,p+1,n)}})}if(!o)return!1;if(r){let i=t.tr;for(let s=0;s<t.selection.ranges.length;s++){let{$from:{pos:a},$to:{pos:c}}=t.selection.ranges[s];i.setBlockType(a,c,n,e)}r(i.scrollIntoView())}return!0}}function Wl(...n){return function(e,t,r){for(let o=0;o<n.length;o++)if(n[o](e,t,r))return!0;return!1}}Wl(zl,of,af),Wl(zl,cf,df),Wl(uf,pf,ff,mE),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function wE(n,e=null){return function(t,r){let{$from:o,$to:i}=t.selection,s=o.blockRange(i);if(!s)return!1;let a=r?t.tr:null;return CE(a,s,n,e)?(r&&r(a.scrollIntoView()),!0):!1}}function CE(n,e,t,r=null){let o=!1,i=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let c=s.resolve(e.start-2);i=new Vi(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new Vi(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let a=dl(i,t,r,e);return a?(n&&_E(n,e,a,o,t),!0):!1}function _E(n,e,t,r,o){let i=x.empty;for(let u=t.length-1;u>=0;u--)i=x.from(t[u].type.create(t[u].attrs,i));n.step(new ft(e.start-(r?2:0),e.end,e.start,e.end,new M(i,0,0),t.length,!0));let s=0;for(let u=0;u<t.length;u++)t[u].type==o&&(s=u+1);let a=t.length-s,c=e.start+t.length-(r?2:0),d=e.parent;for(let u=e.startIndex,p=e.endIndex,f=!0;u<p;u++,f=!1)!f&&Fn(n.doc,c,a)&&(n.split(c,a),c+=2*a),c+=d.child(u).nodeSize;return n}function SE(n){return function(e,t){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,s=>s.childCount>0&&s.firstChild.type==n);return i?t?r.node(i.depth-1).type==n?xE(e,t,n,i):NE(e,t,i):!0:!1}}function xE(n,e,t,r){let o=n.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new ft(i-1,s,i,s,new M(x.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new Vi(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=io(r);if(a==null)return!1;o.lift(r,a);let c=o.mapping.map(i,-1)-1;return rr(o.doc,c)&&o.join(c),e(o.scrollIntoView()),!0}function NE(n,e,t){let r=n.tr,o=t.parent;for(let h=t.end,m=t.endIndex-1,g=t.startIndex;m>g;m--)h-=o.child(m).nodeSize,r.delete(h-1,h+1);let i=r.doc.resolve(t.start),s=i.nodeAfter;if(r.mapping.map(t.end)!=t.start+i.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,c=t.endIndex==o.childCount,d=i.node(-1),u=i.index(-1);if(!d.canReplace(u+(a?0:1),u+1,s.content.append(c?x.empty:x.from(o))))return!1;let p=i.pos,f=p+s.nodeSize;return r.step(new ft(p-(a?1:0),f+(c?1:0),p+1,f-1,new M((a?x.empty:x.from(o.copy(x.empty))).append(c?x.empty:x.from(o.copy(x.empty))),a?0:1,c?0:1),a?0:1)),e(r.scrollIntoView()),!0}function TE(n){return function(e,t){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,d=>d.childCount>0&&d.firstChild.type==n);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!=n)return!1;if(t){let d=c.lastChild&&c.lastChild.type==a.type,u=x.from(d?n.create():null),p=new M(x.from(n.create(null,x.from(a.type.create(null,u)))),d?3:1,0),f=i.start,h=i.end;t(e.tr.step(new ft(f-(d?3:1),h,f,h,p,1,!0)).scrollIntoView())}return!0}}function as(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:o}=t,{storedMarks:i}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=t.selection,o=t.doc,i=t.storedMarks,t}}}class ls{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:t,state:r}=this,{view:o}=t,{tr:i}=r,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&&o.dispatch(i),p}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:r,editor:o,state:i}=this,{view:s}=o,a=[],c=!!e,d=e||i.tr,u=()=>(!c&&t&&!d.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(d),a.every(f=>f===!0)),p={...Object.fromEntries(Object.entries(r).map(([f,h])=>[f,(...g)=>{const b=this.buildProps(d,t),y=h(...g)(b);return a.push(y),p}])),run:u};return p}createCan(e){const{rawCommands:t,state:r}=this,o=!1,i=e||r.tr,s=this.buildProps(i,o);return{...Object.fromEntries(Object.entries(t).map(([c,d])=>[c,(...u)=>d(...u)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,o)}}buildProps(e,t=!0){const{rawCommands:r,editor:o,state:i}=this,{view:s}=o,a={tr:e,editor:o,view:s,state:as({state:i,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([c,d])=>[c,(...u)=>d(...u)(a)]))}};return a}}class OE{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const r=this.callbacks[e];return r&&r.forEach(o=>o.apply(this,t)),this}off(e,t){const r=this.callbacks[e];return r&&(t?this.callbacks[e]=r.filter(o=>o!==t):delete this.callbacks[e]),this}once(e,t){const r=(...o)=>{this.off(e,r),t.apply(this,o)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}}function U(n,e,t){return n.config[e]===void 0&&n.parent?U(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?U(n.parent,e,t):null}):n.config[e]}function cs(n){const e=n.filter(o=>o.type==="extension"),t=n.filter(o=>o.type==="node"),r=n.filter(o=>o.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function bf(n){const e=[],{nodeExtensions:t,markExtensions:r}=cs(n),o=[...t,...r],i={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage,extensions:o},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}})})})})}),o.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 it(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}function Se(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([o,i])=>{if(!r[o]){r[o]=i;return}if(o==="class"){const a=i?String(i).split(" "):[],c=r[o]?r[o].split(" "):[],d=a.filter(u=>!c.includes(u));r[o]=[...c,...d].join(" ")}else if(o==="style"){const a=i?i.split(";").map(u=>u.trim()).filter(Boolean):[],c=r[o]?r[o].split(";").map(u=>u.trim()).filter(Boolean):[],d=new Map;c.forEach(u=>{const[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)}),r[o]=Array.from(d.entries()).map(([u,p])=>`${u}: ${p}`).join("; ")}else r[o]=i}),r},{})}function ql(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>Se(t,r),{})}function yf(n){return typeof n=="function"}function me(n,e=void 0,...t){return yf(n)?e?n.bind(e)(...t):n(...t):n}function ME(n={}){return Object.keys(n).length===0&&n.constructor===Object}function AE(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function kf(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const o=e.reduce((i,s)=>{const a=s.attribute.parseHTML?s.attribute.parseHTML(t):AE(t.getAttribute(s.name));return a==null?i:{...i,[s.name]:a}},{});return{...r,...o}}}}function Ef(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&ME(t)?!1:t!=null))}function vE(n,e){var t;const r=bf(n),{nodeExtensions:o,markExtensions:i}=cs(n),s=(t=o.find(d=>U(d,"topNode")))===null||t===void 0?void 0:t.name,a=Object.fromEntries(o.map(d=>{const u=r.filter(y=>y.type===d.name),p={name:d.name,options:d.options,storage:d.storage,editor:e},f=n.reduce((y,E)=>{const C=U(E,"extendNodeSchema",p);return{...y,...C?C(d):{}}},{}),h=Ef({...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 E;return[y.name,{default:(E=y==null?void 0:y.attribute)===null||E===void 0?void 0:E.default}]}))}),m=me(U(d,"parseHTML",p));m&&(h.parseDOM=m.map(y=>kf(y,u)));const g=U(d,"renderHTML",p);g&&(h.toDOM=y=>g({node:y,HTMLAttributes:ql(y,u)}));const b=U(d,"renderText",p);return b&&(h.toText=b),[d.name,h]})),c=Object.fromEntries(i.map(d=>{const u=r.filter(b=>b.type===d.name),p={name:d.name,options:d.options,storage:d.storage,editor:e},f=n.reduce((b,y)=>{const E=U(y,"extendMarkSchema",p);return{...b,...E?E(d):{}}},{}),h=Ef({...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=>kf(b,u)));const g=U(d,"renderHTML",p);return g&&(h.toDOM=b=>g({mark:b,HTMLAttributes:ql(b,u)})),[d.name,h]}));return new Zd({topNode:s,nodes:a,marks:c})}function Kl(n,e){return e.nodes[n]||e.marks[n]||null}function wf(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function Gl(n,e){const t=Mr.fromSchema(e).serializeFragment(n),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(t),o.innerHTML}const RE=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(o,i,s,a)=>{var c,d;const u=((d=(c=o.type.spec).toText)===null||d===void 0?void 0:d.call(c,{node:o,pos:i,parent:s,index:a}))||o.textContent||"%leaf%";t+=o.isAtom&&!o.isText?u:u.slice(0,Math.max(0,r-i))}),t};function jl(n){return Object.prototype.toString.call(n)==="[object RegExp]"}class ni{constructor(e){this.find=e.find,this.handler=e.handler}}const DE=(n,e)=>{if(jl(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function ds(n){var e;const{editor:t,from:r,to:o,text:i,rules:s,plugin:a}=n,{view:c}=t;if(c.composing)return!1;const d=c.state.doc.resolve(r);if(d.parent.type.spec.code||!((e=d.nodeBefore||d.nodeAfter)===null||e===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let u=!1;const p=RE(d)+i;return s.forEach(f=>{if(u)return;const h=DE(p,f.find);if(!h)return;const m=c.state.tr,g=as({state:c.state,transaction:m}),b={from:r-(h[0].length-i.length),to:o},{commands:y,chain:E,can:C}=new ls({editor:t,state:g});f.handler({state:g,range:b,match:h,commands:y,chain:E,can:C})===null||!m.steps.length||(m.setMeta(a,{transform:m,from:r,to:o,text:i}),c.dispatch(m),u=!0)}),u}function IE(n){const{editor:e,rules:t}=n,r=new Ne({state:{init(){return null},apply(o,i,s){const a=o.getMeta(r);if(a)return a;const c=o.getMeta("applyInputRules");return!!c&&setTimeout(()=>{let{text:u}=c;typeof u=="string"?u=u:u=Gl(x.from(u),s.schema);const{from:p}=c,f=p+u.length;ds({editor:e,from:p,to:f,text:u,rules:t,plugin:r})}),o.selectionSet||o.docChanged?null:i}},props:{handleTextInput(o,i,s,a){return ds({editor:e,from:i,to:s,text:a,rules:t,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{const{$cursor:i}=o.state.selection;i&&ds({editor:e,from:i.pos,to:i.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(o,i){if(i.key!=="Enter")return!1;const{$cursor:s}=o.state.selection;return s?ds({editor:e,from:s.pos,to:s.pos,text:`
14
+ `,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function BE(n){return Object.prototype.toString.call(n).slice(8,-1)}function us(n){return BE(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function ps(n,e){const t={...n};return us(n)&&us(e)&&Object.keys(e).forEach(r=>{us(e[r])&&us(n[r])?t[r]=ps(n[r],e[r]):t[r]=e[r]}),t}class rn{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 rn(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>ps(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new rn(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.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: "${t.name}".`),t.options=me(U(t,"addOptions",{name:t.name})),t.storage=me(U(t,"addStorage",{name:t.name,options:t.options})),t}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){const s=o.marks();if(!!!s.find(d=>(d==null?void 0:d.type.name)===t.name))return!1;const c=s.find(d=>(d==null?void 0:d.type.name)===t.name);return c&&r.removeStoredMark(c),r.insertText(" ",o.pos),e.view.dispatch(r),!0}return!1}}function LE(n){return typeof n=="number"}class PE{constructor(e){this.find=e.find,this.handler=e.handler}}const $E=(n,e,t)=>{if(jl(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(o=>{const i=[o.text];return i.index=o.index,i.input=n,i.data=o.data,o.replaceWith&&(o.text.includes(o.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(o.replaceWith)),i}):[]};function FE(n){const{editor:e,state:t,from:r,to:o,rule:i,pasteEvent:s,dropEvent:a}=n,{commands:c,chain:d,can:u}=new ls({editor:e,state:t}),p=[];return t.doc.nodesBetween(r,o,(h,m)=>{if(!h.isTextblock||h.type.spec.code)return;const g=Math.max(r,m),b=Math.min(o,m+h.content.size),y=h.textBetween(g-m,b-m,void 0,"");$E(y,i.find,s).forEach(C=>{if(C.index===void 0)return;const k=g+C.index+1,S=k+C[0].length,_={from:t.tr.mapping.map(k),to:t.tr.mapping.map(S)},D=i.handler({state:t,range:_,match:C,commands:c,chain:d,can:u,pasteEvent:s,dropEvent:a});p.push(D)})}),p.every(h=>h!==null)}let fs=null;const zE=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)===null||e===void 0||e.setData("text/html",n),t};function VE(n){const{editor:e,rules:t}=n;let r=null,o=!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=as({state:u,transaction:g});if(!(!FE({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 t.map(u=>new Ne({view(p){const f=m=>{var g;r=!((g=p.dom.parentElement)===null||g===void 0)&&g.contains(m.target)?p.dom.parentElement:null,r&&(fs=e)},h=()=>{fs&&(fs=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=r===p.dom.parentElement,a=f,!i){const h=fs;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,o=!!(m!=null&&m.includes("data-pm-slice")),!1}}},appendTransaction:(p,f,h)=>{const m=p[0],g=m.getMeta("uiEvent")==="paste"&&!o,b=m.getMeta("uiEvent")==="drop"&&!i,y=m.getMeta("applyPasteRules"),E=!!y;if(!g&&!b&&!E)return;if(E){let{text:S}=y;typeof S=="string"?S=S:S=Gl(x.from(S),h.schema);const{from:_}=y,D=_+S.length,B=zE(S);return c({rule:u,state:h,from:_,to:{b:D},pasteEvt:B})}const C=f.doc.content.findDiffStart(h.doc.content),k=f.doc.content.findDiffEnd(h.doc.content);if(!(!LE(C)||!k||C===k.b))return c({rule:u,state:h,from:C,to:k,pasteEvt:s})}}))}function HE(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}class mo{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=mo.resolve(e),this.schema=vE(this.extensions,t),this.setupExtensions()}static resolve(e){const t=mo.sort(mo.flatten(e)),r=HE(t.map(o=>o.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(o=>`'${o}'`).join(", ")}]. This can lead to issues.`),t}static flatten(e){return e.map(t=>{const r={name:t.name,options:t.options,storage:t.storage},o=U(t,"addExtensions",r);return o?[t,...this.flatten(o())]:t}).flat(10)}static sort(e){return e.sort((r,o)=>{const i=U(r,"priority")||100,s=U(o,"priority")||100;return i>s?-1:i<s?1:0})}get commands(){return this.extensions.reduce((e,t)=>{const r={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:Kl(t.name,this.schema)},o=U(t,"addCommands",r);return o?{...e,...o()}:e},{})}get plugins(){const{editor:e}=this,t=mo.sort([...this.extensions].reverse()),r=[],o=[],i=t.map(s=>{const a={name:s.name,options:s.options,storage:s.storage,editor:e,type:Kl(s.name,this.schema)},c=[],d=U(s,"addKeyboardShortcuts",a);let u={};if(s.type==="mark"&&U(s,"exitable",a)&&(u.ArrowRight=()=>rn.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=aE(u);c.push(p);const f=U(s,"addInputRules",a);wf(s,e.options.enableInputRules)&&f&&r.push(...f());const h=U(s,"addPasteRules",a);wf(s,e.options.enablePasteRules)&&h&&o.push(...h());const m=U(s,"addProseMirrorPlugins",a);if(m){const g=m();c.push(...g)}return c}).flat();return[IE({editor:e,rules:r}),...VE({editor:e,rules:o}),...i]}get attributes(){return bf(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=cs(this.extensions);return Object.fromEntries(t.filter(r=>!!U(r,"addNodeView")).map(r=>{const o=this.attributes.filter(c=>c.type===r.name),i={name:r.name,options:r.options,storage:r.storage,editor:e,type:it(r.name,this.schema)},s=U(r,"addNodeView",i);if(!s)return[];const a=(c,d,u,p,f)=>{const h=ql(c,o);return s()({node:c,view:d,getPos:u,decorations:p,innerDecorations:f,editor:e,extension:r,HTMLAttributes:h})};return[r.name,a]}))}setupExtensions(){this.extensions.forEach(e=>{var t;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:Kl(e.name,this.schema)};e.type==="mark"&&(!((t=me(U(e,"keepOnSplit",r)))!==null&&t!==void 0)||t)&&this.splittableMarks.push(e.name);const o=U(e,"onBeforeCreate",r),i=U(e,"onCreate",r),s=U(e,"onUpdate",r),a=U(e,"onSelectionUpdate",r),c=U(e,"onTransaction",r),d=U(e,"onFocus",r),u=U(e,"onBlur",r),p=U(e,"onDestroy",r);o&&this.editor.on("beforeCreate",o),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 Ae{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 Ae(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>ps(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Ae({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.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: "${t.name}".`),t.options=me(U(t,"addOptions",{name:t.name})),t.storage=me(U(t,"addStorage",{name:t.name,options:t.options})),t}}function Cf(n,e,t){const{from:r,to:o}=e,{blockSeparator:i=`
15
+
16
+ `,textSerializers:s={}}=t||{};let a="";return n.nodesBetween(r,o,(c,d,u,p)=>{var f;c.isBlock&&d>r&&(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(r,d)-d,o-d))}),a}function Jl(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}const UE=Ae.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ne({key:new Fe("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:o}=e,{ranges:i}=o,s=Math.min(...i.map(u=>u.$from.pos)),a=Math.max(...i.map(u=>u.$to.pos)),c=Jl(t);return Cf(r,{from:s,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),WE=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())===null||t===void 0||t.removeAllRanges())}),!0),qE=(n=!1)=>({commands:e})=>e.setContent("",n),KE=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:o}=r;return t&&o.forEach(({$from:i,$to:s})=>{n.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=io(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},GE=n=>e=>n(e),jE=()=>({state:n,dispatch:e})=>pf(n,e),JE=(n,e)=>({editor:t,tr:r})=>{const{state:o}=t,i=o.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const s=r.mapping.map(e);return r.insert(s,i.content),r.setSelection(new J(r.doc.resolve(s-1))),!0},YE=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const o=n.selection.$anchor;for(let i=o.depth;i>0;i-=1)if(o.node(i).type===r.type){if(e){const a=o.before(i),c=o.after(i);n.delete(a,c).scrollIntoView()}return!0}return!1},XE=n=>({tr:e,state:t,dispatch:r})=>{const o=it(n,t.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===o){if(r){const c=i.before(s),d=i.after(s);e.delete(c,d).scrollIntoView()}return!0}return!1},ZE=n=>({tr:e,dispatch:t})=>{const{from:r,to:o}=n;return t&&e.delete(r,o),!0},QE=()=>({state:n,dispatch:e})=>zl(n,e),ew=()=>({commands:n})=>n.keyboardShortcut("Enter"),tw=()=>({state:n,dispatch:e})=>fE(n,e);function hs(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>t.strict?e[o]===n[o]:jl(e[o])?e[o].test(n[o]):e[o]===n[o]):!0}function _f(n,e,t={}){return n.find(r=>r.type===e&&hs(Object.fromEntries(Object.keys(t).map(o=>[o,r.attrs[o]])),t))}function Sf(n,e,t={}){return!!_f(n,e,t)}function go(n,e,t){var r;if(!n||!e)return;let o=n.parent.childAfter(n.parentOffset);if((!o.node||!o.node.marks.some(u=>u.type===e))&&(o=n.parent.childBefore(n.parentOffset)),!o.node||!o.node.marks.some(u=>u.type===e)||(t=t||((r=o.node.marks[0])===null||r===void 0?void 0:r.attrs),!_f([...o.node.marks],e,t)))return;let s=o.index,a=n.start()+o.offset,c=s+1,d=a+o.node.nodeSize;for(;s>0&&Sf([...n.parent.child(s-1).marks],e,t);)s-=1,a-=n.parent.child(s).nodeSize;for(;c<n.parent.childCount&&Sf([...n.parent.child(c).marks],e,t);)d+=n.parent.child(c).nodeSize,c+=1;return{from:a,to:d}}function fr(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}const nw=(n,e={})=>({tr:t,state:r,dispatch:o})=>{const i=fr(n,r.schema),{doc:s,selection:a}=t,{$from:c,from:d,to:u}=a;if(o){const p=go(c,i,e);if(p&&p.from<=d&&p.to>=u){const f=J.create(s,p.from,p.to);t.setSelection(f)}}return!0},rw=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function ms(n){return n instanceof J}function Wn(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function xf(n,e=null){if(!e)return null;const t=Q.atStart(n),r=Q.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const o=t.from,i=r.to;return e==="all"?J.create(n,Wn(0,o,i),Wn(n.content.size,o,i)):J.create(n,Wn(e,o,i),Wn(e,o,i))}function Nf(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function gs(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const ow=(n=null,e={})=>({editor:t,view:r,tr:o,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{(gs()||Nf())&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(i&&n===null&&!ms(t.state.selection))return s(),!0;const a=xf(o.doc,n)||t.state.selection,c=t.state.selection.eq(a);return i&&(c||o.setSelection(a),c&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},iw=(n,e)=>t=>n.every((r,o)=>e(r,{...t,index:o})),sw=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),Tf=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&Tf(r)}return n};function bs(n){const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return Tf(t)}function ys(n,e,t){if(n instanceof Qn||n instanceof x)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,o=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return x.fromArray(n.map(a=>e.nodeFromJSON(a)));const s=e.nodeFromJSON(n);return t.errorOnInvalidContent&&s.check(),s}catch(i){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",i),ys("",e,t)}if(o){if(t.errorOnInvalidContent){let s=!1,a="";const c=new Zd({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(t.slice?er.fromSchema(c).parseSlice(bs(n),t.parseOptions):er.fromSchema(c).parse(bs(n),t.parseOptions),t.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const i=er.fromSchema(e);return t.slice?i.parseSlice(bs(n),t.parseOptions).content:i.parse(bs(n),t.parseOptions)}return ys("",e,t)}function aw(n,e,t){const r=n.steps.length-1;if(r<e)return;const o=n.steps[r];if(!(o instanceof pt||o instanceof ft))return;const i=n.mapping.maps[r];let s=0;i.forEach((a,c,d,u)=>{s===0&&(s=u)}),n.setSelection(Q.near(n.doc.resolve(s),t))}const lw=n=>!("type"in n),cw=(n,e,t)=>({tr:r,dispatch:o,editor:i})=>{var s;if(o){t={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let a;try{a=ys(e,i.schema,{parseOptions:{preserveWhitespace:"full",...t.parseOptions},errorOnInvalidContent:(s=t.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 n=="number"?{from:n,to:n}:{from:n.from,to:n.to},u=!0,p=!0;if((lw(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}=r.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 x){let m="";e.forEach(g=>{g.text&&(m+=g.text)}),h=m}else typeof e=="object"&&e&&e.text?h=e.text:h=e;r.insertText(h,c,d)}else h=a,r.replaceWith(c,d,h);t.updateSelection&&aw(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:c,text:h}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:c,text:h})}return!0},dw=()=>({state:n,dispatch:e})=>dE(n,e),uw=()=>({state:n,dispatch:e})=>uE(n,e),pw=()=>({state:n,dispatch:e})=>of(n,e),fw=()=>({state:n,dispatch:e})=>cf(n,e),hw=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Ji(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},mw=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Ji(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},gw=()=>({state:n,dispatch:e})=>lE(n,e),bw=()=>({state:n,dispatch:e})=>cE(n,e);function Of(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function yw(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,o,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))r=!0;else if(/^(c|ctrl|control)$/i.test(c))o=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))gs()||Of()?s=!0:o=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return r&&(t=`Alt-${t}`),o&&(t=`Ctrl-${t}`),s&&(t=`Meta-${t}`),i&&(t=`Shift-${t}`),t}const kw=n=>({editor:e,view:t,tr:r,dispatch:o})=>{const i=yw(n).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(()=>{t.someProp("handleKeyDown",d=>d(t,a))});return c==null||c.steps.forEach(d=>{const u=d.map(r.mapping);u&&o&&r.maybeStep(u)}),!0};function ri(n,e,t={}){const{from:r,to:o,empty:i}=n.selection,s=e?it(e,n.schema):null,a=[];n.doc.nodesBetween(r,o,(p,f)=>{if(p.isText)return;const h=Math.max(r,f),m=Math.min(o,f+p.nodeSize);a.push({node:p,from:h,to:m})});const c=o-r,d=a.filter(p=>s?s.name===p.node.type.name:!0).filter(p=>hs(p.node.attrs,t,{strict:!1}));return i?!!d.length:d.reduce((p,f)=>p+f.to-f.from,0)>=c}const Ew=(n,e={})=>({state:t,dispatch:r})=>{const o=it(n,t.schema);return ri(t,o,e)?pE(t,r):!1},ww=()=>({state:n,dispatch:e})=>ff(n,e),Cw=n=>({state:e,dispatch:t})=>{const r=it(n,e.schema);return SE(r)(e,t)},_w=()=>({state:n,dispatch:e})=>uf(n,e);function ks(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Mf(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,o)=>(t.includes(o)||(r[o]=n[o]),r),{})}const Sw=(n,e)=>({tr:t,state:r,dispatch:o})=>{let i=null,s=null;const a=ks(typeof n=="string"?n:n.name,r.schema);return a?(a==="node"&&(i=it(n,r.schema)),a==="mark"&&(s=fr(n,r.schema)),o&&t.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(d,u)=>{i&&i===d.type&&t.setNodeMarkup(u,void 0,Mf(d.attrs,e)),s&&d.marks.length&&d.marks.forEach(p=>{s===p.type&&t.addMark(u,u+d.nodeSize,s.create(Mf(p.attrs,e)))})})}),!0):!1},xw=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),Nw=()=>({tr:n,dispatch:e})=>{if(e){const t=new Ut(n.doc);n.setSelection(t)}return!0},Tw=()=>({state:n,dispatch:e})=>af(n,e),Ow=()=>({state:n,dispatch:e})=>df(n,e),Mw=()=>({state:n,dispatch:e})=>gE(n,e),Aw=()=>({state:n,dispatch:e})=>kE(n,e),vw=()=>({state:n,dispatch:e})=>yE(n,e);function Yl(n,e,t={},r={}){return ys(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}const Rw=(n,e=!1,t={},r={})=>({editor:o,tr:i,dispatch:s,commands:a})=>{var c,d;const{doc:u}=i;if(t.preserveWhitespace!=="full"){const p=Yl(n,o.schema,t,{errorOnInvalidContent:(c=r.errorOnInvalidContent)!==null&&c!==void 0?c:o.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},n,{parseOptions:t,errorOnInvalidContent:(d=r.errorOnInvalidContent)!==null&&d!==void 0?d:o.options.enableContentCheck})};function Af(n,e){const t=fr(e,n.schema),{from:r,to:o,empty:i}=n.selection,s=[];i?(n.storedMarks&&s.push(...n.storedMarks),s.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,o,c=>{s.push(...c.marks)});const a=s.find(c=>c.type.name===t.name);return a?{...a.attrs}:{}}function Dw(n,e){const t=new Wu(n);return e.forEach(r=>{r.steps.forEach(o=>{t.step(o)})}),t}function Iw(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function Xl(n,e){const t=[];return n.descendants((r,o)=>{e(r)&&t.push({node:r,pos:o})}),t}function Bw(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(o,i)=>{t(o)&&r.push({node:o,pos:i})}),r}function vf(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function Zl(n){return e=>vf(e.$from,n)}function Rf(n,e){const t={from:0,to:n.content.size};return Cf(n,t,e)}function Lw(n,e){const t=it(e,n.schema),{from:r,to:o}=n.selection,i=[];n.doc.nodesBetween(r,o,a=>{i.push(a)});const s=i.reverse().find(a=>a.type.name===t.name);return s?{...s.attrs}:{}}function Df(n,e){const t=ks(typeof e=="string"?e:e.name,n.schema);return t==="node"?Lw(n,e):t==="mark"?Af(n,e):{}}function Pw(n,e=JSON.stringify){const t={};return n.filter(r=>{const o=e(r);return Object.prototype.hasOwnProperty.call(t,o)?!1:t[o]=!0})}function $w(n){const e=Pw(n);return e.length===1?e:e.filter((t,r)=>!e.filter((i,s)=>s!==r).some(i=>t.oldRange.from>=i.oldRange.from&&t.oldRange.to<=i.oldRange.to&&t.newRange.from>=i.newRange.from&&t.newRange.to<=i.newRange.to))}function Fw(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((o,i)=>{const s=[];if(o.ranges.length)o.forEach((a,c)=>{s.push({from:a,to:c})});else{const{from:a,to:c}=t[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);r.push({oldRange:{from:p,to:f},newRange:{from:d,to:u}})})}),$w(r)}function Ql(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(o=>{const i=t.resolve(n),s=go(i,o.type);s&&r.push({mark:o,...s})}):t.nodesBetween(n,e,(o,i)=>{!o||(o==null?void 0:o.nodeSize)===void 0||r.push(...o.marks.map(s=>({from:i,to:i+o.nodeSize,mark:s})))}),r}function Es(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const o=n.find(i=>i.type===e&&i.name===r);return o?o.attribute.keepOnSplit:!1}))}function ec(n,e,t={}){const{empty:r,ranges:o}=n.selection,i=e?fr(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(p=>i?i.name===p.type.name:!0).find(p=>hs(p.attrs,t,{strict:!1}));let s=0;const a=[];if(o.forEach(({$from:p,$to:f})=>{const h=p.pos,m=f.pos;n.doc.nodesBetween(h,m,(g,b)=>{if(!g.isText&&!g.marks.length)return;const y=Math.max(h,b),E=Math.min(m,b+g.nodeSize),C=E-y;s+=C,a.push(...g.marks.map(k=>({mark:k,from:y,to:E})))})}),s===0)return!1;const c=a.filter(p=>i?i.name===p.mark.type.name:!0).filter(p=>hs(p.mark.attrs,t,{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 zw(n,e,t={}){if(!e)return ri(n,null,t)||ec(n,null,t);const r=ks(e,n.schema);return r==="node"?ri(n,e,t):r==="mark"?ec(n,e,t):!1}function If(n,e){const{nodeExtensions:t}=cs(e),r=t.find(s=>s.name===n);if(!r)return!1;const o={name:r.name,options:r.options,storage:r.storage},i=me(U(r,"group",o));return typeof i!="string"?!1:i.split(" ").includes("list")}function tc(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!==null&&r!==void 0?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let o=!0;return n.content.forEach(i=>{o!==!1&&(tc(i,{ignoreWhitespace:t,checkChildren:e})||(o=!1))}),o}return!1}function Bf(n){return n instanceof K}function Lf(n,e,t){const o=n.state.doc.content.size,i=Wn(e,0,o),s=Wn(t,0,o),a=n.coordsAtPos(i),c=n.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 Vw(n,e,t){var r;const{selection:o}=e;let i=null;if(ms(o)&&(i=o.$cursor),i){const a=(r=n.storedMarks)!==null&&r!==void 0?r:i.marks();return!!t.isInSet(a)||!a.some(c=>c.type.excludes(t))}const{ranges:s}=o;return s.some(({$from:a,$to:c})=>{let d=a.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(a.pos,c.pos,(u,p,f)=>{if(d)return!1;if(u.isInline){const h=!f||f.type.allowsMarkType(t),m=!!t.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(t));d=h&&m}return!d}),d})}const Hw=(n,e={})=>({tr:t,state:r,dispatch:o})=>{const{selection:i}=t,{empty:s,ranges:a}=i,c=fr(n,r.schema);if(o)if(s){const d=Af(r,c);t.addStoredMark(c.create({...d,...e}))}else a.forEach(d=>{const u=d.$from.pos,p=d.$to.pos;r.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&&t.addMark(m,g,c.create({...y.attrs,...e}))}):t.addMark(m,g,c.create(e))})});return Vw(r,t,c)},Uw=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),Ww=(n,e={})=>({state:t,dispatch:r,chain:o})=>{const i=it(n,t.schema);let s;return t.selection.$anchor.sameParent(t.selection.$head)&&(s=t.selection.$anchor.parent.attrs),i.isTextblock?o().command(({commands:a})=>gf(i,{...s,...e})(t)?!0:a.clearNodes()).command(({state:a})=>gf(i,{...s,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},qw=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,o=Wn(n,0,r.content.size),i=K.create(r,o);e.setSelection(i)}return!0},Kw=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:o,to:i}=typeof n=="number"?{from:n,to:n}:n,s=J.atStart(r).from,a=J.atEnd(r).to,c=Wn(o,s,a),d=Wn(i,s,a),u=J.create(r,c,d);e.setSelection(u)}return!0},Gw=n=>({state:e,dispatch:t})=>{const r=it(n,e.schema);return TE(r)(e,t)};function Pf(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(o=>e==null?void 0:e.includes(o.type.name));n.tr.ensureMarks(r)}}const jw=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:o})=>{const{selection:i,doc:s}=e,{$from:a,$to:c}=i,d=o.extensionManager.attributes,u=Es(d,a.node().type.name,a.node().attrs);if(i instanceof K&&i.node.isBlock)return!a.parentOffset||!Fn(s,a.pos)?!1:(r&&(n&&Pf(t,o.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:Iw(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=p&&f?[{type:f,attrs:u}]:void 0,m=Fn(e.doc,e.mapping.map(a.pos),1,h);if(!h&&!m&&Fn(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(m=!0,h=f?[{type:f,attrs:u}]:void 0),r){if(m&&(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)}n&&Pf(t,o.extensionManager.splittableMarks),e.scrollIntoView()}return m},Jw=(n,e={})=>({tr:t,state:r,dispatch:o,editor:i})=>{var s;const a=it(n,r.schema),{$from:c,$to:d}=r.selection,u=r.selection.node;if(u&&u.isBlock||c.depth<2||!c.sameParent(d))return!1;const 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(o){let y=x.empty;const E=c.index(-1)?1:c.index(-2)?2:3;for(let B=c.depth-E;B>=c.depth-3;B-=1)y=x.from(c.node(B).copy(y));const C=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,k={...Es(f,c.node().type.name,c.node().attrs),...e},S=((s=a.contentMatch.defaultType)===null||s===void 0?void 0:s.createAndFill(k))||void 0;y=y.append(x.from(a.createAndFill(null,S)||void 0));const _=c.before(c.depth-(E-1));t.replace(_,c.after(-C),new M(y,4-E,0));let D=-1;t.doc.nodesBetween(_,t.doc.content.size,(B,v)=>{if(D>-1)return!1;B.isTextblock&&B.content.size===0&&(D=v+1)}),D>-1&&t.setSelection(J.near(t.doc.resolve(D))),t.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};t.delete(c.pos,d.pos);const b=h?[{type:a,attrs:m},{type:h,attrs:g}]:[{type:a,attrs:m}];if(!Fn(t.doc,c.pos,2))return!1;if(o){const{selection:y,storedMarks:E}=r,{splittableMarks:C}=i.extensionManager,k=E||y.$to.parentOffset&&y.$from.marks();if(t.split(c.pos,2,b).scrollIntoView(),!k||!o)return!0;const S=k.filter(_=>C.includes(_.type.name));t.ensureMarks(S)}return!0},nc=(n,e)=>{const t=Zl(s=>s.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const o=n.doc.nodeAt(r);return t.node.type===(o==null?void 0:o.type)&&rr(n.doc,t.pos)&&n.join(t.pos),!0},rc=(n,e)=>{const t=Zl(s=>s.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const o=n.doc.nodeAt(r);return t.node.type===(o==null?void 0:o.type)&&rr(n.doc,r)&&n.join(r),!0};var Yw=Object.freeze({__proto__:null,blur:WE,clearContent:qE,clearNodes:KE,command:GE,createParagraphNear:jE,cut:JE,deleteCurrentNode:YE,deleteNode:XE,deleteRange:ZE,deleteSelection:QE,enter:ew,exitCode:tw,extendMarkRange:nw,first:rw,focus:ow,forEach:iw,insertContent:sw,insertContentAt:cw,joinBackward:pw,joinDown:uw,joinForward:fw,joinItemBackward:hw,joinItemForward:mw,joinTextblockBackward:gw,joinTextblockForward:bw,joinUp:dw,keyboardShortcut:kw,lift:Ew,liftEmptyBlock:ww,liftListItem:Cw,newlineInCode:_w,resetAttributes:Sw,scrollIntoView:xw,selectAll:Nw,selectNodeBackward:Tw,selectNodeForward:Ow,selectParentNode:Mw,selectTextblockEnd:Aw,selectTextblockStart:vw,setContent:Rw,setMark:Hw,setMeta:Uw,setNode:Ww,setNodeSelection:qw,setTextSelection:Kw,sinkListItem:Gw,splitBlock:jw,splitListItem:Jw,toggleList:(n,e,t,r={})=>({editor:o,tr:i,state:s,dispatch:a,chain:c,commands:d,can:u})=>{const{extensions:p,splittableMarks:f}=o.extensionManager,h=it(n,s.schema),m=it(e,s.schema),{selection:g,storedMarks:b}=s,{$from:y,$to:E}=g,C=y.blockRange(E),k=b||g.$to.parentOffset&&g.$from.marks();if(!C)return!1;const S=Zl(_=>If(_.type.name,p))(g);if(C.depth>=1&&S&&C.depth-S.depth<=1){if(S.node.type===h)return d.liftListItem(m);if(If(S.node.type.name,p)&&h.validContent(S.node.content)&&a)return c().command(()=>(i.setNodeMarkup(S.pos,h),!0)).command(()=>nc(i,h)).command(()=>rc(i,h)).run()}return!t||!k||!a?c().command(()=>u().wrapInList(h,r)?!0:d.clearNodes()).wrapInList(h,r).command(()=>nc(i,h)).command(()=>rc(i,h)).run():c().command(()=>{const _=u().wrapInList(h,r),D=k.filter(B=>f.includes(B.type.name));return i.ensureMarks(D),_?!0:d.clearNodes()}).wrapInList(h,r).command(()=>nc(i,h)).command(()=>rc(i,h)).run()},toggleMark:(n,e={},t={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=t,s=fr(n,r.schema);return ec(r,s,e)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,e)},toggleNode:(n,e,t={})=>({state:r,commands:o})=>{const i=it(n,r.schema),s=it(e,r.schema),a=ri(r,i,t);let c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),a?o.setNode(s,c):o.setNode(i,{...c,...t})},toggleWrap:(n,e={})=>({state:t,commands:r})=>{const o=it(n,t.schema);return ri(t,o,e)?r.lift(o):r.wrapIn(o,e)},undoInputRule:()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const o=t[r];let i;if(o.spec.isInputRules&&(i=o.getState(n))){if(e){const s=n.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,n.schema.text(i.text,c))}else s.delete(i.from,i.to)}return!0}}return!1},unsetAllMarks:()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:o}=t;return r||e&&o.forEach(i=>{n.removeMark(i.$from.pos,i.$to.pos)}),!0},unsetMark:(n,e={})=>({tr:t,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:a}=t,c=fr(n,r.schema),{$from:d,empty:u,ranges:p}=a;if(!o)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=go(d,c,m);g&&(f=g.from,h=g.to),t.removeMark(f,h,c)}else p.forEach(f=>{t.removeMark(f.$from.pos,f.$to.pos,c)});return t.removeStoredMark(c),!0},updateAttributes:(n,e={})=>({tr:t,state:r,dispatch:o})=>{let i=null,s=null;const a=ks(typeof n=="string"?n:n.name,r.schema);return a?(a==="node"&&(i=it(n,r.schema)),a==="mark"&&(s=fr(n,r.schema)),o&&t.selection.ranges.forEach(c=>{const d=c.$from.pos,u=c.$to.pos;let p,f,h,m;t.selection.empty?r.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)}):r.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&&t.setNodeMarkup(b,void 0,{...g.attrs,...e}),s&&g.marks.length&&g.marks.forEach(y=>{if(s===y.type){const E=Math.max(b,d),C=Math.min(b+g.nodeSize,u);t.addMark(E,C,s.create({...y.attrs,...e}))}}))}),f&&(p!==void 0&&t.setNodeMarkup(p,void 0,{...f.attrs,...e}),s&&f.marks.length&&f.marks.forEach(g=>{s===g.type&&t.addMark(h,m,s.create({...g.attrs,...e}))}))}),!0):!1},wrapIn:(n,e={})=>({state:t,dispatch:r})=>{const o=it(n,t.schema);return EE(o,e)(t,r)},wrapInList:(n,e={})=>({state:t,dispatch:r})=>{const o=it(n,t.schema);return wE(o,e)(t,r)}});const Xw=Ae.create({name:"commands",addCommands(){return{...Yw}}}),Zw=Ae.create({name:"drop",addProseMirrorPlugins(){return[new Ne({key:new Fe("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),Qw=Ae.create({name:"editable",addProseMirrorPlugins(){return[new Ne({key:new Fe("editable"),props:{editable:()=>this.editor.options.editable}})]}}),e0=Ae.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Ne({key:new Fe("focusEvents"),props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),t0=Ae.create({name:"keymap",addKeyboardShortcuts(){const n=()=>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:Q.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()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o={...r},i={...r,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return gs()||Of()?i:o},addProseMirrorPlugins(){return[new Ne({key:new Fe("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(g=>g.getMeta("composition")))return;const r=n.some(g=>g.docChanged)&&!e.doc.eq(t.doc),o=n.some(g=>g.getMeta("preventClearDocument"));if(!r||o)return;const{empty:i,from:s,to:a}=e.selection,c=Q.atStart(e.doc).from,d=Q.atEnd(e.doc).to;if(i||!(s===c&&a===d)||!tc(t.doc))return;const f=t.tr,h=as({state:t,transaction:f}),{commands:m}=new ls({editor:this.editor,state:h});if(m.clearNodes(),!!f.steps.length)return f}})]}}),n0=Ae.create({name:"paste",addProseMirrorPlugins(){return[new Ne({key:new Fe("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),r0=Ae.create({name:"tabindex",addProseMirrorPlugins(){return[new Ne({key:new Fe("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Fr{get name(){return this.node.type.name}constructor(e,t,r=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=o}get 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 t=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new Fr(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Fr(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 Fr(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const o=t.isBlock&&!t.isTextblock,i=t.isAtom&&!t.isText,s=this.pos+r+(i?0:1),a=this.resolvedPos.doc.resolve(s);if(!o&&a.depth<=this.depth)return;const c=new Fr(a,this.editor,o,o?t:null);o&&(c.actualDepth=this.depth+1),e.push(new Fr(a,this.editor,o,o?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,o=this.parent;for(;o&&!r;){if(o.node.type.name===e)if(Object.keys(t).length>0){const i=o.node.attrs,s=Object.keys(t);for(let a=0;a<s.length;a+=1){const c=s[a];if(i[c]!==t[c])break}}else r=o;o=o.parent}return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let o=[];if(!this.children||this.children.length===0)return o;const i=Object.keys(t);return this.children.forEach(s=>{r&&o.length>0||(s.node.type.name===e&&i.every(c=>t[c]===s.node.attrs[c])&&o.push(s),!(r&&o.length>0)&&(o=o.concat(s.querySelectorAll(e,t,r))))}),o}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}}const o0=`.ProseMirror {
17
+ position: relative;
18
+ }
19
+
20
+ .ProseMirror {
21
+ word-wrap: break-word;
22
+ white-space: pre-wrap;
23
+ white-space: break-spaces;
24
+ -webkit-font-variant-ligatures: none;
25
+ font-variant-ligatures: none;
26
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
27
+ }
28
+
29
+ .ProseMirror [contenteditable="false"] {
30
+ white-space: normal;
31
+ }
32
+
33
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
34
+ white-space: pre-wrap;
35
+ }
36
+
37
+ .ProseMirror pre {
38
+ white-space: pre-wrap;
39
+ }
40
+
41
+ img.ProseMirror-separator {
42
+ display: inline !important;
43
+ border: none !important;
44
+ margin: 0 !important;
45
+ width: 0 !important;
46
+ height: 0 !important;
47
+ }
48
+
49
+ .ProseMirror-gapcursor {
50
+ display: none;
51
+ pointer-events: none;
52
+ position: absolute;
53
+ margin: 0;
54
+ }
55
+
56
+ .ProseMirror-gapcursor:after {
57
+ content: "";
58
+ display: block;
59
+ position: absolute;
60
+ top: -2px;
61
+ width: 20px;
62
+ border-top: 1px solid black;
63
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
64
+ }
65
+
66
+ @keyframes ProseMirror-cursor-blink {
67
+ to {
68
+ visibility: hidden;
69
+ }
70
+ }
71
+
72
+ .ProseMirror-hideselection *::selection {
73
+ background: transparent;
74
+ }
75
+
76
+ .ProseMirror-hideselection *::-moz-selection {
77
+ background: transparent;
78
+ }
79
+
80
+ .ProseMirror-hideselection * {
81
+ caret-color: transparent;
82
+ }
83
+
84
+ .ProseMirror-focused .ProseMirror-gapcursor {
85
+ display: block;
86
+ }
87
+
88
+ .tippy-box[data-animation=fade][data-state=hidden] {
89
+ opacity: 0
90
+ }`;function i0(n,e,t){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const o=document.createElement("style");return e&&o.setAttribute("nonce",e),o.setAttribute("data-tiptap-style",""),o.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(o),o}let Sn=class extends OE{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:t})=>{throw t},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:t,slice:r,moved:o})=>this.options.onDrop(t,r,o)),this.on("paste",({event:t,slice:r})=>this.options.onPaste(t,r)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=i0(o0,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,t=!0){this.setOptions({editable:e}),t&&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,t){const r=yf(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],o=this.state.reconfigure({plugins:r});return this.view.updateState(o),o}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let r=t;if([].concat(e).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;r=t.filter(a=>!a.key.startsWith(s))}),t.length===r.length)return;const o=this.state.reconfigure({plugins:r});return this.view.updateState(o),o}createExtensionManager(){var e,t;const o=[...this.options.enableCoreExtensions?[Qw,UE.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||t===void 0?void 0:t.blockSeparator}),Xw,e0,t0,r0,Zw,n0].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 mo(o,this)}createCommandManager(){this.commandManager=new ls({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let t;try{t=Yl(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()}}),t=Yl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const r=xf(t,this.options.autofocus);this.view=new Zk(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:no.create({doc:t,selection:r||void 0})});const o=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(o),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 t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(s=>{var a;return(a=this.capturedTransaction)===null||a===void 0?void 0:a.step(s)});return}const t=this.state.apply(e),r=!this.state.selection.eq(t.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const o=e.getMeta("focus"),i=e.getMeta("blur");o&&this.emit("focus",{editor:this,event:o.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 Df(this.state,e)}isActive(e,t){const r=typeof e=="string"?e:null,o=typeof e=="string"?t:e;return zw(this.state,r,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Gl(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
91
+
92
+ `,textSerializers:r={}}=e||{};return Rf(this.state.doc,{blockSeparator:t,textSerializers:{...Jl(this.schema),...r}})}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,t){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,t))||null}$nodes(e,t){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new Fr(t,this)}get $doc(){return this.$pos(0)}};function zr(n){return new ni({find:n.find,handler:({state:e,range:t,match:r})=>{const o=me(n.getAttributes,void 0,r);if(o===!1||o===null)return null;const{tr:i}=e,s=r[r.length-1],a=r[0];if(s){const c=a.search(/\S/),d=t.from+a.indexOf(s),u=d+s.length;if(Ql(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(g=>g===n.type&&g!==h.mark.type)).filter(h=>h.to>d).length)return null;u<t.to&&i.delete(u,t.to),d>t.from&&i.delete(t.from+c,d);const f=t.from+c+s.length;i.addMark(t.from+c,f,n.type.create(o||{})),i.removeStoredMark(n.type)}}})}function oc(n){return new ni({find:n.find,handler:({state:e,range:t,match:r})=>{const o=me(n.getAttributes,void 0,r)||{},{tr:i}=e,s=t.from;let a=t.to;const c=n.type.create(o);if(r[1]){const d=r[0].lastIndexOf(r[1]);let u=s+d;u>a?u=a:a=u+r[1].length;const p=r[0][r[0].length-1];i.insertText(p,s+r[0].length-1),i.replaceWith(u,a,c)}else if(r[0]){const d=n.type.isInline?s:s-1;i.insert(d,n.type.create(o)).delete(i.mapping.map(s),i.mapping.map(a))}i.scrollIntoView()}})}function ic(n){return new ni({find:n.find,handler:({state:e,range:t,match:r})=>{const o=e.doc.resolve(t.from),i=me(n.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,i)}})}function Je(n){return new ni({find:n.find,handler:({state:e,range:t,match:r})=>{let o=n.replace,i=t.from;const s=t.to;if(r[1]){const a=r[0].lastIndexOf(r[1]);o+=r[0].slice(a+r[1].length),i+=a;const c=i-s;c>0&&(o=r[0].slice(a-c,a)+o,i=s)}e.tr.insertText(o,i,s)}})}function bo(n){return new ni({find:n.find,handler:({state:e,range:t,match:r,chain:o})=>{const i=me(n.getAttributes,void 0,r)||{},s=e.tr.delete(t.from,t.to),c=s.doc.resolve(t.from).blockRange(),d=c&&dl(c,n.type,i);if(!d)return null;if(s.wrap(c,d),n.keepMarks&&n.editor){const{selection:p,storedMarks:f}=e,{splittableMarks:h}=n.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(n.keepAttributes){const p=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";o().updateAttributes(p,i).run()}const u=s.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&rr(s.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,u))&&s.join(t.from-1)}})}class Ge{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 Ge(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>ps(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Ge(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.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: "${t.name}".`),t.options=me(U(t,"addOptions",{name:t.name})),t.storage=me(U(t,"addStorage",{name:t.name,options:t.options})),t}}class s0{constructor(e,t,r){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options={stopEvent:null,ignoreMutation:null,...r},this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=t.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var t,r,o,i,s,a,c;const{view:d}=this.editor,u=e.target,p=u.nodeType===3?(t=u.parentElement)===null||t===void 0?void 0:t.closest("[data-drag-handle]"):u.closest("[data-drag-handle]");if(!this.dom||!((r=this.contentDOM)===null||r===void 0)&&r.contains(u)||!p)return;let f=0,h=0;if(this.dom!==p){const y=this.dom.getBoundingClientRect(),E=p.getBoundingClientRect(),C=(o=e.offsetX)!==null&&o!==void 0?o:(i=e.nativeEvent)===null||i===void 0?void 0:i.offsetX,k=(s=e.offsetY)!==null&&s!==void 0?s:(a=e.nativeEvent)===null||a===void 0?void 0:a.offsetY;f=E.x-y.x+C,h=E.y-y.y+k}(c=e.dataTransfer)===null||c===void 0||c.setDragImage(this.dom,f,h);const m=this.getPos();if(typeof m!="number")return;const g=K.create(d.state.doc,m),b=d.state.tr.setSelection(g);d.dispatch(b)}stopEvent(e){var t;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:e});const r=e.target;if(!(this.dom.contains(r)&&!(!((t=this.contentDOM)===null||t===void 0)&&t.contains(r))))return!1;const i=e.type.startsWith("drag"),s=e.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(r.tagName)||r.isContentEditable)&&!s&&!i)return!0;const{isEditable:c}=this.editor,{isDragging:d}=this,u=!!this.node.type.spec.draggable,p=K.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=r.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"&&(gs()||Nf())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(r=>r.isContentEditable)?!1:this.contentDOM===e.target&&e.type==="attributes"?!0:!this.contentDOM.contains(e.target)}updateAttributes(e){this.editor.commands.command(({tr:t})=>{const r=this.getPos();return typeof r!="number"?!1:(t.setNodeMarkup(r,void 0,{...this.node.attrs,...e}),!0)})}deleteNode(){const e=this.getPos();if(typeof e!="number")return;const t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}}function hr(n){return new PE({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:o})=>{const i=me(n.getAttributes,void 0,r,o);if(i===!1||i===null)return null;const{tr:s}=e,a=r[r.length-1],c=r[0];let d=t.to;if(a){const u=c.search(/\S/),p=t.from+c.indexOf(a),f=p+a.length;if(Ql(t.from,t.to,e.doc).filter(m=>m.mark.type.excluded.find(b=>b===n.type&&b!==m.mark.type)).filter(m=>m.to>p).length)return null;f<t.to&&s.delete(f,t.to),p>t.from&&s.delete(t.from+u,p),d=t.from+u+a.length,s.addMark(t.from+u,d,n.type.create(i||{})),s.removeStoredMark(n.type)}}})}function a0(n){return n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var $t="top",on="bottom",sn="right",Ft="left",sc="auto",oi=[$t,on,sn,Ft],yo="start",ii="end",l0="clippingParents",$f="viewport",si="popper",c0="reference",Ff=oi.reduce(function(n,e){return n.concat([e+"-"+yo,e+"-"+ii])},[]),zf=[].concat(oi,[sc]).reduce(function(n,e){return n.concat([e,e+"-"+yo,e+"-"+ii])},[]),d0="beforeRead",u0="read",p0="afterRead",f0="beforeMain",h0="main",m0="afterMain",g0="beforeWrite",b0="write",y0="afterWrite",k0=[d0,u0,p0,f0,h0,m0,g0,b0,y0];function xn(n){return n?(n.nodeName||"").toLowerCase():null}function qt(n){if(n==null)return window;if(n.toString()!=="[object Window]"){var e=n.ownerDocument;return e&&e.defaultView||window}return n}function Vr(n){var e=qt(n).Element;return n instanceof e||n instanceof Element}function an(n){var e=qt(n).HTMLElement;return n instanceof e||n instanceof HTMLElement}function ac(n){if(typeof ShadowRoot>"u")return!1;var e=qt(n).ShadowRoot;return n instanceof e||n instanceof ShadowRoot}function E0(n){var e=n.state;Object.keys(e.elements).forEach(function(t){var r=e.styles[t]||{},o=e.attributes[t]||{},i=e.elements[t];!an(i)||!xn(i)||(Object.assign(i.style,r),Object.keys(o).forEach(function(s){var a=o[s];a===!1?i.removeAttribute(s):i.setAttribute(s,a===!0?"":a)}))})}function w0(n){var e=n.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(r){var o=e.elements[r],i=e.attributes[r]||{},s=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:t[r]),a=s.reduce(function(c,d){return c[d]="",c},{});!an(o)||!xn(o)||(Object.assign(o.style,a),Object.keys(i).forEach(function(c){o.removeAttribute(c)}))})}}const Vf={name:"applyStyles",enabled:!0,phase:"write",fn:E0,effect:w0,requires:["computeStyles"]};function Nn(n){return n.split("-")[0]}var Hr=Math.max,ws=Math.min,ko=Math.round;function lc(){var n=navigator.userAgentData;return n!=null&&n.brands&&Array.isArray(n.brands)?n.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function Hf(){return!/^((?!chrome|android).)*safari/i.test(lc())}function Eo(n,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var r=n.getBoundingClientRect(),o=1,i=1;e&&an(n)&&(o=n.offsetWidth>0&&ko(r.width)/n.offsetWidth||1,i=n.offsetHeight>0&&ko(r.height)/n.offsetHeight||1);var s=Vr(n)?qt(n):window,a=s.visualViewport,c=!Hf()&&t,d=(r.left+(c&&a?a.offsetLeft:0))/o,u=(r.top+(c&&a?a.offsetTop:0))/i,p=r.width/o,f=r.height/i;return{width:p,height:f,top:u,right:d+p,bottom:u+f,left:d,x:d,y:u}}function cc(n){var e=Eo(n),t=n.offsetWidth,r=n.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:n.offsetLeft,y:n.offsetTop,width:t,height:r}}function Uf(n,e){var t=e.getRootNode&&e.getRootNode();if(n.contains(e))return!0;if(t&&ac(t)){var r=e;do{if(r&&n.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function qn(n){return qt(n).getComputedStyle(n)}function C0(n){return["table","td","th"].indexOf(xn(n))>=0}function mr(n){return((Vr(n)?n.ownerDocument:n.document)||window.document).documentElement}function Cs(n){return xn(n)==="html"?n:n.assignedSlot||n.parentNode||(ac(n)?n.host:null)||mr(n)}function Wf(n){return!an(n)||qn(n).position==="fixed"?null:n.offsetParent}function _0(n){var e=/firefox/i.test(lc()),t=/Trident/i.test(lc());if(t&&an(n)){var r=qn(n);if(r.position==="fixed")return null}var o=Cs(n);for(ac(o)&&(o=o.host);an(o)&&["html","body"].indexOf(xn(o))<0;){var i=qn(o);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 o;o=o.parentNode}return null}function ai(n){for(var e=qt(n),t=Wf(n);t&&C0(t)&&qn(t).position==="static";)t=Wf(t);return t&&(xn(t)==="html"||xn(t)==="body"&&qn(t).position==="static")?e:t||_0(n)||e}function dc(n){return["top","bottom"].indexOf(n)>=0?"x":"y"}function li(n,e,t){return Hr(n,ws(e,t))}function S0(n,e,t){var r=li(n,e,t);return r>t?t:r}function qf(){return{top:0,right:0,bottom:0,left:0}}function Kf(n){return Object.assign({},qf(),n)}function Gf(n,e){return e.reduce(function(t,r){return t[r]=n,t},{})}var x0=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,Kf(typeof e!="number"?e:Gf(e,oi))};function N0(n){var e,t=n.state,r=n.name,o=n.options,i=t.elements.arrow,s=t.modifiersData.popperOffsets,a=Nn(t.placement),c=dc(a),d=[Ft,sn].indexOf(a)>=0,u=d?"height":"width";if(!(!i||!s)){var p=x0(o.padding,t),f=cc(i),h=c==="y"?$t:Ft,m=c==="y"?on:sn,g=t.rects.reference[u]+t.rects.reference[c]-s[c]-t.rects.popper[u],b=s[c]-t.rects.reference[c],y=ai(i),E=y?c==="y"?y.clientHeight||0:y.clientWidth||0:0,C=g/2-b/2,k=p[h],S=E-f[u]-p[m],_=E/2-f[u]/2+C,D=li(k,_,S),B=c;t.modifiersData[r]=(e={},e[B]=D,e.centerOffset=D-_,e)}}function T0(n){var e=n.state,t=n.options,r=t.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=e.elements.popper.querySelector(o),!o)||Uf(e.elements.popper,o)&&(e.elements.arrow=o))}const O0={name:"arrow",enabled:!0,phase:"main",fn:N0,effect:T0,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function wo(n){return n.split("-")[1]}var M0={top:"auto",right:"auto",bottom:"auto",left:"auto"};function A0(n,e){var t=n.x,r=n.y,o=e.devicePixelRatio||1;return{x:ko(t*o)/o||0,y:ko(r*o)/o||0}}function jf(n){var e,t=n.popper,r=n.popperRect,o=n.placement,i=n.variation,s=n.offsets,a=n.position,c=n.gpuAcceleration,d=n.adaptive,u=n.roundOffsets,p=n.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"),E=s.hasOwnProperty("y"),C=Ft,k=$t,S=window;if(d){var _=ai(t),D="clientHeight",B="clientWidth";if(_===qt(t)&&(_=mr(t),qn(_).position!=="static"&&a==="absolute"&&(D="scrollHeight",B="scrollWidth")),_=_,o===$t||(o===Ft||o===sn)&&i===ii){k=on;var v=p&&_===S&&S.visualViewport?S.visualViewport.height:_[D];g-=v-r.height,g*=c?1:-1}if(o===Ft||(o===$t||o===on)&&i===ii){C=sn;var $=p&&_===S&&S.visualViewport?S.visualViewport.width:_[B];h-=$-r.width,h*=c?1:-1}}var Y=Object.assign({position:a},d&&M0),te=u===!0?A0({x:h,y:g},qt(t)):{x:h,y:g};if(h=te.x,g=te.y,c){var ue;return Object.assign({},Y,(ue={},ue[k]=E?"0":"",ue[C]=y?"0":"",ue.transform=(S.devicePixelRatio||1)<=1?"translate("+h+"px, "+g+"px)":"translate3d("+h+"px, "+g+"px, 0)",ue))}return Object.assign({},Y,(e={},e[k]=E?g+"px":"",e[C]=y?h+"px":"",e.transform="",e))}function v0(n){var e=n.state,t=n.options,r=t.gpuAcceleration,o=r===void 0?!0:r,i=t.adaptive,s=i===void 0?!0:i,a=t.roundOffsets,c=a===void 0?!0:a,d={placement:Nn(e.placement),variation:wo(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:o,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,jf(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,jf(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 R0={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:v0,data:{}};var _s={passive:!0};function D0(n){var e=n.state,t=n.instance,r=n.options,o=r.scroll,i=o===void 0?!0:o,s=r.resize,a=s===void 0?!0:s,c=qt(e.elements.popper),d=[].concat(e.scrollParents.reference,e.scrollParents.popper);return i&&d.forEach(function(u){u.addEventListener("scroll",t.update,_s)}),a&&c.addEventListener("resize",t.update,_s),function(){i&&d.forEach(function(u){u.removeEventListener("scroll",t.update,_s)}),a&&c.removeEventListener("resize",t.update,_s)}}const I0={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:D0,data:{}};var B0={left:"right",right:"left",bottom:"top",top:"bottom"};function Ss(n){return n.replace(/left|right|bottom|top/g,function(e){return B0[e]})}var L0={start:"end",end:"start"};function Jf(n){return n.replace(/start|end/g,function(e){return L0[e]})}function uc(n){var e=qt(n),t=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:t,scrollTop:r}}function pc(n){return Eo(mr(n)).left+uc(n).scrollLeft}function P0(n,e){var t=qt(n),r=mr(n),o=t.visualViewport,i=r.clientWidth,s=r.clientHeight,a=0,c=0;if(o){i=o.width,s=o.height;var d=Hf();(d||!d&&e==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}return{width:i,height:s,x:a+pc(n),y:c}}function $0(n){var e,t=mr(n),r=uc(n),o=(e=n.ownerDocument)==null?void 0:e.body,i=Hr(t.scrollWidth,t.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),s=Hr(t.scrollHeight,t.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),a=-r.scrollLeft+pc(n),c=-r.scrollTop;return qn(o||t).direction==="rtl"&&(a+=Hr(t.clientWidth,o?o.clientWidth:0)-i),{width:i,height:s,x:a,y:c}}function fc(n){var e=qn(n),t=e.overflow,r=e.overflowX,o=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+o+r)}function Yf(n){return["html","body","#document"].indexOf(xn(n))>=0?n.ownerDocument.body:an(n)&&fc(n)?n:Yf(Cs(n))}function ci(n,e){var t;e===void 0&&(e=[]);var r=Yf(n),o=r===((t=n.ownerDocument)==null?void 0:t.body),i=qt(r),s=o?[i].concat(i.visualViewport||[],fc(r)?r:[]):r,a=e.concat(s);return o?a:a.concat(ci(Cs(s)))}function hc(n){return Object.assign({},n,{left:n.x,top:n.y,right:n.x+n.width,bottom:n.y+n.height})}function F0(n,e){var t=Eo(n,!1,e==="fixed");return t.top=t.top+n.clientTop,t.left=t.left+n.clientLeft,t.bottom=t.top+n.clientHeight,t.right=t.left+n.clientWidth,t.width=n.clientWidth,t.height=n.clientHeight,t.x=t.left,t.y=t.top,t}function Xf(n,e,t){return e===$f?hc(P0(n,t)):Vr(e)?F0(e,t):hc($0(mr(n)))}function z0(n){var e=ci(Cs(n)),t=["absolute","fixed"].indexOf(qn(n).position)>=0,r=t&&an(n)?ai(n):n;return Vr(r)?e.filter(function(o){return Vr(o)&&Uf(o,r)&&xn(o)!=="body"}):[]}function V0(n,e,t,r){var o=e==="clippingParents"?z0(n):[].concat(e),i=[].concat(o,[t]),s=i[0],a=i.reduce(function(c,d){var u=Xf(n,d,r);return c.top=Hr(u.top,c.top),c.right=ws(u.right,c.right),c.bottom=ws(u.bottom,c.bottom),c.left=Hr(u.left,c.left),c},Xf(n,s,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Zf(n){var e=n.reference,t=n.element,r=n.placement,o=r?Nn(r):null,i=r?wo(r):null,s=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,c;switch(o){case $t:c={x:s,y:e.y-t.height};break;case on:c={x:s,y:e.y+e.height};break;case sn:c={x:e.x+e.width,y:a};break;case Ft:c={x:e.x-t.width,y:a};break;default:c={x:e.x,y:e.y}}var d=o?dc(o):null;if(d!=null){var u=d==="y"?"height":"width";switch(i){case yo:c[d]=c[d]-(e[u]/2-t[u]/2);break;case ii:c[d]=c[d]+(e[u]/2-t[u]/2);break}}return c}function di(n,e){e===void 0&&(e={});var t=e,r=t.placement,o=r===void 0?n.placement:r,i=t.strategy,s=i===void 0?n.strategy:i,a=t.boundary,c=a===void 0?l0:a,d=t.rootBoundary,u=d===void 0?$f:d,p=t.elementContext,f=p===void 0?si:p,h=t.altBoundary,m=h===void 0?!1:h,g=t.padding,b=g===void 0?0:g,y=Kf(typeof b!="number"?b:Gf(b,oi)),E=f===si?c0:si,C=n.rects.popper,k=n.elements[m?E:f],S=V0(Vr(k)?k:k.contextElement||mr(n.elements.popper),c,u,s),_=Eo(n.elements.reference),D=Zf({reference:_,element:C,placement:o}),B=hc(Object.assign({},C,D)),v=f===si?B:_,$={top:S.top-v.top+y.top,bottom:v.bottom-S.bottom+y.bottom,left:S.left-v.left+y.left,right:v.right-S.right+y.right},Y=n.modifiersData.offset;if(f===si&&Y){var te=Y[o];Object.keys($).forEach(function(ue){var ce=[sn,on].indexOf(ue)>=0?1:-1,oe=[$t,on].indexOf(ue)>=0?"y":"x";$[ue]+=te[oe]*ce})}return $}function H0(n,e){e===void 0&&(e={});var t=e,r=t.placement,o=t.boundary,i=t.rootBoundary,s=t.padding,a=t.flipVariations,c=t.allowedAutoPlacements,d=c===void 0?zf:c,u=wo(r),p=u?a?Ff:Ff.filter(function(m){return wo(m)===u}):oi,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]=di(n,{placement:g,boundary:o,rootBoundary:i,padding:s})[Nn(g)],m},{});return Object.keys(h).sort(function(m,g){return h[m]-h[g]})}function U0(n){if(Nn(n)===sc)return[];var e=Ss(n);return[Jf(n),e,Jf(e)]}function W0(n){var e=n.state,t=n.options,r=n.name;if(!e.modifiersData[r]._skip){for(var o=t.mainAxis,i=o===void 0?!0:o,s=t.altAxis,a=s===void 0?!0:s,c=t.fallbackPlacements,d=t.padding,u=t.boundary,p=t.rootBoundary,f=t.altBoundary,h=t.flipVariations,m=h===void 0?!0:h,g=t.allowedAutoPlacements,b=e.options.placement,y=Nn(b),E=y===b,C=c||(E||!m?[Ss(b)]:U0(b)),k=[b].concat(C).reduce(function(ct,Me){return ct.concat(Nn(Me)===sc?H0(e,{placement:Me,boundary:u,rootBoundary:p,padding:d,flipVariations:m,allowedAutoPlacements:g}):Me)},[]),S=e.rects.reference,_=e.rects.popper,D=new Map,B=!0,v=k[0],$=0;$<k.length;$++){var Y=k[$],te=Nn(Y),ue=wo(Y)===yo,ce=[$t,on].indexOf(te)>=0,oe=ce?"width":"height",ie=di(e,{placement:Y,boundary:u,rootBoundary:p,altBoundary:f,padding:d}),T=ce?ue?sn:Ft:ue?on:$t;S[oe]>_[oe]&&(T=Ss(T));var A=Ss(T),z=[];if(i&&z.push(ie[te]<=0),a&&z.push(ie[T]<=0,ie[A]<=0),z.every(function(ct){return ct})){v=Y,B=!1;break}D.set(Y,z)}if(B)for(var j=m?3:1,ee=function(Me){var ze=k.find(function(Yt){var bt=D.get(Yt);if(bt)return bt.slice(0,Me).every(function(un){return un})});if(ze)return v=ze,"break"},he=j;he>0;he--){var Oe=ee(he);if(Oe==="break")break}e.placement!==v&&(e.modifiersData[r]._skip=!0,e.placement=v,e.reset=!0)}}const q0={name:"flip",enabled:!0,phase:"main",fn:W0,requiresIfExists:["offset"],data:{_skip:!1}};function Qf(n,e,t){return t===void 0&&(t={x:0,y:0}),{top:n.top-e.height-t.y,right:n.right-e.width+t.x,bottom:n.bottom-e.height+t.y,left:n.left-e.width-t.x}}function eh(n){return[$t,sn,on,Ft].some(function(e){return n[e]>=0})}function K0(n){var e=n.state,t=n.name,r=e.rects.reference,o=e.rects.popper,i=e.modifiersData.preventOverflow,s=di(e,{elementContext:"reference"}),a=di(e,{altBoundary:!0}),c=Qf(s,r),d=Qf(a,o,i),u=eh(c),p=eh(d);e.modifiersData[t]={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 G0={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:K0};function j0(n,e,t){var r=Nn(n),o=[Ft,$t].indexOf(r)>=0?-1:1,i=typeof t=="function"?t(Object.assign({},e,{placement:n})):t,s=i[0],a=i[1];return s=s||0,a=(a||0)*o,[Ft,sn].indexOf(r)>=0?{x:a,y:s}:{x:s,y:a}}function J0(n){var e=n.state,t=n.options,r=n.name,o=t.offset,i=o===void 0?[0,0]:o,s=zf.reduce(function(u,p){return u[p]=j0(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[r]=s}const Y0={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:J0};function X0(n){var e=n.state,t=n.name;e.modifiersData[t]=Zf({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})}const Z0={name:"popperOffsets",enabled:!0,phase:"read",fn:X0,data:{}};function Q0(n){return n==="x"?"y":"x"}function eC(n){var e=n.state,t=n.options,r=n.name,o=t.mainAxis,i=o===void 0?!0:o,s=t.altAxis,a=s===void 0?!1:s,c=t.boundary,d=t.rootBoundary,u=t.altBoundary,p=t.padding,f=t.tether,h=f===void 0?!0:f,m=t.tetherOffset,g=m===void 0?0:m,b=di(e,{boundary:c,rootBoundary:d,padding:p,altBoundary:u}),y=Nn(e.placement),E=wo(e.placement),C=!E,k=dc(y),S=Q0(k),_=e.modifiersData.popperOffsets,D=e.rects.reference,B=e.rects.popper,v=typeof g=="function"?g(Object.assign({},e.rects,{placement:e.placement})):g,$=typeof v=="number"?{mainAxis:v,altAxis:v}:Object.assign({mainAxis:0,altAxis:0},v),Y=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,te={x:0,y:0};if(_){if(i){var ue,ce=k==="y"?$t:Ft,oe=k==="y"?on:sn,ie=k==="y"?"height":"width",T=_[k],A=T+b[ce],z=T-b[oe],j=h?-B[ie]/2:0,ee=E===yo?D[ie]:B[ie],he=E===yo?-B[ie]:-D[ie],Oe=e.elements.arrow,ct=h&&Oe?cc(Oe):{width:0,height:0},Me=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:qf(),ze=Me[ce],Yt=Me[oe],bt=li(0,D[ie],ct[ie]),un=C?D[ie]/2-j-bt-ze-$.mainAxis:ee-bt-ze-$.mainAxis,yt=C?-D[ie]/2+j+bt+Yt+$.mainAxis:he+bt+Yt+$.mainAxis,pn=e.elements.arrow&&ai(e.elements.arrow),Bn=pn?k==="y"?pn.clientTop||0:pn.clientLeft||0:0,bn=(ue=Y==null?void 0:Y[k])!=null?ue:0,Xt=T+un-bn-Bn,yn=T+yt-bn,le=li(h?ws(A,Xt):A,T,h?Hr(z,yn):z);_[k]=le,te[k]=le-T}if(a){var Vt,xt=k==="x"?$t:Ft,Z=k==="x"?on:sn,Dt=_[S],Pe=S==="y"?"height":"width",we=Dt+b[xt],It=Dt-b[Z],et=[$t,Ft].indexOf(y)!==-1,kn=(Vt=Y==null?void 0:Y[S])!=null?Vt:0,Bt=et?we:Dt-D[Pe]-B[Pe]-kn+$.altAxis,L=et?Dt+D[Pe]+B[Pe]-kn-$.altAxis:It,V=h&&et?S0(Bt,Dt,L):li(h?Bt:we,Dt,h?L:It);_[S]=V,te[S]=V-Dt}e.modifiersData[r]=te}}const tC={name:"preventOverflow",enabled:!0,phase:"main",fn:eC,requiresIfExists:["offset"]};function nC(n){return{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}}function rC(n){return n===qt(n)||!an(n)?uc(n):nC(n)}function oC(n){var e=n.getBoundingClientRect(),t=ko(e.width)/n.offsetWidth||1,r=ko(e.height)/n.offsetHeight||1;return t!==1||r!==1}function iC(n,e,t){t===void 0&&(t=!1);var r=an(e),o=an(e)&&oC(e),i=mr(e),s=Eo(n,o,t),a={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(r||!r&&!t)&&((xn(e)!=="body"||fc(i))&&(a=rC(e)),an(e)?(c=Eo(e,!0),c.x+=e.clientLeft,c.y+=e.clientTop):i&&(c.x=pc(i))),{x:s.left+a.scrollLeft-c.x,y:s.top+a.scrollTop-c.y,width:s.width,height:s.height}}function sC(n){var e=new Map,t=new Set,r=[];n.forEach(function(i){e.set(i.name,i)});function o(i){t.add(i.name);var s=[].concat(i.requires||[],i.requiresIfExists||[]);s.forEach(function(a){if(!t.has(a)){var c=e.get(a);c&&o(c)}}),r.push(i)}return n.forEach(function(i){t.has(i.name)||o(i)}),r}function aC(n){var e=sC(n);return k0.reduce(function(t,r){return t.concat(e.filter(function(o){return o.phase===r}))},[])}function lC(n){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(n())})})),e}}function cC(n){var e=n.reduce(function(t,r){var o=t[r.name];return t[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,t},{});return Object.keys(e).map(function(t){return e[t]})}var th={placement:"bottom",modifiers:[],strategy:"absolute"};function nh(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return!e.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function dC(n){n===void 0&&(n={});var e=n,t=e.defaultModifiers,r=t===void 0?[]:t,o=e.defaultOptions,i=o===void 0?th:o;return function(a,c,d){d===void 0&&(d=i);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},th,i),modifiersData:{},elements:{reference:a,popper:c},attributes:{},styles:{}},p=[],f=!1,h={state:u,setOptions:function(y){var E=typeof y=="function"?y(u.options):y;g(),u.options=Object.assign({},i,u.options,E),u.scrollParents={reference:Vr(a)?ci(a):a.contextElement?ci(a.contextElement):[],popper:ci(c)};var C=aC(cC([].concat(r,u.options.modifiers)));return u.orderedModifiers=C.filter(function(k){return k.enabled}),m(),h.update()},forceUpdate:function(){if(!f){var y=u.elements,E=y.reference,C=y.popper;if(nh(E,C)){u.rects={reference:iC(E,ai(C),u.options.strategy==="fixed"),popper:cc(C)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function($){return u.modifiersData[$.name]=Object.assign({},$.data)});for(var k=0;k<u.orderedModifiers.length;k++){if(u.reset===!0){u.reset=!1,k=-1;continue}var S=u.orderedModifiers[k],_=S.fn,D=S.options,B=D===void 0?{}:D,v=S.name;typeof _=="function"&&(u=_({state:u,options:B,name:v,instance:h})||u)}}}},update:lC(function(){return new Promise(function(b){h.forceUpdate(),b(u)})}),destroy:function(){g(),f=!0}};if(!nh(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,E=b.options,C=E===void 0?{}:E,k=b.effect;if(typeof k=="function"){var S=k({state:u,name:y,instance:h,options:C}),_=function(){};p.push(S||_)}})}function g(){p.forEach(function(b){return b()}),p=[]}return h}}var uC=[I0,Z0,R0,Vf,Y0,q0,tC,O0,G0],pC=dC({defaultModifiers:uC}),fC="tippy-box",rh="tippy-content",hC="tippy-backdrop",oh="tippy-arrow",ih="tippy-svg-arrow",Ur={passive:!0,capture:!0},sh=function(){return document.body};function mC(n,e){return{}.hasOwnProperty.call(n,e)}function mc(n,e,t){if(Array.isArray(n)){var r=n[e];return r??(Array.isArray(t)?t[e]:t)}return n}function gc(n,e){var t={}.toString.call(n);return t.indexOf("[object")===0&&t.indexOf(e+"]")>-1}function ah(n,e){return typeof n=="function"?n.apply(void 0,e):n}function lh(n,e){if(e===0)return n;var t;return function(r){clearTimeout(t),t=setTimeout(function(){n(r)},e)}}function gC(n,e){var t=Object.assign({},n);return e.forEach(function(r){delete t[r]}),t}function bC(n){return n.split(/\s+/).filter(Boolean)}function Co(n){return[].concat(n)}function ch(n,e){n.indexOf(e)===-1&&n.push(e)}function yC(n){return n.filter(function(e,t){return n.indexOf(e)===t})}function kC(n){return n.split("-")[0]}function xs(n){return[].slice.call(n)}function dh(n){return Object.keys(n).reduce(function(e,t){return n[t]!==void 0&&(e[t]=n[t]),e},{})}function ui(){return document.createElement("div")}function pi(n){return["Element","Fragment"].some(function(e){return gc(n,e)})}function EC(n){return gc(n,"NodeList")}function wC(n){return gc(n,"MouseEvent")}function CC(n){return!!(n&&n._tippy&&n._tippy.reference===n)}function _C(n){return pi(n)?[n]:EC(n)?xs(n):Array.isArray(n)?n:xs(document.querySelectorAll(n))}function bc(n,e){n.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function uh(n,e){n.forEach(function(t){t&&t.setAttribute("data-state",e)})}function SC(n){var e,t=Co(n),r=t[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function xC(n,e){var t=e.clientX,r=e.clientY;return n.every(function(o){var i=o.popperRect,s=o.popperState,a=o.props,c=a.interactiveBorder,d=kC(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-r+p>c,b=r-i.bottom-f>c,y=i.left-t+h>c,E=t-i.right-m>c;return g||b||y||E})}function yc(n,e,t){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(o){n[r](o,t)})}function ph(n,e){for(var t=e;t;){var r;if(n.contains(t))return!0;t=t.getRootNode==null||(r=t.getRootNode())==null?void 0:r.host}return!1}var Tn={isTouch:!1},fh=0;function NC(){Tn.isTouch||(Tn.isTouch=!0,window.performance&&document.addEventListener("mousemove",hh))}function hh(){var n=performance.now();n-fh<20&&(Tn.isTouch=!1,document.removeEventListener("mousemove",hh)),fh=n}function TC(){var n=document.activeElement;if(CC(n)){var e=n._tippy;n.blur&&!e.state.isVisible&&n.blur()}}function OC(){document.addEventListener("touchstart",NC,Ur),window.addEventListener("blur",TC)}var MC=typeof window<"u"&&typeof document<"u",AC=MC?!!window.msCrypto:!1;function _o(n){var e=n==="destroy"?"n already-":" ";return[n+"() was called on a"+e+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function mh(n){var e=/[ \t]{2,}/g,t=/^[ \t]*/gm;return n.replace(e," ").replace(t,"").trim()}function vC(n){return mh(`
93
+ %ctippy.js
94
+
95
+ %c`+mh(n)+`
96
+
97
+ %c👷‍ This is a development-only message. It will be removed in production.
98
+ `)}function gh(n){return[vC(n),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var fi;process.env.NODE_ENV!=="production"&&RC();function RC(){fi=new Set}function Kn(n,e){if(n&&!fi.has(e)){var t;fi.add(e),(t=console).warn.apply(t,gh(e))}}function kc(n,e){if(n&&!fi.has(e)){var t;fi.add(e),(t=console).error.apply(t,gh(e))}}function DC(n){var e=!n,t=Object.prototype.toString.call(n)==="[object Object]"&&!n.addEventListener;kc(e,["tippy() was passed","`"+String(n)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),kc(t,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}var bh={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},IC={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Kt=Object.assign({appendTo:sh,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},bh,IC),BC=Object.keys(Kt),LC=function(e){process.env.NODE_ENV!=="production"&&Eh(e,[]);var t=Object.keys(e);t.forEach(function(r){Kt[r]=e[r]})};function yh(n){var e=n.plugins||[],t=e.reduce(function(r,o){var i=o.name,s=o.defaultValue;if(i){var a;r[i]=n[i]!==void 0?n[i]:(a=Kt[i])!=null?a:s}return r},{});return Object.assign({},n,t)}function PC(n,e){var t=e?Object.keys(yh(Object.assign({},Kt,{plugins:e}))):BC,r=t.reduce(function(o,i){var s=(n.getAttribute("data-tippy-"+i)||"").trim();if(!s)return o;if(i==="content")o[i]=s;else try{o[i]=JSON.parse(s)}catch{o[i]=s}return o},{});return r}function kh(n,e){var t=Object.assign({},e,{content:ah(e.content,[n])},e.ignoreAttributes?{}:PC(n,e.plugins));return t.aria=Object.assign({},Kt.aria,t.aria),t.aria={expanded:t.aria.expanded==="auto"?e.interactive:t.aria.expanded,content:t.aria.content==="auto"?e.interactive?null:"describedby":t.aria.content},t}function Eh(n,e){n===void 0&&(n={}),e===void 0&&(e=[]);var t=Object.keys(n);t.forEach(function(r){var o=gC(Kt,Object.keys(bh)),i=!mC(o,r);i&&(i=e.filter(function(s){return s.name===r}).length===0),Kn(i,["`"+r+"`","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
+
100
+ `,`All props: https://atomiks.github.io/tippyjs/v6/all-props/
101
+ `,"Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))})}var $C=function(){return"innerHTML"};function Ec(n,e){n[$C()]=e}function wh(n){var e=ui();return n===!0?e.className=oh:(e.className=ih,pi(n)?e.appendChild(n):Ec(e,n)),e}function Ch(n,e){pi(e.content)?(Ec(n,""),n.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Ec(n,e.content):n.textContent=e.content)}function wc(n){var e=n.firstElementChild,t=xs(e.children);return{box:e,content:t.find(function(r){return r.classList.contains(rh)}),arrow:t.find(function(r){return r.classList.contains(oh)||r.classList.contains(ih)}),backdrop:t.find(function(r){return r.classList.contains(hC)})}}function _h(n){var e=ui(),t=ui();t.className=fC,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var r=ui();r.className=rh,r.setAttribute("data-state","hidden"),Ch(r,n.props),e.appendChild(t),t.appendChild(r),o(n.props,n.props);function o(i,s){var a=wc(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)&&Ch(d,n.props),s.arrow?u?i.arrow!==s.arrow&&(c.removeChild(u),c.appendChild(wh(s.arrow))):c.appendChild(wh(s.arrow)):u&&c.removeChild(u)}return{popper:e,onUpdate:o}}_h.$$tippy=!0;var FC=1,Ns=[],Cc=[];function zC(n,e){var t=kh(n,Object.assign({},Kt,yh(dh(e)))),r,o,i,s=!1,a=!1,c=!1,d=!1,u,p,f,h=[],m=lh(Xt,t.interactiveDebounce),g,b=FC++,y=null,E=yC(t.plugins),C={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},k={id:b,reference:n,popper:ui(),popperInstance:y,props:t,state:C,plugins:E,clearDelayTimeouts:Bt,setProps:L,setContent:V,show:pe,hide:Ce,hideWithInteractivity:nt,enable:et,disable:kn,unmount:Zt,destroy:vi};if(!t.render)return process.env.NODE_ENV!=="production"&&kc(!0,"render() function has not been supplied."),k;var S=t.render(k),_=S.popper,D=S.onUpdate;_.setAttribute("data-tippy-root",""),_.id="tippy-"+k.id,k.popper=_,n._tippy=k,_._tippy=k;var B=E.map(function(N){return N.fn(k)}),v=n.hasAttribute("aria-expanded");return pn(),j(),T(),A("onCreate",[k]),t.showOnCreate&&we(),_.addEventListener("mouseenter",function(){k.props.interactive&&k.state.isVisible&&k.clearDelayTimeouts()}),_.addEventListener("mouseleave",function(){k.props.interactive&&k.props.trigger.indexOf("mouseenter")>=0&&ce().addEventListener("mousemove",m)}),k;function $(){var N=k.props.touch;return Array.isArray(N)?N:[N,0]}function Y(){return $()[0]==="hold"}function te(){var N;return!!((N=k.props.render)!=null&&N.$$tippy)}function ue(){return g||n}function ce(){var N=ue().parentNode;return N?SC(N):document}function oe(){return wc(_)}function ie(N){return k.state.isMounted&&!k.state.isVisible||Tn.isTouch||u&&u.type==="focus"?0:mc(k.props.delay,N?0:1,Kt.delay)}function T(N){N===void 0&&(N=!1),_.style.pointerEvents=k.props.interactive&&!N?"":"none",_.style.zIndex=""+k.props.zIndex}function A(N,W,ne){if(ne===void 0&&(ne=!0),B.forEach(function(ye){ye[N]&&ye[N].apply(ye,W)}),ne){var xe;(xe=k.props)[N].apply(xe,W)}}function z(){var N=k.props.aria;if(N.content){var W="aria-"+N.content,ne=_.id,xe=Co(k.props.triggerTarget||n);xe.forEach(function(ye){var dt=ye.getAttribute(W);if(k.state.isVisible)ye.setAttribute(W,dt?dt+" "+ne:ne);else{var Lt=dt&&dt.replace(ne,"").trim();Lt?ye.setAttribute(W,Lt):ye.removeAttribute(W)}})}}function j(){if(!(v||!k.props.aria.expanded)){var N=Co(k.props.triggerTarget||n);N.forEach(function(W){k.props.interactive?W.setAttribute("aria-expanded",k.state.isVisible&&W===ue()?"true":"false"):W.removeAttribute("aria-expanded")})}}function ee(){ce().removeEventListener("mousemove",m),Ns=Ns.filter(function(N){return N!==m})}function he(N){if(!(Tn.isTouch&&(c||N.type==="mousedown"))){var W=N.composedPath&&N.composedPath()[0]||N.target;if(!(k.props.interactive&&ph(_,W))){if(Co(k.props.triggerTarget||n).some(function(ne){return ph(ne,W)})){if(Tn.isTouch||k.state.isVisible&&k.props.trigger.indexOf("click")>=0)return}else A("onClickOutside",[k,N]);k.props.hideOnClick===!0&&(k.clearDelayTimeouts(),k.hide(),a=!0,setTimeout(function(){a=!1}),k.state.isMounted||ze())}}}function Oe(){c=!0}function ct(){c=!1}function Me(){var N=ce();N.addEventListener("mousedown",he,!0),N.addEventListener("touchend",he,Ur),N.addEventListener("touchstart",ct,Ur),N.addEventListener("touchmove",Oe,Ur)}function ze(){var N=ce();N.removeEventListener("mousedown",he,!0),N.removeEventListener("touchend",he,Ur),N.removeEventListener("touchstart",ct,Ur),N.removeEventListener("touchmove",Oe,Ur)}function Yt(N,W){un(N,function(){!k.state.isVisible&&_.parentNode&&_.parentNode.contains(_)&&W()})}function bt(N,W){un(N,W)}function un(N,W){var ne=oe().box;function xe(ye){ye.target===ne&&(yc(ne,"remove",xe),W())}if(N===0)return W();yc(ne,"remove",p),yc(ne,"add",xe),p=xe}function yt(N,W,ne){ne===void 0&&(ne=!1);var xe=Co(k.props.triggerTarget||n);xe.forEach(function(ye){ye.addEventListener(N,W,ne),h.push({node:ye,eventType:N,handler:W,options:ne})})}function pn(){Y()&&(yt("touchstart",bn,{passive:!0}),yt("touchend",yn,{passive:!0})),bC(k.props.trigger).forEach(function(N){if(N!=="manual")switch(yt(N,bn),N){case"mouseenter":yt("mouseleave",yn);break;case"focus":yt(AC?"focusout":"blur",le);break;case"focusin":yt("focusout",le);break}})}function Bn(){h.forEach(function(N){var W=N.node,ne=N.eventType,xe=N.handler,ye=N.options;W.removeEventListener(ne,xe,ye)}),h=[]}function bn(N){var W,ne=!1;if(!(!k.state.isEnabled||Vt(N)||a)){var xe=((W=u)==null?void 0:W.type)==="focus";u=N,g=N.currentTarget,j(),!k.state.isVisible&&wC(N)&&Ns.forEach(function(ye){return ye(N)}),N.type==="click"&&(k.props.trigger.indexOf("mouseenter")<0||s)&&k.props.hideOnClick!==!1&&k.state.isVisible?ne=!0:we(N),N.type==="click"&&(s=!ne),ne&&!xe&&It(N)}}function Xt(N){var W=N.target,ne=ue().contains(W)||_.contains(W);if(!(N.type==="mousemove"&&ne)){var xe=Pe().concat(_).map(function(ye){var dt,Lt=ye._tippy,_r=(dt=Lt.popperInstance)==null?void 0:dt.state;return _r?{popperRect:ye.getBoundingClientRect(),popperState:_r,props:t}:null}).filter(Boolean);xC(xe,N)&&(ee(),It(N))}}function yn(N){var W=Vt(N)||k.props.trigger.indexOf("click")>=0&&s;if(!W){if(k.props.interactive){k.hideWithInteractivity(N);return}It(N)}}function le(N){k.props.trigger.indexOf("focusin")<0&&N.target!==ue()||k.props.interactive&&N.relatedTarget&&_.contains(N.relatedTarget)||It(N)}function Vt(N){return Tn.isTouch?Y()!==N.type.indexOf("touch")>=0:!1}function xt(){Z();var N=k.props,W=N.popperOptions,ne=N.placement,xe=N.offset,ye=N.getReferenceClientRect,dt=N.moveTransition,Lt=te()?wc(_).arrow:null,_r=ye?{getBoundingClientRect:ye,contextElement:ye.contextElement||ue()}:n,Ri={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(O){var P=O.state;if(te()){var se=oe(),Ke=se.box;["placement","reference-hidden","escaped"].forEach(function(Ve){Ve==="placement"?Ke.setAttribute("data-placement",P.placement):P.attributes.popper["data-popper-"+Ve]?Ke.setAttribute("data-"+Ve,""):Ke.removeAttribute("data-"+Ve)}),P.attributes.popper={}}}},Ht=[{name:"offset",options:{offset:xe}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!dt}},Ri];te()&&Lt&&Ht.push({name:"arrow",options:{element:Lt,padding:3}}),Ht.push.apply(Ht,(W==null?void 0:W.modifiers)||[]),k.popperInstance=pC(_r,_,Object.assign({},W,{placement:ne,onFirstUpdate:f,modifiers:Ht}))}function Z(){k.popperInstance&&(k.popperInstance.destroy(),k.popperInstance=null)}function Dt(){var N=k.props.appendTo,W,ne=ue();k.props.interactive&&N===sh||N==="parent"?W=ne.parentNode:W=ah(N,[ne]),W.contains(_)||W.appendChild(_),k.state.isMounted=!0,xt(),process.env.NODE_ENV!=="production"&&Kn(k.props.interactive&&N===Kt.appendTo&&ne.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
+
103
+ `,"Using a wrapper <div> or <span> tag around the reference element","solves this by creating a new parentNode context.",`
104
+
105
+ `,"Specifying `appendTo: document.body` silences this warning, but it","assumes you are using a focus management solution to handle","keyboard navigation.",`
106
+
107
+ `,"See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "))}function Pe(){return xs(_.querySelectorAll("[data-tippy-root]"))}function we(N){k.clearDelayTimeouts(),N&&A("onTrigger",[k,N]),Me();var W=ie(!0),ne=$(),xe=ne[0],ye=ne[1];Tn.isTouch&&xe==="hold"&&ye&&(W=ye),W?r=setTimeout(function(){k.show()},W):k.show()}function It(N){if(k.clearDelayTimeouts(),A("onUntrigger",[k,N]),!k.state.isVisible){ze();return}if(!(k.props.trigger.indexOf("mouseenter")>=0&&k.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(N.type)>=0&&s)){var W=ie(!1);W?o=setTimeout(function(){k.state.isVisible&&k.hide()},W):i=requestAnimationFrame(function(){k.hide()})}}function et(){k.state.isEnabled=!0}function kn(){k.hide(),k.state.isEnabled=!1}function Bt(){clearTimeout(r),clearTimeout(o),cancelAnimationFrame(i)}function L(N){if(process.env.NODE_ENV!=="production"&&Kn(k.state.isDestroyed,_o("setProps")),!k.state.isDestroyed){A("onBeforeUpdate",[k,N]),Bn();var W=k.props,ne=kh(n,Object.assign({},W,dh(N),{ignoreAttributes:!0}));k.props=ne,pn(),W.interactiveDebounce!==ne.interactiveDebounce&&(ee(),m=lh(Xt,ne.interactiveDebounce)),W.triggerTarget&&!ne.triggerTarget?Co(W.triggerTarget).forEach(function(xe){xe.removeAttribute("aria-expanded")}):ne.triggerTarget&&n.removeAttribute("aria-expanded"),j(),T(),D&&D(W,ne),k.popperInstance&&(xt(),Pe().forEach(function(xe){requestAnimationFrame(xe._tippy.popperInstance.forceUpdate)})),A("onAfterUpdate",[k,N])}}function V(N){k.setProps({content:N})}function pe(){process.env.NODE_ENV!=="production"&&Kn(k.state.isDestroyed,_o("show"));var N=k.state.isVisible,W=k.state.isDestroyed,ne=!k.state.isEnabled,xe=Tn.isTouch&&!k.props.touch,ye=mc(k.props.duration,0,Kt.duration);if(!(N||W||ne||xe)&&!ue().hasAttribute("disabled")&&(A("onShow",[k],!1),k.props.onShow(k)!==!1)){if(k.state.isVisible=!0,te()&&(_.style.visibility="visible"),T(),Me(),k.state.isMounted||(_.style.transition="none"),te()){var dt=oe(),Lt=dt.box,_r=dt.content;bc([Lt,_r],0)}f=function(){var Ht;if(!(!k.state.isVisible||d)){if(d=!0,_.offsetHeight,_.style.transition=k.props.moveTransition,te()&&k.props.animation){var w=oe(),O=w.box,P=w.content;bc([O,P],ye),uh([O,P],"visible")}z(),j(),ch(Cc,k),(Ht=k.popperInstance)==null||Ht.forceUpdate(),A("onMount",[k]),k.props.animation&&te()&&bt(ye,function(){k.state.isShown=!0,A("onShown",[k])})}},Dt()}}function Ce(){process.env.NODE_ENV!=="production"&&Kn(k.state.isDestroyed,_o("hide"));var N=!k.state.isVisible,W=k.state.isDestroyed,ne=!k.state.isEnabled,xe=mc(k.props.duration,1,Kt.duration);if(!(N||W||ne)&&(A("onHide",[k],!1),k.props.onHide(k)!==!1)){if(k.state.isVisible=!1,k.state.isShown=!1,d=!1,s=!1,te()&&(_.style.visibility="hidden"),ee(),ze(),T(!0),te()){var ye=oe(),dt=ye.box,Lt=ye.content;k.props.animation&&(bc([dt,Lt],xe),uh([dt,Lt],"hidden"))}z(),j(),k.props.animation?te()&&Yt(xe,k.unmount):k.unmount()}}function nt(N){process.env.NODE_ENV!=="production"&&Kn(k.state.isDestroyed,_o("hideWithInteractivity")),ce().addEventListener("mousemove",m),ch(Ns,m),m(N)}function Zt(){process.env.NODE_ENV!=="production"&&Kn(k.state.isDestroyed,_o("unmount")),k.state.isVisible&&k.hide(),k.state.isMounted&&(Z(),Pe().forEach(function(N){N._tippy.unmount()}),_.parentNode&&_.parentNode.removeChild(_),Cc=Cc.filter(function(N){return N!==k}),k.state.isMounted=!1,A("onHidden",[k]))}function vi(){process.env.NODE_ENV!=="production"&&Kn(k.state.isDestroyed,_o("destroy")),!k.state.isDestroyed&&(k.clearDelayTimeouts(),k.unmount(),Bn(),delete n._tippy,k.state.isDestroyed=!0,A("onDestroy",[k]))}}function On(n,e){e===void 0&&(e={});var t=Kt.plugins.concat(e.plugins||[]);process.env.NODE_ENV!=="production"&&(DC(n),Eh(e,t)),OC();var r=Object.assign({},e,{plugins:t}),o=_C(n);if(process.env.NODE_ENV!=="production"){var i=pi(r.content),s=o.length>1;Kn(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
+
109
+ `,"Instead, pass the .innerHTML of the element, or use a function that","returns a cloned version of the element instead.",`
110
+
111
+ `,`1) content: element.innerHTML
112
+ `,"2) content: () => element.cloneNode(true)"].join(" "))}var a=o.reduce(function(c,d){var u=d&&zC(d,r);return u&&c.push(u),c},[]);return pi(n)?a[0]:a}On.defaultProps=Kt,On.setDefaultProps=LC,On.currentInput=Tn,Object.assign({},Vf,{effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow)}}),On.setDefaultProps({render:_h});class VC{constructor({editor:e,element:t,view:r,tippyOptions:o={},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&&ms(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:E}=b,C=Math.min(...E.map(_=>_.$from.pos)),k=Math.max(...E.map(_=>_.$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:C,to:k}))){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(Bf(m.selection)){let _=a.nodeDOM(C);if(_){const D=_.dataset.nodeViewWrapper?_:_.querySelector("[data-node-view-wrapper]");if(D&&(_=D.firstChild),_)return _.getBoundingClientRect()}}return Lf(a,C,k)})}),this.show()},this.editor=e,this.element=t,this.view=r,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=o,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,t=!!e.parentElement;this.tippy||!t||(this.tippy=On(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,t){const{state:r}=e,o=r.selection.from!==r.selection.to;if(this.updateDelay>0&&o){this.handleDebouncedUpdate(e,t);return}const i=!(t!=null&&t.selection.eq(e.state.selection)),s=!(t!=null&&t.doc.eq(e.state.doc));this.updateHandler(e,i,s,t)}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,t;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(t=this.tippy)===null||t===void 0||t.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 Sh=n=>new Ne({key:typeof n.pluginKey=="string"?new Fe(n.pluginKey):n.pluginKey,view:e=>new VC({view:e,...n})});Ae.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Sh({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});class HC{getTextContent(e){return Rf(e,{textSerializers:Jl(this.editor.schema)})}constructor({editor:e,element:t,view:r,tippyOptions:o={},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=t,this.view=r,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=o,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,t=!!e.parentElement;this.tippy||!t||(this.tippy=On(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,t){var r,o,i;const{state:s}=e,{doc:a,selection:c}=s,{from:d,to:u}=c;if(t&&t.doc.eq(a)&&t.selection.eq(c))return;if(this.createTooltip(),!((r=this.shouldShow)===null||r===void 0?void 0:r.call(this,{editor:this.editor,view:e,state:s,oldState:t}))){this.hide();return}(o=this.tippy)===null||o===void 0||o.setProps({getReferenceClientRect:((i=this.tippyOptions)===null||i===void 0?void 0:i.getReferenceClientRect)||(()=>Lf(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,t;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(t=this.tippy)===null||t===void 0||t.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const xh=n=>new Ne({key:typeof n.pluginKey=="string"?new Fe(n.pluginKey):n.pluginKey,view:e=>new HC({view:e,...n})});Ae.create({name:"floatingMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"floatingMenu",shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[xh({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}});const UC=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(n,{slots:e}){const t=l.ref(null);return l.onMounted(()=>{const{updateDelay:r,editor:o,pluginKey:i,shouldShow:s,tippyOptions:a}=n;o.registerPlugin(Sh({updateDelay:r,editor:o,element:t.value,pluginKey:i,shouldShow:s,tippyOptions:a}))}),l.onBeforeUnmount(()=>{const{pluginKey:r,editor:o}=n;o.unregisterPlugin(r)}),()=>{var r;return l.h("div",{ref:t},(r=e.default)===null||r===void 0?void 0:r.call(e))}}});function Nh(n){return l.customRef((e,t)=>({get(){return e(),n},set(r){n=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}class WC extends Sn{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=Nh(this.view.state),this.reactiveExtensionStorage=Nh(this.extensionStorage),this.on("beforeTransaction",({nextState:t})=>{this.reactiveState.value=t,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,t){const r=super.registerPlugin(e,t);return this.reactiveState&&(this.reactiveState.value=r),r}unregisterPlugin(e){const t=super.unregisterPlugin(e);return this.reactiveState&&t&&(this.reactiveState.value=t),t}}const qC=l.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(n){const e=l.ref(),t=l.getCurrentInstance();return l.watchEffect(()=>{const r=n.editor;r&&r.options.element&&e.value&&l.nextTick(()=>{if(!e.value||!r.options.element.firstChild)return;const o=l.unref(e.value);e.value.append(...r.options.element.childNodes),r.contentComponent=t.ctx._,t&&(r.appContext={...t.appContext,provides:t.provides}),r.setOptions({element:o}),r.createNodeViews()})}),l.onBeforeUnmount(()=>{const r=n.editor;r&&(r.contentComponent=null,r.appContext=null)}),{rootEl:e}},render(){return l.h("div",{ref:n=>{this.rootEl=n}})}}),KC=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(n,{slots:e}){const t=l.ref(null);return l.onMounted(()=>{const{pluginKey:r,editor:o,tippyOptions:i,shouldShow:s}=n;o.registerPlugin(xh({pluginKey:r,editor:o,element:t.value,tippyOptions:i,shouldShow:s}))}),l.onBeforeUnmount(()=>{const{pluginKey:r,editor:o}=n;o.unregisterPlugin(r)}),()=>{var r;return l.h("div",{ref:t},(r=e.default)===null||r===void 0?void 0:r.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":""})}}),_c=l.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var n,e;return l.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(n=this.$slots).default)===null||e===void 0?void 0:e.call(n))}}),GC=(n={})=>{const e=l.shallowRef();return l.onMounted(()=>{e.value=new WC(n)}),l.onBeforeUnmount(()=>{var t,r,o;const i=(t=e.value)===null||t===void 0?void 0:t.options.element,s=i==null?void 0:i.cloneNode(!0);(r=i==null?void 0:i.parentNode)===null||r===void 0||r.replaceChild(s,i),(o=e.value)===null||o===void 0||o.destroy()}),e};class Th{constructor(e,{props:t={},editor:r}){this.editor=r,this.component=l.markRaw(e),this.el=document.createElement("div"),this.props=l.reactive(t),this.renderedComponent=this.renderComponent()}get element(){return this.renderedComponent.el}get ref(){var e,t,r,o;return!((t=(e=this.renderedComponent.vNode)===null||e===void 0?void 0:e.component)===null||t===void 0)&&t.exposed?this.renderedComponent.vNode.component.exposed:(o=(r=this.renderedComponent.vNode)===null||r===void 0?void 0:r.component)===null||o===void 0?void 0:o.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(([t,r])=>{this.props[t]=r}),this.renderComponent()}destroy(){this.renderedComponent.destroy()}}const st={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 jC extends s0{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:(o={})=>this.updateAttributes(o),deleteNode:()=>this.deleteNode()},t=this.onDragStart.bind(this);this.decorationClasses=l.ref(this.getDecorationClasses());const r=l.defineComponent({extends:{...this.component},props:Object.keys(e),template:this.component.template,setup:o=>{var i,s;return l.provide("onDragStart",t),l.provide("decorationClasses",this.decorationClasses),(s=(i=this.component).setup)===null||s===void 0?void 0:s.call(i,o,{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 Th(r,{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:t}=this.editor.state.selection,r=this.getPos();if(typeof r=="number")if(e<=r&&t>=r+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(e,t,r){const o=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=t,this.innerDecorations=r,this.options.update({oldNode:i,oldDecorations:s,newNode:e,newDecorations:t,oldInnerDecorations:a,innerDecorations:r,updateProps:()=>o({node:e,decorations:t,innerDecorations:r})})}return e.type!==this.node.type?!1:(e===this.node&&this.decorations===t&&this.innerDecorations===r||(this.node=e,this.decorations=t,this.innerDecorations=r,o({node:e,decorations:t,innerDecorations:r})),!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 hn(n,e){return t=>{if(!t.editor.contentComponent)return{};const r=typeof n=="function"&&"__vccOpts"in n?n.__vccOpts:n;return new jC(r,t,e)}}const JC=/^\s*>\s$/,Oh=Ge.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return["blockquote",Se(this.options.HTMLAttributes,n),0]},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[bo({find:JC,type:this.type})]}}),YC=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,XC=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,ZC=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,QC=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,e_=rn.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return["strong",Se(this.options.HTMLAttributes,n),0]},addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[zr({find:YC,type:this.type}),zr({find:ZC,type:this.type})]},addPasteRules(){return[hr({find:XC,type:this.type}),hr({find:QC,type:this.type})]}}),t_="listItem",Mh="textStyle",Ah=/^\s*([-+*])\s$/,n_=Ge.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",Se(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(t_,this.editor.getAttributes(Mh)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=bo({find:Ah,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=bo({find:Ah,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Mh),editor:this.editor})),[n]}}),r_=/(^|[^`])`([^`]+)`(?!`)/,o_=/(^|[^`])`([^`]+)`(?!`)/g,i_=rn.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",Se(this.options.HTMLAttributes,n),0]},addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[zr({find:r_,type:this.type})]},addPasteRules(){return[hr({find:o_,type:this.type})]}}),s_=/^```([a-z]+)?[\s\n]$/,a_=/^~~~([a-z]+)?[\s\n]$/,vh=Ge.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:n=>{var e;const{languageClassPrefix:t}=this.options,i=[...((e=n.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(s=>s.startsWith(t)).map(s=>s.replace(t,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",Se(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:o}=t;if(!o||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith(`
113
+
114
+ `);return!i||!s?!1:n.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:r}=e,{$from:o,empty:i}=t;if(!i||o.parent.type!==this.type||!(o.parentOffset===o.parent.nodeSize-2))return!1;const a=o.after();return a===void 0?!1:r.nodeAt(a)?n.commands.command(({tr:d})=>(d.setSelection(Q.near(r.resolve(a))),!0)):n.commands.exitCode()}}},addInputRules(){return[ic({find:s_,type:this.type,getAttributes:n=>({language:n[1]})}),ic({find:a_,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new Ne({key:new Fe("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,i=o==null?void 0:o.mode;if(!t||!i)return!1;const{tr:s,schema:a}=n.state,c=a.text(t.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),n.dispatch(s),!0}}})]}}),l_=Ge.create({name:"doc",topNode:!0,content:"block+"});function c_(n={}){return new Ne({view(e){return new d_(e,n)}})}class d_{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=s=>{this[o](s)};return e.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r;if(t){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),r={left:u.left,right:u.right,top:p-this.width/2,bottom:p+this.width/2}}}}if(!r){let a=this.editorView.coordsAtPos(this.cursorPos);r={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}let o=this.editorView.dom.offsetParent;this.element||(this.element=o.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let i,s;if(!o||o==document.body&&getComputedStyle(o).position=="static")i=-pageXOffset,s=-pageYOffset;else{let a=o.getBoundingClientRect();i=a.left-o.scrollLeft,s=a.top-o.scrollTop}this.element.style.left=r.left-i+"px",this.element.style.top=r.top-s+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,t,e):o;if(t&&!i){let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=zb(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 u_=Ae.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[c_(this.options)]}});class Ye extends Q{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return Ye.valid(r)?new Ye(r):Q.near(r)}content(){return M.empty}eq(e){return e instanceof Ye&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Ye(e.resolve(t.pos))}getBookmark(){return new Sc(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!p_(e)||!f_(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let o=t.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&Ye.valid(e))return e;let o=e.pos,i=null;for(let s=e.depth;;s--){let a=e.node(s);if(t>0?e.indexAfter(s)<a.childCount:e.index(s)>0){i=a.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;o+=t;let c=e.doc.resolve(o);if(Ye.valid(c))return c}for(;;){let s=t>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!K.isSelectable(i)){e=e.doc.resolve(o+i.nodeSize*t),r=!1;continue e}break}i=s,o+=t;let a=e.doc.resolve(o);if(Ye.valid(a))return a}return null}}}Ye.prototype.visible=!1,Ye.findFrom=Ye.findGapCursorFrom,Q.jsonID("gapcursor",Ye);class Sc{constructor(e){this.pos=e}map(e){return new Sc(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Ye.valid(t)?new Ye(t):Q.near(t)}}function p_(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(t-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function f_(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(t);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function h_(){return new Ne({props:{decorations:y_,createSelectionBetween(n,e,t){return e.pos==t.pos&&Ye.valid(t)?new Ye(t):null},handleClick:g_,handleKeyDown:m_,handleDOMEvents:{beforeinput:b_}}})}const m_=Fl({ArrowLeft:Ts("horiz",-1),ArrowRight:Ts("horiz",1),ArrowUp:Ts("vert",-1),ArrowDown:Ts("vert",1)});function Ts(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,i){let s=r.selection,a=e>0?s.$to:s.$from,c=s.empty;if(s instanceof J){if(!i.endOfTextblock(t)||a.depth==0)return!1;c=!1,a=r.doc.resolve(e>0?a.after():a.before())}let d=Ye.findGapCursorFrom(a,e,c);return d?(o&&o(r.tr.setSelection(new Ye(d))),!0):!1}}function g_(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!Ye.valid(r))return!1;let o=n.posAtCoords({left:t.clientX,top:t.clientY});return o&&o.inside>-1&&K.isSelectable(n.state.doc.nodeAt(o.inside))?!1:(n.dispatch(n.state.tr.setSelection(new Ye(r))),!0)}function b_(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof Ye))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let o=x.empty;for(let s=r.length-1;s>=0;s--)o=x.from(r[s].createAndFill(null,o));let i=n.state.tr.replace(t.pos,t.pos,new M(o,0,0));return i.setSelection(J.near(i.doc.resolve(t.pos+1))),n.dispatch(i),!1}function y_(n){if(!(n.selection instanceof Ye))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Te.create(n.doc,[Qe.widget(n.selection.head,e,{key:"gapcursor"})])}const k_=Ae.create({name:"gapCursor",addProseMirrorPlugins(){return[h_()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=me(U(n,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}}),E_=Ge.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",Se(this.options.HTMLAttributes,n)]},renderText(){return`
116
+ `},addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:o,storedMarks:i}=t;if(o.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:a}=r.extensionManager,c=i||o.$to.parentOffset&&o.$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()}}}),Rh=Ge.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,Se(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>ic({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}});var Os=200,at=function(){};at.prototype.append=function(e){return e.length?(e=at.from(e),!this.length&&e||e.length<Os&&this.leafAppend(e)||this.length<Os&&e.leafPrepend(this)||this.appendInner(e)):this},at.prototype.prepend=function(e){return e.length?at.from(e).append(this):this},at.prototype.appendInner=function(e){return new w_(this,e)},at.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?at.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},at.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},at.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)},at.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(e(i,s))},t,r),o},at.from=function(e){return e instanceof at?e:e&&e.length?new Dh(e):at.empty};var Dh=function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,s,a){for(var c=i;c<s;c++)if(o(this.values[c],a+c)===!1)return!1},e.prototype.forEachInvertedInner=function(o,i,s,a){for(var c=i-1;c>=s;c--)if(o(this.values[c],a+c)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=Os)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=Os)return new e(o.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(at);at.empty=new Dh([]);var w_=function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,o,i,s){var a=this.left.length;if(o<a&&this.left.forEachInner(r,o,Math.min(i,a),s)===!1||i>a&&this.right.forEachInner(r,Math.max(o-a,0),Math.min(this.length,i)-a,s+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,i,s){var a=this.left.length;if(o>a&&this.right.forEachInvertedInner(r,o-a,Math.max(i,a)-a,s+a)===!1||i<a&&this.left.forEachInvertedInner(r,Math.min(o,a),i,s)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(r,o):r>=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(at);const C_=500;class mn{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;t&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=e.tr,a,c,d=[],u=[];return this.items.forEach((p,f)=>{if(!p.step){o||(o=this.remapping(r,f+1),i=o.maps.length),i--,u.push(p);return}if(o){u.push(new Mn(p.map));let h=p.step.map(o.slice(i)),m;h&&s.maybeStep(h).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],d.push(new Mn(m,void 0,void 0,d.length+u.length))),i--,m&&o.appendMap(m,i)}else s.maybeStep(p.step);if(p.selection)return a=o?p.selection.map(o.slice(i)):p.selection,c=new mn(this.items.slice(0,r).append(u.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:s,selection:a}}addTransform(e,t,r,o){let i=[],s=this.eventCount,a=this.items,c=!o&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let p=e.steps[u].invert(e.docs[u]),f=new Mn(e.mapping.maps[u],p,t),h;(h=c&&c.merge(f))&&(f=h,u?i.pop():a=a.slice(0,a.length-1)),i.push(f),t&&(s++,t=void 0),o||(c=f)}let d=s-r.depth;return d>S_&&(a=__(a,d),s-=d),new mn(a.append(i),s)}remapping(e,t){let r=new ro;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},e,t),r}addMaps(e){return this.eventCount==0?this:new mn(this.items.append(e.map(t=>new Mn(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-t),i=e.mapping,s=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},o);let c=t;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++,r.push(new Mn(m,g,b))}else r.push(new Mn(m))},o);let d=[];for(let f=t;f<s;f++)d.push(new Mn(i.maps[f]));let u=this.items.slice(0,o).append(d).append(r),p=new mn(u,a);return p.emptyItemCount()>C_&&(p=p.compress(this.items.length-r.length)),p}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,o=[],i=0;return this.items.forEach((s,a)=>{if(a>=e)o.push(s),s.selection&&i++;else if(s.step){let c=s.step.map(t.slice(r)),d=c&&c.getMap();if(r--,d&&t.appendMap(d,r),c){let u=s.selection&&s.selection.map(t.slice(r));u&&i++;let p=new Mn(d.invert(),c,u),f,h=o.length-1;(f=o.length&&o[h].merge(p))?o[h]=f:o.push(p)}}else s.map&&r--},this.items.length,0),new mn(at.from(o.reverse()),i)}}mn.empty=new mn(at.empty,0);function __(n,e){let t;return n.forEach((r,o)=>{if(r.selection&&e--==0)return t=o,!1}),n.slice(t)}class Mn{constructor(e,t,r,o){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Mn(t.getMap().invert(),t,this.selection)}}}class gr{constructor(e,t,r,o,i){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}}const S_=20;function x_(n,e,t,r){let o=t.getMeta(Wr),i;if(o)return o.historyState;t.getMeta(O_)&&(n=new gr(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(Wr))return s.getMeta(Wr).redo?new gr(n.done.addTransform(t,void 0,r,Ms(e)),n.undone,Ih(t.mapping.maps),n.prevTime,n.prevComposition):new gr(n.done,n.undone.addTransform(t,void 0,r,Ms(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=t.getMeta("composition"),c=n.prevTime==0||!s&&n.prevComposition!=a&&(n.prevTime<(t.time||0)-r.newGroupDelay||!N_(t,n.prevRanges)),d=s?xc(n.prevRanges,t.mapping):Ih(t.mapping.maps);return new gr(n.done.addTransform(t,c?e.selection.getBookmark():void 0,r,Ms(e)),mn.empty,d,t.time,a??n.prevComposition)}else return(i=t.getMeta("rebased"))?new gr(n.done.rebased(t,i),n.undone.rebased(t,i),xc(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new gr(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),xc(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function N_(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&o>=e[i]&&(t=!0)}),t}function Ih(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,o,i,s)=>e.push(i,s));return e}function xc(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let o=e.map(n[r],1),i=e.map(n[r+1],-1);o<=i&&t.push(o,i)}return t}function T_(n,e,t){let r=Ms(e),o=Wr.get(e).spec.config,i=(t?n.undone:n.done).popEvent(e,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),a=(t?n.done:n.undone).addTransform(i.transform,e.selection.getBookmark(),o,r),c=new gr(t?a:i.remaining,t?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(Wr,{redo:t,historyState:c})}let Nc=!1,Bh=null;function Ms(n){let e=n.plugins;if(Bh!=e){Nc=!1,Bh=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Nc=!0;break}}return Nc}const Wr=new Fe("history"),O_=new Fe("closeHistory");function M_(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Ne({key:Wr,state:{init(){return new gr(mn.empty,mn.empty,null,0,-1)},apply(e,t,r){return x_(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,o=r=="historyUndo"?Ph:r=="historyRedo"?$h:null;return o?(t.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function Lh(n,e){return(t,r)=>{let o=Wr.getState(t);if(!o||(n?o.undone:o.done).eventCount==0)return!1;if(r){let i=T_(o,t,n);i&&r(e?i.scrollIntoView():i)}return!0}}const Ph=Lh(!1,!0),$h=Lh(!0,!0),A_=Ae.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Ph(n,e),redo:()=>({state:n,dispatch:e})=>$h(n,e)}},addProseMirrorPlugins(){return[M_(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()}}}),Fh=Ge.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",Se(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{const{selection:t}=e,{$from:r,$to:o}=t,i=n();return r.parentOffset===0?i.insertContentAt({from:Math.max(r.pos-1,0),to:o.pos},{type:this.name}):Bf(t)?i.insertContentAt(o.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(K.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[oc({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),v_=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,R_=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,D_=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,I_=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,B_=rn.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",Se(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[zr({find:v_,type:this.type}),zr({find:D_,type:this.type})]},addPasteRules(){return[hr({find:R_,type:this.type}),hr({find:I_,type:this.type})]}}),L_=Ge.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",Se(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),P_="listItem",zh="textStyle",Vh=/^(\d+)\.\s$/,$_=Ge.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",Se(this.options.HTMLAttributes,t),0]:["ol",Se(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(P_,this.editor.getAttributes(zh)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=bo({find:Vh,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=bo({find:Vh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(zh)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),Hh=Ge.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",Se(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),F_=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,z_=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,V_=rn.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",Se(this.options.HTMLAttributes,n),0]},addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[zr({find:F_,type:this.type})]},addPasteRules(){return[hr({find:z_,type:this.type})]}}),H_=Ge.create({name:"text",group:"inline"}),U_=Ae.create({name:"starterKit",addExtensions(){var n,e,t,r,o,i,s,a,c,d,u,p,f,h,m,g,b,y;const E=[];return this.options.bold!==!1&&E.push(e_.configure((n=this.options)===null||n===void 0?void 0:n.bold)),this.options.blockquote!==!1&&E.push(Oh.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bulletList!==!1&&E.push(n_.configure((t=this.options)===null||t===void 0?void 0:t.bulletList)),this.options.code!==!1&&E.push(i_.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&E.push(vh.configure((o=this.options)===null||o===void 0?void 0:o.codeBlock)),this.options.document!==!1&&E.push(l_.configure((i=this.options)===null||i===void 0?void 0:i.document)),this.options.dropcursor!==!1&&E.push(u_.configure((s=this.options)===null||s===void 0?void 0:s.dropcursor)),this.options.gapcursor!==!1&&E.push(k_.configure((a=this.options)===null||a===void 0?void 0:a.gapcursor)),this.options.hardBreak!==!1&&E.push(E_.configure((c=this.options)===null||c===void 0?void 0:c.hardBreak)),this.options.heading!==!1&&E.push(Rh.configure((d=this.options)===null||d===void 0?void 0:d.heading)),this.options.history!==!1&&E.push(A_.configure((u=this.options)===null||u===void 0?void 0:u.history)),this.options.horizontalRule!==!1&&E.push(Fh.configure((p=this.options)===null||p===void 0?void 0:p.horizontalRule)),this.options.italic!==!1&&E.push(B_.configure((f=this.options)===null||f===void 0?void 0:f.italic)),this.options.listItem!==!1&&E.push(L_.configure((h=this.options)===null||h===void 0?void 0:h.listItem)),this.options.orderedList!==!1&&E.push($_.configure((m=this.options)===null||m===void 0?void 0:m.orderedList)),this.options.paragraph!==!1&&E.push(Hh.configure((g=this.options)===null||g===void 0?void 0:g.paragraph)),this.options.strike!==!1&&E.push(V_.configure((b=this.options)===null||b===void 0?void 0:b.strike)),this.options.text!==!1&&E.push(H_.configure((y=this.options)===null||y===void 0?void 0:y.text)),E}}),W_=n=>{if(!n.children.length)return;const e=n.querySelectorAll("span");e&&e.forEach(t=>{var r,o;const i=t.getAttribute("style"),s=(o=(r=t.parentElement)===null||r===void 0?void 0:r.closest("span"))===null||o===void 0?void 0:o.getAttribute("style");t.setAttribute("style",`${s};${i}`)})},q_=rn.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&W_(n),{}):!1}]},renderHTML({HTMLAttributes:n}){return["span",Se(this.options.HTMLAttributes,n),0]},addCommands(){return{removeEmptyTextStyle:()=>({tr:n})=>{const{selection:e}=n;return n.doc.nodesBetween(e.from,e.to,(t,r)=>{if(t.isTextblock)return!0;t.marks.filter(o=>o.type===this.type).some(o=>Object.values(o.attrs).some(i=>!!i))||n.removeMark(r,r+t.nodeSize,this.type)}),!0}}}}),re=l.defineComponent({__name:"OIcon",props:{name:{type:String,default:""},color:{type:String,default:""},small:{type:Boolean,default:!1}},setup(n){return(e,t)=>(l.openBlock(),l.createElementBlock("span",{class:l.normalizeClass(["o-icon",{small:n.small}]),style:l.normalizeStyle({color:n.color})},[l.createElementVNode("i",{class:l.normalizeClass(["yiitip-icon",`icon-${n.name}`])},null,2)],6))}}),Uh={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",removeColumn:"Remove Column",addRow:"Add Row",removeRow:"Remove Row",merge:"Merge/Unmerge 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"}},K_={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"}},G_={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"}},Wh={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:"添加列",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:"在新标签页打开"}},qh={en:Uh,"en-us":Uh,pl:K_,"pt-br":G_,zh:Wh,"zh-hans":Wh,"zh-hant":{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:"在新標籤頁打開"}}},j_=qh["en"],J_=n=>qh[n]||j_;function Ee(){const n=l.inject("locale",{value:"en"}),e=l.computed(()=>J_(n.value));function t(r){return r.split(".").reduce((o,i)=>{if(o)return o[i]},e.value)}return{locale:n,message:e,tr:t}}function hi(){const n=l.inject("darkMode",{value:!1}),e=l.computed(()=>n.value?"dark":"light");return{darkMode:n,theme:e}}function Ie(){function n(t,r,o={}){const i=t==null?void 0:t.chain().focus(),s=t==null?void 0:t.commands;e(s,i,r,o)}function e(t,r,o,i={}){switch(console.log("command",o,i),o){case"backColor":i.color?t.setHighlight({color:i.color}):t.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":t.toggleCodeBlock({language:"bash"});break;case"content":t.insertContent(i.content);break;case"fontFamily":t.setFontFamily(i.fontFamily);break;case"foreColor":t.setColor(i.color);break;case"heading":r.toggleHeading(i).run();break;case"horizontalRule":r.setHorizontalRule().run();break;case"image":r.setImage({src:"init"}).run();break;case"imageUpdate":r.setImage(i).run();break;case"italic":r.toggleItalic().run();break;case"linkSet":r.extendMarkRange("link").setLink(i).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(i.name,i.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(i).run();break;case"tableMergeCells":r.mergeCells().run();break;case"tableSelectColumn":r.selectColumn(i.pos).run();break;case"tableSelectRow":r.selectRow(i.pos).run();break;case"tableSplitCell":r.splitCell().run();break;case"taskList":t.toggleTaskList();break;case"textAlign":r.setTextAlign(i.textAlign).run();break;case"underline":r.toggleUnderline().run();break;case"video":r.setVideo({src:"init"}).run()}}return{run:n,onCommand:e}}const br=l.defineComponent({__name:"OTooltip",props:{placement:{type:String,default:"top"},trigger:{type:String,default:"mouseenter focus"}},setup(n){const e=n,{theme:t}=hi(),r=l.ref(),o=l.ref(),i=l.ref();function s(){i.value=On(r.value,{appendTo:()=>document.body,animation:"perspective",content:o.value,duration:100,interactive:!0,placement:e.placement,trigger:e.trigger})}function a(){i.value.setProps({theme:t.value})}return l.watch(t,c=>{a()}),l.onMounted(()=>{s()}),(c,d)=>(l.openBlock(),l.createElementBlock("div",{ref_key:"triggerRef",ref:r,"data-tippy-role":"tooltip"},[l.renderSlot(c.$slots,"trigger"),l.createElementVNode("div",{ref_key:"contentRef",ref:o,class:"tooltip-content"},[l.renderSlot(c.$slots,"default")],512)],512))}}),ve=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(n,{emit:e}){const t=e;return(r,o)=>(l.openBlock(),l.createBlock(br,{class:"o-tooltip",placement:n.placement},{trigger:l.withCtx(()=>[l.createElementVNode("button",{class:l.normalizeClass(["o-menubar-btn o-command-btn o-btn",n.contentClass]),style:l.normalizeStyle(n.contentStyle),onClick:o[0]||(o[0]=i=>t("click",i))},[l.createVNode(re,{name:n.icon,color:n.color,class:l.normalizeClass(n.iconClass)},null,8,["name","color","class"])],6)]),default:l.withCtx(()=>[l.createTextVNode(" "+l.toDisplayString(n.tooltip),1)]),_:1},8,["placement"]))}}),Y_=l.defineComponent({__name:"OSimpleCommandBtn",props:{name:{type:String,default:""},editor:{type:Object}},setup(n){const e=n,{run:t}=Ie(),{tr:r}=Ee(),o=l.computed(()=>({aiViewer:{icon:"auto_awesome",tooltip:r("label.ai")},blockquote:{icon:"format_quote_open",tooltip:r("editor.blockquote")},bold:{icon:"format_bold",tooltip:r("editor.bold")},callout:{icon:"card_text",tooltip:r("editor.callout")},clearFormat:{icon:"format_clear",tooltip:r("editor.removeFormat")},code:{icon:"code",tooltip:r("editor.code")},codeBlock:{icon:"code_braces",tooltip:r("editor.codeBlock")},columns:{icon:"splitscreen_vertical_add",tooltip:"Column",rotate:!0},horizontalRule:{icon:"horizontal_rule",tooltip:r("editor.hr")},italic:{icon:"format_italic",tooltip:r("editor.italic")},image:{icon:"image",tooltip:r("editor.photo")},linkUnset:{icon:"link_off",tooltip:r("link.off")},modelViewer:{icon:"3d_rotation",tooltip:r("label.modelViewer")},strike:{icon:"format_strikethrough",tooltip:r("editor.strikethrough")},underline:{icon:"format_underlined",tooltip:r("editor.underline")},video:{icon:"videocam",tooltip:r("editor.video")}})),i=l.computed(()=>o.value[e.name]||{icon:"",isActive:!1,command:()=>{}});function s(){t(e.editor,e.name)}return(a,c)=>{var d;return l.openBlock(),l.createBlock(ve,{class:"o-simple-command-btn",icon:i.value.icon,tooltip:i.value.tooltip,"content-class":{"is-active":(d=n.editor)==null?void 0:d.isActive(n.name),"rotate-90":i.value.rotate},onClick:s},null,8,["icon","tooltip","content-class"])}}}),X_={class:"o-block-placeholder"},Z_={class:"icon"},Q_={class:"placeholder"},Tc=l.defineComponent({__name:"OBlockPlaceholder",props:{icon:{type:String,default:"image"},placeholder:{type:String,default:""}},setup(n){return(e,t)=>(l.openBlock(),l.createElementBlock("section",X_,[l.createElementVNode("div",Z_,[l.createVNode(l.unref(re),{name:n.icon},null,8,["name"])]),l.createElementVNode("div",Q_,l.toDisplayString(n.placeholder),1)]))}}),_e={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"},mi=[{label:"editor.paragraph",value:"paragraph",icon:"title",color:"",style:!0,group:"label.basic"},{label:"editor.heading1",value:"heading",icon:"format_h1",color:_e.blue,style:!0,options:{level:1}},{label:"editor.heading2",value:"heading",icon:"format_h2",color:_e.blue,style:!0,options:{level:2}},{label:"editor.heading3",value:"heading",icon:"format_h3",color:_e.blue,style:!0,options:{level:3}},{label:"editor.todoList",value:"taskList",icon:"check_box",color:_e.indigo,style:!0},{label:"editor.unorderedList",value:"bulletList",icon:"format_list_bulleted",color:_e.indigo,style:!0},{label:"editor.orderedList",value:"orderedList",icon:"format_list_numbered",color:_e.indigo,style:!0},{label:"editor.blockquote",value:"blockquote",icon:"format_quote_open",color:_e.brown,style:!0},{label:"editor.codeBlock",value:"codeBlock",icon:"code_braces",color:_e.lightBlue,style:!0},{label:"editor.horizontal",value:"horizontalRule",icon:"horizontal_rule",color:_e.blue},{label:"editor.callout",value:"callout",color:_e.deepOrange,icon:"card_text",style:!1},{label:"editor.emoji",value:"emoji",icon:"emoji_emotions",color:_e.blue}],As=mi.filter(n=>n.style),gi=[{label:"label.ai",value:"aiViewer",icon:"auto_awesome",color:_e.purple,tips:"ai",group:"label.ai"},{label:"editor.callout",value:"callout",icon:"card_text",color:_e.deepOrange,tips:"callout",group:"label.common"},{label:"editor.table",value:"table",icon:"window",tips:"table",color:_e.cyan},{label:"editor.codeBlock",value:"codeBlock",icon:"code_braces",tips:"code",color:_e.blue},{label:"editor.todoList",value:"taskList",icon:"check_box",tips:"task",color:_e.indigo},{label:"label.image",value:"image",icon:"image",color:_e.amber,tips:"image",group:"label.media"},{label:"label.video",value:"video",icon:"videocam",tips:"video",color:_e.purple},{label:"label.model",value:"modelViewer",icon:"3d_rotation",tips:"model",color:_e.purple}],Oc=[...mi,...gi],Kh=[{label:"editor.duplicate",value:"duplicate",icon:"content_copy",color:_e.blue,tips:"Ctrl+D",group:"label.common",filter:"common"},{label:"editor.delete",value:"delete",icon:"delete",tips:"Ctrl+D",color:_e.deepOrange,filter:"common"},{label:"label.replace",value:"replace",icon:"cached",tips:"Ctrl+R",color:_e.blue,filter:"image,video,model"},{label:"label.color",value:"palette",icon:"palette",color:_e.purple,filter:"callout",component:"OCalloutColorBoard"}],eS={key:1,class:"group o-tips"},tS={class:"suffix o-tips"},nS={key:1,class:"item"},qr=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(n,{emit:e}){const t=n,r=e,{tr:o}=Ee(),i=l.ref([]),s=l.computed(()=>{var h;return(h=t.node)==null?void 0:h.type.name}),a=l.computed(()=>{const h=Kh.filter(g=>{var b;return((b=g.filter)==null?void 0:b.indexOf("common"))>=0}),m=Kh.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 Ac;default:return null}}function d(h){r("action",h),setTimeout(()=>{u(h)},0)}function u(h){switch(h.value){case"delete":t.deleteNode();break;case"duplicate":p();break}}function p(){var y,E,C;const h=t.node.nodeSize,m=t.getPos()+h,g=JSON.parse(JSON.stringify(t.node));(y=t.editor)==null||y.commands.insertContentAt(m,{type:"paragraph"}),(E=t.editor)==null||E.commands.insertContentAt(m,g);const b=m+h+1;(C=t.editor)==null||C.commands.focus(b)}function f(h,m){switch(m.name){case"backColor":t.updateAttributes({background:m.value});break;case"foreColor":t.updateAttributes({borderColor:m.value});break}}return(h,m)=>(l.openBlock(),l.createBlock(l.unref(ln),{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(Gt),{key:0})):l.createCommentVNode("",!0),n.showGroup?(l.openBlock(),l.createElementBlock("div",eS,l.toDisplayString(l.unref(o)(g.group)),1)):l.createCommentVNode("",!0)],64)):l.createCommentVNode("",!0),c(g)?(l.openBlock(),l.createBlock(l.unref(We),{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(re),{name:g.icon,color:n.colorful?g.color:""},null,8,["name","color"])]),suffix:l.withCtx(()=>[l.createVNode(l.unref(re),{name:"navigate_next",class:"o-tips"})]),default:l.withCtx(()=>[l.createTextVNode(" "+l.toDisplayString(l.unref(o)(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(re),{name:g.icon,color:n.colorful?g.color:""},null,8,["name","color"])]),suffix:l.withCtx(()=>[l.createElementVNode("div",tS,l.toDisplayString(g.tips),1)]),default:l.withCtx(()=>[l.createTextVNode(" "+l.toDisplayString(l.unref(o)(g.label)),1)]),_:2},1032,["onClick"]))],64))),128)):(l.openBlock(),l.createElementBlock("div",nS,"No result"))]),_:1}))}}),So=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:Array,default:function(){return[0,10]}}},emits:["update:modelValue","show","hide"],setup(n,{emit:e}){const t=n,r=e,o=l.ref();function i(a){r("update:modelValue",a)}function s(){t.hideClickOutside&&r("update:modelValue",!1)}return l.watch(()=>t.modelValue,a=>{var c,d;console.log("modelValue",a),a?(c=o.value)==null||c.setShow(!0):(d=o.value)==null||d.setShow(!1)}),l.onMounted(()=>{var a;t.modelValue&&((a=o.value)==null||a.setShow(!0))}),(a,c)=>(l.openBlock(),l.createBlock(l.unref(We),{ref_key:"popover",ref:o,placement:n.placement,"tippy-class":n.tippyClass,trigger:"manual",arrow:n.showArrow,offset:n.offset,show:n.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"]))}}),rS={class:"o-block-toolbar"},oS={class:"button-group"},Mc=l.defineComponent({__name:"OBlockToolbar",props:{...st,type:{type:String,default:"link"}},emits:["action"],setup(n,{emit:e}){const t=n,r=e,{locale:o,tr:i}=Ee(),s=l.ref();function a(c){var d;r("action",c),(d=s.value)==null||d.setShow(!1)}return(c,d)=>(l.openBlock(),l.createElementBlock("div",rS,[l.createElementVNode("section",oS,[l.renderSlot(c.$slots,"default"),l.createVNode(l.unref(We),{ref_key:"popover",ref:s,placement:"bottom-end",size:"medium",trigger:"click","show-arrow":!1},{trigger:l.withCtx(()=>[l.createVNode(l.unref(lt),{icon:"more_horiz",tooltip:l.unref(i)("label.more")},null,8,["tooltip"])]),default:l.withCtx(()=>[l.createVNode(l.unref(qr),l.mergeProps(t,{onAction:a}),null,16)]),_:1},512)])]))}}),iS={class:"o-callout-color-board"},sS={class:"fore-colors"},aS=l.createElementVNode("div",{class:"label o-tips"},"Border color",-1),lS={class:"color-row"},cS={class:"color-row"},dS={class:"back-colors"},uS=l.createElementVNode("div",{class:"label o-tips"},"Background",-1),pS={class:"color-row"},fS={class:"color-row"},Ac=l.defineComponent({__name:"OCalloutColorBoard",props:{foreColor:{type:String,default:""},backColor:{type:String,default:""},activeColor:{type:String,default:""}},emits:["select"],setup(n,{emit:e}){const t=e;function r(s,a){t("select",{name:s,value:a.value})}const o=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",iS,[l.createElementVNode("section",sS,[aS,l.createElementVNode("div",lS,[l.createVNode(l.unref(ve),{icon:"slash_forward",tooltip:"No color","content-class":"border",onClick:a[0]||(a[0]=c=>r("foreColor",{value:""}))}),n.foreColor?(l.openBlock(),l.createBlock(l.unref(ve),{key:0,tooltip:"Last used","content-style":{borderColor:n.foreColor},onClick:a[1]||(a[1]=c=>r("foreColor",{value:n.foreColor}))},null,8,["content-style"])):l.createCommentVNode("",!0)]),l.createElementVNode("div",cS,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(o.value,(c,d)=>(l.openBlock(),l.createBlock(l.unref(ve),{key:`col-${d}`,tooltip:c.label,"content-style":{borderColor:c.value},onClick:u=>r("foreColor",c)},null,8,["tooltip","content-style","onClick"]))),128))])]),l.createElementVNode("section",dS,[uS,l.createElementVNode("div",pS,[l.createVNode(l.unref(ve),{icon:"slash_forward",tooltip:"Default Color","content-class":"border",onClick:a[2]||(a[2]=c=>r("backColor",{value:"#F5F5F5"}))}),n.backColor?(l.openBlock(),l.createBlock(l.unref(ve),{key:0,"content-style":{backgroundColor:n.backColor},tooltip:"Last used","content-class":"border",onClick:a[3]||(a[3]=c=>r("backColor",{value:n.backColor}))},null,8,["content-style"])):l.createCommentVNode("",!0)]),l.createElementVNode("div",fS,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(i.value,(c,d)=>(l.openBlock(),l.createBlock(l.unref(ve),{key:`col-${d}`,tooltip:c.label,"content-style":{backgroundColor:c.value},onClick:u=>r("backColor",c)},null,8,["tooltip","content-style","onClick"]))),128))])])]))}}),hS=l.defineComponent({__name:"OCalloutColorDropdown",props:{editor:{type:Object}},emits:["select"],setup(n,{emit:e}){const t=e,{tr:r}=Ee(),{run:o}=Ie(),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)),t("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(We),{ref_key:"popover",ref:i,placement:"bottom-center",trigger:"hover",arrow:""},{trigger:l.withCtx(()=>[l.createVNode(l.unref(lt),{icon:"palette",tooltip:l.unref(r)("editor.textColor")},{default:l.withCtx(()=>[l.createVNode(l.unref(re),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:l.withCtx(()=>{var p;return[l.createVNode(l.unref(Ac),{"fore-color":s.value,"back-color":a.value,"default-label":l.unref(r)("editor.defaultColor"),"active-color":(p=n.editor)==null?void 0:p.getAttributes("textStyle").color,onSelect:c},null,8,["fore-color","back-color","default-label","active-color"])]}),_:1},512))}}),vs=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(n,{emit:e}){const t=n,r=e,o=l.ref();l.computed(()=>{var a;return t.clientX||((a=t.event)==null?void 0:a.clientX)||0}),l.computed(()=>{var a;return t.clientY||((a=t.event)==null?void 0:a.clientY)||0});function i(a){r("update:modelValue",a)}function s(){r("update:modelValue",!1)}return l.watch(()=>t.modelValue,a=>{var c;a?setTimeout(()=>{var d;(d=o.value)==null||d.setShow(a)},0):(c=o.value)==null||c.setShow(a)}),(a,c)=>(l.openBlock(),l.createBlock(l.unref(We),{ref_key:"popover",ref:o,placement:"bottom-start",trigger:"manual",show:n.modelValue,"show-arrow":!1,event:n.event,"onUpdate:show":i,onClickoutside:s},{default:l.withCtx(()=>[l.renderSlot(a.$slots,"default")]),_:3},8,["show","event"]))}}),mS={class:"o-color-board"},gS={class:"cell-container"},bS={class:"label"},yS=["onClick"],Rs=l.defineComponent({__name:"OColorBoard",props:{defaultColor:{type:String,default:""},defaultLabel:{type:String,default:""},activeColor:{type:String,default:""}},emits:["select"],setup(n,{emit:e}){const t=n,r=e;function o(c){r("select",c.hex)}function i(c){return t.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",mS,[l.createElementVNode("div",{class:"default-color",onClick:d[0]||(d[0]=u=>o({hex:n.defaultColor}))},[l.createElementVNode("div",gS,[l.createElementVNode("div",{class:"cell border",style:l.normalizeStyle({background:n.defaultColor})},[l.createVNode(l.unref(re),{name:"slash_forward"})],4)]),l.createElementVNode("div",bS,l.toDisplayString(n.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=>o(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(re),{key:0,name:"done",style:l.normalizeStyle({color:s(f.rgb)})},null,8,["style"])):l.createCommentVNode("",!0)],6)],8,yS)]))),128))]))),128))]))}}),lt=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(n,{emit:e}){const t=e;return(r,o)=>(l.openBlock(),l.createBlock(l.unref(br),{placement:n.placement},{trigger:l.withCtx(()=>[l.createElementVNode("button",{class:l.normalizeClass(["o-menubar-btn o-command-btn o-btn",n.contentClass]),style:l.normalizeStyle(n.contentStyle),onClick:o[0]||(o[0]=i=>t("click",i))},[l.createVNode(l.unref(re),{name:n.icon,color:n.color,class:l.normalizeClass(n.iconClass)},null,8,["name","color","class"]),l.renderSlot(r.$slots,"default")],6)]),default:l.withCtx(()=>[l.createTextVNode(" "+l.toDisplayString(n.tooltip),1)]),_:3},8,["placement"]))}}),Ds=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(n,{emit:e}){const t=e;return(r,o)=>(l.openBlock(),l.createBlock(l.unref(br),{placement:n.placement},{trigger:l.withCtx(()=>[l.createElementVNode("div",{class:l.normalizeClass(["o-menubar-btn o-command-btn o-btn",n.contentClass]),style:l.normalizeStyle(n.contentStyle),onClick:o[0]||(o[0]=i=>t("click",i))},[l.createVNode(l.unref(re),{name:n.icon,color:n.color,class:l.normalizeClass(n.iconClass)},null,8,["name","color","class"]),l.renderSlot(r.$slots,"default")],6)]),default:l.withCtx(()=>[l.createTextVNode(" "+l.toDisplayString(n.tooltip),1)]),_:3},8,["placement"]))}}),vc=[{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"}],kS={class:"selected-language"},ES={class:"header"},wS={class:"o-scroll"},Gh=l.defineComponent({__name:"OLanguageDropdown",props:{language:{type:String,default:"shell"}},emits:["select"],setup(n,{emit:e}){const t=n,r=e,{tr:o}=Ee(),i=l.ref(),s=l.ref(),a=l.ref(""),c=l.ref(0),d=l.ref(""),u=l.computed(()=>a.value?vc.filter(y=>y.value.toLowerCase().indexOf(a.value.toLowerCase())>=0):vc),p=l.computed(()=>vc.find(y=>y.value===d.value));function f(y){y&&setTimeout(()=>{var E;(E=s.value)==null||E.focus(),c.value=0,window.addEventListener("keyup",b)},0)}function h(){window.removeEventListener("keyup",b)}function m(y){h(),d.value=y.value,r("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=t.language}),(y,E)=>(l.openBlock(),l.createBlock(l.unref(We),{ref_key:"popover",ref:i,placement:"bottom-start",trigger:"click","tippy-class":"o-language-popover dropdown","onUpdate:show":f},{trigger:l.withCtx(()=>[l.createVNode(l.unref(vt),{class:"o-dropdown-btn"},{default:l.withCtx(()=>{var C;return[l.createElementVNode("span",kS,l.toDisplayString((C=p.value)==null?void 0:C.label),1),l.createVNode(l.unref(re),{name:"arrow_drop_down",class:"arrow"})]}),_:1})]),default:l.withCtx(()=>[l.createElementVNode("header",ES,[l.createVNode(l.unref(xo),{ref_key:"input",ref:s,modelValue:a.value,"onUpdate:modelValue":E[0]||(E[0]=C=>a.value=C),type:"text",placeholder:"Search",autofocus:"",clearable:""},{prefix:l.withCtx(()=>[l.createVNode(l.unref(re),{name:"search",class:"o-tips"})]),_:1},8,["modelValue"])]),l.createElementVNode("section",wS,[l.createVNode(l.unref(ln),{hoverable:"",clickable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(u.value,(C,k)=>(l.openBlock(),l.createBlock(l.unref(jt),{key:k,onClick:S=>m(C),class:l.normalizeClass({"is-active":C.value===d.value,"is-select":k===c.value})},{prefix:l.withCtx(()=>[l.createVNode(l.unref(re),{name:C.icon},null,8,["name"])]),default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(C.label)+" ",1)]),_:2},1032,["onClick","class"]))),128))]),_:1})])]),_:1},512))}}),CS={class:"o-media-input"},_S={class:"fields"},SS=l.createElementVNode("div",{class:"o-media-title"},"Link",-1),xS={class:"actions"},Rc=l.defineComponent({__name:"OMediaInput",props:{val:{type:String,default:""},type:{type:String,default:""}},emits:["input"],setup(n,{emit:e}){const t=n,r=e,{tr:o}=Ee(),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()&&r("input",a.value)}return l.onMounted(()=>{a.value=t.val,setTimeout(()=>{var u;(u=i.value)==null||u.focus()},0)}),(u,p)=>(l.openBlock(),l.createElementBlock("section",CS,[l.createElementVNode("section",_S,[SS,l.createVNode(l.unref(xo),{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(re),{name:"link",class:"o-tips"})]),_:1},8,["modelValue","status"])]),l.createElementVNode("footer",xS,[l.createVNode(l.unref(vt),{type:"info",onClick:d},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(o)("label.ok")),1)]),_:1})])]))}}),NS={class:"o-meta-input"},TS={class:"header"},OS={class:"title"},MS={class:"fields"},AS={class:"actions"},Dc=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(n,{emit:e}){const t=n,r=e,{tr:o}=Ee(),i=l.ref(null),s=l.ref("");function a(){console.log("confirm",s.value),r("confirm",s.value)}return l.onMounted(()=>{s.value=t.val,setTimeout(()=>{var c;(c=i.value)==null||c.focus()},0)}),(c,d)=>(l.openBlock(),l.createElementBlock("section",NS,[l.createElementVNode("section",TS,[l.createElementVNode("div",OS,l.toDisplayString(n.title),1),l.createElementVNode("div",null,[l.renderSlot(c.$slots,"header-right")])]),l.createElementVNode("section",MS,[l.createVNode(l.unref(xo),{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(re),{name:n.icon,class:"o-tips"},null,8,["name"])]),_:1},8,["modelValue"])]),l.createElementVNode("footer",AS,[l.createVNode(l.unref(vt),{type:"tertiary",onClick:d[1]||(d[1]=u=>r("cancel"))},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(o)("label.cancel")),1)]),_:1}),l.createVNode(l.unref(vt),{type:"info",onClick:a},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(o)("label.ok")),1)]),_:1})])]))}}),vS={class:"o-table-grid"},RS=["onMouseover"],jh=l.defineComponent({__name:"OTableGrid",emits:["select"],setup(n,{emit:e}){const t=e,r=l.ref(6),o=l.ref(6),i=l.ref(2),s=l.ref(2);function a(d,u){i.value=d,s.value=u,r.value===d&&r.value<10&&(r.value+=1),o.value===u&&o.value<10&&(o.value+=1)}function c(){t("select",{rows:i.value,cols:s.value,withHeaderRow:!0})}return(d,u)=>(l.openBlock(),l.createElementBlock("section",vS,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(r.value,(p,f)=>(l.openBlock(),l.createElementBlock("div",{class:"rows",key:`row-${f}`},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(o.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,RS)]))),128))]))),128)),l.createElementVNode("footer",null,l.toDisplayString(i.value)+" x "+l.toDisplayString(s.value),1)]))}}),DS={class:"o-table-cell-background o-button-group"},IS=["onClick"],BS={class:"o-command-btn"},Jh=l.defineComponent({__name:"OTableCellBackground",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=Ee(),{run:r}=Ie(),o=l.ref(),i=l.ref("#ffec3d");function s(){a(i.value)}function a(c){o.value.setShow(!1),i.value=c,r(e.editor,"tableCellAttribute",{name:"background",value:i.value})}return(c,d)=>(l.openBlock(),l.createBlock(l.unref(We),{ref_key:"popover",ref:o,class:"o-simple-command-btn",placement:"bottom-start",trigger:"click"},{trigger:l.withCtx(()=>[l.createVNode(l.unref(br),{trigger:"hover"},{trigger:l.withCtx(()=>[l.createElementVNode("div",DS,[l.createElementVNode("div",{class:"o-command-btn label",onClick:l.withModifiers(s,["stop"])},[l.createVNode(l.unref(re),{name:"crop_16_9",class:"arrow"}),l.createElementVNode("div",{class:"indicator",style:l.normalizeStyle(`background: ${i.value}`)},null,4)],8,IS),l.createElementVNode("div",BS,[l.createVNode(l.unref(re),{name:"arrow_drop_down"})])])]),default:l.withCtx(()=>[l.createTextVNode(" "+l.toDisplayString(l.unref(t)("editor.highlightColor")),1)]),_:1})]),default:l.withCtx(()=>[l.createVNode(l.unref(Rs),{"default-color":"","default-label":l.unref(t)("editor.noColor"),onSelect:a},null,8,["default-label"])]),_:1},512))}}),LS={class:"o-simple-color-board"},PS={class:"fore-colors"},$S=l.createElementVNode("div",{class:"label o-tips"},"Color",-1),FS={class:"color-row"},zS={class:"color-row"},VS={class:"back-colors"},HS=l.createElementVNode("div",{class:"label o-tips"},"Background",-1),US={class:"color-row"},WS={class:"color-row"},Yh=l.defineComponent({__name:"OTextColorBoard",props:{foreColor:{type:String,default:""},backColor:{type:String,default:""},activeColor:{type:String,default:""}},emits:["select"],setup(n,{emit:e}){const t=e;function r(s,a){t("select",s,a.value)}const o=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",LS,[l.createElementVNode("section",PS,[$S,l.createElementVNode("div",FS,[l.createVNode(l.unref(ve),{icon:"format_text",tooltip:"Default color","content-class":"border",onClick:a[0]||(a[0]=c=>r("foreColor",{value:""}))}),n.foreColor?(l.openBlock(),l.createBlock(l.unref(ve),{key:0,icon:"format_text",color:n.foreColor,tooltip:"Last used","content-class":"border",onClick:a[1]||(a[1]=c=>r("foreColor",{value:n.foreColor}))},null,8,["color"])):l.createCommentVNode("",!0)]),l.createElementVNode("div",zS,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(o.value,(c,d)=>(l.openBlock(),l.createBlock(l.unref(ve),{key:`col-${d}`,icon:"format_text",color:c.value,tooltip:c.label,onClick:u=>r("foreColor",c)},null,8,["color","tooltip","onClick"]))),128))])]),l.createElementVNode("section",VS,[HS,l.createElementVNode("div",US,[l.createVNode(l.unref(ve),{icon:"slash_forward",tooltip:"No Color","content-class":"border",onClick:a[2]||(a[2]=c=>r("backColor",{value:""}))}),n.backColor?(l.openBlock(),l.createBlock(l.unref(ve),{key:0,icon:"format_text",tooltip:"Last used","content-class":"border","content-style":{backgroundColor:n.backColor},onClick:a[3]||(a[3]=c=>r("backColor",{value:n.backColor}))},null,8,["content-style"])):l.createCommentVNode("",!0)]),l.createElementVNode("div",WS,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(i.value,(c,d)=>(l.openBlock(),l.createBlock(l.unref(ve),{key:`col-${d}`,icon:"format_text",tooltip:c.label,"content-style":{backgroundColor:c.value},onClick:u=>r("backColor",c)},null,8,["tooltip","content-style","onClick"]))),128))])])]))}}),Is=[{type:"paragraph",content:[]}],Xh=[{type:"listItem",content:[{type:"paragraph",content:[]}]}],Zh=[{type:"taskItem",content:[{type:"paragraph",content:[]}]}],qS={class:"o-add-node-view"},KS={key:0,class:"view-main"},GS={class:"group o-tips"},jS={class:"panel"},JS={class:"group o-tips"},YS={key:1,class:"item"},XS={key:1,class:"view-emoji"},ZS=l.defineComponent({__name:"AddNodeView",props:st,emits:["action"],setup(n,{emit:e}){const t=n,r=e,{locale:o,tr:i}=Ee(),{run:s}=Ie(),a=l.ref("main"),c=l.ref(0);function d(f){const h=t.editor.chain();let m=null;switch(f.value){case"blockquote":m={content:Is};break;case"callout":m={content:Is,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:Xh};break;case"taskList":m={content:Zh};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)),r("action",f)}const u=l.computed(()=>t.node.content.size===0),p=l.computed(()=>u.value?c.value:c.value+t.node.nodeSize);return l.onMounted(()=>{c.value=t.getPos()}),(f,h)=>(l.openBlock(),l.createElementBlock("section",qS,[a.value==="main"?(l.openBlock(),l.createElementBlock("section",KS,[l.createElementVNode("section",null,[l.createElementVNode("div",GS,l.toDisplayString(l.unref(i)("label.basic")),1),l.createElementVNode("section",jS,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(mi),(m,g)=>(l.openBlock(),l.createBlock(l.unref(ve),{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(ln),{hoverable:"",clickable:""},{default:l.withCtx(()=>[l.unref(gi).length?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(gi),(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(Gt),{key:0})):l.createCommentVNode("",!0),l.createElementVNode("div",JS,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(re),{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",YS,"No result"))]),_:1})])):a.value==="emoji"?(l.openBlock(),l.createElementBlock("section",XS)):l.createCommentVNode("",!0)]))}}),QS=l.defineComponent({__name:"AddNode",props:st,setup(n){const e=n,t=l.ref(null),r=l.ref(!1);function o(s){r.value=s}function i(){var s;(s=t.value)==null||s.setShow(!1),r.value=!1}return(s,a)=>(l.openBlock(),l.createBlock(l.unref(We),{ref_key:"popover",ref:t,placement:"left",trigger:"mouseenter",arrow:"","onUpdate:show":o},{trigger:l.withCtx(()=>[l.createElementVNode("div",{class:l.normalizeClass(["o-add-node",{"is-selected":r.value}])},[l.createVNode(l.unref(vt),{type:"tertiary",class:"o-node-btn"},{default:l.withCtx(()=>[l.createVNode(l.unref(re),{name:"add",small:""})]),_:1})],2)]),default:l.withCtx(()=>[l.createVNode(ZS,l.mergeProps(e,{onAction:i}),null,16)]),_:1},512))}}),ex={class:"o-drag-node-view"},tx={key:0,class:"view-main"},nx={key:0},rx=l.createElementVNode("div",{class:"group o-tips"},"Turn into",-1),ox={class:"panel"},ix=l.defineComponent({__name:"DragNodeView",props:st,emits:["action"],setup(n,{emit:e}){const t=n,r=e,{locale:o,tr:i}=Ee(),{run:s,onCommand:a}=Ie(),c=l.ref("main"),d=l.ref(["heading","codeBlock","paragraph"]),u=l.computed(()=>{var b,y;const g=(b=t.node)==null?void 0:b.content.content;if(g.length>0){const E=g[0];if(E.type.name==="image")return E.type.name}return(y=t.node)==null?void 0:y.type.name}),p=l.computed(()=>As.find(g=>g.value===u.value));function f(g){var b;return g.value===u.value&&((b=t.editor)==null?void 0:b.isActive(u.value,g.options))}function h(g){switch(g.value){default:m(g);break}r("action",g)}function m(g){var C,k,S,_,D;const b=t.getPos();if(g.value===u.value&&d.value.indexOf(u.value)<0){const B=(C=t.editor)==null?void 0:C.isActive(u.value),v=(k=t.editor)==null?void 0:k.commands.lift(u.value);console.log("lift",u.value,B,v);return}const y=(S=t.editor)==null?void 0:S.commands,E=(_=t.editor)==null?void 0:_.chain().focus(b+1);console.log("runCommand",g),a(y,E,g.value,g.options),(D=t.editor)==null||D.commands.setNodeSelection(b)}return l.computed(()=>[{label:"editor.duplicate",value:"duplicate",icon:"content_copy",color:_e.blue,tips:"Ctrl+D",group:"label.common"},{label:"editor.delete",value:"delete",icon:"delete",tips:"Ctrl+D",color:_e.deepOrange}]),(g,b)=>(l.openBlock(),l.createElementBlock("section",ex,[c.value==="main"?(l.openBlock(),l.createElementBlock("section",tx,[p.value?(l.openBlock(),l.createElementBlock("section",nx,[rx,l.createElementVNode("section",ox,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(As),(y,E)=>(l.openBlock(),l.createBlock(l.unref(ve),{key:E,icon:y.icon,tooltip:l.unref(i)(y.label),"content-class":{"is-active":f(y)},quaternary:"",onClick:C=>h(y)},null,8,["icon","tooltip","content-class","onClick"]))),128))])])):l.createCommentVNode("",!0),l.createVNode(l.unref(qr),l.mergeProps(t,{colorful:"","show-group":"",onAction:h}),null,16)])):l.createCommentVNode("",!0)]))}}),sx=l.defineComponent({__name:"DragNode",props:st,emits:["action"],setup(n,{emit:e}){const t=n,r=e,{run:o}=Ie(),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 E,C;const y=(E=t.node)==null?void 0:E.content.content;if(y.length>0){const k=y[0];if(k.type.name==="image")return k.type.name}return(C=t.node)==null?void 0:C.type.name}),p=l.computed(()=>{var E;let y=u.value;return y==="heading"?{icon:`format_h${((E=t.node.attrs)==null?void 0:E.level)||1}`,color:_e.blue}:(y==="table-wrapper"&&(y="table"),Oc.find(C=>C.value===y)||{icon:"title"})});function f(y){var E;(E=i.value)==null||E.setShow(!1),r("action",y)}function h(y){a.value=y,console.log("show",y),y&&m()}function m(){var E;let y=t.getPos();c.value.includes(u.value)||(y+=1),(E=t.editor)==null||E.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,E)=>(l.openBlock(),l.createBlock(l.unref(We),{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(vt),{type:"tertiary",class:"o-node-btn"},{default:l.withCtx(()=>[l.createVNode(l.unref(re),{name:p.value.icon,color:p.value.color,small:""},null,8,["name","color"]),l.createVNode(l.unref(re),{name:"drag_indicator",small:""})]),_:1})],34)]),default:l.withCtx(()=>[l.createVNode(ix,l.mergeProps(t,{onAction:f}),null,16)]),_:1},512))}}),ax=l.defineComponent({__name:"index",props:st,emits:["action"],setup(n,{emit:e}){const t=n,r=e,o=l.ref(!1),i=l.ref(0);l.ref(0);const s=l.computed(()=>a.value==="paragraph"&&t.node.content.size===0),a=l.computed(()=>{var f,h;const p=(f=t.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=t.node)==null?void 0:h.type.name}),c=l.computed(()=>{var p;return i.value||((p=t.node.attrs)==null?void 0:p.level)}),d=l.computed(()=>a.value==="heading"?`type-heading-${c.value}`:`type-${a.value}`);function u(p){r("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":o.value,"is-empty":s.value}])},[l.createElementVNode("section",{class:l.normalizeClass(["action-container",d.value])},[l.createVNode(QS,l.normalizeProps(l.guardReactiveProps(t)),null,16),s.value?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(sx,l.mergeProps({key:0},t,{onAction:u}),null,16))],2)],2)):l.createCommentVNode("",!0)}}}),An=l.defineComponent({__name:"ONodeView",props:st,emits:["action"],setup(n,{emit:e}){const t=n,r=e,o=l.inject("sideNode",{value:!1});return l.computed(()=>{const i={};return t.node.attrs["data-id"]&&(i["data-id"]=t.node.attrs["data-id"]),i}),(i,s)=>(l.openBlock(),l.createBlock(l.unref(_c),{class:"o-node-view"},{default:l.withCtx(()=>{var a;return[l.unref(o)&&((a=i.editor)!=null&&a.isEditable)?(l.openBlock(),l.createBlock(ax,l.mergeProps({key:0},t,{onAction:s[0]||(s[0]=c=>r("action"))}),null,16)):l.createCommentVNode("",!0),l.renderSlot(i.$slots,"default")]}),_:3}))}}),lx={class:"o-add-node-view"},cx={key:0,class:"view-main"},dx={class:"group o-tips"},ux={class:"panel"},px={class:"group o-tips"},fx={key:1,class:"item"},hx={key:1,class:"view-emoji"},mx=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(n,{emit:e}){const t=n,r=e,{locale:o,tr:i}=Ee(),{run:s}=Ie(),a=l.ref("main");function c(p){const f=t.editor.chain();let h=null;switch(p.value){case"blockquote":h={content:Is};break;case"callout":h={content:Is,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:Xh};break;case"taskList":h={content:Zh};break;case"table":setTimeout(()=>{f.insertContentAt(u.value,{type:"paragraph",content:[]}).insertTable({rows:3,cols:3,withHeaderRow:!0}).focus().run()},1);return;case"image":h={type:"paragraph",content:[{type:p.value,attrs:{src:"init"}}]};break;case"model-viewer":h={attrs:{src:"init"}};break}h&&(console.log("add",t.getPos(),u.value),h.type=h.type||p.value,setTimeout(()=>{d.value?f.insertContent(h).focus().run():f.insertContentAt(u.value,h).focus().run()},1)),r("action",p)}const d=l.computed(()=>{var p;return((p=t.node)==null?void 0:p.content.size)===0}),u=l.computed(()=>d.value?t.getPos():t.getPos()+t.node.nodeSize);return(p,f)=>(l.openBlock(),l.createElementBlock("section",lx,[a.value==="main"?(l.openBlock(),l.createElementBlock("section",cx,[l.createElementVNode("section",null,[l.createElementVNode("div",dx,l.toDisplayString(l.unref(i)("label.basic")),1),l.createElementVNode("section",ux,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(mi),(h,m)=>(l.openBlock(),l.createBlock(l.unref(ve),{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(ln),{hoverable:"",clickable:""},{default:l.withCtx(()=>[l.unref(gi).length?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(gi),(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(Gt),{key:0})):l.createCommentVNode("",!0),l.createElementVNode("div",px,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(re),{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",fx,"No result"))]),_:1})])):a.value==="emoji"?(l.openBlock(),l.createElementBlock("section",hx)):l.createCommentVNode("",!0)]))}}),Qh=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(n){const e=n,t=l.ref(),r=l.ref(!1),o=l.computed(()=>{var c;return((c=e.node)==null?void 0:c.content.size)===0});l.computed(()=>o.value?e.getPos():e.getPos()+e.node.nodeSize);function i(c){r.value=c}function s(){var c;(c=t.value)==null||c.setShow(!0)}function a(){var c;(c=t.value)==null||c.setShow(!1),r.value=!1}return(c,d)=>(l.openBlock(),l.createBlock(l.unref(We),{ref_key:"popover",ref:t,placement:"left","tippy-class":"dropdown",trigger:"manual",offset:[0,4],"onUpdate:show":i},{trigger:l.withCtx(()=>[l.createElementVNode("div",{class:l.normalizeClass(["o-add-btn",{"is-selected":r.value}])},[l.createVNode(l.unref(vt),{type:"tertiary",class:"o-node-btn",onClick:s},{default:l.withCtx(()=>[l.createVNode(l.unref(re),{name:"add",small:""})]),_:1})],2)]),default:l.withCtx(()=>[l.createVNode(mx,l.mergeProps(e,{onAction:a}),null,16)]),_:1},512))}}),gx={class:"o-drag-node-view"},bx={key:0,class:"view-main"},yx={key:0},kx=l.createElementVNode("div",{class:"group o-tips"},"Turn into",-1),Ex={class:"panel"},wx=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(n,{emit:e}){const t=n,r=e,{locale:o,tr:i}=Ee(),{run:s,onCommand:a}=Ie(),c=l.ref("main"),d=l.ref(["heading","codeBlock","paragraph"]),u=l.computed(()=>{var b,y;const g=(b=t.node)==null?void 0:b.content.content;if(g.length>0){const E=g[0];if(E.type.name==="image")return E.type.name}return(y=t.node)==null?void 0:y.type.name}),p=l.computed(()=>As.find(g=>g.value===u.value));function f(g){var b;return g.value===u.value&&((b=t.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}r("action",g)}function m(g){var C,k,S,_,D;const b=t.getPos();if(g.value===u.value&&d.value.indexOf(u.value)<0){const B=(C=t.editor)==null?void 0:C.isActive(u.value),v=(k=t.editor)==null?void 0:k.commands.lift(u.value);console.log("lift",u.value,B,v);return}const y=(S=t.editor)==null?void 0:S.commands,E=(_=t.editor)==null?void 0:_.chain().focus(b+1);console.log("runCommand",g),a(y,E,g.value,g.options),(D=t.editor)==null||D.commands.setNodeSelection(b)}return l.computed(()=>[{label:"editor.duplicate",value:"duplicate",icon:"content_copy",color:_e.blue,tips:"Ctrl+D",group:"label.common"},{label:"editor.delete",value:"delete",icon:"delete",tips:"Ctrl+D",color:_e.deepOrange}]),(g,b)=>(l.openBlock(),l.createElementBlock("section",gx,[c.value==="main"?(l.openBlock(),l.createElementBlock("section",bx,[p.value?(l.openBlock(),l.createElementBlock("section",yx,[kx,l.createElementVNode("section",Ex,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(As),(y,E)=>(l.openBlock(),l.createBlock(l.unref(ve),{key:E,icon:y.icon,tooltip:l.unref(i)(y.label),"content-class":{"is-active":f(y)},quaternary:"",onClick:C=>h(y)},null,8,["icon","tooltip","content-class","onClick"]))),128))])])):l.createCommentVNode("",!0),l.createVNode(l.unref(qr),l.mergeProps(t,{colorful:"","show-group":"",onAction:h}),null,16)])):l.createCommentVNode("",!0)]))}}),em=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(n,{emit:e}){const t=n,r=e,{run:o}=Ie(),i=l.ref(null),s=l.ref(!1),a=l.ref(["heading","codeBlock","paragraph"]),c=l.computed(()=>{var b,y,E;const g=(y=(b=t.node)==null?void 0:b.content)==null?void 0:y.content;if((g==null?void 0:g.length)>0){const C=g[0];if(C.type.name==="image")return C.type.name}return(E=t.node)==null?void 0:E.type.name}),d=l.computed(()=>{var b;let g=c.value;return g==="heading"?{icon:`format_h${((b=t.node.attrs)==null?void 0:b.level)||1}`,color:_e.blue}:(g==="table-wrapper"&&(g="table"),Oc.find(y=>y.value===g)||{icon:"title"})});function u(g){r("dragstart",g)}function p(g){r("dragend",g)}function f(g){var b;(b=i.value)==null||b.setShow(!1),r("action",g)}function h(g){s.value=g,console.log("show",g),g&&m()}function m(){var b;let g=t.getPos();a.value.includes(c.value)||(g+=1),(b=t.editor)==null||b.commands.setNodeSelection(g)}return l.watch(()=>t.getPos(),g=>{var b;(b=i.value)==null||b.setShow(!1)}),(g,b)=>(l.openBlock(),l.createBlock(l.unref(We),{ref_key:"popover",ref:i,placement:"left","tippy-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(vt),{type:"tertiary",class:"o-node-btn"},{default:l.withCtx(()=>[l.createVNode(l.unref(re),{name:d.value.icon,color:d.value.color,small:""},null,8,["name","color"]),l.createVNode(l.unref(re),{name:"drag_indicator",small:""})]),_:1})],34)]),default:l.withCtx(()=>[l.createVNode(wx,l.mergeProps(t,{onAction:f}),null,16)]),_:1},512))}}),vt=l.defineComponent({__name:"OBtn",props:{icon:{type:String,default:""},iconClass:{type:[String,Object],default:""},type:{type:String,default:""}},emits:["click"],setup(n,{emit:e}){const t=e;return(r,o)=>(l.openBlock(),l.createElementBlock("button",{class:l.normalizeClass(["o-btn",n.type?`type-${n.type}`:""]),onClick:o[0]||(o[0]=i=>t("click",i))},[n.icon?(l.openBlock(),l.createBlock(l.unref(re),{key:0,name:n.icon,class:l.normalizeClass(n.iconClass)},null,8,["name","class"])):l.createCommentVNode("",!0),l.renderSlot(r.$slots,"default")],2))}}),Cx={class:"o-checkbox"},_x={class:"o-checkbox__main"},Sx={class:"o-checkbox__suffix"},Ic=l.defineComponent({__name:"OCheckbox",props:{modelValue:{type:Boolean,default:!1},label:{type:String,default:""}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,o=l.computed({get(){return t.modelValue},set(i){r("update:modelValue",i)}});return(i,s)=>(l.openBlock(),l.createElementBlock("div",Cx,[l.createElementVNode("div",_x,[l.withDirectives(l.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=a=>o.value=a),type:"checkbox"},null,512),[[l.vModelCheckbox,o.value]])]),l.createElementVNode("div",Sx,l.toDisplayString(n.label),1)]))}}),Gt=l.defineComponent({__name:"ODivider",props:{vertical:{type:Boolean,default:!1}},setup(n){return(e,t)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["o-divider",{"o-divider-vertical":n.vertical}])},null,2))}}),xx={class:"o-input__prefix"},Nx={class:"o-input__main"},Tx={class:"o-input__suffix"},xo=l.defineComponent({__name:"OInput",props:{modelValue:{type:String,default:""},clearable:{type:Boolean,default:!1},type:{type:String,default:""}},emits:["blur","update:modelValue"],setup(n,{expose:e,emit:t}){const r=n,o=t,i=l.ref(null),s=l.computed({get(){return r.modelValue},set(d){o("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-${n.type}`])},[l.createElementVNode("div",xx,[l.renderSlot(d.$slots,"prefix")]),l.createElementVNode("div",Nx,[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=>o("blur"))},null,544),[[l.vModelText,s.value]])]),l.createElementVNode("div",Tx,[l.renderSlot(d.$slots,"suffix"),n.clearable&&s.value?(l.openBlock(),l.createBlock(re,{key:0,name:"close",class:"clear o-tips",onClick:c})):l.createCommentVNode("",!0)])],2))}}),ln=l.defineComponent({__name:"OList",props:{clickable:{type:Boolean,default:!1},hoverable:{type:Boolean,default:!1}},setup(n){return(e,t)=>(l.openBlock(),l.createElementBlock("ul",{class:l.normalizeClass(["o-list",{clickable:n.clickable,hoverable:n.hoverable}])},[l.renderSlot(e.$slots,"default")],2))}}),Ox={class:"o-list-item"},Mx={class:"o-list-item__prefix"},Ax={class:"o-list-item__main"},vx={class:"o-list-item__suffix"},jt=l.defineComponent({__name:"OListItem",props:{hoverable:{type:Boolean,default:!1}},setup(n){return(e,t)=>(l.openBlock(),l.createElementBlock("li",Ox,[l.createElementVNode("div",Mx,[l.renderSlot(e.$slots,"prefix")]),l.createElementVNode("div",Ax,[l.renderSlot(e.$slots,"default")]),l.createElementVNode("div",vx,[l.renderSlot(e.$slots,"suffix")])]))}}),We=l.defineComponent({__name:"OPopover",props:{show:{type:Boolean,default:!1},arrow:{type:Boolean,default:!1},offset:{type:Array,default:function(){return[0,10]}},placement:{type:String,default:"bottom-start"},trigger:{type:String,default:"mouseenter focus"},tippyClass:{type:String,default:""},event:{type:Object,default:function(){return{}}}},emits:["update:show"],setup(n,{expose:e,emit:t}){const r=n,o=t,{theme:i}=hi(),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=r.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:r.event.clientX,right:r.event.clientX,top:r.event.clientY,bottom:r.event.clientY,x:((h=r.event)==null?void 0:h.clientX)||0,y:((m=r.event)==null?void 0:m.clientY)||0,toJSON:()=>{var g,b;return{width:100,height:100,left:((g=r.event)==null?void 0:g.clientX)||0,top:((b=r.event)==null?void 0:b.clientY)||0}}}}function p(){c.value=On(s.value,{appendTo:()=>document.body,animation:"shift-away",arrow:r.arrow,content:a.value,delay:100,duration:200,interactive:!0,placement:r.placement,trigger:r.trigger,theme:i.value,onShow:h=>{o("update:show",!0)},onHide:h=>{o("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"),l.createElementVNode("div",{ref_key:"contentRef",ref:a,class:l.normalizeClass(["popover-content",n.tippyClass])},[l.renderSlot(h.$slots,"default")],2)],512))}}),Rx=l.defineComponent({__name:"OAlignDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=Ee(),{run:r}=Ie(),o=l.ref(null),i=l.computed(()=>[{label:t("editor.left"),value:"left",icon:"format_align_center"},{label:t("editor.center"),value:"center",icon:"format_align_center"},{label:t("editor.right"),value:"right",icon:"format_align_right"},{label:t("editor.justify"),value:"justify",icon:"format_align_justify"}]);function s(a){var c;(c=o.value)==null||c.setShow(!1),r(e.editor,"textAlign",{textAlign:a})}return(a,c)=>(l.openBlock(),l.createBlock(l.unref(We),{ref_key:"popover",ref:o,class:"o-simple-command-btn","tippy-class":"dropdown",size:"medium",trigger:"click","show-arrow":!1},{trigger:l.withCtx(()=>[l.createVNode(l.unref(lt),{icon:"format_align_center","content-class":"o-align-dropdown dropdown",tooltip:l.unref(t)("editor.align")},{default:l.withCtx(()=>[l.createVNode(l.unref(re),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:l.withCtx(()=>[l.createVNode(l.unref(ln),{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=n.editor)==null?void 0:p.isActive({textAlign:d.value})}),onClick:f=>s(d.value)},{prefix:l.withCtx(()=>[l.createVNode(l.unref(re),{name:d.icon},null,8,["name"])]),suffix:l.withCtx(()=>{var f;return[(f=n.editor)!=null&&f.isActive({textAlign:d.value})?(l.openBlock(),l.createBlock(l.unref(re),{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))}}),Dx={class:"o-align-group"},Ix=l.defineComponent({__name:"OAlignGroup",props:{editor:{type:Sn}},setup(n){const e=n,{tr:t}=Ee(),{run:r}=Ie(),o=l.computed(()=>[{label:t("editor.left"),value:"left",icon:"format_align_left"},{label:t("editor.center"),value:"center",icon:"format_align_center"},{label:t("editor.right"),value:"right",icon:"format_align_right"}]);function i(s){r(e.editor,"textAlign",{textAlign:s.value})}return(s,a)=>(l.openBlock(),l.createElementBlock("div",Dx,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(o.value,(c,d)=>{var u;return l.openBlock(),l.createBlock(ve,{key:d,icon:c.icon,tooltip:c.label,"content-class":{"is-active":(u=n.editor)==null?void 0:u.isActive({textAlign:c.value})},onClick:p=>i(c)},null,8,["icon","tooltip","content-class","onClick"])}),128))]))}}),Bx={class:"o-back-color-dropdown o-button-group"},Lx=l.defineComponent({__name:"OBackColorDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=Ee(),{run:r}=Ie(),o=l.ref(null),i=l.ref("#ffec3d");function s(){a(i.value)}function a(c){o.value.setShow(!1),i.value=c,r(e.editor,"backColor",{color:c})}return(c,d)=>(l.openBlock(),l.createBlock(l.unref(We),{ref_key:"popover",ref:o,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:l.withCtx(()=>[l.createVNode(l.unref(br),{trigger:"hover"},{trigger:l.withCtx(()=>[l.createElementVNode("div",Bx,[l.createVNode(l.unref(vt),{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},8,["onClick"]),l.createVNode(l.unref(vt),{icon:"arrow_drop_down",class:"o-command-btn"})])]),default:l.withCtx(()=>[l.createTextVNode(" "+l.toDisplayString(l.unref(t)("editor.highlightColor")),1)]),_:1})]),default:l.withCtx(()=>{var u;return[l.createVNode(l.unref(Rs),{"default-color":"","default-label":l.unref(t)("editor.noColor"),"active-color":(u=n.editor)==null?void 0:u.getAttributes("highlight").color,onSelect:a},null,8,["default-label","active-color"])]}),_:1},512))}}),Px=l.defineComponent({__name:"OFontFamilyDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=Ee(),{run:r}=Ie(),o=l.ref(null),i=l.computed(()=>[{label:t("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=o.value)==null||c.setShow(!1),r(e.editor,"fontFamily",{fontFamily:a})}return(a,c)=>(l.openBlock(),l.createBlock(l.unref(We),{ref_key:"popover",ref:o,class:"o-simple-command-btn","tippy-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:l.withCtx(()=>[l.createVNode(l.unref(lt),{icon:"format_font","content-class":"o-font-family-dropdown dropdown",tooltip:l.unref(t)("editor.fontFamily")},{default:l.withCtx(()=>[l.createVNode(l.unref(re),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:l.withCtx(()=>[l.createVNode(l.unref(ln),{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(Gt),{key:0})):l.createCommentVNode("",!0),l.createVNode(l.unref(jt),{class:l.normalizeClass({"is-active":(p=n.editor)==null?void 0:p.isActive("textStyle",{fontFamily:d.value})}),onClick:f=>s(d.value)},{suffix:l.withCtx(()=>{var f;return[(f=n.editor)!=null&&f.isActive("textStyle",{fontFamily:d.value})?(l.openBlock(),l.createBlock(l.unref(re),{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))}}),$x={class:"o-fore-color-dropdown o-button-group"},Fx=l.defineComponent({__name:"OForeColorDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=Ee(),{run:r}=Ie(),o=l.ref(null),i=l.ref("#ff4d4f");function s(){a(i.value)}function a(c){var d;(d=o.value)==null||d.setShow(!1),i.value=c,r(e.editor,"foreColor",{color:c})}return(c,d)=>(l.openBlock(),l.createBlock(l.unref(We),{ref_key:"popover",ref:o,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:l.withCtx(()=>[l.createVNode(l.unref(br),null,{trigger:l.withCtx(()=>[l.createElementVNode("div",$x,[l.createVNode(l.unref(vt),{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},8,["onClick"]),l.createVNode(l.unref(vt),{icon:"arrow_drop_down",class:"o-command-btn"})])]),default:l.withCtx(()=>[l.createTextVNode(" "+l.toDisplayString(l.unref(t)("editor.textColor")),1)]),_:1})]),default:l.withCtx(()=>{var u;return[l.createVNode(l.unref(Rs),{"default-color":"","default-label":l.unref(t)("editor.defaultColor"),"active-color":(u=n.editor)==null?void 0:u.getAttributes("textStyle").color,onSelect:a},null,8,["default-label","active-color"])]}),_:1},512))}}),zx=l.defineComponent({__name:"OHeadingDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=Ee(),{run:r}=Ie(),o=l.ref(null),i=l.computed(()=>[{label:t("editor.paragraph"),value:"paragraph",valueAlt:"",icon:"title"},{label:t("editor.heading1"),value:"heading",valueAlt:1,icon:"format_h1",separator:!0},{label:t("editor.heading2"),value:"heading",valueAlt:2,icon:"format_h2"},{label:t("editor.heading3"),value:"heading",valueAlt:3,icon:"format_h3"},{label:t("editor.heading4"),value:"heading",valueAlt:4,icon:"format_h4"},{label:t("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=o.value)==null||d.setShow(!1),r(e.editor,c.value,{level:c.valueAlt})}return(c,d)=>(l.openBlock(),l.createBlock(l.unref(We),{ref_key:"popover",ref:o,class:"o-simple-command-btn","tippy-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:l.withCtx(()=>[l.createVNode(l.unref(lt),{icon:"format_header_pound","content-class":"o-heading-dropdown dropdown",tooltip:l.unref(t)("editor.heading")},{default:l.withCtx(()=>[l.createVNode(l.unref(re),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:l.withCtx(()=>[l.createVNode(l.unref(ln),{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(Gt),{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(re),{name:u.icon},null,8,["name"])]),suffix:l.withCtx(()=>[s(u)?(l.openBlock(),l.createBlock(l.unref(re),{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))}}),Vx={class:"o-list-dropdown o-button-group"},Hx=l.defineComponent({__name:"OListDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=Ee(),{run:r}=Ie(),o=l.ref(null),i=l.ref();function s(){r(e.editor,i.value.value)}function a(d){o.value.setShow(!1),i.value=d,r(e.editor,d.value)}const c=l.computed(()=>[{label:t("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:t("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:t("editor.todoList"),value:"taskList",icon:"check_box"}]);return l.onMounted(()=>{i.value=c.value[0]}),(d,u)=>(l.openBlock(),l.createBlock(l.unref(We),{ref_key:"popover",ref:o,class:"o-simple-command-btn","tippy-class":"dropdown",size:"medium",trigger:"click","show-arrow":!1},{trigger:l.withCtx(()=>[l.createVNode(l.unref(br),{trigger:"hover"},{trigger:l.withCtx(()=>{var p;return[l.createElementVNode("div",Vx,[l.createVNode(l.unref(vt),{icon:(p=i.value)==null?void 0:p.icon,class:"o-command-btn",onClick:l.withModifiers(s,["stop"])},null,8,["icon","onClick"]),l.createVNode(l.unref(vt),{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(ln),{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=n.editor)==null?void 0:h.isActive(p.value)}),onClick:m=>a(p)},{prefix:l.withCtx(()=>[l.createVNode(l.unref(re),{name:p.icon},null,8,["name"])]),suffix:l.withCtx(()=>{var m;return[(m=n.editor)!=null&&m.isActive(p.value)?(l.openBlock(),l.createBlock(l.unref(re),{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))}}),Ux={class:"o-list-group"},Wx=l.defineComponent({__name:"OListGroup",props:{editor:{type:Sn,required:!0}},setup(n){const e=n,{tr:t}=Ee(),{run:r}=Ie(),o=l.computed(()=>[{label:t("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:t("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:t("editor.todoList"),value:"taskList",icon:"check_box"}]);function i(s){r(e.editor,s.value)}return(s,a)=>(l.openBlock(),l.createElementBlock("div",Ux,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(o.value,(c,d)=>{var u;return l.openBlock(),l.createBlock(ve,{key:d,icon:c.icon,tooltip:c.label,"content-class":{"is-active":(u=n.editor)==null?void 0:u.isActive(c.value)},onClick:p=>i(c)},null,8,["icon","tooltip","content-class","onClick"])}),128))]))}}),qx=l.defineComponent({__name:"OLinkBtn",props:{editor:{type:Sn,required:!0}},setup(n){const e=n,{tr:t}=Ee(),{run:r}=Ie(),o=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=o.value)==null||p.setShow(!1)}function u(p){var f;p?r(e.editor,"linkSet",{href:p,target:a.value?"_blank":""}):r(e.editor,"linkUnset"),(f=o.value)==null||f.setShow(!1)}return(p,f)=>(l.openBlock(),l.createBlock(l.unref(We),{ref_key:"popover",ref:o,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(lt),{icon:"link","content-class":{"is-active":(h=n.editor)==null?void 0:h.isActive("link")},tooltip:l.unref(t)("editor.hyperlink")},null,8,["content-class","tooltip"])]}),default:l.withCtx(()=>[i.value?(l.openBlock(),l.createBlock(l.unref(Dc),{key:0,title:l.unref(t)("editor.hyperlink"),val:s.value,icon:"link",onCancel:d,onConfirm:u},{"header-right":l.withCtx(()=>[l.createVNode(l.unref(Ic),{modelValue:a.value,"onUpdate:modelValue":f[0]||(f[0]=h=>a.value=h),label:l.unref(t)("link.open_in_new_tab")},null,8,["modelValue","label"])]),_:1},8,["title","val"])):l.createCommentVNode("",!0)]),_:1},8,["show"]))}}),Kx=l.defineComponent({__name:"OLinkEditBtn",props:{editor:{type:Sn,required:!0}},setup(n){const e=n,{tr:t}=Ee(),{run:r}=Ie(),o=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=o.value)==null||p.setShow(!1)}function u(p){var f;p?r(e.editor,"linkSet",{href:p,target:a.value?"_blank":""}):r(e.editor,"linkUnset"),(f=o.value)==null||f.setShow(!1)}return(p,f)=>(l.openBlock(),l.createBlock(l.unref(We),{ref_key:"popover",ref:o,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(lt),{icon:"edit",tooltip:l.unref(t)("link.edit")},null,8,["tooltip"])]),default:l.withCtx(()=>[i.value?(l.openBlock(),l.createBlock(l.unref(Dc),{key:0,title:l.unref(t)("link.edit"),val:s.value,icon:"link",onCancel:d,onConfirm:u},{"header-right":l.withCtx(()=>[l.createVNode(l.unref(Ic),{modelValue:a.value,"onUpdate:modelValue":f[0]||(f[0]=h=>a.value=h),label:l.unref(t)("link.open_in_new_tab")},null,8,["modelValue","label"])]),_:1},8,["title","val"])):l.createCommentVNode("",!0)]),_:1},8,["show"]))}}),Gx=l.defineComponent({__name:"OLinkOpenBtn",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=Ee();function r(){var i;const o=(i=e.editor)==null?void 0:i.getAttributes("link");o!=null&&o.href&&window.open(o.href,"target")}return(o,i)=>(l.openBlock(),l.createBlock(ve,{icon:"open_in_new",tooltip:l.unref(t)("link.open"),"content-class":"o-link-open-btn",onClick:r},null,8,["tooltip"]))}}),jx=["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","columns","aiViewer"],Jx=["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"],Yx=["bold","strike","text-color-dropdown","clearFormat","separator","list-group","link","callout","separator","align-dropdown","more"],Xx=["link-open","link-edit","linkUnset"],Zx=["align-group","separator","link"],Qx=["align-group","separator","link-open","link-edit","linkUnset"],eN=["heading","separator","italic","underline","font-family","separator","code","blockquote"],tN=["table-group","separator","bold","italic","font-family","text-color-dropdown","separator","align-group"],nN=["style-dropdown","separator","bold","italic","text-color-dropdown","separator","align-dropdown"],rN={class:"o-command-btn"},oN={class:"o-more-bubble"},iN=l.defineComponent({__name:"OMoreBubble",props:{editor:{type:Sn,required:!0}},setup(n){const e=l.ref();return(t,r)=>(l.openBlock(),l.createBlock(l.unref(We),{ref_key:"popover",ref:e,offset:[4,10],class:"o-simple-command-btn","tippy-class":"o-more-bubble-popover",placement:"top-end",size:"medium",trigger:"mouseenter"},{trigger:l.withCtx(()=>[l.createElementVNode("div",rN,[l.createVNode(l.unref(re),{name:"more_horiz"})])]),default:l.withCtx(()=>[l.createElementVNode("section",oN,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(eN),(o,i)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:i},[o==="separator"?(l.openBlock(),l.createBlock(l.unref(Gt),{key:0,vertical:""})):typeof o=="string"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(l.unref(Bs)(o)),{key:1,name:o,editor:n.editor},null,8,["name","editor"])):l.createCommentVNode("",!0)],64))),128))])]),_:1},512))}}),sN=l.defineComponent({__name:"OStyleDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=Ee(),{run:r}=Ie(),o=l.ref(null),i=l.computed(()=>[{label:t("editor.paragraph"),value:"paragraph",icon:"title"},{label:t("editor.heading1"),value:"heading",icon:"format_h1",options:{level:1}},{label:t("editor.heading2"),value:"heading",icon:"format_h2",options:{level:2}},{label:t("editor.heading3"),value:"heading",icon:"format_h3",options:{level:3}},{label:t("editor.todoList"),value:"taskList",icon:"check_box"},{label:t("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:t("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:t("editor.blockquote"),value:"blockquote",icon:"format_quote_open"},{label:t("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){o.value.setShow(!1),r(e.editor,c.value,c.options)}return(c,d)=>(l.openBlock(),l.createBlock(l.unref(We),{ref_key:"popover",ref:o,class:"o-simple-command-btn","tippy-class":"dropdown",trigger:"click"},{trigger:l.withCtx(()=>[l.createVNode(l.unref(lt),{icon:"format_paint","content-class":"o-style-dropdown o-command-btn dropdown",tooltip:l.unref(t)("label.styles")},{default:l.withCtx(()=>[l.createVNode(l.unref(re),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:l.withCtx(()=>[l.createVNode(l.unref(ln),{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(Gt),{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(re),{name:u.icon},null,8,["name"])]),suffix:l.withCtx(()=>[s(u)?(l.openBlock(),l.createBlock(l.unref(re),{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))}}),aN=l.defineComponent({__name:"OTableBtn",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=Ee(),{run:r}=Ie(),o=l.ref(null);function i(s){var a;(a=o.value)==null||a.setShow(!1),r(e.editor,"tableInsert",s)}return(s,a)=>(l.openBlock(),l.createBlock(l.unref(We),{ref_key:"popover",ref:o,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:""},{trigger:l.withCtx(()=>[l.createVNode(l.unref(lt),{icon:"window","content-class":"o-table-btn",tooltip:l.unref(t)("table.insert")},null,8,["tooltip"])]),default:l.withCtx(()=>[l.createVNode(l.unref(jh),{onSelect:i})]),_:1},512))}}),lN={class:"o-table-group"},cN={"align-dropdown":Rx,"align-group":Ix,"back-color":Lx,"font-family":Px,"fore-color":Fx,heading:zx,"list-dropdown":Hx,"list-group":Wx,link:qx,"link-edit":Kx,"link-open":Gx,more:iN,"style-dropdown":sN,table:aN,"table-group":l.defineComponent({__name:"OTableGroup",props:{editor:{type:Sn,required:!0}},setup(n){const{tr:e}=Ee(),{run:t}=Ie();return(r,o)=>{var i,s;return l.openBlock(),l.createElementBlock("section",lN,[(i=n.editor)!=null&&i.can().mergeCells()?(l.openBlock(),l.createBlock(l.unref(ve),{key:0,icon:"cell_merge",tooltip:l.unref(e)("table.merge"),onClick:o[0]||(o[0]=a=>l.unref(t)(n.editor,"tableMergeCells"))},null,8,["tooltip"])):l.createCommentVNode("",!0),(s=n.editor)!=null&&s.can().splitCell()?(l.openBlock(),l.createBlock(l.unref(ve),{key:1,icon:"splitscreen_left",tooltip:l.unref(e)("table.split"),onClick:o[1]||(o[1]=a=>l.unref(t)(n.editor,"tableSplitCell"))},null,8,["tooltip"])):l.createCommentVNode("",!0),l.createVNode(l.unref(Jh),{editor:n.editor},null,8,["editor"])])}}}),"text-color-dropdown":l.defineComponent({__name:"OTextColorDropdown",props:{editor:{type:Sn,required:!0}},setup(n){const e=n,{tr:t}=Ee(),{run:r}=Ie(),o=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)),o.value.setShow(!1),r(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(We),{ref_key:"popover",ref:o,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:l.withCtx(()=>[l.createVNode(l.unref(lt),{icon:"format_text","content-class":"o-text-color-dropdown dropdown",tooltip:l.unref(t)("editor.textColor")},{default:l.withCtx(()=>[l.createVNode(l.unref(re),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:l.withCtx(()=>{var u;return[l.createVNode(l.unref(Yh),{"fore-color":i.value,"back-color":s.value,"default-label":l.unref(t)("editor.defaultColor"),"active-color":(u=n.editor)==null?void 0:u.getAttributes("textStyle").color,onSelect:a},null,8,["fore-color","back-color","default-label","active-color"])]}),_:1},512))}}),"text-format-dropdown":l.defineComponent({__name:"OTextFormatDropdown",props:{editor:{type:Sn,required:!0}},setup(n){const e=n,{tr:t}=Ee(),{run:r}=Ie(),o=l.ref(),i=l.computed(()=>[{label:t("editor.strikethrough"),value:"strike",icon:"format_strikethrough"},{label:t("editor.underline"),value:"underline",icon:"format_underlined"},{label:t("editor.code"),value:"code",icon:"code"}]);function s(a){var c;(c=o.value)==null||c.setShow(!1),r(e.editor,a)}return(a,c)=>(l.openBlock(),l.createBlock(l.unref(We),{ref_key:"popover",ref:o,class:"o-simple-command-btn","tippy-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:l.withCtx(()=>[l.createVNode(l.unref(lt),{icon:"title","content-class":"o-text-format-dropdown dropdown",tooltip:l.unref(t)("editor.textFormat")},{default:l.withCtx(()=>[l.createVNode(l.unref(re),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:l.withCtx(()=>[l.createVNode(l.unref(ln),{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=n.editor)==null?void 0:p.isActive(d.value)}),onClick:f=>s(d.value)},{prefix:l.withCtx(()=>[l.createVNode(l.unref(re),{name:d.icon},null,8,["name"])]),suffix:l.withCtx(()=>{var f;return[(f=n.editor)!=null&&f.isActive(d.value)?(l.openBlock(),l.createBlock(l.unref(re),{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))}})},Bs=n=>cN[n]||Y_,dN={class:"o-main-menu"},uN={class:"left"},pN={class:"right"},tm=l.defineComponent({__name:"OMainMenu",props:{editor:{type:Object},menu:{type:Array,default:function(){return[]}}},setup(n){const e=n,t=l.computed(()=>{var o;let r=e.menu;return(o=e.editor)!=null&&o.isActive("table")&&(r=Jx),r.length>0?r:jx});return(r,o)=>(l.openBlock(),l.createElementBlock("section",dN,[l.createElementVNode("section",uN,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(t.value,(i,s)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:s},[i==="separator"?(l.openBlock(),l.createBlock(l.unref(Gt),{key:0,vertical:""})):typeof i=="string"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(l.unref(Bs)(i)),{key:1,name:i,editor:n.editor},null,8,["name","editor"])):(l.openBlock(),l.createBlock(l.resolveDynamicComponent(i),{key:2,editor:n.editor},null,8,["editor"]))],64))),128)),l.renderSlot(r.$slots,"left")]),l.createElementVNode("section",pN,[l.renderSlot(r.$slots,"right")])]))}}),fN={key:0,class:"o-bubble-menu"},hN={class:"container"},mN=l.defineComponent({__name:"OBubbleMenu",props:{editor:{type:Object},menu:{type:Array,default:function(){return[]}},tableToolbar:{type:Array,default:function(){return[]}},menuClass:{type:String,default:""}},setup(n){const e=n,{tr:t}=Ee(),{theme:r}=hi(),o=l.ref(!1),i=l.ref({duration:100,placement:"top",role:"popover",arrow:!1,onShow:()=>{o.value=!1}});function s(){o.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!!go(g,m)}function c({editor:f,view:h,state:m,oldState:g,from:b,to:y}){var $;const{doc:E,selection:C}=m,{empty:k}=C,S=!E.textBetween(b,y).length&&ms(m.selection);if(!h.hasFocus()||k||S&&f.isActive("link")&&!f.isActive("image"))return!1;const _=["image"],D=["toc","video","model-viewer"],B=C.node,v=($=B==null?void 0:B.type)==null?void 0:$.name;return!(f.isActive("codeBlock")||D.indexOf(v)>=0||v&&!_.includes(v))}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!o.value&&d.value&&!((f=e.editor)!=null&&f.isActive("image"))}),p=l.computed(()=>{var h,m;let f=e.menu;return o.value||((h=e.editor)!=null&&h.isActive("image")?f=d.value?Qx:Zx:(m=e.editor)!=null&&m.isActive("table")?f=tN:d.value&&(f=Xx)),f.length>0?f:Yx});return l.onMounted(()=>{o.value=!1}),(f,h)=>n.editor?(l.openBlock(),l.createElementBlock("section",fN,[l.createVNode(l.unref(UC),{class:l.normalizeClass(["bubble-menu",n.menuClass]),editor:n.editor,"should-show":c,"tippy-options":i.value},{default:l.withCtx(()=>[l.createElementVNode("section",hN,[u.value?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[l.createVNode(l.unref(ve),{icon:"arrow_back",tooltip:l.unref(t)("link.back"),onClick:s},null,8,["tooltip"]),l.createVNode(l.unref(Gt),{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(Gt),{key:0,vertical:""})):typeof m=="string"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(l.unref(Bs)(m)),{key:1,name:m,editor:n.editor},null,8,["name","editor"])):(l.openBlock(),l.createBlock(l.resolveDynamicComponent(m),{key:2,editor:n.editor},null,8,["editor"]))],64))),128))])]),_:1},8,["class","editor","tippy-options"])])):l.createCommentVNode("",!0)}}),gN={key:0,class:"o-floating-menu"},bN={class:"container"},yN=l.defineComponent({__name:"OFloatingMenu",props:{editor:{type:Object},menu:{type:Array,default:function(){return[]}},tableToolbar:{type:Array,default:function(){return[]}},menuClass:{type:String,default:""}},setup(n){const e=n,t=l.ref(!1),r=l.ref({arrow:!1,duration:100,role:"popover",placement:"right",offset:[0,168]});function o(){t.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!!go(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(()=>!t.value&&s.value),c=l.computed(()=>{let d=e.menu;return d.length>0?d:nN});return(d,u)=>n.editor?(l.openBlock(),l.createElementBlock("section",gN,[l.createVNode(l.unref(KC),{class:l.normalizeClass(["floating-menu",n.menuClass]),editor:n.editor,"tippy-options":r.value},{default:l.withCtx(()=>[l.createElementVNode("section",bN,[a.value?(l.openBlock(),l.createBlock(l.unref(ve),{key:0,icon:"arrow_back",onClick:o})):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(Gt),{key:0,vertical:""})):typeof p=="string"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(l.unref(Bs)(p)),{key:1,name:p,editor:n.editor},null,8,["name","editor"])):(l.openBlock(),l.createBlock(l.resolveDynamicComponent(p),{key:2,editor:n.editor},null,8,["editor"]))],64))),128))])]),_:1},8,["class","editor","tippy-options"])])):l.createCommentVNode("",!0)}});function Bc(n,e){const t=e==null?void 0:e.posAtCoords(n);if(!t)return;let r=Ls(t.pos,e);if(r!==e.dom){for(;r&&r.parentNode&&r.parentNode!==e.dom;)r=r.parentNode;if(r)return r}}function Ls(n,e){return e.nodeDOM(n)||e.domAtPos(n).node}function Lc(n,e){const t=Bc(n,e);if(t&&t.nodeType===1){const r=e.docView,o=r.nearestDesc(t,!0);return!o||o===r?null:o.posBefore}return null}function kN(n,e){let t,r;const o=e.resolve(n.from).node().type.spec.group==="blockContent",i=e.resolve(n.to).node().type.spec.group==="blockContent",s=Math.min(n.$anchor.depth,n.$head.depth);if(o&&i){const a=n.$from.start(s-1),c=n.$to.end(s-1);t=e.resolve(a-1).pos,r=e.resolve(c+1).pos}else t=n.from,r=n.to;return{from:t,to:r}}function EN(n,e){const t=Lc(n,e.view);return t&&t>=0?{node:e.state.doc.nodeAt(t),pos:t}:{node:null,pos:t}}const Ps=new Fe("sideMenu");class wN{constructor(){$e(this,"hovered",!1);$e(this,"coords",{left:0,top:0});$e(this,"className","")}init(e){return this}apply({tr:e,oldState:t,newState:r}){return e.docChanged?this:this}setHover(e,t,r=""){this.hovered=e,this.coords=t,this.className=r}}class CN{constructor({editor:e,element:t,view:r,tippyOptions:o={},updateDelay:i=250}){$e(this,"editor");$e(this,"element");$e(this,"view");$e(this,"preventHide",!1);$e(this,"tippy");$e(this,"tippyOptions");$e(this,"updateDelay");$e(this,"updateDebounceTimer");$e(this,"mousedownHandler",()=>{this.preventHide=!0});$e(this,"onDragStart",e=>{this.hide()});$e(this,"blurHandler",({event:e})=>{var t;e!=null&&e.relatedTarget&&((t=this.element.parentNode)!=null&&t.contains(e.relatedTarget))||this.hide()});$e(this,"tippyBlurHandler",e=>{this.blurHandler({event:e})});$e(this,"handleDebouncedUpdate",(e,t)=>{const r=!(t!=null&&t.selection.eq(e.state.selection)),o=!(t!=null&&t.doc.eq(e.state.doc));!r&&!o||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,r,o,t)},this.updateDelay))});$e(this,"updateHandler",(e,t,r,o)=>{var u,p;const{state:i,composing:s}=e,{coords:a}=Ps.getState(i),c=Bc(a,e),d=Lc(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=t,this.view=r,this.updateDelay=i,this.view.dom.addEventListener("dragstart",this.onDragStart),this.tippyOptions=o,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,t=!!e.parentElement;this.tippy||!t||(this.tippy=On(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,t){const{state:r}=e,o=!(t!=null&&t.selection.eq(e.state.selection)),i=!(t!=null&&t.doc.eq(e.state.doc));this.updateHandler(e,o,i,t)}show(){var e;(e=this.tippy)==null||e.show()}hide(){var e;(e=this.tippy)==null||e.hide()}destroy(){var e,t;(e=this.tippy)!=null&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(t=this.tippy)==null||t.destroy(),this.view.dom.removeEventListener("dragstart",this.onDragStart)}}const _N=(n,e)=>{if(!n.dataTransfer)return;const t=e.view,r=t.dom.getBoundingClientRect(),o={left:r.left+r.width/2,top:n.clientY},i=Lc(o,t);if(i===null)return;const s=t.state.selection,a=t.state.doc;kN(s,a),t.dispatch(t.state.tr.setSelection(K.create(t.state.doc,i))),xN(t,i);const c=t.state.selection.content(),{dom:d,text:u}=t.serializeForClipboard(c);n.dataTransfer.clearData(),n.dataTransfer.setData("text/html",d.innerHTML),n.dataTransfer.setData("text/plain",u),n.dataTransfer.effectAllowed="move",n.dataTransfer.setDragImage(Kr,0,0),t.dragging={slice:c,move:!0}},SN=(n,e)=>{nm()};let Kr;function xN(n,e,t=e){const r=n.domAtPos(e).node.cloneNode(!0),o=n.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===n.dom)return f;f=h,h=f.parentElement}return f};let a=-1,c=-1;e===t?(a=i(o,s(Ls(e,n))),c=a):(a=i(o,s(Ls(e+1,n))),c=i(o,s(Ls(t-1,n))));for(let p=o.childElementCount-1;p>=0;p--)(p>a||p<c)&&r.removeChild(r.children[p]);nm(),Kr=r;const u=n.dom.className.split(" ").filter(p=>p!=="ProseMirror"&&p!=="yiitap-root"&&p!=="yiitap-editor").join(" ");Kr.className+=" yiitap-dragging-preview "+u,document.body.appendChild(Kr)}function nm(){Kr!==void 0&&(document.body.removeChild(Kr),Kr=void 0)}class NN{constructor(e){$e(this,"options");$e(this,"plugin");$e(this,"sideMenuView");const t=new wN;this.options=e,this.plugin=new Ne({key:Ps,props:{handleDOMEvents:{mouseover(r,o){const i={left:o.clientX,top:o.clientY},s=Bc(i,r),a=(s==null?void 0:s.className)||"",c=t.className;a.indexOf("o-table-wrapper-view")>=0&&c.indexOf("o-table-wrapper-view")>=0||(t.setHover(!0,i,a),r.dispatch(r.state.tr.setMeta(Ps,t)))}}},state:{init(r,o){return t.init(o)},apply(r,o,i,s){return t.apply({tr:r,oldState:i,newState:s})}},view:r=>(this.sideMenuView=new CN({view:r,...e}),this.sideMenuView)})}dragstart(e){_N(e,this.options.editor)}dragend(e){SN(e,this.options.editor)}}const TN=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(n,{expose:e,slots:t}){const r=l.ref(null),o=l.ref(),i=a=>{var c;(c=o.value)==null||c.dragstart(a)},s=a=>{var c;(c=o.value)==null||c.dragend(a)};return l.onMounted(()=>{const{pluginKey:a,editor:c,updateDelay:d,tippyOptions:u}=n;o.value=new NN({updateDelay:d,editor:c,element:r.value,pluginKey:a,tippyOptions:u}),c.registerPlugin(o.value.plugin)}),l.onBeforeUnmount(()=>{const{pluginKey:a,editor:c}=n;c.unregisterPlugin(a)}),e({...n,dragstart:i,dragend:s}),()=>{var a;return l.h("div",{ref:r},(a=t.default)==null?void 0:a.call(t))}}}),ON={key:0,class:"o-side-menu"},MN={class:"container"},AN=l.defineComponent({__name:"OSideMenu",props:{editor:{type:Sn,required:!0},menuClass:{type:String,default:""}},setup(n){const e=n,t=l.ref(null),r=l.ref(null),o=l.ref(0),i=l.computed(()=>({arrow:!1,duration:100,placement:"left"})),s=l.computed(()=>({editor:e.editor,node:r.value,decorations:[],selected:!1,extension:{},getPos:()=>o.value,pos:o.value,updateAttributes:c,deleteNode:a,view:void 0,innerDecorations:[],HTMLAttributes:void 0}));function a(){var m,g;const f=o.value,h=f+((m=r.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(o.value,void 0,{...(g=r.value)==null?void 0:g.attrs,...f}),!0})}function d({editor:f,transaction:h}){let m={left:0,top:0};const g=Ps.getState(e.editor.view.state);if(g){m=g.coords;const b=EN(m,f);b.node&&b.pos>0&&(r.value=b.node,o.value=b.pos)}}function u(f){var h;(h=t.value)==null||h.dragstart(f)}function p(f){var h;(h=t.value)==null||h.dragend(f)}return l.onMounted(()=>{var f;(f=e.editor)==null||f.on("transaction",d)}),(f,h)=>n.editor?(l.openBlock(),l.createElementBlock("section",ON,[l.createVNode(l.unref(TN),{ref_key:"menu",ref:t,class:l.normalizeClass(["side-menu",n.menuClass]),editor:n.editor,"tippy-options":i.value},{default:l.withCtx(()=>[l.createElementVNode("section",MN,[r.value?(l.openBlock(),l.createBlock(l.unref(Qh),l.normalizeProps(l.mergeProps({key:0},s.value)),null,16)):l.createCommentVNode("",!0),r.value?(l.openBlock(),l.createBlock(l.unref(em),l.mergeProps({key:1},s.value,{onDragstart:u,onDragend:p}),null,16)):l.createCommentVNode("",!0)])]),_:1},8,["class","editor","tippy-options"])])):l.createCommentVNode("",!0)}}),vN=l.defineComponent({__name:"view",props:st,setup(n){const e=n;return(t,r)=>(l.openBlock(),l.createBlock(l.unref(An),l.mergeProps(e,{class:"o-blockquote-view"}),{default:l.withCtx(()=>[l.createElementVNode("blockquote",null,[l.createVNode(l.unref(Gn))])]),_:1},16))}}),RN=Oh.extend({draggable:!0,addNodeView(){return hn(vN)}}),DN={class:"callout-container"},IN={class:"callout-icon"},BN={class:"callout-content"},LN=l.defineComponent({__name:"view",props:st,setup(n){const e=n,{theme:t}=hi(),r=l.ref(!1),o=l.ref(!1),i=l.ref({}),s=l.computed(()=>{e.editor.isActive("callout");const{selection:b}=e.editor.view.state,y=b.from,E=e.getPos(),C=E+e.node.nodeSize;return y>=E&&y<=C});l.computed(()=>e.node.attrs);const a=l.computed({get(){return e.node.attrs.backColor},set(b){e.updateAttributes({backColor:b})}}),c=l.computed({get(){return e.node.attrs.backColorDark},set(b){e.updateAttributes({backColorDark:b})}}),d=l.computed({get(){return e.node.attrs.borderColor},set(b){e.updateAttributes({borderColor:b})}}),u=l.computed({get(){return e.node.attrs.borderColorDark},set(b){e.updateAttributes({borderColorDark:b})}}),p=l.computed(()=>t.value==="dark"?c.value:a.value),f=l.computed(()=>t.value==="dark"?u.value:d.value);function h(b){switch(r.value=!1,b.value){case"palette":g(!0);break}}function m(b){r.value=!0,i.value=b}function g(b){o.value=b}return l.watch(s,b=>{g(b)}),(b,y)=>(l.openBlock(),l.createBlock(l.unref(An),l.mergeProps(e,{class:"o-callout-view",style:`--callout-border-color: ${f.value}; --callout-back-color: ${p.value}`,onContextmenu:l.withModifiers(m,["prevent"])}),{default:l.withCtx(()=>[l.createElementVNode("div",DN,[l.createElementVNode("div",IN,l.toDisplayString(b.node.attrs.icon),1),l.createElementVNode("div",BN,[l.createVNode(l.unref(Gn))]),l.createVNode(l.unref(vs),{modelValue:r.value,"onUpdate:modelValue":y[0]||(y[0]=E=>r.value=E),event:i.value},{default:l.withCtx(()=>[l.createVNode(l.unref(qr),l.mergeProps(e,{onAction:h}),null,16)]),_:1},8,["modelValue","event"])])]),_:1},16,["style","onContextmenu"]))}}),PN=Ge.create({name:"callout",group:"block",content:"block+",draggable:!0,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:n}){return["div",Se(n,{"data-type":"callout"}),0]},addCommands(){return{setCallout:()=>({commands:n})=>n.wrapIn(this.name),toggleCallout:()=>({commands:n})=>n.toggleWrap(this.name),unsetCallout:()=>({commands:n})=>n.lift(this.name)}},addNodeView(){return hn(LN)}});function $N(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function rm(n){return n instanceof Map?n.clear=n.delete=n.set=function(){throw new Error("map is read-only")}:n instanceof Set&&(n.add=n.clear=n.delete=function(){throw new Error("set is read-only")}),Object.freeze(n),Object.getOwnPropertyNames(n).forEach(e=>{const t=n[e],r=typeof t;(r==="object"||r==="function")&&!Object.isFrozen(t)&&rm(t)}),n}class om{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function im(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function yr(n,...e){const t=Object.create(null);for(const r in n)t[r]=n[r];return e.forEach(function(r){for(const o in r)t[o]=r[o]}),t}const FN="</span>",sm=n=>!!n.scope,zN=(n,{prefix:e})=>{if(n.startsWith("language:"))return n.replace("language:","language-");if(n.includes(".")){const t=n.split(".");return[`${e}${t.shift()}`,...t.map((r,o)=>`${r}${"_".repeat(o+1)}`)].join(" ")}return`${e}${n}`};class VN{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=im(e)}openNode(e){if(!sm(e))return;const t=zN(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){sm(e)&&(this.buffer+=FN)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}}const am=(n={})=>{const e={children:[]};return Object.assign(e,n),e};class Pc{constructor(){this.rootNode=am(),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 t=am({scope:e});this.add(t),this.stack.push(t)}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,t){return typeof t=="string"?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(r=>this._walk(e,r)),e.closeNode(t)),e}static _collapse(e){typeof e!="string"&&e.children&&(e.children.every(t=>typeof t=="string")?e.children=[e.children.join("")]:e.children.forEach(t=>{Pc._collapse(t)}))}}class HN extends Pc{constructor(e){super(),this.options=e}addText(e){e!==""&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){const r=e.root;t&&(r.scope=`language:${t}`),this.add(r)}toHTML(){return new VN(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function bi(n){return n?typeof n=="string"?n:n.source:null}function lm(n){return Gr("(?=",n,")")}function UN(n){return Gr("(?:",n,")*")}function WN(n){return Gr("(?:",n,")?")}function Gr(...n){return n.map(t=>bi(t)).join("")}function qN(n){const e=n[n.length-1];return typeof e=="object"&&e.constructor===Object?(n.splice(n.length-1,1),e):{}}function $c(...n){return"("+(qN(n).capture?"":"?:")+n.map(r=>bi(r)).join("|")+")"}function cm(n){return new RegExp(n.toString()+"|").exec("").length-1}function KN(n,e){const t=n&&n.exec(e);return t&&t.index===0}const GN=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Fc(n,{joinWith:e}){let t=0;return n.map(r=>{t+=1;const o=t;let i=bi(r),s="";for(;i.length>0;){const a=GN.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])+o):(s+=a[0],a[0]==="("&&t++)}return s}).map(r=>`(${r})`).join(e)}const jN=/\b\B/,dm="[a-zA-Z]\\w*",zc="[a-zA-Z_]\\w*",um="\\b\\d+(\\.\\d+)?",pm="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",fm="\\b(0b[01]+)",JN="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",YN=(n={})=>{const e=/^#![ ]*\//;return n.binary&&(n.begin=Gr(e,/.*\b/,n.binary,/\b.*/)),yr({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(t,r)=>{t.index!==0&&r.ignoreMatch()}},n)},yi={begin:"\\\\[\\s\\S]",relevance:0},XN={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[yi]},ZN={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[yi]},QN={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/},$s=function(n,e,t={}){const r=yr({scope:"comment",begin:n,end:e,contains:[]},t);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const o=$c("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:Gr(/[ ]+/,"(",o,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},e1=$s("//","$"),t1=$s("/\\*","\\*/"),n1=$s("#","$"),r1={scope:"number",begin:um,relevance:0},o1={scope:"number",begin:pm,relevance:0},i1={scope:"number",begin:fm,relevance:0},s1={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[yi,{begin:/\[/,end:/\]/,relevance:0,contains:[yi]}]},a1={scope:"title",begin:dm,relevance:0},l1={scope:"title",begin:zc,relevance:0},c1={begin:"\\.\\s*"+zc,relevance:0};var Fs=Object.freeze({__proto__:null,APOS_STRING_MODE:XN,BACKSLASH_ESCAPE:yi,BINARY_NUMBER_MODE:i1,BINARY_NUMBER_RE:fm,COMMENT:$s,C_BLOCK_COMMENT_MODE:t1,C_LINE_COMMENT_MODE:e1,C_NUMBER_MODE:o1,C_NUMBER_RE:pm,END_SAME_AS_BEGIN:function(n){return Object.assign(n,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:n1,IDENT_RE:dm,MATCH_NOTHING_RE:jN,METHOD_GUARD:c1,NUMBER_MODE:r1,NUMBER_RE:um,PHRASAL_WORDS_MODE:QN,QUOTE_STRING_MODE:ZN,REGEXP_MODE:s1,RE_STARTERS_RE:JN,SHEBANG:YN,TITLE_MODE:a1,UNDERSCORE_IDENT_RE:zc,UNDERSCORE_TITLE_MODE:l1});function d1(n,e){n.input[n.index-1]==="."&&e.ignoreMatch()}function u1(n,e){n.className!==void 0&&(n.scope=n.className,delete n.className)}function p1(n,e){e&&n.beginKeywords&&(n.begin="\\b("+n.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",n.__beforeBegin=d1,n.keywords=n.keywords||n.beginKeywords,delete n.beginKeywords,n.relevance===void 0&&(n.relevance=0))}function f1(n,e){Array.isArray(n.illegal)&&(n.illegal=$c(...n.illegal))}function h1(n,e){if(n.match){if(n.begin||n.end)throw new Error("begin & end are not supported with match");n.begin=n.match,delete n.match}}function m1(n,e){n.relevance===void 0&&(n.relevance=1)}const g1=(n,e)=>{if(!n.beforeMatch)return;if(n.starts)throw new Error("beforeMatch cannot be used with starts");const t=Object.assign({},n);Object.keys(n).forEach(r=>{delete n[r]}),n.keywords=t.keywords,n.begin=Gr(t.beforeMatch,lm(t.begin)),n.starts={relevance:0,contains:[Object.assign(t,{endsParent:!0})]},n.relevance=0,delete t.beforeMatch},b1=["of","and","for","in","not","or","if","then","parent","list","value"],y1="keyword";function hm(n,e,t=y1){const r=Object.create(null);return typeof n=="string"?o(t,n.split(" ")):Array.isArray(n)?o(t,n):Object.keys(n).forEach(function(i){Object.assign(r,hm(n[i],e,i))}),r;function o(i,s){e&&(s=s.map(a=>a.toLowerCase())),s.forEach(function(a){const c=a.split("|");r[c[0]]=[i,k1(c[0],c[1])]})}}function k1(n,e){return e?Number(e):E1(n)?0:1}function E1(n){return b1.includes(n.toLowerCase())}const mm={},jr=n=>{console.error(n)},gm=(n,...e)=>{console.log(`WARN: ${n}`,...e)},No=(n,e)=>{mm[`${n}/${e}`]||(console.log(`Deprecated as of ${n}. ${e}`),mm[`${n}/${e}`]=!0)},zs=new Error;function bm(n,e,{key:t}){let r=0;const o=n[t],i={},s={};for(let a=1;a<=e.length;a++)s[a+r]=o[a],i[a+r]=!0,r+=cm(e[a-1]);n[t]=s,n[t]._emit=i,n[t]._multi=!0}function w1(n){if(Array.isArray(n.begin)){if(n.skip||n.excludeBegin||n.returnBegin)throw jr("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),zs;if(typeof n.beginScope!="object"||n.beginScope===null)throw jr("beginScope must be object"),zs;bm(n,n.begin,{key:"beginScope"}),n.begin=Fc(n.begin,{joinWith:""})}}function C1(n){if(Array.isArray(n.end)){if(n.skip||n.excludeEnd||n.returnEnd)throw jr("skip, excludeEnd, returnEnd not compatible with endScope: {}"),zs;if(typeof n.endScope!="object"||n.endScope===null)throw jr("endScope must be object"),zs;bm(n,n.end,{key:"endScope"}),n.end=Fc(n.end,{joinWith:""})}}function _1(n){n.scope&&typeof n.scope=="object"&&n.scope!==null&&(n.beginScope=n.scope,delete n.scope)}function S1(n){_1(n),typeof n.beginScope=="string"&&(n.beginScope={_wrap:n.beginScope}),typeof n.endScope=="string"&&(n.endScope={_wrap:n.endScope}),w1(n),C1(n)}function x1(n){function e(s,a){return new RegExp(bi(s),"m"+(n.case_insensitive?"i":"")+(n.unicodeRegex?"u":"")+(a?"g":""))}class t{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+=cm(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const a=this.regexes.map(c=>c[1]);this.matcherRe=e(Fc(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 r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(a){if(this.multiRegexes[a])return this.multiRegexes[a];const c=new t;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 o(s){const a=new r;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;[u1,h1,S1,g1].forEach(u=>u(s,a)),n.compilerExtensions.forEach(u=>u(s,a)),s.__beforeBegin=null,[p1,f1,m1].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=hm(s.keywords,n.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=bi(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 N1(u==="self"?s:u)})),s.contains.forEach(function(u){i(u,c)}),s.starts&&i(s.starts,a),c.matcher=o(c),c}if(n.compilerExtensions||(n.compilerExtensions=[]),n.contains&&n.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return n.classNameAliases=yr(n.classNameAliases||{}),i(n)}function ym(n){return n?n.endsWithParent||ym(n.starts):!1}function N1(n){return n.variants&&!n.cachedVariants&&(n.cachedVariants=n.variants.map(function(e){return yr(n,{variants:null},e)})),n.cachedVariants?n.cachedVariants:ym(n)?yr(n,{starts:n.starts?yr(n.starts):null}):Object.isFrozen(n)?yr(n):n}var T1="11.10.0";class O1 extends Error{constructor(e,t){super(e),this.name="HTMLInjectionError",this.html=t}}const Vc=im,km=yr,Em=Symbol("nomatch"),M1=7,wm=function(n){const e=Object.create(null),t=Object.create(null),r=[];let o=!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:HN};function c(T){return a.noHighlightRe.test(T)}function d(T){let A=T.className+" ";A+=T.parentNode?T.parentNode.className:"";const z=a.languageDetectRe.exec(A);if(z){const j=v(z[1]);return j||(gm(i.replace("{}",z[1])),gm("Falling back to no-highlight mode for this block.",T)),j?z[1]:"no-highlight"}return A.split(/\s+/).find(j=>c(j)||v(j))}function u(T,A,z){let j="",ee="";typeof A=="object"?(j=T,z=A.ignoreIllegals,ee=A.language):(No("10.7.0","highlight(lang, code, ...args) has been deprecated."),No("10.7.0",`Please use highlight(code, options) instead.
117
+ https://github.com/highlightjs/highlight.js/issues/2277`),ee=T,j=A),z===void 0&&(z=!0);const he={code:j,language:ee};oe("before:highlight",he);const Oe=he.result?he.result:p(he.language,he.code,z);return Oe.code=he.code,oe("after:highlight",Oe),Oe}function p(T,A,z,j){const ee=Object.create(null);function he(L,V){return L.keywords[V]}function Oe(){if(!Z.keywords){Pe.addText(we);return}let L=0;Z.keywordPatternRe.lastIndex=0;let V=Z.keywordPatternRe.exec(we),pe="";for(;V;){pe+=we.substring(L,V.index);const Ce=le.case_insensitive?V[0].toLowerCase():V[0],nt=he(Z,Ce);if(nt){const[Zt,vi]=nt;if(Pe.addText(pe),pe="",ee[Ce]=(ee[Ce]||0)+1,ee[Ce]<=M1&&(It+=vi),Zt.startsWith("_"))pe+=V[0];else{const N=le.classNameAliases[Zt]||Zt;ze(V[0],N)}}else pe+=V[0];L=Z.keywordPatternRe.lastIndex,V=Z.keywordPatternRe.exec(we)}pe+=we.substring(L),Pe.addText(pe)}function ct(){if(we==="")return;let L=null;if(typeof Z.subLanguage=="string"){if(!e[Z.subLanguage]){Pe.addText(we);return}L=p(Z.subLanguage,we,!0,Dt[Z.subLanguage]),Dt[Z.subLanguage]=L._top}else L=h(we,Z.subLanguage.length?Z.subLanguage:null);Z.relevance>0&&(It+=L.relevance),Pe.__addSublanguage(L._emitter,L.language)}function Me(){Z.subLanguage!=null?ct():Oe(),we=""}function ze(L,V){L!==""&&(Pe.startScope(V),Pe.addText(L),Pe.endScope())}function Yt(L,V){let pe=1;const Ce=V.length-1;for(;pe<=Ce;){if(!L._emit[pe]){pe++;continue}const nt=le.classNameAliases[L[pe]]||L[pe],Zt=V[pe];nt?ze(Zt,nt):(we=Zt,Oe(),we=""),pe++}}function bt(L,V){return L.scope&&typeof L.scope=="string"&&Pe.openNode(le.classNameAliases[L.scope]||L.scope),L.beginScope&&(L.beginScope._wrap?(ze(we,le.classNameAliases[L.beginScope._wrap]||L.beginScope._wrap),we=""):L.beginScope._multi&&(Yt(L.beginScope,V),we="")),Z=Object.create(L,{parent:{value:Z}}),Z}function un(L,V,pe){let Ce=KN(L.endRe,pe);if(Ce){if(L["on:end"]){const nt=new om(L);L["on:end"](V,nt),nt.isMatchIgnored&&(Ce=!1)}if(Ce){for(;L.endsParent&&L.parent;)L=L.parent;return L}}if(L.endsWithParent)return un(L.parent,V,pe)}function yt(L){return Z.matcher.regexIndex===0?(we+=L[0],1):(Bt=!0,0)}function pn(L){const V=L[0],pe=L.rule,Ce=new om(pe),nt=[pe.__beforeBegin,pe["on:begin"]];for(const Zt of nt)if(Zt&&(Zt(L,Ce),Ce.isMatchIgnored))return yt(V);return pe.skip?we+=V:(pe.excludeBegin&&(we+=V),Me(),!pe.returnBegin&&!pe.excludeBegin&&(we=V)),bt(pe,L),pe.returnBegin?0:V.length}function Bn(L){const V=L[0],pe=A.substring(L.index),Ce=un(Z,L,pe);if(!Ce)return Em;const nt=Z;Z.endScope&&Z.endScope._wrap?(Me(),ze(V,Z.endScope._wrap)):Z.endScope&&Z.endScope._multi?(Me(),Yt(Z.endScope,L)):nt.skip?we+=V:(nt.returnEnd||nt.excludeEnd||(we+=V),Me(),nt.excludeEnd&&(we=V));do Z.scope&&Pe.closeNode(),!Z.skip&&!Z.subLanguage&&(It+=Z.relevance),Z=Z.parent;while(Z!==Ce.parent);return Ce.starts&&bt(Ce.starts,L),nt.returnEnd?0:V.length}function bn(){const L=[];for(let V=Z;V!==le;V=V.parent)V.scope&&L.unshift(V.scope);L.forEach(V=>Pe.openNode(V))}let Xt={};function yn(L,V){const pe=V&&V[0];if(we+=L,pe==null)return Me(),0;if(Xt.type==="begin"&&V.type==="end"&&Xt.index===V.index&&pe===""){if(we+=A.slice(V.index,V.index+1),!o){const Ce=new Error(`0 width match regex (${T})`);throw Ce.languageName=T,Ce.badRule=Xt.rule,Ce}return 1}if(Xt=V,V.type==="begin")return pn(V);if(V.type==="illegal"&&!z){const Ce=new Error('Illegal lexeme "'+pe+'" for mode "'+(Z.scope||"<unnamed>")+'"');throw Ce.mode=Z,Ce}else if(V.type==="end"){const Ce=Bn(V);if(Ce!==Em)return Ce}if(V.type==="illegal"&&pe==="")return 1;if(kn>1e5&&kn>V.index*3)throw new Error("potential infinite loop, way more iterations than matches");return we+=pe,pe.length}const le=v(T);if(!le)throw jr(i.replace("{}",T)),new Error('Unknown language: "'+T+'"');const Vt=x1(le);let xt="",Z=j||Vt;const Dt={},Pe=new a.__emitter(a);bn();let we="",It=0,et=0,kn=0,Bt=!1;try{if(le.__emitTokens)le.__emitTokens(A,Pe);else{for(Z.matcher.considerAll();;){kn++,Bt?Bt=!1:Z.matcher.considerAll(),Z.matcher.lastIndex=et;const L=Z.matcher.exec(A);if(!L)break;const V=A.substring(et,L.index),pe=yn(V,L);et=L.index+pe}yn(A.substring(et))}return Pe.finalize(),xt=Pe.toHTML(),{language:T,value:xt,relevance:It,illegal:!1,_emitter:Pe,_top:Z}}catch(L){if(L.message&&L.message.includes("Illegal"))return{language:T,value:Vc(A),illegal:!0,relevance:0,_illegalBy:{message:L.message,index:et,context:A.slice(et-100,et+100),mode:L.mode,resultSoFar:xt},_emitter:Pe};if(o)return{language:T,value:Vc(A),illegal:!1,relevance:0,errorRaised:L,_emitter:Pe,_top:Z};throw L}}function f(T){const A={value:Vc(T),illegal:!1,relevance:0,_top:s,_emitter:new a.__emitter(a)};return A._emitter.addText(T),A}function h(T,A){A=A||a.languages||Object.keys(e);const z=f(T),j=A.filter(v).filter(Y).map(Me=>p(Me,T,!1));j.unshift(z);const ee=j.sort((Me,ze)=>{if(Me.relevance!==ze.relevance)return ze.relevance-Me.relevance;if(Me.language&&ze.language){if(v(Me.language).supersetOf===ze.language)return 1;if(v(ze.language).supersetOf===Me.language)return-1}return 0}),[he,Oe]=ee,ct=he;return ct.secondBest=Oe,ct}function m(T,A,z){const j=A&&t[A]||z;T.classList.add("hljs"),T.classList.add(`language-${j}`)}function g(T){let A=null;const z=d(T);if(c(z))return;if(oe("before:highlightElement",{el:T,language:z}),T.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",T);return}if(T.children.length>0&&(a.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(T)),a.throwUnescapedHTML))throw new O1("One of your code blocks includes unescaped HTML.",T.innerHTML);A=T;const j=A.textContent,ee=z?u(j,{language:z,ignoreIllegals:!0}):h(j);T.innerHTML=ee.value,T.dataset.highlighted="yes",m(T,z,ee.language),T.result={language:ee.language,re:ee.relevance,relevance:ee.relevance},ee.secondBest&&(T.secondBest={language:ee.secondBest.language,relevance:ee.secondBest.relevance}),oe("after:highlightElement",{el:T,result:ee,text:j})}function b(T){a=km(a,T)}const y=()=>{k(),No("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function E(){k(),No("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let C=!1;function k(){if(document.readyState==="loading"){C=!0;return}document.querySelectorAll(a.cssSelector).forEach(g)}function S(){C&&k()}typeof window<"u"&&window.addEventListener&&window.addEventListener("DOMContentLoaded",S,!1);function _(T,A){let z=null;try{z=A(n)}catch(j){if(jr("Language definition for '{}' could not be registered.".replace("{}",T)),o)jr(j);else throw j;z=s}z.name||(z.name=T),e[T]=z,z.rawDefinition=A.bind(null,n),z.aliases&&$(z.aliases,{languageName:T})}function D(T){delete e[T];for(const A of Object.keys(t))t[A]===T&&delete t[A]}function B(){return Object.keys(e)}function v(T){return T=(T||"").toLowerCase(),e[T]||e[t[T]]}function $(T,{languageName:A}){typeof T=="string"&&(T=[T]),T.forEach(z=>{t[z.toLowerCase()]=A})}function Y(T){const A=v(T);return A&&!A.disableAutodetect}function te(T){T["before:highlightBlock"]&&!T["before:highlightElement"]&&(T["before:highlightElement"]=A=>{T["before:highlightBlock"](Object.assign({block:A.el},A))}),T["after:highlightBlock"]&&!T["after:highlightElement"]&&(T["after:highlightElement"]=A=>{T["after:highlightBlock"](Object.assign({block:A.el},A))})}function ue(T){te(T),r.push(T)}function ce(T){const A=r.indexOf(T);A!==-1&&r.splice(A,1)}function oe(T,A){const z=T;r.forEach(function(j){j[z]&&j[z](A)})}function ie(T){return No("10.7.0","highlightBlock will be removed entirely in v12.0"),No("10.7.0","Please use highlightElement now."),g(T)}Object.assign(n,{highlight:u,highlightAuto:h,highlightAll:k,highlightElement:g,highlightBlock:ie,configure:b,initHighlighting:y,initHighlightingOnLoad:E,registerLanguage:_,unregisterLanguage:D,listLanguages:B,getLanguage:v,registerAliases:$,autoDetection:Y,inherit:km,addPlugin:ue,removePlugin:ce}),n.debugMode=function(){o=!1},n.safeMode=function(){o=!0},n.versionString=T1,n.regex={concat:Gr,lookahead:lm,either:$c,optional:WN,anyNumberOfTimes:UN};for(const T in Fs)typeof Fs[T]=="object"&&rm(Fs[T]);return Object.assign(n,Fs),n},To=wm({});To.newInstance=()=>wm({});var A1=To;To.HighlightJS=To,To.default=To;var v1=$N(A1);function Cm(n,e=[]){return n.map(t=>{const r=[...e,...t.properties?t.properties.className:[]];return t.children?Cm(t.children,r):{text:t.value,classes:r}}).flat()}function _m(n){return n.value||n.children||[]}function R1(n){return!!v1.getLanguage(n)}function Sm({doc:n,name:e,lowlight:t,defaultLanguage:r}){const o=[];return Xl(n,i=>i.type.name===e).forEach(i=>{var s;let a=i.pos+1;const c=i.node.attrs.language||r,d=t.listLanguages(),u=c&&(d.includes(c)||R1(c)||!((s=t.registered)===null||s===void 0)&&s.call(t,c))?_m(t.highlight(c,i.node.textContent)):_m(t.highlightAuto(i.node.textContent));Cm(u).forEach(p=>{const f=a+p.text.length;if(p.classes.length){const h=Qe.inline(a,f,{class:p.classes.join(" ")});o.push(h)}a=f})}),Te.create(n,o)}function D1(n){return typeof n=="function"}function I1({name:n,lowlight:e,defaultLanguage:t}){if(!["highlight","highlightAuto","listLanguages"].every(o=>D1(e[o])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const r=new Ne({key:new Fe("lowlight"),state:{init:(o,{doc:i})=>Sm({doc:i,name:n,lowlight:e,defaultLanguage:t}),apply:(o,i,s,a)=>{const c=s.selection.$head.parent.type.name,d=a.selection.$head.parent.type.name,u=Xl(s.doc,f=>f.type.name===n),p=Xl(a.doc,f=>f.type.name===n);return o.docChanged&&([c,d].includes(n)||p.length!==u.length||o.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)))?Sm({doc:o.doc,name:n,lowlight:e,defaultLanguage:t}):i.map(o.mapping,o.doc)}},props:{decorations(o){return r.getState(o)}}});return r}const B1=vh.extend({addOptions(){var n;return{...(n=this.parent)===null||n===void 0?void 0:n.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},addProseMirrorPlugins(){var n;return[...((n=this.parent)===null||n===void 0?void 0:n.call(this))||[],I1({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}});function L1(n){const e=n.regex,t=n.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",o="[a-zA-Z_]\\w*::",s="(?!struct)("+r+"|"+e.optional(o)+"[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:[n.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:"."},n.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},n.inherit(d,{className:"string"}),{className:"string",begin:/<.*?>/},t,n.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(o)+n.IDENT_RE,relevance:0},h=e.optional(o)+n.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"],k={type:g,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:b},S={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,n.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},_=[S,p,a,t,n.C_BLOCK_COMMENT_MODE,u,d],D={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:k,contains:_.concat([{begin:/\(/,end:/\)/,keywords:k,contains:_.concat(["self"]),relevance:0}]),relevance:0},B={className:"function",begin:"("+s+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:k,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:k,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:k,relevance:0,contains:[t,n.C_BLOCK_COMMENT_MODE,d,u,a,{begin:/\(/,end:/\)/,keywords:k,relevance:0,contains:["self",t,n.C_BLOCK_COMMENT_MODE,d,u,a]}]},a,t,n.C_BLOCK_COMMENT_MODE,p]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:k,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(D,B,S,_,[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:k,contains:["self",a]},{begin:n.IDENT_RE+"::",keywords:k},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function P1(n){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"]},t=L1(n),r=t.keywords;return r.type=[...r.type,...e.type],r.literal=[...r.literal,...e.literal],r.built_in=[...r.built_in,...e.built_in],r._hints=e._hints,t.name="Arduino",t.aliases=["ino"],t.supersetOf="cpp",t}function $1(n){const e=n.regex,t={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[t]}]};Object.assign(t,{className:"variable",variants:[{begin:e.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const o={className:"subst",begin:/\$\(/,end:/\)/,contains:[n.BACKSLASH_ESCAPE]},i=n.inherit(n.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),s={begin:/<<-?\s*(?=\w+)/,starts:{contains:[n.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},a={className:"string",begin:/"/,end:/"/,contains:[n.BACKSLASH_ESCAPE,t,o]};o.contains.push(a);const c={match:/\\"/},d={className:"string",begin:/'/,end:/'/},u={match:/\\'/},p={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},n.NUMBER_MODE,t]},f=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],h=n.SHEBANG({binary:`(${f.join("|")})`,relevance:10}),m={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[n.inherit(n.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._-]+)+/},E=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],C=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],k=["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"],S=["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:[...E,...C,"set","shopt",...k,...S]},contains:[h,n.SHEBANG(),m,p,i,s,y,a,c,d,u,t]}}function F1(n){const e=n.regex,t=n.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",o="[a-zA-Z_]\\w*::",s="("+r+"|"+e.optional(o)+"[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:[n.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:"."},n.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},n.inherit(d,{className:"string"}),{className:"string",begin:/<.*?>/},t,n.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(o)+n.IDENT_RE,relevance:0},h=e.optional(o)+n.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,t,n.C_BLOCK_COMMENT_MODE,u,d],E={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},C={begin:"("+s+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:b,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:b,relevance:0},{begin:h,returnBegin:!0,contains:[n.inherit(f,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:[t,n.C_BLOCK_COMMENT_MODE,d,u,a,{begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:["self",t,n.C_BLOCK_COMMENT_MODE,d,u,a]}]},a,t,n.C_BLOCK_COMMENT_MODE,p]};return{name:"C",aliases:["h"],keywords:b,disableAutodetect:!0,illegal:"</",contains:[].concat(E,C,y,[p,{begin:n.IDENT_RE+"::",keywords:b},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},n.TITLE_MODE]}]),exports:{preprocessor:p,strings:d,keywords:b}}}function z1(n){const e=n.regex,t=n.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",o="[a-zA-Z_]\\w*::",s="(?!struct)("+r+"|"+e.optional(o)+"[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:[n.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:"."},n.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},n.inherit(d,{className:"string"}),{className:"string",begin:/<.*?>/},t,n.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(o)+n.IDENT_RE,relevance:0},h=e.optional(o)+n.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"],k={type:g,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:b},S={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,n.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},_=[S,p,a,t,n.C_BLOCK_COMMENT_MODE,u,d],D={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:k,contains:_.concat([{begin:/\(/,end:/\)/,keywords:k,contains:_.concat(["self"]),relevance:0}]),relevance:0},B={className:"function",begin:"("+s+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:k,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:k,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:k,relevance:0,contains:[t,n.C_BLOCK_COMMENT_MODE,d,u,a,{begin:/\(/,end:/\)/,keywords:k,relevance:0,contains:["self",t,n.C_BLOCK_COMMENT_MODE,d,u,a]}]},a,t,n.C_BLOCK_COMMENT_MODE,p]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:k,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(D,B,S,_,[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:k,contains:["self",a]},{begin:n.IDENT_RE+"::",keywords:k},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function V1(n){const e=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],t=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],o=["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:o.concat(i),built_in:e,literal:r},a=n.inherit(n.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=n.inherit(u,{illegal:/\n/}),f={className:"subst",begin:/\{/,end:/\}/,keywords:s},h=n.inherit(f,{illegal:/\n/}),m={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},n.BACKSLASH_ESCAPE,h]},g={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},f]},b=n.inherit(g,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]});f.contains=[g,m,u,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,c,n.C_BLOCK_COMMENT_MODE],h.contains=[b,m,p,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,c,n.inherit(n.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const y={variants:[d,g,m,u,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE]},E={begin:"<",end:">",contains:[{beginKeywords:"in out"},a]},C=n.IDENT_RE+"(<"+n.IDENT_RE+"(\\s*,\\s*"+n.IDENT_RE+")*>)?(\\[\\])?",k={begin:"@"+n.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:s,illegal:/::/,contains:[n.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),n.C_LINE_COMMENT_MODE,n.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,E,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,E,n.C_LINE_COMMENT_MODE,n.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:"("+C+"\\s+)+"+n.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:s,contains:[{beginKeywords:t.join(" "),relevance:0},{begin:n.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[n.TITLE_MODE,E],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,relevance:0,contains:[y,c,n.C_BLOCK_COMMENT_MODE]},n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},k]}}const H1=n=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:n.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:[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:n.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_-]*/}}),U1=["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"],W1=["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"],q1=[...U1,...W1],K1=["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(),G1=["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(),j1=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),J1=["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 Y1(n){const e=n.regex,t=H1(n),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},o="and or not only",i=/@-?\w[\w]*(-\w+)*/,s="[a-zA-Z-][a-zA-Z0-9_-]*",a=[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[t.BLOCK_COMMENT,r,t.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+s,relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+G1.join("|")+")"},{begin:":(:)?("+j1.join("|")+")"}]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+J1.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[t.BLOCK_COMMENT,t.HEXCOLOR,t.IMPORTANT,t.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}]},t.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:o,attribute:K1.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,t.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+q1.join("|")+")\\b"}]}}function X1(n){const e=n.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 Z1(n){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:[n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE,{className:"string",variants:[n.QUOTE_STRING_MODE,n.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:[n.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:i,illegal:/["']/}]}]}}function Q1(n){const e=n.regex,t=/[_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:[n.HASH_COMMENT_MODE,n.QUOTE_STRING_MODE,n.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(t,e.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}function eT(n){const e=n.regex,t={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:n.NUMBER_RE}]},r=n.COMMENT();r.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const o={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},i={className:"literal",begin:/\bon|off|true|false|yes|no\b/},s={className:"string",contains:[n.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},a={begin:/\[/,end:/\]/,contains:[r,i,o,s,t,"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:[r,{className:"section",begin:/\[+/,end:/\]+/},{begin:f,className:"attr",starts:{end:/$/,contains:[r,a,i,o,s,t]}}]}}var Oo="[0-9](_*[0-9])*",Vs=`\\.(${Oo})`,Hs="[0-9a-fA-F](_*[0-9a-fA-F])*",xm={className:"number",variants:[{begin:`(\\b(${Oo})((${Vs})|\\.)?|(${Vs}))[eE][+-]?(${Oo})[fFdD]?\\b`},{begin:`\\b(${Oo})((${Vs})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Vs})[fFdD]?\\b`},{begin:`\\b(${Oo})[fFdD]\\b`},{begin:`\\b0[xX]((${Hs})\\.?|(${Hs})?\\.(${Hs}))[pP][+-]?(${Oo})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Hs})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Nm(n,e,t){return t===-1?"":n.replace(e,r=>Nm(n,e,t-1))}function tT(n){const e=n.regex,t="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=t+Nm("(?:<"+t+"~~~(?:\\s*,\\s*"+t+"~~~)*>)?",/~~~/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:"@"+t,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},u={className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[n.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:c,illegal:/<\/|#/,contains:[n.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[n.BACKSLASH_ESCAPE]},n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,t],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[e.concat(/(?!else)/,t),/\s+/,t,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,t],className:{1:"keyword",3:"title.class"},contains:[u,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",n.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:c,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[d,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,xm,n.C_BLOCK_COMMENT_MODE]},n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},xm,d]}}const Tm="[A-Za-z$_][0-9A-Za-z$_]*",nT=["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"],rT=["true","false","null","undefined","NaN","Infinity"],Om=["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"],Mm=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Am=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],oT=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],iT=[].concat(Am,Om,Mm);function sT(n){const e=n.regex,t=(A,{after:z})=>{const j="</"+A[0].slice(1);return A.input.indexOf(j,z)!==-1},r=Tm,o={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(A,z)=>{const j=A[0].length+A.index,ee=A.input[j];if(ee==="<"||ee===","){z.ignoreMatch();return}ee===">"&&(t(A,{after:j})||z.ignoreMatch());let he;const Oe=A.input.substring(j);if(he=Oe.match(/^\s*=/)){z.ignoreMatch();return}if((he=Oe.match(/^\s+extends\s+/))&&he.index===0){z.ignoreMatch();return}}},a={$pattern:Tm,keyword:nT,literal:rT,built_in:iT,"variable.language":oT},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:[n.BACKSLASH_ESCAPE,f],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,f],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},b={className:"string",begin:"`",end:"`",contains:[n.BACKSLASH_ESCAPE,f]},E={className:"comment",variants:[n.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),n.C_BLOCK_COMMENT_MODE,n.C_LINE_COMMENT_MODE]},C=[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,h,m,g,b,{match:/\$\d+/},p];f.contains=C.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(C)});const k=[].concat(E,f.contains),S=k.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(k)}]),_={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:S},D={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},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:{_:[...Om,...Mm]}},v={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},$={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[_],illegal:/%/},Y={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function te(A){return e.concat("(?!",A.join("|"),")")}const ue={match:e.concat(/\b/,te([...Am,"super","import"].map(A=>`${A}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},ce={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},oe={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},_]},ie="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+n.UNDERSCORE_IDENT_RE+")\\s*=>",T={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(ie)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[_]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:S,CLASS_REFERENCE:B},illegal:/#(?![$_A-z])/,contains:[n.SHEBANG({label:"shebang",binary:"node",relevance:5}),v,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,h,m,g,b,E,{match:/\$\d+/},p,B,{scope:"attr",match:r+e.lookahead(":"),relevance:0},T,{begin:"("+n.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[E,n.REGEXP_MODE,{className:"function",begin:ie,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:n.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:S}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:o.begin,end:o.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"]}]}]},$,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+n.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[_,n.inherit(n.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},ce,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[_]},ue,Y,D,oe,{match:/\$[(.]/}]}}function aT(n){const e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},t={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],o={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[e,t,n.QUOTE_STRING_MODE,o,n.C_NUMBER_MODE,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var Mo="[0-9](_*[0-9])*",Us=`\\.(${Mo})`,Ws="[0-9a-fA-F](_*[0-9a-fA-F])*",lT={className:"number",variants:[{begin:`(\\b(${Mo})((${Us})|\\.)?|(${Us}))[eE][+-]?(${Mo})[fFdD]?\\b`},{begin:`\\b(${Mo})((${Us})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Us})[fFdD]?\\b`},{begin:`\\b(${Mo})[fFdD]\\b`},{begin:`\\b0[xX]((${Ws})\\.?|(${Ws})?\\.(${Ws}))[pP][+-]?(${Mo})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Ws})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function cT(n){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"},t={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:n.UNDERSCORE_IDENT_RE+"@"},o={className:"subst",begin:/\$\{/,end:/\}/,contains:[n.C_NUMBER_MODE]},i={className:"variable",begin:"\\$"+n.UNDERSCORE_IDENT_RE},s={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[i,o]},{begin:"'",end:"'",illegal:/\n/,contains:[n.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[n.BACKSLASH_ESCAPE,i,o]}]};o.contains.push(s);const a={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+n.UNDERSCORE_IDENT_RE+")?"},c={className:"meta",begin:"@"+n.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[n.inherit(s,{className:"string"}),"self"]}]},d=lT,u=n.COMMENT("/\\*","\\*/",{contains:[n.C_BLOCK_COMMENT_MODE]}),p={variants:[{className:"type",begin:n.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:[n.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),n.C_LINE_COMMENT_MODE,u,t,r,a,c,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:e,relevance:5,contains:[{begin:n.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[n.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,n.C_LINE_COMMENT_MODE,u],relevance:0},n.C_LINE_COMMENT_MODE,u,a,c,s,n.C_NUMBER_MODE]},u]},{begin:[/class|interface|trait/,/\s+/,n.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},n.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:`
118
+ `},d]}}const dT=n=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:n.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:[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:n.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_-]*/}}),uT=["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"],pT=["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"],fT=[...uT,...pT],hT=["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(),vm=["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(),Rm=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),mT=["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(),gT=vm.concat(Rm).sort().reverse();function bT(n){const e=dT(n),t=gT,r="and or not only",o="[\\w-]+",i="("+o+"|@\\{"+o+"\\})",s=[],a=[],c=function(C){return{className:"string",begin:"~?"+C+".*?"+C}},d=function(C,k,S){return{className:C,begin:k,relevance:S}},u={$pattern:/[a-z-]+/,keyword:r,attribute:hT.join(" ")},p={begin:"\\(",end:"\\)",contains:a,keywords:u,relevance:0};a.push(n.C_LINE_COMMENT_MODE,n.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","@@?"+o,10),d("variable","@\\{"+o+"\\}"),d("built_in","~?`[^`]*?`"),{className:"attribute",begin:o+"\\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("+mT.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:"@"+o+"\\s*:",relevance:15},{begin:"@"+o}],starts:{end:"[;}]",returnEnd:!0,contains:f}},y={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:i,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE,h,d("keyword","all\\b"),d("variable","@\\{"+o+"\\}"),{begin:"\\b("+fT.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:":("+vm.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+Rm.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:f},{begin:"!important"},e.FUNCTION_DISPATCH]},E={begin:o+`:(:)?(${t.join("|")})`,returnBegin:!0,contains:[y]};return s.push(n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE,g,b,E,m,y,h,e.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:s}}function yT(n){const e="\\[=*\\[",t="\\]=*\\]",r={begin:e,end:t,contains:["self"]},o=[n.COMMENT("--(?!"+e+")","$"),n.COMMENT("--"+e,t,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:n.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:o.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[n.inherit(n.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:o}].concat(o)},n.C_NUMBER_MODE,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,{className:"string",begin:e,end:t,contains:[r],relevance:5}])}}function kT(n){const e={className:"variable",variants:[{begin:"\\$\\("+n.UNDERSCORE_IDENT_RE+"\\)",contains:[n.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},t={className:"string",begin:/"/,end:/"/,contains:[n.BACKSLASH_ESCAPE,e]},r={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[e,t]},o={begin:"^"+n.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:[n.HASH_COMMENT_MODE,e,t,r,o,i,s]}}function ET(n){const e=n.regex,t={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},o={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=n.inherit(d,{contains:[]}),f=n.inherit(u,{contains:[]});d.contains.push(f),u.contains.push(p);let h=[t,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}]}]},t,i,d,u,{className:"quote",begin:"^>\\s+",contains:h,end:"$"},o,r,c,s,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function wT(n){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+"},t=/[a-zA-Z@][a-zA-Z0-9_]*/,a={"variable.language":["this","super"],$pattern:t,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:t,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:a,illegal:"</",contains:[e,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE,n.C_NUMBER_MODE,n.QUOTE_STRING_MODE,n.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[n.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},n.inherit(n.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+c.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:c,contains:[n.UNDERSCORE_TITLE_MODE]},{begin:"\\."+n.UNDERSCORE_IDENT_RE,relevance:0}]}}function CT(n){const e=n.regex,t=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,o={$pattern:/[\w.]+/,keyword:t.join(" ")},i={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:o},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=[n.BACKSLASH_ESCAPE,i,c],p=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],f=(g,b,y="\\1")=>{const E=y==="\\1"?y:e.concat(y,b);return e.concat(e.concat("(?:",g,")"),b,/(?:\\.|[^\\\/])*?/,E,/(?:\\.|[^\\\/])*?/,y,r)},h=(g,b,y)=>e.concat(e.concat("(?:",g,")"),b,/(?:\\.|[^\\\/])*?/,y,r),m=[c,n.HASH_COMMENT_MODE,n.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:[n.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[n.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},d,{begin:"(\\/\\/|"+n.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[n.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:[n.TITLE_MODE,a]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[n.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:o,contains:m}}function _T(n){const e=n.regex,t=/(?![A-Za-z0-9])(?![$])/,r=e.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,t),o=e.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,t),i=e.concat(/[A-Z]+/,t),s={scope:"variable",match:"\\$+"+r},a={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},c={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},d=n.inherit(n.APOS_STRING_MODE,{illegal:null}),u=n.inherit(n.QUOTE_STRING_MODE,{illegal:null,contains:n.QUOTE_STRING_MODE.contains.concat(c)}),p={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:n.QUOTE_STRING_MODE.contains.concat(c),"on:begin":(ce,oe)=>{oe.data._beginMatch=ce[1]||ce[2]},"on:end":(ce,oe)=>{oe.data._beginMatch!==ce[1]&&oe.ignoreMatch()}},f=n.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),h=`[
119
+ ]`,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"],E=["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"],k={keyword:y,literal:(ce=>{const oe=[];return ce.forEach(ie=>{oe.push(ie),ie.toLowerCase()===ie?oe.push(ie.toUpperCase()):oe.push(ie.toLowerCase())}),oe})(b),built_in:E},S=ce=>ce.map(oe=>oe.replace(/\|\d+$/,"")),_={variants:[{match:[/new/,e.concat(h,"+"),e.concat("(?!",S(E).join("\\b|"),"\\b)"),o],scope:{1:"keyword",4:"title.class"}}]},D=e.concat(r,"\\b(?!\\()"),B={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),D],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[o,e.concat(/::/,e.lookahead(/(?!class\b)/)),D],scope:{1:"title.class",3:"variable.constant"}},{match:[o,e.concat("::",e.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[o,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},v={scope:"attr",match:e.concat(r,e.lookahead(":"),e.lookahead(/(?!::)/))},$={relevance:0,begin:/\(/,end:/\)/,keywords:k,contains:[v,s,B,n.C_BLOCK_COMMENT_MODE,m,g,_]},Y={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",S(y).join("\\b|"),"|",S(E).join("\\b|"),"\\b)"),r,e.concat(h,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[$]};$.contains.push(Y);const te=[v,B,n.C_BLOCK_COMMENT_MODE,m,g,_],ue={begin:e.concat(/#\[\s*\\?/,e.either(o,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:o},{match:i}]}]};return{case_insensitive:!1,keywords:k,contains:[ue,n.HASH_COMMENT_MODE,n.COMMENT("//","$"),n.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:n.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},a,{scope:"variable.language",match:/\$this\b/},s,Y,B,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},_,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},n.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:k,contains:["self",ue,s,B,n.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"},n.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[n.inherit(n.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},n.UNDERSCORE_TITLE_MODE]},m,g]}}function ST(n){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},n.inherit(n.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),n.inherit(n.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function xT(n){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function NT(n){const e=n.regex,t=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],a={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},c={className:"meta",begin:/^(>>>|\.\.\.) /},d={className:"subst",begin:/\{/,end:/\}/,keywords:a,illegal:/#/},u={begin:/\{\{/,relevance:0},p={className:"string",contains:[n.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[n.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[n.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[n.BACKSLASH_ESCAPE,c,u,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[n.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:[n.BACKSLASH_ESCAPE,u,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[n.BACKSLASH_ESCAPE,u,d]},n.APOS_STRING_MODE,n.QUOTE_STRING_MODE]},f="[0-9](_?[0-9])*",h=`(\\b(${f}))?\\.(${f})|\\b(${f})\\.`,m=`\\b|${r.join("|")}`,g={className:"number",relevance:0,variants:[{begin:`(\\b(${f})|(${h}))[eE][+-]?(${f})[jJ]?(?=${m})`},{begin:`(${h})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${m})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${m})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${m})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${m})`},{begin:`\\b(${f})[jJ](?=${m})`}]},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,n.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,n.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,t],scope:{1:"keyword",3:"title.function"},contains:[y]},{variants:[{match:[/\bclass/,/\s+/,t,/\s*/,/\(\s*/,t,/\s*\)/]},{match:[/\bclass/,/\s+/,t]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[g,y,p]}]}}function TT(n){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function OT(n){const e=n.regex,t=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=e.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),o=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,i=e.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:t,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:[n.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:t},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),n.HASH_COMMENT_MODE,{scope:"string",contains:[n.BACKSLASH_ESCAPE],variants:[n.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),n.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),n.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),n.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),n.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),n.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[o,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[i,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[t,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:o},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:i},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function MT(n){const e=n.regex,t="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=e.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),o=e.concat(r,/(::\w+)*/),s={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},a={className:"doctag",begin:"@[A-Za-z]+"},c={begin:"#<",end:">"},d=[n.COMMENT("#","$",{contains:[a]}),n.COMMENT("^=begin","^=end",{contains:[a],relevance:10}),n.COMMENT("^__END__",n.MATCH_NOTHING_RE)],u={className:"subst",begin:/#\{/,end:/\}/,keywords:s},p={className:"string",contains:[n.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:[n.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[n.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}]},_=[p,{variants:[{match:[/class\s+/,o,/\s+<\s+/,o]},{match:[/\b(class|module)\s+/,o]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:s},{match:[/(include|extend)\s+/,o],scope:{2:"title.class"},keywords:s},{relevance:0,match:[o,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,t],scope:{1:"keyword",3:"title.function"},contains:[g]},{begin:n.IDENT_RE+"::"},{className:"symbol",begin:n.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[p,{begin:t}],relevance:0},m,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:s},{begin:"("+n.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[n.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=_,g.contains=_;const $=[{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 d.unshift(c),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:s,illegal:/\/\*/,contains:[n.SHEBANG({binary:"ruby"})].concat($).concat(d).concat(_)}}function AT(n){const e=n.regex,t=/(r#)?/,r=e.concat(t,n.UNDERSCORE_IDENT_RE),o=e.concat(t,n.IDENT_RE),i={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let|for|while|if|else|match\b)/,o,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:n.IDENT_RE+"!?",type:u,keyword:a,literal:c,built_in:d},illegal:"</",contains:[n.C_LINE_COMMENT_MODE,n.COMMENT("/\\*","\\*/",{contains:["self"]}),n.inherit(n.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+s},{begin:"\\b0o([0-7_]+)"+s},{begin:"\\b0x([A-Fa-f0-9_]+)"+s},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+s}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[n.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:n.IDENT_RE+"::",keywords:{keyword:"Self",built_in:d,type:u}},{className:"punctuation",begin:"->"},i]}}const vT=n=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:n.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:[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:n.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_-]*/}}),RT=["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"],DT=["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"],IT=[...RT,...DT],BT=["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(),LT=["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(),PT=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),$T=["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 FT(n){const e=vT(n),t=PT,r=LT,o="@[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:[n.C_LINE_COMMENT_MODE,n.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("+IT.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+t.join("|")+")"},a,{begin:/\(/,end:/\)/,contains:[e.CSS_NUMBER_MODE]},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+$T.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,n.QUOTE_STRING_MODE,n.APOS_STRING_MODE,e.IMPORTANT,e.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:o,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:BT.join(" ")},contains:[{begin:o,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},a,n.QUOTE_STRING_MODE,n.APOS_STRING_MODE,e.HEXCOLOR,e.CSS_NUMBER_MODE]},e.FUNCTION_DISPATCH]}}function zT(n){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function VT(n){const e=n.regex,t=n.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},o={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(S=>!u.includes(S)),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 E(S){return e.concat(/\b/,e.either(...S.map(_=>_.replace(/\s+/,"\\s+"))),/\b/)}const C={scope:"keyword",match:E(f),relevance:0};function k(S,{exceptions:_,when:D}={}){const B=D;return _=_||[],S.map(v=>v.match(/\|\d+$/)||_.includes(v)?v:B(v)?`${v}|0`:v)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:k(m,{when:S=>S.length<3}),literal:i,type:a,built_in:p},contains:[{scope:"type",match:E(s)},C,y,g,r,o,n.C_NUMBER_MODE,n.C_BLOCK_COMMENT_MODE,t,b]}}function Dm(n){return n?typeof n=="string"?n:n.source:null}function ki(n){return Be("(?=",n,")")}function Be(...n){return n.map(t=>Dm(t)).join("")}function HT(n){const e=n[n.length-1];return typeof e=="object"&&e.constructor===Object?(n.splice(n.length-1,1),e):{}}function Rt(...n){return"("+(HT(n).capture?"":"?:")+n.map(r=>Dm(r)).join("|")+")"}const Hc=n=>Be(/\b/,n,/\w$/.test(n)?/\b/:/\B/),UT=["Protocol","Type"].map(Hc),Im=["init","self"].map(Hc),WT=["Any","Self"],Uc=["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"],Bm=["false","nil","true"],qT=["assignment","associativity","higherThan","left","lowerThan","none","right"],KT=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],Lm=["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"],Pm=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]/),$m=Rt(Pm,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),Wc=Be(Pm,$m,"*"),Fm=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]/),qs=Rt(Fm,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),vn=Be(Fm,qs,"*"),Ks=Be(/[A-Z]/,qs,"*"),GT=["attached","autoclosure",Be(/convention\(/,Rt("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Be(/objc\(/,vn,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],jT=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function JT(n){const e={match:/\s+/,relevance:0},t=n.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[n.C_LINE_COMMENT_MODE,t],o={match:[/\./,Rt(...UT,...Im)],className:{2:"keyword"}},i={match:Be(/\./,Rt(...Uc)),relevance:0},s=Uc.filter(le=>typeof le=="string").concat(["_|0"]),a=Uc.filter(le=>typeof le!="string").concat(WT).map(Hc),c={variants:[{className:"keyword",match:Rt(...a,...Im)}]},d={$pattern:Rt(/\b\w+/,/#\w+/),keyword:s.concat(KT),literal:Bm},u=[o,i,c],p={match:Be(/\./,Rt(...Lm)),relevance:0},f={className:"built_in",match:Be(/\b/,Rt(...Lm),/(?=\()/)},h=[p,f],m={match:/->/,relevance:0},g={className:"operator",relevance:0,variants:[{match:Wc},{match:`\\.(\\.|${$m})+`}]},b=[m,g],y="([0-9]_*)+",E="([0-9a-fA-F]_*)+",C={className:"number",relevance:0,variants:[{match:`\\b(${y})(\\.(${y}))?([eE][+-]?(${y}))?\\b`},{match:`\\b0x(${E})(\\.(${E}))?([pP][+-]?(${y}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},k=(le="")=>({className:"subst",variants:[{match:Be(/\\/,le,/[0\\tnr"']/)},{match:Be(/\\/,le,/u\{[0-9a-fA-F]{1,8}\}/)}]}),S=(le="")=>({className:"subst",match:Be(/\\/,le,/[\t ]*(?:[\r\n]|\r\n)/)}),_=(le="")=>({className:"subst",label:"interpol",begin:Be(/\\/,le,/\(/),end:/\)/}),D=(le="")=>({begin:Be(le,/"""/),end:Be(/"""/,le),contains:[k(le),S(le),_(le)]}),B=(le="")=>({begin:Be(le,/"/),end:Be(/"/,le),contains:[k(le),_(le)]}),v={className:"string",variants:[D(),D("#"),D("##"),D("###"),B(),B("#"),B("##"),B("###")]},$=[n.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[n.BACKSLASH_ESCAPE]}],Y={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:$},te=le=>{const Vt=Be(le,/\//),xt=Be(/\//,le);return{begin:Vt,end:xt,contains:[...$,{scope:"comment",begin:`#(?!.*${xt})`,end:/$/}]}},ue={scope:"regexp",variants:[te("###"),te("##"),te("#"),Y]},ce={match:Be(/`/,vn,/`/)},oe={className:"variable",match:/\$\d+/},ie={className:"variable",match:`\\$${qs}+`},T=[ce,oe,ie],A={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:jT,contains:[...b,C,v]}]}},z={scope:"keyword",match:Be(/@/,Rt(...GT),ki(Rt(/\(/,/\s+/)))},j={scope:"meta",match:Be(/@/,vn)},ee=[A,z,j],he={match:ki(/\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)/,qs,"+")},{className:"type",match:Ks,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Be(/\s+&\s+/,ki(Ks)),relevance:0}]},Oe={begin:/</,end:/>/,keywords:d,contains:[...r,...u,...ee,m,he]};he.contains.push(Oe);const ct={match:Be(vn,/\s*:/),keywords:"_|0",relevance:0},Me={begin:/\(/,end:/\)/,relevance:0,keywords:d,contains:["self",ct,...r,ue,...u,...h,...b,C,v,...T,...ee,he]},ze={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,he]},Yt={begin:Rt(ki(Be(vn,/\s*:/)),ki(Be(vn,/\s+/,vn,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:vn}]},bt={begin:/\(/,end:/\)/,keywords:d,contains:[Yt,...r,...u,...b,C,v,...ee,he,Me],endsParent:!0,illegal:/["']/},un={match:[/(func|macro)/,/\s+/,Rt(ce.match,vn,Wc)],className:{1:"keyword",3:"title.function"},contains:[ze,bt,e],illegal:[/\[/,/%/]},yt={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[ze,bt,e],illegal:/\[|%/},pn={match:[/operator/,/\s+/,Wc],className:{1:"keyword",3:"title"}},Bn={begin:[/precedencegroup/,/\s+/,Ks],className:{1:"keyword",3:"title"},contains:[he],keywords:[...qT,...Bm],end:/}/},bn={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Xt={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},yn={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,vn,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:d,contains:[ze,...u,{begin:/:/,end:/\{/,keywords:d,contains:[{scope:"title.class.inherited",match:Ks},...u],relevance:0}]};for(const le of v.variants){const Vt=le.contains.find(Z=>Z.label==="interpol");Vt.keywords=d;const xt=[...u,...h,...b,C,v,...T];Vt.contains=[...xt,{begin:/\(/,end:/\)/,contains:["self",...xt]}]}return{name:"Swift",keywords:d,contains:[...r,un,yt,bn,Xt,yn,pn,Bn,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},ue,...u,...h,...b,C,v,...T,...ee,he,Me]}}const Gs="[A-Za-z$_][0-9A-Za-z$_]*",zm=["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"],Vm=["true","false","null","undefined","NaN","Infinity"],Hm=["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"],Um=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Wm=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],qm=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Km=[].concat(Wm,Hm,Um);function YT(n){const e=n.regex,t=(A,{after:z})=>{const j="</"+A[0].slice(1);return A.input.indexOf(j,z)!==-1},r=Gs,o={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(A,z)=>{const j=A[0].length+A.index,ee=A.input[j];if(ee==="<"||ee===","){z.ignoreMatch();return}ee===">"&&(t(A,{after:j})||z.ignoreMatch());let he;const Oe=A.input.substring(j);if(he=Oe.match(/^\s*=/)){z.ignoreMatch();return}if((he=Oe.match(/^\s+extends\s+/))&&he.index===0){z.ignoreMatch();return}}},a={$pattern:Gs,keyword:zm,literal:Vm,built_in:Km,"variable.language":qm},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:[n.BACKSLASH_ESCAPE,f],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,f],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},b={className:"string",begin:"`",end:"`",contains:[n.BACKSLASH_ESCAPE,f]},E={className:"comment",variants:[n.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),n.C_BLOCK_COMMENT_MODE,n.C_LINE_COMMENT_MODE]},C=[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,h,m,g,b,{match:/\$\d+/},p];f.contains=C.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(C)});const k=[].concat(E,f.contains),S=k.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(k)}]),_={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:S},D={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},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:{_:[...Hm,...Um]}},v={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},$={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[_],illegal:/%/},Y={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function te(A){return e.concat("(?!",A.join("|"),")")}const ue={match:e.concat(/\b/,te([...Wm,"super","import"].map(A=>`${A}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},ce={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},oe={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},_]},ie="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+n.UNDERSCORE_IDENT_RE+")\\s*=>",T={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(ie)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[_]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:S,CLASS_REFERENCE:B},illegal:/#(?![$_A-z])/,contains:[n.SHEBANG({label:"shebang",binary:"node",relevance:5}),v,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,h,m,g,b,E,{match:/\$\d+/},p,B,{scope:"attr",match:r+e.lookahead(":"),relevance:0},T,{begin:"("+n.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[E,n.REGEXP_MODE,{className:"function",begin:ie,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:n.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:S}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:o.begin,end:o.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"]}]}]},$,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+n.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[_,n.inherit(n.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},ce,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[_]},ue,Y,D,oe,{match:/\$[(.]/}]}}function XT(n){const e=n.regex,t=YT(n),r=Gs,o=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={begin:[/namespace/,/\s+/,n.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},s={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:o},contains:[t.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:Gs,keyword:zm.concat(c),literal:Vm,built_in:Km.concat(o),"variable.language":qm},u={className:"meta",begin:"@"+r},p=(g,b,y)=>{const E=g.contains.findIndex(C=>C.label===b);if(E===-1)throw new Error("can not find mode to replace");g.contains.splice(E,1,y)};Object.assign(t.keywords,d),t.exports.PARAMS_CONTAINS.push(u);const f=t.contains.find(g=>g.scope==="attr"),h=Object.assign({},f,{match:e.concat(r,e.lookahead(/\s*\?:/))});t.exports.PARAMS_CONTAINS.push([t.exports.CLASS_REFERENCE,f,h]),t.contains=t.contains.concat([u,i,s,h]),p(t,"shebang",n.SHEBANG()),p(t,"use_strict",a);const m=t.contains.find(g=>g.label==="func.def");return m.relevance=0,Object.assign(t,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),t}function ZT(n){const e=n.regex,t={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},o=/\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,o),/ *#/)},{begin:e.concat(/# */,a,/ *#/)},{begin:e.concat(/# */,s,/ *#/)},{begin:e.concat(/# */,e.either(i,o),/ +/,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=n.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),f=n.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:[t,r,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 QT(n){n.regex;const e=n.COMMENT(/\(;/,/;\)/);e.contains.push("self");const t=n.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],o={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:r},contains:[t,e,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},i,s,o,n.QUOTE_STRING_MODE,c,d,a]}}function eO(n){const e=n.regex,t=e.concat(/[\p{L}_]/u,e.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,o={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=n.inherit(i,{begin:/\(/,end:/\)/}),a=n.inherit(n.APOS_STRING_MODE,{className:"string"}),c=n.inherit(n.QUOTE_STRING_MODE,{className:"string"}),d={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[o]},{begin:/'/,end:/'/,contains:[o]},{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]}]}]},n.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},o,{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(t,e.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:t,relevance:0,starts:d}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(t,/>/))),contains:[{className:"name",begin:t,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function tO(n){const e="true false yes no null",t="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},o={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:[n.BACKSLASH_ESCAPE,o]},a=n.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=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+t},{className:"type",begin:"!<"+t+">"},{className:"type",begin:"!"+t},{className:"type",begin:"!!"+t},{className:"meta",begin:"&"+n.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+n.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},n.HASH_COMMENT_MODE,{beginKeywords:e,keywords:{literal:e}},f,{className:"number",begin:n.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 nO={arduino:P1,bash:$1,c:F1,cpp:z1,csharp:V1,css:Y1,diff:X1,go:Z1,graphql:Q1,ini:eT,java:tT,javascript:sT,json:aT,kotlin:cT,less:bT,lua:yT,makefile:kT,markdown:ET,objectivec:wT,perl:CT,php:_T,"php-template":ST,plaintext:xT,python:NT,"python-repl":TT,r:OT,ruby:MT,rust:AT,scss:FT,shell:zT,sql:VT,swift:JT,typescript:XT,vbnet:ZT,wasm:QT,xml:eO,yaml:tO};function rO(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var qc,Gm;function oO(){if(Gm)return qc;Gm=1;function n(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(O=>{const P=w[O],se=typeof P;(se==="object"||se==="function")&&!Object.isFrozen(P)&&n(P)}),w}class e{constructor(O){O.data===void 0&&(O.data={}),this.data=O.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function t(w){return w.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function r(w,...O){const P=Object.create(null);for(const se in w)P[se]=w[se];return O.forEach(function(se){for(const Ke in se)P[Ke]=se[Ke]}),P}const o="</span>",i=w=>!!w.scope,s=(w,{prefix:O})=>{if(w.startsWith("language:"))return w.replace("language:","language-");if(w.includes(".")){const P=w.split(".");return[`${O}${P.shift()}`,...P.map((se,Ke)=>`${se}${"_".repeat(Ke+1)}`)].join(" ")}return`${O}${w}`};class a{constructor(O,P){this.buffer="",this.classPrefix=P.classPrefix,O.walk(this)}addText(O){this.buffer+=t(O)}openNode(O){if(!i(O))return;const P=s(O.scope,{prefix:this.classPrefix});this.span(P)}closeNode(O){i(O)&&(this.buffer+=o)}value(){return this.buffer}span(O){this.buffer+=`<span class="${O}">`}}const c=(w={})=>{const O={children:[]};return Object.assign(O,w),O};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(O){this.top.children.push(O)}openNode(O){const P=c({scope:O});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(O){return this.constructor._walk(O,this.rootNode)}static _walk(O,P){return typeof P=="string"?O.addText(P):P.children&&(O.openNode(P),P.children.forEach(se=>this._walk(O,se)),O.closeNode(P)),O}static _collapse(O){typeof O!="string"&&O.children&&(O.children.every(P=>typeof P=="string")?O.children=[O.children.join("")]:O.children.forEach(P=>{d._collapse(P)}))}}class u extends d{constructor(O){super(),this.options=O}addText(O){O!==""&&this.add(O)}startScope(O){this.openNode(O)}endScope(){this.closeNode()}__addSublanguage(O,P){const se=O.root;P&&(se.scope=`language:${P}`),this.add(se)}toHTML(){return new a(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 O=w[w.length-1];return typeof O=="object"&&O.constructor===Object?(w.splice(w.length-1,1),O):{}}function y(...w){return"("+(b(w).capture?"":"?:")+w.map(se=>p(se)).join("|")+")"}function E(w){return new RegExp(w.toString()+"|").exec("").length-1}function C(w,O){const P=w&&w.exec(O);return P&&P.index===0}const k=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function S(w,{joinWith:O}){let P=0;return w.map(se=>{P+=1;const Ke=P;let Ve=p(se),q="";for(;Ve.length>0;){const H=k.exec(Ve);if(!H){q+=Ve;break}q+=Ve.substring(0,H.index),Ve=Ve.substring(H.index+H[0].length),H[0][0]==="\\"&&H[1]?q+="\\"+String(Number(H[1])+Ke):(q+=H[0],H[0]==="("&&P++)}return q}).map(se=>`(${se})`).join(O)}const _=/\b\B/,D="[a-zA-Z]\\w*",B="[a-zA-Z_]\\w*",v="\\b\\d+(\\.\\d+)?",$="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Y="\\b(0b[01]+)",te="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",ue=(w={})=>{const O=/^#![ ]*\//;return w.binary&&(w.begin=g(O,/.*\b/,w.binary,/\b.*/)),r({scope:"meta",begin:O,end:/$/,relevance:0,"on:begin":(P,se)=>{P.index!==0&&se.ignoreMatch()}},w)},ce={begin:"\\\\[\\s\\S]",relevance:0},oe={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[ce]},ie={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[ce]},T={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(w,O,P={}){const se=r({scope:"comment",begin:w,end:O,contains:[]},P);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 Ke=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(/[ ]+/,"(",Ke,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),se},z=A("//","$"),j=A("/\\*","\\*/"),ee=A("#","$"),he={scope:"number",begin:v,relevance:0},Oe={scope:"number",begin:$,relevance:0},ct={scope:"number",begin:Y,relevance:0},Me={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[ce,{begin:/\[/,end:/\]/,relevance:0,contains:[ce]}]},ze={scope:"title",begin:D,relevance:0},Yt={scope:"title",begin:B,relevance:0},bt={begin:"\\.\\s*"+B,relevance:0};var yt=Object.freeze({__proto__:null,APOS_STRING_MODE:oe,BACKSLASH_ESCAPE:ce,BINARY_NUMBER_MODE:ct,BINARY_NUMBER_RE:Y,COMMENT:A,C_BLOCK_COMMENT_MODE:j,C_LINE_COMMENT_MODE:z,C_NUMBER_MODE:Oe,C_NUMBER_RE:$,END_SAME_AS_BEGIN:function(w){return Object.assign(w,{"on:begin":(O,P)=>{P.data._beginMatch=O[1]},"on:end":(O,P)=>{P.data._beginMatch!==O[1]&&P.ignoreMatch()}})},HASH_COMMENT_MODE:ee,IDENT_RE:D,MATCH_NOTHING_RE:_,METHOD_GUARD:bt,NUMBER_MODE:he,NUMBER_RE:v,PHRASAL_WORDS_MODE:T,QUOTE_STRING_MODE:ie,REGEXP_MODE:Me,RE_STARTERS_RE:te,SHEBANG:ue,TITLE_MODE:ze,UNDERSCORE_IDENT_RE:B,UNDERSCORE_TITLE_MODE:Yt});function pn(w,O){w.input[w.index-1]==="."&&O.ignoreMatch()}function Bn(w,O){w.className!==void 0&&(w.scope=w.className,delete w.className)}function bn(w,O){O&&w.beginKeywords&&(w.begin="\\b("+w.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",w.__beforeBegin=pn,w.keywords=w.keywords||w.beginKeywords,delete w.beginKeywords,w.relevance===void 0&&(w.relevance=0))}function Xt(w,O){Array.isArray(w.illegal)&&(w.illegal=y(...w.illegal))}function yn(w,O){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 le(w,O){w.relevance===void 0&&(w.relevance=1)}const Vt=(w,O)=>{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(se=>{delete w[se]}),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},xt=["of","and","for","in","not","or","if","then","parent","list","value"],Z="keyword";function Dt(w,O,P=Z){const se=Object.create(null);return typeof w=="string"?Ke(P,w.split(" ")):Array.isArray(w)?Ke(P,w):Object.keys(w).forEach(function(Ve){Object.assign(se,Dt(w[Ve],O,Ve))}),se;function Ke(Ve,q){O&&(q=q.map(H=>H.toLowerCase())),q.forEach(function(H){const ae=H.split("|");se[ae[0]]=[Ve,Pe(ae[0],ae[1])]})}}function Pe(w,O){return O?Number(O):we(w)?0:1}function we(w){return xt.includes(w.toLowerCase())}const It={},et=w=>{console.error(w)},kn=(w,...O)=>{console.log(`WARN: ${w}`,...O)},Bt=(w,O)=>{It[`${w}/${O}`]||(console.log(`Deprecated as of ${w}. ${O}`),It[`${w}/${O}`]=!0)},L=new Error;function V(w,O,{key:P}){let se=0;const Ke=w[P],Ve={},q={};for(let H=1;H<=O.length;H++)q[H+se]=Ke[H],Ve[H+se]=!0,se+=E(O[H-1]);w[P]=q,w[P]._emit=Ve,w[P]._multi=!0}function pe(w){if(Array.isArray(w.begin)){if(w.skip||w.excludeBegin||w.returnBegin)throw et("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),L;if(typeof w.beginScope!="object"||w.beginScope===null)throw et("beginScope must be object"),L;V(w,w.begin,{key:"beginScope"}),w.begin=S(w.begin,{joinWith:""})}}function Ce(w){if(Array.isArray(w.end)){if(w.skip||w.excludeEnd||w.returnEnd)throw et("skip, excludeEnd, returnEnd not compatible with endScope: {}"),L;if(typeof w.endScope!="object"||w.endScope===null)throw et("endScope must be object"),L;V(w,w.end,{key:"endScope"}),w.end=S(w.end,{joinWith:""})}}function nt(w){w.scope&&typeof w.scope=="object"&&w.scope!==null&&(w.beginScope=w.scope,delete w.scope)}function Zt(w){nt(w),typeof w.beginScope=="string"&&(w.beginScope={_wrap:w.beginScope}),typeof w.endScope=="string"&&(w.endScope={_wrap:w.endScope}),pe(w),Ce(w)}function vi(w){function O(q,H){return new RegExp(p(q),"m"+(w.case_insensitive?"i":"")+(w.unicodeRegex?"u":"")+(H?"g":""))}class P{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+=E(H)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const H=this.regexes.map(ae=>ae[1]);this.matcherRe=O(S(H,{joinWith:"|"}),!0),this.lastIndex=0}exec(H){this.matcherRe.lastIndex=this.lastIndex;const ae=this.matcherRe.exec(H);if(!ae)return null;const ut=ae.findIndex((Di,Sd)=>Sd>0&&Di!==void 0),rt=this.matchIndexes[ut];return ae.splice(0,ut),Object.assign(ae,rt)}}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 P;return this.rules.slice(H).forEach(([ut,rt])=>ae.addRule(ut,rt)),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 ut=ae.exec(H);if(this.resumingScanAtSamePosition()&&!(ut&&ut.index===this.lastIndex)){const rt=this.getMatcher(0);rt.lastIndex=this.lastIndex+1,ut=rt.exec(H)}return ut&&(this.regexIndex+=ut.position+1,this.regexIndex===this.count&&this.considerAll()),ut}}function Ke(q){const H=new se;return q.contains.forEach(ae=>H.addRule(ae.begin,{rule:ae,type:"begin"})),q.terminatorEnd&&H.addRule(q.terminatorEnd,{type:"end"}),q.illegal&&H.addRule(q.illegal,{type:"illegal"}),H}function Ve(q,H){const ae=q;if(q.isCompiled)return ae;[Bn,yn,Zt,Vt].forEach(rt=>rt(q,H)),w.compilerExtensions.forEach(rt=>rt(q,H)),q.__beforeBegin=null,[bn,Xt,le].forEach(rt=>rt(q,H)),q.isCompiled=!0;let ut=null;return typeof q.keywords=="object"&&q.keywords.$pattern&&(q.keywords=Object.assign({},q.keywords),ut=q.keywords.$pattern,delete q.keywords.$pattern),ut=ut||/\w+/,q.keywords&&(q.keywords=Dt(q.keywords,w.case_insensitive)),ae.keywordPatternRe=O(ut,!0),H&&(q.begin||(q.begin=/\B|\b/),ae.beginRe=O(ae.begin),!q.end&&!q.endsWithParent&&(q.end=/\B|\b/),q.end&&(ae.endRe=O(ae.end)),ae.terminatorEnd=p(ae.end)||"",q.endsWithParent&&H.terminatorEnd&&(ae.terminatorEnd+=(q.end?"|":"")+H.terminatorEnd)),q.illegal&&(ae.illegalRe=O(q.illegal)),q.contains||(q.contains=[]),q.contains=[].concat(...q.contains.map(function(rt){return W(rt==="self"?q:rt)})),q.contains.forEach(function(rt){Ve(rt,ae)}),q.starts&&Ve(q.starts,H),ae.matcher=Ke(ae),ae}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=r(w.classNameAliases||{}),Ve(w)}function N(w){return w?w.endsWithParent||N(w.starts):!1}function W(w){return w.variants&&!w.cachedVariants&&(w.cachedVariants=w.variants.map(function(O){return r(w,{variants:null},O)})),w.cachedVariants?w.cachedVariants:N(w)?r(w,{starts:w.starts?r(w.starts):null}):Object.isFrozen(w)?r(w):w}var ne="11.11.1";class xe extends Error{constructor(O,P){super(O),this.name="HTMLInjectionError",this.html=P}}const ye=t,dt=r,Lt=Symbol("nomatch"),_r=7,Ri=function(w){const O=Object.create(null),P=Object.create(null),se=[];let Ke=!0;const Ve="Could not find the language '{}', did you forget to load/include a language module?",q={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(I){return H.noHighlightRe.test(I)}function ut(I){let X=I.className+" ";X+=I.parentNode?I.parentNode.className:"";const ke=H.languageDetectRe.exec(X);if(ke){const He=Sr(ke[1]);return He||(kn(Ve.replace("{}",ke[1])),kn("Falling back to no-highlight mode for this block.",I)),He?ke[1]:"no-highlight"}return X.split(/\s+/).find(He=>ae(He)||Sr(He))}function rt(I,X,ke){let He="",ot="";typeof X=="object"?(He=I,ke=X.ignoreIllegals,ot=X.language):(Bt("10.7.0","highlight(lang, code, ...args) has been deprecated."),Bt("10.7.0",`Please use highlight(code, options) instead.
120
+ https://github.com/highlightjs/highlight.js/issues/2277`),ot=I,He=X),ke===void 0&&(ke=!0);const En={code:He,language:ot};Ia("before:highlight",En);const xr=En.result?En.result:Di(En.language,En.code,ke);return xr.code=En.code,Ia("after:highlight",xr),xr}function Di(I,X,ke,He){const ot=Object.create(null);function En(F,G){return F.keywords[G]}function xr(){if(!fe.keywords){kt.addText(Ue);return}let F=0;fe.keywordPatternRe.lastIndex=0;let G=fe.keywordPatternRe.exec(Ue),be="";for(;G;){be+=Ue.substring(F,G.index);const Re=Pn.case_insensitive?G[0].toLowerCase():G[0],Nt=En(fe,Re);if(Nt){const[Xn,Xv]=Nt;if(kt.addText(be),be="",ot[Re]=(ot[Re]||0)+1,ot[Re]<=_r&&(Pa+=Xv),Xn.startsWith("_"))be+=G[0];else{const Zv=Pn.classNameAliases[Xn]||Xn;Ln(G[0],Zv)}}else be+=G[0];F=fe.keywordPatternRe.lastIndex,G=fe.keywordPatternRe.exec(Ue)}be+=Ue.substring(F),kt.addText(be)}function Ba(){if(Ue==="")return;let F=null;if(typeof fe.subLanguage=="string"){if(!O[fe.subLanguage]){kt.addText(Ue);return}F=Di(fe.subLanguage,Ue,!0,eb[fe.subLanguage]),eb[fe.subLanguage]=F._top}else F=xd(Ue,fe.subLanguage.length?fe.subLanguage:null);fe.relevance>0&&(Pa+=F.relevance),kt.__addSublanguage(F._emitter,F.language)}function Qt(){fe.subLanguage!=null?Ba():xr(),Ue=""}function Ln(F,G){F!==""&&(kt.startScope(G),kt.addText(F),kt.endScope())}function Yg(F,G){let be=1;const Re=G.length-1;for(;be<=Re;){if(!F._emit[be]){be++;continue}const Nt=Pn.classNameAliases[F[be]]||F[be],Xn=G[be];Nt?Ln(Xn,Nt):(Ue=Xn,xr(),Ue=""),be++}}function Xg(F,G){return F.scope&&typeof F.scope=="string"&&kt.openNode(Pn.classNameAliases[F.scope]||F.scope),F.beginScope&&(F.beginScope._wrap?(Ln(Ue,Pn.classNameAliases[F.beginScope._wrap]||F.beginScope._wrap),Ue=""):F.beginScope._multi&&(Yg(F.beginScope,G),Ue="")),fe=Object.create(F,{parent:{value:fe}}),fe}function Zg(F,G,be){let Re=C(F.endRe,be);if(Re){if(F["on:end"]){const Nt=new e(F);F["on:end"](G,Nt),Nt.isMatchIgnored&&(Re=!1)}if(Re){for(;F.endsParent&&F.parent;)F=F.parent;return F}}if(F.endsWithParent)return Zg(F.parent,G,be)}function Kv(F){return fe.matcher.regexIndex===0?(Ue+=F[0],1):(Md=!0,0)}function Gv(F){const G=F[0],be=F.rule,Re=new e(be),Nt=[be.__beforeBegin,be["on:begin"]];for(const Xn of Nt)if(Xn&&(Xn(F,Re),Re.isMatchIgnored))return Kv(G);return be.skip?Ue+=G:(be.excludeBegin&&(Ue+=G),Qt(),!be.returnBegin&&!be.excludeBegin&&(Ue=G)),Xg(be,F),be.returnBegin?0:G.length}function jv(F){const G=F[0],be=X.substring(F.index),Re=Zg(fe,F,be);if(!Re)return Lt;const Nt=fe;fe.endScope&&fe.endScope._wrap?(Qt(),Ln(G,fe.endScope._wrap)):fe.endScope&&fe.endScope._multi?(Qt(),Yg(fe.endScope,F)):Nt.skip?Ue+=G:(Nt.returnEnd||Nt.excludeEnd||(Ue+=G),Qt(),Nt.excludeEnd&&(Ue=G));do fe.scope&&kt.closeNode(),!fe.skip&&!fe.subLanguage&&(Pa+=fe.relevance),fe=fe.parent;while(fe!==Re.parent);return Re.starts&&Xg(Re.starts,F),Nt.returnEnd?0:G.length}function Jv(){const F=[];for(let G=fe;G!==Pn;G=G.parent)G.scope&&F.unshift(G.scope);F.forEach(G=>kt.openNode(G))}let La={};function Qg(F,G){const be=G&&G[0];if(Ue+=F,be==null)return Qt(),0;if(La.type==="begin"&&G.type==="end"&&La.index===G.index&&be===""){if(Ue+=X.slice(G.index,G.index+1),!Ke){const Re=new Error(`0 width match regex (${I})`);throw Re.languageName=I,Re.badRule=La.rule,Re}return 1}if(La=G,G.type==="begin")return Gv(G);if(G.type==="illegal"&&!ke){const Re=new Error('Illegal lexeme "'+be+'" for mode "'+(fe.scope||"<unnamed>")+'"');throw Re.mode=fe,Re}else if(G.type==="end"){const Re=jv(G);if(Re!==Lt)return Re}if(G.type==="illegal"&&be==="")return Ue+=`
121
+ `,1;if(Od>1e5&&Od>G.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Ue+=be,be.length}const Pn=Sr(I);if(!Pn)throw et(Ve.replace("{}",I)),new Error('Unknown language: "'+I+'"');const Yv=vi(Pn);let Td="",fe=He||Yv;const eb={},kt=new H.__emitter(H);Jv();let Ue="",Pa=0,Zr=0,Od=0,Md=!1;try{if(Pn.__emitTokens)Pn.__emitTokens(X,kt);else{for(fe.matcher.considerAll();;){Od++,Md?Md=!1:fe.matcher.considerAll(),fe.matcher.lastIndex=Zr;const F=fe.matcher.exec(X);if(!F)break;const G=X.substring(Zr,F.index),be=Qg(G,F);Zr=F.index+be}Qg(X.substring(Zr))}return kt.finalize(),Td=kt.toHTML(),{language:I,value:Td,relevance:Pa,illegal:!1,_emitter:kt,_top:fe}}catch(F){if(F.message&&F.message.includes("Illegal"))return{language:I,value:ye(X),illegal:!0,relevance:0,_illegalBy:{message:F.message,index:Zr,context:X.slice(Zr-100,Zr+100),mode:F.mode,resultSoFar:Td},_emitter:kt};if(Ke)return{language:I,value:ye(X),illegal:!1,relevance:0,errorRaised:F,_emitter:kt,_top:fe};throw F}}function Sd(I){const X={value:ye(I),illegal:!1,relevance:0,_top:q,_emitter:new H.__emitter(H)};return X._emitter.addText(I),X}function xd(I,X){X=X||H.languages||Object.keys(O);const ke=Sd(I),He=X.filter(Sr).filter(Jg).map(Qt=>Di(Qt,I,!1));He.unshift(ke);const ot=He.sort((Qt,Ln)=>{if(Qt.relevance!==Ln.relevance)return Ln.relevance-Qt.relevance;if(Qt.language&&Ln.language){if(Sr(Qt.language).supersetOf===Ln.language)return 1;if(Sr(Ln.language).supersetOf===Qt.language)return-1}return 0}),[En,xr]=ot,Ba=En;return Ba.secondBest=xr,Ba}function Bv(I,X,ke){const He=X&&P[X]||ke;I.classList.add("hljs"),I.classList.add(`language-${He}`)}function Nd(I){let X=null;const ke=ut(I);if(ae(ke))return;if(Ia("before:highlightElement",{el:I,language:ke}),I.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",I);return}if(I.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(I)),H.throwUnescapedHTML))throw new xe("One of your code blocks includes unescaped HTML.",I.innerHTML);X=I;const He=X.textContent,ot=ke?rt(He,{language:ke,ignoreIllegals:!0}):xd(He);I.innerHTML=ot.value,I.dataset.highlighted="yes",Bv(I,ke,ot.language),I.result={language:ot.language,re:ot.relevance,relevance:ot.relevance},ot.secondBest&&(I.secondBest={language:ot.secondBest.language,relevance:ot.secondBest.relevance}),Ia("after:highlightElement",{el:I,result:ot,text:He})}function Lv(I){H=dt(H,I)}const Pv=()=>{Da(),Bt("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function $v(){Da(),Bt("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Gg=!1;function Da(){function I(){Da()}if(document.readyState==="loading"){Gg||window.addEventListener("DOMContentLoaded",I,!1),Gg=!0;return}document.querySelectorAll(H.cssSelector).forEach(Nd)}function Fv(I,X){let ke=null;try{ke=X(w)}catch(He){if(et("Language definition for '{}' could not be registered.".replace("{}",I)),Ke)et(He);else throw He;ke=q}ke.name||(ke.name=I),O[I]=ke,ke.rawDefinition=X.bind(null,w),ke.aliases&&jg(ke.aliases,{languageName:I})}function zv(I){delete O[I];for(const X of Object.keys(P))P[X]===I&&delete P[X]}function Vv(){return Object.keys(O)}function Sr(I){return I=(I||"").toLowerCase(),O[I]||O[P[I]]}function jg(I,{languageName:X}){typeof I=="string"&&(I=[I]),I.forEach(ke=>{P[ke.toLowerCase()]=X})}function Jg(I){const X=Sr(I);return X&&!X.disableAutodetect}function Hv(I){I["before:highlightBlock"]&&!I["before:highlightElement"]&&(I["before:highlightElement"]=X=>{I["before:highlightBlock"](Object.assign({block:X.el},X))}),I["after:highlightBlock"]&&!I["after:highlightElement"]&&(I["after:highlightElement"]=X=>{I["after:highlightBlock"](Object.assign({block:X.el},X))})}function Uv(I){Hv(I),se.push(I)}function Wv(I){const X=se.indexOf(I);X!==-1&&se.splice(X,1)}function Ia(I,X){const ke=I;se.forEach(function(He){He[ke]&&He[ke](X)})}function qv(I){return Bt("10.7.0","highlightBlock will be removed entirely in v12.0"),Bt("10.7.0","Please use highlightElement now."),Nd(I)}Object.assign(w,{highlight:rt,highlightAuto:xd,highlightAll:Da,highlightElement:Nd,highlightBlock:qv,configure:Lv,initHighlighting:Pv,initHighlightingOnLoad:$v,registerLanguage:Fv,unregisterLanguage:zv,listLanguages:Vv,getLanguage:Sr,registerAliases:jg,autoDetection:Jg,inherit:dt,addPlugin:Uv,removePlugin:Wv}),w.debugMode=function(){Ke=!1},w.safeMode=function(){Ke=!0},w.versionString=ne,w.regex={concat:g,lookahead:f,either:y,optional:m,anyNumberOfTimes:h};for(const I in yt)typeof yt[I]=="object"&&n(yt[I]);return Object.assign(w,yt),w},Ht=Ri({});return Ht.newInstance=()=>Ri({}),qc=Ht,Ht.HighlightJS=Ht,Ht.default=Ht,qc}var iO=oO();const sO=rO(iO),jm={},aO="hljs-";function lO(n){const e=sO.newInstance();return n&&i(n),{highlight:t,highlightAuto:r,listLanguages:o,register:i,registerAlias:s,registered:a};function t(c,d,u){const p=u||jm,f=typeof p.prefix=="string"?p.prefix:aO;if(!e.getLanguage(c))throw new Error("Unknown language: `"+c+"` is not registered");e.configure({__emitter:cO,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 r(c,d){const p=(d||jm).subset||o();let f=-1,h=0,m;for(;++f<p.length;){const g=p[f];if(!e.getLanguage(g))continue;const b=t(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 o(){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 cO{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 t=this.stack[this.stack.length-1],r=t.children[t.children.length-1];r&&r.type==="text"?r.value+=e:t.children.push({type:"text",value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,t){const r=this.stack[this.stack.length-1],o=e.root.children;t?r.children.push({type:"element",tagName:"span",properties:{className:[t]},children:o}):r.children.push(...o)}openNode(e){const t=this,r=e.split(".").map(function(s,a){return a?s+"_".repeat(a):t.options.classPrefix+s}),o=this.stack[this.stack.length-1],i={type:"element",tagName:"span",properties:{className:r},children:[]};o.children.push(i),this.stack.push(i)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}function dO(n){const e=document.createElement("textarea");e.value=n,e.contentEditable="true",e.style.position="fixed",document.body.appendChild(e),e.focus(),e.select();const t=document.execCommand("copy");return e.remove(),t}function uO(n){return navigator.clipboard!==void 0?navigator.clipboard.writeText(n):new Promise((e,t)=>{const r=dO(n);r?e(!0):t(r)})}const pO={class:"code-block-toolbar"},fO={class:"wrap editable"},hO={class:"wrap"},mO={class:"language readonly"},gO=l.defineComponent({__name:"view",props:st,setup(n){const e=n,t=l.ref("content_copy"),r=l.computed({get(){return e.node.attrs.language},set(d){e.updateAttributes({language:d})}}),o=l.computed({get(){return e.node.attrs.wrap},set(d){e.updateAttributes({wrap:d})}}),i=l.computed(()=>o.value?"text_select_move_down":"format_text_wrap");function s(d){r.value=d}function a(){const d=e.node.content.content[0].text;uO(d).then(()=>{t.value="done",setTimeout(()=>{t.value="content_copy"},2e3)})}function c(){o.value=!o.value}return(d,u)=>(l.openBlock(),l.createBlock(l.unref(An),l.mergeProps(e,{class:"o-code-block-view"}),{default:l.withCtx(()=>[l.createElementVNode("div",pO,[l.createElementVNode("div",fO,[l.createVNode(l.unref(Gh),{language:r.value,onSelect:s},null,8,["language"])]),l.createElementVNode("div",hO,[l.createElementVNode("div",mO,l.toDisplayString(r.value),1),l.createVNode(l.unref(ve),{icon:i.value,"icon-class":{"rotate-270":o.value},tooltip:"Wrap",class:"editable",onClick:c},null,8,["icon","icon-class"]),l.createVNode(l.unref(ve),{icon:t.value,tooltip:"Copy",onClick:a},null,8,["icon"])])]),l.createElementVNode("pre",null,[l.createVNode(l.unref(Gn),{as:"code",class:l.normalizeClass({wrap:o.value})},null,8,["class"])])]),_:1},16))}}),bO=lO(nO),yO=B1.extend({draggable:!0,addAttributes(){var n;return{...(n=this.parent)==null?void 0:n.call(this),wrap:{default:!0,rendered:!1}}},addNodeView(){return hn(gO)}}).configure({languageClassPrefix:"language-",defaultLanguage:"bash",lowlight:bO}),Jm=n=>{const e=/(#[0-9a-f]{3,6})\b/gi,t=[];return n.descendants((r,o)=>{r.text&&Array.from(r.text.matchAll(e)).forEach(i=>{const s=i[0],a=i.index||0,c=o+a,d=c+s.length,u=Qe.inline(c,d,{class:"color",style:`--color: ${s}`});t.push(u)})}),Te.create(n,t)},kO=Ae.create({name:"colorHighlighter",addProseMirrorPlugins(){return[new Ne({state:{init(n,{doc:e}){return Jm(e)},apply(n,e){return n.docChanged?Jm(n.doc):e}},props:{decorations(n){return this.getState(n)}}})]}});Ae.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Ne({key:new Fe("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:o}=e,i=[];if(!t||!r)return Te.create(n,[]);let s=0;this.options.mode==="deepest"&&n.descendants((c,d)=>{if(c.isText)return;if(!(o>=d&&o<=d+c.nodeSize-1))return!1;s+=1});let a=0;return n.descendants((c,d)=>{if(c.isText||!(o>=d&&o<=d+c.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&s-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";i.push(Qe.node(d,d+c.nodeSize,{class:this.options.className}))}),Te.create(n,i)}}})]}});const EO=l.defineComponent({__name:"view",props:st,setup(n){const e=n,t=l.computed(()=>e.node.attrs.level);return(r,o)=>(l.openBlock(),l.createBlock(l.unref(An),l.mergeProps(e,{class:["o-heading-view",`h${t.value}`],"data-id":r.node.attrs["data-id"],style:`text-align: ${r.node.attrs.textAlign}`}),{default:l.withCtx(()=>[l.createVNode(l.unref(Gn))]),_:1},16,["class","data-id","style"]))}}),wO=Rh.extend({draggable:!0,addNodeView(){return hn(EO)}}),CO={class:"horizontal"},_O=l.defineComponent({__name:"view",props:st,setup(n){const e=n;return(t,r)=>(l.openBlock(),l.createBlock(l.unref(An),l.mergeProps(e,{class:"o-horizontal-view"}),{default:l.withCtx(()=>[l.createElementVNode("div",CO,[l.createVNode(l.unref(Gn),{as:"div",class:"divider"})])]),_:1},16))}}),SO=Fh.extend({draggable:!0,addNodeView(){return hn(_O)}}),xO=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Ym=Ge.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:n}){return["img",Se(this.options.HTMLAttributes,n)]},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[oc({find:xO,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}}),NO={key:1,class:"image-container"},TO={key:1},OO=l.defineComponent({__name:"view",props:st,setup(n){const e=n,t=l.ref(!1),r=l.ref(!1),o=l.ref({}),i=l.ref(null),s=l.ref(!1),a=l.computed(()=>e.node.attrs),c=l.computed({get(){return e.node.attrs.src},set(b){e.updateAttributes({src:b})}}),d=l.computed({get(){return e.node.attrs.title},set(b){e.updateAttributes({title:b})}});function u(){s.value=!0,setTimeout(()=>{var b;(b=i.value)==null||b.focus()},0)}function p(){s.value=!1}function f(){c.value==="init"&&g(!0)}function h(b){switch(t.value=!1,b.value){case"replace":g(!0);break}}function m(b){c.value=b,g(!1)}function g(b){r.value=b}return l.onMounted(()=>{g(c.value==="init")}),(b,y)=>{var E;return l.openBlock(),l.createBlock(l.unref(An),l.mergeProps(e,{class:["o-image-view",{"with-caption":a.value.alt,"with-ratio":a.value.ratio,readonly:!((E=b.editor)!=null&&E.isEditable),init:c.value==="init"}],size:a.value.size,as:"div",onClick:f}),{default:l.withCtx(()=>[l.createVNode(l.unref(So),{modelValue:r.value,"onUpdate:modelValue":y[1]||(y[1]=C=>r.value=C),placement:c.value==="init"?"bottom":"top","show-arrow":""},{"popover-content":l.withCtx(()=>[l.createVNode(l.unref(Rc),{val:c.value==="init"?"":c.value,type:"image",onInput:m},null,8,["val"])]),default:l.withCtx(()=>{var C;return[c.value==="init"?(l.openBlock(),l.createBlock(l.unref(Tc),{key:0,icon:"image",placeholder:"Add an image"})):(l.openBlock(),l.createElementBlock("div",NO,[l.createVNode(l.unref(Mc),l.mergeProps(e,{onAction:h}),{default:l.withCtx(()=>[l.createVNode(l.unref(ve),{icon:"subtitles",tooltip:"image.caption",onClick:u})]),_:1},16),l.createElementVNode("img",l.mergeProps(a.value,{draggable:"true","data-drag-handle":""}),null,16),l.createElementVNode("div",{class:"caption",onClick:u},[(C=b.editor)!=null&&C.isEditable&&s.value?(l.openBlock(),l.createBlock(l.unref(xo),{key:0,ref_key:"captionInput",ref:i,class:"caption-input",modelValue:d.value,"onUpdate:modelValue":y[0]||(y[0]=k=>d.value=k),type:"text",placeholder:"Input caption",autosize:"",onBlur:p},null,8,["modelValue"])):(l.openBlock(),l.createElementBlock("span",TO,l.toDisplayString(d.value),1))])]))]}),_:1},8,["modelValue","placement"]),l.createVNode(l.unref(vs),{modelValue:t.value,"onUpdate:modelValue":y[2]||(y[2]=C=>t.value=C),event:o.value},{default:l.withCtx(()=>[l.createVNode(l.unref(qr),l.mergeProps(e,{onAction:h}),null,16)]),_:1},8,["modelValue","event"])]),_:1},16,["class","size"])}}}),MO=Ym.extend({draggable:!0,addAttributes(){var n;return{...(n=this.parent)==null?void 0:n.call(this),size:{default:"",rendered:!1},ratio:{default:"",rendered:!1},isDraggable:{default:!0,renderHTML:e=>({})}}},renderHTML({node:n,HTMLAttributes:e}){return e.size=n.attrs.size,e.ratio=n.attrs.ratio,["img",Se(this.options.HTMLAttributes,e)]},addNodeView(){return hn(OO)}}).configure({inline:!0}),AO="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",vO="ελ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",Ao=(n,e)=>{for(const t in e)n[t]=e[t];return n},Kc="numeric",Gc="ascii",jc="alpha",Ei="asciinumeric",wi="alphanumeric",Jc="domain",Xm="emoji",RO="scheme",DO="slashscheme",Yc="whitespace";function IO(n,e){return n in e||(e[n]=[]),e[n]}function Jr(n,e,t){e[Kc]&&(e[Ei]=!0,e[wi]=!0),e[Gc]&&(e[Ei]=!0,e[jc]=!0),e[Ei]&&(e[wi]=!0),e[jc]&&(e[wi]=!0),e[wi]&&(e[Jc]=!0),e[Xm]&&(e[Jc]=!0);for(const r in e){const o=IO(r,t);o.indexOf(n)<0&&o.push(n)}}function BO(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function zt(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}zt.groups={},zt.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;r<e.jr.length;r++){const o=e.jr[r][0],i=e.jr[r][1];if(i&&o.test(n))return i}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,r){for(let o=0;o<n.length;o++)this.tt(n[o],e,t,r)},tr(n,e,t,r){r=r||zt.groups;let o;return e&&e.j?o=e:(o=new zt(e),t&&r&&Jr(e,t,r)),this.jr.push([n,o]),o},ts(n,e,t,r){let o=this;const i=n.length;if(!i)return o;for(let s=0;s<i-1;s++)o=o.tt(n[s]);return o.tt(n[i-1],e,t,r)},tt(n,e,t,r){r=r||zt.groups;const o=this;if(e&&e.j)return o.j[n]=e,e;const i=e;let s,a=o.go(n);if(a?(s=new zt,Ao(s.j,a.j),s.jr.push.apply(s.jr,a.jr),s.jd=a.jd,s.t=a.t):s=new zt,i){if(r)if(s.t&&typeof s.t=="string"){const c=Ao(BO(s.t,r),t);Jr(i,c,r)}else t&&Jr(i,t,r);s.t=i}return o.j[n]=s,s}};const ge=(n,e,t,r,o)=>n.ta(e,t,r,o),Xe=(n,e,t,r,o)=>n.tr(e,t,r,o),Zm=(n,e,t,r,o)=>n.ts(e,t,r,o),R=(n,e,t,r,o)=>n.tt(e,t,r,o),jn="WORD",Xc="UWORD",Qm="ASCIINUMERICAL",eg="ALPHANUMERICAL",Ci="LOCALHOST",Zc="TLD",Qc="UTLD",js="SCHEME",vo="SLASH_SCHEME",ed="NUM",td="WS",nd="NL",_i="OPENBRACE",Si="CLOSEBRACE",Js="OPENBRACKET",Ys="CLOSEBRACKET",Xs="OPENPAREN",Zs="CLOSEPAREN",Qs="OPENANGLEBRACKET",ea="CLOSEANGLEBRACKET",ta="FULLWIDTHLEFTPAREN",na="FULLWIDTHRIGHTPAREN",ra="LEFTCORNERBRACKET",oa="RIGHTCORNERBRACKET",ia="LEFTWHITECORNERBRACKET",sa="RIGHTWHITECORNERBRACKET",aa="FULLWIDTHLESSTHAN",la="FULLWIDTHGREATERTHAN",ca="AMPERSAND",rd="APOSTROPHE",da="ASTERISK",kr="AT",ua="BACKSLASH",pa="BACKTICK",fa="CARET",Er="COLON",od="COMMA",ha="DOLLAR",Rn="DOT",ma="EQUALS",id="EXCLAMATION",cn="HYPHEN",xi="PERCENT",ga="PIPE",ba="PLUS",ya="POUND",Ni="QUERY",sd="QUOTE",tg="FULLWIDTHMIDDLEDOT",ad="SEMI",Dn="SLASH",Ti="TILDE",ka="UNDERSCORE",ng="EMOJI",Ea="SYM";var rg=Object.freeze({__proto__:null,WORD:jn,UWORD:Xc,ASCIINUMERICAL:Qm,ALPHANUMERICAL:eg,LOCALHOST:Ci,TLD:Zc,UTLD:Qc,SCHEME:js,SLASH_SCHEME:vo,NUM:ed,WS:td,NL:nd,OPENBRACE:_i,CLOSEBRACE:Si,OPENBRACKET:Js,CLOSEBRACKET:Ys,OPENPAREN:Xs,CLOSEPAREN:Zs,OPENANGLEBRACKET:Qs,CLOSEANGLEBRACKET:ea,FULLWIDTHLEFTPAREN:ta,FULLWIDTHRIGHTPAREN:na,LEFTCORNERBRACKET:ra,RIGHTCORNERBRACKET:oa,LEFTWHITECORNERBRACKET:ia,RIGHTWHITECORNERBRACKET:sa,FULLWIDTHLESSTHAN:aa,FULLWIDTHGREATERTHAN:la,AMPERSAND:ca,APOSTROPHE:rd,ASTERISK:da,AT:kr,BACKSLASH:ua,BACKTICK:pa,CARET:fa,COLON:Er,COMMA:od,DOLLAR:ha,DOT:Rn,EQUALS:ma,EXCLAMATION:id,HYPHEN:cn,PERCENT:xi,PIPE:ga,PLUS:ba,POUND:ya,QUERY:Ni,QUOTE:sd,FULLWIDTHMIDDLEDOT:tg,SEMI:ad,SLASH:Dn,TILDE:Ti,UNDERSCORE:ka,EMOJI:ng,SYM:Ea});const Jn=/[a-z]/,Oi=new RegExp("\\p{L}","u"),ld=new RegExp("\\p{Emoji}","u"),Yn=/\d/,cd=/\s/,og="\r",dd=`
122
+ `,LO="️",PO="‍",ud="";let wa=null,Ca=null;function $O(n=[]){const e={};zt.groups=e;const t=new zt;wa==null&&(wa=sg(AO)),Ca==null&&(Ca=sg(vO)),R(t,"'",rd),R(t,"{",_i),R(t,"}",Si),R(t,"[",Js),R(t,"]",Ys),R(t,"(",Xs),R(t,")",Zs),R(t,"<",Qs),R(t,">",ea),R(t,"(",ta),R(t,")",na),R(t,"「",ra),R(t,"」",oa),R(t,"『",ia),R(t,"』",sa),R(t,"<",aa),R(t,">",la),R(t,"&",ca),R(t,"*",da),R(t,"@",kr),R(t,"`",pa),R(t,"^",fa),R(t,":",Er),R(t,",",od),R(t,"$",ha),R(t,".",Rn),R(t,"=",ma),R(t,"!",id),R(t,"-",cn),R(t,"%",xi),R(t,"|",ga),R(t,"+",ba),R(t,"#",ya),R(t,"?",Ni),R(t,'"',sd),R(t,"/",Dn),R(t,";",ad),R(t,"~",Ti),R(t,"_",ka),R(t,"\\",ua),R(t,"・",tg);const r=Xe(t,Yn,ed,{[Kc]:!0});Xe(r,Yn,r);const o=Xe(r,Jn,Qm,{[Ei]:!0}),i=Xe(r,Oi,eg,{[wi]:!0}),s=Xe(t,Jn,jn,{[Gc]:!0});Xe(s,Yn,o),Xe(s,Jn,s),Xe(o,Yn,o),Xe(o,Jn,o);const a=Xe(t,Oi,Xc,{[jc]:!0});Xe(a,Jn),Xe(a,Yn,i),Xe(a,Oi,a),Xe(i,Yn,i),Xe(i,Jn),Xe(i,Oi,i);const c=R(t,dd,nd,{[Yc]:!0}),d=R(t,og,td,{[Yc]:!0}),u=Xe(t,cd,td,{[Yc]:!0});R(t,ud,u),R(d,dd,c),R(d,ud,u),Xe(d,cd,u),R(u,og),R(u,dd),Xe(u,cd,u),R(u,ud,u);const p=Xe(t,ld,ng,{[Xm]:!0});R(p,"#"),Xe(p,ld,p),R(p,LO,p);const f=R(p,PO);R(f,"#"),Xe(f,ld,p);const h=[[Jn,s],[Yn,o]],m=[[Jn,null],[Oi,a],[Yn,i]];for(let g=0;g<wa.length;g++)wr(t,wa[g],Zc,jn,h);for(let g=0;g<Ca.length;g++)wr(t,Ca[g],Qc,Xc,m);Jr(Zc,{tld:!0,ascii:!0},e),Jr(Qc,{utld:!0,alpha:!0},e),wr(t,"file",js,jn,h),wr(t,"mailto",js,jn,h),wr(t,"http",vo,jn,h),wr(t,"https",vo,jn,h),wr(t,"ftp",vo,jn,h),wr(t,"ftps",vo,jn,h),Jr(js,{scheme:!0,ascii:!0},e),Jr(vo,{slashscheme:!0,ascii:!0},e),n=n.sort((g,b)=>g[0]>b[0]?1:-1);for(let g=0;g<n.length;g++){const b=n[g][0],E=n[g][1]?{[RO]:!0}:{[DO]:!0};b.indexOf("-")>=0?E[Jc]=!0:Jn.test(b)?Yn.test(b)?E[Ei]=!0:E[Gc]=!0:E[Kc]=!0,Zm(t,b,b,E)}return Zm(t,"localhost",Ci,{ascii:!0}),t.jd=new zt(Ea),{start:t,tokens:Ao({groups:e},rg)}}function ig(n,e){const t=FO(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=t.length,o=[];let i=0,s=0;for(;s<r;){let a=n,c=null,d=0,u=null,p=-1,f=-1;for(;s<r&&(c=a.go(t[s]));)a=c,a.accepts()?(p=0,f=0,u=a):p>=0&&(p+=t[s].length,f++),d+=t[s].length,i+=t[s].length,s++;i-=p,s-=f,d-=p,o.push({t:u.t,v:e.slice(i-d,i),s:i-d,e:i})}return o}function FO(n){const e=[],t=n.length;let r=0;for(;r<t;){let o=n.charCodeAt(r),i,s=o<55296||o>56319||r+1===t||(i=n.charCodeAt(r+1))<56320||i>57343?n[r]:n.slice(r,r+2);e.push(s),r+=s.length}return e}function wr(n,e,t,r,o){let i;const s=e.length;for(let a=0;a<s-1;a++){const c=e[a];n.j[c]?i=n.j[c]:(i=new zt(r),i.jr=o.slice(),n.j[c]=i),n=i}return i=new zt(t),i.jr=o.slice(),n.j[e[s-1]]=i,i}function sg(n){const e=[],t=[];let r=0,o="0123456789";for(;r<n.length;){let i=0;for(;o.indexOf(n[r+i])>=0;)i++;if(i>0){e.push(t.join(""));for(let s=parseInt(n.substring(r,r+i),10);s>0;s--)t.pop();r+=i}else t.push(n[r]),r++}return e}const Mi={defaultProtocol:"http",events:null,format:ag,formatHref:ag,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function pd(n,e=null){let t=Ao({},Mi);n&&(t=Ao(t,n instanceof pd?n.o:n));const r=t.ignoreTags,o=[];for(let i=0;i<r.length;i++)o.push(r[i].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=o}pd.prototype={o:Mi,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let o=this.o[n];return o&&(typeof o=="object"?(o=t.t in o?o[t.t]:Mi[n],typeof o=="function"&&r&&(o=o(e,t))):typeof o=="function"&&r&&(o=o(e,t.t,t)),o)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function ag(n){return n}function lg(n,e){this.t="token",this.v=n,this.tk=e}lg.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=Mi.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),o=n.get("tagName",t,e),i=this.toFormattedString(n),s={},a=n.get("className",t,e),c=n.get("target",t,e),d=n.get("rel",t,e),u=n.getObj("attributes",t,e),p=n.getObj("events",t,e);return s.href=r,a&&(s.class=a),c&&(s.target=c),d&&(s.rel=d),u&&Ao(s,u),{tagName:o,attributes:s,content:i,eventListeners:p}}};function _a(n,e){class t extends lg{constructor(o,i){super(o,i),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const cg=_a("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),dg=_a("text"),zO=_a("nl"),Sa=_a("url",{isLink:!0,toHref(n=Mi.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Ci&&n[1].t===Er}}),dn=n=>new zt(n);function VO({groups:n}){const e=n.domain.concat([ca,da,kr,ua,pa,fa,ha,ma,cn,ed,xi,ga,ba,ya,Dn,Ea,Ti,ka]),t=[Er,od,Rn,id,xi,Ni,sd,ad,Qs,ea,_i,Si,Ys,Js,Xs,Zs,ta,na,ra,oa,ia,sa,aa,la],r=[ca,rd,da,ua,pa,fa,ha,ma,cn,_i,Si,xi,ga,ba,ya,Ni,Dn,Ea,Ti,ka],o=dn(),i=R(o,Ti);ge(i,r,i),ge(i,n.domain,i);const s=dn(),a=dn(),c=dn();ge(o,n.domain,s),ge(o,n.scheme,a),ge(o,n.slashscheme,c),ge(s,r,i),ge(s,n.domain,s);const d=R(s,kr);R(i,kr,d),R(a,kr,d),R(c,kr,d);const u=R(i,Rn);ge(u,r,i),ge(u,n.domain,i);const p=dn();ge(d,n.domain,p),ge(p,n.domain,p);const f=R(p,Rn);ge(f,n.domain,p);const h=dn(cg);ge(f,n.tld,h),ge(f,n.utld,h),R(d,Ci,h);const m=R(p,cn);R(m,cn,m),ge(m,n.domain,p),ge(h,n.domain,p),R(h,Rn,f),R(h,cn,m);const g=R(h,Er);ge(g,n.numeric,cg);const b=R(s,cn),y=R(s,Rn);R(b,cn,b),ge(b,n.domain,s),ge(y,r,i),ge(y,n.domain,s);const E=dn(Sa);ge(y,n.tld,E),ge(y,n.utld,E),ge(E,n.domain,s),ge(E,r,i),R(E,Rn,y),R(E,cn,b),R(E,kr,d);const C=R(E,Er),k=dn(Sa);ge(C,n.numeric,k);const S=dn(Sa),_=dn();ge(S,e,S),ge(S,t,_),ge(_,e,S),ge(_,t,_),R(E,Dn,S),R(k,Dn,S);const D=R(a,Er),B=R(c,Er),v=R(B,Dn),$=R(v,Dn);ge(a,n.domain,s),R(a,Rn,y),R(a,cn,b),ge(c,n.domain,s),R(c,Rn,y),R(c,cn,b),ge(D,n.domain,S),R(D,Dn,S),R(D,Ni,S),ge($,n.domain,S),ge($,e,S),R($,Dn,S);const Y=[[_i,Si],[Js,Ys],[Xs,Zs],[Qs,ea],[ta,na],[ra,oa],[ia,sa],[aa,la]];for(let te=0;te<Y.length;te++){const[ue,ce]=Y[te],oe=R(S,ue);R(_,ue,oe),R(oe,ce,S);const ie=dn(Sa);ge(oe,e,ie);const T=dn();ge(oe,t),ge(ie,e,ie),ge(ie,t,T),ge(T,e,ie),ge(T,t,T),R(ie,ce,S),R(T,ce,S)}return R(o,Ci,E),R(o,nd,zO),{start:o,tokens:rg}}function HO(n,e,t){let r=t.length,o=0,i=[],s=[];for(;o<r;){let a=n,c=null,d=null,u=0,p=null,f=-1;for(;o<r&&!(c=a.go(t[o].t));)s.push(t[o++]);for(;o<r&&(d=c||a.go(t[o].t));)c=null,a=d,a.accepts()?(f=0,p=a):f>=0&&f++,o++,u++;if(f<0)o-=u,o<r&&(s.push(t[o]),o++);else{s.length>0&&(i.push(fd(dg,e,s)),s=[]),o-=f,u-=f;const h=p.t,m=t.slice(o-u,o);i.push(fd(h,e,m))}}return s.length>0&&i.push(fd(dg,e,s)),i}function fd(n,e,t){const r=t[0].s,o=t[t.length-1].e,i=e.slice(r,o);return new n(i,t)}const UO=typeof console<"u"&&console&&console.warn||(()=>{}),WO="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",qe={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function qO(){return zt.groups={},qe.scanner=null,qe.parser=null,qe.tokenQueue=[],qe.pluginQueue=[],qe.customSchemes=[],qe.initialized=!1,qe}function ug(n,e=!1){if(qe.initialized&&UO(`linkifyjs: already initialized - will not register custom scheme "${n}" ${WO}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
123
+ 1. Must only contain digits, lowercase ASCII letters or "-"
124
+ 2. Cannot start or end with "-"
125
+ 3. "-" cannot repeat`);qe.customSchemes.push([n,e])}function KO(){qe.scanner=$O(qe.customSchemes);for(let n=0;n<qe.tokenQueue.length;n++)qe.tokenQueue[n][1]({scanner:qe.scanner});qe.parser=VO(qe.scanner.tokens);for(let n=0;n<qe.pluginQueue.length;n++)qe.pluginQueue[n][1]({scanner:qe.scanner,parser:qe.parser});return qe.initialized=!0,qe}function hd(n){return qe.initialized||KO(),HO(qe.parser.start,n,ig(qe.scanner.start,n))}hd.scan=ig;function pg(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new pd(t),o=hd(n),i=[];for(let s=0;s<o.length;s++){const a=o[s];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}function GO(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function jO(n){return new Ne({key:new Fe("autolink"),appendTransaction:(e,t,r)=>{const o=e.some(d=>d.docChanged)&&!t.doc.eq(r.doc),i=e.some(d=>d.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=r,a=Dw(t.doc,[...e]);if(Fw(a).forEach(({newRange:d})=>{const u=Bw(r.doc,d,h=>h.isTextblock);let p,f;if(u.length>1?(p=u[0],f=r.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ")):u.length&&r.doc.textBetween(d.from,d.to," "," ").endsWith(" ")&&(p=u[0],f=r.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=hd(m).map(y=>y.toObject(n.defaultProtocol));if(!GO(b))return!1;b.filter(y=>y.isLink).map(y=>({...y,from:g+y.start+1,to:g+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>n.validate(y.value)).filter(y=>n.shouldAutoLink(y.value)).forEach(y=>{Ql(y.from,y.to,r.doc).some(E=>E.mark.type===n.type)||s.addMark(y.from,y.to,n.type.create({href:y.href}))})}}),!!s.steps.length)return s}})}function JO(n){return new Ne({key:new Fe("handleClickLink"),props:{handleClick:(e,t,r)=>{var o,i;if(r.button!==0||!e.editable)return!1;let s=r.target;const a=[];for(;s.nodeName!=="DIV";)a.push(s),s=s.parentNode;if(!a.find(f=>f.nodeName==="A"))return!1;const c=Df(e.state,n.type.name),d=r.target,u=(o=d==null?void 0:d.href)!==null&&o!==void 0?o: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 YO(n){return new Ne({key:new Fe("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:o}=e,{selection:i}=o,{empty:s}=i;if(s)return!1;let a="";r.content.forEach(d=>{a+=d.textContent});const c=pg(a,{defaultProtocol:n.defaultProtocol}).find(d=>d.isLink&&d.value===a);return!a||!c?!1:n.editor.commands.setMark(n.type,{href:c.href})}}})}const XO=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function Yr(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&t.push(o)}),!n||n.replace(XO,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const fg=rn.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){ug(n);return}ug(n.scheme,n.optionalSlashes)})},onDestroy(){qO()},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:(n,e)=>!!Yr(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!Yr(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!Yr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Se(this.options.HTMLAttributes,n),0]:["a",Se(this.options.HTMLAttributes,{...n,href:""}),0]},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!Yr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!Yr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[hr({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,o=pg(n).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!Yr(s,t),protocols:t,defaultProtocol:r}));o.length&&o.forEach(i=>e.push({text:i.value,data:{href:i.href},index:i.start}))}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(jO({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!Yr(o,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(JO({type:this.type})),this.options.linkOnPaste&&n.push(YO({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),n}});function ZO(n){return new Ne({key:new Fe("handleClickSelectLink"),props:{handleClick:(e,t,r)=>{const{schema:o,doc:i,tr:s}=e.state,a=go(i.resolve(t),o.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 QO=fg.extend({addProseMirrorPlugins(){var n;return[...((n=this.parent)==null?void 0:n.call(this))||[],ZO({type:this.type})]}}).configure({openOnClick:!1}),eM=l.defineComponent({__name:"view",props:st,setup(n){const e=n;return(t,r)=>(l.openBlock(),l.createBlock(l.unref(An),l.mergeProps(e,{class:"o-paragraph-view"}),{default:l.withCtx(()=>[l.createVNode(l.unref(Gn),{as:"p",style:l.normalizeStyle(`text-align: ${t.node.attrs.textAlign}`)},null,8,["style"])]),_:1},16))}}),tM=Hh.extend({draggable:!1,addNodeView(){return hn(eM,{stopEvent:()=>!1})}}),nM=Ae.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Ne({key:new Fe("placeholder"),props:{decorations:({doc:n,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,o=[];return t?(n.descendants((i,s)=>{const a=r>=s&&r<=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=Qe.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});o.push(p)}return this.options.includeChildren}),Te.create(n,o)):null}}})]}});var md,gd;if(typeof WeakMap<"u"){let n=new WeakMap;md=e=>n.get(e),gd=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;md=r=>{for(let o=0;o<n.length;o+=2)if(n[o]==r)return n[o+1]},gd=(r,o)=>(t==10&&(t=0),n[t++]=r,n[t++]=o)}var Ze=class{constructor(n,e,t,r){this.width=n,this.height=e,this.map=t,this.problems=r}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const r=e%this.width,o=e/this.width|0;let i=r+1,s=o+1;for(let a=1;i<this.width&&this.map[e+a]==t;a++)i++;for(let a=1;s<this.height&&this.map[e+this.width*a]==t;a++)s++;return{left:r,top:o,right:i,bottom:s}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){const{left:r,right:o,top:i,bottom:s}=this.findCell(n);return e=="horiz"?(t<0?r==0:o==this.width)?null:this.map[i*this.width+(t<0?r-1:o)]:(t<0?i==0:s==this.height)?null:this.map[r+this.width*(t<0?i-1:s)]}rectBetween(n,e){const{left:t,right:r,top:o,bottom:i}=this.findCell(n),{left:s,right:a,top:c,bottom:d}=this.findCell(e);return{left:Math.min(t,s),top:Math.min(o,c),right:Math.max(r,a),bottom:Math.max(i,d)}}cellsInRect(n){const e=[],t={};for(let r=n.top;r<n.bottom;r++)for(let o=n.left;o<n.right;o++){const i=r*this.width+o,s=this.map[i];t[s]||(t[s]=!0,!(o==n.left&&o&&this.map[i-1]==s||r==n.top&&r&&this.map[i-this.width]==s)&&e.push(s))}return e}positionAt(n,e,t){for(let r=0,o=0;;r++){const i=o+t.child(r).nodeSize;if(r==n){let s=e+n*this.width;const a=(n+1)*this.width;for(;s<a&&this.map[s]<o;)s++;return s==a?i-1:this.map[s]}o=i}}static get(n){return md(n)||gd(n,rM(n))}};function rM(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=oM(n),t=n.childCount,r=[];let o=0,i=null;const s=[];for(let d=0,u=e*t;d<u;d++)r[d]=0;for(let d=0,u=0;d<t;d++){const p=n.child(d);u++;for(let m=0;;m++){for(;o<r.length&&r[o]!=0;)o++;if(m==p.childCount)break;const g=p.child(m),{colspan:b,rowspan:y,colwidth:E}=g.attrs;for(let C=0;C<y;C++){if(C+d>=t){(i||(i=[])).push({type:"overlong_rowspan",pos:u,n:y-C});break}const k=o+C*e;for(let S=0;S<b;S++){r[k+S]==0?r[k+S]=u:(i||(i=[])).push({type:"collision",row:d,pos:u,n:b-S});const _=E&&E[S];if(_){const D=(k+S)%e*2,B=s[D];B==null||B!=_&&s[D+1]==1?(s[D]=_,s[D+1]=1):B==_&&s[D+1]++}}}o+=b,u+=g.nodeSize}const f=(d+1)*e;let h=0;for(;o<f;)r[o++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:d,n:h}),u++}(e===0||t===0)&&(i||(i=[])).push({type:"zero_sized"});const a=new Ze(e,t,r,i);let c=!1;for(let d=0;!c&&d<s.length;d+=2)s[d]!=null&&s[d+1]<t&&(c=!0);return c&&iM(a,s,n),a}function oM(n){let e=-1,t=!1;for(let r=0;r<n.childCount;r++){const o=n.child(r);let i=0;if(t)for(let s=0;s<r;s++){const a=n.child(s);for(let c=0;c<a.childCount;c++){const d=a.child(c);s+d.attrs.rowspan>r&&(i+=d.attrs.colspan)}}for(let s=0;s<o.childCount;s++){const a=o.child(s);i+=a.attrs.colspan,a.attrs.rowspan>1&&(t=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function iM(n,e,t){n.problems||(n.problems=[]);const r={};for(let o=0;o<n.map.length;o++){const i=n.map[o];if(r[i])continue;r[i]=!0;const s=t.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=(o+d)%n.width,p=e[u*2];p!=null&&(!c.colwidth||c.colwidth[d]!=p)&&((a||(a=sM(c)))[d]=p)}a&&n.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:a})}}function sM(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function St(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const r=n.nodes[t],o=r.spec.tableRole;o&&(e[o]=r)}}return e}var Cr=new Fe("selectingCells");function Ro(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function aM(n){for(let e=n.depth;e>0;e--){const t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function gn(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function xa(n){const e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=Ro(e.$head)||lM(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function lM(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function bd(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function cM(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function yd(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function hg(n,e,t){const r=n.node(-1),o=Ze.get(r),i=n.start(-1),s=o.nextCell(n.pos-i,e,t);return s==null?null:n.node(0).resolve(i+s)}function Xr(n,e,t=1){const r={...n,colspan:n.colspan-t};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(o=>o>0)||(r.colwidth=null)),r}function mg(n,e,t=1){const r={...n,colspan:n.colspan+t};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let o=0;o<t;o++)r.colwidth.splice(e,0,0)}return r}function dM(n,e,t){const r=St(e.type.schema).header_cell;for(let o=0;o<n.height;o++)if(e.nodeAt(n.map[t+o*n.width]).type!=r)return!1;return!0}var Le=class Zn extends Q{constructor(e,t=e){const r=e.node(-1),o=Ze.get(r),i=e.start(-1),s=o.rectBetween(e.pos-i,t.pos-i),a=e.node(0),c=o.cellsInRect(s).filter(u=>u!=t.pos-i);c.unshift(t.pos-i);const d=c.map(u=>{const p=r.nodeAt(u);if(!p)throw RangeError(`No cell with offset ${u} found`);const f=i+u+1;return new Eu(a.resolve(f),a.resolve(f+p.content.size))});super(d[0].$from,d[0].$to,d),this.$anchorCell=e,this.$headCell=t}map(e,t){const r=e.resolve(t.map(this.$anchorCell.pos)),o=e.resolve(t.map(this.$headCell.pos));if(bd(r)&&bd(o)&&yd(r,o)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?Zn.rowSelection(r,o):i&&this.isColSelection()?Zn.colSelection(r,o):new Zn(r,o)}return J.between(r,o)}content(){const e=this.$anchorCell.node(-1),t=Ze.get(e),r=this.$anchorCell.start(-1),o=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},s=[];for(let c=o.top;c<o.bottom;c++){const d=[];for(let u=c*t.width+o.left,p=o.left;p<o.right;p++,u++){const f=t.map[u];if(i[f])continue;i[f]=!0;const h=t.findCell(f);let m=e.nodeAt(f);if(!m)throw RangeError(`No cell with offset ${f} found`);const g=o.left-h.left,b=h.right-o.right;if(g>0||b>0){let y=m.attrs;if(g>0&&(y=Xr(y,0,g)),b>0&&(y=Xr(y,y.colspan-b,b)),h.left<o.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<o.top||h.bottom>o.bottom){const y={...m.attrs,rowspan:Math.min(h.bottom,o.bottom)-Math.max(h.top,o.top)};h.top<o.top?m=m.type.createAndFill(y):m=m.type.create(y,m.content)}d.push(m)}s.push(e.child(c).copy(x.from(d)))}const a=this.isColSelection()&&this.isRowSelection()?e:s;return new M(x.from(a),1,1)}replace(e,t=M.empty){const r=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){const{$from:a,$to:c}=o[s],d=e.mapping.slice(r);e.replace(d.map(a.pos),d.map(c.pos),s?M.empty:t)}const i=Q.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new M(x.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),r=Ze.get(t),o=this.$anchorCell.start(-1),i=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let s=0;s<i.length;s++)e(t.nodeAt(i[s]),o+i[s])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,o=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,o)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const r=e.node(-1),o=Ze.get(r),i=e.start(-1),s=o.findCell(e.pos-i),a=o.findCell(t.pos-i),c=e.node(0);return s.top<=a.top?(s.top>0&&(e=c.resolve(i+o.map[s.left])),a.bottom<o.height&&(t=c.resolve(i+o.map[o.width*(o.height-1)+a.right-1]))):(a.top>0&&(t=c.resolve(i+o.map[a.left])),s.bottom<o.height&&(e=c.resolve(i+o.map[o.width*(o.height-1)+s.right-1]))),new Zn(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=Ze.get(e),r=this.$anchorCell.start(-1),o=t.colCount(this.$anchorCell.pos-r),i=t.colCount(this.$headCell.pos-r);if(Math.min(o,i)>0)return!1;const s=o+this.$anchorCell.nodeAfter.attrs.colspan,a=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,a)==t.width}eq(e){return e instanceof Zn&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const r=e.node(-1),o=Ze.get(r),i=e.start(-1),s=o.findCell(e.pos-i),a=o.findCell(t.pos-i),c=e.node(0);return s.left<=a.left?(s.left>0&&(e=c.resolve(i+o.map[s.top*o.width])),a.right<o.width&&(t=c.resolve(i+o.map[o.width*(a.top+1)-1]))):(a.left>0&&(t=c.resolve(i+o.map[a.top*o.width])),s.right<o.width&&(e=c.resolve(i+o.map[o.width*(s.top+1)-1]))),new Zn(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new Zn(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new Zn(e.resolve(t),e.resolve(r))}getBookmark(){return new uM(this.$anchorCell.pos,this.$headCell.pos)}};Le.prototype.visible=!1,Q.jsonID("cell",Le);var uM=class nb{constructor(e,t){this.anchor=e,this.head=t}map(e){return new nb(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),r=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&r.index()<r.parent.childCount&&yd(t,r)?new Le(t,r):Q.near(r,1)}};function pM(n){if(!(n.selection instanceof Le))return null;const e=[];return n.selection.forEachCell((t,r)=>{e.push(Qe.node(r,r+t.nodeSize,{class:"selectedCell"}))}),Te.create(n.doc,e)}function fM({$from:n,$to:e}){if(n.pos==e.pos||n.pos<e.pos-6)return!1;let t=n.pos,r=e.pos,o=n.depth;for(;o>=0&&!(n.after(o+1)<n.end(o));o--,t++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,r--);return t==r&&/row|table/.test(n.node(o).type.spec.tableRole)}function hM({$from:n,$to:e}){let t,r;for(let o=n.depth;o>0;o--){const i=n.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){t=i;break}}for(let o=e.depth;o>0;o--){const i=e.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return t!==r&&e.parentOffset===0}function mM(n,e,t){const r=(e||n).selection,o=(e||n).doc;let i,s;if(r instanceof K&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")i=Le.create(o,r.from);else if(s=="row"){const a=o.resolve(r.from+1);i=Le.rowSelection(a,a)}else if(!t){const a=Ze.get(r.node),c=r.from+1,d=c+a.map[a.width*a.height-1];i=Le.create(o,c+1,d)}}else r instanceof J&&fM(r)?i=J.create(o,r.from):r instanceof J&&hM(r)&&(i=J.create(o,r.$from.start(),r.$from.end()));return i&&(e||(e=n.tr)).setSelection(i),e}var gM=new Fe("fix-tables");function gg(n,e,t,r){const o=n.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(o,s+3);d<u;d++)if(n.child(d)==c){a=d+1,t+=c.nodeSize;continue e}r(c,t),a<o&&n.child(a).sameMarkup(c)?gg(n.child(a),c,t+1,r):c.nodesBetween(0,c.content.size,r,t+1),t+=c.nodeSize}}function bg(n,e){let t;const r=(o,i)=>{o.type.spec.tableRole=="table"&&(t=bM(n,o,i,t))};return e?e.doc!=n.doc&&gg(e.doc,n.doc,0,r):n.doc.descendants(r),t}function bM(n,e,t,r){const o=Ze.get(e);if(!o.problems)return r;r||(r=n.tr);const i=[];for(let c=0;c<o.height;c++)i.push(0);for(let c=0;c<o.problems.length;c++){const d=o.problems[c];if(d.type=="collision"){const u=e.nodeAt(d.pos);if(!u)continue;const p=u.attrs;for(let f=0;f<p.rowspan;f++)i[d.row+f]+=d.n;r.setNodeMarkup(r.mapping.map(t+1+d.pos),null,Xr(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;r.setNodeMarkup(r.mapping.map(t+1+d.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-d.n})}else if(d.type=="colwidth mismatch"){const u=e.nodeAt(d.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(t+1+d.pos),null,{...u.attrs,colwidth:d.colwidth})}else if(d.type=="zero_sized"){const u=r.mapping.map(t);r.delete(u,u+e.nodeSize)}}let s,a;for(let c=0;c<i.length;c++)i[c]&&(s==null&&(s=c),a=c);for(let c=0,d=t+1;c<o.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=St(n.schema)[h].createAndFill();y&&m.push(y)}const g=(c==0||s==c-1)&&a==c?d+1:p-1;r.insert(r.mapping.map(g),m)}d=p}return r.setMeta(gM,{fixTables:!0})}function In(n){const e=n.selection,t=xa(n),r=t.node(-1),o=t.start(-1),i=Ze.get(r);return{...e instanceof Le?i.rectBetween(e.$anchorCell.pos-o,e.$headCell.pos-o):i.findCell(t.pos-o),tableStart:o,map:i,table:r}}function yg(n,{map:e,tableStart:t,table:r},o){let i=o>0?-1:0;dM(e,r,o+i)&&(i=o==0||o==e.width?null:0);for(let s=0;s<e.height;s++){const a=s*e.width+o;if(o>0&&o<e.width&&e.map[a-1]==e.map[a]){const c=e.map[a],d=r.nodeAt(c);n.setNodeMarkup(n.mapping.map(t+c),null,mg(d.attrs,o-e.colCount(c))),s+=d.attrs.rowspan-1}else{const c=i==null?St(r.type.schema).cell:r.nodeAt(e.map[a+i]).type,d=e.positionAt(s,o,r);n.insert(n.mapping.map(t+d),c.createAndFill())}}return n}function yM(n,e){if(!gn(n))return!1;if(e){const t=In(n);e(yg(n.tr,t,t.left))}return!0}function kM(n,e){if(!gn(n))return!1;if(e){const t=In(n);e(yg(n.tr,t,t.right))}return!0}function EM(n,{map:e,table:t,tableStart:r},o){const i=n.mapping.maps.length;for(let s=0;s<e.height;){const a=s*e.width+o,c=e.map[a],d=t.nodeAt(c),u=d.attrs;if(o>0&&e.map[a-1]==c||o<e.width-1&&e.map[a+1]==c)n.setNodeMarkup(n.mapping.slice(i).map(r+c),null,Xr(u,o-e.colCount(c)));else{const p=n.mapping.slice(i).map(r+c);n.delete(p,p+d.nodeSize)}s+=u.rowspan}}function wM(n,e){if(!gn(n))return!1;if(e){const t=In(n),r=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let o=t.right-1;EM(r,t,o),o!=t.left;o--){const i=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!i)throw RangeError("No table found");t.table=i,t.map=Ze.get(i)}e(r)}return!0}function CM(n,e,t){var r;const o=St(e.type.schema).header_cell;for(let i=0;i<n.width;i++)if(((r=e.nodeAt(n.map[i+t*n.width]))==null?void 0:r.type)!=o)return!1;return!0}function kg(n,{map:e,tableStart:t,table:r},o){var i;let s=t;for(let d=0;d<o;d++)s+=r.child(d).nodeSize;const a=[];let c=o>0?-1:0;CM(e,r,o+c)&&(c=o==0||o==e.height?null:0);for(let d=0,u=e.width*o;d<e.width;d++,u++)if(o>0&&o<e.height&&e.map[u]==e.map[u-e.width]){const p=e.map[u],f=r.nodeAt(p).attrs;n.setNodeMarkup(t+p,null,{...f,rowspan:f.rowspan+1}),d+=f.colspan-1}else{const p=c==null?St(r.type.schema).cell:(i=r.nodeAt(e.map[u+c*e.width]))==null?void 0:i.type,f=p==null?void 0:p.createAndFill();f&&a.push(f)}return n.insert(s,St(r.type.schema).row.create(null,a)),n}function _M(n,e){if(!gn(n))return!1;if(e){const t=In(n);e(kg(n.tr,t,t.top))}return!0}function SM(n,e){if(!gn(n))return!1;if(e){const t=In(n);e(kg(n.tr,t,t.bottom))}return!0}function xM(n,{map:e,table:t,tableStart:r},o){let i=0;for(let d=0;d<o;d++)i+=t.child(d).nodeSize;const s=i+t.child(o).nodeSize,a=n.mapping.maps.length;n.delete(i+r,s+r);const c=new Set;for(let d=0,u=o*e.width;d<e.width;d++,u++){const p=e.map[u];if(!c.has(p)){if(c.add(p),o>0&&p==e.map[u-e.width]){const f=t.nodeAt(p).attrs;n.setNodeMarkup(n.mapping.slice(a).map(p+r),null,{...f,rowspan:f.rowspan-1}),d+=f.colspan-1}else if(o<e.height&&p==e.map[u+e.width]){const f=t.nodeAt(p),h=f.attrs,m=f.type.create({...h,rowspan:f.attrs.rowspan-1},f.content),g=e.positionAt(o+1,d,t);n.insert(n.mapping.slice(a).map(r+g),m),d+=h.colspan-1}}}}function NM(n,e){if(!gn(n))return!1;if(e){const t=In(n),r=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let o=t.bottom-1;xM(r,t,o),o!=t.top;o--){const i=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!i)throw RangeError("No table found");t.table=i,t.map=Ze.get(t.table)}e(r)}return!0}function Eg(n){const e=n.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function TM({width:n,height:e,map:t},r){let o=r.top*n+r.left,i=o,s=(r.bottom-1)*n+r.left,a=o+(r.right-r.left-1);for(let c=r.top;c<r.bottom;c++){if(r.left>0&&t[i]==t[i-1]||r.right<n&&t[a]==t[a+1])return!0;i+=n,a+=n}for(let c=r.left;c<r.right;c++){if(r.top>0&&t[o]==t[o-n]||r.bottom<e&&t[s]==t[s+n])return!0;o++,s++}return!1}function wg(n,e){const t=n.selection;if(!(t instanceof Le)||t.$anchorCell.pos==t.$headCell.pos)return!1;const r=In(n),{map:o}=r;if(TM(o,r))return!1;if(e){const i=n.tr,s={};let a=x.empty,c,d;for(let u=r.top;u<r.bottom;u++)for(let p=r.left;p<r.right;p++){const f=o.map[u*o.width+p],h=r.table.nodeAt(f);if(!(s[f]||!h))if(s[f]=!0,c==null)c=f,d=h;else{Eg(h)||(a=a.append(h.content));const m=i.mapping.map(f+r.tableStart);i.delete(m,m+h.nodeSize)}}if(c==null||d==null)return!0;if(i.setNodeMarkup(c+r.tableStart,null,{...mg(d.attrs,d.attrs.colspan,r.right-r.left-d.attrs.colspan),rowspan:r.bottom-r.top}),a.size){const u=c+1+d.content.size,p=Eg(d)?c+1:u;i.replaceWith(p+r.tableStart,u+r.tableStart,a)}i.setSelection(new Le(i.doc.resolve(c+r.tableStart))),e(i)}return!0}function Cg(n,e){const t=St(n.schema);return OM(({node:r})=>t[r.type.spec.tableRole])(n,e)}function OM(n){return(e,t)=>{var r;const o=e.selection;let i,s;if(o instanceof Le){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;i=o.$anchorCell.nodeAfter,s=o.$anchorCell.pos}else{if(i=aM(o.$from),!i)return!1;s=(r=Ro(o.$from))==null?void 0:r.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(t){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),n({node:i,row:h,col:g}).createAndFill(c[b]))}p.setNodeMarkup(s,n({node:i,row:u.top,col:u.left}),c[0]),o instanceof Le&&p.setSelection(new Le(p.doc.resolve(o.$anchorCell.pos),f?p.doc.resolve(f):void 0)),t(p)}return!0}}function MM(n,e){return function(t,r){if(!gn(t))return!1;const o=xa(t);if(o.nodeAfter.attrs[n]===e)return!1;if(r){const i=t.tr;t.selection instanceof Le?t.selection.forEachCell((s,a)=>{s.attrs[n]!==e&&i.setNodeMarkup(a,null,{...s.attrs,[n]:e})}):i.setNodeMarkup(o.pos,null,{...o.nodeAfter.attrs,[n]:e}),r(i)}return!0}}function AM(n){return function(e,t){if(!gn(e))return!1;if(t){const r=St(e.schema),o=In(e),i=e.tr,s=o.map.cellsInRect(n=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:n=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),a=s.map(c=>o.table.nodeAt(c));for(let c=0;c<s.length;c++)a[c].type==r.header_cell&&i.setNodeMarkup(o.tableStart+s[c],r.cell,a[c].attrs);if(i.steps.length==0)for(let c=0;c<s.length;c++)i.setNodeMarkup(o.tableStart+s[c],r.header_cell,a[c].attrs);t(i)}return!0}}function _g(n,e,t){const r=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let o=0;o<r.length;o++){const i=e.table.nodeAt(r[o]);if(i&&i.type!==t.header_cell)return!1}return!0}function Ai(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?AM(n):function(t,r){if(!gn(t))return!1;if(r){const o=St(t.schema),i=In(t),s=t.tr,a=_g("row",i,o),c=_g("column",i,o),u=(n==="column"?a:n==="row"?c:!1)?1:0,p=n=="column"?{left:0,top:u,right:1,bottom:i.map.height}:n=="row"?{left:u,top:0,right:i.map.width,bottom:1}:i,f=n=="column"?c?o.cell:o.header_cell:n=="row"?a?o.cell:o.header_cell:o.cell;i.map.cellsInRect(p).forEach(h=>{const m=h+i.tableStart,g=s.doc.nodeAt(m);g&&s.setNodeMarkup(m,f,g.attrs)}),r(s)}return!0}}Ai("row",{useDeprecatedLogic:!0}),Ai("column",{useDeprecatedLogic:!0});var vM=Ai("cell",{useDeprecatedLogic:!0});function RM(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,o=n.before();r>=0;r--){const i=n.node(-1).child(r),s=i.lastChild;if(s)return o-1-s.nodeSize;o-=i.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;const t=n.node(-1);for(let r=n.indexAfter(-1),o=n.after();r<t.childCount;r++){const i=t.child(r);if(i.childCount)return o+1;o+=i.nodeSize}}return null}function Sg(n){return function(e,t){if(!gn(e))return!1;const r=RM(xa(e),n);if(r==null)return!1;if(t){const o=e.doc.resolve(r);t(e.tr.setSelection(J.between(o,cM(o))).scrollIntoView())}return!0}}function DM(n,e){const t=n.selection.$anchor;for(let r=t.depth;r>0;r--)if(t.node(r).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(r),t.after(r)).scrollIntoView()),!0;return!1}function Na(n,e){const t=n.selection;if(!(t instanceof Le))return!1;if(e){const r=n.tr,o=St(n.schema).cell.createAndFill().content;t.forEachCell((i,s)=>{i.content.eq(o)||r.replace(r.mapping.map(s+1),r.mapping.map(s+i.nodeSize-1),new M(o,0,0))}),r.docChanged&&e(r)}return!0}function IM(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:r}=n;for(;e.childCount==1&&(t>0&&r>0||e.child(0).type.spec.tableRole=="table");)t--,r--,e=e.child(0).content;const o=e.child(0),i=o.type.spec.tableRole,s=o.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,t-1),p=c<e.childCount-1?0:Math.max(0,r-1);(u||p)&&(d=kd(St(s).row,new M(d,u,p)).content),a.push(d)}else if(i=="cell"||i=="header_cell")a.push(t||r?kd(St(s).row,new M(e,t,r)).content:e);else return null;return BM(s,a)}function BM(n,e){const t=[];for(let o=0;o<e.length;o++){const i=e[o];for(let s=i.childCount-1;s>=0;s--){const{rowspan:a,colspan:c}=i.child(s).attrs;for(let d=o;d<o+a;d++)t[d]=(t[d]||0)+c}}let r=0;for(let o=0;o<t.length;o++)r=Math.max(r,t[o]);for(let o=0;o<t.length;o++)if(o>=e.length&&e.push(x.empty),t[o]<r){const i=St(n).cell.createAndFill(),s=[];for(let a=t[o];a<r;a++)s.push(i);e[o]=e[o].append(x.from(s))}return{height:e.length,width:r,rows:e}}function kd(n,e){const t=n.createAndFill();return new Wu(t).replace(0,t.content.size,e).doc}function LM({width:n,height:e,rows:t},r,o){if(n!=r){const i=[],s=[];for(let a=0;a<t.length;a++){const c=t[a],d=[];for(let u=i[a]||0,p=0;u<r;p++){let f=c.child(p%c.childCount);u+f.attrs.colspan>r&&(f=f.type.createChecked(Xr(f.attrs,f.attrs.colspan,u+f.attrs.colspan-r),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(x.from(d))}t=s,n=r}if(e!=o){const i=[];for(let s=0,a=0;s<o;s++,a++){const c=[],d=t[a%e];for(let u=0;u<d.childCount;u++){let p=d.child(u);s+p.attrs.rowspan>o&&(p=p.type.create({...p.attrs,rowspan:Math.max(1,o-p.attrs.rowspan)},p.content)),c.push(p)}i.push(x.from(c))}t=i,e=o}return{width:n,height:e,rows:t}}function PM(n,e,t,r,o,i,s){const a=n.doc.type.schema,c=St(a);let d,u;if(o>e.width)for(let p=0,f=0;p<e.height;p++){const h=t.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<o;b++)m.push(g);n.insert(n.mapping.slice(s).map(f-1+r),m)}if(i>e.height){const p=[];for(let m=0,g=(e.height-1)*e.width;m<Math.max(e.width,o);m++){const b=m>=e.width?!1:t.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,x.from(p)),h=[];for(let m=e.height;m<i;m++)h.push(f);n.insert(n.mapping.slice(s).map(r+t.nodeSize-2),h)}return!!(d||u)}function xg(n,e,t,r,o,i,s,a){if(s==0||s==e.height)return!1;let c=!1;for(let d=o;d<i;d++){const u=s*e.width+d,p=e.map[u];if(e.map[u-e.width]==p){c=!0;const f=t.nodeAt(p),{top:h,left:m}=e.findCell(p);n.setNodeMarkup(n.mapping.slice(a).map(p+r),null,{...f.attrs,rowspan:s-h}),n.insert(n.mapping.slice(a).map(e.positionAt(s,m,t)),f.type.createAndFill({...f.attrs,rowspan:h+f.attrs.rowspan-s})),d+=f.attrs.colspan-1}}return c}function Ng(n,e,t,r,o,i,s,a){if(s==0||s==e.width)return!1;let c=!1;for(let d=o;d<i;d++){const u=d*e.width+s,p=e.map[u];if(e.map[u-1]==p){c=!0;const f=t.nodeAt(p),h=e.colCount(p),m=n.mapping.slice(a).map(p+r);n.setNodeMarkup(m,null,Xr(f.attrs,s-h,f.attrs.colspan-(s-h))),n.insert(m+f.nodeSize,f.type.createAndFill(Xr(f.attrs,0,s-h))),d+=f.attrs.rowspan-1}}return c}function Tg(n,e,t,r,o){let i=t?n.doc.nodeAt(t-1):n.doc;if(!i)throw new Error("No table found");let s=Ze.get(i);const{top:a,left:c}=r,d=c+o.width,u=a+o.height,p=n.tr;let f=0;function h(){if(i=t?p.doc.nodeAt(t-1):p.doc,!i)throw new Error("No table found");s=Ze.get(i),f=p.mapping.maps.length}PM(p,s,i,t,d,u,f)&&h(),xg(p,s,i,t,c,d,a,f)&&h(),xg(p,s,i,t,c,d,u,f)&&h(),Ng(p,s,i,t,a,u,c,f)&&h(),Ng(p,s,i,t,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+t),p.mapping.slice(f).map(b+t),new M(o.rows[m-a],0,0))}h(),p.setSelection(new Le(p.doc.resolve(t+s.positionAt(a,c,i)),p.doc.resolve(t+s.positionAt(u-1,d-1,i)))),e(p)}var $M=Fl({ArrowLeft:Oa("horiz",-1),ArrowRight:Oa("horiz",1),ArrowUp:Oa("vert",-1),ArrowDown:Oa("vert",1),"Shift-ArrowLeft":Ma("horiz",-1),"Shift-ArrowRight":Ma("horiz",1),"Shift-ArrowUp":Ma("vert",-1),"Shift-ArrowDown":Ma("vert",1),Backspace:Na,"Mod-Backspace":Na,Delete:Na,"Mod-Delete":Na});function Ta(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function Oa(n,e){return(t,r,o)=>{if(!o)return!1;const i=t.selection;if(i instanceof Le)return Ta(t,r,Q.near(i.$headCell,e));if(n!="horiz"&&!i.empty)return!1;const s=Og(o,n,e);if(s==null)return!1;if(n=="horiz")return Ta(t,r,Q.near(t.doc.resolve(i.head+e),e));{const a=t.doc.resolve(s),c=hg(a,n,e);let d;return c?d=Q.near(c,1):e<0?d=Q.near(t.doc.resolve(a.before(-1)),-1):d=Q.near(t.doc.resolve(a.after(-1)),1),Ta(t,r,d)}}}function Ma(n,e){return(t,r,o)=>{if(!o)return!1;const i=t.selection;let s;if(i instanceof Le)s=i;else{const c=Og(o,n,e);if(c==null)return!1;s=new Le(t.doc.resolve(c))}const a=hg(s.$headCell,n,e);return a?Ta(t,r,new Le(s.$anchorCell,a)):!1}}function FM(n,e){const t=n.state.doc,r=Ro(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new Le(r))),!0):!1}function zM(n,e,t){if(!gn(n.state))return!1;let r=IM(t);const o=n.state.selection;if(o instanceof Le){r||(r={width:1,height:1,rows:[x.from(kd(St(n.state.schema).cell,t))]});const i=o.$anchorCell.node(-1),s=o.$anchorCell.start(-1),a=Ze.get(i).rectBetween(o.$anchorCell.pos-s,o.$headCell.pos-s);return r=LM(r,a.right-a.left,a.bottom-a.top),Tg(n.state,n.dispatch,s,a,r),!0}else if(r){const i=xa(n.state),s=i.start(-1);return Tg(n.state,n.dispatch,s,Ze.get(i.node(-1)).findCell(i.pos-s),r),!0}else return!1}function VM(n,e){var t;if(e.ctrlKey||e.metaKey)return;const r=Mg(n,e.target);let o;if(e.shiftKey&&n.state.selection instanceof Le)i(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(o=Ro(n.state.selection.$anchor))!=null&&((t=Ed(n,e))==null?void 0:t.pos)!=o.pos)i(o,e),e.preventDefault();else if(!r)return;function i(c,d){let u=Ed(n,d);const p=Cr.getState(n.state)==null;if(!u||!yd(c,u))if(p)u=c;else return;const f=new Le(c,u);if(p||!n.state.selection.eq(f)){const h=n.state.tr.setSelection(f);p&&h.setMeta(Cr,c.pos),n.dispatch(h)}}function s(){n.root.removeEventListener("mouseup",s),n.root.removeEventListener("dragstart",s),n.root.removeEventListener("mousemove",a),Cr.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(Cr,-1))}function a(c){const d=c,u=Cr.getState(n.state);let p;if(u!=null)p=n.state.doc.resolve(u);else if(Mg(n,d.target)!=r&&(p=Ed(n,e),!p))return s();p&&i(p,d)}n.root.addEventListener("mouseup",s),n.root.addEventListener("dragstart",s),n.root.addEventListener("mousemove",a)}function Og(n,e,t){if(!(n.state.selection instanceof J))return null;const{$head:r}=n.state.selection;for(let o=r.depth-1;o>=0;o--){const i=r.node(o);if((t<0?r.index(o):r.indexAfter(o))!=(t<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const a=r.before(o),c=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(c)?a:null}}return null}function Mg(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Ed(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?Ro(n.state.doc.resolve(t.pos)):null}var HM=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),wd(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,wd(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function wd(n,e,t,r,o,i){var s;let a=0,c=!0,d=e.firstChild;const u=n.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=o==f?i:m&&m[g],y=b?b+"px":"";if(a+=b||r,b||(c=!1),d)d.style.width!=y&&(d.style.width=y),d=d.nextSibling;else{const E=document.createElement("col");E.style.width=y,e.appendChild(E)}}}for(;d;){const p=d.nextSibling;(s=d.parentNode)==null||s.removeChild(d),d=p}c?(t.style.width=a+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=a+"px")}}var Jt=new Fe("tableColumnResizing");function UM({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:r=HM,lastColumnResizable:o=!0}={}){const i=new Ne({key:Jt,state:{init(s,a){var c,d;const u=(d=(c=i.spec)==null?void 0:c.props)==null?void 0:d.nodeViews,p=St(a.schema).table.name;return r&&u&&(u[p]=(f,h)=>new r(f,t,h)),new WM(-1,!1)},apply(s,a){return a.apply(s)}},props:{attributes:s=>{const a=Jt.getState(s);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,a)=>{qM(s,a,n,o)},mouseleave:s=>{KM(s)},mousedown:(s,a)=>{GM(s,a,e,t)}},decorations:s=>{const a=Jt.getState(s);if(a&&a.activeHandle>-1)return ZM(s,a.activeHandle)},nodeViews:{}}});return i}var WM=class Va{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,r=e.getMeta(Jt);if(r&&r.setHandle!=null)return new Va(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Va(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let o=e.mapping.map(t.activeHandle,-1);return bd(e.doc.resolve(o))||(o=-1),new Va(o,t.dragging)}return t}};function qM(n,e,t,r){if(!n.editable)return;const o=Jt.getState(n.state);if(o&&!o.dragging){const i=JM(e.target);let s=-1;if(i){const{left:a,right:c}=i.getBoundingClientRect();e.clientX-a<=t?s=Ag(n,e,"left",t):c-e.clientX<=t&&(s=Ag(n,e,"right",t))}if(s!=o.activeHandle){if(!r&&s!==-1){const a=n.state.doc.resolve(s),c=a.node(-1),d=Ze.get(c),u=a.start(-1);if(d.colCount(a.pos-u)+a.nodeAfter.attrs.colspan-1==d.width-1)return}Rg(n,s)}}}function KM(n){if(!n.editable)return;const e=Jt.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&Rg(n,-1)}function GM(n,e,t,r){var o;if(!n.editable)return!1;const i=(o=n.dom.ownerDocument.defaultView)!=null?o:window,s=Jt.getState(n.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const a=n.state.doc.nodeAt(s.activeHandle),c=jM(n,s.activeHandle,a.attrs);n.dispatch(n.state.tr.setMeta(Jt,{setDragging:{startX:e.clientX,startWidth:c}}));function d(p){i.removeEventListener("mouseup",d),i.removeEventListener("mousemove",u);const f=Jt.getState(n.state);f!=null&&f.dragging&&(YM(n,f.activeHandle,vg(f.dragging,p,t)),n.dispatch(n.state.tr.setMeta(Jt,{setDragging:null})))}function u(p){if(!p.which)return d(p);const f=Jt.getState(n.state);if(f&&f.dragging){const h=vg(f.dragging,p,t);Dg(n,f.activeHandle,h,r)}}return Dg(n,s.activeHandle,c,r),i.addEventListener("mouseup",d),i.addEventListener("mousemove",u),e.preventDefault(),!0}function jM(n,e,{colspan:t,colwidth:r}){const o=r&&r[r.length-1];if(o)return o;const i=n.domAtPos(e);let a=i.node.childNodes[i.offset].offsetWidth,c=t;if(r)for(let d=0;d<t;d++)r[d]&&(a-=r[d],c--);return a/c}function JM(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function Ag(n,e,t,r){const o=t=="right"?-r:r,i=n.posAtCoords({left:e.clientX+o,top:e.clientY});if(!i)return-1;const{pos:s}=i,a=Ro(n.state.doc.resolve(s));if(!a)return-1;if(t=="right")return a.pos;const c=Ze.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 vg(n,e,t){const r=e.clientX-n.startX;return Math.max(t,n.startWidth+r)}function Rg(n,e){n.dispatch(n.state.tr.setMeta(Jt,{setHandle:e}))}function YM(n,e,t){const r=n.state.doc.resolve(e),o=r.node(-1),i=Ze.get(o),s=r.start(-1),a=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,c=n.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=o.nodeAt(p).attrs,h=f.colspan==1?0:a-i.colCount(p);if(f.colwidth&&f.colwidth[h]==t)continue;const m=f.colwidth?f.colwidth.slice():XM(f.colspan);m[h]=t,c.setNodeMarkup(s+p,null,{...f,colwidth:m})}c.docChanged&&n.dispatch(c)}function Dg(n,e,t,r){const o=n.state.doc.resolve(e),i=o.node(-1),s=o.start(-1),a=Ze.get(i).colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;let c=n.domAtPos(o.start(-1)).node;for(;c&&c.nodeName!="TABLE";)c=c.parentNode;c&&wd(i,c.firstChild,c,r,a,t)}function XM(n){return Array(n).fill(0)}function ZM(n,e){var t;const r=[],o=n.doc.resolve(e),i=o.node(-1);if(!i)return Te.empty;const s=Ze.get(i),a=o.start(-1),c=s.colCount(o.pos-a)+o.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",(t=Jt.getState(n))!=null&&t.dragging&&r.push(Qe.node(a+p,a+p+i.nodeAt(p).nodeSize,{class:"column-resize-dragging"})),r.push(Qe.widget(f,h))}}return Te.create(n.doc,r)}function QM({allowTableNodeSelection:n=!1}={}){return new Ne({key:Cr,state:{init(){return null},apply(e,t){const r=e.getMeta(Cr);if(r!=null)return r==-1?null:r;if(t==null||!e.docChanged)return t;const{deleted:o,pos:i}=e.mapping.mapResult(t);return o?null:i}},props:{decorations:pM,handleDOMEvents:{mousedown:VM},createSelectionBetween(e){return Cr.getState(e.state)!=null?e.state.selection:null},handleTripleClick:FM,handleKeyDown:$M,handlePaste:zM},appendTransaction(e,t,r){return mM(r,bg(r,t),n)}})}function Cd(n,e){return e?["width",`${Math.max(e,n)}px`]:["min-width",`${n}px`]}function Ig(n,e,t,r,o,i){var s;let a=0,c=!0,d=e.firstChild;const u=n.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=o===f?i:m&&m[g],y=b?`${b}px`:"";if(a+=b||r,b||(c=!1),d){if(d.style.width!==y){const[E,C]=Cd(r,b);d.style.setProperty(E,C)}d=d.nextSibling}else{const E=document.createElement("col"),[C,k]=Cd(r,b);E.style.setProperty(C,k),e.appendChild(E)}}}for(;d;){const p=d.nextSibling;(s=d.parentNode)===null||s===void 0||s.removeChild(d),d=p}c?(t.style.width=`${a}px`,t.style.minWidth=""):(t.style.width="",t.style.minWidth=`${a}px`)}let eA=class{constructor(e,t){this.node=e,this.cellMinWidth=t,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")),Ig(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,Ig(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}};function tA(n,e,t,r){let o=0,i=!0;const s=[],a=n.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=t===f?r:m&&m[g];o+=b||e,b||(i=!1);const[y,E]=Cd(e,b);s.push(["col",{style:`${y}: ${E}`}])}}const c=i?`${o}px`:"",d=i?"":`${o}px`;return{colgroup:["colgroup",{},...s],tableWidth:c,tableMinWidth:d}}function Bg(n,e){return n.createAndFill()}function nA(n){if(n.cached.tableNodeTypes)return n.cached.tableNodeTypes;const e={};return Object.keys(n.nodes).forEach(t=>{const r=n.nodes[t];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),n.cached.tableNodeTypes=e,e}function Lg(n,e,t,r,o){const i=nA(n),s=[],a=[];for(let d=0;d<t;d+=1){const u=Bg(i.cell);if(u&&a.push(u),r){const p=Bg(i.header_cell);p&&s.push(p)}}const c=[];for(let d=0;d<e;d+=1)c.push(i.row.createChecked(null,r&&d===0?s:a));return i.table.createChecked(null,c)}function rA(n){return n instanceof Le}const Aa=({editor:n})=>{const{selection:e}=n.state;if(!rA(e))return!1;let t=0;const r=vf(e.ranges[0].$from,i=>i.type.name==="table");return r==null||r.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(t+=1)}),t===e.ranges.length?(n.commands.deleteTable(),!0):!1},Pg=Ge.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:eA,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:n,HTMLAttributes:e}){const{colgroup:t,tableWidth:r,tableMinWidth:o}=tA(n,this.options.cellMinWidth);return["table",Se(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${o}`}),t,["tbody",0]]},addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:r,dispatch:o,editor:i})=>{const s=Lg(i.schema,n,e,t);if(o){const a=r.selection.from+1;r.replaceSelectionWith(s).scrollIntoView().setSelection(J.near(r.doc.resolve(a)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>yM(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>kM(n,e),deleteColumn:()=>({state:n,dispatch:e})=>wM(n,e),addRowBefore:()=>({state:n,dispatch:e})=>_M(n,e),addRowAfter:()=>({state:n,dispatch:e})=>SM(n,e),deleteRow:()=>({state:n,dispatch:e})=>NM(n,e),deleteTable:()=>({state:n,dispatch:e})=>DM(n,e),mergeCells:()=>({state:n,dispatch:e})=>wg(n,e),splitCell:()=>({state:n,dispatch:e})=>Cg(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>Ai("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>Ai("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>vM(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>wg(n,e)?!0:Cg(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:r})=>MM(n,e)(t,r),goToNextCell:()=>({state:n,dispatch:e})=>Sg(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>Sg(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&bg(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){const r=Le.create(e.doc,n.anchorCell,n.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Aa,"Mod-Backspace":Aa,Delete:Aa,"Mod-Delete":Aa}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[UM({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],QM({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){const e={name:n.name,options:n.options,storage:n.storage};return{tableRole:me(U(n,"tableRole",e))}}});function $g(n,e,t,r,o,i){let s=0,a=!0,c=e.firstChild;const d=n.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=o===p?i:h&&h[m],b=g?`${g}px`:"";if(s+=g||r,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?(t.style.width=`${s}px`,t.style.minWidth=""):(t.style.width="",t.style.minWidth=`${s}px`)}class oA{constructor(e,t,r){$e(this,"node");$e(this,"cellMinWidth");$e(this,"view");$e(this,"dom");$e(this,"table");$e(this,"colgroup");$e(this,"contentDOM");this.node=e,this.cellMinWidth=t,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")),$g(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,$g(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}const iA=Pg.extend({addOptions(){return{HTMLAttributes:{},resizable:!0,handleWidth:5,cellMinWidth:25,View:oA,lastColumnResizable:!0,allowTableNodeSelection:!1}},addCommands(){var n;return{...(n=this.parent)==null?void 0:n.call(this),insertTable:({rows:e,cols:t,withHeaderRow:r})=>({editor:o,commands:i,tr:s,dispatch:a})=>{const c=Lg(o.schema,e,t,r);if(a){const d=s.selection.anchor+1;i.insertContent({type:"table-wrapper",content:[c.toJSON()]}),s.scrollIntoView().setSelection(J.near(s.doc.resolve(d)))}return!0},deleteTable:()=>({state:e,dispatch:t})=>{const r=e.selection.$anchor;for(let o=r.depth;o>0;o--)if(r.node(o).type.name==="table-wrapper")return t&&t(e.tr.delete(r.before(o),r.after(o)).scrollIntoView()),!0;return!1},selectRow:e=>({tr:t,dispatch:r})=>{if(r){const o=t.doc.resolve(e),i=Le.rowSelection(o);t.setSelection(i)}return!0},selectColumn:e=>({tr:t,dispatch:r})=>{if(r){const o=t.doc.resolve(e),i=Le.colSelection(o);t.setSelection(i)}return!0}}}}),Fg=Ge.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",Se(this.options.HTMLAttributes,n),0]}}),sA={class:"add"},aA=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),lA=l.defineComponent({__name:"view",props:st,setup(n){const e=n,{tr:t}=Ee(),{run:r}=Ie(),o=l.ref(!1);function i(){o.value=!0}function s(){a("tableSelectRow",{pos:e.getPos()})}function a(c,d={}){c==="tableDeleteRow"&&(o.value=!1),setTimeout(()=>{r(e.editor,c,d)},0)}return(c,d)=>(l.openBlock(),l.createBlock(l.unref(_c),l.mergeProps({class:"o-table-cell-view",as:"td"},c.node.attrs,{style:{background:c.node.attrs.background}}),{default:l.withCtx(()=>{var u;return[(u=c.editor)!=null&&u.isEditable?(l.openBlock(),l.createBlock(l.unref(So),{key:0,modelValue:o.value,"onUpdate:modelValue":d[2]||(d[2]=p=>o.value=p),placement:"left","tippy-class":"o-row-popover",offset:[16,40],"hide-click-outside":""},{"popover-content":l.withCtx(()=>[l.createVNode(l.unref(lt),{icon:"select_all",tooltip:l.unref(t)("table.removeColumn"),onClick:s},null,8,["tooltip"]),l.createVNode(l.unref(lt),{icon:"delete",tooltip:l.unref(t)("table.removeRow"),onClick:d[1]||(d[1]=p=>a("tableDeleteRow"))},null,8,["tooltip"])]),default:l.withCtx(()=>[l.createElementVNode("section",{class:l.normalizeClass(["row-handler",{active:o.value}]),onClick:i},[l.createElementVNode("div",sA,[aA,l.createVNode(l.unref(Ds),{icon:"add_circle",color:l.unref(_e).blue,tooltip:l.unref(t)("table.addRow"),placement:"left",onClick:d[0]||(d[0]=l.withModifiers(p=>a("tableAddRow"),["stop"]))},null,8,["color","tooltip"])])],2)]),_:1},8,["modelValue"])):l.createCommentVNode("",!0),l.createVNode(l.unref(Gn))]}),_:1},16,["style"]))}}),cA=Fg.extend({addAttributes(){var n;return{...(n=this.parent)==null?void 0:n.call(this),background:{default:""}}},addNodeView(){return hn(lA,{stopEvent:()=>!1})}}),zg=Ge.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",Se(this.options.HTMLAttributes,n),0]}}),dA={class:"add"},uA=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),pA={class:"add"},fA=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),hA=l.defineComponent({__name:"view",props:st,setup(n){const e=n,{tr:t}=Ee(),{run:r}=Ie(),o=l.ref(!1),i=l.ref(!1);function s(){setTimeout(()=>{o.value=!0},0)}function a(){i.value=!0}function c(){o.value=!1,u("tableSelectColumn",{pos:e.getPos()})}function d(){u("tableSelectRow",{pos:e.getPos()})}function u(p,f={}){p==="tableDeleteRow"?i.value=!1:p==="tableDeleteColumn"&&(o.value=!1),setTimeout(()=>{r(e.editor,p,f)},0)}return(p,f)=>(l.openBlock(),l.createBlock(l.unref(_c),l.mergeProps({class:"o-table-header-view",as:"th"},p.node.attrs,{style:{background:p.node.attrs.background}}),{default:l.withCtx(()=>{var h;return[(h=p.editor)!=null&&h.isEditable?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[l.createVNode(l.unref(So),{modelValue:o.value,"onUpdate:modelValue":f[2]||(f[2]=m=>o.value=m),placement:"top","tippy-class":"o-column-popover",offset:[0,20],"hide-click-outside":""},{"popover-content":l.withCtx(()=>[l.createVNode(l.unref(lt),{icon:"select_all",tooltip:l.unref(t)("table.removeColumn"),onClick:c},null,8,["tooltip"]),l.createVNode(l.unref(lt),{icon:"delete",tooltip:l.unref(t)("table.removeColumn"),onClick:f[1]||(f[1]=m=>u("tableDeleteColumn"))},null,8,["tooltip"])]),default:l.withCtx(()=>[l.createElementVNode("section",{class:l.normalizeClass(["col-handler",{active:o.value}]),onClick:s},[l.createElementVNode("div",dA,[uA,l.createVNode(l.unref(Ds),{icon:"add_circle",color:l.unref(_e).blue,tooltip:l.unref(t)("table.addColumn"),onClick:f[0]||(f[0]=l.withModifiers(m=>u("tableAddColumn"),["stop"]))},null,8,["color","tooltip"])])],2)]),_:1},8,["modelValue"]),l.createVNode(l.unref(So),{modelValue:i.value,"onUpdate:modelValue":f[5]||(f[5]=m=>i.value=m),placement:"left","tippy-class":"o-row-popover",offset:[15,40],"hide-click-outside":""},{"popover-content":l.withCtx(()=>[l.createVNode(l.unref(lt),{icon:"select_all",tooltip:l.unref(t)("table.removeColumn"),onClick:d},null,8,["tooltip"]),l.createVNode(l.unref(lt),{icon:"delete",tooltip:l.unref(t)("table.removeRow"),onClick:f[4]||(f[4]=m=>u("tableDeleteRow"))},null,8,["tooltip"])]),default:l.withCtx(()=>[l.createElementVNode("section",{class:l.normalizeClass(["row-handler",{active:i.value}]),onClick:a},[l.createElementVNode("div",pA,[fA,l.createVNode(l.unref(Ds),{icon:"add_circle",color:l.unref(_e).blue,tooltip:l.unref(t)("table.addRow"),placement:"left",onClick:f[3]||(f[3]=l.withModifiers(m=>u("tableAddRow"),["stop"]))},null,8,["color","tooltip"])])],2)]),_:1},8,["modelValue"])],64)):l.createCommentVNode("",!0),l.createVNode(l.unref(Gn))]}),_:1},16,["style"]))}}),mA=zg.extend({addAttributes(){var n;return{...(n=this.parent)==null?void 0:n.call(this),background:{default:""}}},addNodeView(){return hn(hA,{stopEvent:()=>!1})}}),gA=l.defineComponent({__name:"view",props:st,setup(n){const e=n,t=l.inject("sideNode",{value:!1}),r=l.ref(!1),o=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){r.value=s}return l.watch(o,s=>{i(s)}),(s,a)=>(l.openBlock(),l.createBlock(l.unref(An),l.mergeProps(e,{class:["o-table-wrapper-view",{"side-node-enabled":l.unref(t)}]}),{default:l.withCtx(()=>[l.createVNode(l.unref(Gn),{as:"table"})]),_:1},16,["class"]))}}),bA=Ge.create({name:"table-wrapper",group:"block",content:"table",draggable:!0,parseHTML(){return[{tag:"table-wrapper"}]},renderHTML({HTMLAttributes:n}){return["table-wrapper",Se(n),0]},addNodeView(){return hn(gA,{stopEvent:()=>!1})}});function yA({node:n,types:e}){return Array.isArray(e)&&e.includes(n==null?void 0:n.type)||(n==null?void 0:n.type)===e}function va({node:n,types:e}){return n?!yA({node:n,types:e}):!1}const kA=Ae.create({name:"trailingNode",addOptions(){return{node:"paragraph",notAfter:["paragraph"]}},addProseMirrorPlugins(){const n=new Fe(this.name),e=Object.entries(this.editor.schema.nodes).map(([,t])=>t).filter(t=>this.options.notAfter.includes(t.name));return[new Ne({key:n,appendTransaction:(t,r,o)=>{const{doc:i,tr:s,schema:a}=o,c=n.getState(o),d=i.content.size,u=a.nodes[this.options.node];if(c)return s.insert(d,u.create())},state:{init:(t,r)=>{const o=r.tr.doc.lastChild,i=(o==null?void 0:o.firstChild)??null;return va({node:o,types:e})||va({node:i,types:e})},apply:(t,r)=>{var s;if(!t.docChanged)return r;const o=t.doc.lastChild,i=((s=t.doc.lastChild)==null?void 0:s.firstChild)??null;return va({node:o,types:e})||va({node:i,types:e})}}})]}});for(var gt=[],_d=0;_d<256;++_d)gt.push((_d+256).toString(16).slice(1));function EA(n,e=0){return(gt[n[e+0]]+gt[n[e+1]]+gt[n[e+2]]+gt[n[e+3]]+"-"+gt[n[e+4]]+gt[n[e+5]]+"-"+gt[n[e+6]]+gt[n[e+7]]+"-"+gt[n[e+8]]+gt[n[e+9]]+"-"+gt[n[e+10]]+gt[n[e+11]]+gt[n[e+12]]+gt[n[e+13]]+gt[n[e+14]]+gt[n[e+15]]).toLowerCase()}var Ra,wA=new Uint8Array(16);function CA(){if(!Ra&&(Ra=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ra))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ra(wA)}var _A=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Vg={randomUUID:_A};function SA(n,e,t){if(Vg.randomUUID&&!n)return Vg.randomUUID();n=n||{};var r=n.random||(n.rng||CA)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,EA(r)}const xA=()=>SA(),NA=Ae.create({name:"uniqueID",priority:1e4,addOptions:()=>({attributeName:"data-id",types:["heading"],enableRender:!1,generateId:()=>xA()}),addGlobalAttributes(){return[{types:this.options.types,attributes:{[this.options.attributeName]:{default:this.options.generateId(),parseHTML:n=>n.getAttribute(this.options.attributeName),renderHTML:n=>this.options.enableRender?{[this.options.attributeName]:n[this.options.attributeName]}:{}}}}]}}),TA={key:1,class:"video-container"},OA=l.createElementVNode("div",{class:"video-cover"},null,-1),MA={key:1},AA=l.defineComponent({__name:"view",props:st,setup(n){const e=n,t=l.ref(!1),r=l.ref({}),o=l.ref(null),i=l.ref(!1),s=l.ref(!1),a=l.computed({get(){return e.node.attrs.caption},set(b){e.updateAttributes({caption:b})}}),c=l.computed({get(){return e.node.attrs.src},set(b){e.updateAttributes({src:b})}});function d(b){switch(t.value=!1,b.value){case"replace":g(!0);break}}function u(){i.value=!0,setTimeout(()=>{var b;(b=o.value)==null||b.focus()},0)}function p(){i.value=!1}function f(){c.value==="init"&&g(!0)}function h(b){t.value=!0,r.value=b}function m(b){c.value=b,g(!1)}function g(b){s.value=b}return l.onMounted(()=>{g(c.value==="init")}),(b,y)=>{var E;return l.openBlock(),l.createBlock(l.unref(An),l.mergeProps(e,{class:["o-video-view",{readonly:!((E=b.editor)!=null&&E.isEditable),init:c.value==="init"}],as:"div",onContextmenu:l.withModifiers(h,["prevent"]),onClick:f}),{default:l.withCtx(()=>[l.createVNode(l.unref(So),{modelValue:s.value,"onUpdate:modelValue":y[1]||(y[1]=C=>s.value=C),placement:c.value==="init"?"bottom":"top"},{"popover-content":l.withCtx(()=>[l.createVNode(l.unref(Rc),{val:c.value==="init"?"":c.value,type:"video",onInput:m},null,8,["val"])]),default:l.withCtx(()=>{var C;return[c.value==="init"?(l.openBlock(),l.createBlock(l.unref(Tc),{key:0,icon:"videocam",placeholder:"Add a video"})):(l.openBlock(),l.createElementBlock("div",TA,[OA,l.createVNode(l.unref(Mc),l.mergeProps(e,{onAction:d}),{default:l.withCtx(()=>[l.createVNode(l.unref(ve),{icon:"subtitles",tooltip:"image.caption",onClick:u})]),_:1},16),l.createElementVNode("video",l.mergeProps(b.node.attrs,{draggable:"true","data-drag-handle":"",controls:""}),[l.createElementVNode("source",l.normalizeProps(l.guardReactiveProps(b.node.attrs)),null,16)],16),l.createElementVNode("div",{class:"caption",onClick:u},[(C=b.editor)!=null&&C.isEditable&&i.value?(l.openBlock(),l.createBlock(l.unref(xo),{key:0,ref_key:"captionInput",ref:o,class:"caption-input",modelValue:a.value,"onUpdate:modelValue":y[0]||(y[0]=k=>a.value=k),type:"text",placeholder:"Input caption",autosize:"",onBlur:p},null,8,["modelValue"])):(l.openBlock(),l.createElementBlock("span",MA,l.toDisplayString(a.value),1))])]))]}),_:1},8,["modelValue","placement"]),l.createVNode(l.unref(vs),{modelValue:t.value,"onUpdate:modelValue":y[2]||(y[2]=C=>t.value=C),event:r.value},{default:l.withCtx(()=>[l.createVNode(l.unref(qr),l.mergeProps(e,{onAction:d}),null,16)]),_:1},8,["modelValue","event"])]),_:1},16,["class","onContextmenu"])}}}),vA=/(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,RA=Ge.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:n=>{const e=n.firstElementChild;return(e==null?void 0:e.src)??""}}}},parseHTML(){return[{tag:"video"}]},renderHTML({node:n,HTMLAttributes:e}){return["video",{caption:n.attrs.caption},["source",Se(this.options.HTMLAttributes,e)]]},addCommands(){return{setVideo:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[oc({find:vA,type:this.type,getAttributes:n=>{const[e]=n;return{src:e}}})]},addNodeView(){return hn(AA)}}),Hg=["BackColor","Focus","FontFamily","ForeColor","Table","TaskItem","TaskList","TextAlign","Typography","Underline","OHorizontalRule","OUniqueID"],DA=["BackColor","Blockquote","Bold","BulletList","Code","CodeBlockLowlight","Focus","FontFamily","ForeColor","HorizontalRule","Image","Italic","Link","ListItem","OrderedList","Strike","Table","TaskItem","TaskList","TextAlign","Typography","Underline"],IA=["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"],BA=[...DA,...IA],LA=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,PA=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,$A=rn.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:n=>n.getAttribute("data-color")||n.style.backgroundColor,renderHTML:n=>n.color?{"data-color":n.color,style:`background-color: ${n.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:n}){return["mark",Se(this.options.HTMLAttributes,n),0]},addCommands(){return{setHighlight:n=>({commands:e})=>e.setMark(this.name,n),toggleHighlight:n=>({commands:e})=>e.toggleMark(this.name,n),unsetHighlight:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[zr({find:LA,type:this.type})]},addPasteRules(){return[hr({find:PA,type:this.type})]}}),FA=Ae.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Ne({key:new Fe("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:o}=e,i=[];if(!t||!r)return Te.create(n,[]);let s=0;this.options.mode==="deepest"&&n.descendants((c,d)=>{if(c.isText)return;if(!(o>=d&&o<=d+c.nodeSize-1))return!1;s+=1});let a=0;return n.descendants((c,d)=>{if(c.isText||!(o>=d&&o<=d+c.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&s-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";i.push(Qe.node(d,d+c.nodeSize,{class:this.options.className}))}),Te.create(n,i)}}})]}}),zA=Ae.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:n=>n.style.fontFamily,renderHTML:n=>n.fontFamily?{style:`font-family: ${n.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:n=>({chain:e})=>e().setMark("textStyle",{fontFamily:n}).run(),unsetFontFamily:()=>({chain:n})=>n().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),VA=Ae.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:n=>{var e;return(e=n.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.color?{style:`color: ${n.color}`}:{}}}}]},addCommands(){return{setColor:n=>({chain:e})=>e().setMark("textStyle",{color:n}).run(),unsetColor:()=>({chain:n})=>n().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),HA=/^\s*(\[([( |x])?\])\s$/,UA=Ge.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:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",Se(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const o=document.createElement("li"),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(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:u}=d.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const f=t();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(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,u)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,u])=>{o.setAttribute(d,u)}),o.dataset.checked=n.attrs.checked,a.checked=n.attrs.checked,i.append(a,s),o.append(i,c),Object.entries(e).forEach(([d,u])=>{o.setAttribute(d,u)}),{dom:o,contentDOM:c,update:d=>d.type!==this.type?!1:(o.dataset.checked=d.attrs.checked,a.checked=d.attrs.checked,!0)}}},addInputRules(){return[bo({find:HA,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),WA=Ge.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",Se(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),qA=Ae.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>{const e=n.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:n=>n.textAlign?{style:`text-align: ${n.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.map(t=>e.updateAttributes(t,{textAlign:n})).every(t=>t):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.map(e=>n.resetAttributes(e,"textAlign")).every(e=>e)}},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")}}}),KA=n=>Je({find:/--$/,replace:n??"—"}),GA=n=>Je({find:/\.\.\.$/,replace:n??"…"}),jA=n=>Je({find:/(?:^|[\s{[(<'"\u2018\u201C])(")$/,replace:n??"“"}),JA=n=>Je({find:/"$/,replace:n??"”"}),YA=n=>Je({find:/(?:^|[\s{[(<'"\u2018\u201C])(')$/,replace:n??"‘"}),XA=n=>Je({find:/'$/,replace:n??"’"}),ZA=n=>Je({find:/<-$/,replace:n??"←"}),QA=n=>Je({find:/->$/,replace:n??"→"}),ev=n=>Je({find:/\(c\)$/,replace:n??"©"}),tv=n=>Je({find:/\(tm\)$/,replace:n??"™"}),nv=n=>Je({find:/\(sm\)$/,replace:n??"℠"}),rv=n=>Je({find:/\(r\)$/,replace:n??"®"}),ov=n=>Je({find:/(?:^|\s)(1\/2)\s$/,replace:n??"½"}),iv=n=>Je({find:/\+\/-$/,replace:n??"±"}),sv=n=>Je({find:/!=$/,replace:n??"≠"}),av=n=>Je({find:/<<$/,replace:n??"«"}),lv=n=>Je({find:/>>$/,replace:n??"»"}),cv=n=>Je({find:/\d+\s?([*x])\s?\d+$/,replace:n??"×"}),dv=n=>Je({find:/\^2$/,replace:n??"²"}),uv=n=>Je({find:/\^3$/,replace:n??"³"}),pv=n=>Je({find:/(?:^|\s)(1\/4)\s$/,replace:n??"¼"}),fv=n=>Je({find:/(?:^|\s)(3\/4)\s$/,replace:n??"¾"}),hv=Ae.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 n=[];return this.options.emDash!==!1&&n.push(KA(this.options.emDash)),this.options.ellipsis!==!1&&n.push(GA(this.options.ellipsis)),this.options.openDoubleQuote!==!1&&n.push(jA(this.options.openDoubleQuote)),this.options.closeDoubleQuote!==!1&&n.push(JA(this.options.closeDoubleQuote)),this.options.openSingleQuote!==!1&&n.push(YA(this.options.openSingleQuote)),this.options.closeSingleQuote!==!1&&n.push(XA(this.options.closeSingleQuote)),this.options.leftArrow!==!1&&n.push(ZA(this.options.leftArrow)),this.options.rightArrow!==!1&&n.push(QA(this.options.rightArrow)),this.options.copyright!==!1&&n.push(ev(this.options.copyright)),this.options.trademark!==!1&&n.push(tv(this.options.trademark)),this.options.servicemark!==!1&&n.push(nv(this.options.servicemark)),this.options.registeredTrademark!==!1&&n.push(rv(this.options.registeredTrademark)),this.options.oneHalf!==!1&&n.push(ov(this.options.oneHalf)),this.options.plusMinus!==!1&&n.push(iv(this.options.plusMinus)),this.options.notEqual!==!1&&n.push(sv(this.options.notEqual)),this.options.laquo!==!1&&n.push(av(this.options.laquo)),this.options.raquo!==!1&&n.push(lv(this.options.raquo)),this.options.multiplication!==!1&&n.push(cv(this.options.multiplication)),this.options.superscriptTwo!==!1&&n.push(dv(this.options.superscriptTwo)),this.options.superscriptThree!==!1&&n.push(uv(this.options.superscriptThree)),this.options.oneQuarter!==!1&&n.push(pv(this.options.oneQuarter)),this.options.threeQuarters!==!1&&n.push(fv(this.options.threeQuarters)),n}}),mv=rn.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",Se(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),Ug=Ge.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",Se(this.options.HTMLAttributes,n),0]}});function gv(n){var e;const{char:t,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=n,c=r&&!o,d=a0(t),u=new RegExp(`\\s${d}$`),p=s?"^":"",f=o?"":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),E=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(y);if(i!==null&&!E)return null;const C=g+b.index;let k=C+b[0].length;return c&&u.test(m.slice(k-1,k+1))&&(b[0]+=" ",k+=1),C<a.pos&&k>=a.pos?{range:{from:C,to:k},query:b[0].slice(t.length),text:b[0]}:null}const bv=new Fe("suggestion");function Wg({pluginKey:n=bv,editor:e,char:t="@",allowSpaces:r=!1,allowToIncludeChar:o=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:a="span",decorationClass:c="suggestion",command:d=()=>null,items:u=()=>[],render:p=()=>({}),allow:f=()=>!0,findSuggestionMatch:h=gv}){let m;const g=p==null?void 0:p(),b=new Ne({key:n,view(){return{update:async(y,E)=>{var C,k,S,_,D,B,v;const $=(C=this.key)===null||C===void 0?void 0:C.getState(E),Y=(k=this.key)===null||k===void 0?void 0:k.getState(y.state),te=$.active&&Y.active&&$.range.from!==Y.range.from,ue=!$.active&&Y.active,ce=$.active&&!Y.active,oe=!ue&&!ce&&$.query!==Y.query,ie=ue||te&&oe,T=oe||te,A=ce||te&&oe;if(!ie&&!T&&!A)return;const z=A&&!ie?$:Y,j=y.dom.querySelector(`[data-decoration-id="${z.decorationId}"]`);m={editor:e,range:z.range,query:z.query,text:z.text,items:[],command:ee=>d({editor:e,range:z.range,props:ee}),decorationNode:j,clientRect:j?()=>{var ee;const{decorationId:he}=(ee=this.key)===null||ee===void 0?void 0:ee.getState(e.state),Oe=y.dom.querySelector(`[data-decoration-id="${he}"]`);return(Oe==null?void 0:Oe.getBoundingClientRect())||null}:null},ie&&((S=g==null?void 0:g.onBeforeStart)===null||S===void 0||S.call(g,m)),T&&((_=g==null?void 0:g.onBeforeUpdate)===null||_===void 0||_.call(g,m)),(T||ie)&&(m.items=await u({editor:e,query:z.query})),A&&((D=g==null?void 0:g.onExit)===null||D===void 0||D.call(g,m)),T&&((B=g==null?void 0:g.onUpdate)===null||B===void 0||B.call(g,m)),ie&&((v=g==null?void 0:g.onStart)===null||v===void 0||v.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,E,C,k){const{isEditable:S}=e,{composing:_}=e.view,{selection:D}=y,{empty:B,from:v}=D,$={...E};if($.composing=_,S&&(B||e.view.composing)){(v<E.range.from||v>E.range.to)&&!_&&!E.composing&&($.active=!1);const Y=h({char:t,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:D.$from}),te=`id_${Math.floor(Math.random()*4294967295)}`;Y&&f({editor:e,state:k,range:Y.range,isActive:E.active})?($.active=!0,$.decorationId=E.decorationId?E.decorationId:te,$.range=Y.range,$.query=Y.query,$.text=Y.text):$.active=!1}else $.active=!1;return $.active||($.decorationId=null,$.range={from:0,to:0},$.query=null,$.text=null),$}},props:{handleKeyDown(y,E){var C;const{active:k,range:S}=b.getState(y.state);return k&&((C=g==null?void 0:g.onKeyDown)===null||C===void 0?void 0:C.call(g,{view:y,event:E,range:S}))||!1},decorations(y){const{active:E,range:C,decorationId:k}=b.getState(y);return E?Te.create(y.doc,[Qe.inline(C.from,C.to,{nodeName:a,class:c,"data-decoration-id":k})]):null}}});return b}const yv=Ae.create({name:"slash",addOptions(){return{suggestion:{char:"/",command:({editor:n,range:e,props:t})=>{t.command({editor:n,range:e})}}}},addProseMirrorPlugins(){return[Wg({editor:this.editor,...this.options.suggestion})]}}),kv=Ae.create({name:"slash-zh",addOptions(){return{suggestion:{char:"、",command:({editor:n,range:e,props:t})=>{t.command({editor:n,range:e})}}}},addProseMirrorPlugins(){return[Wg({pluginKey:new Fe("slash-zh-suggestion"),editor:this.editor,...this.options.suggestion})]}}),Ev={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:Object},range:{type:Object}},setup(){const{locale:n,tr:e}=Ee(),{onCommand:t}=Ie();return{locale:n,tr:e,onCommand:t}},data(){return{view:"main",selectedIndex:0}},components:{ODivider:Gt,OIcon:re,OList:ln,OListItem:jt},watch:{items(){this.selectedIndex=0}},methods:{onClick(n){switch(n.value){default:this.run(n);break}return!0},run(n){const e=this.editor.chain().focus().deleteRange(this.range),t=this.editor.commands;switch(n.value){case"codeBlock":t.deleteRange(this.range),this.editor.commands.setCodeBlock({language:"bash"});break;case"content":t.deleteRange(this.range),this.editor.commands.insertContent(n.options.content);break;case"taskList":t.deleteRange(this.range),this.editor.commands.toggleTaskList();break;default:this.onCommand(t,e,n.value,n.options);break}},onKeyDown({event:n}){return n.key==="ArrowUp"?(this.upHandler(),!0):n.key==="ArrowDown"?(this.downHandler(),!0):n.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(n){const e=this.items[n];e&&this.onClick(e)},setEmoji(n){this.onClick({value:"content",options:{content:n}})}},computed:{basicBlocks(){return mi.slice(1)}},mounted(){this.selectedIndex=0}},wv=(n,e)=>{const t=n.__vccOpts||n;for(const[r,o]of e)t[r]=o;return t},Cv={key:0,class:"view-main"},_v={class:"group o-tips"},Sv={class:"o-tips"},xv={key:1,class:"item"},Nv={key:1,class:"view-emoji"},Tv={key:2,class:"view-emoji"};function Ov(n,e,t,r,o,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-${o.view}`])},[o.view==="main"?(l.openBlock(),l.createElementBlock("section",Cv,[l.createVNode(d,{hoverable:"",clickable:""},{default:l.withCtx(()=>[t.items.length?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(t.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",_v,l.toDisplayString(r.tr(u.group)),1)],64)):l.createCommentVNode("",!0),l.createVNode(c,{class:l.normalizeClass(["item",{"is-active":p===o.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",Sv,l.toDisplayString(u.tips),1)]),default:l.withCtx(()=>[l.createTextVNode(" "+l.toDisplayString(r.tr(u.label)),1)]),_:2},1032,["class","onClick"])],64))),128)):(l.openBlock(),l.createElementBlock("div",xv,"No result"))]),_:1})])):o.view==="emoji"?(l.openBlock(),l.createElementBlock("section",Nv)):o.view==="ai"?(l.openBlock(),l.createElementBlock("section",Tv)):l.createCommentVNode("",!0)],2)}const Mv=wv(Ev,[["render",Ov]]),qg={items:({query:n})=>Oc.filter(e=>e.value.toLowerCase().startsWith(n.toLowerCase())),render:()=>{let n,e;return{onStart:t=>{n=new Th(Mv,{props:t,editor:t.editor}),e=On("body",{getReferenceClientRect:t.clientRect,appendTo:()=>document.body,content:n.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start",arrow:!1})},onUpdate(t){n.updateProps(t),e[0].setProps({getReferenceClientRect:t.clientRect})},onKeyDown(t){var r;return t.event.key==="Escape"?(e[0].hide(),n.destroy(),!0):(r=n.ref)==null?void 0:r.onKeyDown(t)},onExit(){e[0].destroy(),n.destroy()}}}},Av={BackColor:$A.configure({multicolor:!0}),Focus:FA,ForeColor:VA,FontFamily:zA,Image:Ym,Link:fg,TextAlign:qA.configure({types:["heading","paragraph"]}),TaskItem:UA,TaskList:WA.configure({itemTypeName:"taskItem"}),Underline:mv,Typography:hv,OSlash:yv.configure({suggestion:qg}),OSlashZh:kv.configure({suggestion:qg}),OBlockquote:RN,OCallout:PN,OCodeBlock:yO,OColorHighlighter:kO,OHeading:wO,OHorizontalRule:SO,OImage:MO,OLink:QO.configure({openOnClick:!1}),OParagraph:tM,OTrailingNode:kA,OUniqueID:NA.configure({attributeName:"data-id",enableRender:!1,types:["heading","paragraph"]}),OVideo:RA};class vv{constructor(e){return Av[e]}}const Rv=[bA,iA.configure({resizable:!0}),Ug,mA,cA];Pg.configure({resizable:!0});const Dv=["data-theme"],Kg=l.defineComponent({__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},showContent:{type:Boolean,default:!0},showGuide:{type:Boolean,default:!1},scrollable:{type:Boolean,default:!1},editorProps:{type:Object,default:function(){return{}}},extensions:{type:Array,default:function(){return[]}},mainMenu:{type:Array,default:function(){return[]}},tableMenu:{type:Array,default:function(){return[]}},bubbleMenu:{type:Array,default:function(){return[]}},floatingMenu:{type:Array,default:function(){return[]}},pageView:{type:String,default:"page"},options:{type:Object,default:function(){return{}}}},emits:["transaction","update"],setup(n,{expose:e,emit:t}){const r=n,o=t,{tr:i}=Ee(),s=l.ref(!1),a=l.ref("en"),c=l.ref(!1);l.provide("darkMode",s),l.provide("locale",a),l.provide("sideNode",c);const d=l.computed(()=>g()),u=GC({editable:r.editable,content:r.content,extensions:d.value,onUpdate:()=>{var E,C;const b=(E=u.value)==null?void 0:E.getJSON(),y=(C=u.value)==null?void 0:C.getHTML();o("update",{json:b,html:y})},onTransaction:({editor:b,transaction:y})=>{o("transaction",{editor:b,transaction:y})}}),p=l.computed(()=>({editor:u.value,menu:r.mainMenu})),f=l.computed(()=>({editor:u.value,menu:r.bubbleMenu})),h=l.computed(()=>({editor:u.value,menu:r.floatingMenu})),m=l.computed(()=>({editor:u.value,menu:[]}));function g(){const b=[];b.push(nM.configure({placeholder:({editor:E,node:C,pos:k})=>{if(C.type.name==="heading"){const S=C.attrs.level;return k>0?`H${S}`:i("label.untitled")}else return C.type.name==="paragraph"?i("label.typeForCommands"):""}})),b.push(q_),b.push(U_.configure({blockquote:r.extensions.includes("OBlockquote")?!1:{},codeBlock:!1,heading:r.extensions.includes("OHeading")?!1:{levels:[1,2,3,4,5]},paragraph:r.extensions.includes("OParagraph")?!1:{},dropcursor:{width:5,color:"skyblue",class:"yiitap-dropcursor"},horizontalRule:!1})),console.log("default",Hg);const y=Hg.concat(r.extensions);for(const E of y)if(typeof E=="string"){if(!BA.includes(E))continue;switch(E){case"Table":b.push(...Rv);break;default:try{const C=new vv(E);b.push(C),console.log("dynamic extension",E,C)}catch(C){console.error(C.message)}break}}else b.push(E);return b}return l.watch(()=>r.darkMode,b=>{s.value=b}),l.watch(()=>r.locale,b=>{a.value=b}),l.watch(()=>r.editable,b=>{var y;(y=u.value)==null||y.setEditable(b)}),l.onBeforeMount(()=>{s.value=r.darkMode,a.value=r.locale,c.value=!r.showSideMenu&&r.showSideNode}),e({editor:u,darkModeAlt:s,localeAlt:a}),(b,y)=>{var E,C,k;return l.openBlock(),l.createElementBlock("main",{class:"yiitap yiitap-editor","data-theme":s.value?"dark":""},[n.showMainMenu?(l.openBlock(),l.createBlock(tm,l.mergeProps({key:0},p.value,{class:"desktop-only"}),{left:l.withCtx(()=>[l.renderSlot(b.$slots,"toolbar-left")]),right:l.withCtx(()=>[l.renderSlot(b.$slots,"toolbar-right")]),_:3},16)):l.createCommentVNode("",!0),(E=l.unref(u))!=null&&E.isEditable&&n.showBubbleMenu?(l.openBlock(),l.createBlock(mN,l.normalizeProps(l.mergeProps({key:1},f.value)),null,16)):l.createCommentVNode("",!0),(C=l.unref(u))!=null&&C.isEditable&&n.showFloatingMenu?(l.openBlock(),l.createBlock(yN,l.normalizeProps(l.mergeProps({key:2},h.value)),null,16)):l.createCommentVNode("",!0),(k=l.unref(u))!=null&&k.isEditable&&n.showSideMenu?(l.openBlock(),l.createBlock(AN,l.normalizeProps(l.mergeProps({key:3},m.value)),null,16)):l.createCommentVNode("",!0),l.createVNode(l.unref(qC),{class:l.normalizeClass(["editor-content",n.pageView]),editor:l.unref(u)},null,8,["class","editor"])],8,Dv)}}}),Iv={installed:!1,spellcheck:!0,install(n){this.installed=!0,n.component("YiiEditor",Kg)}};return de.AddNode=Qh,de.DragNode=em,de.OBlockMenu=qr,de.OBlockPlaceholder=Tc,de.OBlockPopover=So,de.OBlockToolbar=Mc,de.OBtn=vt,de.OCalloutColorBoard=Ac,de.OCalloutColorDropdown=hS,de.OCheckbox=Ic,de.OColorBoard=Rs,de.OCommandBtn=lt,de.OCommonBtn=Ds,de.OContextMenu=vs,de.ODivider=Gt,de.OIcon=re,de.OInput=xo,de.OLanguageDropdown=Gh,de.OList=ln,de.OListItem=jt,de.OMainMenu=tm,de.OMediaInput=Rc,de.OMenubarBtn=ve,de.OMetaInput=Dc,de.ONodeView=An,de.OPopover=We,de.OTableCellBackground=Jh,de.OTableGrid=jh,de.OTextColorBoard=Yh,de.OTooltip=br,de.YiiEditor=Kg,de.YiiEditorPlugin=Iv,de.useI18n=Ee,de.useTheme=hi,de.useTiptap=Ie,Object.defineProperty(de,Symbol.toStringTag,{value:"Module"}),de}({},Vue);