@next-bricks/markdown 1.13.2 → 1.13.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bricks.json +1 -1
- package/dist/chunks/1945.d498e798.js +2 -0
- package/dist/chunks/1945.d498e798.js.map +1 -0
- package/dist/chunks/6934.2253ad8b.js +2 -0
- package/dist/chunks/6934.2253ad8b.js.map +1 -0
- package/dist/chunks/{7768.25c15640.js → 7768.0fc422f7.js} +3 -3
- package/dist/chunks/{7768.25c15640.js.map → 7768.0fc422f7.js.map} +1 -1
- package/dist/chunks/8488.3ed7729b.js +3 -0
- package/dist/chunks/8488.3ed7729b.js.map +1 -0
- package/dist/chunks/eo-markdown-display.84640f41.js +2 -0
- package/dist/chunks/eo-markdown-display.84640f41.js.map +1 -0
- package/dist/chunks/eo-markdown-editor.59c2f466.js +2 -0
- package/dist/chunks/{eo-markdown-editor.a32213aa.js.map → eo-markdown-editor.59c2f466.js.map} +1 -1
- package/dist/chunks/{main.c451c922.js → main.125402d8.js} +2 -2
- package/dist/chunks/{main.c451c922.js.map → main.125402d8.js.map} +1 -1
- package/dist/{index.cb7e902d.js → index.c824a3e4.js} +2 -2
- package/dist/{index.cb7e902d.js.map → index.c824a3e4.js.map} +1 -1
- package/package.json +2 -2
- package/dist/chunks/5522.bbd6f76c.js +0 -3
- package/dist/chunks/5522.bbd6f76c.js.map +0 -1
- package/dist/chunks/6069.14414932.js +0 -2
- package/dist/chunks/6069.14414932.js.map +0 -1
- package/dist/chunks/6934.6b647c62.js +0 -2
- package/dist/chunks/6934.6b647c62.js.map +0 -1
- package/dist/chunks/eo-markdown-display.9c8150da.js +0 -2
- package/dist/chunks/eo-markdown-display.9c8150da.js.map +0 -1
- package/dist/chunks/eo-markdown-editor.a32213aa.js +0 -2
- /package/dist/chunks/{7768.25c15640.js.LICENSE.txt → 7768.0fc422f7.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{5522.bbd6f76c.js.LICENSE.txt → 8488.3ed7729b.js.LICENSE.txt} +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! For license information please see 7768.
|
|
2
|
-
(globalThis.webpackChunk_next_bricks_markdown=globalThis.webpackChunk_next_bricks_markdown||[]).push([[7768],{62:e=>{"use strict";e.exports=function(e,t){return t||(t={}),e?(e=String(e.__esModule?e.default:e),/^['"].*['"]$/.test(e)&&(e=e.slice(1,-1)),t.hash&&(e+=t.hash),/["'() \t\n]|(%20)/.test(e)||t.needQuotes?'"'.concat(e.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):e):e}},72:(e,t,n)=>{var r=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,s=/^0o[0-7]+$/i,a=parseInt,l="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,c="object"==typeof self&&self&&self.Object===Object&&self,u=l||c||Function("return this")(),d=Object.prototype.toString,h=Math.max,p=Math.min,f=function(){return u.Date.now()};function m(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function g(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==d.call(e)}(e))return NaN;if(m(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=m(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(r,"");var n=i.test(e);return n||s.test(e)?a(e.slice(2),n?2:8):o.test(e)?NaN:+e}e.exports=function(e,t,n){var r,o,i,s,a,l,c=0,u=!1,d=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function v(t){var n=r,i=o;return r=o=void 0,c=t,s=e.apply(i,n)}function w(e){var n=e-l;return void 0===l||n>=t||n<0||d&&e-c>=i}function k(){var e=f();if(w(e))return b(e);a=setTimeout(k,function(e){var n=t-(e-l);return d?p(n,i-(e-c)):n}(e))}function b(e){return a=void 0,y&&r?v(e):(r=o=void 0,s)}function x(){var e=f(),n=w(e);if(r=arguments,o=this,l=e,n){if(void 0===a)return function(e){return c=e,a=setTimeout(k,t),u?v(e):s}(l);if(d)return a=setTimeout(k,t),v(l)}return void 0===a&&(a=setTimeout(k,t)),s}return t=g(t)||0,m(n)&&(u=!!n.leading,i=(d="maxWait"in n)?h(g(n.maxWait)||0,t):i,y="trailing"in n?!!n.trailing:y),x.cancel=function(){void 0!==a&&clearTimeout(a),c=0,r=l=o=a=void 0},x.flush=function(){return void 0===a?s:b(f())},x}},96:(e,t,n)=>{"use strict";n.d(t,{JJ:()=>s,fV:()=>o,tG:()=>i});var r=n(1329);class o{constructor(e,t){var n;this.match=e,this.match=e,this.handler="string"==typeof t?(n=t,function(e,t,r,o){let i=n;if(t[1]){let e=t[0].lastIndexOf(t[1]);i+=t[0].slice(e+t[1].length);let n=(r+=e)-o;n>0&&(i=t[0].slice(e-n,e)+i,r=o)}return e.tr.insertText(i,r,o)}):t}}function i(e,t,n=null,i){return new o(e,((e,o,s,a)=>{let l=n instanceof Function?n(o):n,c=e.tr.delete(s,a),u=c.doc.resolve(s).blockRange(),d=u&&(0,r.oM)(u,t,l);if(!d)return null;c.wrap(u,d);let h=c.doc.resolve(s-1).nodeBefore;return h&&h.type==t&&(0,r.n9)(c.doc,s-1)&&(!i||i(o,h))&&c.join(s-1),c}))}function s(e,t,n=null){return new o(e,((e,r,o,i)=>{let s=e.doc.resolve(o),a=n instanceof Function?n(r):n;return s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),t)?e.tr.delete(o,i).setBlockType(o,o,t,a):null}))}new o(/--$/,"—"),new o(/\.\.\.$/,"…"),new o(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),new o(/"$/,"”"),new o(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),new o(/'$/,"’")},135:(e,t,n)=>{"use strict";n.d(t,{b6:()=>F,eD:()=>A,Eb:()=>O});var r=n(2113),o=200,i=function(){};i.prototype.append=function(e){return e.length?(e=i.from(e),!this.length&&e||e.length<o&&this.leafAppend(e)||this.length<o&&e.leafPrepend(this)||this.appendInner(e)):this},i.prototype.prepend=function(e){return e.length?i.from(e).append(this):this},i.prototype.appendInner=function(e){return new a(this,e)},i.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?i.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},i.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},i.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},i.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(t,n){return r.push(e(t,n))}),t,n),r},i.from=function(e){return e instanceof i?e:e&&e.length?new s(e):i.empty};var s=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var o=t;o<n;o++)if(!1===e(this.values[o],r+o))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var o=t-1;o>=n;o--)if(!1===e(this.values[o],r+o))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=o)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=o)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(i);i.empty=new s([]);var a=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var o=this.left.length;return!(t<o&&!1===this.left.forEachInner(e,t,Math.min(n,o),r))&&!(n>o&&!1===this.right.forEachInner(e,Math.max(t-o,0),Math.min(this.length,n)-o,r+o))&&void 0},t.prototype.forEachInvertedInner=function(e,t,n,r){var o=this.left.length;return!(t>o&&!1===this.right.forEachInvertedInner(e,t-o,Math.max(n,o)-o,r+o))&&!(n<o&&!1===this.left.forEachInvertedInner(e,Math.min(t,o),n,r))&&void 0},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(i);const l=i;var c=n(1329),u=n(1570);class d{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(0==this.eventCount)return null;let n,r,o=this.items.length;for(;;o--)if(this.items.get(o-1).selection){--o;break}t&&(n=this.remapping(o,this.items.length),r=n.maps.length);let i,s,a=e.tr,l=[],c=[];return this.items.forEach(((e,t)=>{if(!e.step)return n||(n=this.remapping(o,t+1),r=n.maps.length),r--,void c.push(e);if(n){c.push(new h(e.map));let t,o=e.step.map(n.slice(r));o&&a.maybeStep(o).doc&&(t=a.mapping.maps[a.mapping.maps.length-1],l.push(new h(t,void 0,void 0,l.length+c.length))),r--,t&&n.appendMap(t,r)}else a.maybeStep(e.step);return e.selection?(i=n?e.selection.map(n.slice(r)):e.selection,s=new d(this.items.slice(0,o).append(c.reverse().concat(l)),this.eventCount-1),!1):void 0}),this.items.length,0),{remaining:s,transform:a,selection:i}}addTransform(e,t,n,r){let o=[],i=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null;for(let n=0;n<e.steps.length;n++){let l,c=e.steps[n].invert(e.docs[n]),u=new h(e.mapping.maps[n],c,t);(l=a&&a.merge(u))&&(u=l,n?o.pop():s=s.slice(0,s.length-1)),o.push(u),t&&(i++,t=void 0),r||(a=u)}let l=i-n.depth;return l>f&&(s=function(e,t){let n;return e.forEach(((e,r)=>{if(e.selection&&0==t--)return n=r,!1})),e.slice(n)}(s,l),i-=l),new d(s.append(o),i)}remapping(e,t){let n=new c.X9;return this.items.forEach(((t,r)=>{let o=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,o)}),e,t),n}addMaps(e){return 0==this.eventCount?this:new d(this.items.append(e.map((e=>new h(e)))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),o=e.mapping,i=e.steps.length,s=this.eventCount;this.items.forEach((e=>{e.selection&&s--}),r);let a=t;this.items.forEach((t=>{let r=o.getMirror(--a);if(null==r)return;i=Math.min(i,r);let l=o.maps[r];if(t.step){let i=e.steps[r].invert(e.docs[r]),c=t.selection&&t.selection.map(o.slice(a+1,r));c&&s++,n.push(new h(l,i,c))}else n.push(new h(l))}),r);let l=[];for(let e=t;e<i;e++)l.push(new h(o.maps[e]));let c=this.items.slice(0,r).append(l).append(n),u=new d(c,s);return u.emptyItemCount()>500&&(u=u.compress(this.items.length-n.length)),u}emptyItemCount(){let e=0;return this.items.forEach((t=>{t.step||e++})),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],o=0;return this.items.forEach(((i,s)=>{if(s>=e)r.push(i),i.selection&&o++;else if(i.step){let e=i.step.map(t.slice(n)),s=e&&e.getMap();if(n--,s&&t.appendMap(s,n),e){let a=i.selection&&i.selection.map(t.slice(n));a&&o++;let l,c=new h(s.invert(),e,a),u=r.length-1;(l=r.length&&r[u].merge(c))?r[u]=l:r.push(c)}}else i.map&&n--}),this.items.length,0),new d(l.from(r.reverse()),o)}}d.empty=new d(l.empty,0);class h{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new h(t.getMap().invert(),t,this.selection)}}}class p{constructor(e,t,n,r,o){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=o}}const f=20;function m(e){let t=[];return e.forEach(((e,n,r,o)=>t.push(r,o))),t}function g(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let o=t.map(e[r],1),i=t.map(e[r+1],-1);o<=i&&n.push(o,i)}return n}function y(e,t,n,r){let o=k(t),i=b.get(t).spec.config,s=(r?e.undone:e.done).popEvent(t,o);if(!s)return;let a=s.selection.resolve(s.transform.doc),l=(r?e.done:e.undone).addTransform(s.transform,t.selection.getBookmark(),i,o),c=new p(r?l:s.remaining,r?s.remaining:l,null,0,-1);n(s.transform.setSelection(a).setMeta(b,{redo:r,historyState:c}).scrollIntoView())}let v=!1,w=null;function k(e){let t=e.plugins;if(w!=t){v=!1,w=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){v=!0;break}}return v}const b=new u.hs("history"),x=new u.hs("closeHistory");const C=(e,t)=>{let n=b.getState(e);return!(!n||0==n.done.eventCount||(t&&y(n,e,t,!1),0))},S=(e,t)=>{let n=b.getState(e);return!(!n||0==n.undone.eventCount||(t&&y(n,e,t,!0),0))};var M=n(6512);const N=(e,t)=>(Object.assign(e,{meta:{package:"@milkdown/plugin-history",...t}}),e),O=(0,M.yu)("Undo",(()=>()=>C));N(O,{displayName:"Command<undo>"});const A=(0,M.yu)("Undo",(()=>()=>S));N(O,{displayName:"Command<redo>"});const E=(0,M.Qx)({},"historyProviderConfig");N(E,{displayName:"Ctx<historyProviderConfig>"});const D=(0,M.Gf)((e=>function(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new u.k_({key:b,state:{init:()=>new p(d.empty,d.empty,null,0,-1),apply:(t,n,r)=>function(e,t,n,r){let o,i=n.getMeta(b);if(i)return i.historyState;n.getMeta(x)&&(e=new p(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(b))return s.getMeta(b).redo?new p(e.done.addTransform(n,void 0,r,k(t)),e.undone,m(n.mapping.maps[n.steps.length-1]),e.prevTime,e.prevComposition):new p(e.done,e.undone.addTransform(n,void 0,r,k(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new p(e.done.rebased(n,o),e.undone.rebased(n,o),g(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new p(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),g(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let o=n.getMeta("composition"),i=0==e.prevTime||!s&&e.prevComposition!=o&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach(((e,r)=>{for(let o=0;o<t.length;o+=2)e<=t[o+1]&&r>=t[o]&&(n=!0)})),n}(n,e.prevRanges)),a=s?g(e.prevRanges,n.mapping):m(n.mapping.maps[n.steps.length-1]);return new p(e.done.addTransform(n,i?t.selection.getBookmark():void 0,r,k(t)),d.empty,a,n.time,null==o?e.prevComposition:o)}}(n,r,t,e)},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?C:"historyRedo"==n?S:null;return!!r&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}(e.get(E.key))));N(D,{displayName:"Ctx<historyProviderPlugin>"});const T=(0,M.pq)("historyKeymap",{Undo:{shortcuts:"Mod-z",command:e=>{const t=e.get(r.MD);return()=>t.call(O.key)}},Redo:{shortcuts:["Mod-y","Shift-Mod-z"],command:e=>{const t=e.get(r.MD);return()=>t.call(A.key)}}});N(T.ctx,{displayName:"KeymapCtx<history>"}),N(T.shortcuts,{displayName:"Keymap<history>"});const F=[E,D,T,O,A].flat()},537:(e,t,n)=>{"use strict";n.d(t,{vh:()=>It,_r:()=>Ft,RP:()=>Pt,kD:()=>Rt,pK:()=>Tt,bA:()=>ot,xu:()=>it,Te:()=>Qt,f$:()=>Mt,tt:()=>Ot,lW:()=>Nt,cq:()=>Et,kr:()=>At,A7:()=>Dt,zF:()=>Bt,$l:()=>et});var r=n(1440),o=n(1854),i=n(96),s=n(6512),a=n(2113),l=n(1570),c=n(2402),u=n(4254),d=n(5715),h=n(660),p=n(7884);const f={tokenize:function(e,t,n){let r=0;return function t(i){return(87===i||119===i)&&r<3?(r++,e.consume(i),t):46===i&&3===r?(e.consume(i),o):n(i)};function o(e){return null===e?n(e):t(e)}},partial:!0},m={tokenize:function(e,t,n){let r,o,i;return s;function s(t){return 46===t||95===t?e.check(y,l,a)(t):null===t||(0,p.Ee)(t)||(0,p.Ny)(t)||45!==t&&(0,p.es)(t)?l(t):(i=!0,e.consume(t),s)}function a(t){return 95===t?r=!0:(o=r,r=void 0),e.consume(t),s}function l(e){return o||r||!i?n(e):t(e)}},partial:!0},g={tokenize:function(e,t){let n=0,r=0;return o;function o(s){return 40===s?(n++,e.consume(s),o):41===s&&r<n?i(s):33===s||34===s||38===s||39===s||41===s||42===s||44===s||46===s||58===s||59===s||60===s||63===s||93===s||95===s||126===s?e.check(y,t,i)(s):null===s||(0,p.Ee)(s)||(0,p.Ny)(s)?t(s):(e.consume(s),o)}function i(t){return 41===t&&r++,e.consume(t),o}},partial:!0},y={tokenize:function(e,t,n){return r;function r(s){return 33===s||34===s||39===s||41===s||42===s||44===s||46===s||58===s||59===s||63===s||95===s||126===s?(e.consume(s),r):38===s?(e.consume(s),i):93===s?(e.consume(s),o):60===s||null===s||(0,p.Ee)(s)||(0,p.Ny)(s)?t(s):n(s)}function o(e){return null===e||40===e||91===e||(0,p.Ee)(e)||(0,p.Ny)(e)?t(e):r(e)}function i(e){return(0,p.CW)(e)?s(e):n(e)}function s(t){return 59===t?(e.consume(t),r):(0,p.CW)(t)?(e.consume(t),s):n(t)}},partial:!0},v={tokenize:function(e,t,n){return function(t){return e.consume(t),r};function r(e){return(0,p.lV)(e)?n(e):t(e)}},partial:!0},w={tokenize:function(e,t,n){const r=this;return function(t){return 87!==t&&119!==t||!M.call(r,r.previous)||E(r.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(f,e.attempt(m,e.attempt(g,o),n),n)(t))};function o(n){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(n)}},previous:M},k={tokenize:function(e,t,n){const r=this;let o="",i=!1;return function(t){return 72!==t&&104!==t||!N.call(r,r.previous)||E(r.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(t),e.consume(t),s)};function s(t){if((0,p.CW)(t)&&o.length<5)return o+=String.fromCodePoint(t),e.consume(t),s;if(58===t){const n=o.toLowerCase();if("http"===n||"https"===n)return e.consume(t),a}return n(t)}function a(t){return 47===t?(e.consume(t),i?l:(i=!0,a)):n(t)}function l(t){return null===t||(0,p.JQ)(t)||(0,p.Ee)(t)||(0,p.Ny)(t)||(0,p.es)(t)?n(t):e.attempt(m,e.attempt(g,c),n)(t)}function c(n){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(n)}},previous:N},b={tokenize:function(e,t,n){const r=this;let o,i;return function(t){return A(t)&&O.call(r,r.previous)&&!E(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),s(t)):n(t)};function s(t){return A(t)?(e.consume(t),s):64===t?(e.consume(t),a):n(t)}function a(t){return 46===t?e.check(v,c,l)(t):45===t||95===t||(0,p.lV)(t)?(i=!0,e.consume(t),a):c(t)}function l(t){return e.consume(t),o=!0,a}function c(s){return i&&o&&(0,p.CW)(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(s)):n(s)}},previous:O},x={},C={text:x};let S=48;for(;S<123;)x[S]=b,S++,58===S?S=65:91===S&&(S=97);function M(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||(0,p.Ee)(e)}function N(e){return!(0,p.CW)(e)}function O(e){return!(47===e||A(e))}function A(e){return 43===e||45===e||46===e||95===e||(0,p.lV)(e)}function E(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}x[43]=b,x[45]=b,x[46]=b,x[95]=b,x[72]=[b,k],x[104]=[b,k],x[87]=[b,w],x[119]=[b,w];var D=n(5460),T=n(7508),F=n(6243);const I={tokenize:function(e,t,n){const r=this;return(0,T.N)(e,(function(e){const o=r.events[r.events.length-1];return o&&"gfmFootnoteDefinitionIndent"===o[1].type&&4===o[2].sliceSerialize(o[1],!0).length?t(e):n(e)}),"gfmFootnoteDefinitionIndent",5)},partial:!0};function R(e,t,n){const r=this;let o=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;o--;){const e=r.events[o][1];if("labelImage"===e.type){s=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(o){if(!s||!s._balanced)return n(o);const a=(0,F.B)(r.sliceSerialize({start:s.end,end:r.now()}));return 94===a.codePointAt(0)&&i.includes(a.slice(1))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(o),e.exit("gfmFootnoteCallLabelMarker"),t(o)):n(o)}}function P(e,t){let n,r=e.length;for(;r--;)if("labelImage"===e[r][1].type&&"enter"===e[r][0]){n=e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const o={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},l=[e[r+1],e[r+2],["enter",o,t],e[r+3],e[r+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",a,t],["exit",a,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",o,t]];return e.splice(r,e.length-r+1,...l),e}function B(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,s=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),a};function a(t){return 94!==t?n(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",l)}function l(a){if(s>999||93===a&&!i||null===a||91===a||(0,p.Ee)(a))return n(a);if(93===a){e.exit("chunkString");const i=e.exit("gfmFootnoteCallString");return o.includes((0,F.B)(r.sliceSerialize(i)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(a)}return(0,p.Ee)(a)||(i=!0),s++,e.consume(a),92===a?c:l}function c(t){return 91===t||92===t||93===t?(e.consume(t),s++,l):l(t)}}function L(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,s,a=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),l};function l(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(t)}function c(t){if(a>999||93===t&&!s||null===t||91===t||(0,p.Ee)(t))return n(t);if(93===t){e.exit("chunkString");const n=e.exit("gfmFootnoteDefinitionLabelString");return i=(0,F.B)(r.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return(0,p.Ee)(t)||(s=!0),a++,e.consume(t),92===t?u:c}function u(t){return 91===t||92===t||93===t?(e.consume(t),a++,c):c(t)}function d(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o.includes(i)||o.push(i),(0,T.N)(e,h,"gfmFootnoteDefinitionWhitespace")):n(t)}function h(e){return t(e)}}function z(e,t,n){return e.check(D.B,t,e.attempt(I,t,n))}function $(e){e.exit("gfmFootnoteDefinition")}var j=n(3890),_=n(6990),V=n(3796);function W(e){let t=(e||{}).singleTilde;const n={tokenize:function(e,n,r){const o=this.previous,i=this.events;let s=0;return function(t){return 126===o&&"characterEscape"!==i[i.length-1][1].type?r(t):(e.enter("strikethroughSequenceTemporary"),a(t))};function a(i){const l=(0,_.S)(o);if(126===i)return s>1?r(i):(e.consume(i),s++,a);if(s<2&&!t)return r(i);const c=e.exit("strikethroughSequenceTemporary"),u=(0,_.S)(i);return c._open=!u||2===u&&Boolean(l),c._close=!l||2===l&&Boolean(u),n(i)}},resolveAll:function(e,t){let n=-1;for(;++n<e.length;)if("enter"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._close){let r=n;for(;r--;)if("exit"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset==e[r][1].end.offset-e[r][1].start.offset){e[n][1].type="strikethroughSequence",e[r][1].type="strikethroughSequence";const o={type:"strikethrough",start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},i={type:"strikethroughText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},s=[["enter",o,t],["enter",e[r][1],t],["exit",e[r][1],t],["enter",i,t]],a=t.parser.constructs.insideSpan.null;a&&(0,j.m)(s,s.length,0,(0,V.W)(a,e.slice(r+1,n),t)),(0,j.m)(s,s.length,0,[["exit",i,t],["enter",e[n][1],t],["exit",e[n][1],t],["exit",o,t]]),(0,j.m)(e,r-1,n-r+3,s),n=r+s.length-2;break}}for(n=-1;++n<e.length;)"strikethroughSequenceTemporary"===e[n][1].type&&(e[n][1].type="data");return e}};return null==t&&(t=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}}}class H{constructor(){this.map=[]}add(e,t,n){!function(e,t,n,r){let o=0;if(0!==n||0!==r.length){for(;o<e.map.length;){if(e.map[o][0]===t)return e.map[o][1]+=n,void e.map[o][2].push(...r);o+=1}e.map.push([t,n,r])}}(this,e,t,n)}consume(e){if(this.map.sort(((e,t)=>e[0]-t[0])),0===this.map.length)return;let t=this.map.length;const n=[];for(;t>0;)t-=1,n.push(e.slice(this.map[t][0]+this.map[t][1])),n.push(this.map[t][2]),e.length=this.map[t][0];n.push([...e]),e.length=0;let r=n.pop();for(;r;)e.push(...r),r=n.pop();this.map.length=0}}function K(e,t){let n=!1;const r=[];for(;t<e.length;){const o=e[t];if(n){if("enter"===o[0])"tableContent"===o[1].type&&r.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===o[1].type){if("tableDelimiterMarker"===e[t-1][1].type){const e=r.length-1;r[e]="left"===r[e]?"center":"right"}}else if("tableDelimiterRow"===o[1].type)break}else"enter"===o[0]&&"tableDelimiterRow"===o[1].type&&(n=!0);t+=1}return r}const J={flow:{null:{tokenize:function(e,t,n){const r=this;let o,i=0,s=0;return function(e){let t=r.events.length-1;for(;t>-1;){const e=r.events[t][1].type;if("lineEnding"!==e&&"linePrefix"!==e)break;t--}const o=t>-1?r.events[t][1].type:null,i="tableHead"===o||"tableRow"===o?b:a;return i===b&&r.parser.lazy[r.now().line]?n(e):i(e)};function a(t){return e.enter("tableHead"),e.enter("tableRow"),function(e){return 124===e||(o=!0,s+=1),l(e)}(t)}function l(t){return null===t?n(t):(0,p.HP)(t)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),d):n(t):(0,p.On)(t)?(0,T.N)(e,l,"whitespace")(t):(s+=1,o&&(o=!1,i+=1),124===t?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),o=!0,l):(e.enter("data"),c(t)))}function c(t){return null===t||124===t||(0,p.Ee)(t)?(e.exit("data"),l(t)):(e.consume(t),92===t?u:c)}function u(t){return 92===t||124===t?(e.consume(t),c):c(t)}function d(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter("tableDelimiterRow"),o=!1,(0,p.On)(t)?(0,T.N)(e,h,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):h(t))}function h(t){return 45===t||58===t?m(t):124===t?(o=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),f):k(t)}function f(t){return(0,p.On)(t)?(0,T.N)(e,m,"whitespace")(t):m(t)}function m(t){return 58===t?(s+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),g):45===t?(s+=1,g(t)):null===t||(0,p.HP)(t)?w(t):k(t)}function g(t){return 45===t?(e.enter("tableDelimiterFiller"),y(t)):k(t)}function y(t){return 45===t?(e.consume(t),y):58===t?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),v):(e.exit("tableDelimiterFiller"),v(t))}function v(t){return(0,p.On)(t)?(0,T.N)(e,w,"whitespace")(t):w(t)}function w(n){return 124===n?h(n):(null===n||(0,p.HP)(n))&&o&&i===s?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(n)):k(n)}function k(e){return n(e)}function b(t){return e.enter("tableRow"),x(t)}function x(n){return 124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),x):null===n||(0,p.HP)(n)?(e.exit("tableRow"),t(n)):(0,p.On)(n)?(0,T.N)(e,x,"whitespace")(n):(e.enter("data"),C(n))}function C(t){return null===t||124===t||(0,p.Ee)(t)?(e.exit("data"),x(t)):(e.consume(t),92===t?S:C)}function S(t){return 92===t||124===t?(e.consume(t),C):C(t)}},resolveAll:function(e,t){let n,r,o,i=-1,s=!0,a=0,l=[0,0,0,0],c=[0,0,0,0],u=!1,d=0;const h=new H;for(;++i<e.length;){const p=e[i],f=p[1];"enter"===p[0]?"tableHead"===f.type?(u=!1,0!==d&&(U(h,t,d,n,r),r=void 0,d=0),n={type:"table",start:Object.assign({},f.start),end:Object.assign({},f.end)},h.add(i,0,[["enter",n,t]])):"tableRow"===f.type||"tableDelimiterRow"===f.type?(s=!0,o=void 0,l=[0,0,0,0],c=[0,i+1,0,0],u&&(u=!1,r={type:"tableBody",start:Object.assign({},f.start),end:Object.assign({},f.end)},h.add(i,0,[["enter",r,t]])),a="tableDelimiterRow"===f.type?2:r?3:1):!a||"data"!==f.type&&"tableDelimiterMarker"!==f.type&&"tableDelimiterFiller"!==f.type?"tableCellDivider"===f.type&&(s?s=!1:(0!==l[1]&&(c[0]=c[1],o=q(h,t,l,a,void 0,o)),l=c,c=[l[1],i,0,0])):(s=!1,0===c[2]&&(0!==l[1]&&(c[0]=c[1],o=q(h,t,l,a,void 0,o),l=[0,0,0,0]),c[2]=i)):"tableHead"===f.type?(u=!0,d=i):"tableRow"===f.type||"tableDelimiterRow"===f.type?(d=i,0!==l[1]?(c[0]=c[1],o=q(h,t,l,a,i,o)):0!==c[1]&&(o=q(h,t,c,a,i,o)),a=0):!a||"data"!==f.type&&"tableDelimiterMarker"!==f.type&&"tableDelimiterFiller"!==f.type||(c[3]=i)}for(0!==d&&U(h,t,d,n,r),h.consume(t.events),i=-1;++i<t.events.length;){const e=t.events[i];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=K(t.events,i))}return e}}}};function q(e,t,n,r,o,i){const s=1===r?"tableHeader":2===r?"tableDelimiter":"tableData";0!==n[0]&&(i.end=Object.assign({},Y(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const a=Y(t.events,n[1]);if(i={type:s,start:Object.assign({},a),end:Object.assign({},a)},e.add(n[1],0,[["enter",i,t]]),0!==n[2]){const o=Y(t.events,n[2]),i=Y(t.events,n[3]),s={type:"tableContent",start:Object.assign({},o),end:Object.assign({},i)};if(e.add(n[2],0,[["enter",s,t]]),2!==r){const r=t.events[n[2]],o=t.events[n[3]];if(r[1].end=Object.assign({},o[1].end),r[1].type="chunkText",r[1].contentType="text",n[3]>n[2]+1){const t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[["exit",s,t]])}return void 0!==o&&(i.end=Object.assign({},Y(t.events,o)),e.add(o,0,[["exit",i,t]]),i=void 0),i}function U(e,t,n,r,o){const i=[],s=Y(t.events,n);o&&(o.end=Object.assign({},s),i.push(["exit",o,t])),r.end=Object.assign({},s),i.push(["exit",r,t]),e.add(n+1,0,i)}function Y(e,t){const n=e[t],r="enter"===n[0]?"start":"end";return n[1][r]}const Z={tokenize:function(e,t,n){const r=this;return function(t){return null===r.previous&&r._gfmTasklistFirstContentOfListItem?(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),o):n(t)};function o(t){return(0,p.Ee)(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),i):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),i):n(t)}function i(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),s):n(t)}function s(r){return(0,p.HP)(r)?t(r):(0,p.On)(r)?e.check({tokenize:Q},t,n)(r):n(r)}}},G={text:{91:Z}};function Q(e,t,n){return(0,T.N)(e,(function(e){return null===e?n(e):t(e)}),"whitespace")}var X=n(8999),ee=n(7096),te=n(6641),ne=n(5186);const re={}.hasOwnProperty;function oe(e){return"string"==typeof e?new RegExp((0,ee.A)(e),"g"):e}function ie(e){return"function"==typeof e?e:()=>e}const se="phrasing",ae=["autolink","link","image","label"],le={transforms:[function(e){!function(e,t,n,r){let o,i;"string"==typeof t||t instanceof RegExp?(i=[[t,n]],o=r):(i=t,o=n),o||(o={});const s=(0,ne.C)(o.ignore||[]),a=function(e){const t=[];if("object"!=typeof e)throw new TypeError("Expected array or object as schema");if(Array.isArray(e)){let n=-1;for(;++n<e.length;)t.push([oe(e[n][0]),ie(e[n][1])])}else{let n;for(n in e)re.call(e,n)&&t.push([oe(n),ie(e[n])])}return t}(i);let l=-1;for(;++l<a.length;)(0,te.VG)(e,"text",c);return e;function c(e,t){let n,r=-1;for(;++r<t.length;){const e=t[r];if(s(e,n?n.children.indexOf(e):void 0,n))return;n=e}if(n)return function(e,t){const n=t[t.length-1],r=a[l][0],o=a[l][1];let i=0;const s=n.children.indexOf(e);let c=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){const n=d.index,s={index:d.index,input:d.input,stack:[...t,e]};let a=o(...d,s);if("string"==typeof a&&(a=a.length>0?{type:"text",value:a}:void 0),!1!==a&&(i!==n&&u.push({type:"text",value:e.value.slice(i,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),i=n+d[0].length,c=!0),!r.global)break;d=r.exec(e.value)}return c?(i<e.value.length&&u.push({type:"text",value:e.value.slice(i)}),n.children.splice(s,1,...u)):u=[e],s+u.length}(e,t)}}(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,de],[/([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/g,he]],{ignore:["link","linkReference"]})}],enter:{literalAutolink:function(e){this.enter({type:"link",title:null,url:"",children:[]},e)},literalAutolinkEmail:ue,literalAutolinkHttp:ue,literalAutolinkWww:ue},exit:{literalAutolink:function(e){this.exit(e)},literalAutolinkEmail:function(e){this.config.exit.autolinkEmail.call(this,e)},literalAutolinkHttp:function(e){this.config.exit.autolinkProtocol.call(this,e)},literalAutolinkWww:function(e){this.config.exit.data.call(this,e),this.stack[this.stack.length-1].url="http://"+this.sliceSerialize(e)}}},ce={unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:se,notInConstruct:ae},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:se,notInConstruct:ae},{character:":",before:"[ps]",after:"\\/",inConstruct:se,notInConstruct:ae}]};function ue(e){this.config.enter.autolinkProtocol.call(this,e)}function de(e,t,n,r,o){let i="";if(!pe(o))return!1;if(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!function(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}(n))return!1;const s=function(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const o=(0,X.D)(e,"(");let i=(0,X.D)(e,")");for(;-1!==r&&o>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}(n+r);if(!s[0])return!1;const a={type:"link",title:null,url:i+t+s[0],children:[{type:"text",value:t+s[0]}]};return s[1]?[a,{type:"text",value:s[1]}]:a}function he(e,t,n,r){return!(!pe(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function pe(e,t){const n=e.input.charCodeAt(e.index-1);return(0===e.index||(0,p.Ny)(n)||(0,p.es)(n))&&(!t||47!==n)}var fe=n(7938);function me(e){return e.label||!e.identifier?e.label||"":(0,fe.s)(e.identifier)}function ge(e,t,n,r){let o=r.join.length;for(;o--;){const i=r.join[o](e,t,n,r);if(!0===i||1===i)break;if("number"==typeof i)return"\n".repeat(1+i);if(!1===i)return"\n\n\x3c!----\x3e\n\n"}return"\n\n"}const ye=/\r?\n|\r/g;function ve(e){if(!e._compiled){const t=(e.atBreak?"[\\r\\n][\\t ]*":"")+(e.before?"(?:"+e.before+")":"");e._compiled=new RegExp((t?"("+t+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?"\\":"")+e.character+(e.after?"(?:"+e.after+")":""),"g")}return e._compiled}function we(e,t){return ke(e,t.inConstruct,!0)&&!ke(e,t.notInConstruct,!1)}function ke(e,t,n){if("string"==typeof t&&(t=[t]),!t||0===t.length)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function be(e,t,n){const r=(n.before||"")+(t||"")+(n.after||""),o=[],i=[],s={};let a=-1;for(;++a<e.unsafe.length;){const t=e.unsafe[a];if(!we(e.stack,t))continue;const n=ve(t);let i;for(;i=n.exec(r);){const e="before"in t||Boolean(t.atBreak),n="after"in t,r=i.index+(e?i[1].length:0);o.includes(r)?(s[r].before&&!e&&(s[r].before=!1),s[r].after&&!n&&(s[r].after=!1)):(o.push(r),s[r]={before:e,after:n})}}o.sort(xe);let l=n.before?n.before.length:0;const c=r.length-(n.after?n.after.length:0);for(a=-1;++a<o.length;){const e=o[a];e<l||e>=c||e+1<c&&o[a+1]===e+1&&s[e].after&&!s[e+1].before&&!s[e+1].after||o[a-1]===e-1&&s[e].before&&!s[e-1].before&&!s[e-1].after||(l!==e&&i.push(Ce(r.slice(l,e),"\\")),l=e,!/[!-/:-@[-`{-~]/.test(r.charAt(e))||n.encode&&n.encode.includes(r.charAt(e))?(i.push("&#x"+r.charCodeAt(e).toString(16).toUpperCase()+";"),l++):i.push("\\"))}return i.push(Ce(r.slice(l,c),n.after)),i.join("")}function xe(e,t){return e-t}function Ce(e,t){const n=/\\(?=[!-/:-@[-`{-~])/g,r=[],o=[],i=e+t;let s,a=-1,l=0;for(;s=n.exec(i);)r.push(s.index);for(;++a<r.length;)l!==r[a]&&o.push(e.slice(l,r[a])),o.push("\\"),l=r[a];return o.push(e.slice(l)),o.join("")}function Se(e){const t=e||{},n=t.now||{};let r=t.lineShift||0,o=n.line||1,i=n.column||1;return{move:function(e){const t=e||"",n=t.split(/\r?\n|\r/g),s=n[n.length-1];return o+=n.length-1,i=1===n.length?i+s.length:1+s.length+r,t},current:function(){return{now:{line:o,column:i},lineShift:r}},shift:function(e){r+=e}}}function Me(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Ne(){this.buffer()}function Oe(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=(0,F.B)(this.sliceSerialize(e)).toLowerCase()}function Ae(e){this.exit(e)}function Ee(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function De(){this.buffer()}function Te(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=(0,F.B)(this.sliceSerialize(e)).toLowerCase()}function Fe(e){this.exit(e)}function Ie(e,t,n,r){const o=Se(r);let i=o.move("[^");const s=n.enter("footnoteReference"),a=n.enter("reference");return i+=o.move(be(n,me(e),{...o.current(),before:i,after:"]"})),a(),s(),i+=o.move("]"),i}function Re(e,t,n,r){const o=Se(r);let i=o.move("[^");const s=n.enter("footnoteDefinition"),a=n.enter("label");return i+=o.move(be(n,me(e),{...o.current(),before:i,after:"]"})),a(),i+=o.move("]:"+(e.children&&e.children.length>0?" ":"")),o.shift(4),i+=o.move(function(e,t){const n=[];let r,o=0,i=0;for(;r=ye.exec(e);)s(e.slice(o,r.index)),n.push(r[0]),o=r.index+r[0].length,i++;return s(e.slice(o)),n.join("");function s(e){n.push(t(e,i,!e))}}(function(e,t,n){const r=t.indexStack,o=e.children||[],i=t.createTracker(n),s=[];let a=-1;for(r.push(-1);++a<o.length;){const n=o[a];r[r.length-1]=a,s.push(i.move(t.handle(n,e,t,{before:"\n",after:"\n",...i.current()}))),"list"!==n.type&&(t.bulletLastUsed=void 0),a<o.length-1&&s.push(i.move(ge(n,o[a+1],e,t)))}return r.pop(),s.join("")}(e,n,o.current()),Pe)),s(),i}function Pe(e,t,n){return 0===t?e:(n?"":" ")+e}function Be(e,t,n){const r=t.indexStack,o=e.children||[],i=[];let s=-1,a=n.before;r.push(-1);let l=t.createTracker(n);for(;++s<o.length;){const c=o[s];let u;if(r[r.length-1]=s,s+1<o.length){let n=t.handle.handlers[o[s+1].type];n&&n.peek&&(n=n.peek),u=n?n(o[s+1],e,t,{before:"",after:"",...l.current()}).charAt(0):""}else u=n.after;i.length>0&&("\r"===a||"\n"===a)&&"html"===c.type&&(i[i.length-1]=i[i.length-1].replace(/(\r?\n|\r)$/," "),a=" ",l=t.createTracker(n),l.move(i.join(""))),i.push(l.move(t.handle(c,e,t,{...l.current(),before:a,after:u}))),a=i[i.length-1].slice(-1)}return r.pop(),i.join("")}Ie.peek=function(){return"["},$e.peek=function(){return"~"};const Le={canContainEols:["delete"],enter:{strikethrough:function(e){this.enter({type:"delete",children:[]},e)}},exit:{strikethrough:function(e){this.exit(e)}}},ze={unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"]}],handlers:{delete:$e}};function $e(e,t,n,r){const o=Se(r),i=n.enter("strikethrough");let s=o.move("~~");return s+=Be(e,n,{...o.current(),before:s,after:"~"}),s+=o.move("~~"),i(),s}function je(e,t,n){let r=e.value||"",o="`",i=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(r);)o+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const e=n.unsafe[i],t=ve(e);let o;if(e.atBreak)for(;o=t.exec(r);){let e=o.index;10===r.charCodeAt(e)&&13===r.charCodeAt(e-1)&&e--,r=r.slice(0,e)+" "+r.slice(o.index+1)}}return o+r+o}je.peek=function(){return"`"};var _e=n(7395);const Ve={enter:{table:function(e){const t=e._align;this.enter({type:"table",align:t.map((e=>"none"===e?null:e)),children:[]},e),this.setData("inTable",!0)},tableData:He,tableHeader:He,tableRow:function(e){this.enter({type:"tableRow",children:[]},e)}},exit:{codeText:function(e){let t=this.resume();this.getData("inTable")&&(t=t.replace(/\\([\\|])/g,Ke)),this.stack[this.stack.length-1].value=t,this.exit(e)},table:function(e){this.exit(e),this.setData("inTable")},tableData:We,tableHeader:We,tableRow:We}};function We(e){this.exit(e)}function He(e){this.enter({type:"tableCell",children:[]},e)}function Ke(e,t){return"|"===t?t:e}function Je(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,o=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[\t :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{table:function(e,t,n,r){return a(function(e,t,n){const r=e.children;let o=-1;const i=[],s=t.enter("table");for(;++o<r.length;)i[o]=l(r[o],t,n);return s(),i}(e,n,r),e.align)},tableRow:function(e,t,n,r){const o=a([l(e,n,r)]);return o.slice(0,o.indexOf("\n"))},tableCell:s,inlineCode:function(e,t,n){let r=je(e,0,n);return n.stack.includes("tableCell")&&(r=r.replace(/\|/g,"\\$&")),r}}};function s(e,t,n,r){const o=n.enter("tableCell"),s=n.enter("phrasing"),a=Be(e,n,{...r,before:i,after:i});return s(),o(),a}function a(e,t){return(0,_e.Q)(e,{align:t,alignDelimiters:r,padding:n,stringLength:o})}function l(e,t,n){const r=e.children;let o=-1;const i=[],a=t.enter("tableRow");for(;++o<r.length;)i[o]=s(r[o],0,t,n);return a(),i}}const qe={exit:{taskListCheckValueChecked:Ye,taskListCheckValueUnchecked:Ye,paragraph:function(e){const t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){const e=this.stack[this.stack.length-1],n=e.children[0];if(n&&"text"===n.type){const r=t.children;let o,i=-1;for(;++i<r.length;){const e=r[i];if("paragraph"===e.type){o=e;break}}o===e&&(n.value=n.value.slice(1),0===n.value.length?e.children.shift():e.position&&n.position&&"number"==typeof n.position.start.offset&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}}},Ue={unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:function(e,t,n,r){const o=e.children[0],i="boolean"==typeof e.checked&&o&&"paragraph"===o.type,s="["+(e.checked?"x":" ")+"] ",a=Se(r);i&&a.move(s);let l=function(e,t,n,r){const o=function(e){const t=e.options.listItemIndent||"tab";if(1===t||"1"===t)return"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(n);let i=n.bulletCurrent||function(e){const t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}(n);t&&"list"===t.type&&t.ordered&&(i=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+i);let s=i.length+1;("tab"===o||"mixed"===o&&(t&&"list"===t.type&&t.spread||e.spread))&&(s=4*Math.ceil(s/4));const a=n.createTracker(r);a.move(i+" ".repeat(s-i.length)),a.shift(s);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,a.current()),(function(e,t,n){return t?(n?"":" ".repeat(s))+e:(n?i:i+" ".repeat(s-i.length))+e}));return l(),c}(e,t,n,{...r,...a.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,(function(e){return e+s}))),l}}};function Ye(e){this.stack[this.stack.length-2].checked="taskListCheckValueChecked"===e.type}function Ze(e={}){const t=this.data();function n(e,n){(t[e]?t[e]:t[e]=[]).push(n)}n("micromarkExtensions",function(e){return(0,h.y)([C,{document:{91:{tokenize:L,continuation:{tokenize:z},exit:$}},text:{91:{tokenize:B},93:{add:"after",tokenize:R,resolveTo:P}}},W(e),J,G])}(e)),n("fromMarkdownExtensions",[le,{enter:{gfmFootnoteDefinition:Me,gfmFootnoteDefinitionLabelString:Ne,gfmFootnoteCall:Ee,gfmFootnoteCallString:De},exit:{gfmFootnoteDefinition:Ae,gfmFootnoteDefinitionLabelString:Oe,gfmFootnoteCall:Fe,gfmFootnoteCallString:Te}},Le,Ve,qe]),n("toMarkdownExtensions",function(e){return{extensions:[ce,{unsafe:[{character:"[",inConstruct:["phrasing","label","reference"]}],handlers:{footnoteDefinition:Re,footnoteReference:Ie}},ze,Je(e),Ue]}}(e))}const Ge=(e,t)=>(Object.assign(e,{meta:{package:"@milkdown/preset-gfm",...t}}),e),Qe=(0,s.JY)("strike_through");Ge(Qe,{displayName:"Attr<strikethrough>",group:"Strikethrough"});const Xe=(0,s.hk)("strike_through",(e=>({inclusive:!1,parseDOM:[{tag:"del"},{style:"text-decoration",getAttrs:e=>"line-through"===e}],toDOM:t=>["del",e.get(Qe.key)(t)],parseMarkdown:{match:e=>"delete"===e.type,runner:(e,t,n)=>{e.openMark(n),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"strike_through"===e.type.name,runner:(e,t)=>{e.withMark(t,"delete")}}})));Ge(Xe.mark,{displayName:"MarkSchema<strikethrough>",group:"Strikethrough"}),Ge(Xe.ctx,{displayName:"MarkSchemaCtx<strikethrough>",group:"Strikethrough"});const et=(0,s.yu)("ToggleStrikeThrough",(()=>()=>(0,d.wh)(Xe.type())));Ge(et,{displayName:"Command<ToggleStrikethrough>",group:"Strikethrough"});const tt=(0,s.pq)("strikeThroughKeymap",{ToggleStrikethrough:{shortcuts:"Mod-Alt-x",command:e=>{const t=e.get(a.MD);return()=>t.call(et.key)}}});Ge(tt.ctx,{displayName:"KeymapCtx<strikethrough>",group:"Strikethrough"}),Ge(tt.shortcuts,{displayName:"Keymap<strikethrough>",group:"Strikethrough"});const nt=(e=3,t=3)=>{const n=Array(t).fill(0).map((()=>wt.type().createAndFill())),r=Array(t).fill(0).map((()=>kt.type().createAndFill())),o=Array(e).fill(0).map(((e,t)=>vt.type().create(null,0===t?r:n)));return yt.type().create(null,o)},rt=e=>(0,u.KP)((e=>"table"===e.type.spec.tableRole))(e),ot=(e,t)=>{const n=rt(t);if(!n)return;const r=c.J3.get(n.node);return e<0||e>=r.width?void 0:r.cellsInRect({left:e,right:e+1,top:0,bottom:r.height}).map((e=>{const t=n.node.nodeAt(e);if(!t)return;const r=e+n.start;return{pos:r,start:r+1,node:t}})).filter((e=>null!=e))},it=(e,t)=>{const n=rt(t);if(!n)return;const r=c.J3.get(n.node);return e<0||e>=r.height?void 0:r.cellsInRect({left:0,right:r.width,top:e,bottom:e+1}).map((e=>{const t=n.node.nodeAt(e);if(!t)return;const r=e+n.start;return{pos:r,start:r+1,node:t}})).filter((e=>null!=e))};function st(e,{map:t,tableStart:n,table:r},o){const i=Array(o).fill(0).reduce(((e,t,n)=>e+r.child(n).nodeSize),n),s=Array(t.width).fill(0).map(((e,n)=>{const o=r.nodeAt(t.map[n]);return wt.type().createAndFill({alignment:null==o?void 0:o.attrs.alignment})}));return e.insert(i,vt.type().create(null,s)),e}const at=e=>t=>n=>{const r=rt(n.selection),o="row"===e;if(r){const e=c.J3.get(r.node);if(t>=0&&t<(o?e.height:e.width)){const i=e.positionAt(o?t:e.height-1,o?e.width-1:t,r.node),s=n.doc.resolve(r.start+i),a=o?c.rn.rowSelection:c.rn.colSelection,l=e.positionAt(o?t:0,o?0:t,r.node),d=n.doc.resolve(r.start+l);return(0,u.I9)(n.setSelection(a(s,d)))}}return n},lt=at("row"),ct=at("col"),ut=e=>e[0].map(((t,n)=>e.map((e=>e[n])))),dt=(e,t)=>{const n=[],r=c.J3.get(e);for(let o=0;o<r.height;o++){const i=e.child(o),s=[];for(let n=0;n<r.width;n++){if(!t[o][n])continue;const i=r.map[o*r.width+n],a=t[o][n],l=e.nodeAt(i).type.createChecked(Object.assign({},a.attrs),a.content,a.marks);s.push(l)}n.push(i.type.createChecked(i.attrs,s,i.marks))}return e.type.createChecked(e.attrs,n,e.marks)},ht=e=>{const t=c.J3.get(e),n=[];for(let r=0;r<t.height;r++){const o=[],i={};for(let n=0;n<t.width;n++){const s=t.map[r*t.width+n],a=e.nodeAt(s),l=t.findCell(s);i[s]||l.top!==r?o.push(null):(i[s]=!0,o.push(a))}n.push(o)}return n},pt=(e,t,n,r)=>{const o=t[0]>n[0]?-1:1,i=e.splice(t[0],t.length),s=i.length%2==0?1:0;let a;return a=-1===r&&1===o?n[0]-1:1===r&&-1===o?n[n.length-1]-s+1:-1===o?n[0]:n[n.length-1]-s,e.splice(a,0,...i),e},ft=(e,t)=>{let n=e,r=e;for(let o=e;o>=0;o--){const e=ot(o,t.selection);e&&e.forEach((e=>{const t=e.node.attrs.colspan+o-1;t>=n&&(n=o),t>r&&(r=t)}))}for(let n=e;n<=r;n++){const e=ot(n,t.selection);e&&e.forEach((e=>{const t=e.node.attrs.colspan+n-1;e.node.attrs.colspan>1&&t>r&&(r=t)}))}const o=[];for(let e=n;e<=r;e++){const n=ot(e,t.selection);n&&n.length&&o.push(e)}n=o[0],r=o[o.length-1];const i=ot(n,t.selection),s=it(0,t.selection),a=t.doc.resolve(i[i.length-1].pos);let l;for(let e=r;e>=n;e--){const n=ot(e,t.selection);if(n&&n.length){for(let e=s.length-1;e>=0;e--)if(s[e].pos===n[0].pos){l=n[0];break}if(l)break}}return{$anchor:a,$head:t.doc.resolve(l.pos),indexes:o}},mt=(e,t)=>{let n=e,r=e;for(let o=e;o>=0;o--)it(o,t.selection).forEach((e=>{const t=e.node.attrs.rowspan+o-1;t>=n&&(n=o),t>r&&(r=t)}));for(let n=e;n<=r;n++)it(n,t.selection).forEach((e=>{const t=e.node.attrs.rowspan+n-1;e.node.attrs.rowspan>1&&t>r&&(r=t)}));const o=[];for(let e=n;e<=r;e++){const n=it(e,t.selection);n&&n.length&&o.push(e)}n=o[0],r=o[o.length-1];const i=it(n,t.selection),s=ot(0,t.selection),a=t.doc.resolve(i[i.length-1].pos);let l;for(let e=r;e>=n;e--){const n=it(e,t.selection);if(n&&n.length){for(let e=s.length-1;e>=0;e--)if(s[e].pos===n[0].pos){l=n[0];break}if(l)break}}return{$anchor:a,$head:t.doc.resolve(l.pos),indexes:o}};const gt=(0,c.of)({tableGroup:"block",cellContent:"paragraph",cellAttributes:{alignment:{default:"left",getFromDOM:e=>e.style.textAlign||"left",setDOMAttr:(e,t)=>{t.style=`text-align: ${e||"left"}`}}}}),yt=(0,s.Yh)("table",(()=>({...gt.table,parseMarkdown:{match:e=>"table"===e.type,runner:(e,t,n)=>{const r=t.align,o=t.children.map(((e,t)=>({...e,align:r,isHeader:0===t})));e.openNode(n),e.next(o),e.closeNode()}},toMarkdown:{match:e=>"table"===e.type.name,runner:(e,t)=>{var n;const r=null==(n=t.content.firstChild)?void 0:n.content;if(!r)return;const o=[];r.forEach((e=>{o.push(e.attrs.alignment)})),e.openNode("table",void 0,{align:o}),e.next(t.content),e.closeNode()}}})));Ge(yt.node,{displayName:"NodeSchema<table>",group:"Table"}),Ge(yt.ctx,{displayName:"NodeSchemaCtx<table>",group:"Table"});const vt=(0,s.Yh)("table_row",(()=>({...gt.table_row,parseMarkdown:{match:e=>"tableRow"===e.type,runner:(e,t,n)=>{const r=t.align,o=t.children.map(((e,n)=>({...e,align:r[n],isHeader:t.isHeader})));e.openNode(n),e.next(o),e.closeNode()}},toMarkdown:{match:e=>"table_row"===e.type.name,runner:(e,t)=>{e.openNode("tableRow"),e.next(t.content),e.closeNode()}}})));Ge(vt.node,{displayName:"NodeSchema<tableRow>",group:"Table"}),Ge(vt.ctx,{displayName:"NodeSchemaCtx<tableRow>",group:"Table"});const wt=(0,s.Yh)("table_cell",(()=>({...gt.table_cell,parseMarkdown:{match:e=>"tableCell"===e.type&&!e.isHeader,runner:(e,t,n)=>{const r=t.align;e.openNode(n,{alignment:r}).openNode(e.schema.nodes.paragraph).next(t.children).closeNode().closeNode()}},toMarkdown:{match:e=>"table_cell"===e.type.name,runner:(e,t)=>{e.openNode("tableCell").next(t.content).closeNode()}}})));Ge(wt.node,{displayName:"NodeSchema<tableCell>",group:"Table"}),Ge(wt.ctx,{displayName:"NodeSchemaCtx<tableCell>",group:"Table"});const kt=(0,s.Yh)("table_header",(()=>({...gt.table_header,parseMarkdown:{match:e=>"tableCell"===e.type&&!!e.isHeader,runner:(e,t,n)=>{const r=t.align;e.openNode(n,{alignment:r}),e.openNode(e.schema.nodes.paragraph),e.next(t.children),e.closeNode(),e.closeNode()}},toMarkdown:{match:e=>"table_header"===e.type.name,runner:(e,t)=>{e.openNode("tableCell"),e.next(t.content),e.closeNode()}}})));Ge(kt.node,{displayName:"NodeSchema<tableHeader>",group:"Table"}),Ge(kt.ctx,{displayName:"NodeSchemaCtx<tableHeader>",group:"Table"});const bt=(0,s.b_)((()=>new i.fV(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,((e,t,n,r)=>{var o,i;const s=e.doc.resolve(n);if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),yt.type()))return null;const a=nt(Number(null==(o=t.groups)?void 0:o.row),Number(null==(i=t.groups)?void 0:i.col)),c=e.tr.replaceRangeWith(n,r,a).scrollIntoView();return c.setSelection(l.U3.create(c.doc,n+3))}))));Ge(bt,{displayName:"InputRule<insertTableInputRule>",group:"Table"});const xt=(0,s.yu)("GoToPrevTableCell",(()=>()=>(0,c.D8)(-1)));Ge(xt,{displayName:"Command<goToPrevTableCellCommand>",group:"Table"});const Ct=(0,s.yu)("GoToNextTableCell",(()=>()=>(0,c.D8)(1)));Ge(Ct,{displayName:"Command<goToNextTableCellCommand>",group:"Table"});const St=(0,s.yu)("BreakTable",(()=>()=>(e,t)=>{if(!(0,c.aH)(e))return!1;const{$head:n}=e.selection,r=n.after(),i=e.tr.replaceWith(r,r,o.Wf.type().createAndFill());return i.setSelection(l.LN.near(i.doc.resolve(r),1)).scrollIntoView(),null==t||t(i),!0}));Ge(St,{displayName:"Command<breakTableCommand>",group:"Table"});const Mt=(0,s.yu)("InsertTable",(()=>({row:e,col:t}={})=>(n,r)=>{const{selection:o,tr:i}=n,{from:s}=o,a=nt(e,t),c=i.replaceSelectionWith(a),u=l.LN.findFrom(c.doc.resolve(s),1,!0);return u&&(null==r||r(c.setSelection(u))),!0}));Ge(Mt,{displayName:"Command<insertTableCommand>",group:"Table"});const Nt=(0,s.yu)("MoveRow",(()=>({from:e,to:t}={})=>(n,r)=>{const{tr:o}=n,i=null==r?void 0:r(function(e,t,n,r=!0){const o=rt(e.selection);if(!o)return e;const{indexes:i}=mt(t,e),{indexes:s}=mt(n,e);if(i.includes(n))return e;const a=((e,t,n)=>{let r=ht(e.node);return r=pt(r,t,n,0),dt(e.node,r)})(o,i,s),l=(0,u.I9)(e).replaceWith(o.pos,o.pos+o.node.nodeSize,a);if(!r)return l;const d=c.J3.get(a),h=o.start,p=n,f=d.positionAt(p,d.width-1,a),m=l.doc.resolve(h+f),g=c.rn.rowSelection,y=d.positionAt(p,0,a),v=l.doc.resolve(h+y);return l.setSelection(g(m,v))}(o,e??0,t??0,!0));return Boolean(i)}));Ge(Nt,{displayName:"Command<moveRowCommand>",group:"Table"});const Ot=(0,s.yu)("MoveCol",(()=>({from:e,to:t}={})=>(n,r)=>{const{tr:o}=n,i=null==r?void 0:r(function(e,t,n,r=!0){const o=rt(e.selection);if(!o)return e;const{indexes:i}=ft(t,e),{indexes:s}=ft(n,e);if(i.includes(n))return e;const a=((e,t,n)=>{let r=ut(ht(e.node));return r=pt(r,t,n,0),r=ut(r),dt(e.node,r)})(o,i,s),l=(0,u.I9)(e).replaceWith(o.pos,o.pos+o.node.nodeSize,a);if(!r)return l;const d=c.J3.get(a),h=o.start,p=n,f=d.positionAt(d.height-1,p,a),m=l.doc.resolve(h+f),g=c.rn.colSelection,y=d.positionAt(0,p,a),v=l.doc.resolve(h+y);return l.setSelection(g(m,v))}(o,e??0,t??0,!0));return Boolean(i)}));Ge(Ot,{displayName:"Command<moveColCommand>",group:"Table"});const At=(0,s.yu)("SelectRow",(()=>(e=0)=>(t,n)=>{const{tr:r}=t,o=null==n?void 0:n(lt(e)(r));return Boolean(o)}));Ge(At,{displayName:"Command<selectRowCommand>",group:"Table"});const Et=(0,s.yu)("SelectCol",(()=>(e=0)=>(t,n)=>{const{tr:r}=t,o=null==n?void 0:n(ct(e)(r));return Boolean(o)}));Ge(Et,{displayName:"Command<selectColCommand>",group:"Table"});const Dt=(0,s.yu)("SelectTable",(()=>()=>(e,t)=>{const{tr:n}=e,r=null==t?void 0:t((e=>{const t=(e=>{const t=rt(e);if(!t)return;const n=c.J3.get(t.node);return n.cellsInRect({left:0,right:n.width,top:0,bottom:n.height}).map((e=>{const n=t.node.nodeAt(e),r=e+t.start;return{pos:r,start:r+1,node:n}}))})(e.selection);if(t&&t[0]){const n=e.doc.resolve(t[0].pos),r=t[t.length-1];if(r){const t=e.doc.resolve(r.pos);return(0,u.I9)(e.setSelection(new c.rn(t,n)))}}return e})(n));return Boolean(r)}));Ge(Dt,{displayName:"Command<selectTableCommand>",group:"Table"});const Tt=(0,s.yu)("DeleteSelectedCells",(()=>()=>(e,t)=>{const{selection:n}=e;if(!(n instanceof c.rn))return!1;const r=n.isRowSelection(),o=n.isColSelection();return r&&o?(0,c.kG)(e,t):o?(0,c.gR)(e,t):(0,c.aR)(e,t)}));Ge(Tt,{displayName:"Command<deleteSelectedCellsCommand>",group:"Table"});const Ft=(0,s.yu)("AddColBefore",(()=>()=>c.RC));Ge(Ft,{displayName:"Command<addColBeforeCommand>",group:"Table"});const It=(0,s.yu)("AddColAfter",(()=>()=>c.GU));Ge(It,{displayName:"Command<addColAfterCommand>",group:"Table"});const Rt=(0,s.yu)("AddRowBefore",(()=>()=>(e,t)=>{if(!(0,c.aH)(e))return!1;if(t){const n=(0,c._t)(e);t(st(e.tr,n,n.top))}return!0}));Ge(Rt,{displayName:"Command<addRowBeforeCommand>",group:"Table"});const Pt=(0,s.yu)("AddRowAfter",(()=>()=>(e,t)=>{if(!(0,c.aH)(e))return!1;if(t){const n=(0,c._t)(e);t(st(e.tr,n,n.bottom))}return!0}));Ge(Pt,{displayName:"Command<addRowAfterCommand>",group:"Table"});const Bt=(0,s.yu)("SetAlign",(()=>(e="left")=>(0,c.i4)("alignment",e)));Ge(Bt,{displayName:"Command<setAlignCommand>",group:"Table"});const Lt=(0,s.pq)("tableKeymap",{NextCell:{shortcuts:["Mod-]","Tab"],command:e=>{const t=e.get(a.MD);return()=>t.call(Ct.key)}},PrevCell:{shortcuts:["Mod-[","Shift-Tab"],command:e=>{const t=e.get(a.MD);return()=>t.call(xt.key)}},ExitTable:{shortcuts:["Mod-Enter"],command:e=>{const t=e.get(a.MD);return()=>t.call(St.key)}}});Ge(Lt.ctx,{displayName:"KeymapCtx<table>",group:"Table"}),Ge(Lt.shortcuts,{displayName:"Keymap<table>",group:"Table"});const zt="footnote_definition",$t="footnoteDefinition",jt=(0,s.Yh)("footnote_definition",(()=>({group:"block",content:"block+",defining:!0,attrs:{label:{default:""}},parseDOM:[{tag:`dl[data-type="${zt}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw(0,r.Ik)(e);return{label:e.dataset.label}},contentElement:"dd"}],toDOM:e=>{const t=e.attrs.label;return["dl",{"data-label":t,"data-type":zt},["dt",t],["dd",0]]},parseMarkdown:{match:({type:e})=>e===$t,runner:(e,t,n)=>{e.openNode(n,{label:t.label}).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name===zt,runner:(e,t)=>{e.openNode($t,void 0,{label:t.attrs.label,identifier:t.attrs.label}).next(t.content).closeNode()}}})));Ge(jt.ctx,{displayName:"NodeSchemaCtx<footnodeDef>",group:"footnote"}),Ge(jt.node,{displayName:"NodeSchema<footnodeDef>",group:"footnote"});const _t="footnote_reference",Vt=(0,s.Yh)("footnote_reference",(()=>({group:"inline",inline:!0,atom:!0,attrs:{label:{default:""}},parseDOM:[{tag:`sup[data-type="${_t}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw(0,r.Ik)(e);return{label:e.dataset.label}}}],toDOM:e=>{const t=e.attrs.label;return["sup",{"data-label":t,"data-type":_t},t]},parseMarkdown:{match:({type:e})=>"footnoteReference"===e,runner:(e,t,n)=>{e.addNode(n,{label:t.label})}},toMarkdown:{match:e=>e.type.name===_t,runner:(e,t)=>{e.addNode("footnoteReference",void 0,void 0,{label:t.attrs.label,identifier:t.attrs.label})}}})));Ge(Vt.ctx,{displayName:"NodeSchemaCtx<footnodeRef>",group:"footnote"}),Ge(Vt.node,{displayName:"NodeSchema<footnodeRef>",group:"footnote"});const Wt=o.hm.extendSchema((e=>t=>{const n=e(t);return{...n,attrs:{...n.attrs,checked:{default:null}},parseDOM:[{tag:'li[data-item-type="task"]',getAttrs:e=>{if(!(e instanceof HTMLElement))throw(0,r.Ik)(e);return{label:e.dataset.label,listType:e.dataset["list-type"],spread:e.dataset.spread,checked:e.dataset.checked?"true"===e.dataset.checked:null}}},...(null==n?void 0:n.parseDOM)||[]],toDOM:e=>n.toDOM&&null==e.attrs.checked?n.toDOM(e):["li",{"data-item-type":"task","data-label":e.attrs.label,"data-list-type":e.attrs.listType,"data-spread":e.attrs.spread,"data-checked":e.attrs.checked},0],parseMarkdown:{match:({type:e})=>"listItem"===e,runner:(e,t,r)=>{if(null==t.checked)return void n.parseMarkdown.runner(e,t,r);const o=null!=t.label?`${t.label}.`:"•",i=null!=t.checked?Boolean(t.checked):null,s=null!=t.label?"ordered":"bullet",a=null!=t.spread?`${t.spread}`:"true";e.openNode(r,{label:o,listType:s,spread:a,checked:i}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>"list_item"===e.type.name,runner:(e,t)=>{if(null==t.attrs.checked)return void n.toMarkdown.runner(e,t);const r=t.attrs.label,o=t.attrs.listType,i="true"===t.attrs.spread,s=t.attrs.checked;e.openNode("listItem",void 0,{label:r,listType:o,spread:i,checked:s}),e.next(t.content),e.closeNode()}}}}));Ge(Wt,{displayName:"NodeSchema<listItem>",group:"ListItem"});const Ht=(0,s.b_)((()=>new i.fV(/^\[(?<checked>\s|x)\]\s$/,((e,t,n,r)=>{var o;const i=e.doc.resolve(n);let s=0,a=i.node(s);for(;a&&"list_item"!==a.type.name;)s--,a=i.node(s);if(!a||null!=a.attrs.checked)return null;const l=Boolean("x"===(null==(o=t.groups)?void 0:o.checked)),c=i.before(s),u=e.tr;return u.deleteRange(n,r).setNodeMarkup(c,void 0,{...a.attrs,checked:l}),u}))));Ge(Ht,{displayName:"InputRule<wrapInTaskListInputRule>",group:"ListItem"});const Kt=[tt,Lt].flat(),Jt=[bt,Ht],qt=(0,s.Gf)((()=>{const e=new l.hs("MILKDOWN_AUTO_INSERT_ZERO_SPACE"),t=e=>e.type===o.Wf.type();return new l.k_({key:e,props:{handleDOMEvents:{compositionstart(e){const{state:n,dispatch:r}=e,{tr:o,selection:i}=n,{$from:s}=i;return u.T.safari&&(0,c.aH)(n)&&i.empty&&(e=>t(e)&&2===e.nodeSize)(s.parent)&&r(o.insertText("",s.start())),!1},compositionend(e){const{state:n,dispatch:r}=e,{tr:o,selection:i}=n,{$from:s}=i;return u.T.safari&&(0,c.aH)(n)&&i.empty&&t(s.parent)&&s.parent.textContent.startsWith("")&&r(o.delete(s.start(),s.start()+1)),!1}}}})}));Ge(qt,{displayName:"Prose<autoInsertZeroSpaceInTablePlugin>",group:"Prose"});const Ut=(0,s.Gf)((()=>(0,c.AL)({})));Ge(Ut,{displayName:"Prose<columnResizingPlugin>",group:"Prose"});const Yt=(0,s.Gf)((()=>(0,c.LF)()));Ge(Yt,{displayName:"Prose<tableEditingPlugin>",group:"Prose"});const Zt=(0,s.lz)((()=>Ze));Ge(Zt,{displayName:"Remark<remarkGFMPlugin>",group:"Remark"});const Gt=[qt,Ut,Yt,Zt],Qt=[[Wt,yt,vt,kt,wt,jt,Vt,Qe,Xe].flat(),Jt,Kt,Gt,[Ct,xt,St,Mt,Nt,Ot,At,Et,Dt,Tt,Rt,Pt,Ft,It,Bt,et]].flat()},660:(e,t,n)=>{"use strict";n.d(t,{y:()=>i});var r=n(3890);const o={}.hasOwnProperty;function i(e){const t={};let n=-1;for(;++n<e.length;)s(t,e[n]);return t}function s(e,t){let n;for(n in t){const r=(o.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;for(s in i){o.call(r,s)||(r[s]=[]);const e=i[s];a(r[s],Array.isArray(e)?e:e?[e]:[])}}}function a(e,t){let n=-1;const o=[];for(;++n<t.length;)("after"===t[n].add?e:o).push(t[n]);(0,r.m)(e,0,0,o)}},1329:(e,t,n)=>{"use strict";n.d(t,{$L:()=>O,Ln:()=>y,Um:()=>N,Wg:()=>v,X9:()=>l,XE:()=>p,dL:()=>j,jP:()=>b,n9:()=>M,oM:()=>x,zy:()=>S});var r=n(6090);const o=Math.pow(2,16);function i(e){return 65535&e}class s{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class a{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&a.empty)return a.empty}recover(e){let t=0,n=i(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/o}(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?r:0);if(c>e)break;let u=this.ranges[l+i],d=this.ranges[l+a],h=c+u;if(e<=h){let i=c+r+((u?e==c?-1:e==h?1:t:t)<0?0:d);if(n)return i;let a=e==c?2:e==h?1:4;return(t<0?e!=c:e!=h)&&(a|=8),new s(i,a,e==(t<0?c:h)?null:l/3+(e-c)*o)}r+=d-u}return n?e+r:new s(e+r,0,null)}touches(e,t){let n=0,r=i(t),o=this.inverted?2:1,s=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let i=this.ranges[t]-(this.inverted?n:0);if(i>e)break;let a=this.ranges[t+o];if(e<=i+a&&t==3*r)return!0;n+=this.ranges[t+s]-a}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,o=0;r<this.ranges.length;r+=3){let i=this.ranges[r],s=i-(this.inverted?o:0),a=i+(this.inverted?0:o),l=this.ranges[r+t],c=this.ranges[r+n];e(s,s+l,a,a+c),o+=c-l}}invert(){return new a(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?a.empty:new a(e<0?[0,-e,0]:[0,0,e])}}a.empty=new a([]);class l{constructor(e=[],t,n=0,r=e.length){this.maps=e,this.mirror=t,this.from=n,this.to=r}slice(e=0,t=this.maps.length){return new l(this.maps,this.mirror,e,t)}copy(){return new l(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),null!=t&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,n=this.maps.length;t<e.maps.length;t++){let r=e.getMirror(t);this.appendMap(e.maps[t],null!=r&&r<t?n+r: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,n=this.maps.length+e.maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e.maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new l;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this.maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let o=this.maps[n].mapResult(e,t);if(null!=o.recover){let t=this.getMirror(n);if(null!=t&&t>n&&t<this.to){n=t,e=this.maps[t].recover(o.recover);continue}}r|=o.delInfo,e=o.pos}return n?e:new s(e,r,null)}}const c=Object.create(null);class u{getMap(){return a.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=c[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in c)throw new RangeError("Duplicate use of step JSON ID "+e);return c[e]=t,t.prototype.jsonID=e,t}}class d{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new d(e,null)}static fail(e){return new d(null,e)}static fromReplace(e,t,n,o){try{return d.ok(e.replace(t,n,o))}catch(e){if(e instanceof r.vI)return d.fail(e.message);throw e}}}function h(e,t,n){let o=[];for(let r=0;r<e.childCount;r++){let i=e.child(r);i.content.size&&(i=i.copy(h(i.content,t,i))),i.isInline&&(i=t(i,n,r)),o.push(i)}return r.FK.fromArray(o)}class p extends u{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),o=n.node(n.sharedDepth(this.to)),i=new r.Ji(h(t.content,((e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e),o),t.openStart,t.openEnd);return d.fromReplace(e,this.from,this.to,i)}invert(){return new f(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new p(t.pos,n.pos,this.mark)}merge(e){return e instanceof p&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new p(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("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new p(t.from,t.to,e.markFromJSON(t.mark))}}u.jsonID("addMark",p);class f extends u{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new r.Ji(h(t.content,(e=>e.mark(this.mark.removeFromSet(e.marks))),e),t.openStart,t.openEnd);return d.fromReplace(e,this.from,this.to,n)}invert(){return new p(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new f(t.pos,n.pos,this.mark)}merge(e){return e instanceof f&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new f(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("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new f(t.from,t.to,e.markFromJSON(t.mark))}}u.jsonID("removeMark",f);class m extends u{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return d.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return d.fromReplace(e,this.pos,this.pos+1,new r.Ji(r.FK.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new m(this.pos,t.marks[n]);return new m(this.pos,this.mark)}}return new g(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new m(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new m(t.pos,e.markFromJSON(t.mark))}}u.jsonID("addNodeMark",m);class g extends u{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return d.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return d.fromReplace(e,this.pos,this.pos+1,new r.Ji(r.FK.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new m(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new g(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new g(t.pos,e.markFromJSON(t.mark))}}u.jsonID("removeNodeMark",g);class y extends u{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&w(e,this.from,this.to)?d.fail("Structure replace would overwrite content"):d.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new a([this.from,this.to-this.from,this.slice.size])}invert(e){return new y(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new y(t.pos,Math.max(t.pos,n.pos),this.slice)}merge(e){if(!(e instanceof y)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;{let t=this.slice.size+e.slice.size==0?r.Ji.empty:new r.Ji(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new y(e.from,this.to,t,this.structure)}}{let t=this.slice.size+e.slice.size==0?r.Ji.empty:new r.Ji(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new y(this.from,this.to+(e.to-e.from),t,this.structure)}}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("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new y(t.from,t.to,r.Ji.fromJSON(e,t.slice),!!t.structure)}}u.jsonID("replace",y);class v extends u{constructor(e,t,n,r,o,i,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=o,this.insert=i,this.structure=s}apply(e){if(this.structure&&(w(e,this.from,this.gapFrom)||w(e,this.gapTo,this.to)))return d.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return d.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?d.fromReplace(e,this.from,this.to,n):d.fail("Content does not fit in gap")}getMap(){return new a([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 v(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),n=e.mapResult(this.to,-1),r=e.map(this.gapFrom,-1),o=e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||o>n.pos?null:new v(t.pos,n.pos,r,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new v(t.from,t.to,t.gapFrom,t.gapTo,r.Ji.fromJSON(e,t.slice),t.insert,!!t.structure)}}function w(e,t,n){let r=e.resolve(t),o=n-t,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let e=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,o--}}return!1}function k(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function b(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth;;--n){let r=e.$from.node(n),o=e.$from.index(n),i=e.$to.indexAfter(n);if(n<e.depth&&r.canReplace(o,i,t))return n;if(0==n||r.type.spec.isolating||!k(r,o,i))break}return null}function x(e,t,n=null,r=e){let o=function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.contentMatchAt(r).findWrapping(t);if(!i)return null;let s=i.length?i[0]:t;return n.canReplaceWith(r,o,s)?i:null}(e,t),i=o&&function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.child(r),s=t.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:t).contentMatch;for(let e=r;a&&e<o;e++)a=a.matchType(n.child(e).type);return a&&a.validEnd?s:null}(r,t);return i?o.map(C).concat({type:t,attrs:n}).concat(i.map(C)):null}function C(e){return{type:e,attrs:null}}function S(e,t,n=1,r){let o=e.resolve(t),i=o.depth-n,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 e=o.depth-1,t=n-2;e>i;e--,t--){let n=o.node(e),i=o.index(e);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(i,n.childCount),a=r&&r[t]||n;if(a!=n&&(s=s.replaceChild(0,a.type.create(a.attrs))),!n.canReplace(i+1,n.childCount)||!a.type.validContent(s))return!1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function M(e,t){let n=e.resolve(t),r=n.index();return o=n.nodeBefore,i=n.nodeAfter,!(!o||!i||o.isLeaf||!o.canAppend(i))&&n.parent.canReplace(r,r+1);var o,i}function N(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let o=n.content;for(let e=0;e<n.openStart;e++)o=o.firstChild.content;for(let e=1;e<=(0==n.openStart&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,i=r.index(t)+(n>0?1:0),s=r.node(t),a=!1;if(1==e)a=s.canReplace(i,i,o);else{let e=s.contentMatchAt(i).findWrapping(o.firstChild.type);a=e&&s.canReplaceWith(i,i,e[0])}if(a)return 0==n?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function O(e,t,n=t,o=r.Ji.empty){if(t==n&&!o.size)return null;let i=e.resolve(t),s=e.resolve(n);return A(i,s,o)?new y(t,n,o):new E(i,s,o).fit()}function A(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}u.jsonID("replaceAround",v);class E{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=r.FK.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=r.FK.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,o=this.close(e<0?this.$to:n.doc.resolve(e));if(!o)return null;let i=this.placed,s=n.depth,a=o.depth;for(;s&&a&&1==i.childCount;)i=i.firstChild.content,s--,a--;let l=new r.Ji(i,s,a);return e>-1?new v(n.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||n.pos!=this.$to.pos?new y(n.pos,o.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let o=t.firstChild;if(t.childCount>1&&(r=0),o.type.spec.isolating&&r<=n){e=n;break}t=o.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e,o=null;n?(o=F(this.unplaced.content,n-1).firstChild,e=o.content):e=this.unplaced.content;let i=e.firstChild;for(let e=this.depth;e>=0;e--){let s,{type:a,match:l}=this.frontier[e],c=null;if(1==t&&(i?l.matchType(i.type)||(c=l.fillBefore(r.FK.from(i),!1)):o&&a.compatibleContent(o.type)))return{sliceDepth:n,frontierDepth:e,parent:o,inject:c};if(2==t&&i&&(s=l.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:e,parent:o,wrap:s};if(o&&l.matchType(o.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,o=F(e,t);return!(!o.childCount||o.firstChild.isLeaf||(this.unplaced=new r.Ji(e,t+1,Math.max(n,o.size+t>=e.size-n?t+1:0)),0))}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,o=F(e,t);if(o.childCount<=1&&t>0){let i=e.size-t<=t+o.size;this.unplaced=new r.Ji(D(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new r.Ji(D(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:o,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let s=this.unplaced,a=n?n.content:s.content,l=s.openStart-e,c=0,u=[],{match:d,type:h}=this.frontier[t];if(o){for(let e=0;e<o.childCount;e++)u.push(o.child(e));d=d.matchFragment(o)}let p=a.size+e-(s.content.size-s.openEnd);for(;c<a.childCount;){let e=a.child(c),t=d.matchType(e.type);if(!t)break;c++,(c>1||0==l||e.content.size)&&(d=t,u.push(I(e.mark(h.allowedMarks(e.marks)),1==c?l:0,c==a.childCount?p:-1)))}let f=c==a.childCount;f||(p=-1),this.placed=T(this.placed,t,r.FK.from(u)),this.frontier[t].match=d,f&&p<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=a;e<p;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=f?0==e?r.Ji.empty:new r.Ji(D(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new r.Ji(D(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,t=this.frontier[this.depth];if(!t.type.isTextblock||!R(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),i=R(e,t,r,n,o);if(i){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],o=R(e,n,r,t,!0);if(!o||o.childCount)continue e}return{depth:t,fit:i,move:o?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=T(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=T(this.placed,this.depth,r.FK.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(r.FK.empty,!0);e.childCount&&(this.placed=T(this.placed,this.frontier.length,e))}}function D(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(D(e.firstChild.content,t-1,n)))}function T(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(T(e.lastChild.content,t-1,n)))}function F(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function I(e,t,n){if(t<=0)return e;let o=e.content;return t>1&&(o=o.replaceChild(0,I(o.firstChild,t-1,1==o.childCount?n-1:0))),t>0&&(o=e.type.contentMatch.fillBefore(o).append(o),n<=0&&(o=o.append(e.type.contentMatch.matchFragment(o).fillBefore(r.FK.empty,!0)))),e.copy(o)}function R(e,t,n,r,o){let i=e.node(t),s=o?e.indexAfter(t):e.index(t);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,i.content,s)?a:null}function P(e){return e.spec.defining||e.spec.definingForContent}function B(e,t,n,o,i){if(t<n){let r=e.firstChild;e=e.replaceChild(0,r.copy(B(r.content,t+1,n,o,r)))}if(t>o){let t=i.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(r.FK.empty,!0))}return e}function L(e,t){let n=[];for(let r=Math.min(e.depth,t.depth);r>=0;r--){let o=e.start(r);if(o<e.pos-(e.depth-r)||t.end(r)>t.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(o==t.start(r)||r==e.depth&&r==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==o-1)&&n.push(r)}return n}class z extends u{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return d.fail("No node at attribute step's position");let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let o=t.type.create(n,null,t.marks);return d.fromReplace(e,this.pos,this.pos+1,new r.Ji(r.FK.from(o),0,t.isLeaf?0:1))}getMap(){return a.empty}invert(e){return new z(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 z(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new z(t.pos,t.attr,t.value)}}u.jsonID("attr",z);let $=class extends Error{};$=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},($.prototype=Object.create(Error.prototype)).constructor=$,$.prototype.name="TransformError";class j{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new l}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new $(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,n=r.Ji.empty){let o=O(this.doc,e,t,n);return o&&this.step(o),this}replaceWith(e,t,n){return this.replace(e,t,new r.Ji(r.FK.from(n),0,0))}delete(e,t){return this.replace(e,t,r.Ji.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return function(e,t,n,o){if(!o.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),s=e.doc.resolve(n);if(A(i,s,o))return e.step(new y(t,n,o));let a=L(i,e.doc.resolve(n));0==a[a.length-1]&&a.pop();let l=-(i.depth+1);a.unshift(l);for(let e=i.depth,t=i.pos-1;e>0;e--,t--){let n=i.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;a.indexOf(e)>-1?l=e:i.before(e)==t&&a.splice(1,0,-e)}let c=a.indexOf(l),u=[],d=o.openStart;for(let e=o.content,t=0;;t++){let n=e.firstChild;if(u.push(n),t==o.openStart)break;e=n.content}for(let e=d-1;e>=0;e--){let t=u[e].type,n=P(t);if(n&&i.node(c).type!=t)d=e;else if(n||!t.isTextblock)break}for(let t=o.openStart;t>=0;t--){let l=(t+d+1)%(o.openStart+1),h=u[l];if(h)for(let t=0;t<a.length;t++){let u=a[(t+c)%a.length],d=!0;u<0&&(d=!1,u=-u);let p=i.node(u-1),f=i.index(u-1);if(p.canReplaceWith(f,f,h.type,h.marks))return e.replace(i.before(u),d?s.after(u):n,new r.Ji(B(o.content,0,o.openStart,l),l,o.openEnd))}}let h=e.steps.length;for(let r=a.length-1;r>=0&&(e.replace(t,n,o),!(e.steps.length>h));r--){let e=a[r];e<0||(t=i.before(e),n=s.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){return function(e,t,n,o){if(!o.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let r=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)return null}return null}(e.doc,t,o.type);null!=r&&(t=n=r)}e.replaceRange(t,n,new r.Ji(r.FK.from(o),0,0))}(this,e,t,n),this}deleteRange(e,t){return function(e,t,n){let r=e.doc.resolve(t),o=e.doc.resolve(n),i=L(r,o);for(let t=0;t<i.length;t++){let n=i[t],s=t==i.length-1;if(s&&0==n||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),o.end(n));if(n>0&&(s||r.node(n-1).canReplace(r.index(n-1),o.indexAfter(n-1))))return e.delete(r.before(n),o.after(n))}for(let i=1;i<=r.depth&&i<=o.depth;i++)if(t-r.start(i)==r.depth-i&&n>r.end(i)&&o.end(i)-n!=o.depth-i)return e.delete(r.before(i),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return function(e,t,n){let{$from:o,$to:i,depth:s}=t,a=o.before(s+1),l=i.after(s+1),c=a,u=l,d=r.FK.empty,h=0;for(let e=s,t=!1;e>n;e--)t||o.index(e)>0?(t=!0,d=r.FK.from(o.node(e).copy(d)),h++):c--;let p=r.FK.empty,f=0;for(let e=s,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,p=r.FK.from(i.node(e).copy(p)),f++):u++;e.step(new v(c,u,a,l,new r.Ji(d.append(p),h,f),d.size-h,!0))}(this,e,t),this}join(e,t=1){return function(e,t,n){let o=new y(t-n,t+n,r.Ji.empty,!0);e.step(o)}(this,e,t),this}wrap(e,t){return function(e,t,n){let o=r.FK.empty;for(let e=n.length-1;e>=0;e--){if(o.size){let t=n[e].type.contentMatch.matchFragment(o);if(!t||!t.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=r.FK.from(n[e].type.create(n[e].attrs,o))}let i=t.start,s=t.end;e.step(new v(i,s,i,s,new r.Ji(o,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,o=null){return function(e,t,n,o,i){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=e.steps.length;e.doc.nodesBetween(t,n,((t,n)=>{if(t.isTextblock&&!t.hasMarkup(o,i)&&function(e,t,n){let r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(e.doc,e.mapping.slice(s).map(n),o)){e.clearIncompatible(e.mapping.slice(s).map(n,1),o);let a=e.mapping.slice(s),l=a.map(n,1),c=a.map(n+t.nodeSize,1);return e.step(new v(l,c,l+1,c-1,new r.Ji(r.FK.from(o.create(i,null,t.marks)),0,0),1,!0)),!1}}))}(this,e,t,n,o),this}setNodeMarkup(e,t,n=null,o){return function(e,t,n,o,i){let s=e.doc.nodeAt(t);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let a=n.create(o,null,i||s.marks);if(s.isLeaf)return e.replaceWith(t,t+s.nodeSize,a);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new v(t,t+s.nodeSize,t+1,t+s.nodeSize-1,new r.Ji(r.FK.from(a),0,0),1,!0))}(this,e,t,n,o),this}setNodeAttribute(e,t,n){return this.step(new z(e,t,n)),this}addNodeMark(e,t){return this.step(new m(e,t)),this}removeNodeMark(e,t){if(!(t instanceof r.CU)){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(!(t=t.isInSet(n.marks)))return this}return this.step(new g(e,t)),this}split(e,t=1,n){return function(e,t,n=1,o){let i=e.doc.resolve(t),s=r.FK.empty,a=r.FK.empty;for(let e=i.depth,t=i.depth-n,l=n-1;e>t;e--,l--){s=r.FK.from(i.node(e).copy(s));let t=o&&o[l];a=r.FK.from(t?t.type.create(t.attrs,a):i.node(e).copy(a))}e.step(new y(t,t,new r.Ji(s.append(a),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){return function(e,t,n,r){let o,i,s=[],a=[];e.doc.nodesBetween(t,n,((e,l,c)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&c.type.allowsMarkType(r.type)){let c=Math.max(l,t),d=Math.min(l+e.nodeSize,n),h=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(h)||(o&&o.to==c&&o.mark.eq(u[e])?o.to=d:s.push(o=new f(c,d,u[e])));i&&i.to==c?i.to=d:a.push(i=new p(c,d,r))}})),s.forEach((t=>e.step(t))),a.forEach((t=>e.step(t)))}(this,e,t,n),this}removeMark(e,t,n){return function(e,t,n,o){let i=[],s=0;e.doc.nodesBetween(t,n,((e,a)=>{if(!e.isInline)return;s++;let l=null;if(o instanceof r.sX){let t,n=e.marks;for(;t=o.isInSet(n);)(l||(l=[])).push(t),n=t.removeFromSet(n)}else o?o.isInSet(e.marks)&&(l=[o]):l=e.marks;if(l&&l.length){let r=Math.min(a+e.nodeSize,n);for(let e=0;e<l.length;e++){let n,o=l[e];for(let e=0;e<i.length;e++){let t=i[e];t.step==s-1&&o.eq(i[e].style)&&(n=t)}n?(n.to=r,n.step=s):i.push({style:o,from:Math.max(a,t),to:r,step:s})}}})),i.forEach((t=>e.step(new f(t.from,t.to,t.style))))}(this,e,t,n),this}clearIncompatible(e,t,n){return function(e,t,n,o=n.contentMatch){let i=e.doc.nodeAt(t),s=[],a=t+1;for(let t=0;t<i.childCount;t++){let l=i.child(t),c=a+l.nodeSize,u=o.matchType(l.type);if(u){o=u;for(let t=0;t<l.marks.length;t++)n.allowsMarkType(l.marks[t].type)||e.step(new f(a,c,l.marks[t]))}else s.push(new y(a,c,r.Ji.empty));a=c}if(!o.validEnd){let t=o.fillBefore(r.FK.empty,!0);e.replace(a,a,new r.Ji(t,0,0))}for(let t=s.length-1;t>=0;t--)e.step(s[t])}(this,e,t,n),this}}},1408:(e,t,n)=>{"use strict";function r(e,t,n,r,o,i,s){try{var a=e[i](s),l=a.value}catch(e){return void n(e)}a.done?t(l):Promise.resolve(l).then(r,o)}n.d(t,{i:()=>i});var o=n(1361),i=function(){var e,t=(e=function*(e,t,n){var r=new FormData,i=function*(){if(Array.isArray(a)){var e="".concat(s,"[]");a.forEach((t=>{r.append(e,t)}))}else r.append(s,a)};for(var[s,a]of Object.entries(t))yield*i();return(yield o.http.put("api/gateway/object_store.object_store.PutObject/api/v1/objectStore/bucket/".concat(e,"/object"),r,n)).data},function(){var t=this,n=arguments;return new Promise((function(o,i){var s=e.apply(t,n);function a(e){r(s,o,i,a,l,"next",e)}function l(e){r(s,o,i,a,l,"throw",e)}a(void 0)}))});return function(e,n,r){return t.apply(this,arguments)}}()},1440:(e,t,n)=>{"use strict";n.d(t,{$D:()=>h,Ik:()=>g,TR:()=>p,XM:()=>c,Xm:()=>f,_K:()=>m,dI:()=>d,j7:()=>l,nr:()=>u,pj:()=>v,sm:()=>w,zD:()=>y});var r=Object.defineProperty,o=(e=>(e.docTypeError="docTypeError",e.contextNotFound="contextNotFound",e.timerNotFound="timerNotFound",e.ctxCallOutOfScope="ctxCallOutOfScope",e.createNodeInParserFail="createNodeInParserFail",e.stackOverFlow="stackOverFlow",e.parserMatchError="parserMatchError",e.serializerMatchError="serializerMatchError",e.getAtomFromSchemaFail="getAtomFromSchemaFail",e.expectDomTypeError="expectDomTypeError",e.callCommandBeforeEditorView="callCommandBeforeEditorView",e.missingRootElement="missingRootElement",e.missingNodeInSchema="missingNodeInSchema",e.missingMarkInSchema="missingMarkInSchema",e.ctxNotBind="ctxNotBind",e.missingYjsDoc="missingYjsDoc",e))(o||{});class i extends Error{constructor(e,t){super(t),((e,t,n)=>{((e,t,n)=>{t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n)})(this,"code"),this.name="MilkdownError",this.code=e}}const s=(e,t)=>"function"==typeof t?"[Function]":t,a=e=>JSON.stringify(e,s),l=e=>new i(o.docTypeError,`Doc type error, unsupported type: ${a(e)}`),c=e=>new i(o.contextNotFound,`Context "${e}" not found, do you forget to inject it?`),u=e=>new i(o.timerNotFound,`Timer "${e}" not found, do you forget to record it?`),d=()=>new i(o.ctxCallOutOfScope,"Should not call a context out of the plugin."),h=(...e)=>{const t=e.reduce(((e,t)=>{if(!t)return e;const n=e=>Array.isArray(e)?e.map((e=>n(e))).join(", "):e.toJSON?a(e.toJSON()):e.spec?a(e.spec):e.toString();return`${e}, ${n(t)}`}),"Create prosemirror node from remark failed in parser");return new i(o.createNodeInParserFail,t)},p=()=>new i(o.stackOverFlow,"Stack over flow, cannot pop on an empty stack."),f=e=>new i(o.parserMatchError,`Cannot match target parser for node: ${a(e)}.`),m=e=>new i(o.serializerMatchError,`Cannot match target serializer for node: ${a(e)}.`),g=e=>new i(o.expectDomTypeError,`Expect to be a dom, but get: ${a(e)}.`),y=()=>new i(o.callCommandBeforeEditorView,"You're trying to call a command before editor view initialized, make sure to get commandManager from ctx after editor view has been initialized"),v=e=>new i(o.missingNodeInSchema,`Missing node in schema, milkdown cannot find "${e}" in schema.`),w=e=>new i(o.missingMarkInSchema,`Missing mark in schema, milkdown cannot find "${e}" in schema.`)},1570:(e,t,n)=>{"use strict";n.d(t,{$t:()=>C,LN:()=>s,U3:()=>u,hs:()=>A,i5:()=>f,k_:()=>M,nh:()=>h,yn:()=>a});var r=n(6090),o=n(1329);const i=Object.create(null);class s{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new a(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=r.Ji.empty){let n=t.content.lastChild,o=null;for(let e=0;e<t.openEnd;e++)o=n,n=n.lastChild;let i=e.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:c}=s[a],u=e.mapping.slice(i);e.replaceRange(u.map(l.pos),u.map(c.pos),a?r.Ji.empty:t),0==a&&y(e,i,(n?n.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){let{$from:i,$to:s}=r[o],a=e.mapping.slice(n),l=a.map(i.pos),c=a.map(s.pos);o?e.deleteRange(l,c):(e.replaceRangeWith(l,c,t),y(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new u(e):g(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let o=t<0?g(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):g(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new f(e.node(0))}static atStart(e){return g(e,e,0,0,1)||new f(e)}static atEnd(e){return g(e,e,e.content.size,e.childCount,-1)||new f(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=i[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in i)throw new RangeError("Duplicate use of selection JSON ID "+e);return i[e]=t,t.prototype.jsonID=e,t}getBookmark(){return u.between(this.$anchor,this.$head).getBookmark()}}s.prototype.visible=!0;class a{constructor(e,t){this.$from=e,this.$to=t}}let l=!1;function c(e){l||e.parent.inlineContent||(l=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class u extends s{constructor(e,t=e){c(e),c(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return s.near(n);let r=e.resolve(t.map(this.anchor));return new u(r.parent.inlineContent?r:n,n)}replace(e,t=r.Ji.empty){if(super.replace(e,t),t==r.Ji.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof u&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new d(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new u(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if(n&&!r||(n=r>=0?1:-1),!t.parent.inlineContent){let e=s.findFrom(t,n,!0)||s.findFrom(t,-n,!0);if(!e)return s.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r||(e=(s.findFrom(e,-n,!0)||s.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0)&&(e=t),new u(e,t)}}s.jsonID("text",u);class d{constructor(e,t){this.anchor=e,this.head=t}map(e){return new d(e.map(this.anchor),e.map(this.head))}resolve(e){return u.between(e.resolve(this.anchor),e.resolve(this.head))}}class h extends s{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),o=e.resolve(r);return n?s.near(o):new h(o)}content(){return new r.Ji(r.FK.from(this.node),0,0)}eq(e){return e instanceof h&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new p(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new h(e.resolve(t.anchor))}static create(e,t){return new h(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}h.prototype.visible=!1,s.jsonID("node",h);class p{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new d(n,n):new p(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&h.isSelectable(n)?new h(t):s.near(t)}}class f extends s{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=r.Ji.empty){if(t==r.Ji.empty){e.delete(0,e.doc.content.size);let t=s.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new f(e)}map(e){return new f(e)}eq(e){return e instanceof f}getBookmark(){return m}}s.jsonID("all",f);const m={map(){return this},resolve:e=>new f(e)};function g(e,t,n,r,o,i=!1){if(t.inlineContent)return u.create(e,n);for(let s=r-(o>0?0:1);o>0?s<t.childCount:s>=0;s+=o){let r=t.child(s);if(r.isAtom){if(!i&&h.isSelectable(r))return h.create(e,n-(o<0?r.nodeSize:0))}else{let t=g(e,r,n+o,o<0?r.childCount:0,o,i);if(t)return t}n+=r.nodeSize*o}return null}function y(e,t,n){let r=e.steps.length-1;if(r<t)return;let i,a=e.steps[r];(a instanceof o.Ln||a instanceof o.Wg)&&(e.mapping.maps[r].forEach(((e,t,n,r)=>{null==i&&(i=r)})),e.setSelection(s.near(e.doc.resolve(i),n)))}class v extends o.dL{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=-3&this.updated|1,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return r.CU.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(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||r.CU.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(n=t),n=null==n?t:n,!e)return this.deleteRange(t,n);let o=this.storedMarks;if(!o){let e=this.doc.resolve(t);o=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,o)),this.selection.empty||this.setSelection(s.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function w(e,t){return t&&e?e.bind(t):e}class k{constructor(e,t,n){this.name=e,this.init=w(t.init,n),this.apply=w(t.apply,n)}}const b=[new k("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new k("selection",{init:(e,t)=>e.selection||s.atStart(t.doc),apply:e=>e.selection}),new k("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new k("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class x{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=b.slice(),t&&t.forEach((e=>{if(this.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new k(e.key,e.spec.state,e))}))}}class C{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 n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let o=!1;for(let i=0;i<this.config.plugins.length;i++){let s=this.config.plugins[i];if(s.spec.appendTransaction){let a=r?r[i].n:0,l=r?r[i].state:this,c=a<t.length&&s.spec.appendTransaction.call(s,a?t.slice(a):t,l,n);if(c&&n.filterTransaction(c,i)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<i?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),o=!0}r&&(r[i]={state:n,n:t.length})}}if(!o)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new C(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let o=n[r];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new v(this)}static create(e){let t=new x(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new C(t);for(let r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n}reconfigure(e){let t=new x(this.schema,e.plugins),n=t.fields,r=new C(t);for(let t=0;t<n.length;t++){let o=n[t].name;r[o]=this.hasOwnProperty(o)?this[o]:n[t].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map((e=>e.toJSON()))),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],o=r.spec.state;o&&o.toJSON&&(t[n]=o.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new x(e.schema,e.plugins),i=new C(o);return o.fields.forEach((o=>{if("doc"==o.name)i.doc=r.bP.fromJSON(e.schema,t.doc);else if("selection"==o.name)i.selection=s.fromJSON(i.doc,t.selection);else if("storedMarks"==o.name)t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let r in n){let s=n[r],a=s.spec.state;if(s.key==o.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(t,r))return void(i[o.name]=a.fromJSON.call(s,e,t[r],i))}i[o.name]=o.init(e,i)}})),i}}function S(e,t,n){for(let r in e){let o=e[r];o instanceof Function?o=o.bind(t):"handleDOMEvents"==r&&(o=S(o,t,{})),n[r]=o}return n}class M{constructor(e){this.spec=e,this.props={},e.props&&S(e.props,this,this.props),this.key=e.key?e.key.key:O("plugin")}getState(e){return e[this.key]}}const N=Object.create(null);function O(e){return e in N?e+"$"+ ++N[e]:(N[e]=0,e+"$")}class A{constructor(e="key"){this.key=O(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}},1854:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>ie,PD:()=>lt,hm:()=>Fe,Wf:()=>V,e0:()=>N,vY:()=>D,oO:()=>ne,Xk:()=>Se,Ej:()=>Ee});var r=n(6512),o=n(2113),i=n(5715),s=n(6090),a=n(1440),l=n(96),c=n(7096);const u=[["ß","ss"],["ẞ","Ss"],["ä","ae"],["Ä","Ae"],["ö","oe"],["Ö","Oe"],["ü","ue"],["Ü","Ue"],["À","A"],["Á","A"],["Â","A"],["Ã","A"],["Ä","Ae"],["Å","A"],["Æ","AE"],["Ç","C"],["È","E"],["É","E"],["Ê","E"],["Ë","E"],["Ì","I"],["Í","I"],["Î","I"],["Ï","I"],["Ð","D"],["Ñ","N"],["Ò","O"],["Ó","O"],["Ô","O"],["Õ","O"],["Ö","Oe"],["Ő","O"],["Ø","O"],["Ù","U"],["Ú","U"],["Û","U"],["Ü","Ue"],["Ű","U"],["Ý","Y"],["Þ","TH"],["ß","ss"],["à","a"],["á","a"],["â","a"],["ã","a"],["ä","ae"],["å","a"],["æ","ae"],["ç","c"],["è","e"],["é","e"],["ê","e"],["ë","e"],["ì","i"],["í","i"],["î","i"],["ï","i"],["ð","d"],["ñ","n"],["ò","o"],["ó","o"],["ô","o"],["õ","o"],["ö","oe"],["ő","o"],["ø","o"],["ù","u"],["ú","u"],["û","u"],["ü","ue"],["ű","u"],["ý","y"],["þ","th"],["ÿ","y"],["ẞ","SS"],["à","a"],["À","A"],["á","a"],["Á","A"],["â","a"],["Â","A"],["ã","a"],["Ã","A"],["è","e"],["È","E"],["é","e"],["É","E"],["ê","e"],["Ê","E"],["ì","i"],["Ì","I"],["í","i"],["Í","I"],["ò","o"],["Ò","O"],["ó","o"],["Ó","O"],["ô","o"],["Ô","O"],["õ","o"],["Õ","O"],["ù","u"],["Ù","U"],["ú","u"],["Ú","U"],["ý","y"],["Ý","Y"],["ă","a"],["Ă","A"],["Đ","D"],["đ","d"],["ĩ","i"],["Ĩ","I"],["ũ","u"],["Ũ","U"],["ơ","o"],["Ơ","O"],["ư","u"],["Ư","U"],["ạ","a"],["Ạ","A"],["ả","a"],["Ả","A"],["ấ","a"],["Ấ","A"],["ầ","a"],["Ầ","A"],["ẩ","a"],["Ẩ","A"],["ẫ","a"],["Ẫ","A"],["ậ","a"],["Ậ","A"],["ắ","a"],["Ắ","A"],["ằ","a"],["Ằ","A"],["ẳ","a"],["Ẳ","A"],["ẵ","a"],["Ẵ","A"],["ặ","a"],["Ặ","A"],["ẹ","e"],["Ẹ","E"],["ẻ","e"],["Ẻ","E"],["ẽ","e"],["Ẽ","E"],["ế","e"],["Ế","E"],["ề","e"],["Ề","E"],["ể","e"],["Ể","E"],["ễ","e"],["Ễ","E"],["ệ","e"],["Ệ","E"],["ỉ","i"],["Ỉ","I"],["ị","i"],["Ị","I"],["ọ","o"],["Ọ","O"],["ỏ","o"],["Ỏ","O"],["ố","o"],["Ố","O"],["ồ","o"],["Ồ","O"],["ổ","o"],["Ổ","O"],["ỗ","o"],["Ỗ","O"],["ộ","o"],["Ộ","O"],["ớ","o"],["Ớ","O"],["ờ","o"],["Ờ","O"],["ở","o"],["Ở","O"],["ỡ","o"],["Ỡ","O"],["ợ","o"],["Ợ","O"],["ụ","u"],["Ụ","U"],["ủ","u"],["Ủ","U"],["ứ","u"],["Ứ","U"],["ừ","u"],["Ừ","U"],["ử","u"],["Ử","U"],["ữ","u"],["Ữ","U"],["ự","u"],["Ự","U"],["ỳ","y"],["Ỳ","Y"],["ỵ","y"],["Ỵ","Y"],["ỷ","y"],["Ỷ","Y"],["ỹ","y"],["Ỹ","Y"],["ء","e"],["آ","a"],["أ","a"],["ؤ","w"],["إ","i"],["ئ","y"],["ا","a"],["ب","b"],["ة","t"],["ت","t"],["ث","th"],["ج","j"],["ح","h"],["خ","kh"],["د","d"],["ذ","dh"],["ر","r"],["ز","z"],["س","s"],["ش","sh"],["ص","s"],["ض","d"],["ط","t"],["ظ","z"],["ع","e"],["غ","gh"],["ـ","_"],["ف","f"],["ق","q"],["ك","k"],["ل","l"],["م","m"],["ن","n"],["ه","h"],["و","w"],["ى","a"],["ي","y"],["َ","a"],["ُ","u"],["ِ","i"],["٠","0"],["١","1"],["٢","2"],["٣","3"],["٤","4"],["٥","5"],["٦","6"],["٧","7"],["٨","8"],["٩","9"],["چ","ch"],["ک","k"],["گ","g"],["پ","p"],["ژ","zh"],["ی","y"],["۰","0"],["۱","1"],["۲","2"],["۳","3"],["۴","4"],["۵","5"],["۶","6"],["۷","7"],["۸","8"],["۹","9"],["ټ","p"],["ځ","z"],["څ","c"],["ډ","d"],["ﺫ","d"],["ﺭ","r"],["ړ","r"],["ﺯ","z"],["ږ","g"],["ښ","x"],["ګ","g"],["ڼ","n"],["ۀ","e"],["ې","e"],["ۍ","ai"],["ٹ","t"],["ڈ","d"],["ڑ","r"],["ں","n"],["ہ","h"],["ھ","h"],["ے","e"],["А","A"],["а","a"],["Б","B"],["б","b"],["В","V"],["в","v"],["Г","G"],["г","g"],["Д","D"],["д","d"],["ъе","ye"],["Ъе","Ye"],["ъЕ","yE"],["ЪЕ","YE"],["Е","E"],["е","e"],["Ё","Yo"],["ё","yo"],["Ж","Zh"],["ж","zh"],["З","Z"],["з","z"],["И","I"],["и","i"],["ый","iy"],["Ый","Iy"],["ЫЙ","IY"],["ыЙ","iY"],["Й","Y"],["й","y"],["К","K"],["к","k"],["Л","L"],["л","l"],["М","M"],["м","m"],["Н","N"],["н","n"],["О","O"],["о","o"],["П","P"],["п","p"],["Р","R"],["р","r"],["С","S"],["с","s"],["Т","T"],["т","t"],["У","U"],["у","u"],["Ф","F"],["ф","f"],["Х","Kh"],["х","kh"],["Ц","Ts"],["ц","ts"],["Ч","Ch"],["ч","ch"],["Ш","Sh"],["ш","sh"],["Щ","Sch"],["щ","sch"],["Ъ",""],["ъ",""],["Ы","Y"],["ы","y"],["Ь",""],["ь",""],["Э","E"],["э","e"],["Ю","Yu"],["ю","yu"],["Я","Ya"],["я","ya"],["ă","a"],["Ă","A"],["ș","s"],["Ș","S"],["ț","t"],["Ț","T"],["ţ","t"],["Ţ","T"],["ş","s"],["Ş","S"],["ç","c"],["Ç","C"],["ğ","g"],["Ğ","G"],["ı","i"],["İ","I"],["ա","a"],["Ա","A"],["բ","b"],["Բ","B"],["գ","g"],["Գ","G"],["դ","d"],["Դ","D"],["ե","ye"],["Ե","Ye"],["զ","z"],["Զ","Z"],["է","e"],["Է","E"],["ը","y"],["Ը","Y"],["թ","t"],["Թ","T"],["ժ","zh"],["Ժ","Zh"],["ի","i"],["Ի","I"],["լ","l"],["Լ","L"],["խ","kh"],["Խ","Kh"],["ծ","ts"],["Ծ","Ts"],["կ","k"],["Կ","K"],["հ","h"],["Հ","H"],["ձ","dz"],["Ձ","Dz"],["ղ","gh"],["Ղ","Gh"],["ճ","tch"],["Ճ","Tch"],["մ","m"],["Մ","M"],["յ","y"],["Յ","Y"],["ն","n"],["Ն","N"],["շ","sh"],["Շ","Sh"],["ո","vo"],["Ո","Vo"],["չ","ch"],["Չ","Ch"],["պ","p"],["Պ","P"],["ջ","j"],["Ջ","J"],["ռ","r"],["Ռ","R"],["ս","s"],["Ս","S"],["վ","v"],["Վ","V"],["տ","t"],["Տ","T"],["ր","r"],["Ր","R"],["ց","c"],["Ց","C"],["ու","u"],["ՈՒ","U"],["Ու","U"],["փ","p"],["Փ","P"],["ք","q"],["Ք","Q"],["օ","o"],["Օ","O"],["ֆ","f"],["Ֆ","F"],["և","yev"],["ა","a"],["ბ","b"],["გ","g"],["დ","d"],["ე","e"],["ვ","v"],["ზ","z"],["თ","t"],["ი","i"],["კ","k"],["ლ","l"],["მ","m"],["ნ","n"],["ო","o"],["პ","p"],["ჟ","zh"],["რ","r"],["ს","s"],["ტ","t"],["უ","u"],["ფ","ph"],["ქ","q"],["ღ","gh"],["ყ","k"],["შ","sh"],["ჩ","ch"],["ც","ts"],["ძ","dz"],["წ","ts"],["ჭ","tch"],["ხ","kh"],["ჯ","j"],["ჰ","h"],["č","c"],["ď","d"],["ě","e"],["ň","n"],["ř","r"],["š","s"],["ť","t"],["ů","u"],["ž","z"],["Č","C"],["Ď","D"],["Ě","E"],["Ň","N"],["Ř","R"],["Š","S"],["Ť","T"],["Ů","U"],["Ž","Z"],["ހ","h"],["ށ","sh"],["ނ","n"],["ރ","r"],["ބ","b"],["ޅ","lh"],["ކ","k"],["އ","a"],["ވ","v"],["މ","m"],["ފ","f"],["ދ","dh"],["ތ","th"],["ލ","l"],["ގ","g"],["ޏ","gn"],["ސ","s"],["ޑ","d"],["ޒ","z"],["ޓ","t"],["ޔ","y"],["ޕ","p"],["ޖ","j"],["ޗ","ch"],["ޘ","tt"],["ޙ","hh"],["ޚ","kh"],["ޛ","th"],["ޜ","z"],["ޝ","sh"],["ޞ","s"],["ޟ","d"],["ޠ","t"],["ޡ","z"],["ޢ","a"],["ޣ","gh"],["ޤ","q"],["ޥ","w"],["ަ","a"],["ާ","aa"],["ި","i"],["ީ","ee"],["ު","u"],["ޫ","oo"],["ެ","e"],["ޭ","ey"],["ޮ","o"],["ޯ","oa"],["ް",""],["α","a"],["β","v"],["γ","g"],["δ","d"],["ε","e"],["ζ","z"],["η","i"],["θ","th"],["ι","i"],["κ","k"],["λ","l"],["μ","m"],["ν","n"],["ξ","ks"],["ο","o"],["π","p"],["ρ","r"],["σ","s"],["τ","t"],["υ","y"],["φ","f"],["χ","x"],["ψ","ps"],["ω","o"],["ά","a"],["έ","e"],["ί","i"],["ό","o"],["ύ","y"],["ή","i"],["ώ","o"],["ς","s"],["ϊ","i"],["ΰ","y"],["ϋ","y"],["ΐ","i"],["Α","A"],["Β","B"],["Γ","G"],["Δ","D"],["Ε","E"],["Ζ","Z"],["Η","I"],["Θ","TH"],["Ι","I"],["Κ","K"],["Λ","L"],["Μ","M"],["Ν","N"],["Ξ","KS"],["Ο","O"],["Π","P"],["Ρ","R"],["Σ","S"],["Τ","T"],["Υ","Y"],["Φ","F"],["Χ","X"],["Ψ","PS"],["Ω","O"],["Ά","A"],["Έ","E"],["Ί","I"],["Ό","O"],["Ύ","Y"],["Ή","I"],["Ώ","O"],["Ϊ","I"],["Ϋ","Y"],["ā","a"],["ē","e"],["ģ","g"],["ī","i"],["ķ","k"],["ļ","l"],["ņ","n"],["ū","u"],["Ā","A"],["Ē","E"],["Ģ","G"],["Ī","I"],["Ķ","K"],["Ļ","L"],["Ņ","N"],["Ū","U"],["č","c"],["š","s"],["ž","z"],["Č","C"],["Š","S"],["Ž","Z"],["ą","a"],["č","c"],["ę","e"],["ė","e"],["į","i"],["š","s"],["ų","u"],["ū","u"],["ž","z"],["Ą","A"],["Č","C"],["Ę","E"],["Ė","E"],["Į","I"],["Š","S"],["Ų","U"],["Ū","U"],["Ќ","Kj"],["ќ","kj"],["Љ","Lj"],["љ","lj"],["Њ","Nj"],["њ","nj"],["Тс","Ts"],["тс","ts"],["ą","a"],["ć","c"],["ę","e"],["ł","l"],["ń","n"],["ś","s"],["ź","z"],["ż","z"],["Ą","A"],["Ć","C"],["Ę","E"],["Ł","L"],["Ń","N"],["Ś","S"],["Ź","Z"],["Ż","Z"],["Є","Ye"],["І","I"],["Ї","Yi"],["Ґ","G"],["є","ye"],["і","i"],["ї","yi"],["ґ","g"],["IJ","IJ"],["ij","ij"],["¢","c"],["¥","Y"],["߿","b"],["৳","t"],["૱","Bo"],["฿","B"],["₠","CE"],["₡","C"],["₢","Cr"],["₣","F"],["₥","m"],["₦","N"],["₧","Pt"],["₨","Rs"],["₩","W"],["₫","s"],["€","E"],["₭","K"],["₮","T"],["₯","Dp"],["₰","S"],["₱","P"],["₲","G"],["₳","A"],["₴","S"],["₵","C"],["₶","tt"],["₷","S"],["₸","T"],["₹","R"],["₺","L"],["₽","P"],["₿","B"],["﹩","$"],["¢","c"],["¥","Y"],["₩","W"],["𝐀","A"],["𝐁","B"],["𝐂","C"],["𝐃","D"],["𝐄","E"],["𝐅","F"],["𝐆","G"],["𝐇","H"],["𝐈","I"],["𝐉","J"],["𝐊","K"],["𝐋","L"],["𝐌","M"],["𝐍","N"],["𝐎","O"],["𝐏","P"],["𝐐","Q"],["𝐑","R"],["𝐒","S"],["𝐓","T"],["𝐔","U"],["𝐕","V"],["𝐖","W"],["𝐗","X"],["𝐘","Y"],["𝐙","Z"],["𝐚","a"],["𝐛","b"],["𝐜","c"],["𝐝","d"],["𝐞","e"],["𝐟","f"],["𝐠","g"],["𝐡","h"],["𝐢","i"],["𝐣","j"],["𝐤","k"],["𝐥","l"],["𝐦","m"],["𝐧","n"],["𝐨","o"],["𝐩","p"],["𝐪","q"],["𝐫","r"],["𝐬","s"],["𝐭","t"],["𝐮","u"],["𝐯","v"],["𝐰","w"],["𝐱","x"],["𝐲","y"],["𝐳","z"],["𝐴","A"],["𝐵","B"],["𝐶","C"],["𝐷","D"],["𝐸","E"],["𝐹","F"],["𝐺","G"],["𝐻","H"],["𝐼","I"],["𝐽","J"],["𝐾","K"],["𝐿","L"],["𝑀","M"],["𝑁","N"],["𝑂","O"],["𝑃","P"],["𝑄","Q"],["𝑅","R"],["𝑆","S"],["𝑇","T"],["𝑈","U"],["𝑉","V"],["𝑊","W"],["𝑋","X"],["𝑌","Y"],["𝑍","Z"],["𝑎","a"],["𝑏","b"],["𝑐","c"],["𝑑","d"],["𝑒","e"],["𝑓","f"],["𝑔","g"],["𝑖","i"],["𝑗","j"],["𝑘","k"],["𝑙","l"],["𝑚","m"],["𝑛","n"],["𝑜","o"],["𝑝","p"],["𝑞","q"],["𝑟","r"],["𝑠","s"],["𝑡","t"],["𝑢","u"],["𝑣","v"],["𝑤","w"],["𝑥","x"],["𝑦","y"],["𝑧","z"],["𝑨","A"],["𝑩","B"],["𝑪","C"],["𝑫","D"],["𝑬","E"],["𝑭","F"],["𝑮","G"],["𝑯","H"],["𝑰","I"],["𝑱","J"],["𝑲","K"],["𝑳","L"],["𝑴","M"],["𝑵","N"],["𝑶","O"],["𝑷","P"],["𝑸","Q"],["𝑹","R"],["𝑺","S"],["𝑻","T"],["𝑼","U"],["𝑽","V"],["𝑾","W"],["𝑿","X"],["𝒀","Y"],["𝒁","Z"],["𝒂","a"],["𝒃","b"],["𝒄","c"],["𝒅","d"],["𝒆","e"],["𝒇","f"],["𝒈","g"],["𝒉","h"],["𝒊","i"],["𝒋","j"],["𝒌","k"],["𝒍","l"],["𝒎","m"],["𝒏","n"],["𝒐","o"],["𝒑","p"],["𝒒","q"],["𝒓","r"],["𝒔","s"],["𝒕","t"],["𝒖","u"],["𝒗","v"],["𝒘","w"],["𝒙","x"],["𝒚","y"],["𝒛","z"],["𝒜","A"],["𝒞","C"],["𝒟","D"],["𝒢","g"],["𝒥","J"],["𝒦","K"],["𝒩","N"],["𝒪","O"],["𝒫","P"],["𝒬","Q"],["𝒮","S"],["𝒯","T"],["𝒰","U"],["𝒱","V"],["𝒲","W"],["𝒳","X"],["𝒴","Y"],["𝒵","Z"],["𝒶","a"],["𝒷","b"],["𝒸","c"],["𝒹","d"],["𝒻","f"],["𝒽","h"],["𝒾","i"],["𝒿","j"],["𝓀","h"],["𝓁","l"],["𝓂","m"],["𝓃","n"],["𝓅","p"],["𝓆","q"],["𝓇","r"],["𝓈","s"],["𝓉","t"],["𝓊","u"],["𝓋","v"],["𝓌","w"],["𝓍","x"],["𝓎","y"],["𝓏","z"],["𝓐","A"],["𝓑","B"],["𝓒","C"],["𝓓","D"],["𝓔","E"],["𝓕","F"],["𝓖","G"],["𝓗","H"],["𝓘","I"],["𝓙","J"],["𝓚","K"],["𝓛","L"],["𝓜","M"],["𝓝","N"],["𝓞","O"],["𝓟","P"],["𝓠","Q"],["𝓡","R"],["𝓢","S"],["𝓣","T"],["𝓤","U"],["𝓥","V"],["𝓦","W"],["𝓧","X"],["𝓨","Y"],["𝓩","Z"],["𝓪","a"],["𝓫","b"],["𝓬","c"],["𝓭","d"],["𝓮","e"],["𝓯","f"],["𝓰","g"],["𝓱","h"],["𝓲","i"],["𝓳","j"],["𝓴","k"],["𝓵","l"],["𝓶","m"],["𝓷","n"],["𝓸","o"],["𝓹","p"],["𝓺","q"],["𝓻","r"],["𝓼","s"],["𝓽","t"],["𝓾","u"],["𝓿","v"],["𝔀","w"],["𝔁","x"],["𝔂","y"],["𝔃","z"],["𝔄","A"],["𝔅","B"],["𝔇","D"],["𝔈","E"],["𝔉","F"],["𝔊","G"],["𝔍","J"],["𝔎","K"],["𝔏","L"],["𝔐","M"],["𝔑","N"],["𝔒","O"],["𝔓","P"],["𝔔","Q"],["𝔖","S"],["𝔗","T"],["𝔘","U"],["𝔙","V"],["𝔚","W"],["𝔛","X"],["𝔜","Y"],["𝔞","a"],["𝔟","b"],["𝔠","c"],["𝔡","d"],["𝔢","e"],["𝔣","f"],["𝔤","g"],["𝔥","h"],["𝔦","i"],["𝔧","j"],["𝔨","k"],["𝔩","l"],["𝔪","m"],["𝔫","n"],["𝔬","o"],["𝔭","p"],["𝔮","q"],["𝔯","r"],["𝔰","s"],["𝔱","t"],["𝔲","u"],["𝔳","v"],["𝔴","w"],["𝔵","x"],["𝔶","y"],["𝔷","z"],["𝔸","A"],["𝔹","B"],["𝔻","D"],["𝔼","E"],["𝔽","F"],["𝔾","G"],["𝕀","I"],["𝕁","J"],["𝕂","K"],["𝕃","L"],["𝕄","M"],["𝕆","N"],["𝕊","S"],["𝕋","T"],["𝕌","U"],["𝕍","V"],["𝕎","W"],["𝕏","X"],["𝕐","Y"],["𝕒","a"],["𝕓","b"],["𝕔","c"],["𝕕","d"],["𝕖","e"],["𝕗","f"],["𝕘","g"],["𝕙","h"],["𝕚","i"],["𝕛","j"],["𝕜","k"],["𝕝","l"],["𝕞","m"],["𝕟","n"],["𝕠","o"],["𝕡","p"],["𝕢","q"],["𝕣","r"],["𝕤","s"],["𝕥","t"],["𝕦","u"],["𝕧","v"],["𝕨","w"],["𝕩","x"],["𝕪","y"],["𝕫","z"],["𝕬","A"],["𝕭","B"],["𝕮","C"],["𝕯","D"],["𝕰","E"],["𝕱","F"],["𝕲","G"],["𝕳","H"],["𝕴","I"],["𝕵","J"],["𝕶","K"],["𝕷","L"],["𝕸","M"],["𝕹","N"],["𝕺","O"],["𝕻","P"],["𝕼","Q"],["𝕽","R"],["𝕾","S"],["𝕿","T"],["𝖀","U"],["𝖁","V"],["𝖂","W"],["𝖃","X"],["𝖄","Y"],["𝖅","Z"],["𝖆","a"],["𝖇","b"],["𝖈","c"],["𝖉","d"],["𝖊","e"],["𝖋","f"],["𝖌","g"],["𝖍","h"],["𝖎","i"],["𝖏","j"],["𝖐","k"],["𝖑","l"],["𝖒","m"],["𝖓","n"],["𝖔","o"],["𝖕","p"],["𝖖","q"],["𝖗","r"],["𝖘","s"],["𝖙","t"],["𝖚","u"],["𝖛","v"],["𝖜","w"],["𝖝","x"],["𝖞","y"],["𝖟","z"],["𝖠","A"],["𝖡","B"],["𝖢","C"],["𝖣","D"],["𝖤","E"],["𝖥","F"],["𝖦","G"],["𝖧","H"],["𝖨","I"],["𝖩","J"],["𝖪","K"],["𝖫","L"],["𝖬","M"],["𝖭","N"],["𝖮","O"],["𝖯","P"],["𝖰","Q"],["𝖱","R"],["𝖲","S"],["𝖳","T"],["𝖴","U"],["𝖵","V"],["𝖶","W"],["𝖷","X"],["𝖸","Y"],["𝖹","Z"],["𝖺","a"],["𝖻","b"],["𝖼","c"],["𝖽","d"],["𝖾","e"],["𝖿","f"],["𝗀","g"],["𝗁","h"],["𝗂","i"],["𝗃","j"],["𝗄","k"],["𝗅","l"],["𝗆","m"],["𝗇","n"],["𝗈","o"],["𝗉","p"],["𝗊","q"],["𝗋","r"],["𝗌","s"],["𝗍","t"],["𝗎","u"],["𝗏","v"],["𝗐","w"],["𝗑","x"],["𝗒","y"],["𝗓","z"],["𝗔","A"],["𝗕","B"],["𝗖","C"],["𝗗","D"],["𝗘","E"],["𝗙","F"],["𝗚","G"],["𝗛","H"],["𝗜","I"],["𝗝","J"],["𝗞","K"],["𝗟","L"],["𝗠","M"],["𝗡","N"],["𝗢","O"],["𝗣","P"],["𝗤","Q"],["𝗥","R"],["𝗦","S"],["𝗧","T"],["𝗨","U"],["𝗩","V"],["𝗪","W"],["𝗫","X"],["𝗬","Y"],["𝗭","Z"],["𝗮","a"],["𝗯","b"],["𝗰","c"],["𝗱","d"],["𝗲","e"],["𝗳","f"],["𝗴","g"],["𝗵","h"],["𝗶","i"],["𝗷","j"],["𝗸","k"],["𝗹","l"],["𝗺","m"],["𝗻","n"],["𝗼","o"],["𝗽","p"],["𝗾","q"],["𝗿","r"],["𝘀","s"],["𝘁","t"],["𝘂","u"],["𝘃","v"],["𝘄","w"],["𝘅","x"],["𝘆","y"],["𝘇","z"],["𝘈","A"],["𝘉","B"],["𝘊","C"],["𝘋","D"],["𝘌","E"],["𝘍","F"],["𝘎","G"],["𝘏","H"],["𝘐","I"],["𝘑","J"],["𝘒","K"],["𝘓","L"],["𝘔","M"],["𝘕","N"],["𝘖","O"],["𝘗","P"],["𝘘","Q"],["𝘙","R"],["𝘚","S"],["𝘛","T"],["𝘜","U"],["𝘝","V"],["𝘞","W"],["𝘟","X"],["𝘠","Y"],["𝘡","Z"],["𝘢","a"],["𝘣","b"],["𝘤","c"],["𝘥","d"],["𝘦","e"],["𝘧","f"],["𝘨","g"],["𝘩","h"],["𝘪","i"],["𝘫","j"],["𝘬","k"],["𝘭","l"],["𝘮","m"],["𝘯","n"],["𝘰","o"],["𝘱","p"],["𝘲","q"],["𝘳","r"],["𝘴","s"],["𝘵","t"],["𝘶","u"],["𝘷","v"],["𝘸","w"],["𝘹","x"],["𝘺","y"],["𝘻","z"],["𝘼","A"],["𝘽","B"],["𝘾","C"],["𝘿","D"],["𝙀","E"],["𝙁","F"],["𝙂","G"],["𝙃","H"],["𝙄","I"],["𝙅","J"],["𝙆","K"],["𝙇","L"],["𝙈","M"],["𝙉","N"],["𝙊","O"],["𝙋","P"],["𝙌","Q"],["𝙍","R"],["𝙎","S"],["𝙏","T"],["𝙐","U"],["𝙑","V"],["𝙒","W"],["𝙓","X"],["𝙔","Y"],["𝙕","Z"],["𝙖","a"],["𝙗","b"],["𝙘","c"],["𝙙","d"],["𝙚","e"],["𝙛","f"],["𝙜","g"],["𝙝","h"],["𝙞","i"],["𝙟","j"],["𝙠","k"],["𝙡","l"],["𝙢","m"],["𝙣","n"],["𝙤","o"],["𝙥","p"],["𝙦","q"],["𝙧","r"],["𝙨","s"],["𝙩","t"],["𝙪","u"],["𝙫","v"],["𝙬","w"],["𝙭","x"],["𝙮","y"],["𝙯","z"],["𝙰","A"],["𝙱","B"],["𝙲","C"],["𝙳","D"],["𝙴","E"],["𝙵","F"],["𝙶","G"],["𝙷","H"],["𝙸","I"],["𝙹","J"],["𝙺","K"],["𝙻","L"],["𝙼","M"],["𝙽","N"],["𝙾","O"],["𝙿","P"],["𝚀","Q"],["𝚁","R"],["𝚂","S"],["𝚃","T"],["𝚄","U"],["𝚅","V"],["𝚆","W"],["𝚇","X"],["𝚈","Y"],["𝚉","Z"],["𝚊","a"],["𝚋","b"],["𝚌","c"],["𝚍","d"],["𝚎","e"],["𝚏","f"],["𝚐","g"],["𝚑","h"],["𝚒","i"],["𝚓","j"],["𝚔","k"],["𝚕","l"],["𝚖","m"],["𝚗","n"],["𝚘","o"],["𝚙","p"],["𝚚","q"],["𝚛","r"],["𝚜","s"],["𝚝","t"],["𝚞","u"],["𝚟","v"],["𝚠","w"],["𝚡","x"],["𝚢","y"],["𝚣","z"],["𝚤","l"],["𝚥","j"],["𝛢","A"],["𝛣","B"],["𝛤","G"],["𝛥","D"],["𝛦","E"],["𝛧","Z"],["𝛨","I"],["𝛩","TH"],["𝛪","I"],["𝛫","K"],["𝛬","L"],["𝛭","M"],["𝛮","N"],["𝛯","KS"],["𝛰","O"],["𝛱","P"],["𝛲","R"],["𝛳","TH"],["𝛴","S"],["𝛵","T"],["𝛶","Y"],["𝛷","F"],["𝛸","x"],["𝛹","PS"],["𝛺","O"],["𝛻","D"],["𝛼","a"],["𝛽","b"],["𝛾","g"],["𝛿","d"],["𝜀","e"],["𝜁","z"],["𝜂","i"],["𝜃","th"],["𝜄","i"],["𝜅","k"],["𝜆","l"],["𝜇","m"],["𝜈","n"],["𝜉","ks"],["𝜊","o"],["𝜋","p"],["𝜌","r"],["𝜍","s"],["𝜎","s"],["𝜏","t"],["𝜐","y"],["𝜑","f"],["𝜒","x"],["𝜓","ps"],["𝜔","o"],["𝜕","d"],["𝜖","E"],["𝜗","TH"],["𝜘","K"],["𝜙","f"],["𝜚","r"],["𝜛","p"],["𝜜","A"],["𝜝","V"],["𝜞","G"],["𝜟","D"],["𝜠","E"],["𝜡","Z"],["𝜢","I"],["𝜣","TH"],["𝜤","I"],["𝜥","K"],["𝜦","L"],["𝜧","M"],["𝜨","N"],["𝜩","KS"],["𝜪","O"],["𝜫","P"],["𝜬","S"],["𝜭","TH"],["𝜮","S"],["𝜯","T"],["𝜰","Y"],["𝜱","F"],["𝜲","X"],["𝜳","PS"],["𝜴","O"],["𝜵","D"],["𝜶","a"],["𝜷","v"],["𝜸","g"],["𝜹","d"],["𝜺","e"],["𝜻","z"],["𝜼","i"],["𝜽","th"],["𝜾","i"],["𝜿","k"],["𝝀","l"],["𝝁","m"],["𝝂","n"],["𝝃","ks"],["𝝄","o"],["𝝅","p"],["𝝆","r"],["𝝇","s"],["𝝈","s"],["𝝉","t"],["𝝊","y"],["𝝋","f"],["𝝌","x"],["𝝍","ps"],["𝝎","o"],["𝝏","a"],["𝝐","e"],["𝝑","i"],["𝝒","k"],["𝝓","f"],["𝝔","r"],["𝝕","p"],["𝝖","A"],["𝝗","B"],["𝝘","G"],["𝝙","D"],["𝝚","E"],["𝝛","Z"],["𝝜","I"],["𝝝","TH"],["𝝞","I"],["𝝟","K"],["𝝠","L"],["𝝡","M"],["𝝢","N"],["𝝣","KS"],["𝝤","O"],["𝝥","P"],["𝝦","R"],["𝝧","TH"],["𝝨","S"],["𝝩","T"],["𝝪","Y"],["𝝫","F"],["𝝬","X"],["𝝭","PS"],["𝝮","O"],["𝝯","D"],["𝝰","a"],["𝝱","v"],["𝝲","g"],["𝝳","d"],["𝝴","e"],["𝝵","z"],["𝝶","i"],["𝝷","th"],["𝝸","i"],["𝝹","k"],["𝝺","l"],["𝝻","m"],["𝝼","n"],["𝝽","ks"],["𝝾","o"],["𝝿","p"],["𝞀","r"],["𝞁","s"],["𝞂","s"],["𝞃","t"],["𝞄","y"],["𝞅","f"],["𝞆","x"],["𝞇","ps"],["𝞈","o"],["𝞉","a"],["𝞊","e"],["𝞋","i"],["𝞌","k"],["𝞍","f"],["𝞎","r"],["𝞏","p"],["𝞐","A"],["𝞑","V"],["𝞒","G"],["𝞓","D"],["𝞔","E"],["𝞕","Z"],["𝞖","I"],["𝞗","TH"],["𝞘","I"],["𝞙","K"],["𝞚","L"],["𝞛","M"],["𝞜","N"],["𝞝","KS"],["𝞞","O"],["𝞟","P"],["𝞠","S"],["𝞡","TH"],["𝞢","S"],["𝞣","T"],["𝞤","Y"],["𝞥","F"],["𝞦","X"],["𝞧","PS"],["𝞨","O"],["𝞩","D"],["𝞪","av"],["𝞫","g"],["𝞬","d"],["𝞭","e"],["𝞮","z"],["𝞯","i"],["𝞰","i"],["𝞱","th"],["𝞲","i"],["𝞳","k"],["𝞴","l"],["𝞵","m"],["𝞶","n"],["𝞷","ks"],["𝞸","o"],["𝞹","p"],["𝞺","r"],["𝞻","s"],["𝞼","s"],["𝞽","t"],["𝞾","y"],["𝞿","f"],["𝟀","x"],["𝟁","ps"],["𝟂","o"],["𝟃","a"],["𝟄","e"],["𝟅","i"],["𝟆","k"],["𝟇","f"],["𝟈","r"],["𝟉","p"],["𝟊","F"],["𝟋","f"],["⒜","(a)"],["⒝","(b)"],["⒞","(c)"],["⒟","(d)"],["⒠","(e)"],["⒡","(f)"],["⒢","(g)"],["⒣","(h)"],["⒤","(i)"],["⒥","(j)"],["⒦","(k)"],["⒧","(l)"],["⒨","(m)"],["⒩","(n)"],["⒪","(o)"],["⒫","(p)"],["⒬","(q)"],["⒭","(r)"],["⒮","(s)"],["⒯","(t)"],["⒰","(u)"],["⒱","(v)"],["⒲","(w)"],["⒳","(x)"],["⒴","(y)"],["⒵","(z)"],["Ⓐ","(A)"],["Ⓑ","(B)"],["Ⓒ","(C)"],["Ⓓ","(D)"],["Ⓔ","(E)"],["Ⓕ","(F)"],["Ⓖ","(G)"],["Ⓗ","(H)"],["Ⓘ","(I)"],["Ⓙ","(J)"],["Ⓚ","(K)"],["Ⓛ","(L)"],["Ⓝ","(N)"],["Ⓞ","(O)"],["Ⓟ","(P)"],["Ⓠ","(Q)"],["Ⓡ","(R)"],["Ⓢ","(S)"],["Ⓣ","(T)"],["Ⓤ","(U)"],["Ⓥ","(V)"],["Ⓦ","(W)"],["Ⓧ","(X)"],["Ⓨ","(Y)"],["Ⓩ","(Z)"],["ⓐ","(a)"],["ⓑ","(b)"],["ⓒ","(b)"],["ⓓ","(c)"],["ⓔ","(e)"],["ⓕ","(f)"],["ⓖ","(g)"],["ⓗ","(h)"],["ⓘ","(i)"],["ⓙ","(j)"],["ⓚ","(k)"],["ⓛ","(l)"],["ⓜ","(m)"],["ⓝ","(n)"],["ⓞ","(o)"],["ⓟ","(p)"],["ⓠ","(q)"],["ⓡ","(r)"],["ⓢ","(s)"],["ⓣ","(t)"],["ⓤ","(u)"],["ⓥ","(v)"],["ⓦ","(w)"],["ⓧ","(x)"],["ⓨ","(y)"],["ⓩ","(z)"],["Ċ","C"],["ċ","c"],["Ġ","G"],["ġ","g"],["Ħ","H"],["ħ","h"],["Ż","Z"],["ż","z"],["𝟎","0"],["𝟏","1"],["𝟐","2"],["𝟑","3"],["𝟒","4"],["𝟓","5"],["𝟔","6"],["𝟕","7"],["𝟖","8"],["𝟗","9"],["𝟘","0"],["𝟙","1"],["𝟚","2"],["𝟛","3"],["𝟜","4"],["𝟝","5"],["𝟞","6"],["𝟟","7"],["𝟠","8"],["𝟡","9"],["𝟢","0"],["𝟣","1"],["𝟤","2"],["𝟥","3"],["𝟦","4"],["𝟧","5"],["𝟨","6"],["𝟩","7"],["𝟪","8"],["𝟫","9"],["𝟬","0"],["𝟭","1"],["𝟮","2"],["𝟯","3"],["𝟰","4"],["𝟱","5"],["𝟲","6"],["𝟳","7"],["𝟴","8"],["𝟵","9"],["𝟶","0"],["𝟷","1"],["𝟸","2"],["𝟹","3"],["𝟺","4"],["𝟻","5"],["𝟼","6"],["𝟽","7"],["𝟾","8"],["𝟿","9"],["①","1"],["②","2"],["③","3"],["④","4"],["⑤","5"],["⑥","6"],["⑦","7"],["⑧","8"],["⑨","9"],["⑩","10"],["⑪","11"],["⑫","12"],["⑬","13"],["⑭","14"],["⑮","15"],["⑯","16"],["⑰","17"],["⑱","18"],["⑲","19"],["⑳","20"],["⑴","1"],["⑵","2"],["⑶","3"],["⑷","4"],["⑸","5"],["⑹","6"],["⑺","7"],["⑻","8"],["⑼","9"],["⑽","10"],["⑾","11"],["⑿","12"],["⒀","13"],["⒁","14"],["⒂","15"],["⒃","16"],["⒄","17"],["⒅","18"],["⒆","19"],["⒇","20"],["⒈","1."],["⒉","2."],["⒊","3."],["⒋","4."],["⒌","5."],["⒍","6."],["⒎","7."],["⒏","8."],["⒐","9."],["⒑","10."],["⒒","11."],["⒓","12."],["⒔","13."],["⒕","14."],["⒖","15."],["⒗","16."],["⒘","17."],["⒙","18."],["⒚","19."],["⒛","20."],["⓪","0"],["⓫","11"],["⓬","12"],["⓭","13"],["⓮","14"],["⓯","15"],["⓰","16"],["⓱","17"],["⓲","18"],["⓳","19"],["⓴","20"],["⓵","1"],["⓶","2"],["⓷","3"],["⓸","4"],["⓹","5"],["⓺","6"],["⓻","7"],["⓼","8"],["⓽","9"],["⓾","10"],["⓿","0"],["🙰","&"],["🙱","&"],["🙲","&"],["🙳","&"],["🙴","&"],["🙵","&"],["🙶",'"'],["🙷",'"'],["🙸",'"'],["‽","?!"],["🙹","?!"],["🙺","?!"],["🙻","?!"],["🙼","/"],["🙽","\\"],["🜇","AR"],["🜈","V"],["🜉","V"],["🜆","VR"],["🜅","VF"],["🜩","2"],["🜪","5"],["🝡","f"],["🝢","W"],["🝣","U"],["🝧","V"],["🝨","T"],["🝪","V"],["🝫","MB"],["🝬","VB"],["🝲","3B"],["🝳","3B"],["💯","100"],["🔙","BACK"],["🔚","END"],["🔛","ON!"],["🔜","SOON"],["🔝","TOP"],["🔞","18"],["🔤","abc"],["🔠","ABCD"],["🔡","abcd"],["🔢","1234"],["🔣","T&@%"],["#️⃣","#"],["*️⃣","*"],["0️⃣","0"],["1️⃣","1"],["2️⃣","2"],["3️⃣","3"],["4️⃣","4"],["5️⃣","5"],["6️⃣","6"],["7️⃣","7"],["8️⃣","8"],["9️⃣","9"],["🔟","10"],["🅰️","A"],["🅱️","B"],["🆎","AB"],["🆑","CL"],["🅾️","O"],["🅿","P"],["🆘","SOS"],["🅲","C"],["🅳","D"],["🅴","E"],["🅵","F"],["🅶","G"],["🅷","H"],["🅸","I"],["🅹","J"],["🅺","K"],["🅻","L"],["🅼","M"],["🅽","N"],["🆀","Q"],["🆁","R"],["🆂","S"],["🆃","T"],["🆄","U"],["🆅","V"],["🆆","W"],["🆇","X"],["🆈","Y"],["🆉","Z"]];const d=[["&"," and "],["🦄"," unicorn "],["♥"," love "]];function h(e,t){if("string"!=typeof e)throw new TypeError(`Expected a string, got \`${typeof e}\``);const n=(t={separator:"-",lowercase:!0,decamelize:!0,customReplacements:[],preserveLeadingUnderscore:!1,preserveTrailingDash:!1,preserveCharacters:[],...t}).preserveLeadingUnderscore&&e.startsWith("_"),r=t.preserveTrailingDash&&e.endsWith("-");e=function(e,t){if("string"!=typeof e)throw new TypeError(`Expected a string, got \`${typeof e}\``);t={customReplacements:[],...t};const n=new Map([...u,...t.customReplacements]);return(e=((e,t)=>{for(const[n,r]of t)e=e.replace(new RegExp((0,c.A)(n),"g"),r);return e})(e=e.normalize(),n)).normalize("NFD").replace(/[\^`\xA8\xAF\xB4\xB7\xB8\u02B0-\u034E\u0350-\u0357\u035D-\u0362\u0374\u0375\u037A\u0384\u0385\u0483-\u0487\u0559\u0591-\u05A1\u05A3-\u05BD\u05BF\u05C1\u05C2\u05C4\u064B-\u0652\u0657\u0658\u06DF\u06E0\u06E5\u06E6\u06EA-\u06EC\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F5\u0818\u0819\u0898-\u089F\u08C9-\u08D2\u08E3-\u08FE\u093C\u094D\u0951-\u0954\u0971\u09BC\u09CD\u0A3C\u0A4D\u0ABC\u0ACD\u0AFD-\u0AFF\u0B3C\u0B4D\u0B55\u0BCD\u0C3C\u0C4D\u0CBC\u0CCD\u0D3B\u0D3C\u0D4D\u0DCA\u0E3A\u0E47-\u0E4C\u0E4E\u0EBA\u0EC8-\u0ECC\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F82-\u0F84\u0F86\u0F87\u0FC6\u1037\u1039\u103A\u1063\u1064\u1069-\u106D\u1087-\u108D\u108F\u109A\u109B\u135D-\u135F\u1714\u1715\u1734\u17C9-\u17D3\u17DD\u1939-\u193B\u1A60\u1A75-\u1A7C\u1A7F\u1AB0-\u1ABE\u1AC1-\u1ACB\u1B34\u1B44\u1B6B-\u1B73\u1BAA\u1BAB\u1BE6\u1BF2\u1BF3\u1C36\u1C37\u1C78-\u1C7D\u1CD0-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1D2C-\u1D6A\u1DC4-\u1DCF\u1DF5-\u1DFF\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2CEF-\u2CF1\u2E2F\u302A-\u302F\u3099-\u309C\u30FC\uA66F\uA67C\uA67D\uA67F\uA69C\uA69D\uA6F0\uA6F1\uA700-\uA721\uA788-\uA78A\uA7F8\uA7F9\uA806\uA82C\uA8C4\uA8E0-\uA8F1\uA92B-\uA92E\uA953\uA9B3\uA9C0\uA9E5\uAA7B-\uAA7D\uAABF-\uAAC2\uAAF6\uAB5B-\uAB5F\uAB69-\uAB6B\uABEC\uABED\uFB1E\uFE20-\uFE2F\uFF3E\uFF40\uFF70\uFF9E\uFF9F\uFFE3\u{102E0}\u{10780}-\u{10785}\u{10787}-\u{107B0}\u{107B2}-\u{107BA}\u{10A38}-\u{10A3A}\u{10A3F}\u{10AE5}\u{10AE6}\u{10D22}-\u{10D27}\u{10D4E}\u{10D69}-\u{10D6D}\u{10EFD}-\u{10EFF}\u{10F46}-\u{10F50}\u{10F82}-\u{10F85}\u{11046}\u{11070}\u{110B9}\u{110BA}\u{11133}\u{11134}\u{11173}\u{111C0}\u{111CA}-\u{111CC}\u{11235}\u{11236}\u{112E9}\u{112EA}\u{1133B}\u{1133C}\u{1134D}\u{11366}-\u{1136C}\u{11370}-\u{11374}\u{113CE}-\u{113D0}\u{113D2}\u{113D3}\u{113E1}\u{113E2}\u{11442}\u{11446}\u{114C2}\u{114C3}\u{115BF}\u{115C0}\u{1163F}\u{116B6}\u{116B7}\u{1172B}\u{11839}\u{1183A}\u{1193D}\u{1193E}\u{11943}\u{119E0}\u{11A34}\u{11A47}\u{11A99}\u{11C3F}\u{11D42}\u{11D44}\u{11D45}\u{11D97}\u{11F41}\u{11F42}\u{11F5A}\u{13447}-\u{13455}\u{1612F}\u{16AF0}-\u{16AF4}\u{16B30}-\u{16B36}\u{16D6B}\u{16D6C}\u{16F8F}-\u{16F9F}\u{16FF0}\u{16FF1}\u{1AFF0}-\u{1AFF3}\u{1AFF5}-\u{1AFFB}\u{1AFFD}\u{1AFFE}\u{1CF00}-\u{1CF2D}\u{1CF30}-\u{1CF46}\u{1D167}-\u{1D169}\u{1D16D}-\u{1D172}\u{1D17B}-\u{1D182}\u{1D185}-\u{1D18B}\u{1D1AA}-\u{1D1AD}\u{1E030}-\u{1E06D}\u{1E130}-\u{1E136}\u{1E2AE}\u{1E2EC}-\u{1E2EF}\u{1E5EE}\u{1E5EF}\u{1E8D0}-\u{1E8D6}\u{1E944}-\u{1E946}\u{1E948}-\u{1E94A}]/gu,"").normalize()}(e,{customReplacements:new Map([...d,...t.customReplacements])}),t.decamelize&&(e=(e=>e.replace(/([A-Z]{2,})(\d+)/g,"$1 $2").replace(/([a-z\d]+)([A-Z]{2,})/g,"$1 $2").replace(/([a-z\d])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-rt-z\d]+)/g,"$1 $2"))(e));const o=(e=>{let t="a-z\\d";if(t+=e.lowercase?"":"A-Z",e.preserveCharacters.length>0)for(const n of e.preserveCharacters){if(n===e.separator)throw new Error(`The separator character \`${e.separator}\` cannot be included in preserved characters: ${e.preserveCharacters}`);t+=(0,c.A)(n)}return new RegExp(`[^${t}]+`,"g")})(t);return t.lowercase&&(e=e.toLowerCase()),e=(e=(e=e.replace(/([a-zA-Z\d]+)'([ts])(\s|$)/g,"$1$2$3")).replace(o,t.separator)).replace(/\\/g,""),t.separator&&(e=((e,t)=>{const n=(0,c.A)(t);return e.replace(new RegExp(`${n}{2,}`,"g"),t).replace(new RegExp(`^${n}|${n}$`,"g"),"")})(e,t.separator)),n&&(e=`_${e}`),r&&(e=`${e}-`),e}var p=n(1570),f=n(4254),m=n(1329);var g=n(3686),y=n(6641);const v=function(e,t,n,r){"function"==typeof t&&"function"!=typeof n&&(r=n,n=t,t=null),(0,y.VG)(e,t,(function(e,t){const r=t[t.length-1];return n(e,r?r.children.indexOf(e):null,r)}),r)},w={}.hasOwnProperty;function k(e){return String(e||"").toUpperCase()}function b(){return e=>{const t=function(e){const t=Object.create(null);if(!e||!e.type)throw new Error("mdast-util-definitions expected node");return function(e,t,n,r){"function"==typeof t&&"function"!=typeof n&&(r=n,n=t,t=null),(0,y.VG)(e,t,(function(e,t){const r=t[t.length-1];return n(e,r?r.children.indexOf(e):null,r)}),r)}(e,"definition",(e=>{const n=k(e.identifier);n&&!w.call(t,n)&&(t[n]=e)})),function(e){const n=k(e);return n&&w.call(t,n)?t[n]:null}}(e);!function(e,t,n,r){"function"==typeof t&&"function"!=typeof n&&(r=n,n=t,t=null),(0,y.VG)(e,t,(function(e,t){const r=t[t.length-1];return n(e,r?r.children.indexOf(e):null,r)}),r)}(e,((e,n,r)=>{if("definition"===e.type&&null!==r&&"number"==typeof n)return r.children.splice(n,1),[y._Z,n];if("imageReference"===e.type||"linkReference"===e.type){const o=t(e.identifier);if(o&&null!==r&&"number"==typeof n){const t="imageReference"===e.type?{type:"image",url:o.url,title:o.title,alt:e.alt}:{type:"link",url:o.url,title:o.title,children:e.children};return r.children[n]=t,[y._Z,n]}}}))}}const x=(e,t)=>{var n;if(!(t.childCount>=1&&"hardbreak"===(null==(n=t.lastChild)?void 0:n.type.name)))return void e.next(t.content);const r=[];t.content.forEach(((e,n,o)=>{o!==t.childCount-1&&r.push(e)})),e.next(s.FK.fromArray(r))},C=(e,t)=>(Object.assign(e,{meta:{package:"@milkdown/preset-commonmark",...t}}),e),S=(0,r.JY)("emphasis");C(S,{displayName:"Attr<emphasis>",group:"Emphasis"});const M=(0,r.hk)("emphasis",(e=>({inclusive:!1,parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:e=>"italic"===e}],toDOM:t=>["em",e.get(S.key)(t)],parseMarkdown:{match:e=>"emphasis"===e.type,runner:(e,t,n)=>{e.openMark(n),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"emphasis"===e.type.name,runner:(e,t)=>{e.withMark(t,"emphasis")}}})));C(M.mark,{displayName:"MarkSchema<emphasis>",group:"Emphasis"}),C(M.ctx,{displayName:"MarkSchemaCtx<emphasis>",group:"Emphasis"});const N=(0,r.yu)("ToggleEmphasis",(()=>()=>(0,i.wh)(M.type())));C(N,{displayName:"Command<toggleEmphasisCommand>",group:"Emphasis"});const O=(0,r.pq)("emphasisKeymap",{ToggleEmphasis:{shortcuts:"Mod-i",command:e=>{const t=e.get(o.MD);return()=>t.call(N.key)}}});C(O.ctx,{displayName:"KeymapCtx<emphasis>",group:"Emphasis"}),C(O.shortcuts,{displayName:"Keymap<emphasis>",group:"Emphasis"});const A=(0,r.JY)("strong");C(A,{displayName:"Attr<strong>",group:"Strong"});const E=(0,r.hk)("strong",(e=>({inclusive:!1,parseDOM:[{tag:"b"},{tag:"strong"},{style:"font-style",getAttrs:e=>"bold"===e}],toDOM:t=>["strong",e.get(A.key)(t)],parseMarkdown:{match:e=>"strong"===e.type,runner:(e,t,n)=>{e.openMark(n),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"strong"===e.type.name,runner:(e,t)=>{e.withMark(t,"strong")}}})));C(E.mark,{displayName:"MarkSchema<strong>",group:"Strong"}),C(E.ctx,{displayName:"MarkSchemaCtx<strong>",group:"Strong"});const D=(0,r.yu)("ToggleStrong",(()=>()=>(0,i.wh)(E.type())));C(D,{displayName:"Command<toggleStrongCommand>",group:"Strong"});const T=(0,r.pq)("strongKeymap",{ToggleBold:{shortcuts:["Mod-b"],command:e=>{const t=e.get(o.MD);return()=>t.call(D.key)}}});C(T.ctx,{displayName:"KeymapCtx<strong>",group:"Strong"}),C(T.shortcuts,{displayName:"Keymap<strong>",group:"Strong"});const F=(0,r.JY)("inlineCode");C(F,{displayName:"Attr<inlineCode>",group:"InlineCode"});const I=(0,r.hk)("inlineCode",(e=>({priority:100,code:!0,inclusive:!1,parseDOM:[{tag:"code"}],toDOM:t=>["code",e.get(F.key)(t)],parseMarkdown:{match:e=>"inlineCode"===e.type,runner:(e,t,n)=>{e.openMark(n),e.addText(t.value),e.closeMark(n)}},toMarkdown:{match:e=>"inlineCode"===e.type.name,runner:(e,t,n)=>{e.withMark(t,"inlineCode",n.text||"")}}})));C(I.mark,{displayName:"MarkSchema<inlineCode>",group:"InlineCode"}),C(I.ctx,{displayName:"MarkSchemaCtx<inlineCode>",group:"InlineCode"});const R=(0,r.yu)("ToggleInlineCode",(()=>()=>(e,t)=>{const{selection:n,tr:r}=e;if(n.empty)return!1;const{from:o,to:i}=n;return e.doc.rangeHasMark(o,i,I.type())?(null==t||t(r.removeMark(o,i,I.type())),!0):(Object.keys(e.schema.marks).filter((e=>e!==I.type.name)).map((t=>e.schema.marks[t])).forEach((e=>{r.removeMark(o,i,e)})),null==t||t(r.addMark(o,i,I.type().create())),!0)}));C(R,{displayName:"Command<toggleInlineCodeCommand>",group:"InlineCode"});const P=(0,r.pq)("inlineCodeKeymap",{ToggleInlineCode:{shortcuts:"Mod-e",command:e=>{const t=e.get(o.MD);return()=>t.call(R.key)}}});C(P.ctx,{displayName:"KeymapCtx<inlineCode>",group:"InlineCode"}),C(P.shortcuts,{displayName:"Keymap<inlineCode>",group:"InlineCode"});const B=(0,r.JY)("link");C(B,{displayName:"Attr<link>",group:"Link"});const L=(0,r.hk)("link",(e=>({attrs:{href:{},title:{default:null}},parseDOM:[{tag:"a[href]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw(0,a.Ik)(e);return{href:e.getAttribute("href"),title:e.getAttribute("title")}}}],toDOM:t=>["a",{...e.get(B.key)(t),...t.attrs}],parseMarkdown:{match:e=>"link"===e.type,runner:(e,t,n)=>{const r=t.url,o=t.title;e.openMark(n,{href:r,title:o}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"link"===e.type.name,runner:(e,t)=>{e.withMark(t,"link",void 0,{title:t.attrs.title,url:t.attrs.href})}}})));C(L.mark,{displayName:"MarkSchema<link>",group:"Link"});const z=(0,r.yu)("ToggleLink",(()=>(e={})=>(0,i.wh)(L.type(),e)));C(z,{displayName:"Command<toggleLinkCommand>",group:"Link"});const $=(0,r.yu)("UpdateLink",(()=>(e={})=>(t,n)=>{if(!n)return!1;let r,o=-1;const{selection:i}=t,{from:s,to:a}=i;if(t.doc.nodesBetween(s,s===a?a+1:a,((e,t)=>{if(L.type().isInSet(e.marks))return r=e,o=t,!1})),!r)return!1;const l=r.marks.find((({type:e})=>e===L.type()));if(!l)return!1;const c=o,u=o+r.nodeSize,{tr:d}=t,h=L.type().create({...l.attrs,...e});return!!h&&(n(d.removeMark(c,u,l).addMark(c,u,h).setSelection(new p.U3(d.selection.$anchor)).scrollIntoView()),!0)}));C($,{displayName:"Command<updateLinkCommand>",group:"Link"});const j=(0,r.dz)("doc",(()=>({content:"block+",parseMarkdown:{match:({type:e})=>"root"===e,runner:(e,t,n)=>{e.injectRoot(t,n)}},toMarkdown:{match:e=>"doc"===e.type.name,runner:(e,t)=>{e.openNode("root"),e.next(t.content)}}})));C(j,{displayName:"NodeSchema<doc>",group:"Doc"});const _=(0,r.YR)("paragraph");C(_,{displayName:"Attr<paragraph>",group:"Paragraph"});const V=(0,r.Yh)("paragraph",(e=>({content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:t=>["p",e.get(_.key)(t),0],parseMarkdown:{match:e=>"paragraph"===e.type,runner:(e,t,n)=>{e.openNode(n),t.children?e.next(t.children):e.addText(t.value||""),e.closeNode()}},toMarkdown:{match:e=>"paragraph"===e.type.name,runner:(e,t)=>{e.openNode("paragraph"),x(e,t),e.closeNode()}}})));C(V.node,{displayName:"NodeSchema<paragraph>",group:"Paragraph"}),C(V.ctx,{displayName:"NodeSchemaCtx<paragraph>",group:"Paragraph"});const W=(0,r.yu)("TurnIntoText",(()=>()=>(0,i.y_)(V.type())));C(W,{displayName:"Command<turnIntoTextCommand>",group:"Paragraph"});const H=(0,r.pq)("paragraphKeymap",{TurnIntoText:{shortcuts:"Mod-Alt-0",command:e=>{const t=e.get(o.MD);return()=>t.call(W.key)}}});C(H.ctx,{displayName:"KeymapCtx<paragraph>",group:"Paragraph"}),C(H.shortcuts,{displayName:"Keymap<paragraph>",group:"Paragraph"});const K=Array(6).fill(0).map(((e,t)=>t+1)),J=(0,r.Qx)((e=>h(e.textContent)),"headingIdGenerator");C(J,{displayName:"Ctx<HeadingIdGenerator>",group:"Heading"});const q=(0,r.YR)("heading");C(q,{displayName:"Attr<heading>",group:"Heading"});const U=(0,r.Yh)("heading",(e=>{const t=e.get(J.key);return{content:"inline*",group:"block",defining:!0,attrs:{id:{default:""},level:{default:1}},parseDOM:K.map((e=>({tag:`h${e}`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw(0,a.Ik)(t);return{level:e,id:t.id}}}))),toDOM:n=>[`h${n.attrs.level}`,{...e.get(q.key)(n),id:n.attrs.id||t(n)},0],parseMarkdown:{match:({type:e})=>"heading"===e,runner:(e,t,n)=>{const r=t.depth;e.openNode(n,{level:r}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>"heading"===e.type.name,runner:(e,t)=>{e.openNode("heading",void 0,{depth:t.attrs.level}),x(e,t),e.closeNode()}}}}));C(U.node,{displayName:"NodeSchema<heading>",group:"Heading"}),C(U.ctx,{displayName:"NodeSchemaCtx<heading>",group:"Heading"});const Y=(0,r.b_)((e=>(0,l.JJ)(/^(?<hashes>#+)\s$/,U.type(),(t=>{var n,r;const i=(null==(r=null==(n=t.groups)?void 0:n.hashes)?void 0:r.length)||0,s=e.get(o.kY),{$from:a}=s.state.selection,l=a.node();if("heading"===l.type.name){let e=Number(l.attrs.level)+Number(i);return e>6&&(e=6),{level:e}}return{level:i}}))));C(Y,{displayName:"InputRule<wrapInHeadingInputRule>",group:"Heading"});const Z=(0,r.yu)("WrapInHeading",(()=>e=>(e??(e=1),e<1?(0,i.y_)(V.type()):(0,i.y_)(U.type(),{level:e}))));C(Z,{displayName:"Command<wrapInHeadingCommand>",group:"Heading"});const G=(0,r.yu)("DowngradeHeading",(()=>()=>(e,t,n)=>{const{$from:r}=e.selection,o=r.node();if(o.type!==U.type()||!e.selection.empty||0!==r.parentOffset)return!1;const s=o.attrs.level-1;return s?(null==t||t(e.tr.setNodeMarkup(e.selection.$from.before(),void 0,{...o.attrs,level:s})),!0):(0,i.y_)(V.type())(e,t,n)}));C(G,{displayName:"Command<downgradeHeadingCommand>",group:"Heading"});const Q=(0,r.pq)("headingKeymap",{TurnIntoH1:{shortcuts:"Mod-Alt-1",command:e=>{const t=e.get(o.MD);return()=>t.call(Z.key,1)}},TurnIntoH2:{shortcuts:"Mod-Alt-2",command:e=>{const t=e.get(o.MD);return()=>t.call(Z.key,2)}},TurnIntoH3:{shortcuts:"Mod-Alt-3",command:e=>{const t=e.get(o.MD);return()=>t.call(Z.key,3)}},TurnIntoH4:{shortcuts:"Mod-Alt-4",command:e=>{const t=e.get(o.MD);return()=>t.call(Z.key,3)}},TurnIntoH5:{shortcuts:"Mod-Alt-5",command:e=>{const t=e.get(o.MD);return()=>t.call(Z.key,3)}},TurnIntoH6:{shortcuts:"Mod-Alt-6",command:e=>{const t=e.get(o.MD);return()=>t.call(Z.key,3)}},DowngradeHeading:{shortcuts:["Delete","Backspace"],command:e=>{const t=e.get(o.MD);return()=>t.call(G.key)}}});C(Q.ctx,{displayName:"KeymapCtx<heading>",group:"Heading"}),C(Q.shortcuts,{displayName:"Keymap<heading>",group:"Heading"});const X=(0,r.YR)("blockquote");C(X,{displayName:"Attr<blockquote>",group:"Blockquote"});const ee=(0,r.Yh)("blockquote",(e=>({content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:t=>["blockquote",e.get(X.key)(t),0],parseMarkdown:{match:({type:e})=>"blockquote"===e,runner:(e,t,n)=>{e.openNode(n).next(t.children).closeNode()}},toMarkdown:{match:e=>"blockquote"===e.type.name,runner:(e,t)=>{e.openNode("blockquote").next(t.content).closeNode()}}})));C(ee.node,{displayName:"NodeSchema<blockquote>",group:"Blockquote"}),C(ee.ctx,{displayName:"NodeSchemaCtx<blockquote>",group:"Blockquote"});const te=(0,r.b_)((()=>(0,l.tG)(/^\s*>\s$/,ee.type())));C(te,{displayName:"InputRule<wrapInBlockquoteInputRule>",group:"Blockquote"});const ne=(0,r.yu)("WrapInBlockquote",(()=>()=>(0,i.Im)(ee.type())));C(ne,{displayName:"Command<wrapInBlockquoteCommand>",group:"Blockquote"});const re=(0,r.pq)("blockquoteKeymap",{WrapInBlockquote:{shortcuts:"Mod-Shift-b",command:e=>{const t=e.get(o.MD);return()=>t.call(ne.key)}}});C(re.ctx,{displayName:"KeymapCtx<blockquote>",group:"Blockquote"}),C(re.shortcuts,{displayName:"Keymap<blockquote>",group:"Blockquote"});const oe=(0,r.YR)("codeBlock",(()=>({pre:{},code:{}})));C(oe,{displayName:"Attr<codeBlock>",group:"CodeBlock"});const ie=(0,r.Yh)("code_block",(e=>({content:"text*",group:"block",marks:"",defining:!0,code:!0,attrs:{language:{default:""}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:e=>{if(!(e instanceof HTMLElement))throw(0,a.Ik)(e);return{language:e.dataset.language}}}],toDOM:t=>{const n=e.get(oe.key)(t);return["pre",{...n.pre,"data-language":t.attrs.language},["code",n.code,0]]},parseMarkdown:{match:({type:e})=>"code"===e,runner:(e,t,n)=>{const r=t.lang,o=t.value;e.openNode(n,{language:r}),o&&e.addText(o),e.closeNode()}},toMarkdown:{match:e=>"code_block"===e.type.name,runner:(e,t)=>{var n;e.addNode("code",void 0,(null==(n=t.content.firstChild)?void 0:n.text)||"",{lang:t.attrs.language})}}})));C(ie.node,{displayName:"NodeSchema<codeBlock>",group:"CodeBlock"}),C(ie.ctx,{displayName:"NodeSchemaCtx<codeBlock>",group:"CodeBlock"});const se=(0,r.b_)((()=>(0,l.JJ)(/^```(?<language>[a-z]*)?[\s\n]$/,ie.type(),(e=>{var t;return{language:(null==(t=e.groups)?void 0:t.language)??""}}))));C(se,{displayName:"InputRule<createCodeBlockInputRule>",group:"CodeBlock"});const ae=(0,r.yu)("CreateCodeBlock",(()=>(e="")=>(0,i.y_)(ie.type(),{language:e})));C(ae,{displayName:"Command<createCodeBlockCommand>",group:"CodeBlock"}),C((0,r.yu)("UpdateCodeBlockLanguage",(()=>({pos:e,language:t}={pos:-1,language:""})=>(n,r)=>e>=0&&(null==r||r(n.tr.setNodeAttribute(e,"language",t)),!0))),{displayName:"Command<updateCodeBlockLanguageCommand>",group:"CodeBlock"});const le=(0,r.pq)("codeBlockKeymap",{CreateCodeBlock:{shortcuts:"Mod-Alt-c",command:e=>{const t=e.get(o.MD);return()=>t.call(ae.key)}}});C(le.ctx,{displayName:"KeymapCtx<codeBlock>",group:"CodeBlock"}),C(le.shortcuts,{displayName:"Keymap<codeBlock>",group:"CodeBlock"});const ce=(0,r.YR)("image");C(ce,{displayName:"Attr<image>",group:"Image"});const ue=(0,r.Yh)("image",(e=>({inline:!0,group:"inline",selectable:!0,draggable:!0,marks:"",atom:!0,defining:!0,isolating:!0,attrs:{src:{default:""},alt:{default:""},title:{default:""}},parseDOM:[{tag:"img[src]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw(0,a.Ik)(e);return{src:e.getAttribute("src")||"",alt:e.getAttribute("alt")||"",title:e.getAttribute("title")||e.getAttribute("alt")||""}}}],toDOM:t=>["img",{...e.get(ce.key)(t),...t.attrs}],parseMarkdown:{match:({type:e})=>"image"===e,runner:(e,t,n)=>{const r=t.url,o=t.alt,i=t.title;e.addNode(n,{src:r,alt:o,title:i})}},toMarkdown:{match:e=>"image"===e.type.name,runner:(e,t)=>{e.addNode("image",void 0,void 0,{title:t.attrs.title,url:t.attrs.src,alt:t.attrs.alt})}}})));C(ue.node,{displayName:"NodeSchema<image>",group:"Image"}),C(ue.ctx,{displayName:"NodeSchemaCtx<image>",group:"Image"});const de=(0,r.yu)("InsertImage",(()=>(e={})=>(t,n)=>{if(!n)return!0;const{src:r="",alt:o="",title:i=""}=e,s=ue.type().create({src:r,alt:o,title:i});return s&&n(t.tr.replaceSelectionWith(s).scrollIntoView()),!0}));C(de,{displayName:"Command<insertImageCommand>",group:"Image"});const he=(0,r.yu)("UpdateImage",(()=>(e={})=>(t,n)=>{const r=(0,f.UM)(t.selection,ue.type());if(!r)return!1;const{node:o,pos:i}=r,s={...o.attrs},{src:a,alt:l,title:c}=e;return void 0!==a&&(s.src=a),void 0!==l&&(s.alt=l),void 0!==c&&(s.title=c),null==n||n(t.tr.setNodeMarkup(i,void 0,s).scrollIntoView()),!0}));C(he,{displayName:"Command<updateImageCommand>",group:"Image"}),C((0,r.b_)((()=>new l.fV(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,((e,t,n,r)=>{const[o,i,s="",a]=t;return o?e.tr.replaceWith(n,r,ue.type().create({src:s,alt:i,title:a})):null})))),{displayName:"InputRule<insertImageInputRule>",group:"Image"});const pe=(0,r.YR)("hardbreak",(e=>({"data-is-inline":e.attrs.isInline})));C(pe,{displayName:"Attr<hardbreak>",group:"Hardbreak"});const fe=(0,r.Yh)("hardbreak",(e=>({inline:!0,group:"inline",attrs:{isInline:{default:!1}},selectable:!1,parseDOM:[{tag:"br"}],toDOM:t=>["br",e.get(pe.key)(t)],parseMarkdown:{match:({type:e})=>"break"===e,runner:(e,t,n)=>{var r;e.addNode(n,{isInline:Boolean(null==(r=t.data)?void 0:r.isInline)})}},leafText:()=>"\n",toMarkdown:{match:e=>"hardbreak"===e.type.name,runner:(e,t)=>{t.attrs.isInline?e.addNode("text",void 0,"\n"):e.addNode("break")}}})));C(fe.node,{displayName:"NodeSchema<hardbreak>",group:"Hardbreak"}),C(fe.ctx,{displayName:"NodeSchemaCtx<hardbreak>",group:"Hardbreak"});const me=(0,r.yu)("InsertHardbreak",(()=>()=>(e,t)=>{var n;const{selection:r,tr:o}=e;if(r.empty){const i=r.$from.node();if(i.childCount>0&&"hardbreak"===(null==(n=i.lastChild)?void 0:n.type.name))return null==t||t(o.replaceRangeWith(r.to-1,r.to,e.schema.node("paragraph")).setSelection(p.LN.near(o.doc.resolve(r.to))).scrollIntoView()),!0}return null==t||t(o.setMeta("hardbreak",!0).replaceSelectionWith(fe.type().create()).scrollIntoView()),!0}));C(me,{displayName:"Command<insertHardbreakCommand>",group:"Hardbreak"});const ge=(0,r.pq)("hardbreakKeymap",{InsertHardbreak:{shortcuts:"Shift-Enter",command:e=>{const t=e.get(o.MD);return()=>t.call(me.key)}}});C(ge.ctx,{displayName:"KeymapCtx<hardbreak>",group:"Hardbreak"}),C(ge.shortcuts,{displayName:"Keymap<hardbreak>",group:"Hardbreak"});const ye=(0,r.YR)("hr");C(ye,{displayName:"Attr<hr>",group:"Hr"});const ve=(0,r.Yh)("hr",(e=>({group:"block",parseDOM:[{tag:"hr"}],toDOM:t=>["hr",e.get(ye.key)(t)],parseMarkdown:{match:({type:e})=>"thematicBreak"===e,runner:(e,t,n)=>{e.addNode(n)}},toMarkdown:{match:e=>"hr"===e.type.name,runner:e=>{e.addNode("thematicBreak")}}})));C(ve.node,{displayName:"NodeSchema<hr>",group:"Hr"}),C(ve.ctx,{displayName:"NodeSchemaCtx<hr>",group:"Hr"});const we=(0,r.b_)((()=>new l.fV(/^(?:---|___\s|\*\*\*\s)$/,((e,t,n,r)=>{const{tr:o}=e;return t[0]&&o.replaceWith(n-1,r,ve.type().create()),o}))));C(we,{displayName:"InputRule<insertHrInputRule>",group:"Hr"});const ke=(0,r.yu)("InsertHr",(()=>()=>(e,t)=>{if(!t)return!0;const n=V.node.type().create(),{tr:r,selection:o}=e,{from:i}=o,s=ve.type().create();if(!s)return!0;const a=r.replaceSelectionWith(s).insert(i,n),l=p.LN.findFrom(a.doc.resolve(i),1,!0);return l&&t(a.setSelection(l).scrollIntoView()),!0}));C(ke,{displayName:"Command<insertHrCommand>",group:"Hr"});const be=(0,r.YR)("bulletList");C(be,{displayName:"Attr<bulletList>",group:"BulletList"});const xe=(0,r.Yh)("bullet_list",(e=>({content:"listItem+",group:"block",attrs:{spread:{default:!1}},parseDOM:[{tag:"ul",getAttrs:e=>{if(!(e instanceof HTMLElement))throw(0,a.Ik)(e);return{spread:e.dataset.spread}}}],toDOM:t=>["ul",{...e.get(be.key)(t),"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>"list"===e&&!t,runner:(e,t,n)=>{const r=null!=t.spread?`${t.spread}`:"false";e.openNode(n,{spread:r}).next(t.children).closeNode()}},toMarkdown:{match:e=>"bullet_list"===e.type.name,runner:(e,t)=>{e.openNode("list",void 0,{ordered:!1,spread:"true"===t.attrs.spread}).next(t.content).closeNode()}}})));C(xe.node,{displayName:"NodeSchema<bulletList>",group:"BulletList"}),C(xe.ctx,{displayName:"NodeSchemaCtx<bulletList>",group:"BulletList"});const Ce=(0,r.b_)((()=>(0,l.tG)(/^\s*([-+*])\s$/,xe.type())));C(Ce,{displayName:"InputRule<wrapInBulletListInputRule>",group:"BulletList"});const Se=(0,r.yu)("WrapInBulletList",(()=>()=>(0,i.Im)(xe.type())));C(Se,{displayName:"Command<wrapInBulletListCommand>",group:"BulletList"});const Me=(0,r.pq)("bulletListKeymap",{WrapInBulletList:{shortcuts:"Mod-Alt-8",command:e=>{const t=e.get(o.MD);return()=>t.call(Se.key)}}});C(Me.ctx,{displayName:"KeymapCtx<bulletListKeymap>",group:"BulletList"}),C(Me.shortcuts,{displayName:"Keymap<bulletListKeymap>",group:"BulletList"});const Ne=(0,r.YR)("orderedList");C(Ne,{displayName:"Attr<orderedList>",group:"OrderedList"});const Oe=(0,r.Yh)("ordered_list",(e=>({content:"listItem+",group:"block",attrs:{order:{default:1},spread:{default:!1}},parseDOM:[{tag:"ol",getAttrs:e=>{if(!(e instanceof HTMLElement))throw(0,a.Ik)(e);return{spread:e.dataset.spread,order:e.hasAttribute("start")?Number(e.getAttribute("start")):1}}}],toDOM:t=>["ol",{...e.get(Ne.key)(t),...1===t.attrs.order?{}:t.attrs.order,"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>"list"===e&&!!t,runner:(e,t,n)=>{const r=null!=t.spread?`${t.spread}`:"true";e.openNode(n,{spread:r}).next(t.children).closeNode()}},toMarkdown:{match:e=>"ordered_list"===e.type.name,runner:(e,t)=>{e.openNode("list",void 0,{ordered:!0,start:1,spread:"true"===t.attrs.spread}),e.next(t.content),e.closeNode()}}})));C(Oe.node,{displayName:"NodeSchema<orderedList>",group:"OrderedList"}),C(Oe.ctx,{displayName:"NodeSchemaCtx<orderedList>",group:"OrderedList"});const Ae=(0,r.b_)((()=>(0,l.tG)(/^\s*(\d+)\.\s$/,Oe.type(),(e=>({order:Number(e[1])})),((e,t)=>t.childCount+t.attrs.order===Number(e[1])))));C(Ae,{displayName:"InputRule<wrapInOrderedListInputRule>",group:"OrderedList"});const Ee=(0,r.yu)("WrapInOrderedList",(()=>()=>(0,i.Im)(Oe.type())));C(Ee,{displayName:"Command<wrapInOrderedListCommand>",group:"OrderedList"});const De=(0,r.pq)("orderedListKeymap",{WrapInOrderedList:{shortcuts:"Mod-Alt-7",command:e=>{const t=e.get(o.MD);return()=>t.call(Ee.key)}}});C(De.ctx,{displayName:"KeymapCtx<orderedList>",group:"OrderedList"}),C(De.shortcuts,{displayName:"Keymap<orderedList>",group:"OrderedList"});const Te=(0,r.YR)("listItem");C(Te,{displayName:"Attr<listItem>",group:"ListItem"});const Fe=(0,r.Yh)("list_item",(e=>({group:"listItem",content:"paragraph block*",attrs:{label:{default:"•"},listType:{default:"bullet"},spread:{default:"true"}},defining:!0,parseDOM:[{tag:"li",getAttrs:e=>{if(!(e instanceof HTMLElement))throw(0,a.Ik)(e);return{label:e.dataset.label,listType:e.dataset["list-type"],spread:e.dataset.spread}}}],toDOM:t=>["li",{...e.get(Te.key)(t),"data-label":t.attrs.label,"data-list-type":t.attrs.listType,"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e})=>"listItem"===e,runner:(e,t,n)=>{const r=null!=t.label?`${t.label}.`:"•",o=null!=t.label?"ordered":"bullet",i=null!=t.spread?`${t.spread}`:"true";e.openNode(n,{label:r,listType:o,spread:i}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>"list_item"===e.type.name,runner:(e,t)=>{e.openNode("listItem",void 0,{spread:"true"===t.attrs.spread}),e.next(t.content),e.closeNode()}}})));C(Fe.node,{displayName:"NodeSchema<listItem>",group:"ListItem"}),C(Fe.ctx,{displayName:"NodeSchemaCtx<listItem>",group:"ListItem"});const Ie=(0,r.yu)("SinkListItem",(()=>()=>{return e=Fe.type(),function(t,n){let{$from:r,$to:o}=t.selection,i=r.blockRange(o,(t=>t.childCount>0&&t.firstChild.type==e));if(!i)return!1;let a=i.startIndex;if(0==a)return!1;let l=i.parent,c=l.child(a-1);if(c.type!=e)return!1;if(n){let r=c.lastChild&&c.lastChild.type==l.type,o=s.FK.from(r?e.create():null),a=new s.Ji(s.FK.from(e.create(null,s.FK.from(l.type.create(null,o)))),r?3:1,0),u=i.start,d=i.end;n(t.tr.step(new m.Wg(u-(r?3:1),d,u,d,a,1,!0)).scrollIntoView())}return!0};var e}));C(Ie,{displayName:"Command<sinkListItemCommand>",group:"ListItem"});const Re=(0,r.yu)("SplitListItem",(()=>()=>{return e=Fe.type(),function(t,n){let{$from:r,$to:o}=t.selection,i=r.blockRange(o,(t=>t.childCount>0&&t.firstChild.type==e));return!!i&&(!n||(r.node(i.depth-1).type==e?function(e,t,n,r){let o=e.tr,i=r.end,a=r.$to.end(r.depth);i<a&&(o.step(new m.Wg(i-1,a,i,a,new s.Ji(s.FK.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new s.u$(o.doc.resolve(r.$from.pos),o.doc.resolve(a),r.depth));const l=(0,m.jP)(r);if(null==l)return!1;o.lift(r,l);let c=o.mapping.map(i,-1)-1;return(0,m.n9)(o.doc,c)&&o.join(c),t(o.scrollIntoView()),!0}(t,n,e,i):function(e,t,n){let r=e.tr,o=n.parent;for(let e=n.end,t=n.endIndex-1,i=n.startIndex;t>i;t--)e-=o.child(t).nodeSize,r.delete(e-1,e+1);let i=r.doc.resolve(n.start),a=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=0==n.startIndex,c=n.endIndex==o.childCount,u=i.node(-1),d=i.index(-1);if(!u.canReplace(d+(l?0:1),d+1,a.content.append(c?s.FK.empty:s.FK.from(o))))return!1;let h=i.pos,p=h+a.nodeSize;return r.step(new m.Wg(h-(l?1:0),p+(c?1:0),h+1,p-1,new s.Ji((l?s.FK.empty:s.FK.from(o.copy(s.FK.empty))).append(c?s.FK.empty:s.FK.from(o.copy(s.FK.empty))),l?0:1,c?0:1),l?0:1)),t(r.scrollIntoView()),!0}(t,n,i)))};var e}));C(Re,{displayName:"Command<liftListItemCommand>",group:"ListItem"});const Pe=(0,r.yu)("SplitListItem",(()=>()=>{return e=Fe.type(),function(t,n){let{$from:r,$to:o,node:i}=t.selection;if(i&&i.isBlock||r.depth<2||!r.sameParent(o))return!1;let a=r.node(-1);if(a.type!=e)return!1;if(0==r.parent.content.size&&r.node(-1).childCount==r.indexAfter(-1)){if(3==r.depth||r.node(-3).type!=e||r.index(-2)!=r.node(-2).childCount-1)return!1;if(n){let o=s.FK.empty,i=r.index(-1)?1:r.index(-2)?2:3;for(let e=r.depth-i;e>=r.depth-3;e--)o=s.FK.from(r.node(e).copy(o));let a=r.indexAfter(-1)<r.node(-2).childCount?1:r.indexAfter(-2)<r.node(-3).childCount?2:3;o=o.append(s.FK.from(e.createAndFill()));let l=r.before(r.depth-(i-1)),c=t.tr.replace(l,r.after(-a),new s.Ji(o,4-i,0)),u=-1;c.doc.nodesBetween(l,c.doc.content.size,((e,t)=>{if(u>-1)return!1;e.isTextblock&&0==e.content.size&&(u=t+1)})),u>-1&&c.setSelection(p.LN.near(c.doc.resolve(u))),n(c.scrollIntoView())}return!0}let l=o.pos==r.end()?a.contentMatchAt(0).defaultType:null,c=t.tr.delete(r.pos,o.pos),u=l?[null,{type:l}]:void 0;return!!(0,m.zy)(c.doc,r.pos,2,u)&&(n&&n(c.split(r.pos,2,u).scrollIntoView()),!0)};var e}));C(Pe,{displayName:"Command<splitListItemCommand>",group:"ListItem"});const Be=(0,r.pq)("listItemKeymap",{NextListItem:{shortcuts:"Enter",command:e=>{const t=e.get(o.MD);return()=>t.call(Pe.key)}},SinkListItem:{shortcuts:["Tab","Mod-]"],command:e=>{const t=e.get(o.MD);return()=>t.call(Ie.key)}},LiftListItem:{shortcuts:["Shift-Tab","Mod-["],command:e=>{const t=e.get(o.MD);return()=>t.call(Re.key)}}});C(Be.ctx,{displayName:"KeymapCtx<listItem>",group:"ListItem"}),C(Be.shortcuts,{displayName:"Keymap<listItem>",group:"ListItem"});const Le=(0,r.dz)("text",(()=>({group:"inline",parseMarkdown:{match:({type:e})=>"text"===e,runner:(e,t)=>{e.addText(t.value)}},toMarkdown:{match:e=>"text"===e.type.name,runner:(e,t)=>{e.addNode("text",void 0,t.text)}}})));C(Le,{displayName:"NodeSchema<text>",group:"Text"});const ze=(0,r.YR)("html");C(ze,{displayName:"Attr<html>",group:"Html"});const $e=(0,r.Yh)("html",(e=>({atom:!0,group:"inline",inline:!0,attrs:{value:{default:""}},toDOM:t=>{const n=document.createElement("span"),r={...e.get(ze.key)(t),"data-value":t.attrs.value,"data-type":"html"};return n.textContent=t.attrs.value,["span",r,t.attrs.value]},parseDOM:[{tag:'span[data-type="html"]',getAttrs:e=>({value:e.dataset.value??""})}],parseMarkdown:{match:({type:e})=>Boolean("html"===e),runner:(e,t,n)=>{e.addNode(n,{value:t.value})}},toMarkdown:{match:e=>"html"===e.type.name,runner:(e,t)=>{e.addNode("html",void 0,t.attrs.value)}}})));C($e.node,{displayName:"NodeSchema<html>",group:"Html"}),C($e.ctx,{displayName:"NodeSchemaCtx<html>",group:"Html"});const je=[j,_,V,J,q,U,pe,fe,X,ee,oe,ie,ye,ve,ce,ue,be,xe,Ne,Oe,Te,Fe,S,M,A,E,F,I,B,L,ze,$e,Le].flat(),_e=[te,Ce,Ae,se,we,Y].flat(),Ve=[W,ne,Z,G,ae,me,ke,de,he,Ee,Se,Ie,Pe,Re,N,R,D,z,$],We=[re,le,ge,Q,Be,De,Me,H,O,P,T].flat(),He=/\[(?<span>((www|https:\/\/|http:\/\/)[^\s\]]+))]\((?<url>[^\s\]]+)\)/,Ke=e=>{let t=e,n=t.match(He);for(;n&&n.groups;){const{span:e}=n.groups;t=t.replace(He,e),n=t.match(He)}return t},Je=(e,t,n)=>{const r=e.split(""),o=r[t];return r[t]&&r[n]&&(r[t]=r[n],r[n]=o),r.join("").toString()},qe={placeholderConfig:{hole:"∅",punctuation:"⁂",char:"∴"},globalNodes:["footnote_definition"],shouldSyncNode:({prevNode:e,nextNode:t})=>e.inlineContent&&t&&e.type===t.type&&!e.eq(t),movePlaceholder:(e,t)=>{const n=["*","_"];let r=t.indexOf(e);for(;n.includes(t[r-1]||"")&&n.includes(t[r+1]||"");)t=Je(t,r,r+1),r+=1;return t}},Ue=(0,r.Qx)(qe,"inlineSyncConfig");C(Ue,{displayName:"Ctx<inlineSyncConfig>",group:"Prose"});const Ye=e=>e.split("\n\n")[0]||"",Ze=(e,t)=>{try{const n=((e,t)=>{const{globalNodes:n}=e.get(Ue.key),r=[];return t.doc.descendants((e=>{if(n.includes(e.type.name)||n.includes(e.type))return r.push(e),!1})),r})(e,t),i=(e=>e.selection.$from.node())(t),s=((e,t,n,r)=>e.get(o.M)(t.schema.topNodeType.create(void 0,[n,...r])))(e,t,i,n),[a,l]=((e,t)=>{const n=e.get(Ue.key),o=n.placeholderConfig.hole,[i="",...s]=t.split("\n\n");let a=(0,r.Fs)((e=>t=>t.replace((e=>new RegExp(`\\\\(?=[^\\w\\s${e}\\\\]|_)`,"g"))(e),""))(o),(e=>n.movePlaceholder(o,e)),Ke)(i);const l=(e=>t=>{const n=t.indexOf(e.hole),r=t.charAt(n-1),o=t.charAt(n+1),i=/[^\w]|_/;return o?r&&i.test(r)&&i.test(o)?e.punctuation:e.char:e.punctuation})(n.placeholderConfig)(a);return a=a.replace(o,l),a=[a,...s].join("\n\n"),[a,l]})(e,s),c=((e,t)=>{const n=e.get(o.bQ)(t);return n?n.firstChild:null})(e,a);return!c||i.type!==c.type||(e=>1===e.childCount&&"html"===e.child(0).type.name)(c)?null:(c.attrs={...i.attrs},c.descendants((e=>{var t;const n=e.marks.find((e=>"link"===e.type.name));n&&(null==(t=e.text)?void 0:t.includes(l))&&n.attrs.href.includes(l)&&(n.attrs.href=n.attrs.href.replace(l,""))})),{text:Ye(a),prevNode:i,nextNode:c,placeholder:l})}catch{return null}},Ge=(0,r.Gf)((e=>{let t=null;const n=new p.hs("MILKDOWN_INLINE_SYNC");return new p.k_({key:n,state:{init:()=>null,apply:(r,i,s,a)=>{var l;const c=e.get(o.kY);if(null==(l=c.hasFocus)||!l.call(c)||!c.editable||!r.docChanged||r.getMeta(n))return null;const u=Ze(e,a);if(!u)return null;t&&(cancelAnimationFrame(t),t=null);const{prevNode:d,nextNode:h,text:f}=u,{shouldSyncNode:m}=e.get(Ue.key);return m({prevNode:d,nextNode:h,ctx:e,tr:r,text:f})&&(t=requestAnimationFrame((()=>{t=null;const{dispatch:r,state:i}=e.get(o.kY);((e,t,n,r,o)=>{const{placeholderConfig:i}=e.get(Ue.key),s=i.hole;let a=n.tr.setMeta(t,!0).insertText(s,n.selection.from);const l=n.apply(a),c=Ze(e,l);if(!c)return;const{$from:u}=l.selection,d=u.before(),h=u.after(),f=((e,t,n)=>{let r=t,o=!1;return e.descendants((e=>{var t;if(o)return!1;if(e.isText){const i=null==(t=e.text)?void 0:t.indexOf(n);if(null!=i&&i>=0)return o=!0,r+=i,!1}r+=e.nodeSize})),r})(c.nextNode,d,c.placeholder);a=a.replaceWith(d,h,c.nextNode).setNodeMarkup(d,void 0,o).delete(f+1,f+2),a=a.setSelection(p.U3.near(a.doc.resolve(f+1))),r(a)})(e,n,i,r,d.attrs)})),r.setMeta("addToHistory",!1)),null}}})}));C(Ge,{displayName:"Prose<inlineSyncPlugin>",group:"Prose"});const Qe=(0,r.lz)((()=>()=>e=>{v(e,"list",(e=>{if(e.ordered){const t=e.start??1;e.children.forEach(((e,n)=>{e.label=n+t}))}}))}));C(Qe,{displayName:"Remark<remarkAddOrderInListPlugin>",group:"Remark"});const Xe=(0,r.lz)((()=>()=>e=>{const t=/[\t ]*(?:\r?\n|\r)/g;v(e,"text",((e,n,r)=>{if(!e.value||"string"!=typeof e.value)return;const o=[];let i=0;t.lastIndex=0;let s=t.exec(e.value);for(;s;){const n=s.index;i!==n&&o.push({type:"text",value:e.value.slice(i,n)}),o.push({type:"break",data:{isInline:!0}}),i=n+s[0].length,s=t.exec(e.value)}return o.length>0&&r&&"number"==typeof n?(i<e.value.length&&o.push({type:"text",value:e.value.slice(i)}),r.children.splice(n,1,...o),n+o.length):void 0}))}));C(Xe,{displayName:"Remark<remarkLineBreak>",group:"Remark"});const et=(0,r.lz)((()=>b));C(et,{displayName:"Remark<remarkInlineLinkPlugin>",group:"Remark"});const tt=(0,r.lz)((()=>()=>e=>{!function(e){(function e(t,n,r){if((e=>!!e.children)(t)){const n=[];for(let r=0,o=t.children.length;r<o;r++){const o=t.children[r];if(o){const i=e(o,r,t);if(i)for(let e=0,t=i.length;e<t;e++){const t=i[e];t&&n.push(t)}}}t.children=n}return((e,t,n)=>(e=>"html"===e.type)(e)?("root"===(null==n?void 0:n.type)&&(e.children=[{...e}],delete e.value,e.type="paragraph"),[e]):[e])(t,0,r)})(e,0,null)[0]}(e)}));C(tt,{displayName:"Remark<remarkHtmlTransformer>",group:"Remark"});const nt=(0,r.Gf)((()=>{let e=!1;const t=new p.hs("MILKDOWN_INLINE_NODES_CURSOR"),n=new p.k_({key:t,state:{init:()=>!1,apply(e){if(!e.selection.empty)return!1;const t=e.selection.$from,n=t.nodeBefore,r=t.nodeAfter;return!(!(n&&r&&n.isInline&&!n.isText&&r.isInline)||r.isText)}},props:{handleDOMEvents:{compositionend:(t,r)=>!!e&&(e=!1,requestAnimationFrame((()=>{if(n.getState(t.state)){const e=t.state.selection.from;r.preventDefault(),t.dispatch(t.state.tr.insertText(r.data||"",e))}})),!0),compositionstart:t=>(n.getState(t.state)&&(e=!0),!1),beforeinput:(t,r)=>{if(n.getState(t.state)&&r instanceof InputEvent&&r.data&&!e){const e=t.state.selection.from;return r.preventDefault(),t.dispatch(t.state.tr.insertText(r.data||"",e)),!0}return!1}},decorations(e){if(n.getState(e)){const t=e.selection.$from.pos,n=document.createElement("span"),r=g.NZ.widget(t,n,{side:-1}),o=document.createElement("span"),i=g.NZ.widget(t,o);return setTimeout((()=>{n.contentEditable="true",o.contentEditable="true"})),g.zF.create(e.doc,[r,i])}return g.zF.empty}}});return n}));C(nt,{displayName:"Prose<inlineNodesCursorPlugin>",group:"Prose"});const rt=(0,r.Gf)((()=>new p.k_({key:new p.hs("MILKDOWN_HARDBREAK_MARKS"),appendTransaction:(e,t,n)=>{if(!e.length)return;const[r]=e;if(!r)return;const[o]=r.steps;if(r.getMeta("hardbreak")){if(!(o instanceof m.Ln))return;const{from:e}=o;return n.tr.setNodeMarkup(e,fe.type(),void 0,[])}if(o instanceof m.XE){let e=n.tr;const{from:t,to:r}=o;return n.doc.nodesBetween(t,r,((t,n)=>{t.type===fe.type()&&(e=e.setNodeMarkup(n,fe.type(),void 0,[]))})),e}}})));C(rt,{displayName:"Prose<hardbreakClearMarkPlugin>",group:"Prose"});const ot=(0,r.Qx)(["table","code_block"],"hardbreakFilterNodes");C(ot,{displayName:"Ctx<hardbreakFilterNodes>",group:"Prose"});const it=(0,r.Gf)((e=>{const t=e.get(ot.key);return new p.k_({key:new p.hs("MILKDOWN_HARDBREAK_FILTER"),filterTransaction:(e,n)=>{const r=e.getMeta("hardbreak"),[o]=e.steps;if(r&&o){const{from:e}=o,r=n.doc.resolve(e);let i=r.depth,s=!0;for(;i>0;)t.includes(r.node(i).type.name)&&(s=!1),i--;return s}return!0}})}));C(it,{displayName:"Prose<hardbreakFilterPlugin>",group:"Prose"});const st=(0,r.Gf)((e=>{const t=new p.hs("MILKDOWN_HEADING_ID"),n=n=>{if(n.composing||!n.editable)return;const r=e.get(J.key),o=n.state.tr.setMeta("addToHistory",!1);let i=!1;n.state.doc.descendants(((e,n)=>{if(e.type===U.type()){if(0===e.textContent.trim().length)return;const s=e.attrs,a=r(e);s.id!==a&&(i=!0,o.setMeta(t,!0).setNodeMarkup(n,void 0,{...s,id:a}))}})),i&&n.dispatch(o)};return new p.k_({key:t,view:e=>(n(e),{update:e=>{n(e)}})})}));C(st,{displayName:"Prose<syncHeadingIdPlugin>",group:"Prose"});const at=(0,r.Gf)((()=>{const e=e=>{if(e.composing||!e.editable)return;const t=Oe.type(),n=xe.type(),r=Fe.type(),o=e.state,i=(e,t)=>{let n=!1;const r=`${t+1}.`;return e.label!==r&&(e.label=r,n=!0),n};let s=o.tr,a=!1;o.doc.descendants(((e,o,l,c)=>{if(e.type===n){const n=e.maybeChild(0);(null==n?void 0:n.type)===r&&"ordered"===n.attrs.listType&&(a=!0,s.setNodeMarkup(o,t,{spread:"true"}),e.descendants(((e,t,n,o)=>{if(e.type===r){const n={...e.attrs};i(n,o)&&(s=s.setNodeMarkup(t,void 0,n))}return!1})))}else if(e.type===r&&(null==l?void 0:l.type)===t){const t={...e.attrs};let n=!1;"ordered"!==t.listType&&(t.listType="ordered",n=!0),(null==l?void 0:l.maybeChild(0))&&(n=i(t,c)),n&&(s=s.setNodeMarkup(o,void 0,t),a=!0)}})),a&&e.dispatch(s.setMeta("addToHistory",!1))};return new p.k_({key:new p.hs("MILKDOWN_KEEP_LIST_ORDER"),view:t=>(e(t),{update:t=>{e(t)}})})}));C(at,{displayName:"Prose<syncListOrderPlugin>",group:"Prose"});const lt=[je,_e,Ve,We,[Ue,Ge,rt,ot,it,nt,Qe,et,Xe,tt,st,at]].flat()},2113:(e,t,n)=>{"use strict";n.d(t,{KE:()=>fo,CU:()=>Pr,ge:()=>nr,x8:()=>pr,g3:()=>Sr,MD:()=>qr,qf:()=>Jr,CI:()=>Ar,Sr:()=>Dr,kY:()=>Br,QM:()=>zr,f4:()=>ir,aD:()=>cr,u7:()=>yr,pe:()=>lr,P_:()=>gr,bQ:()=>br,TP:()=>sr,eM:()=>ar,k:()=>$r,pZ:()=>mr,M:()=>Nr});var r={};n.r(r),n.d(r,{attentionMarkers:()=>Se,contentInitial:()=>ve,disable:()=>Me,document:()=>ye,flow:()=>ke,flowInitial:()=>we,insideSpan:()=>Ce,string:()=>be,text:()=>xe});var o=n(7488),i=n(6090);const s={};function a(e,t){const n=t||s;return l(e,"boolean"!=typeof n.includeImageAlt||n.includeImageAlt,"boolean"!=typeof n.includeHtml||n.includeHtml)}function l(e,t,n){if(function(e){return Boolean(e&&"object"==typeof e)}(e)){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return c(e.children,t,n)}return Array.isArray(e)?c(e,t,n):""}function c(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=l(e[o],t,n);return r.join("")}var u=n(660),d=n(7508),h=n(7884);const p={tokenize:function(e){const t=e.attempt(this.parser.constructs.contentInitial,(function(n){if(null!==n)return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),(0,d.N)(e,t,"linePrefix");e.consume(n)}),(function(t){return e.enter("paragraph"),r(t)}));let n;return t;function r(t){const r=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){return null===t?(e.exit("chunkText"),e.exit("paragraph"),void e.consume(t)):(0,h.HP)(t)?(e.consume(t),e.exit("chunkText"),r):(e.consume(t),o)}}};var f=n(3890);const m={tokenize:function(e){const t=this,n=[];let r,o,i,s=0;return a;function a(r){if(s<n.length){const o=n[s];return t.containerState=o[1],e.attempt(o[0].continuation,l,c)(r)}return c(r)}function l(e){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,r&&b();const n=t.events.length;let o,i=n;for(;i--;)if("exit"===t.events[i][0]&&"chunkFlow"===t.events[i][1].type){o=t.events[i][1].end;break}k(s);let a=n;for(;a<t.events.length;)t.events[a][1].end=Object.assign({},o),a++;return(0,f.m)(t.events,i+1,0,t.events.slice(n)),t.events.length=a,c(e)}return a(e)}function c(o){if(s===n.length){if(!r)return p(o);if(r.currentConstruct&&r.currentConstruct.concrete)return y(o);t.interrupt=Boolean(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(g,u,d)(o)}function u(e){return r&&b(),k(s),p(e)}function d(e){return t.parser.lazy[t.now().line]=s!==n.length,i=t.now().offset,y(e)}function p(n){return t.containerState={},e.attempt(g,m,y)(n)}function m(e){return s++,n.push([t.currentConstruct,t.containerState]),p(e)}function y(n){return null===n?(r&&b(),k(0),void e.consume(n)):(r=r||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:o,_tokenizer:r}),v(n))}function v(n){return null===n?(w(e.exit("chunkFlow"),!0),k(0),void e.consume(n)):(0,h.HP)(n)?(e.consume(n),w(e.exit("chunkFlow")),s=0,t.interrupt=void 0,a):(e.consume(n),v)}function w(e,n){const a=t.sliceStream(e);if(n&&a.push(null),e.previous=o,o&&(o.next=e),o=e,r.defineSkip(e.start),r.write(a),t.parser.lazy[e.start.line]){let e=r.events.length;for(;e--;)if(r.events[e][1].start.offset<i&&(!r.events[e][1].end||r.events[e][1].end.offset>i))return;const n=t.events.length;let o,a,l=n;for(;l--;)if("exit"===t.events[l][0]&&"chunkFlow"===t.events[l][1].type){if(o){a=t.events[l][1].end;break}o=!0}for(k(s),e=n;e<t.events.length;)t.events[e][1].end=Object.assign({},a),e++;(0,f.m)(t.events,l+1,0,t.events.slice(n)),t.events.length=e}}function k(r){let o=n.length;for(;o-- >r;){const r=n[o];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function b(){r.write([null]),o=void 0,r=void 0,t.containerState._closeFlow=void 0}}},g={tokenize:function(e,t,n){return(0,d.N)(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};var y=n(5460);function v(e){const t={};let n,r,o,i,s,a,l,c=-1;for(;++c<e.length;){for(;c in t;)c=t[c];if(n=e[c],c&&"chunkFlow"===n[1].type&&"listItemPrefix"===e[c-1][1].type&&(a=n[1]._tokenizer.events,o=0,o<a.length&&"lineEndingBlank"===a[o][1].type&&(o+=2),o<a.length&&"content"===a[o][1].type))for(;++o<a.length&&"content"!==a[o][1].type;)"chunkText"===a[o][1].type&&(a[o][1]._isInFirstContentOfListItem=!0,o++);if("enter"===n[0])n[1].contentType&&(Object.assign(t,w(e,c)),c=t[c],l=!0);else if(n[1]._container){for(o=c,r=void 0;o--&&(i=e[o],"lineEnding"===i[1].type||"lineEndingBlank"===i[1].type);)"enter"===i[0]&&(r&&(e[r][1].type="lineEndingBlank"),i[1].type="lineEnding",r=o);r&&(n[1].end=Object.assign({},e[r][1].start),s=e.slice(r,c),s.unshift(n),(0,f.m)(e,r,c-r+1,s))}}return!l}function w(e,t){const n=e[t][1],r=e[t][2];let o=t-1;const i=[],s=n._tokenizer||r.parser[n.contentType](n.start),a=s.events,l=[],c={};let u,d,h=-1,p=n,m=0,g=0;const y=[g];for(;p;){for(;e[++o][1]!==p;);i.push(o),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&s.defineSkip(p.start),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(u),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++h<a.length;)"exit"===a[h][0]&&"enter"===a[h-1][0]&&a[h][1].type===a[h-1][1].type&&a[h][1].start.line!==a[h][1].end.line&&(g=h+1,y.push(g),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(s.events=[],p?(p._tokenizer=void 0,p.previous=void 0):y.pop(),h=y.length;h--;){const t=a.slice(y[h],y[h+1]),n=i.pop();l.unshift([n,n+t.length-1]),(0,f.m)(e,n,2,t)}for(h=-1;++h<l.length;)c[m+l[h][0]]=m+l[h][1],m+=l[h][1]-l[h][0]-1;return c}const k={tokenize:function(e,t){let n;return function(t){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(t)};function r(t){return null===t?o(t):(0,h.HP)(t)?e.check(b,i,o)(t):(e.consume(t),r)}function o(n){return e.exit("chunkContent"),e.exit("content"),t(n)}function i(t){return e.consume(t),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}},resolve:function(e){return v(e),e}},b={tokenize:function(e,t,n){const r=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),(0,d.N)(e,o,"linePrefix")};function o(o){if(null===o||(0,h.HP)(o))return n(o);const i=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}},partial:!0},x={tokenize:function(e){const t=this,n=e.attempt(y.B,(function(r){if(null!==r)return e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n;e.consume(r)}),e.attempt(this.parser.constructs.flowInitial,r,(0,d.N)(e,e.attempt(this.parser.constructs.flow,r,e.attempt(k,r)),"linePrefix")));return n;function r(r){if(null!==r)return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n;e.consume(r)}}},C={resolveAll:O()},S=N("string"),M=N("text");function N(e){return{tokenize:function(t){const n=this,r=this.parser.constructs[e],o=t.attempt(r,i,s);return i;function i(e){return l(e)?o(e):s(e)}function s(e){if(null!==e)return t.enter("data"),t.consume(e),a;t.consume(e)}function a(e){return l(e)?(t.exit("data"),o(e)):(t.consume(e),a)}function l(e){if(null===e)return!0;const t=r[e];let o=-1;if(t)for(;++o<t.length;){const e=t[o];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}},resolveAll:O("text"===e?A:void 0)}}function O(e){return function(t,n){let r,o=-1;for(;++o<=t.length;)void 0===r?t[o]&&"data"===t[o][1].type&&(r=o,o++):t[o]&&"data"===t[o][1].type||(o!==r+2&&(t[r][1].end=t[o-1][1].end,t.splice(r+2,o-r-2),o=r+2),r=void 0);return e?e(t,n):t}}function A(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||"lineEnding"===e[n][1].type)&&"data"===e[n-1][1].type){const r=e[n-1][1],o=t.sliceStream(r);let i,s=o.length,a=-1,l=0;for(;s--;){const e=o[s];if("string"==typeof e){for(a=e.length;32===e.charCodeAt(a-1);)l++,a--;if(a)break;a=-1}else if(-2===e)i=!0,l++;else if(-1!==e){s++;break}}if(l){const o={type:n===e.length||i||l<2?"lineSuffix":"hardBreakTrailing",start:{line:r.end.line,column:r.end.column-l,offset:r.end.offset-l,_index:r.start._index+s,_bufferIndex:s?a:r.start._bufferIndex+a},end:Object.assign({},r.end)};r.end=Object.assign({},o.start),r.start.offset===r.end.offset?Object.assign(r,o):(e.splice(n,0,["enter",o,t],["exit",o,t]),n+=2)}n++}return e}var E=n(3796);function D(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const o={},i=[];let s=[],a=[],l=!0;const c={consume:function(e){(0,h.HP)(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,b()):-1!==e&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=e,l=!0},enter:function(e,t){const n=t||{};return n.type=e,n.start=g(),u.events.push(["enter",n,u]),a.push(n),n},exit:function(e){const t=a.pop();return t.end=g(),u.events.push(["exit",t,u]),t},attempt:w((function(e,t){k(e,t.from)})),check:w(v),interrupt:w(v,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:m,sliceSerialize:function(e,t){return function(e,t){let n=-1;const r=[];let o;for(;++n<e.length;){const i=e[n];let s;if("string"==typeof i)s=i;else switch(i){case-5:s="\r";break;case-4:s="\n";break;case-3:s="\r\n";break;case-2:s=t?" ":"\t";break;case-1:if(!t&&o)continue;s=" ";break;default:s=String.fromCharCode(i)}o=-2===i,r.push(s)}return r.join("")}(m(e),t)},now:g,defineSkip:function(e){o[e.line]=e.column,b()},write:function(e){return s=(0,f.V)(s,e),function(){let e;for(;r._index<s.length;){const t=s[r._index];if("string"==typeof t)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)y(t.charCodeAt(r._bufferIndex));else y(t)}}(),null!==s[s.length-1]?[]:(k(t,0),u.events=(0,E.W)(i,u.events,u),u.events)}};let d,p=t.tokenize.call(u,c);return t.resolveAll&&i.push(t),u;function m(e){return function(e,t){const n=t.start._index,r=t.start._bufferIndex,o=t.end._index,i=t.end._bufferIndex;let s;return n===o?s=[e[n].slice(r,i)]:(s=e.slice(n,o),r>-1&&(s[0]=s[0].slice(r)),i>0&&s.push(e[o].slice(0,i))),s}(s,e)}function g(){return Object.assign({},r)}function y(e){l=void 0,d=e,p=p(e)}function v(e,t){t.restore()}function w(e,t){return function(n,o,i){let s,d,h,p;return Array.isArray(n)?f(n):"tokenize"in n?f([n]):function(e){return function(t){const n=null!==t&&e[t],r=null!==t&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}(n);function f(e){return s=e,d=0,0===e.length?i:m(e[d])}function m(e){return function(n){return p=function(){const e=g(),t=u.previous,n=u.currentConstruct,o=u.events.length,i=Array.from(a);return{restore:function(){r=e,u.previous=t,u.currentConstruct=n,u.events.length=o,a=i,b()},from:o}}(),h=e,e.partial||(u.currentConstruct=e),e.name&&u.parser.constructs.disable.null.includes(e.name)?v():e.tokenize.call(t?Object.assign(Object.create(u),t):u,c,y,v)(n)}}function y(t){return l=!0,e(h,p),o}function v(e){return l=!0,p.restore(),++d<s.length?m(s[d]):i}}}function k(e,t){e.resolveAll&&!i.includes(e)&&i.push(e),e.resolve&&(0,f.m)(u.events,t,u.events.length-t,e.resolve(u.events.slice(t),u)),e.resolveTo&&(u.events=e.resolveTo(u.events,u))}function b(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}const T={name:"thematicBreak",tokenize:function(e,t,n){let r,o=0;return function(t){return e.enter("thematicBreak"),function(e){return r=e,i(e)}(t)};function i(i){return i===r?(e.enter("thematicBreakSequence"),s(i)):o>=3&&(null===i||(0,h.HP)(i))?(e.exit("thematicBreak"),t(i)):n(i)}function s(t){return t===r?(e.consume(t),o++,s):(e.exit("thematicBreakSequence"),(0,h.On)(t)?(0,d.N)(e,i,"whitespace")(t):i(t))}}},F={name:"list",tokenize:function(e,t,n){const r=this,o=r.events[r.events.length-1];let i=o&&"linePrefix"===o[1].type?o[2].sliceSerialize(o[1],!0).length:0,s=0;return function(t){const o=r.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===o?!r.containerState.marker||t===r.containerState.marker:(0,h.BM)(t)){if(r.containerState.type||(r.containerState.type=o,e.enter(o,{_container:!0})),"listUnordered"===o)return e.enter("listItemPrefix"),42===t||45===t?e.check(T,n,l)(t):l(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),a(t)}return n(t)};function a(t){return(0,h.BM)(t)&&++s<10?(e.consume(t),a):(!r.interrupt||s<2)&&(r.containerState.marker?t===r.containerState.marker:41===t||46===t)?(e.exit("listItemValue"),l(t)):n(t)}function l(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||t,e.check(y.B,r.interrupt?n:c,e.attempt(I,d,u))}function c(e){return r.containerState.initialBlankLine=!0,i++,d(e)}function u(t){return(0,h.On)(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),d):n(t)}function d(n){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}},continuation:{tokenize:function(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(y.B,(function(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,(0,d.N)(e,t,"listItemIndent",r.containerState.size+1)(n)}),(function(n){return r.containerState.furtherBlankLines||!(0,h.On)(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(R,t,o)(n))}));function o(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,(0,d.N)(e,e.attempt(F,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}},exit:function(e){e.exit(this.containerState.type)}},I={tokenize:function(e,t,n){const r=this;return(0,d.N)(e,(function(e){const o=r.events[r.events.length-1];return!(0,h.On)(e)&&o&&"listItemPrefixWhitespace"===o[1].type?t(e):n(e)}),"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)},partial:!0},R={tokenize:function(e,t,n){const r=this;return(0,d.N)(e,(function(e){const o=r.events[r.events.length-1];return o&&"listItemIndent"===o[1].type&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(e):n(e)}),"listItemIndent",r.containerState.size+1)},partial:!0},P={name:"blockQuote",tokenize:function(e,t,n){const r=this;return function(t){if(62===t){const n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),o}return n(t)};function o(n){return(0,h.On)(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}},continuation:{tokenize:function(e,t,n){const r=this;return function(t){return(0,h.On)(t)?(0,d.N)(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):o(t)};function o(r){return e.attempt(P,t,n)(r)}}},exit:function(e){e.exit("blockQuote")}};function B(e,t,n,r,o,i,s,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return function(t){return 60===t?(e.enter(r),e.enter(o),e.enter(i),e.consume(t),e.exit(i),d):null===t||41===t||(0,h.JQ)(t)?n(t):(e.enter(r),e.enter(s),e.enter(a),e.enter("chunkString",{contentType:"string"}),m(t))};function d(n){return 62===n?(e.enter(i),e.consume(n),e.exit(i),e.exit(o),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(n))}function p(t){return 62===t?(e.exit("chunkString"),e.exit(a),d(t)):null===t||60===t||(0,h.HP)(t)?n(t):(e.consume(t),92===t?f:p)}function f(t){return 60===t||62===t||92===t?(e.consume(t),p):p(t)}function m(o){return 40===o?++u>c?n(o):(e.consume(o),m):41===o?u--?(e.consume(o),m):(e.exit("chunkString"),e.exit(a),e.exit(s),e.exit(r),t(o)):null===o||(0,h.Ee)(o)?u?n(o):(e.exit("chunkString"),e.exit(a),e.exit(s),e.exit(r),t(o)):(0,h.JQ)(o)?n(o):(e.consume(o),92===o?g:m)}function g(t){return 40===t||41===t||92===t?(e.consume(t),m):m(t)}}function L(e,t,n,r,o,i){const s=this;let a,l=0;return function(t){return e.enter(r),e.enter(o),e.consume(t),e.exit(o),e.enter(i),c};function c(d){return null===d||91===d||93===d&&!a||94===d&&!l&&"_hiddenFootnoteSupport"in s.parser.constructs||l>999?n(d):93===d?(e.exit(i),e.enter(o),e.consume(d),e.exit(o),e.exit(r),t):(0,h.HP)(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),u(d))}function u(t){return null===t||91===t||93===t||(0,h.HP)(t)||l++>999?(e.exit("chunkString"),c(t)):(e.consume(t),a=a||!(0,h.On)(t),92===t?d:u)}function d(t){return 91===t||92===t||93===t?(e.consume(t),l++,u):u(t)}}function z(e,t,n,r,o,i){let s;return function(t){return e.enter(r),e.enter(o),e.consume(t),e.exit(o),s=40===t?41:t,a};function a(n){return n===s?(e.enter(o),e.consume(n),e.exit(o),e.exit(r),t):(e.enter(i),l(n))}function l(t){return t===s?(e.exit(i),a(s)):null===t?n(t):(0,h.HP)(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),(0,d.N)(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(t))}function c(t){return t===s||null===t||(0,h.HP)(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?u:c)}function u(t){return t===s||92===t?(e.consume(t),c):c(t)}}function $(e,t){let n;return function r(o){return(0,h.HP)(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):(0,h.On)(o)?(0,d.N)(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}var j=n(6243);const _={name:"definition",tokenize:function(e,t,n){const r=this;let o;return function(t){return e.enter("definition"),function(t){return L.call(r,e,i,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(t)}(t)};function i(t){return o=(0,j.B)(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),s):n(t)}function s(t){return(0,h.Ee)(t)?$(e,a)(t):a(t)}function a(t){return B(e,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(V,c,c)(t)}function c(t){return(0,h.On)(t)?(0,d.N)(e,u,"whitespace")(t):u(t)}function u(i){return null===i||(0,h.HP)(i)?(e.exit("definition"),r.parser.defined.push(o),t(i)):n(i)}}},V={tokenize:function(e,t,n){return function(t){return(0,h.Ee)(t)?$(e,r)(t):n(t)};function r(t){return z(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function o(t){return(0,h.On)(t)?(0,d.N)(e,i,"whitespace")(t):i(t)}function i(e){return null===e||(0,h.HP)(e)?t(e):n(e)}},partial:!0},W={name:"codeIndented",tokenize:function(e,t,n){const r=this;return function(t){return e.enter("codeIndented"),(0,d.N)(e,o,"linePrefix",5)(t)};function o(e){const t=r.events[r.events.length-1];return t&&"linePrefix"===t[1].type&&t[2].sliceSerialize(t[1],!0).length>=4?i(e):n(e)}function i(t){return null===t?a(t):(0,h.HP)(t)?e.attempt(H,i,a)(t):(e.enter("codeFlowValue"),s(t))}function s(t){return null===t||(0,h.HP)(t)?(e.exit("codeFlowValue"),i(t)):(e.consume(t),s)}function a(n){return e.exit("codeIndented"),t(n)}}},H={tokenize:function(e,t,n){const r=this;return o;function o(t){return r.parser.lazy[r.now().line]?n(t):(0,h.HP)(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o):(0,d.N)(e,i,"linePrefix",5)(t)}function i(e){const i=r.events[r.events.length-1];return i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?t(e):(0,h.HP)(e)?o(e):n(e)}},partial:!0},K={name:"headingAtx",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("atxHeading"),function(t){return e.enter("atxHeadingSequence"),o(t)}(t)};function o(t){return 35===t&&r++<6?(e.consume(t),o):null===t||(0,h.Ee)(t)?(e.exit("atxHeadingSequence"),i(t)):n(t)}function i(n){return 35===n?(e.enter("atxHeadingSequence"),s(n)):null===n||(0,h.HP)(n)?(e.exit("atxHeading"),t(n)):(0,h.On)(n)?(0,d.N)(e,i,"whitespace")(n):(e.enter("atxHeadingText"),a(n))}function s(t){return 35===t?(e.consume(t),s):(e.exit("atxHeadingSequence"),i(t))}function a(t){return null===t||35===t||(0,h.Ee)(t)?(e.exit("atxHeadingText"),i(t)):(e.consume(t),a)}},resolve:function(e,t){let n,r,o=e.length-2,i=3;return"whitespace"===e[i][1].type&&(i+=2),o-2>i&&"whitespace"===e[o][1].type&&(o-=2),"atxHeadingSequence"===e[o][1].type&&(i===o-1||o-4>i&&"whitespace"===e[o-2][1].type)&&(o-=i+1===o?2:4),o>i&&(n={type:"atxHeadingText",start:e[i][1].start,end:e[o][1].end},r={type:"chunkText",start:e[i][1].start,end:e[o][1].end,contentType:"text"},(0,f.m)(e,i,o-i+1,[["enter",n,t],["enter",r,t],["exit",r,t],["exit",n,t]])),e}},J={name:"setextUnderline",tokenize:function(e,t,n){const r=this;let o;return function(t){let s,a=r.events.length;for(;a--;)if("lineEnding"!==r.events[a][1].type&&"linePrefix"!==r.events[a][1].type&&"content"!==r.events[a][1].type){s="paragraph"===r.events[a][1].type;break}return r.parser.lazy[r.now().line]||!r.interrupt&&!s?n(t):(e.enter("setextHeadingLine"),o=t,function(t){return e.enter("setextHeadingLineSequence"),i(t)}(t))};function i(t){return t===o?(e.consume(t),i):(e.exit("setextHeadingLineSequence"),(0,h.On)(t)?(0,d.N)(e,s,"lineSuffix")(t):s(t))}function s(r){return null===r||(0,h.HP)(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}},resolveTo:function(e,t){let n,r,o,i=e.length;for(;i--;)if("enter"===e[i][0]){if("content"===e[i][1].type){n=i;break}"paragraph"===e[i][1].type&&(r=i)}else"content"===e[i][1].type&&e.splice(i,1),o||"definition"!==e[i][1].type||(o=i);const s={type:"setextHeading",start:Object.assign({},e[r][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[r][1].type="setextHeadingText",o?(e.splice(r,0,["enter",s,t]),e.splice(o+1,0,["exit",e[n][1],t]),e[n][1].end=Object.assign({},e[o][1].end)):e[n][1]=s,e.push(["exit",s,t]),e}},q=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],U=["pre","script","style","textarea"],Y={name:"htmlFlow",tokenize:function(e,t,n){const r=this;let o,i,s,a,l;return function(t){return function(t){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(t),c}(t)};function c(a){return 33===a?(e.consume(a),u):47===a?(e.consume(a),i=!0,f):63===a?(e.consume(a),o=3,r.interrupt?t:P):(0,h.CW)(a)?(e.consume(a),s=String.fromCharCode(a),m):n(a)}function u(i){return 45===i?(e.consume(i),o=2,d):91===i?(e.consume(i),o=5,a=0,p):(0,h.CW)(i)?(e.consume(i),o=4,r.interrupt?t:P):n(i)}function d(o){return 45===o?(e.consume(o),r.interrupt?t:P):n(o)}function p(o){return o==="CDATA[".charCodeAt(a++)?(e.consume(o),6===a?r.interrupt?t:O:p):n(o)}function f(t){return(0,h.CW)(t)?(e.consume(t),s=String.fromCharCode(t),m):n(t)}function m(a){if(null===a||47===a||62===a||(0,h.Ee)(a)){const l=47===a,c=s.toLowerCase();return l||i||!U.includes(c)?q.includes(s.toLowerCase())?(o=6,l?(e.consume(a),g):r.interrupt?t(a):O(a)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(a):i?y(a):v(a)):(o=1,r.interrupt?t(a):O(a))}return 45===a||(0,h.lV)(a)?(e.consume(a),s+=String.fromCharCode(a),m):n(a)}function g(o){return 62===o?(e.consume(o),r.interrupt?t:O):n(o)}function y(t){return(0,h.On)(t)?(e.consume(t),y):M(t)}function v(t){return 47===t?(e.consume(t),M):58===t||95===t||(0,h.CW)(t)?(e.consume(t),w):(0,h.On)(t)?(e.consume(t),v):M(t)}function w(t){return 45===t||46===t||58===t||95===t||(0,h.lV)(t)?(e.consume(t),w):k(t)}function k(t){return 61===t?(e.consume(t),b):(0,h.On)(t)?(e.consume(t),k):v(t)}function b(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),l=t,x):(0,h.On)(t)?(e.consume(t),b):C(t)}function x(t){return t===l?(e.consume(t),l=null,S):null===t||(0,h.HP)(t)?n(t):(e.consume(t),x)}function C(t){return null===t||34===t||39===t||47===t||60===t||61===t||62===t||96===t||(0,h.Ee)(t)?k(t):(e.consume(t),C)}function S(e){return 47===e||62===e||(0,h.On)(e)?v(e):n(e)}function M(t){return 62===t?(e.consume(t),N):n(t)}function N(t){return null===t||(0,h.HP)(t)?O(t):(0,h.On)(t)?(e.consume(t),N):n(t)}function O(t){return 45===t&&2===o?(e.consume(t),T):60===t&&1===o?(e.consume(t),F):62===t&&4===o?(e.consume(t),B):63===t&&3===o?(e.consume(t),P):93===t&&5===o?(e.consume(t),R):!(0,h.HP)(t)||6!==o&&7!==o?null===t||(0,h.HP)(t)?(e.exit("htmlFlowData"),A(t)):(e.consume(t),O):(e.exit("htmlFlowData"),e.check(Z,L,A)(t))}function A(t){return e.check(G,E,L)(t)}function E(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),D}function D(t){return null===t||(0,h.HP)(t)?A(t):(e.enter("htmlFlowData"),O(t))}function T(t){return 45===t?(e.consume(t),P):O(t)}function F(t){return 47===t?(e.consume(t),s="",I):O(t)}function I(t){if(62===t){const n=s.toLowerCase();return U.includes(n)?(e.consume(t),B):O(t)}return(0,h.CW)(t)&&s.length<8?(e.consume(t),s+=String.fromCharCode(t),I):O(t)}function R(t){return 93===t?(e.consume(t),P):O(t)}function P(t){return 62===t?(e.consume(t),B):45===t&&2===o?(e.consume(t),P):O(t)}function B(t){return null===t||(0,h.HP)(t)?(e.exit("htmlFlowData"),L(t)):(e.consume(t),B)}function L(n){return e.exit("htmlFlow"),t(n)}},resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e},concrete:!0},Z={tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(y.B,t,n)}},partial:!0},G={tokenize:function(e,t,n){const r=this;return function(t){return(0,h.HP)(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o):n(t)};function o(e){return r.parser.lazy[r.now().line]?n(e):t(e)}},partial:!0},Q={tokenize:function(e,t,n){const r=this;return function(t){return null===t?n(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o)};function o(e){return r.parser.lazy[r.now().line]?n(e):t(e)}},partial:!0},X={name:"codeFenced",tokenize:function(e,t,n){const r=this,o={tokenize:function(e,t,n){let o=0;return function(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),s};function s(t){return e.enter("codeFencedFence"),(0,h.On)(t)?(0,d.N)(e,l,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):l(t)}function l(t){return t===i?(e.enter("codeFencedFenceSequence"),c(t)):n(t)}function c(t){return t===i?(o++,e.consume(t),c):o>=a?(e.exit("codeFencedFenceSequence"),(0,h.On)(t)?(0,d.N)(e,u,"whitespace")(t):u(t)):n(t)}function u(r){return null===r||(0,h.HP)(r)?(e.exit("codeFencedFence"),t(r)):n(r)}},partial:!0};let i,s=0,a=0;return function(t){return function(t){const n=r.events[r.events.length-1];return s=n&&"linePrefix"===n[1].type?n[2].sliceSerialize(n[1],!0).length:0,i=t,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),l(t)}(t)};function l(t){return t===i?(a++,e.consume(t),l):a<3?n(t):(e.exit("codeFencedFenceSequence"),(0,h.On)(t)?(0,d.N)(e,c,"whitespace")(t):c(t))}function c(n){return null===n||(0,h.HP)(n)?(e.exit("codeFencedFence"),r.interrupt?t(n):e.check(Q,m,k)(n)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),u(n))}function u(t){return null===t||(0,h.HP)(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(t)):(0,h.On)(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),(0,d.N)(e,p,"whitespace")(t)):96===t&&t===i?n(t):(e.consume(t),u)}function p(t){return null===t||(0,h.HP)(t)?c(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),f(t))}function f(t){return null===t||(0,h.HP)(t)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(t)):96===t&&t===i?n(t):(e.consume(t),f)}function m(t){return e.attempt(o,k,g)(t)}function g(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),y}function y(t){return s>0&&(0,h.On)(t)?(0,d.N)(e,v,"linePrefix",s+1)(t):v(t)}function v(t){return null===t||(0,h.HP)(t)?e.check(Q,m,k)(t):(e.enter("codeFlowValue"),w(t))}function w(t){return null===t||(0,h.HP)(t)?(e.exit("codeFlowValue"),v(t)):(e.consume(t),w)}function k(n){return e.exit("codeFenced"),t(n)}},concrete:!0};var ee=n(1157);const te={name:"characterReference",tokenize:function(e,t,n){const r=this;let o,i,s=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),a};function a(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),o=31,i=h.lV,c(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,i=h.ok,c):(e.enter("characterReferenceValue"),o=7,i=h.BM,c(t))}function c(a){if(59===a&&s){const o=e.exit("characterReferenceValue");return i!==h.lV||(0,ee.s)(r.sliceSerialize(o))?(e.enter("characterReferenceMarker"),e.consume(a),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(a)}return i(a)&&s++<o?(e.consume(a),c):n(a)}}},ne={name:"characterEscape",tokenize:function(e,t,n){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),r};function r(r){return(0,h.ol)(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}},re={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),(0,d.N)(e,t,"linePrefix")}}},oe={name:"labelEnd",tokenize:function(e,t,n){const r=this;let o,i,s=r.events.length;for(;s--;)if(("labelImage"===r.events[s][1].type||"labelLink"===r.events[s][1].type)&&!r.events[s][1]._balanced){o=r.events[s][1];break}return function(t){return o?o._inactive?u(t):(i=r.parser.defined.includes((0,j.B)(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),a):n(t)};function a(t){return 40===t?e.attempt(ie,c,i?c:u)(t):91===t?e.attempt(se,c,i?l:u)(t):i?c(t):u(t)}function l(t){return e.attempt(ae,c,u)(t)}function c(e){return t(e)}function u(e){return o._balanced=!0,n(e)}},resolveTo:function(e,t){let n,r,o,i,s=e.length,a=0;for(;s--;)if(n=e[s][1],r){if("link"===n.type||"labelLink"===n.type&&n._inactive)break;"enter"===e[s][0]&&"labelLink"===n.type&&(n._inactive=!0)}else if(o){if("enter"===e[s][0]&&("labelImage"===n.type||"labelLink"===n.type)&&!n._balanced&&(r=s,"labelLink"!==n.type)){a=2;break}}else"labelEnd"===n.type&&(o=s);const l={type:"labelLink"===e[r][1].type?"link":"image",start:Object.assign({},e[r][1].start),end:Object.assign({},e[e.length-1][1].end)},c={type:"label",start:Object.assign({},e[r][1].start),end:Object.assign({},e[o][1].end)},u={type:"labelText",start:Object.assign({},e[r+a+2][1].end),end:Object.assign({},e[o-2][1].start)};return i=[["enter",l,t],["enter",c,t]],i=(0,f.V)(i,e.slice(r+1,r+a+3)),i=(0,f.V)(i,[["enter",u,t]]),i=(0,f.V)(i,(0,E.W)(t.parser.constructs.insideSpan.null,e.slice(r+a+4,o-3),t)),i=(0,f.V)(i,[["exit",u,t],e[o-2],e[o-1],["exit",c,t]]),i=(0,f.V)(i,e.slice(o+1)),i=(0,f.V)(i,[["exit",l,t]]),(0,f.m)(e,r,e.length,i),e},resolveAll:function(e){let t=-1;for(;++t<e.length;){const n=e[t][1];"labelImage"!==n.type&&"labelLink"!==n.type&&"labelEnd"!==n.type||(e.splice(t+1,"labelImage"===n.type?4:2),n.type="data",t++)}return e}},ie={tokenize:function(e,t,n){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),r};function r(t){return(0,h.Ee)(t)?$(e,o)(t):o(t)}function o(t){return 41===t?c(t):B(e,i,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function i(t){return(0,h.Ee)(t)?$(e,a)(t):c(t)}function s(e){return n(e)}function a(t){return 34===t||39===t||40===t?z(e,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):c(t)}function l(t){return(0,h.Ee)(t)?$(e,c)(t):c(t)}function c(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),t):n(r)}}},se={tokenize:function(e,t,n){const r=this;return function(t){return L.call(r,e,o,i,"reference","referenceMarker","referenceString")(t)};function o(e){return r.parser.defined.includes((0,j.B)(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function i(e){return n(e)}}},ae={tokenize:function(e,t,n){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),r};function r(r){return 93===r?(e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),e.exit("reference"),t):n(r)}}},le={name:"labelStartImage",tokenize:function(e,t,n){const r=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),o};function o(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),i):n(t)}function i(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}},resolveAll:oe.resolveAll};var ce=n(6990);const ue={name:"attention",tokenize:function(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=(0,ce.S)(r);let i;return function(t){return i=t,e.enter("attentionSequence"),s(t)};function s(a){if(a===i)return e.consume(a),s;const l=e.exit("attentionSequence"),c=(0,ce.S)(a),u=!c||2===c&&o||n.includes(a),d=!o||2===o&&c||n.includes(r);return l._open=Boolean(42===i?u:u&&(o||!d)),l._close=Boolean(42===i?d:d&&(c||!u)),t(a)}},resolveAll:function(e,t){let n,r,o,i,s,a,l,c,u=-1;for(;++u<e.length;)if("enter"===e[u][0]&&"attentionSequence"===e[u][1].type&&e[u][1]._close)for(n=u;n--;)if("exit"===e[n][0]&&"attentionSequence"===e[n][1].type&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[u][1]).charCodeAt(0)){if((e[n][1]._close||e[u][1]._open)&&(e[u][1].end.offset-e[u][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[u][1].end.offset-e[u][1].start.offset)%3))continue;a=e[n][1].end.offset-e[n][1].start.offset>1&&e[u][1].end.offset-e[u][1].start.offset>1?2:1;const d=Object.assign({},e[n][1].end),h=Object.assign({},e[u][1].start);de(d,-a),de(h,a),i={type:a>1?"strongSequence":"emphasisSequence",start:d,end:Object.assign({},e[n][1].end)},s={type:a>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[u][1].start),end:h},o={type:a>1?"strongText":"emphasisText",start:Object.assign({},e[n][1].end),end:Object.assign({},e[u][1].start)},r={type:a>1?"strong":"emphasis",start:Object.assign({},i.start),end:Object.assign({},s.end)},e[n][1].end=Object.assign({},i.start),e[u][1].start=Object.assign({},s.end),l=[],e[n][1].end.offset-e[n][1].start.offset&&(l=(0,f.V)(l,[["enter",e[n][1],t],["exit",e[n][1],t]])),l=(0,f.V)(l,[["enter",r,t],["enter",i,t],["exit",i,t],["enter",o,t]]),l=(0,f.V)(l,(0,E.W)(t.parser.constructs.insideSpan.null,e.slice(n+1,u),t)),l=(0,f.V)(l,[["exit",o,t],["enter",s,t],["exit",s,t],["exit",r,t]]),e[u][1].end.offset-e[u][1].start.offset?(c=2,l=(0,f.V)(l,[["enter",e[u][1],t],["exit",e[u][1],t]])):c=0,(0,f.m)(e,n-1,u-n+3,l),u=n+l.length-c-2;break}for(u=-1;++u<e.length;)"attentionSequence"===e[u][1].type&&(e[u][1].type="data");return e}};function de(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const he={name:"autolink",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o};function o(t){return(0,h.CW)(t)?(e.consume(t),i):l(t)}function i(e){return 43===e||45===e||46===e||(0,h.lV)(e)?(r=1,s(e)):l(e)}function s(t){return 58===t?(e.consume(t),r=0,a):(43===t||45===t||46===t||(0,h.lV)(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function a(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),t):null===r||32===r||60===r||(0,h.JQ)(r)?n(r):(e.consume(r),a)}function l(t){return 64===t?(e.consume(t),c):(0,h.cx)(t)?(e.consume(t),l):n(t)}function c(e){return(0,h.lV)(e)?u(e):n(e)}function u(n){return 46===n?(e.consume(n),r=0,c):62===n?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(n),e.exit("autolinkMarker"),e.exit("autolink"),t):d(n)}function d(t){if((45===t||(0,h.lV)(t))&&r++<63){const n=45===t?d:u;return e.consume(t),n}return n(t)}}},pe={name:"htmlText",tokenize:function(e,t,n){const r=this;let o,i,s;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),a};function a(t){return 33===t?(e.consume(t),l):47===t?(e.consume(t),x):63===t?(e.consume(t),k):(0,h.CW)(t)?(e.consume(t),M):n(t)}function l(t){return 45===t?(e.consume(t),c):91===t?(e.consume(t),i=0,m):(0,h.CW)(t)?(e.consume(t),w):n(t)}function c(t){return 45===t?(e.consume(t),f):n(t)}function u(t){return null===t?n(t):45===t?(e.consume(t),p):(0,h.HP)(t)?(s=u,R(t)):(e.consume(t),u)}function p(t){return 45===t?(e.consume(t),f):u(t)}function f(e){return 62===e?I(e):45===e?p(e):u(e)}function m(t){return t==="CDATA[".charCodeAt(i++)?(e.consume(t),6===i?g:m):n(t)}function g(t){return null===t?n(t):93===t?(e.consume(t),y):(0,h.HP)(t)?(s=g,R(t)):(e.consume(t),g)}function y(t){return 93===t?(e.consume(t),v):g(t)}function v(t){return 62===t?I(t):93===t?(e.consume(t),v):g(t)}function w(t){return null===t||62===t?I(t):(0,h.HP)(t)?(s=w,R(t)):(e.consume(t),w)}function k(t){return null===t?n(t):63===t?(e.consume(t),b):(0,h.HP)(t)?(s=k,R(t)):(e.consume(t),k)}function b(e){return 62===e?I(e):k(e)}function x(t){return(0,h.CW)(t)?(e.consume(t),C):n(t)}function C(t){return 45===t||(0,h.lV)(t)?(e.consume(t),C):S(t)}function S(t){return(0,h.HP)(t)?(s=S,R(t)):(0,h.On)(t)?(e.consume(t),S):I(t)}function M(t){return 45===t||(0,h.lV)(t)?(e.consume(t),M):47===t||62===t||(0,h.Ee)(t)?N(t):n(t)}function N(t){return 47===t?(e.consume(t),I):58===t||95===t||(0,h.CW)(t)?(e.consume(t),O):(0,h.HP)(t)?(s=N,R(t)):(0,h.On)(t)?(e.consume(t),N):I(t)}function O(t){return 45===t||46===t||58===t||95===t||(0,h.lV)(t)?(e.consume(t),O):A(t)}function A(t){return 61===t?(e.consume(t),E):(0,h.HP)(t)?(s=A,R(t)):(0,h.On)(t)?(e.consume(t),A):N(t)}function E(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),o=t,D):(0,h.HP)(t)?(s=E,R(t)):(0,h.On)(t)?(e.consume(t),E):(e.consume(t),T)}function D(t){return t===o?(e.consume(t),o=void 0,F):null===t?n(t):(0,h.HP)(t)?(s=D,R(t)):(e.consume(t),D)}function T(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||(0,h.Ee)(t)?N(t):(e.consume(t),T)}function F(e){return 47===e||62===e||(0,h.Ee)(e)?N(e):n(e)}function I(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),t):n(r)}function R(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),P}function P(t){return(0,h.On)(t)?(0,d.N)(e,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):B(t)}function B(t){return e.enter("htmlTextData"),s(t)}}},fe={name:"labelStartLink",tokenize:function(e,t,n){const r=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),o};function o(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}},resolveAll:oe.resolveAll},me={name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return(0,h.HP)(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}},ge={name:"codeText",tokenize:function(e,t,n){let r,o,i=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),s(t)};function s(t){return 96===t?(e.consume(t),i++,s):(e.exit("codeTextSequence"),a(t))}function a(t){return null===t?n(t):32===t?(e.enter("space"),e.consume(t),e.exit("space"),a):96===t?(o=e.enter("codeTextSequence"),r=0,c(t)):(0,h.HP)(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a):(e.enter("codeTextData"),l(t))}function l(t){return null===t||32===t||96===t||(0,h.HP)(t)?(e.exit("codeTextData"),a(t)):(e.consume(t),l)}function c(n){return 96===n?(e.consume(n),r++,c):r===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(n)):(o.type="codeTextData",l(n))}},resolve:function(e){let t,n,r=e.length-4,o=3;if(!("lineEnding"!==e[o][1].type&&"space"!==e[o][1].type||"lineEnding"!==e[r][1].type&&"space"!==e[r][1].type))for(t=o;++t<r;)if("codeTextData"===e[t][1].type){e[o][1].type="codeTextPadding",e[r][1].type="codeTextPadding",o+=2,r-=2;break}for(t=o-1,r++;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):t!==r&&"lineEnding"!==e[t][1].type||(e[n][1].type="codeTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e},previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type}},ye={42:F,43:F,45:F,48:F,49:F,50:F,51:F,52:F,53:F,54:F,55:F,56:F,57:F,62:P},ve={91:_},we={[-2]:W,[-1]:W,32:W},ke={35:K,42:T,45:[J,T],60:Y,61:J,95:T,96:X,126:X},be={38:te,92:ne},xe={[-5]:re,[-4]:re,[-3]:re,33:le,38:te,42:ue,60:[he,pe],91:fe,92:[me,ne],93:oe,95:ue,96:ge},Ce={null:[ue,C]},Se={null:[42,95]},Me={null:[]},Ne=/[\0\t\n\r]/g;var Oe=n(9896),Ae=n(7938);function Ee(e){return e&&"object"==typeof e?"position"in e||"type"in e?Te(e.position):"start"in e||"end"in e?Te(e):"line"in e||"column"in e?De(e):"":""}function De(e){return Fe(e&&e.line)+":"+Fe(e&&e.column)}function Te(e){return De(e&&e.start)+"-"+De(e&&e.end)}function Fe(e){return e&&"number"==typeof e?e:1}const Ie={}.hasOwnProperty,Re=function(e,t,n){return"string"!=typeof t&&(n=t,t=void 0),function(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(b),autolinkProtocol:p,autolinkEmail:p,atxHeading:s(v),blockQuote:s((function(){return{type:"blockquote",children:[]}})),characterEscape:p,characterReference:p,codeFenced:s(y),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:s(y,l),codeText:s((function(){return{type:"inlineCode",value:""}}),l),codeTextData:p,data:p,codeFlowValue:p,definition:s((function(){return{type:"definition",identifier:"",label:null,title:null,url:""}})),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:s((function(){return{type:"emphasis",children:[]}})),hardBreakEscape:s(w),hardBreakTrailing:s(w),htmlFlow:s(k,l),htmlFlowData:p,htmlText:s(k,l),htmlTextData:p,image:s((function(){return{type:"image",title:null,url:"",alt:null}})),label:l,link:s(b),listItem:s((function(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}})),listItemValue:function(e){i("expectingFirstListItemValue")&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),o("expectingFirstListItemValue"))},listOrdered:s(x,(function(){o("expectingFirstListItemValue",!0)})),listUnordered:s(x),paragraph:s((function(){return{type:"paragraph",children:[]}})),reference:function(){o("referenceType","collapsed")},referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:s(v),strong:s((function(){return{type:"strong",children:[]}})),thematicBreak:s((function(){return{type:"thematicBreak"}}))},exit:{atxHeading:u(),atxHeadingSequence:function(e){const t=this.stack[this.stack.length-1];if(!t.depth){const n=this.sliceSerialize(e).length;t.depth=n}},autolink:u(),autolinkEmail:function(e){f.call(this,e),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)},autolinkProtocol:function(e){f.call(this,e),this.stack[this.stack.length-1].url=this.sliceSerialize(e)},blockQuote:u(),characterEscapeValue:f,characterReferenceMarkerHexadecimal:g,characterReferenceMarkerNumeric:g,characterReferenceValue:function(e){const t=this.sliceSerialize(e),n=i("characterReferenceType");let r;n?(r=(0,Oe.C)(t,"characterReferenceMarkerNumeric"===n?10:16),o("characterReferenceType")):r=(0,ee.s)(t);const s=this.stack.pop();s.value+=r,s.position.end=Pe(e.end)},codeFenced:u((function(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),o("flowCodeInside")})),codeFencedFence:function(){i("flowCodeInside")||(this.buffer(),o("flowCodeInside",!0))},codeFencedFenceInfo:function(){const e=this.resume();this.stack[this.stack.length-1].lang=e},codeFencedFenceMeta:function(){const e=this.resume();this.stack[this.stack.length-1].meta=e},codeFlowValue:f,codeIndented:u((function(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")})),codeText:u((function(){const e=this.resume();this.stack[this.stack.length-1].value=e})),codeTextData:f,data:f,definition:u(),definitionDestinationString:function(){const e=this.resume();this.stack[this.stack.length-1].url=e},definitionLabelString:function(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=(0,j.B)(this.sliceSerialize(e)).toLowerCase()},definitionTitleString:function(){const e=this.resume();this.stack[this.stack.length-1].title=e},emphasis:u(),hardBreakEscape:u(m),hardBreakTrailing:u(m),htmlFlow:u((function(){const e=this.resume();this.stack[this.stack.length-1].value=e})),htmlFlowData:f,htmlText:u((function(){const e=this.resume();this.stack[this.stack.length-1].value=e})),htmlTextData:f,image:u((function(){const e=this.stack[this.stack.length-1];if(i("inReference")){const t=i("referenceType")||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;o("referenceType")})),label:function(){const e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];if(o("inReference",!0),"link"===n.type){const t=e.children;n.children=t}else n.alt=t},labelText:function(e){const t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=(0,Ae.s)(t),n.identifier=(0,j.B)(t).toLowerCase()},lineEnding:function(e){const n=this.stack[this.stack.length-1];if(i("atHardBreak"))return n.children[n.children.length-1].position.end=Pe(e.end),void o("atHardBreak");!i("setextHeadingSlurpLineEnding")&&t.canContainEols.includes(n.type)&&(p.call(this,e),f.call(this,e))},link:u((function(){const e=this.stack[this.stack.length-1];if(i("inReference")){const t=i("referenceType")||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;o("referenceType")})),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:function(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=(0,j.B)(this.sliceSerialize(e)).toLowerCase(),o("referenceType","full")},resourceDestinationString:function(){const e=this.resume();this.stack[this.stack.length-1].url=e},resourceTitleString:function(){const e=this.resume();this.stack[this.stack.length-1].title=e},resource:function(){o("inReference")},setextHeading:u((function(){o("setextHeadingSlurpLineEnding")})),setextHeadingLineSequence:function(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).charCodeAt(0)?1:2},setextHeadingText:function(){o("setextHeadingSlurpLineEnding",!0)},strong:u(),thematicBreak:u()}};Be(t,(e||{}).mdastExtensions||[]);const n={};return function(e){let n={type:"root",children:[]};const s={stack:[n],tokenStack:[],config:t,enter:c,exit:d,buffer:l,resume:h,setData:o,getData:i},a=[];let u=-1;for(;++u<e.length;)"listOrdered"!==e[u][1].type&&"listUnordered"!==e[u][1].type||("enter"===e[u][0]?a.push(u):u=r(e,a.pop(),u));for(u=-1;++u<e.length;){const n=t[e[u][0]];Ie.call(n,e[u][1].type)&&n[e[u][1].type].call(Object.assign({sliceSerialize:e[u][2].sliceSerialize},s),e[u][1])}if(s.tokenStack.length>0){const e=s.tokenStack[s.tokenStack.length-1];(e[1]||ze).call(s,void 0,e[0])}for(n.position={start:Pe(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Pe(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},u=-1;++u<t.transforms.length;)n=t.transforms[u](n)||n;return n};function r(e,t,n){let r,o,i,s,a=t-1,l=-1,c=!1;for(;++a<=n;){const t=e[a];if("listUnordered"===t[1].type||"listOrdered"===t[1].type||"blockQuote"===t[1].type?("enter"===t[0]?l++:l--,s=void 0):"lineEndingBlank"===t[1].type?"enter"===t[0]&&(!r||s||l||i||(i=a),s=void 0):"linePrefix"===t[1].type||"listItemValue"===t[1].type||"listItemMarker"===t[1].type||"listItemPrefix"===t[1].type||"listItemPrefixWhitespace"===t[1].type||(s=void 0),!l&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===l&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(r){let s=a;for(o=void 0;s--;){const t=e[s];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;o&&(e[o][1].type="lineEndingBlank",c=!0),t[1].type="lineEnding",o=s}else if("linePrefix"!==t[1].type&&"blockQuotePrefix"!==t[1].type&&"blockQuotePrefixWhitespace"!==t[1].type&&"blockQuoteMarker"!==t[1].type&&"listItemIndent"!==t[1].type)break}i&&(!o||i<o)&&(r._spread=!0),r.end=Object.assign({},o?e[o][1].start:t[1].end),e.splice(o||a,0,["exit",r,t[2]]),a++,n++}"listItemPrefix"===t[1].type&&(r={type:"listItem",_spread:!1,start:Object.assign({},t[1].start)},e.splice(a,0,["enter",r,t[2]]),a++,n++,i=void 0,s=!0)}}return e[t][1]._spread=c,n}function o(e,t){n[e]=t}function i(e){return n[e]}function s(e,t){return function(n){c.call(this,e(n),n),t&&t.call(this,n)}}function l(){this.stack.push({type:"fragment",children:[]})}function c(e,t,n){return this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n]),e.position={start:Pe(t.start)},e}function u(e){return function(t){e&&e.call(this,t),d.call(this,t)}}function d(e,t){const n=this.stack.pop(),r=this.tokenStack.pop();if(!r)throw new Error("Cannot close `"+e.type+"` ("+Ee({start:e.start,end:e.end})+"): it’s not open");return r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||ze).call(this,e,r[0])),n.position.end=Pe(e.end),n}function h(){return a(this.stack.pop())}function p(e){const t=this.stack[this.stack.length-1];let n=t.children[t.children.length-1];n&&"text"===n.type||(n={type:"text",value:""},n.position={start:Pe(e.start)},t.children.push(n)),this.stack.push(n)}function f(e){const t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=Pe(e.end)}function m(){o("atHardBreak",!0)}function g(e){o("characterReferenceType",e.type)}function y(){return{type:"code",lang:null,meta:null,value:""}}function v(){return{type:"heading",depth:void 0,children:[]}}function w(){return{type:"break"}}function k(){return{type:"html",value:""}}function b(){return{type:"link",title:null,url:"",children:[]}}function x(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}}(n)(function(e){for(;!v(e););return e}(function(e={}){const t={defined:[],lazy:{},constructs:(0,u.y)([r].concat(e.extensions||[])),content:n(p),document:n(m),flow:n(x),string:n(S),text:n(M)};return t;function n(e){return function(n){return D(t,e,n)}}}(n).document().write(function(){let e,t=1,n="",r=!0;return function(o,i,s){const a=[];let l,c,u,d,h;for(o=n+o.toString(i),u=0,n="",r&&(65279===o.charCodeAt(0)&&u++,r=void 0);u<o.length;){if(Ne.lastIndex=u,l=Ne.exec(o),d=l&&void 0!==l.index?l.index:o.length,h=o.charCodeAt(d),!l){n=o.slice(u);break}if(10===h&&u===d&&e)a.push(-3),e=void 0;else switch(e&&(a.push(-5),e=void 0),u<d&&(a.push(o.slice(u,d)),t+=d-u),h){case 0:a.push(65533),t++;break;case 9:for(c=4*Math.ceil(t/4),a.push(-2);t++<c;)a.push(-1);break;case 10:a.push(-4),t=1;break;default:e=!0,t=1}u=d+1}return s&&(e&&a.push(-5),n&&a.push(n),a.push(null)),a}}()(e,t,!0))))};function Pe(e){return{line:e.line,column:e.column,offset:e.offset}}function Be(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Be(e,r):Le(e,r)}}function Le(e,t){let n;for(n in t)if(Ie.call(t,n))if("canContainEols"===n){const r=t[n];r&&e[n].push(...r)}else if("transforms"===n){const r=t[n];r&&e[n].push(...r)}else if("enter"===n||"exit"===n){const r=t[n];r&&Object.assign(e[n],r)}}function ze(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ee({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ee({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ee({start:t.start,end:t.end})+") is still open")}function $e(e){Object.assign(this,{Parser:t=>{const n=this.data("settings");return Re(t,Object.assign({},n,e,{extensions:this.data("micromarkExtensions")||[],mdastExtensions:this.data("fromMarkdownExtensions")||[]}))}})}const je={}.hasOwnProperty;function _e(e,t){let n,r=-1;if(t.extensions)for(;++r<t.extensions.length;)_e(e,t.extensions[r]);for(n in t)"extensions"===n||("unsafe"===n||"join"===n?e[n]=[...e[n]||[],...t[n]||[]]:"handlers"===n?e[n]=Object.assign(e[n],t[n]||{}):e.options[n]=t[n]);return e}function Ve(e,t,n){return">"+(n?"":" ")+e}function We(e,t){return He(e,t.inConstruct,!0)&&!He(e,t.notInConstruct,!1)}function He(e,t,n){if("string"==typeof t&&(t=[t]),!t||0===t.length)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function Ke(e,t,n,r){let o=-1;for(;++o<n.unsafe.length;)if("\n"===n.unsafe[o].character&&We(n.stack,n.unsafe[o]))return/[ \t]/.test(r.before)?"":" ";return"\\\n"}var Je=n(5344);function qe(e,t){return Boolean(!t.options.fences&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Ue(e,t,n){return(n?"":" ")+e}function Ye(e){const t=e.options.quote||'"';if('"'!==t&&"'"!==t)throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Ze(e,t,n,r){const o=function(e){const t=e.options.emphasis||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}(n),i=n.enter("emphasis"),s=n.createTracker(r);let a=s.move(o);return a+=s.move(n.containerPhrasing(e,{before:a,after:o,...s.current()})),a+=s.move(o),i(),a}Ze.peek=function(e,t,n){return n.options.emphasis||"*"};var Ge=n(6641);function Qe(e,t){let n=!1;var r,o,i,s;return r=e,o=e=>{if("value"in e&&/\r?\n|\r/.test(e.value)||"break"===e.type)return n=!0,Ge.dc},"function"==typeof o&&"function"!=typeof i&&(s=i,i=o,o=null),(0,Ge.VG)(r,o,(function(e,t){const n=t[t.length-1];return i(e,n?n.children.indexOf(e):null,n)}),s),Boolean((!e.depth||e.depth<3)&&a(e)&&(t.options.setext||n))}function Xe(e){return e.value||""}function et(e,t,n,r){const o=Ye(n),i='"'===o?"Quote":"Apostrophe",s=n.enter("image");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("![");return c+=l.move(n.safe(e.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":")",...l.current()}))),a(),e.title&&(a=n.enter(`title${i}`),c+=l.move(" "+o),c+=l.move(n.safe(e.title,{before:c,after:o,...l.current()})),c+=l.move(o),a()),c+=l.move(")"),s(),c}function tt(e,t,n,r){const o=e.referenceType,i=n.enter("imageReference");let s=n.enter("label");const a=n.createTracker(r);let l=a.move("![");const c=n.safe(e.alt,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),s();const u=n.stack;n.stack=[],s=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return s(),n.stack=u,i(),"full"!==o&&c&&c===d?"shortcut"===o?l=l.slice(0,-1):l+=a.move("]"):l+=a.move(d+"]"),l}function nt(e){if(!e._compiled){const t=(e.atBreak?"[\\r\\n][\\t ]*":"")+(e.before?"(?:"+e.before+")":"");e._compiled=new RegExp((t?"("+t+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?"\\":"")+e.character+(e.after?"(?:"+e.after+")":""),"g")}return e._compiled}function rt(e,t,n){let r=e.value||"",o="`",i=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(r);)o+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const e=n.unsafe[i],t=nt(e);let o;if(e.atBreak)for(;o=t.exec(r);){let e=o.index;10===r.charCodeAt(e)&&13===r.charCodeAt(e-1)&&e--,r=r.slice(0,e)+" "+r.slice(o.index+1)}}return o+r+o}function ot(e,t){const n=a(e);return Boolean(!t.options.resourceLink&&e.url&&!e.title&&e.children&&1===e.children.length&&"text"===e.children[0].type&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}function it(e,t,n,r){const o=Ye(n),i='"'===o?"Quote":"Apostrophe",s=n.createTracker(r);let a,l;if(ot(e,n)){const t=n.stack;n.stack=[],a=n.enter("autolink");let r=s.move("<");return r+=s.move(n.containerPhrasing(e,{before:r,after:">",...s.current()})),r+=s.move(">"),a(),n.stack=t,r}a=n.enter("link"),l=n.enter("label");let c=s.move("[");return c+=s.move(n.containerPhrasing(e,{before:c,after:"](",...s.current()})),c+=s.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=s.move("<"),c+=s.move(n.safe(e.url,{before:c,after:">",...s.current()})),c+=s.move(">")):(l=n.enter("destinationRaw"),c+=s.move(n.safe(e.url,{before:c,after:e.title?" ":")",...s.current()}))),l(),e.title&&(l=n.enter(`title${i}`),c+=s.move(" "+o),c+=s.move(n.safe(e.title,{before:c,after:o,...s.current()})),c+=s.move(o),l()),c+=s.move(")"),a(),c}function st(e,t,n,r){const o=e.referenceType,i=n.enter("linkReference");let s=n.enter("label");const a=n.createTracker(r);let l=a.move("[");const c=n.containerPhrasing(e,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),s();const u=n.stack;n.stack=[],s=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return s(),n.stack=u,i(),"full"!==o&&c&&c===d?"shortcut"===o?l=l.slice(0,-1):l+=a.move("]"):l+=a.move(d+"]"),l}function at(e){const t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function lt(e){const t=e.options.bulletOrdered||".";if("."!==t&&")"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function ct(e){const t=e.options.rule||"*";if("*"!==t&&"-"!==t&&"_"!==t)throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}Xe.peek=function(){return"<"},et.peek=function(){return"!"},tt.peek=function(){return"!"},rt.peek=function(){return"`"},it.peek=function(e,t,n){return ot(e,n)?"<":"["},st.peek=function(){return"["};const ut=(0,n(5186).C)(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","link","linkReference","strong","text"]);function dt(e,t,n,r){const o=function(e){const t=e.options.strong||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}(n),i=n.enter("strong"),s=n.createTracker(r);let a=s.move(o+o);return a+=s.move(n.containerPhrasing(e,{before:a,after:o,...s.current()})),a+=s.move(o+o),i(),a}dt.peek=function(e,t,n){return n.options.strong||"*"};const ht={blockquote:function(e,t,n,r){const o=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const s=n.indentLines(n.containerFlow(e,i.current()),Ve);return o(),s},break:Ke,code:function(e,t,n,r){const o=function(e){const t=e.options.fence||"`";if("`"!==t&&"~"!==t)throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}(n),i=e.value||"",s="`"===o?"GraveAccent":"Tilde";if(qe(e,n)){const e=n.enter("codeIndented"),t=n.indentLines(i,Ue);return e(),t}const a=n.createTracker(r),l=o.repeat(Math.max((0,Je.D)(i,o)+1,3)),c=n.enter("codeFenced");let u=a.move(l);if(e.lang){const t=n.enter(`codeFencedLang${s}`);u+=a.move(n.safe(e.lang,{before:u,after:" ",encode:["`"],...a.current()})),t()}if(e.lang&&e.meta){const t=n.enter(`codeFencedMeta${s}`);u+=a.move(" "),u+=a.move(n.safe(e.meta,{before:u,after:"\n",encode:["`"],...a.current()})),t()}return u+=a.move("\n"),i&&(u+=a.move(i+"\n")),u+=a.move(l),c(),u},definition:function(e,t,n,r){const o=Ye(n),i='"'===o?"Quote":"Apostrophe",s=n.enter("definition");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("[");return c+=l.move(n.safe(n.associationId(e),{before:c,after:"]",...l.current()})),c+=l.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":"\n",...l.current()}))),a(),e.title&&(a=n.enter(`title${i}`),c+=l.move(" "+o),c+=l.move(n.safe(e.title,{before:c,after:o,...l.current()})),c+=l.move(o),a()),s(),c},emphasis:Ze,hardBreak:Ke,heading:function(e,t,n,r){const o=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(Qe(e,n)){const t=n.enter("headingSetext"),r=n.enter("phrasing"),s=n.containerPhrasing(e,{...i.current(),before:"\n",after:"\n"});return r(),t(),s+"\n"+(1===o?"=":"-").repeat(s.length-(Math.max(s.lastIndexOf("\r"),s.lastIndexOf("\n"))+1))}const s="#".repeat(o),a=n.enter("headingAtx"),l=n.enter("phrasing");i.move(s+" ");let c=n.containerPhrasing(e,{before:"# ",after:"\n",...i.current()});return/^[\t ]/.test(c)&&(c="&#x"+c.charCodeAt(0).toString(16).toUpperCase()+";"+c.slice(1)),c=c?s+" "+c:s,n.options.closeAtx&&(c+=" "+s),l(),a(),c},html:Xe,image:et,imageReference:tt,inlineCode:rt,link:it,linkReference:st,list:function(e,t,n,r){const o=n.enter("list"),i=n.bulletCurrent;let s=e.ordered?lt(n):at(n);const a=e.ordered?function(e){const t=lt(e),n=e.options.bulletOrderedOther;if(!n)return"."===t?")":".";if("."!==n&&")"!==n)throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOrderedOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bulletOrdered` (`"+t+"`) and `bulletOrderedOther` (`"+n+"`) to be different");return n}(n):function(e){const t=at(e),n=e.options.bulletOther;if(!n)return"*"===t?"-":"*";if("*"!==n&&"+"!==n&&"-"!==n)throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}(n),l=n.bulletLastUsed;let c=!1;if(t&&(e.ordered?n.options.bulletOrderedOther:n.options.bulletOther)&&l&&s===l&&(c=!0),!e.ordered){const t=e.children?e.children[0]:void 0;if("*"!==s&&"-"!==s||!t||t.children&&t.children[0]||"list"!==n.stack[n.stack.length-1]||"listItem"!==n.stack[n.stack.length-2]||"list"!==n.stack[n.stack.length-3]||"listItem"!==n.stack[n.stack.length-4]||0!==n.indexStack[n.indexStack.length-1]||0!==n.indexStack[n.indexStack.length-2]||0!==n.indexStack[n.indexStack.length-3]||(c=!0),ct(n)===s&&t){let t=-1;for(;++t<e.children.length;){const n=e.children[t];if(n&&"listItem"===n.type&&n.children&&n.children[0]&&"thematicBreak"===n.children[0].type){c=!0;break}}}}c&&(s=a),n.bulletCurrent=s;const u=n.containerFlow(e,r);return n.bulletLastUsed=s,n.bulletCurrent=i,o(),u},listItem:function(e,t,n,r){const o=function(e){const t=e.options.listItemIndent||"tab";if(1===t||"1"===t)return"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(n);let i=n.bulletCurrent||at(n);t&&"list"===t.type&&t.ordered&&(i=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+i);let s=i.length+1;("tab"===o||"mixed"===o&&(t&&"list"===t.type&&t.spread||e.spread))&&(s=4*Math.ceil(s/4));const a=n.createTracker(r);a.move(i+" ".repeat(s-i.length)),a.shift(s);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,a.current()),(function(e,t,n){return t?(n?"":" ".repeat(s))+e:(n?i:i+" ".repeat(s-i.length))+e}));return l(),c},paragraph:function(e,t,n,r){const o=n.enter("paragraph"),i=n.enter("phrasing"),s=n.containerPhrasing(e,r);return i(),o(),s},root:function(e,t,n,r){const o=e.children.some((e=>ut(e)));return(o?n.containerPhrasing:n.containerFlow).call(n,e,r)},strong:dt,text:function(e,t,n,r){return n.safe(e.value,r)},thematicBreak:function(e,t,n){const r=(ct(n)+(n.options.ruleSpaces?" ":"")).repeat(function(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}(n));return n.options.ruleSpaces?r.slice(0,-1):r}},pt=[function(e,t,n,r){if("code"===t.type&&qe(t,r)&&("list"===e.type||e.type===t.type&&qe(e,r)))return!1;if("list"===e.type&&e.type===t.type&&Boolean(e.ordered)===Boolean(t.ordered)&&!(e.ordered?r.options.bulletOrderedOther:r.options.bulletOther))return!1;if("spread"in n&&"boolean"==typeof n.spread){if("paragraph"===e.type&&(e.type===t.type||"definition"===t.type||"heading"===t.type&&Qe(t,r)))return;return n.spread?1:0}}],ft=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],mt=[{character:"\t",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"\t",before:"[\\r\\n]",inConstruct:"phrasing"},{character:"\t",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:"\n",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:ft},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:"(?:[\r\n]|$)"},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:ft},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:"(?:[ \t\r\n*])"},{character:"*",inConstruct:"phrasing",notInConstruct:ft},{atBreak:!0,character:"+",after:"(?:[ \t\r\n])"},{atBreak:!0,character:"-",after:"(?:[ \t\r\n-])"},{atBreak:!0,before:"\\d+",character:".",after:"(?:[ \t\r\n]|$)"},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:ft},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:ft},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:ft},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:ft},{atBreak:!0,character:"~"}];function gt(e){return e.label||!e.identifier?e.label||"":(0,Ae.s)(e.identifier)}function yt(e,t,n,r){let o=r.join.length;for(;o--;){const i=r.join[o](e,t,n,r);if(!0===i||1===i)break;if("number"==typeof i)return"\n".repeat(1+i);if(!1===i)return"\n\n\x3c!----\x3e\n\n"}return"\n\n"}const vt=/\r?\n|\r/g;function wt(e,t){const n=[];let r,o=0,i=0;for(;r=vt.exec(e);)s(e.slice(o,r.index)),n.push(r[0]),o=r.index+r[0].length,i++;return s(e.slice(o)),n.join("");function s(e){n.push(t(e,i,!e))}}function kt(e,t){return e-t}function bt(e,t){const n=/\\(?=[!-/:-@[-`{-~])/g,r=[],o=[],i=e+t;let s,a=-1,l=0;for(;s=n.exec(i);)r.push(s.index);for(;++a<r.length;)l!==r[a]&&o.push(e.slice(l,r[a])),o.push("\\"),l=r[a];return o.push(e.slice(l)),o.join("")}function xt(e){const t=e||{},n=t.now||{};let r=t.lineShift||0,o=n.line||1,i=n.column||1;return{move:function(e){const t=e||"",n=t.split(/\r?\n|\r/g),s=n[n.length-1];return o+=n.length-1,i=1===n.length?i+s.length:1+s.length+r,t},current:function(){return{now:{line:o,column:i},lineShift:r}},shift:function(e){r+=e}}}function Ct(e){throw new Error("Cannot handle value `"+e+"`, expected node")}function St(e){throw new Error("Cannot handle unknown node `"+e.type+"`")}function Mt(e,t){if("definition"===e.type&&e.type===t.type)return 0}function Nt(e,t){return function(e,t,n){const r=t.indexStack,o=e.children||[],i=[];let s=-1,a=n.before;r.push(-1);let l=t.createTracker(n);for(;++s<o.length;){const c=o[s];let u;if(r[r.length-1]=s,s+1<o.length){let n=t.handle.handlers[o[s+1].type];n&&n.peek&&(n=n.peek),u=n?n(o[s+1],e,t,{before:"",after:"",...l.current()}).charAt(0):""}else u=n.after;i.length>0&&("\r"===a||"\n"===a)&&"html"===c.type&&(i[i.length-1]=i[i.length-1].replace(/(\r?\n|\r)$/," "),a=" ",l=t.createTracker(n),l.move(i.join(""))),i.push(l.move(t.handle(c,e,t,{...l.current(),before:a,after:u}))),a=i[i.length-1].slice(-1)}return r.pop(),i.join("")}(e,this,t)}function Ot(e,t){return function(e,t,n){const r=t.indexStack,o=e.children||[],i=t.createTracker(n),s=[];let a=-1;for(r.push(-1);++a<o.length;){const n=o[a];r[r.length-1]=a,s.push(i.move(t.handle(n,e,t,{before:"\n",after:"\n",...i.current()}))),"list"!==n.type&&(t.bulletLastUsed=void 0),a<o.length-1&&s.push(i.move(yt(n,o[a+1],e,t)))}return r.pop(),s.join("")}(e,this,t)}function At(e,t){return function(e,t,n){const r=(n.before||"")+(t||"")+(n.after||""),o=[],i=[],s={};let a=-1;for(;++a<e.unsafe.length;){const t=e.unsafe[a];if(!We(e.stack,t))continue;const n=nt(t);let i;for(;i=n.exec(r);){const e="before"in t||Boolean(t.atBreak),n="after"in t,r=i.index+(e?i[1].length:0);o.includes(r)?(s[r].before&&!e&&(s[r].before=!1),s[r].after&&!n&&(s[r].after=!1)):(o.push(r),s[r]={before:e,after:n})}}o.sort(kt);let l=n.before?n.before.length:0;const c=r.length-(n.after?n.after.length:0);for(a=-1;++a<o.length;){const e=o[a];e<l||e>=c||e+1<c&&o[a+1]===e+1&&s[e].after&&!s[e+1].before&&!s[e+1].after||o[a-1]===e-1&&s[e].before&&!s[e-1].before&&!s[e-1].after||(l!==e&&i.push(bt(r.slice(l,e),"\\")),l=e,!/[!-/:-@[-`{-~]/.test(r.charAt(e))||n.encode&&n.encode.includes(r.charAt(e))?(i.push("&#x"+r.charCodeAt(e).toString(16).toUpperCase()+";"),l++):i.push("\\"))}return i.push(bt(r.slice(l,c),n.after)),i.join("")}(this,e,t)}function Et(e){Object.assign(this,{Compiler:t=>{const n=this.data("settings");return function(e,t={}){const n={enter:function(e){return n.stack.push(e),function(){n.stack.pop()}},indentLines:wt,associationId:gt,containerPhrasing:Nt,containerFlow:Ot,createTracker:xt,safe:At,stack:[],unsafe:[],join:[],handlers:{},options:{},indexStack:[],handle:void 0};_e(n,{unsafe:mt,join:pt,handlers:ht}),_e(n,t),n.options.tightDefinitions&&_e(n,{join:[Mt]}),n.handle=function(e,t){const n=t||{};function r(t,...n){let o=r.invalid;const i=r.handlers;if(t&&je.call(t,e)){const n=String(t[e]);o=je.call(i,n)?i[n]:r.unknown}if(o)return o.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}("type",{invalid:Ct,unknown:St,handlers:n.handlers});let r=n.handle(e,void 0,n,{before:"\n",after:"\n",now:{line:1,column:1},lineShift:0});return r&&10!==r.charCodeAt(r.length-1)&&13!==r.charCodeAt(r.length-1)&&(r+="\n"),r}(t,Object.assign({},n,e,{extensions:this.data("toMarkdownExtensions")||[]}))}})}var Dt=n(659),Tt=n(6325),Ft=n(9710);function It(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)}var Rt=n(4934);function Pt(e){return Lt(e&&e.line)+":"+Lt(e&&e.column)}function Bt(e){return Pt(e&&e.start)+"-"+Pt(e&&e.end)}function Lt(e){return e&&"number"==typeof e?e:1}class zt extends Error{constructor(e,t,n){const r=[null,null];let o={start:{line:null,column:null},end:{line:null,column:null}};if(super(),"string"==typeof t&&(n=t,t=void 0),"string"==typeof n){const e=n.indexOf(":");-1===e?r[1]=n:(r[0]=n.slice(0,e),r[1]=n.slice(e+1))}var i;t&&("type"in t||"position"in t?t.position&&(o=t.position):"start"in t||"end"in t?o=t:("line"in t||"column"in t)&&(o.start=t)),this.name=((i=t)&&"object"==typeof i?"position"in i||"type"in i?Bt(i.position):"start"in i||"end"in i?Bt(i):"line"in i||"column"in i?Pt(i):"":"")||"1:1",this.message="object"==typeof e?e.message:e,this.stack="","object"==typeof e&&e.stack&&(this.stack=e.stack),this.reason=this.message,this.fatal,this.line=o.start.line,this.column=o.start.column,this.position=o,this.source=r[0],this.ruleId=r[1],this.file,this.actual,this.expected,this.url,this.note}}zt.prototype.file="",zt.prototype.name="",zt.prototype.reason="",zt.prototype.message="",zt.prototype.stack="",zt.prototype.fatal=null,zt.prototype.column=null,zt.prototype.line=null,zt.prototype.source=null,zt.prototype.ruleId=null,zt.prototype.position=null;const $t=function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');Ht(e);let n,r=0,o=-1,i=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;i--;)if(47===e.charCodeAt(i)){if(n){r=i+1;break}}else o<0&&(n=!0,o=i+1);return o<0?"":e.slice(r,o)}if(t===e)return"";let s=-1,a=t.length-1;for(;i--;)if(47===e.charCodeAt(i)){if(n){r=i+1;break}}else s<0&&(n=!0,s=i+1),a>-1&&(e.charCodeAt(i)===t.charCodeAt(a--)?a<0&&(o=i):(a=-1,o=s));return r===o?o=s:o<0&&(o=e.length),e.slice(r,o)},jt=function(e){if(Ht(e),0===e.length)return".";let t,n=-1,r=e.length;for(;--r;)if(47===e.charCodeAt(r)){if(t){n=r;break}}else t||(t=!0);return n<0?47===e.charCodeAt(0)?"/":".":1===n&&47===e.charCodeAt(0)?"//":e.slice(0,n)},_t=function(e){Ht(e);let t,n=e.length,r=-1,o=0,i=-1,s=0;for(;n--;){const a=e.charCodeAt(n);if(47!==a)r<0&&(t=!0,r=n+1),46===a?i<0?i=n:1!==s&&(s=1):i>-1&&(s=-1);else if(t){o=n+1;break}}return i<0||r<0||0===s||1===s&&i===r-1&&i===o+1?"":e.slice(i,r)},Vt=function(...e){let t,n=-1;for(;++n<e.length;)Ht(e[n]),e[n]&&(t=void 0===t?e[n]:t+"/"+e[n]);return void 0===t?".":function(e){Ht(e);const t=47===e.charCodeAt(0);let n=function(e,t){let n,r,o="",i=0,s=-1,a=0,l=-1;for(;++l<=e.length;){if(l<e.length)n=e.charCodeAt(l);else{if(47===n)break;n=47}if(47===n){if(s===l-1||1===a);else if(s!==l-1&&2===a){if(o.length<2||2!==i||46!==o.charCodeAt(o.length-1)||46!==o.charCodeAt(o.length-2))if(o.length>2){if(r=o.lastIndexOf("/"),r!==o.length-1){r<0?(o="",i=0):(o=o.slice(0,r),i=o.length-1-o.lastIndexOf("/")),s=l,a=0;continue}}else if(o.length>0){o="",i=0,s=l,a=0;continue}t&&(o=o.length>0?o+"/..":"..",i=2)}else o.length>0?o+="/"+e.slice(s+1,l):o=e.slice(s+1,l),i=l-s-1;s=l,a=0}else 46===n&&a>-1?a++:a=-1}return o}(e,!t);return 0!==n.length||t||(n="."),n.length>0&&47===e.charCodeAt(e.length-1)&&(n+="/"),t?"/"+n:n}(t)},Wt="/";function Ht(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Kt=function(){return"/"};function Jt(e){return null!==e&&"object"==typeof e&&e.href&&e.origin}const qt=["history","path","basename","stem","extname","dirname"];class Ut{constructor(e){let t;t=e?"string"==typeof e||function(e){return Tt(e)}(e)?{value:e}:Jt(e)?{path:e}:e:{},this.data={},this.messages=[],this.history=[],this.cwd=Kt(),this.value,this.stored,this.result,this.map;let n,r=-1;for(;++r<qt.length;){const e=qt[r];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(n in t)qt.includes(n)||(this[n]=t[n])}get path(){return this.history[this.history.length-1]}set path(e){Jt(e)&&(e=function(e){if("string"==typeof e)e=new URL(e);else if(!Jt(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if("file:"!==e.protocol){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){const e=new TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}const t=e.pathname;let n=-1;for(;++n<t.length;)if(37===t.charCodeAt(n)&&50===t.charCodeAt(n+1)){const e=t.charCodeAt(n+2);if(70===e||102===e){const e=new TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}(e)),Zt(e,"path"),this.path!==e&&this.history.push(e)}get dirname(){return"string"==typeof this.path?jt(this.path):void 0}set dirname(e){Gt(this.basename,"dirname"),this.path=Vt(e||"",this.basename)}get basename(){return"string"==typeof this.path?$t(this.path):void 0}set basename(e){Zt(e,"basename"),Yt(e,"basename"),this.path=Vt(this.dirname||"",e)}get extname(){return"string"==typeof this.path?_t(this.path):void 0}set extname(e){if(Yt(e,"extname"),Gt(this.dirname,"extname"),e){if(46!==e.charCodeAt(0))throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Vt(this.dirname,this.stem+(e||""))}get stem(){return"string"==typeof this.path?$t(this.path,this.extname):void 0}set stem(e){Zt(e,"stem"),Yt(e,"stem"),this.path=Vt(this.dirname||"",e+(this.extname||""))}toString(e){return(this.value||"").toString(e||void 0)}message(e,t,n){const r=new zt(e,t,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}info(e,t,n){const r=this.message(e,t,n);return r.fatal=null,r}fail(e,t,n){const r=this.message(e,t,n);throw r.fatal=!0,r}}function Yt(e,t){if(e&&e.includes(Wt))throw new Error("`"+t+"` cannot be a path: did not expect `"+Wt+"`")}function Zt(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Gt(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}const Qt=function e(){const t=(0,Rt.S)(),n=[];let r,o={},i=-1;return s.data=function(e,t){return"string"==typeof e?2===arguments.length?(rn("data",r),o[e]=t,s):Xt.call(o,e)&&o[e]||null:e?(rn("data",r),o=e,s):o},s.Parser=void 0,s.Compiler=void 0,s.freeze=function(){if(r)return s;for(;++i<n.length;){const[e,...r]=n[i];if(!1===r[0])continue;!0===r[0]&&(r[0]=void 0);const o=e.call(s,...r);"function"==typeof o&&t.use(o)}return r=!0,i=Number.POSITIVE_INFINITY,s},s.attachers=n,s.use=function(e,...t){let i;if(rn("use",r),null==e);else if("function"==typeof e)u(e,...t);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");Array.isArray(e)?c(e):l(e)}return i&&(o.settings=Object.assign(o.settings||{},i)),s;function a(e){if("function"==typeof e)u(e);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");if(Array.isArray(e)){const[t,...n]=e;u(t,...n)}else l(e)}}function l(e){c(e.plugins),e.settings&&(i=Object.assign(i||{},e.settings))}function c(e){let t=-1;if(null==e);else{if(!Array.isArray(e))throw new TypeError("Expected a list of plugins, not `"+e+"`");for(;++t<e.length;)a(e[t])}}function u(e,t){let r,o=-1;for(;++o<n.length;)if(n[o][0]===e){r=n[o];break}r?(It(r[1])&&It(t)&&(t=Ft(!0,r[1],t)),r[1]=t):n.push([...arguments])}},s.parse=function(e){s.freeze();const t=an(e),n=s.Parser;return tn("parse",n),en(n,"parse")?new n(String(t),t).parse():n(String(t),t)},s.stringify=function(e,t){s.freeze();const n=an(t),r=s.Compiler;return nn("stringify",r),on(e),en(r,"compile")?new r(e,n).compile():r(e,n)},s.run=function(e,n,r){if(on(e),s.freeze(),r||"function"!=typeof n||(r=n,n=void 0),!r)return new Promise(o);function o(o,i){t.run(e,an(n),(function(t,n,s){n=n||e,t?i(t):o?o(n):r(null,n,s)}))}o(null,r)},s.runSync=function(e,t){let n,r;return s.run(e,t,(function(e,t){(0,Dt.V)(e),n=t,r=!0})),sn("runSync","run",r),n},s.process=function(e,t){if(s.freeze(),tn("process",s.Parser),nn("process",s.Compiler),!t)return new Promise(n);function n(n,r){const o=an(e);function i(e,o){e||!o?r(e):n?n(o):t(null,o)}s.run(s.parse(o),o,((e,t,n)=>{if(!e&&t&&n){const o=s.stringify(t,n);null==o||("string"==typeof(r=o)||Tt(r)?n.value=o:n.result=o),i(e,n)}else i(e);var r}))}n(null,t)},s.processSync=function(e){let t;s.freeze(),tn("processSync",s.Parser),nn("processSync",s.Compiler);const n=an(e);return s.process(n,(function(e){t=!0,(0,Dt.V)(e)})),sn("processSync","process",t),n},s;function s(){const t=e();let r=-1;for(;++r<n.length;)t.use(...n[r]);return t.data(Ft(!0,{},o)),t}}().freeze(),Xt={}.hasOwnProperty;function en(e,t){return"function"==typeof e&&e.prototype&&(function(e){let t;for(t in e)if(Xt.call(e,t))return!0;return!1}(e.prototype)||t in e.prototype)}function tn(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `Parser`")}function nn(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `Compiler`")}function rn(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function on(e){if(!It(e)||"string"!=typeof e.type)throw new TypeError("Expected node, got `"+e+"`")}function sn(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function an(e){return function(e){return Boolean(e&&"object"==typeof e&&"message"in e&&"messages"in e)}(e)?e:new Ut(e)}var ln,cn,un,dn,hn,pn,fn,mn=n(1440),gn=Object.defineProperty,yn=(e,t,n)=>(((e,t,n)=>{t in e?gn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n),vn=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},wn=(e,t,n)=>(vn(e,t,"read from private field"),n?n.call(e):t.get(e)),kn=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},bn=(e,t,n,r)=>(vn(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class xn{}class Cn{constructor(){yn(this,"elements",[]),yn(this,"size",(()=>this.elements.length)),yn(this,"top",(()=>this.elements.at(-1))),yn(this,"push",(e=>{var t;null==(t=this.top())||t.push(e)})),yn(this,"open",(e=>{this.elements.push(e)})),yn(this,"close",(()=>{const e=this.elements.pop();if(!e)throw(0,mn.TR)();return e}))}}class Sn extends xn{constructor(e,t,n){super(),this.type=e,this.content=t,this.attrs=n}push(e,...t){this.content.push(e,...t)}pop(){return this.content.pop()}static create(e,t,n){return new Sn(e,t,n)}}const Mn=class extends Cn{constructor(e){super(),yn(this,"schema"),kn(this,ln,i.CU.none),kn(this,cn,(e=>e.isText)),kn(this,un,((e,t)=>{if(wn(this,cn).call(this,e)&&wn(this,cn).call(this,t)&&i.CU.sameSet(e.marks,t.marks))return this.schema.text(e.text+t.text,e.marks)})),kn(this,dn,(e=>{const t=Object.values({...this.schema.nodes,...this.schema.marks}).find((t=>t.spec.parseMarkdown.match(e)));if(!t)throw(0,mn.Xm)(e);return t})),kn(this,hn,(e=>{const t=wn(this,dn).call(this,e);t.spec.parseMarkdown.runner(this,e,t)})),yn(this,"injectRoot",((e,t,n)=>(this.openNode(t,n),this.next(e.children),this))),yn(this,"openNode",((e,t)=>(this.open(Sn.create(e,[],t)),this))),kn(this,pn,(()=>{bn(this,ln,i.CU.none);const e=this.close();return wn(this,fn).call(this,e.type,e.attrs,e.content)})),yn(this,"closeNode",(()=>(wn(this,pn).call(this),this))),kn(this,fn,((e,t,n)=>{const r=e.createAndFill(t,n,wn(this,ln));if(!r)throw(0,mn.$D)(e,t,n);return this.push(r),r})),yn(this,"addNode",((e,t,n)=>(wn(this,fn).call(this,e,t,n),this))),yn(this,"openMark",((e,t)=>{const n=e.create(t);return bn(this,ln,n.addToSet(wn(this,ln))),this})),yn(this,"closeMark",(e=>(bn(this,ln,e.removeFromSet(wn(this,ln))),this))),yn(this,"addText",(e=>{const t=this.top();if(!t)throw(0,mn.TR)();const n=t.pop(),r=this.schema.text(e,wn(this,ln));if(!n)return t.push(r),this;const o=wn(this,un).call(this,n,r);return o?(t.push(o),this):(t.push(n,r),this)})),yn(this,"build",(()=>{let e;do{e=wn(this,pn).call(this)}while(this.size());return e})),yn(this,"next",((e=[])=>([e].flat().forEach((e=>wn(this,hn).call(this,e))),this))),yn(this,"toDoc",(()=>this.build())),yn(this,"run",((e,t)=>{const n=e.runSync(e.parse(t),t);return this.next(n),this})),this.schema=e}};let Nn=Mn;ln=new WeakMap,cn=new WeakMap,un=new WeakMap,dn=new WeakMap,hn=new WeakMap,pn=new WeakMap,fn=new WeakMap,yn(Nn,"create",((e,t)=>{const n=new Mn(e);return e=>(n.run(t,e),n.toDoc())}));const On=class extends xn{constructor(e,t,n,r={}){super(),yn(this,"push",((e,...t)=>{this.children||(this.children=[]),this.children.push(e,...t)})),yn(this,"pop",(()=>{var e;return null==(e=this.children)?void 0:e.pop()})),this.type=e,this.children=t,this.value=n,this.props=r}};let An=On;var En,Dn,Tn,Fn,In,Rn,Pn,Bn,Ln,zn,$n,jn;yn(An,"create",((e,t,n,r={})=>new On(e,t,n,r)));const _n=class extends Cn{constructor(e){super(),kn(this,En,i.CU.none),yn(this,"schema"),kn(this,Dn,(e=>{const t=Object.values({...this.schema.nodes,...this.schema.marks}).find((t=>t.spec.toMarkdown.match(e)));if(!t)throw(0,mn._K)(e.type);return t})),kn(this,Tn,(e=>wn(this,Dn).call(this,e).spec.toMarkdown.runner(this,e))),kn(this,Fn,((e,t)=>wn(this,Dn).call(this,e).spec.toMarkdown.runner(this,e,t))),kn(this,In,(e=>{const{marks:t}=e,n=e=>e.type.spec.priority??50;[...t].sort(((e,t)=>n(e)-n(t))).every((t=>!wn(this,Fn).call(this,t,e)))&&wn(this,Tn).call(this,e),t.forEach((e=>wn(this,jn).call(this,e)))})),kn(this,Rn,((e,t)=>{var n;if(e.type===t||1!==(null==(n=e.children)?void 0:n.length))return e;const r=e=>{var n;if(e.type===t)return e;if(1!==(null==(n=e.children)?void 0:n.length))return null;const[o]=e.children;return o?r(o):null},o=r(e);if(!o)return e;const i=o.children?[...o.children]:void 0,s={...e,children:i};return s.children=i,o.children=[s],o})),kn(this,Pn,(e=>{const{children:t}=e;return t&&(e.children=t.reduce(((e,t,n)=>{if(0===n)return[t];const r=e.at(-1);if(r&&r.isMark&&t.isMark){t=wn(this,Rn).call(this,t,r.type);const{children:n,...o}=t,{children:i,...s}=r;if(t.type===r.type&&n&&i&&JSON.stringify(o)===JSON.stringify(s)){const t={...s,children:[...i,...n]};return e.slice(0,-1).concat(wn(this,Pn).call(this,t))}}return e.concat(t)}),[])),e})),kn(this,Bn,(e=>{const t={...e.props,type:e.type};return e.children&&(t.children=e.children),e.value&&(t.value=e.value),t})),yn(this,"openNode",((e,t,n)=>(this.open(An.create(e,void 0,t,n)),this))),kn(this,Ln,(()=>{const e=this.close();return wn(this,zn).call(this,e.type,e.children,e.value,e.props)})),yn(this,"closeNode",(()=>(wn(this,Ln).call(this),this))),kn(this,zn,((e,t,n,r)=>{const o=An.create(e,t,n,r),i=wn(this,Pn).call(this,wn(this,Bn).call(this,o));return this.push(i),i})),yn(this,"addNode",((e,t,n,r)=>(wn(this,zn).call(this,e,t,n,r),this))),kn(this,$n,((e,t,n,r)=>e.isInSet(wn(this,En))?this:(bn(this,En,e.addToSet(wn(this,En))),this.openNode(t,n,{...r,isMark:!0})))),kn(this,jn,(e=>{!e.isInSet(wn(this,En))||(bn(this,En,e.type.removeFromSet(wn(this,En))),wn(this,Ln).call(this))})),yn(this,"withMark",((e,t,n,r)=>(wn(this,$n).call(this,e,t,n,r),this))),yn(this,"closeMark",(e=>(wn(this,jn).call(this,e),this))),yn(this,"build",(()=>{let e=null;do{e=wn(this,Ln).call(this)}while(this.size());return e})),yn(this,"next",(e=>{return t=e,Object.prototype.hasOwnProperty.call(t,"size")?(e.forEach((e=>{wn(this,In).call(this,e)})),this):(wn(this,In).call(this,e),this);var t})),yn(this,"toString",(e=>e.stringify(this.build()))),yn(this,"run",(e=>(this.next(e),this))),this.schema=e}};let Vn=_n;En=new WeakMap,Dn=new WeakMap,Tn=new WeakMap,Fn=new WeakMap,In=new WeakMap,Rn=new WeakMap,Pn=new WeakMap,Bn=new WeakMap,Ln=new WeakMap,zn=new WeakMap,$n=new WeakMap,jn=new WeakMap,yn(Vn,"create",((e,t)=>{const n=new _n(e);return e=>(n.run(e),n.toString(t))}));var Wn=n(1570),Hn=n(3686),Kn=n(4254),Jn=n(5715),qn=n(5939),Un=Object.defineProperty,Yn=(e,t,n)=>(((e,t,n)=>{t in e?Un(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n),Zn=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Gn=(e,t,n)=>(Zn(e,t,"read from private field"),n?n.call(e):t.get(e)),Qn=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Xn=(e,t,n,r)=>(Zn(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);const er=(e,t)=>(e.meta={package:"@milkdown/core",group:"System",...t},e),tr=(0,o.CR)("ConfigReady"),nr=(0,o.CR)("InitReady"),rr=(0,o.Z0)([],"initTimer"),or=(0,o.Z0)({},"editor"),ir=(0,o.Z0)([],"inputRules"),sr=(0,o.Z0)([],"prosePlugins"),ar=(0,o.Z0)([],"remarkPlugins"),lr=(0,o.Z0)([],"nodeView"),cr=(0,o.Z0)([],"markView"),ur=(0,o.Z0)(Qt().use($e).use(Et),"remark"),dr=(0,o.Z0)({},"remarkStringifyOptions"),hr=e=>{const t=t=>(t.inject(or,e).inject(sr).inject(ar).inject(ir).inject(lr).inject(cr).inject(dr).inject(ur,Qt().use($e).use(Et)).inject(rr,[tr]).record(nr),async()=>{await t.waitTimers(rr);const e=t.get(dr);return t.set(ur,Qt().use($e).use(Et,e)),t.done(nr),()=>{t.remove(or).remove(sr).remove(ar).remove(ir).remove(lr).remove(cr).remove(dr).remove(ur).remove(rr).clearTimer(nr)}});return er(t,{displayName:"Init"}),t},pr=(0,o.CR)("SchemaReady"),fr=(0,o.Z0)([],"schemaTimer"),mr=(0,o.Z0)({},"schema"),gr=(0,o.Z0)([],"nodes"),yr=(0,o.Z0)([],"marks"),vr=e=>{var t;return{...e,parseDOM:null==(t=e.parseDOM)?void 0:t.map((t=>({priority:e.priority,...t})))}},wr=e=>(e.inject(mr).inject(gr).inject(yr).inject(fr,[nr]).record(pr),async()=>{await e.waitTimers(fr);const t=e.get(ur),n=e.get(ar).reduce(((e,t)=>e.use(t)),t);e.set(ur,n);const r=Object.fromEntries(e.get(gr).map((([e,t])=>[e,vr(t)]))),o=Object.fromEntries(e.get(yr).map((([e,t])=>[e,vr(t)])));return e.set(mr,new i.Sj({nodes:r,marks:o})),e.done(pr),()=>{e.remove(mr).remove(gr).remove(yr).remove(fr).clearTimer(pr)}});er(wr,{displayName:"Schema"});const kr=(0,o.CR)("ParserReady"),br=(0,o.Z0)((()=>{throw(0,mn.dI)()}),"parser"),xr=(0,o.Z0)([],"parserTimer"),Cr=e=>(e.inject(br).inject(xr,[pr]).record(kr),async()=>{await e.waitTimers(xr);const t=e.get(ur),n=e.get(mr);return e.set(br,Nn.create(n,t)),e.done(kr),()=>{e.remove(br).remove(xr).clearTimer(kr)}});er(Cr,{displayName:"Parser"});const Sr=(0,o.CR)("SerializerReady"),Mr=(0,o.Z0)([],"serializerTimer"),Nr=(0,o.Z0)((()=>""),"serializer"),Or=e=>(e.inject(Nr).inject(Mr,[pr]).record(Sr),async()=>{await e.waitTimers(Mr);const t=e.get(ur),n=e.get(mr);return e.set(Nr,Vn.create(n,t)),e.done(Sr),()=>{e.remove(Nr).remove(Mr).clearTimer(Sr)}});er(Or,{displayName:"Serializer"});const Ar=(0,o.Z0)("","defaultValue"),Er=(0,o.Z0)({},"editorState"),Dr=(0,o.Z0)((e=>e),"stateOptions"),Tr=(0,o.Z0)([],"editorStateTimer"),Fr=(0,o.CR)("EditorStateReady"),Ir=new Wn.hs("MILKDOWN_STATE_TRACKER"),Rr=e=>(e.inject(Ar).inject(Er).inject(Dr).inject(Tr,[kr,Sr,Yr]).record(Fr),async()=>{await e.waitTimers(Tr);const t=e.get(mr),n=e.get(br),r=e.get(ir),o=e.get(Dr),s=e.get(sr),a=((e,t,n)=>{if("string"==typeof e)return t(e);if("html"===e.type)return i.S4.fromSchema(n).parse(e.dom);if("json"===e.type)return i.bP.fromJSON(n,e.value);throw(0,mn.j7)(e)})(e.get(Ar),n,t),l=[...s,new Wn.k_({key:Ir,state:{init:()=>{},apply:(t,n,r,o)=>{e.set(Er,o)}}}),(0,Kn.Z6)({rules:r}),(0,qn.w)(Jn.RV)];e.set(sr,l);const c=o({schema:t,doc:a,plugins:l}),u=Wn.$t.create(c);return e.set(Er,u),e.done(Fr),()=>{e.remove(Ar).remove(Er).remove(Dr).remove(Tr).clearTimer(Fr)}});er(Rr,{displayName:"EditorState"});const Pr=(0,o.CR)("EditorViewReady"),Br=(0,o.Z0)({},"editorView"),Lr=(0,o.Z0)([],"editorViewTimer"),zr=(0,o.Z0)({},"editorViewOptions"),$r=(0,o.Z0)(null,"root"),jr=(0,o.Z0)(null,"rootDOM"),_r=(0,o.Z0)({},"rootAttrs"),Vr=new Wn.hs("MILKDOWN_VIEW_CLEAR"),Wr=e=>(e.inject($r,document.body).inject(Br).inject(zr).inject(jr).inject(_r).inject(Lr,[Fr]).record(Pr),async()=>{await e.wait(nr);const t=e.get($r)||document.body,n="string"==typeof t?document.querySelector(t):t;e.update(sr,(t=>[new Wn.k_({key:Vr,view:t=>{const r=n?((e,t)=>{const n=document.createElement("div");n.className="milkdown",e.appendChild(n),t.set(jr,n);const r=t.get(_r);return Object.entries(r).forEach((([e,t])=>n.setAttribute(e,t))),n})(n,e):void 0;return(()=>{if(r&&n){const e=t.dom;n.replaceChild(r,e),r.appendChild(e)}})(),{destroy:()=>{null!=r&&r.parentNode&&(null==r||r.parentNode.replaceChild(t.dom,r)),null==r||r.remove()}}}}),...t])),await e.waitTimers(Lr);const r=e.get(Er),o=e.get(zr),i=Object.fromEntries(e.get(lr)),s=Object.fromEntries(e.get(cr)),a=new Hn.Lz(n,{state:r,nodeViews:i,markViews:s,...o});return(e=>{e.classList.add("editor"),e.setAttribute("role","textbox")})(a.dom),e.set(Br,a),e.done(Pr),()=>{null==a||a.destroy(),e.remove($r).remove(Br).remove(zr).remove(jr).remove(_r).remove(Lr).clearTimer(Pr)}});var Hr,Kr;er(Wr,{displayName:"EditorView"}),Hr=new WeakMap,Kr=new WeakMap;const Jr=(e="cmdKey")=>(0,o.Z0)((()=>()=>!1),e),qr=(0,o.Z0)(new class{constructor(){Qn(this,Hr,new o.mc),Qn(this,Kr,null),Yn(this,"setCtx",(e=>{Xn(this,Kr,e)}))}create(e,t){const n=e.create(Gn(this,Hr).sliceMap);return n.set(t),n}get(e){return Gn(this,Hr).get(e).get()}remove(e){return Gn(this,Hr).remove(e)}call(e,t){if(null==Gn(this,Kr))throw(0,mn.zD)();const n=this.get(e)(t),r=Gn(this,Kr).get(Br);return n(r.state,r.dispatch,r)}},"commands"),Ur=(0,o.Z0)([pr],"commandsTimer"),Yr=(0,o.CR)("CommandsReady"),Zr=e=>(e.inject(qr).inject(Ur).record(Yr),e.get(qr).setCtx(e),async()=>(await e.waitTimers(Ur),e.done(Yr),()=>{e.remove(qr).remove(Ur).clearTimer(Yr)}));var Gr,Qr,Xr,eo,to,no,ro,oo,io,so,ao,lo,co,uo,ho;er(Zr,{displayName:"Commands"});const po=class{constructor(){Qn(this,Gr,!1),Qn(this,Qr,"Idle"),Qn(this,Xr,[]),Qn(this,eo,(()=>{})),Qn(this,to,new o.mc),Qn(this,no,new o.zD),Qn(this,ro,new Map),Qn(this,oo,new Map),Qn(this,io,new o.Kj(Gn(this,to),Gn(this,no))),Qn(this,so,(()=>{const e=(e=>{const t=t=>(t.record(tr),async()=>(await e(t),t.done(tr),()=>{t.clearTimer(tr)}));return er(t,{displayName:"Config"}),t})((async e=>{await Promise.all(Gn(this,Xr).map((t=>t(e))))})),t=[wr,Cr,Or,Zr,Rr,Wr,hr(this),e];Gn(this,ao).call(this,t,Gn(this,oo))})),Qn(this,ao,((e,t)=>{e.forEach((e=>{const n=Gn(this,io).produce(Gn(this,Gr)?e.meta:void 0),r=e(n);t.set(e,{ctx:n,handler:r,cleanup:void 0})}))})),Qn(this,lo,((e,t=!1)=>Promise.all([e].flat().map((e=>{const n=Gn(this,ro).get(e),r=null==n?void 0:n.cleanup;return t?Gn(this,ro).delete(e):Gn(this,ro).set(e,{ctx:void 0,handler:void 0,cleanup:void 0}),"function"==typeof r?r():r}))))),Qn(this,co,(async()=>{await Promise.all([...Gn(this,oo).entries()].map((([e,{cleanup:t}])=>"function"==typeof t?t():t))),Gn(this,oo).clear()})),Qn(this,uo,(e=>{Xn(this,Qr,e),Gn(this,eo).call(this,e)})),Qn(this,ho,(e=>[...e.entries()].map((async([t,n])=>{const{ctx:r,handler:o}=n;if(!o)return;const i=await o();e.set(t,{ctx:r,handler:o,cleanup:i})})))),Yn(this,"enableInspector",((e=!0)=>(Xn(this,Gr,e),this))),Yn(this,"onStatusChange",(e=>(Xn(this,eo,e),this))),Yn(this,"config",(e=>(Gn(this,Xr).push(e),this))),Yn(this,"removeConfig",(e=>(Xn(this,Xr,Gn(this,Xr).filter((t=>t!==e))),this))),Yn(this,"use",(e=>{const t=[e].flat();return t.flat().forEach((e=>{Gn(this,ro).set(e,{ctx:void 0,handler:void 0,cleanup:void 0})})),"Created"===Gn(this,Qr)&&Gn(this,ao).call(this,t,Gn(this,ro)),this})),Yn(this,"remove",(async e=>"OnCreate"===Gn(this,Qr)?(console.warn("[Milkdown]: You are trying to remove plugins when the editor is creating, this is not recommended, please check your code."),new Promise((t=>{setTimeout((()=>{t(this.remove(e))}),50)}))):(await Gn(this,lo).call(this,[e].flat(),!0),this))),Yn(this,"create",(async()=>("OnCreate"===Gn(this,Qr)||("Created"===Gn(this,Qr)&&await this.destroy(),Gn(this,uo).call(this,"OnCreate"),Gn(this,so).call(this),Gn(this,ao).call(this,[...Gn(this,ro).keys()],Gn(this,ro)),await Promise.all([Gn(this,ho).call(this,Gn(this,oo)),Gn(this,ho).call(this,Gn(this,ro))].flat()),Gn(this,uo).call(this,"Created")),this))),Yn(this,"destroy",(async(e=!1)=>"Destroyed"===Gn(this,Qr)||"OnDestroy"===Gn(this,Qr)?this:"OnCreate"===Gn(this,Qr)?new Promise((t=>{setTimeout((()=>{t(this.destroy(e))}),50)})):(e&&Xn(this,Xr,[]),Gn(this,uo).call(this,"OnDestroy"),await Gn(this,lo).call(this,[...Gn(this,ro).keys()],e),await Gn(this,co).call(this),Gn(this,uo).call(this,"Destroyed"),this))),Yn(this,"action",(e=>e(Gn(this,io)))),Yn(this,"inspect",(()=>Gn(this,Gr)?[...Gn(this,oo).values(),...Gn(this,ro).values()].map((({ctx:e})=>{var t;return null==(t=null==e?void 0:e.inspector)?void 0:t.read()})).filter((e=>Boolean(e))):(console.warn("[Milkdown]: You are trying to collect inspection when inspector is disabled, please enable inspector by `editor.enableInspector()` first."),[])))}static make(){return new po}get ctx(){return Gn(this,io)}get status(){return Gn(this,Qr)}};let fo=po;Gr=new WeakMap,Qr=new WeakMap,Xr=new WeakMap,eo=new WeakMap,to=new WeakMap,no=new WeakMap,ro=new WeakMap,oo=new WeakMap,io=new WeakMap,so=new WeakMap,ao=new WeakMap,lo=new WeakMap,co=new WeakMap,uo=new WeakMap,ho=new WeakMap},2402:(e,t,n)=>{"use strict";n.d(t,{AL:()=>Y,D8:()=>de,GU:()=>re,J3:()=>u,LF:()=>pe,RC:()=>ne,_t:()=>ee,aH:()=>v,aR:()=>ae,gR:()=>ie,i4:()=>le,kG:()=>he,of:()=>f,rn:()=>M});var r,o,i=n(1570),s=n(6090),a=n(3686),l=n(5939),c=n(1329);if("undefined"!=typeof WeakMap){let e=new WeakMap;r=t=>e.get(t),o=(t,n)=>(e.set(t,n),n)}else{const e=[],t=10;let n=0;r=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},o=(r,o)=>(n==t&&(n=0),e[n++]=r,e[n++]=o)}var u=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){const n=this.map[t];if(n!=e)continue;const r=t%this.width,o=t/this.width|0;let i=r+1,s=o+1;for(let e=1;i<this.width&&this.map[t+e]==n;e++)i++;for(let e=1;s<this.height&&this.map[t+this.width*e]==n;e++)s++;return{left:r,top:o,right:i,bottom:s}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){const{left:r,right:o,top:i,bottom:s}=this.findCell(e);return"horiz"==t?(n<0?0==r:o==this.width)?null:this.map[i*this.width+(n<0?r-1:o)]:(n<0?0==i:s==this.height)?null:this.map[r+this.width*(n<0?i-1:s)]}rectBetween(e,t){const{left:n,right:r,top:o,bottom:i}=this.findCell(e),{left:s,right:a,top:l,bottom:c}=this.findCell(t);return{left:Math.min(n,s),top:Math.min(o,l),right:Math.max(r,a),bottom:Math.max(i,c)}}cellsInRect(e){const t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let o=e.left;o<e.right;o++){const i=r*this.width+o,s=this.map[i];n[s]||(n[s]=!0,o==e.left&&o&&this.map[i-1]==s||r==e.top&&r&&this.map[i-this.width]==s||t.push(s))}return t}positionAt(e,t,n){for(let r=0,o=0;;r++){const i=o+n.child(r).nodeSize;if(r==e){let n=t+e*this.width;const r=(e+1)*this.width;for(;n<r&&this.map[n]<o;)n++;return n==r?i-1:this.map[n]}o=i}}static get(e){return r(e)||o(e,function(e){if("table"!=e.type.spec.tableRole)throw new RangeError("Not a table node: "+e.type.name);const t=function(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){const o=e.child(r);let i=0;if(n)for(let t=0;t<r;t++){const n=e.child(t);for(let e=0;e<n.childCount;e++){const o=n.child(e);t+o.attrs.rowspan>r&&(i+=o.attrs.colspan)}}for(let e=0;e<o.childCount;e++){const t=o.child(e);i+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}-1==t?t=i:t!=i&&(t=Math.max(t,i))}return t}(e),n=e.childCount,r=[];let o=0,i=null;const s=[];for(let e=0,o=t*n;e<o;e++)r[e]=0;for(let a=0,l=0;a<n;a++){const c=e.child(a);l++;for(let e=0;;e++){for(;o<r.length&&0!=r[o];)o++;if(e==c.childCount)break;const u=c.child(e),{colspan:d,rowspan:h,colwidth:p}=u.attrs;for(let e=0;e<h;e++){if(e+a>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:l,n:h-e});break}const c=o+e*t;for(let e=0;e<d;e++){0==r[c+e]?r[c+e]=l:(i||(i=[])).push({type:"collision",row:a,pos:l,n:d-e});const n=p&&p[e];if(n){const r=(c+e)%t*2,o=s[r];null==o||o!=n&&1==s[r+1]?(s[r]=n,s[r+1]=1):o==n&&s[r+1]++}}}o+=d,l+=u.nodeSize}const u=(a+1)*t;let d=0;for(;o<u;)0==r[o++]&&d++;d&&(i||(i=[])).push({type:"missing",row:a,n:d}),l++}const a=new u(t,n,r,i);let l=!1;for(let e=0;!l&&e<s.length;e+=2)null!=s[e]&&s[e+1]<n&&(l=!0);return l&&function(e,t,n){e.problems||(e.problems=[]);const r={};for(let o=0;o<e.map.length;o++){const i=e.map[o];if(r[i])continue;r[i]=!0;const s=n.nodeAt(i);if(!s)throw new RangeError(`No cell with offset ${i} found`);let a=null;const l=s.attrs;for(let n=0;n<l.colspan;n++){const r=t[(o+n)%e.width*2];null==r||l.colwidth&&l.colwidth[n]==r||((a||(a=d(l)))[n]=r)}a&&e.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:a})}}(a,s,e),a}(e))}};function d(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function h(e,t){if("string"==typeof e)return{};const n=e.getAttribute("data-colwidth"),r=n&&/^\d+(,\d+)*$/.test(n)?n.split(",").map((e=>Number(e))):null,o=Number(e.getAttribute("colspan")||1),i={colspan:o,rowspan:Number(e.getAttribute("rowspan")||1),colwidth:r&&r.length==o?r:null};for(const n in t){const r=t[n].getFromDOM,o=r&&r(e);null!=o&&(i[n]=o)}return i}function p(e,t){const n={};1!=e.attrs.colspan&&(n.colspan=e.attrs.colspan),1!=e.attrs.rowspan&&(n.rowspan=e.attrs.rowspan),e.attrs.colwidth&&(n["data-colwidth"]=e.attrs.colwidth.join(","));for(const r in t){const o=t[r].setDOMAttr;o&&o(e.attrs[r],n)}return n}function f(e){const t=e.cellAttributes||{},n={colspan:{default:1},rowspan:{default:1},colwidth:{default:null}};for(const e in t)n[e]={default:t[e].default};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:e.tableGroup,parseDOM:[{tag:"table"}],toDOM:()=>["table",["tbody",0]]},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM:()=>["tr",0]},table_cell:{content:e.cellContent,attrs:n,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:e=>h(e,t)}],toDOM:e=>["td",p(e,t),0]},table_header:{content:e.cellContent,attrs:n,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:e=>h(e,t)}],toDOM:e=>["th",p(e,t),0]}}}function m(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(const n in e.nodes){const r=e.nodes[n],o=r.spec.tableRole;o&&(t[o]=r)}}return t}var g=new i.hs("selectingCells");function y(e){for(let t=e.depth-1;t>0;t--)if("row"==e.node(t).type.spec.tableRole)return e.node(0).resolve(e.before(t+1));return null}function v(e){const t=e.selection.$head;for(let e=t.depth;e>0;e--)if("row"==t.node(e).type.spec.tableRole)return!0;return!1}function w(e){const t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&"cell"==t.node.type.spec.tableRole)return t.$anchor;const n=y(t.$head)||function(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){const r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){const r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n-t.nodeSize)}}(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function k(e){return"row"==e.parent.type.spec.tableRole&&!!e.nodeAfter}function b(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function x(e,t,n){const r=e.node(-1),o=u.get(r),i=e.start(-1),s=o.nextCell(e.pos-i,t,n);return null==s?null:e.node(0).resolve(i+s)}function C(e,t,n=1){const r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some((e=>e>0))||(r.colwidth=null)),r}function S(e,t,n=1){const r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}var M=class extends i.LN{constructor(e,t=e){const n=e.node(-1),r=u.get(n),o=e.start(-1),s=r.rectBetween(e.pos-o,t.pos-o),a=e.node(0),l=r.cellsInRect(s).filter((e=>e!=t.pos-o));l.unshift(t.pos-o);const c=l.map((e=>{const t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);const r=o+e+1;return new i.yn(a.resolve(r),a.resolve(r+t.content.size))}));super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){const n=e.resolve(t.map(this.$anchorCell.pos)),r=e.resolve(t.map(this.$headCell.pos));if(k(n)&&k(r)&&b(n,r)){const e=this.$anchorCell.node(-1)!=n.node(-1);return e&&this.isRowSelection()?M.rowSelection(n,r):e&&this.isColSelection()?M.colSelection(n,r):new M(n,r)}return i.U3.between(n,r)}content(){const e=this.$anchorCell.node(-1),t=u.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),o={},i=[];for(let n=r.top;n<r.bottom;n++){const a=[];for(let i=n*t.width+r.left,s=r.left;s<r.right;s++,i++){const n=t.map[i];if(o[n])continue;o[n]=!0;const s=t.findCell(n);let l=e.nodeAt(n);if(!l)throw RangeError(`No cell with offset ${n} found`);const c=r.left-s.left,u=s.right-r.right;if(c>0||u>0){let e=l.attrs;if(c>0&&(e=C(e,0,c)),u>0&&(e=C(e,e.colspan-u,u)),s.left<r.left){if(l=l.type.createAndFill(e),!l)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else l=l.type.create(e,l.content)}if(s.top<r.top||s.bottom>r.bottom){const e={...l.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};l=s.top<r.top?l.type.createAndFill(e):l.type.create(e,l.content)}a.push(l)}i.push(e.child(n).copy(s.FK.from(a)))}const a=this.isColSelection()&&this.isRowSelection()?e:i;return new s.Ji(s.FK.from(a),1,1)}replace(e,t=s.Ji.empty){const n=e.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){const{$from:i,$to:a}=r[o],l=e.mapping.slice(n);e.replace(l.map(i.pos),l.map(a.pos),o?s.Ji.empty:t)}const o=i.LN.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);o&&e.setSelection(o)}replaceWith(e,t){this.replace(e,new s.Ji(s.FK.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),n=u.get(t),r=this.$anchorCell.start(-1),o=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<o.length;n++)e(t.nodeAt(o[n]),r+o[n])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const n=e.node(-1),r=u.get(n),o=e.start(-1),i=r.findCell(e.pos-o),s=r.findCell(t.pos-o),a=e.node(0);return i.top<=s.top?(i.top>0&&(e=a.resolve(o+r.map[i.left])),s.bottom<r.height&&(t=a.resolve(o+r.map[r.width*(r.height-1)+s.right-1]))):(s.top>0&&(t=a.resolve(o+r.map[s.left])),i.bottom<r.height&&(e=a.resolve(o+r.map[r.width*(r.height-1)+i.right-1]))),new M(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=u.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),o=t.colCount(this.$headCell.pos-n);if(Math.min(r,o)>0)return!1;const i=r+this.$anchorCell.nodeAfter.attrs.colspan,s=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(i,s)==t.width}eq(e){return e instanceof M&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const n=e.node(-1),r=u.get(n),o=e.start(-1),i=r.findCell(e.pos-o),s=r.findCell(t.pos-o),a=e.node(0);return i.left<=s.left?(i.left>0&&(e=a.resolve(o+r.map[i.top*r.width])),s.right<r.width&&(t=a.resolve(o+r.map[r.width*(s.top+1)-1]))):(s.left>0&&(t=a.resolve(o+r.map[s.top*r.width])),i.right<r.width&&(e=a.resolve(o+r.map[r.width*(i.top+1)-1]))),new M(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new M(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){return new M(e.resolve(t),e.resolve(n))}getBookmark(){return new N(this.$anchorCell.pos,this.$headCell.pos)}};M.prototype.visible=!1,i.LN.jsonID("cell",M);var N=class{constructor(e,t){this.anchor=e,this.head=t}map(e){return new N(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),n=e.resolve(this.head);return"row"==t.parent.type.spec.tableRole&&"row"==n.parent.type.spec.tableRole&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&b(t,n)?new M(t,n):i.LN.near(n,1)}};function O(e){if(!(e.selection instanceof M))return null;const t=[];return e.selection.forEachCell(((e,n)=>{t.push(a.NZ.node(n,n+e.nodeSize,{class:"selectedCell"}))})),a.zF.create(e.doc,t)}var A=new i.hs("fix-tables");function E(e,t,n,r){const o=e.childCount,i=t.childCount;e:for(let s=0,a=0;s<i;s++){const i=t.child(s);for(let t=a,r=Math.min(o,s+3);t<r;t++)if(e.child(t)==i){a=t+1,n+=i.nodeSize;continue e}r(i,n),a<o&&e.child(a).sameMarkup(i)?E(e.child(a),i,n+1,r):i.nodesBetween(0,i.content.size,r,n+1),n+=i.nodeSize}}function D(e,t){let n;const r=(t,r)=>{"table"==t.type.spec.tableRole&&(n=function(e,t,n,r){const o=u.get(t);if(!o.problems)return r;r||(r=e.tr);const i=[];for(let e=0;e<o.height;e++)i.push(0);for(let e=0;e<o.problems.length;e++){const s=o.problems[e];if("collision"==s.type){const e=t.nodeAt(s.pos);if(!e)continue;const o=e.attrs;for(let e=0;e<o.rowspan;e++)i[s.row+e]+=s.n;r.setNodeMarkup(r.mapping.map(n+1+s.pos),null,C(o,o.colspan-s.n,s.n))}else if("missing"==s.type)i[s.row]+=s.n;else if("overlong_rowspan"==s.type){const e=t.nodeAt(s.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+s.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-s.n})}else if("colwidth mismatch"==s.type){const e=t.nodeAt(s.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+s.pos),null,{...e.attrs,colwidth:s.colwidth})}}let s,a;for(let e=0;e<i.length;e++)i[e]&&(null==s&&(s=e),a=e);for(let l=0,c=n+1;l<o.height;l++){const n=t.child(l),o=c+n.nodeSize,u=i[l];if(u>0){let t="cell";n.firstChild&&(t=n.firstChild.type.spec.tableRole);const i=[];for(let n=0;n<u;n++){const n=m(e.schema)[t].createAndFill();n&&i.push(n)}const d=0!=l&&s!=l-1||a!=l?o-1:c+1;r.insert(r.mapping.map(d),i)}c=o}return r.setMeta(A,{fixTables:!0})}(e,t,r,n))};return t?t.doc!=e.doc&&E(t.doc,e.doc,0,r):e.doc.descendants(r),n}function T(e,t){const n=e.createAndFill();return new c.dL(n).replace(0,n.content.size,t).doc}function F(e,t,n,r,o,i,s,a){if(0==s||s==t.height)return!1;let l=!1;for(let c=o;c<i;c++){const o=s*t.width+c,i=t.map[o];if(t.map[o-t.width]==i){l=!0;const o=n.nodeAt(i),{top:u,left:d}=t.findCell(i);e.setNodeMarkup(e.mapping.slice(a).map(i+r),null,{...o.attrs,rowspan:s-u}),e.insert(e.mapping.slice(a).map(t.positionAt(s,d,n)),o.type.createAndFill({...o.attrs,rowspan:u+o.attrs.rowspan-s})),c+=o.attrs.colspan-1}}return l}function I(e,t,n,r,o,i,s,a){if(0==s||s==t.width)return!1;let l=!1;for(let c=o;c<i;c++){const o=c*t.width+s,i=t.map[o];if(t.map[o-1]==i){l=!0;const o=n.nodeAt(i),u=t.colCount(i),d=e.mapping.slice(a).map(i+r);e.setNodeMarkup(d,null,C(o.attrs,s-u,o.attrs.colspan-(s-u))),e.insert(d+o.nodeSize,o.type.createAndFill(C(o.attrs,0,s-u))),c+=o.attrs.rowspan-1}}return l}function R(e,t,n,r,o){let i=n?e.doc.nodeAt(n-1):e.doc;if(!i)throw new Error("No table found");let a=u.get(i);const{top:l,left:c}=r,d=c+o.width,h=l+o.height,p=e.tr;let f=0;function g(){if(i=n?p.doc.nodeAt(n-1):p.doc,!i)throw new Error("No table found");a=u.get(i),f=p.mapping.maps.length}(function(e,t,n,r,o,i,a){const l=m(e.doc.type.schema);let c,u;if(o>t.width)for(let i=0,s=0;i<t.height;i++){const d=n.child(i);s+=d.nodeSize;const h=[];let p;p=null==d.lastChild||d.lastChild.type==l.cell?c||(c=l.cell.createAndFill()):u||(u=l.header_cell.createAndFill());for(let e=t.width;e<o;e++)h.push(p);e.insert(e.mapping.slice(a).map(s-1+r),h)}if(i>t.height){const d=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,o);e++){const o=!(e>=t.width)&&n.nodeAt(t.map[r+e]).type==l.header_cell;d.push(o?u||(u=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()))}const h=l.row.create(null,s.FK.from(d)),p=[];for(let e=t.height;e<i;e++)p.push(h);e.insert(e.mapping.slice(a).map(r+n.nodeSize-2),p)}return!(!c&&!u)})(p,a,i,n,d,h,f)&&g(),F(p,a,i,n,c,d,l,f)&&g(),F(p,a,i,n,c,d,h,f)&&g(),I(p,a,i,n,l,h,c,f)&&g(),I(p,a,i,n,l,h,d,f)&&g();for(let e=l;e<h;e++){const t=a.positionAt(e,c,i),r=a.positionAt(e,d,i);p.replace(p.mapping.slice(f).map(t+n),p.mapping.slice(f).map(r+n),new s.Ji(o.rows[e-l],0,0))}g(),p.setSelection(new M(p.doc.resolve(n+a.positionAt(l,c,i)),p.doc.resolve(n+a.positionAt(h-1,d-1,i)))),t(p)}var P=(0,l.K)({ArrowLeft:L("horiz",-1),ArrowRight:L("horiz",1),ArrowUp:L("vert",-1),ArrowDown:L("vert",1),"Shift-ArrowLeft":z("horiz",-1),"Shift-ArrowRight":z("horiz",1),"Shift-ArrowUp":z("vert",-1),"Shift-ArrowDown":z("vert",1),Backspace:$,"Mod-Backspace":$,Delete:$,"Mod-Delete":$});function B(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function L(e,t){return(n,r,o)=>{if(!o)return!1;const s=n.selection;if(s instanceof M)return B(n,r,i.LN.near(s.$headCell,t));if("horiz"!=e&&!s.empty)return!1;const a=W(o,e,t);if(null==a)return!1;if("horiz"==e)return B(n,r,i.LN.near(n.doc.resolve(s.head+t),t));{const o=n.doc.resolve(a),s=x(o,e,t);let l;return l=s?i.LN.near(s,1):t<0?i.LN.near(n.doc.resolve(o.before(-1)),-1):i.LN.near(n.doc.resolve(o.after(-1)),1),B(n,r,l)}}}function z(e,t){return(n,r,o)=>{if(!o)return!1;const i=n.selection;let s;if(i instanceof M)s=i;else{const r=W(o,e,t);if(null==r)return!1;s=new M(n.doc.resolve(r))}const a=x(s.$headCell,e,t);return!!a&&B(n,r,new M(s.$anchorCell,a))}}function $(e,t){const n=e.selection;if(!(n instanceof M))return!1;if(t){const r=e.tr,o=m(e.schema).cell.createAndFill().content;n.forEachCell(((e,t)=>{e.content.eq(o)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new s.Ji(o,0,0))})),r.docChanged&&t(r)}return!0}function j(e,t){const n=y(e.state.doc.resolve(t));return!!n&&(e.dispatch(e.state.tr.setSelection(new M(n))),!0)}function _(e,t,n){if(!v(e.state))return!1;let r=function(e){if(!e.size)return null;let{content:t,openStart:n,openEnd:r}=e;for(;1==t.childCount&&(n>0&&r>0||"table"==t.child(0).type.spec.tableRole);)n--,r--,t=t.child(0).content;const o=t.child(0),i=o.type.spec.tableRole,a=o.type.schema,l=[];if("row"==i)for(let e=0;e<t.childCount;e++){let o=t.child(e).content;const i=e?0:Math.max(0,n-1),c=e<t.childCount-1?0:Math.max(0,r-1);(i||c)&&(o=T(m(a).row,new s.Ji(o,i,c)).content),l.push(o)}else{if("cell"!=i&&"header_cell"!=i)return null;l.push(n||r?T(m(a).row,new s.Ji(t,n,r)).content:t)}return function(e,t){const n=[];for(let e=0;e<t.length;e++){const r=t[e];for(let t=r.childCount-1;t>=0;t--){const{rowspan:o,colspan:i}=r.child(t).attrs;for(let t=e;t<e+o;t++)n[t]=(n[t]||0)+i}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let o=0;o<n.length;o++)if(o>=t.length&&t.push(s.FK.empty),n[o]<r){const i=m(e).cell.createAndFill(),a=[];for(let e=n[o];e<r;e++)a.push(i);t[o]=t[o].append(s.FK.from(a))}return{height:t.length,width:r,rows:t}}(a,l)}(n);const o=e.state.selection;if(o instanceof M){r||(r={width:1,height:1,rows:[s.FK.from(T(m(e.state.schema).cell,n))]});const t=o.$anchorCell.node(-1),i=o.$anchorCell.start(-1),a=u.get(t).rectBetween(o.$anchorCell.pos-i,o.$headCell.pos-i);return r=function({width:e,height:t,rows:n},r,o){if(e!=r){const t=[],o=[];for(let e=0;e<n.length;e++){const i=n[e],a=[];for(let n=t[e]||0,o=0;n<r;o++){let s=i.child(o%i.childCount);n+s.attrs.colspan>r&&(s=s.type.createChecked(C(s.attrs,s.attrs.colspan,n+s.attrs.colspan-r),s.content)),a.push(s),n+=s.attrs.colspan;for(let n=1;n<s.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+s.attrs.colspan}o.push(s.FK.from(a))}n=o,e=r}if(t!=o){const e=[];for(let r=0,i=0;r<o;r++,i++){const a=[],l=n[i%t];for(let e=0;e<l.childCount;e++){let t=l.child(e);r+t.attrs.rowspan>o&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,o-t.attrs.rowspan)},t.content)),a.push(t)}e.push(s.FK.from(a))}n=e,t=o}return{width:e,height:t,rows:n}}(r,a.right-a.left,a.bottom-a.top),R(e.state,e.dispatch,i,a,r),!0}if(r){const t=w(e.state),n=t.start(-1);return R(e.state,e.dispatch,n,u.get(t.node(-1)).findCell(t.pos-n),r),!0}return!1}function V(e,t){var n;if(t.ctrlKey||t.metaKey)return;const r=H(e,t.target);let o;if(t.shiftKey&&e.state.selection instanceof M)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&r&&null!=(o=y(e.state.selection.$anchor))&&(null==(n=K(e,t))?void 0:n.pos)!=o.pos)i(o,t),t.preventDefault();else if(!r)return;function i(t,n){let r=K(e,n);const o=null==g.getState(e.state);if(!r||!b(t,r)){if(!o)return;r=t}const i=new M(t,r);if(o||!e.state.selection.eq(i)){const n=e.state.tr.setSelection(i);o&&n.setMeta(g,t.pos),e.dispatch(n)}}function s(){e.root.removeEventListener("mouseup",s),e.root.removeEventListener("dragstart",s),e.root.removeEventListener("mousemove",a),null!=g.getState(e.state)&&e.dispatch(e.state.tr.setMeta(g,-1))}function a(n){const o=n,a=g.getState(e.state);let l;if(null!=a)l=e.state.doc.resolve(a);else if(H(e,o.target)!=r&&(l=K(e,t),!l))return s();l&&i(l,o)}e.root.addEventListener("mouseup",s),e.root.addEventListener("dragstart",s),e.root.addEventListener("mousemove",a)}function W(e,t,n){if(!(e.state.selection instanceof i.U3))return null;const{$head:r}=e.state.selection;for(let o=r.depth-1;o>=0;o--){const i=r.node(o);if((n<0?r.index(o):r.indexAfter(o))!=(n<0?0:i.childCount))return null;if("cell"==i.type.spec.tableRole||"header_cell"==i.type.spec.tableRole){const i=r.before(o),s="vert"==t?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(s)?i:null}}return null}function H(e,t){for(;t&&t!=e.dom;t=t.parentNode)if("TD"==t.nodeName||"TH"==t.nodeName)return t;return null}function K(e,t){const n=e.posAtCoords({left:t.clientX,top:t.clientY});return n&&n?y(e.state.doc.resolve(n.pos)):null}var J=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")),q(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type==this.node.type&&(this.node=e,q(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return"attributes"==e.type&&(e.target==this.table||this.colgroup.contains(e.target))}};function q(e,t,n,r,o,i){var s;let a=0,l=!0,c=t.firstChild;const u=e.firstChild;if(u){for(let e=0,n=0;e<u.childCount;e++){const{colspan:s,colwidth:d}=u.child(e).attrs;for(let e=0;e<s;e++,n++){const s=o==n?i:d&&d[e],u=s?s+"px":"";a+=s||r,s||(l=!1),c?(c.style.width!=u&&(c.style.width=u),c=c.nextSibling):t.appendChild(document.createElement("col")).style.width=u}}for(;c;){const e=c.nextSibling;null==(s=c.parentNode)||s.removeChild(c),c=e}l?(n.style.width=a+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=a+"px")}}var U=new i.hs("tableColumnResizing");function Y({handleWidth:e=5,cellMinWidth:t=25,View:n=J,lastColumnResizable:r=!0}={}){const o=new i.k_({key:U,state:{init:(e,r)=>(o.spec.props.nodeViews[m(r.schema).table.name]=(e,r)=>new n(e,t,r),new Z(-1,!1)),apply:(e,t)=>t.apply(e)},props:{attributes:e=>{const t=U.getState(e);return t&&t.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(t,n)=>{!function(e,t,n,r,o){const i=U.getState(e.state);if(i&&!i.dragging){const r=function(e){for(;e&&"TD"!=e.nodeName&&"TH"!=e.nodeName;)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}(t.target);let s=-1;if(r){const{left:o,right:i}=r.getBoundingClientRect();t.clientX-o<=n?s=G(e,t,"left"):i-t.clientX<=n&&(s=G(e,t,"right"))}if(s!=i.activeHandle){if(!o&&-1!==s){const t=e.state.doc.resolve(s),n=t.node(-1),r=u.get(n),o=t.start(-1);if(r.colCount(t.pos-o)+t.nodeAfter.attrs.colspan-1==r.width-1)return}X(e,s)}}}(t,n,e,0,r)},mouseleave:e=>{!function(e){const t=U.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&X(e,-1)}(e)},mousedown:(e,n)=>{!function(e,t,n){const r=U.getState(e.state);if(!r||-1==r.activeHandle||r.dragging)return!1;const o=e.state.doc.nodeAt(r.activeHandle),i=function(e,t,{colspan:n,colwidth:r}){const o=r&&r[r.length-1];if(o)return o;const i=e.domAtPos(t);let s=i.node.childNodes[i.offset].offsetWidth,a=n;if(r)for(let e=0;e<n;e++)r[e]&&(s-=r[e],a--);return s/a}(e,r.activeHandle,o.attrs);function s(t){window.removeEventListener("mouseup",s),window.removeEventListener("mousemove",a);const r=U.getState(e.state);(null==r?void 0:r.dragging)&&(function(e,t,n){const r=e.state.doc.resolve(t),o=r.node(-1),i=u.get(o),s=r.start(-1),a=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,l=e.state.tr;for(let e=0;e<i.height;e++){const t=e*i.width+a;if(e&&i.map[t]==i.map[t-i.width])continue;const r=i.map[t],u=o.nodeAt(r).attrs,d=1==u.colspan?0:a-i.colCount(r);if(u.colwidth&&u.colwidth[d]==n)continue;const h=u.colwidth?u.colwidth.slice():(c=u.colspan,Array(c).fill(0));h[d]=n,l.setNodeMarkup(s+r,null,{...u,colwidth:h})}var c;l.docChanged&&e.dispatch(l)}(e,r.activeHandle,Q(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(U,{setDragging:null})))}function a(t){if(!t.which)return s(t);const r=U.getState(e.state);if(r&&r.dragging){const o=Q(r.dragging,t,n);!function(e,t,n,r){const o=e.state.doc.resolve(t),i=o.node(-1),s=o.start(-1),a=u.get(i).colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;let l=e.domAtPos(o.start(-1)).node;for(;l&&"TABLE"!=l.nodeName;)l=l.parentNode;l&&q(i,l.firstChild,l,r,a,n)}(e,r.activeHandle,o,n)}}e.dispatch(e.state.tr.setMeta(U,{setDragging:{startX:t.clientX,startWidth:i}})),window.addEventListener("mouseup",s),window.addEventListener("mousemove",a),t.preventDefault()}(e,n,t)}},decorations:e=>{const t=U.getState(e);if(t&&t.activeHandle>-1)return function(e,t){const n=[],r=e.doc.resolve(t),o=r.node(-1);if(!o)return a.zF.empty;const i=u.get(o),s=r.start(-1),l=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan;for(let e=0;e<i.height;e++){const t=l+e*i.width-1;if(!(l!=i.width&&i.map[t]==i.map[t+1]||0!=e&&i.map[t-1]==i.map[t-1-i.width])){const e=i.map[t],r=s+e+o.nodeAt(e).nodeSize-1,l=document.createElement("div");l.className="column-resize-handle",n.push(a.NZ.widget(r,l))}}return a.zF.create(e.doc,n)}(e,t.activeHandle)},nodeViews:{}}});return o}var Z=class{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,n=e.getMeta(U);if(n&&null!=n.setHandle)return new Z(n.setHandle,!1);if(n&&void 0!==n.setDragging)return new Z(t.activeHandle,n.setDragging);if(t.activeHandle>-1&&e.docChanged){let n=e.mapping.map(t.activeHandle,-1);return k(e.doc.resolve(n))||(n=-1),new Z(n,t.dragging)}return t}};function G(e,t,n){const r=e.posAtCoords({left:t.clientX,top:t.clientY});if(!r)return-1;const{pos:o}=r,i=y(e.state.doc.resolve(o));if(!i)return-1;if("right"==n)return i.pos;const s=u.get(i.node(-1)),a=i.start(-1),l=s.map.indexOf(i.pos-a);return l%s.width==0?-1:a+s.map[l-1]}function Q(e,t,n){const r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function X(e,t){e.dispatch(e.state.tr.setMeta(U,{setHandle:t}))}function ee(e){const t=e.selection,n=w(e),r=n.node(-1),o=n.start(-1),i=u.get(r);return{...t instanceof M?i.rectBetween(t.$anchorCell.pos-o,t.$headCell.pos-o):i.findCell(n.pos-o),tableStart:o,map:i,table:r}}function te(e,{map:t,tableStart:n,table:r},o){let i=o>0?-1:0;(function(e,t,n){const r=m(t.type.schema).header_cell;for(let o=0;o<e.height;o++)if(t.nodeAt(e.map[n+o*e.width]).type!=r)return!1;return!0})(t,r,o+i)&&(i=0==o||o==t.width?null:0);for(let s=0;s<t.height;s++){const a=s*t.width+o;if(o>0&&o<t.width&&t.map[a-1]==t.map[a]){const i=t.map[a],l=r.nodeAt(i);e.setNodeMarkup(e.mapping.map(n+i),null,S(l.attrs,o-t.colCount(i))),s+=l.attrs.rowspan-1}else{const l=null==i?m(r.type.schema).cell:r.nodeAt(t.map[a+i]).type,c=t.positionAt(s,o,r);e.insert(e.mapping.map(n+c),l.createAndFill())}}return e}function ne(e,t){if(!v(e))return!1;if(t){const n=ee(e);t(te(e.tr,n,n.left))}return!0}function re(e,t){if(!v(e))return!1;if(t){const n=ee(e);t(te(e.tr,n,n.right))}return!0}function oe(e,{map:t,table:n,tableStart:r},o){const i=e.mapping.maps.length;for(let s=0;s<t.height;){const a=s*t.width+o,l=t.map[a],c=n.nodeAt(l),u=c.attrs;if(o>0&&t.map[a-1]==l||o<t.width-1&&t.map[a+1]==l)e.setNodeMarkup(e.mapping.slice(i).map(r+l),null,C(u,o-t.colCount(l)));else{const t=e.mapping.slice(i).map(r+l);e.delete(t,t+c.nodeSize)}s+=u.rowspan}}function ie(e,t){if(!v(e))return!1;if(t){const n=ee(e),r=e.tr;if(0==n.left&&n.right==n.map.width)return!1;for(let e=n.right-1;oe(r,n,e),e!=n.left;e--){const e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError("No table found");n.table=e,n.map=u.get(e)}t(r)}return!0}function se(e,{map:t,table:n,tableStart:r},o){let i=0;for(let e=0;e<o;e++)i+=n.child(e).nodeSize;const s=i+n.child(o).nodeSize,a=e.mapping.maps.length;e.delete(i+r,s+r);for(let i=0,s=o*t.width;i<t.width;i++,s++){const l=t.map[s];if(o>0&&l==t.map[s-t.width]){const t=n.nodeAt(l).attrs;e.setNodeMarkup(e.mapping.slice(a).map(l+r),null,{...t,rowspan:t.rowspan-1}),i+=t.colspan-1}else if(o<t.width&&l==t.map[s+t.width]){const s=n.nodeAt(l),c=s.attrs,u=s.type.create({...c,rowspan:s.attrs.rowspan-1},s.content),d=t.positionAt(o+1,i,n);e.insert(e.mapping.slice(a).map(r+d),u),i+=c.colspan-1}}}function ae(e,t){if(!v(e))return!1;if(t){const n=ee(e),r=e.tr;if(0==n.top&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;se(r,n,e),e!=n.top;e--){const e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError("No table found");n.table=e,n.map=u.get(n.table)}t(r)}return!0}function le(e,t){return function(n,r){if(!v(n))return!1;const o=w(n);if(o.nodeAfter.attrs[e]===t)return!1;if(r){const i=n.tr;n.selection instanceof M?n.selection.forEachCell(((n,r)=>{n.attrs[e]!==t&&i.setNodeMarkup(r,null,{...n.attrs,[e]:t})})):i.setNodeMarkup(o.pos,null,{...o.nodeAfter.attrs,[e]:t}),r(i)}return!0}}function ce(e,t,n){const r=t.map.cellsInRect({left:0,top:0,right:"row"==e?t.map.width:1,bottom:"column"==e?t.map.height:1});for(let e=0;e<r.length;e++){const o=t.table.nodeAt(r[e]);if(o&&o.type!==n.header_cell)return!1}return!0}function ue(e,t){return(t=t||{useDeprecatedLogic:!1}).useDeprecatedLogic?function(e){return function(t,n){if(!v(t))return!1;if(n){const r=m(t.schema),o=ee(t),i=t.tr,s=o.map.cellsInRect("column"==e?{left:o.left,top:0,right:o.right,bottom:o.map.height}:"row"==e?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),a=s.map((e=>o.table.nodeAt(e)));for(let e=0;e<s.length;e++)a[e].type==r.header_cell&&i.setNodeMarkup(o.tableStart+s[e],r.cell,a[e].attrs);if(0==i.steps.length)for(let e=0;e<s.length;e++)i.setNodeMarkup(o.tableStart+s[e],r.header_cell,a[e].attrs);n(i)}return!0}}(e):function(t,n){if(!v(t))return!1;if(n){const r=m(t.schema),o=ee(t),i=t.tr,s=ce("row",o,r),a=ce("column",o,r),l=("column"===e?s:"row"===e&&a)?1:0,c="column"==e?{left:0,top:l,right:1,bottom:o.map.height}:"row"==e?{left:l,top:0,right:o.map.width,bottom:1}:o,u="column"==e?a?r.cell:r.header_cell:"row"==e?s?r.cell:r.header_cell:r.cell;o.map.cellsInRect(c).forEach((e=>{const t=e+o.tableStart,n=i.doc.nodeAt(t);n&&i.setNodeMarkup(t,u,n.attrs)})),n(i)}return!0}}function de(e){return function(t,n){if(!v(t))return!1;const r=function(e,t){if(t<0){const t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){const r=e.node(-1).child(t),o=r.lastChild;if(o)return n-1-o.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;const t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){const e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}(w(t),e);if(null==r)return!1;if(n){const e=t.doc.resolve(r);n(t.tr.setSelection(i.U3.between(e,(o=e,o.node(0).resolve(o.pos+o.nodeAfter.nodeSize)))).scrollIntoView())}var o;return!0}}function he(e,t){const n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if("table"==n.node(r).type.spec.tableRole)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function pe({allowTableNodeSelection:e=!1}={}){return new i.k_({key:g,state:{init:()=>null,apply(e,t){const n=e.getMeta(g);if(null!=n)return-1==n?null:n;if(null==t||!e.docChanged)return t;const{deleted:r,pos:o}=e.mapping.mapResult(t);return r?null:o}},props:{decorations:O,handleDOMEvents:{mousedown:V},createSelectionBetween:e=>null!=g.getState(e.state)?e.state.selection:null,handleTripleClick:j,handleKeyDown:P,handlePaste:_},appendTransaction:(t,n,r)=>function(e,t,n){const r=(t||e).selection,o=(t||e).doc;let s,a;if(r instanceof i.nh&&(a=r.node.type.spec.tableRole)){if("cell"==a||"header_cell"==a)s=M.create(o,r.from);else if("row"==a){const e=o.resolve(r.from+1);s=M.rowSelection(e,e)}else if(!n){const e=u.get(r.node),t=r.from+1,n=t+e.map[e.width*e.height-1];s=M.create(o,t+1,n)}}else r instanceof i.U3&&function({$from:e,$to:t}){if(e.pos==t.pos||e.pos<e.pos-6)return!1;let n=e.pos,r=t.pos,o=e.depth;for(;o>=0&&!(e.after(o+1)<e.end(o));o--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(o).type.spec.tableRole)}(r)?s=i.U3.create(o,r.from):r instanceof i.U3&&function({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){const r=e.node(t);if("cell"===r.type.spec.tableRole||"header_cell"===r.type.spec.tableRole){n=r;break}}for(let e=t.depth;e>0;e--){const n=t.node(e);if("cell"===n.type.spec.tableRole||"header_cell"===n.type.spec.tableRole){r=n;break}}return n!==r&&0===t.parentOffset}(r)&&(s=i.U3.create(o,r.$from.start(),r.$from.end()));return s&&(t||(t=e.tr)).setSelection(s),t}(r,D(r,n),e)})}ue("row",{useDeprecatedLogic:!0}),ue("column",{useDeprecatedLogic:!0}),ue("cell",{useDeprecatedLogic:!0})},2466:(e,t,n)=>{"use strict";n.d(t,{Nj:()=>l,hG:()=>a,pb:()=>s,y5:()=>i});var r=n(8769);const o=(0,r.createContext)({}),i=()=>{const e=(()=>{const{dom:e,editor:t,setLoading:n,editorFactory:i}=(0,r.useContext)(o),s=(0,r.useRef)(null);return(0,r.useEffect)((()=>{const r=s.current;if(!i||!r)return;e.current=r;const o=i(r);return o?(n(!0),o.create().then((e=>{t.current=e})).finally((()=>{n(!1)})).catch(console.error),()=>{var e;null==(e=t.current)||e.destroy()}):void 0}),[e,t,i,n]),s})();return r.createElement("div",{"data-milkdown-root":!0,ref:e})},s=({children:e})=>{const t=(0,r.useRef)(void 0),[n,i]=(0,r.useState)(void 0),s=(0,r.useRef)(),[a,l]=(0,r.useState)(!0),c=(0,r.useMemo)((()=>({loading:a,dom:t,editor:s,setLoading:l,editorFactory:n,setEditorFactory:i})),[a,n]);return r.createElement(o.Provider,{value:c},e)},a=(e,t=[])=>{const n=(0,r.useContext)(o),i=(0,r.useCallback)(e,t);return(0,r.useLayoutEffect)((()=>{n.setEditorFactory((()=>i))}),[n,i]),{loading:n.loading,get:()=>n.editor.current}},l=()=>{const e=(0,r.useContext)(o),t=(0,r.useCallback)((()=>e.editor.current),[e.editor]);return[e.loading,t]}},3373:(e,t)=>{var n;!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=s(e,i(n)))}return e}function i(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return o.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var n in e)r.call(e,n)&&e[n]&&(t=s(t,n));return t}function s(e,t){return t?e?e+" "+t:e+t:e}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},3686:(e,t,n)=>{"use strict";n.d(t,{Lz:()=>an,NZ:()=>Bt,zF:()=>$t});var r=n(1570),o=n(6090),i=n(1329);const s=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},a=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t};let l=null;const c=function(e,t,n){let r=l||(l=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},u=function(e,t,n,r){return n&&(h(e,t,n,r,-1)||h(e,t,n,r,1))},d=/^(img|br|input|textarea|hr)$/i;function h(e,t,n,r,o){for(;;){if(e==n&&t==r)return!0;if(t==(o<0?0:p(e))){let n=e.parentNode;if(!n||1!=n.nodeType||f(e)||d.test(e.nodeName)||"false"==e.contentEditable)return!1;t=s(e)+(o<0?0:1),e=n}else{if(1!=e.nodeType)return!1;if("false"==(e=e.childNodes[t+(o<0?-1:0)]).contentEditable)return!1;t=o<0?p(e):0}}}function p(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function f(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const m=function(e){return e.focusNode&&u(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function g(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}const y="undefined"!=typeof navigator?navigator:null,v="undefined"!=typeof document?document:null,w=y&&y.userAgent||"",k=/Edge\/(\d+)/.exec(w),b=/MSIE \d/.exec(w),x=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(w),C=!!(b||x||k),S=b?document.documentMode:x?+x[1]:k?+k[1]:0,M=!C&&/gecko\/(\d+)/i.test(w);M&&(/Firefox\/(\d+)/.exec(w)||[0,0])[1];const N=!C&&/Chrome\/(\d+)/.exec(w),O=!!N,A=N?+N[1]:0,E=!C&&!!y&&/Apple Computer/.test(y.vendor),D=E&&(/Mobile\/\w+/.test(w)||!!y&&y.maxTouchPoints>2),T=D||!!y&&/Mac/.test(y.platform),F=!!y&&/Win/.test(y.platform),I=/Android \d/.test(w),R=!!v&&"webkitFontSmoothing"in v.documentElement.style,P=R?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function B(e){return{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function L(e,t){return"number"==typeof e?e:e[t]}function z(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function $(e,t,n){let r=e.someProp("scrollThreshold")||0,o=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument;for(let s=n||e.dom;s;s=a(s)){if(1!=s.nodeType)continue;let e=s,n=e==i.body,a=n?B(i):z(e),l=0,c=0;if(t.top<a.top+L(r,"top")?c=-(a.top-t.top+L(o,"top")):t.bottom>a.bottom-L(r,"bottom")&&(c=t.bottom-a.bottom+L(o,"bottom")),t.left<a.left+L(r,"left")?l=-(a.left-t.left+L(o,"left")):t.right>a.right-L(r,"right")&&(l=t.right-a.right+L(o,"right")),l||c)if(n)i.defaultView.scrollBy(l,c);else{let n=e.scrollLeft,r=e.scrollTop;c&&(e.scrollTop+=c),l&&(e.scrollLeft+=l);let o=e.scrollLeft-n,i=e.scrollTop-r;t={left:t.left-o,top:t.top-i,right:t.right-o,bottom:t.bottom-i}}if(n)break}}function j(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=a(r));return t}function _(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:o,left:i}=e[n];r.scrollTop!=o+t&&(r.scrollTop=o+t),r.scrollLeft!=i&&(r.scrollLeft=i)}}let V=null;function W(e,t){let n,r,o,i,s=2e8,a=0,l=t.top,u=t.top;for(let d=e.firstChild,h=0;d;d=d.nextSibling,h++){let e;if(1==d.nodeType)e=d.getClientRects();else{if(3!=d.nodeType)continue;e=c(d).getClientRects()}for(let c=0;c<e.length;c++){let p=e[c];if(p.top<=l&&p.bottom>=u){l=Math.max(p.bottom,l),u=Math.min(p.top,u);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<s){n=d,s=e,r=e&&3==n.nodeType?{left:p.right<t.left?p.right:p.left,top:t.top}:t,1==d.nodeType&&e&&(a=h+(t.left>=(p.left+p.right)/2?1:0));continue}}else p.top>t.top&&!o&&p.left<=t.left&&p.right>=t.left&&(o=d,i={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=h+1)}}return!n&&o&&(n=o,r=i,s=0),n&&3==n.nodeType?function(e,t){let n=e.nodeValue.length,r=document.createRange();for(let o=0;o<n;o++){r.setEnd(e,o+1),r.setStart(e,o);let n=U(r,1);if(n.top!=n.bottom&&H(t,n))return{node:e,offset:o+(t.left>=(n.left+n.right)/2?1:0)}}return{node:e,offset:0}}(n,r):!n||s&&1==n.nodeType?{node:e,offset:a}:W(n,r)}function H(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function K(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let n=e.childNodes[i];if(1==n.nodeType){let e=n.getClientRects();for(let r=0;r<e.length;r++){let o=e[r];if(H(t,o))return K(n,t,o)}}if((i=(i+1)%r)==o)break}return e}function J(e,t){let n,r=e.dom.ownerDocument,o=0,i=function(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:r.offset}}catch(e){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:r.startOffset}}}(r,t.left,t.top);i&&({node:n,offset:o}=i);let s,l=(e.root.elementFromPoint?e.root:r).elementFromPoint(t.left,t.top);if(!l||!e.dom.contains(1!=l.nodeType?l.parentNode:l)){let n=e.dom.getBoundingClientRect();if(!H(t,n))return null;if(l=K(e.dom,t,n),!l)return null}if(E)for(let e=l;n&&e;e=a(e))e.draggable&&(n=void 0);if(l=function(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(l,t),n){if(M&&1==n.nodeType&&(o=Math.min(o,n.childNodes.length),o<n.childNodes.length)){let e,r=n.childNodes[o];"IMG"==r.nodeName&&(e=r.getBoundingClientRect()).right<=t.left&&e.bottom>t.top&&o++}n==e.dom&&o==n.childNodes.length-1&&1==n.lastChild.nodeType&&t.top>n.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:0!=o&&1==n.nodeType&&"BR"==n.childNodes[o-1].nodeName||(s=function(e,t,n,r){let o=-1;for(let n=t,i=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0);if(!t)return null;if(1==t.dom.nodeType&&(t.node.isBlock&&t.parent&&!i||!t.contentDOM)){let e=t.dom.getBoundingClientRect();if(t.node.isBlock&&t.parent&&!i&&(i=!0,e.left>r.left||e.top>r.top?o=t.posBefore:(e.right<r.left||e.bottom<r.top)&&(o=t.posAfter)),!t.contentDOM&&o<0)return(t.node.isBlock?r.top<(e.top+e.bottom)/2:r.left<(e.left+e.right)/2)?t.posBefore:t.posAfter}n=t.dom.parentNode}return o>-1?o:e.docView.posFromDOM(t,n,-1)}(e,n,o,t))}null==s&&(s=function(e,t,n){let{node:r,offset:o}=W(t,n),i=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();i=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,o,i)}(e,l,t));let c=e.docView.nearestDesc(l,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function q(e){return e.top<e.bottom||e.left<e.right}function U(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(q(e))return e}return Array.prototype.find.call(n,q)||e.getBoundingClientRect()}const Y=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Z(e,t,n){let{node:r,offset:o,atom:i}=e.docView.domFromPos(t,n<0?-1:1),s=R||M;if(3==r.nodeType){if(!s||!Y.test(r.nodeValue)&&(n<0?o:o!=r.nodeValue.length)){let e=o,t=o,i=n<0?1:-1;return n<0&&!o?(t++,i=-1):n>=0&&o==r.nodeValue.length?(e--,i=1):n<0?e--:t++,G(U(c(r,e,t),i),i<0)}{let e=U(c(r,o,o),n);if(M&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let t=U(c(r,o-1,o-1),-1);if(t.top==e.top){let n=U(c(r,o,o+1),-1);if(n.top!=e.top)return G(n,n.left<t.left)}}return e}}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(null==i&&o&&(n<0||o==p(r))){let e=r.childNodes[o-1];if(1==e.nodeType)return Q(e.getBoundingClientRect(),!1)}if(null==i&&o<p(r)){let e=r.childNodes[o];if(1==e.nodeType)return Q(e.getBoundingClientRect(),!0)}return Q(r.getBoundingClientRect(),n>=0)}if(null==i&&o&&(n<0||o==p(r))){let e=r.childNodes[o-1],t=3==e.nodeType?c(e,p(e)-(s?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return G(U(t,1),!1)}if(null==i&&o<p(r)){let e=r.childNodes[o];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?c(e,0,s?0:1):1==e.nodeType?e:null:null;if(t)return G(U(t,-1),!0)}return G(U(3==r.nodeType?c(r):r,-n),n>=0)}function G(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function Q(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function X(e,t,n){let r=e.state,o=e.root.activeElement;r!=t&&e.updateState(t),o!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),o!=e.dom&&o&&o.focus()}}const ee=/[\u0590-\u08ac]/;let te=null,ne=null,re=!1;class oe{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){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,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}}let r;if(e==this.dom&&this.contentDOM)r=t>s(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let o,i=this.getDesc(r);if(i&&(!t||i.node)){if(!n||!(o=i.nodeDOM)||(1==o.nodeType?o.contains(1==e.nodeType?e:e.parentNode):o==e))return i;n=!1}}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let o=this.getDesc(r);if(o)return o.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],o=n+r.size;if(n==e&&o!=n){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(e<o)return r.descAt(e-n-r.border);n=o}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let o=this.children[n],i=t+o.size;if(i>e||o instanceof de){r=e-t;break}t=i}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof ie&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,e&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?s(e.dom)+1:0}}{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,e&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?s(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,o=-1;for(let i=n,a=0;;a++){let n=this.children[a],l=i+n.size;if(-1==r&&e<=l){let o=i+n.border;if(e>=o&&t<=l-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,o);e=i;for(let t=a;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=s(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(l>t||a==this.children.length-1)){t=l;for(let e=a+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){o=s(n.dom);break}t+=n.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=l}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(1!=t.nodeType||n==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let o=Math.min(e,t),i=Math.max(e,t);for(let s=0,a=0;s<this.children.length;s++){let l=this.children[s],c=a+l.size;if(o>a&&i<c)return l.setSelection(e-a-l.border,t-a-l.border,n,r);a=c}let s=this.domFromPos(e,e?-1:1),a=t==e?s:this.domFromPos(t,t?-1:1),l=n.getSelection(),c=!1;if((M||E)&&e==t){let{node:e,offset:t}=s;if(3==e.nodeType)c=!(!t||"\n"!=e.nodeValue[t-1]);else{let n=e.childNodes[t-1];c=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(M&&l.focusNode&&l.focusNode!=a.node&&1==l.focusNode.nodeType){let e=l.focusNode.childNodes[l.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||c&&E)&&u(s.node,s.offset,l.anchorNode,l.anchorOffset)&&u(a.node,a.offset,l.focusNode,l.focusOffset))return;let d=!1;if((l.extend||e==t)&&!c){l.collapse(s.node,s.offset);try{e!=t&&l.extend(a.node,a.offset),d=!0}catch(e){}}if(!d){if(e>t){let e=s;s=a,a=e}let n=document.createRange();n.setEnd(a.node,a.offset),n.setStart(s.node,s.offset),l.removeAllRanges(),l.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let o=this.children[r],i=n+o.size;if(n==i?e<=i&&t>=n:e<i&&t>n){let r=n+o.border,s=i-o.border;if(e>=r&&t<=s)return this.dirty=e==n||t==i?2:1,void(e!=r||t!=s||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(e-r,t-r):o.dirty=3);o.dirty=o.dom!=o.contentDOM||o.dom.parentNode!=this.contentDOM||o.children.length?3:2}n=i}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}}class ie extends oe{constructor(e,t,n,r){let o,i=t.type.toDOM;if("function"==typeof i&&(i=i(n,(()=>o?o.parent?o.parent.posBeforeChild(o):void 0:r))),!t.type.spec.raw){if(1!=i.nodeType){let e=document.createElement("span");e.appendChild(i),i=e}i.contentEditable="false",i.classList.add("ProseMirror-widget")}super(e,[],i,null),this.widget=t,this.widget=t,o=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||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 se extends oe{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}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"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class ae extends oe{constructor(e,t,n,r){super(e,[],n,r),this.mark=t}static create(e,t,n,r){let i=r.nodeViews[t.type.name],s=i&&i(t,r,n);return s&&s.dom||(s=o.ZF.renderSpec(document,t.type.spec.toDOM(t,n))),new ae(e,t,s.dom,s.contentDOM||s.dom)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM||void 0}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,n){let r=ae.create(this.parent,this.mark,!0,n),o=this.children,i=this.size;t<i&&(o=Se(o,t,i,n)),e>0&&(o=Se(o,0,e,n));for(let e=0;e<o.length;e++)o[e].parent=r;return r.children=o,r}}class le extends oe{constructor(e,t,n,r,o,i,s,a,l){super(e,[],o,i),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=s}static create(e,t,n,r,i,s){let a,l=i.nodeViews[t.type.name],c=l&&l(t,i,(()=>a?a.parent?a.parent.posBeforeChild(a):void 0:s),n,r),u=c&&c.dom,d=c&&c.contentDOM;if(t.isText)if(u){if(3!=u.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else u=document.createTextNode(t.text);else u||({dom:u,contentDOM:d}=o.ZF.renderSpec(document,t.type.spec.toDOM(t)));d||t.isText||"BR"==u.nodeName||(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let h=u;return u=we(u,n,t),c?a=new he(e,t,n,r,u,d||null,h,c,i,s+1):t.isText?new ue(e,t,n,r,u,h,i):new le(e,t,n,r,u,d||null,h,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>o.FK.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&ke(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,s=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new xe(this,s&&s.node,e);!function(e,t,n,r){let o=t.locals(e),i=0;if(0==o.length){for(let n=0;n<e.childCount;n++){let s=e.child(n);r(s,o,t.forChild(i,s),n),i+=s.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){if(s<o.length&&o[s].to==i){let e,t=o[s++];for(;s<o.length&&o[s].to==i;)(e||(e=[t])).push(o[s++]);if(e){e.sort(Ce);for(let t=0;t<e.length;t++)n(e[t],c,!!l)}else n(t,c,!!l)}let u,d;if(l)d=-1,u=l,l=null;else{if(!(c<e.childCount))break;d=c,u=e.child(c++)}for(let e=0;e<a.length;e++)a[e].to<=i&&a.splice(e--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)a.push(o[s++]);let h=i+u.nodeSize;if(u.isText){let e=h;s<o.length&&o[s].from<e&&(e=o[s].from);for(let t=0;t<a.length;t++)a[t].to<e&&(e=a[t].to);e<h&&(l=u.cut(e-i),u=u.cut(0,e-i),h=e,d=-1)}r(u,u.isInline&&!u.isLeaf?a.filter((e=>!e.inline)):a.slice(),t.forChild(i,u),d),i=h}}(this.node,this.innerDeco,((t,i,s)=>{t.spec.marks?l.syncToMarks(t.spec.marks,n,e):t.type.side>=0&&!s&&l.syncToMarks(i==this.node.childCount?o.CU.none:this.node.child(i).marks,n,e),l.placeWidget(t,e,r)}),((t,o,s,c)=>{let u;l.syncToMarks(t.marks,n,e),l.findNodeMatch(t,o,s,c)||a&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(u=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(t,o,s,u,e)||l.updateNextNode(t,o,s,e,c,r)||l.addNode(t,o,s,e,r),r+=t.nodeSize})),l.syncToMarks([],n,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||2==this.dirty)&&(s&&this.protectLocalComposition(e,s),pe(this.contentDOM,this.children,e),D&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:n,to:o}=e.state.selection;if(!(e.state.selection instanceof r.U3)||n<t||o>t+this.node.content.size)return null;let i=e.domSelectionRange(),s=function(e,t){for(;;){if(3==e.nodeType)return e;if(1==e.nodeType&&t>0){if(e.childNodes.length>t&&3==e.childNodes[t].nodeType)return e.childNodes[t];t=p(e=e.childNodes[t-1])}else{if(!(1==e.nodeType&&t<e.childNodes.length))return null;e=e.childNodes[t],t=0}}}(i.focusNode,i.focusOffset);if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let e=s.nodeValue,r=function(e,t,n,r){for(let o=0,i=0;o<e.childCount&&i<=r;){let s=e.child(o++),a=i;if(i+=s.nodeSize,!s.isText)continue;let l=s.text;for(;o<e.childCount;){let t=e.child(o++);if(i+=t.nodeSize,!t.isText)break;l+=t.text}if(i>=n){let e=a<r?l.lastIndexOf(t,r-a-1):-1;if(e>=0&&e+t.length+a>=n)return a+e;if(n==r&&l.length>=r+t.length-a&&l.slice(r-a,r-a+t.length)==t)return r}}return-1}(this.node.content,e,n-t,o-t);return r<0?null:{node:s,pos:r,text:e}}return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let o=t;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let i=new se(this,o,t,r);e.input.compositionNodes.push(i),this.children=Se(this.children,n,n+r.length,e,i)}update(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node)||(this.updateInner(e,t,n,r),0))}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(ke(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=ye(this.dom,this.nodeDOM,ge(this.outerDeco,this.node,t),ge(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)}deselectNode(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable")}get domAtom(){return this.node.isAtom}}function ce(e,t,n,r,o){we(r,t,e);let i=new le(void 0,e,t,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class ue extends le{constructor(e,t,n,r,o,i,s){super(e,t,n,r,o,null,i,s,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node)||(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,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,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),o=document.createTextNode(r.text);return new ue(this.parent,r,this.outerDeco,this.innerDeco,o,o,n)}markDirty(e,t){super.markDirty(e,t),this.dom==this.nodeDOM||0!=e&&t!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}}class de extends oe{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class he extends le{constructor(e,t,n,r,o,i,s,a,l,c){super(e,t,n,r,o,i,s,l,c),this.spec=a}update(e,t,n,r){if(3==this.dirty)return!1;if(this.spec.update){let o=this.spec.update(e,t,n);return o&&this.updateInner(e,t,n,r),o}return!(!this.contentDOM&&!e.isLeaf)&&super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function pe(e,t,n){let r=e.firstChild,o=!1;for(let i=0;i<t.length;i++){let s=t[i],a=s.dom;if(a.parentNode==e){for(;a!=r;)r=be(r),o=!0;r=r.nextSibling}else o=!0,e.insertBefore(a,r);if(s instanceof ae){let t=r?r.previousSibling:e.lastChild;pe(s.contentDOM,s.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=be(r),o=!0;o&&n.trackWrites==e&&(n.trackWrites=null)}const fe=function(e){e&&(this.nodeName=e)};fe.prototype=Object.create(null);const me=[new fe];function ge(e,t,n){if(0==e.length)return me;let r=n?me[0]:new fe,o=[r];for(let i=0;i<e.length;i++){let s=e[i].type.attrs;if(s){s.nodeName&&o.push(r=new fe(s.nodeName));for(let e in s){let i=s[e];null!=i&&(n&&1==o.length&&o.push(r=new fe(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+i:"style"==e?r.style=(r.style?r.style+";":"")+i:"nodeName"!=e&&(r[e]=i))}}}return o}function ye(e,t,n,r){if(n==me&&r==me)return t;let o=t;for(let t=0;t<r.length;t++){let i=r[t],s=n[t];if(t){let t;s&&s.nodeName==i.nodeName&&o!=e&&(t=o.parentNode)&&t.nodeName.toLowerCase()==i.nodeName||(t=document.createElement(i.nodeName),t.pmIsDeco=!0,t.appendChild(o),s=me[0]),o=t}ve(o,s||me[0],i)}return o}function ve(e,t,n){for(let r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let t=0;t<r.length;t++)-1==o.indexOf(r[t])&&e.classList.remove(r[t]);for(let t=0;t<o.length;t++)-1==r.indexOf(o[t])&&e.classList.add(o[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let n,r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;n=r.exec(t.style);)e.style.removeProperty(n[1])}n.style&&(e.style.cssText+=n.style)}}function we(e,t,n){return ye(e,e,me,ge(t,n,1!=e.nodeType))}function ke(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function be(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class xe{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,r=n.children.length,o=e.childCount,i=new Map,s=[];e:for(;o>0;){let a;for(;;)if(r){let e=n.children[r-1];if(!(e instanceof ae)){a=e,r--;break}n=e,r=e.children.length}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=e.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n){let r=0,o=this.stack.length>>1,i=Math.min(o,e.length);for(;r<i&&(r==o-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&!1!==e[r].type.spec.spanning;)r++;for(;r<o;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let r=-1;for(let t=this.index;t<Math.min(this.index+3,this.top.children.length);t++){let n=this.top.children[t];if(n.matchesMark(e[o])&&!this.isLocked(n.dom)){r=t;break}}if(r>-1)r>this.index&&(this.changed=!0,this.destroyBetween(this.index,r)),this.top=this.top.children[this.index];else{let r=ae.create(this.top,e[o],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,n,r){let o,i=-1;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))i=this.top.children.indexOf(o,this.index);else for(let r=this.index,o=Math.min(this.top.children.length,r+5);r<o;r++){let o=this.top.children[r];if(o.matchesNode(e,t,n)&&!this.preMatch.matched.has(o)){i=r;break}}return!(i<0||(this.destroyBetween(this.index,i),this.index++,0))}updateNodeAt(e,t,n,r,o){let i=this.top.children[r];return 3==i.dirty&&i.dom==i.contentDOM&&(i.dirty=2),!!i.update(e,t,n,o)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t)for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e;return-1}e=t}}updateNextNode(e,t,n,r,o,i){for(let s=this.index;s<this.top.children.length;s++){let a=this.top.children[s];if(a instanceof le){let l=this.preMatch.matched.get(a);if(null!=l&&l!=o)return!1;let c,u=a.dom,d=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&ke(t,a.outerDeco));if(!d&&a.update(e,t,n,r))return this.destroyBetween(this.index,s),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!d&&(c=this.recreateWrapper(a,e,t,n,r,i)))return this.top.children[this.index]=c,c.dirty=2,c.updateChildren(r,i+1),c.dirty=0,this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,o,i){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content))return null;let s=le.create(this.top,t,n,r,o,i);if(!s.contentDOM)return null;s.children=e.children,e.children=[];for(let e of s.children)e.parent=s;return s}addNode(e,t,n,r,o){let i=le.create(this.top,e,t,n,r,o);i.contentDOM&&i.updateChildren(r,o+1),this.top.children.splice(this.index++,0,i),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){let r=new ie(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}else this.index++}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof ae;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof ue)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((E||O)&&e&&"false"==e.dom.contentEditable&&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 n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new de(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function Ce(e,t){return e.type.side-t.type.side}function Se(e,t,n,r,o){let i=[];for(let s=0,a=0;s<e.length;s++){let l=e[s],c=a,u=a+=l.size;c>=n||u<=t?i.push(l):(c<t&&i.push(l.slice(0,t-c,r)),o&&(i.push(o),o=void 0),u>n&&i.push(l.slice(n-c,l.size,r)))}return i}function Me(e,t=null){let n=e.domSelectionRange(),o=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),a=i&&0==i.size,l=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(l<0)return null;let c,u,d=o.resolve(l);if(m(n)){for(c=d;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&r.nh.isSelectable(e)&&i.parent&&(!e.isInline||!function(e,t,n){for(let r=0==t,o=t==p(e);r||o;){if(e==n)return!0;let t=s(e);if(!(e=e.parentNode))return!1;r=r&&0==t,o=o&&t==p(e)}}(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;u=new r.nh(l==e?d:o.resolve(e))}}else{let t=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(t<0)return null;c=o.resolve(t)}return u||(u=Re(e,c,d,"pointer"==t||e.state.selection.head<d.pos&&!a?1:-1)),u}function Ne(e){return e.editable?e.hasFocus():Be(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Oe(e,t=!1){let n=e.state.selection;if(Fe(e,n),Ne(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&O){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&u(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection(),n=document.createRange(),r=e.cursorWrapper.dom,o="IMG"==r.nodeName;o?n.setEnd(r.parentNode,s(r)+1):n.setEnd(r,0),n.collapse(!1),t.removeAllRanges(),t.addRange(n),!o&&!e.state.selection.visible&&C&&S<=11&&(r.disabled=!0,r.disabled=!1)}(e);else{let o,i,{anchor:s,head:a}=n;!Ae||n instanceof r.U3||(n.$from.parent.inlineContent||(o=Ee(e,n.from)),n.empty||n.$from.parent.inlineContent||(i=Ee(e,n.to))),e.docView.setSelection(s,a,e.root,t),Ae&&(o&&Te(o),i&&Te(i)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{n.anchorNode==r&&n.anchorOffset==o||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout((()=>{Ne(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")}),20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const Ae=E||O&&A<63;function Ee(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(E&&o&&"false"==o.contentEditable)return De(o);if(!(o&&"false"!=o.contentEditable||i&&"false"!=i.contentEditable)){if(o)return De(o);if(i)return De(i)}}function De(e){return e.contentEditable="true",E&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function Te(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function Fe(e,t){if(t instanceof r.nh){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Ie(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Ie(e)}function Ie(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function Re(e,t,n,o){return e.someProp("createSelectionBetween",(r=>r(e,t,n)))||r.U3.between(t,n,o)}function Pe(e){return!(e.editable&&!e.hasFocus())&&Be(e)}function Be(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function Le(e,t){let{$anchor:n,$head:o}=e.selection,i=t>0?n.max(o):n.min(o),s=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return s&&r.LN.findFrom(s,t)}function ze(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function $e(e,t,n){let o=e.state.selection;if(!(o instanceof r.U3)){if(o instanceof r.nh&&o.node.isInline)return ze(e,new r.U3(t>0?o.$to:o.$from));{let n=Le(e.state,t);return!!n&&ze(e,n)}}if(!o.empty||n.indexOf("s")>-1)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){let n=Le(e.state,t);return!!(n&&n instanceof r.nh)&&ze(e,n)}if(!(T&&n.indexOf("m")>-1)){let n,i=o.$head,s=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText)return!1;let a=t<0?i.pos-s.nodeSize:i.pos;return!!(s.isAtom||(n=e.docView.descAt(a))&&!n.contentDOM)&&(r.nh.isSelectable(s)?ze(e,new r.nh(t<0?e.state.doc.resolve(i.pos-s.nodeSize):i)):!!R&&ze(e,new r.U3(e.state.doc.resolve(t<0?a:a+s.nodeSize))))}}function je(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function _e(e){let t=e.pmViewDesc;return t&&0==t.size&&(e.nextSibling||"BR"!=e.nodeName)}function Ve(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,a=!1;for(M&&1==n.nodeType&&r<je(n)&&_e(n.childNodes[r])&&(a=!0);;)if(r>0){if(1!=n.nodeType)break;{let e=n.childNodes[r-1];if(_e(e))o=n,i=--r;else{if(3!=e.nodeType)break;n=e,r=n.nodeValue.length}}}else{if(He(n))break;{let t=n.previousSibling;for(;t&&_e(t);)o=n.parentNode,i=s(t),t=t.previousSibling;if(t)n=t,r=je(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}a?Ke(e,n,r):o&&Ke(e,o,i)}(e):We(e)}function We(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,a=je(n);for(;;)if(r<a){if(1!=n.nodeType)break;if(!_e(n.childNodes[r]))break;o=n,i=++r}else{if(He(n))break;{let t=n.nextSibling;for(;t&&_e(t);)o=t.parentNode,i=s(t)+1,t=t.nextSibling;if(t)n=t,r=0,a=je(n);else{if(n=n.parentNode,n==e.dom)break;r=a=0}}}o&&Ke(e,o,i)}function He(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Ke(e,t,n){let r=e.domSelection();if(m(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:o}=e;setTimeout((()=>{e.state==o&&Oe(e)}),50)}function Je(e,t){let n=e.state.doc.resolve(t);if(!O&&!F&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(t<n.end()){let n=e.coordsAtPos(t+1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function qe(e,t,n){let o=e.state.selection;if(o instanceof r.U3&&!o.empty||n.indexOf("s")>-1)return!1;if(T&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=o;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=Le(e.state,t);if(n&&n instanceof r.nh)return ze(e,n)}if(!i.parent.inlineContent){let n=t<0?i:s,a=o instanceof r.i5?r.LN.near(n,t):r.LN.findFrom(n,t);return!!a&&ze(e,a)}return!1}function Ue(e,t){if(!(e.state.selection instanceof r.U3))return!0;let{$head:n,$anchor:o,empty:i}=e.state.selection;if(!n.sameParent(o))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let s=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let r=e.state.tr;return t<0?r.delete(n.pos-s.nodeSize,n.pos):r.delete(n.pos,n.pos+s.nodeSize),e.dispatch(r),!0}return!1}function Ye(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Ze(e,t){e.someProp("transformCopied",(n=>{t=n(t,e)}));let n=[],{content:r,openStart:i,openEnd:s}=t;for(;i>1&&s>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,s--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let a=e.someProp("clipboardSerializer")||o.ZF.fromSchema(e.state.schema),l=st(),c=l.createElement("div");c.appendChild(a.serializeFragment(r,{document:l}));let u,d=c.firstChild,h=0;for(;d&&1==d.nodeType&&(u=ot[d.nodeName.toLowerCase()]);){for(let e=u.length-1;e>=0;e--){let t=l.createElement(u[e]);for(;c.firstChild;)t.appendChild(c.firstChild);c.appendChild(t),h++}d=c.firstChild}return d&&1==d.nodeType&&d.setAttribute("data-pm-slice",`${i} ${s}${h?` -${h}`:""} ${JSON.stringify(n)}`),{dom:c,text:e.someProp("clipboardTextSerializer",(n=>n(t,e)))||t.content.textBetween(0,t.content.size,"\n\n")}}function Ge(e,t,n,r,i){let s,a,l=i.parent.type.spec.code;if(!n&&!t)return null;let c=t&&(r||l||!n);if(c){if(e.someProp("transformPastedText",(n=>{t=n(t,l||r,e)})),l)return t?new o.Ji(o.FK.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0):o.Ji.empty;let n=e.someProp("clipboardTextParser",(n=>n(t,i,r,e)));if(n)a=n;else{let n=i.marks(),{schema:r}=e.state,a=o.ZF.fromSchema(r);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach((e=>{let t=s.appendChild(document.createElement("p"));e&&t.appendChild(a.serializeNode(r.text(e,n)))}))}}else e.someProp("transformPastedHTML",(t=>{n=t(n,e)})),s=function(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n,r=st().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e);if((n=o&&ot[o[1].toLowerCase()])&&(e=n.map((e=>"<"+e+">")).join("")+e+n.map((e=>"</"+e+">")).reverse().join("")),r.innerHTML=e,n)for(let e=0;e<n.length;e++)r=r.querySelector(n[e])||r;return r}(n),R&&function(e){let t=e.querySelectorAll(O?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(s);let u=s&&s.querySelector("[data-pm-slice]"),d=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let e=+d[3];e>0;e--){let e=s.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;s=e}if(!a){let t=e.someProp("clipboardParser")||e.someProp("domParser")||o.S4.fromSchema(e.state.schema);a=t.parseSlice(s,{preserveWhitespace:!(!c&&!d),context:i,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||Qe.test(e.parentNode.nodeName)?null:{ignore:!0}})}if(d)a=function(e,t){if(!e.size)return e;let n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(t){return e}let{content:i,openStart:s,openEnd:a}=e;for(let e=n.length-2;e>=0;e-=2){let t=r.nodes[n[e]];if(!t||t.hasRequiredAttrs())break;i=o.FK.from(t.create(n[e+1],i)),s++,a++}return new o.Ji(i,s,a)}(rt(a,+d[1],+d[2]),d[4]);else if(a=o.Ji.maxOpen(function(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r,i=t.node(n).contentMatchAt(t.index(n)),s=[];if(e.forEach((e=>{if(!s)return;let t,n=i.findWrapping(e.type);if(!n)return s=null;if(t=s.length&&r.length&&et(n,r,e,s[s.length-1],0))s[s.length-1]=t;else{s.length&&(s[s.length-1]=tt(s[s.length-1],r.length));let t=Xe(e,n);s.push(t),i=i.matchType(t.type),r=n}})),s)return o.FK.from(s)}return e}(a.content,i),!0),a.openStart||a.openEnd){let e=0,t=0;for(let t=a.content.firstChild;e<a.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=a.content.lastChild;t<a.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);a=rt(a,e,t)}return e.someProp("transformPasted",(t=>{a=t(a,e)})),a}const Qe=/^(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 Xe(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,o.FK.from(e));return e}function et(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let s=et(e,t,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(o.FK.from(Xe(n,e,i+1))))}}function tt(e,t){if(0==t)return e;let n=e.content.replaceChild(e.childCount-1,tt(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(o.FK.empty,!0);return e.copy(n.append(r))}function nt(e,t,n,r,i,s){let a=t<0?e.firstChild:e.lastChild,l=a.content;return e.childCount>1&&(s=0),i<r-1&&(l=nt(l,t,n,r,i+1,s)),i>=n&&(l=t<0?a.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(a.contentMatchAt(a.childCount).fillBefore(o.FK.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,a.copy(l))}function rt(e,t,n){return t<e.openStart&&(e=new o.Ji(nt(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new o.Ji(nt(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const ot={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 it=null;function st(){return it||(it=document.implementation.createHTMLDocument("title"))}const at={},lt={},ct={touchstart:!0,touchmove:!0};class ut{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.lastAndroidDelete=0,this.composing=!1,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function dt(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function ht(e){e.someProp("handleDOMEvents",(t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>pt(e,t))}))}function pt(e,t){return e.someProp("handleDOMEvents",(n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)}))}function ft(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function mt(e){return{left:e.clientX,top:e.clientY}}function gt(e,t,n,r,o){if(-1==r)return!1;let i=e.state.doc.resolve(r);for(let r=i.depth+1;r>0;r--)if(e.someProp(t,(t=>r>i.depth?t(e,n,i.nodeAfter,i.before(r),o,!0):t(e,n,i.node(r),i.before(r),o,!1))))return!0;return!1}function yt(e,t,n){e.focused||e.focus();let r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}function vt(e,t,n,r){return gt(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",(n=>n(e,t,r)))}function wt(e,t,n,o){return gt(e,"handleTripleClickOn",t,n,o)||e.someProp("handleTripleClick",(n=>n(e,t,o)))||function(e,t,n){if(0!=n.button)return!1;let o=e.state.doc;if(-1==t)return!!o.inlineContent&&(yt(e,r.U3.create(o,0,o.content.size),"pointer"),!0);let i=o.resolve(t);for(let t=i.depth+1;t>0;t--){let n=t>i.depth?i.nodeAfter:i.node(t),s=i.before(t);if(n.inlineContent)yt(e,r.U3.create(o,s+1,s+1+n.content.size),"pointer");else{if(!r.nh.isSelectable(n))continue;yt(e,r.nh.create(o,s),"pointer")}return!0}}(e,n,o)}function kt(e){return Ot(e)}lt.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!Ct(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!I||!O||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!D||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)e.someProp("handleKeyDown",(t=>t(e,n)))||function(e,t){let n=t.keyCode,r=function(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);if(8==n||T&&72==n&&"c"==r)return Ue(e,-1)||Ve(e,-1);if(46==n||T&&68==n&&"c"==r)return Ue(e,1)||Ve(e,1);if(13==n||27==n)return!0;if(37==n||T&&66==n&&"c"==r){let t=37==n?"ltr"==Je(e,e.state.selection.from)?-1:1:-1;return $e(e,t,r)||Ve(e,t)}if(39==n||T&&70==n&&"c"==r){let t=39==n?"ltr"==Je(e,e.state.selection.from)?1:-1:1;return $e(e,t,r)||Ve(e,t)}return 38==n||T&&80==n&&"c"==r?qe(e,-1,r)||Ve(e,-1):40==n||T&&78==n&&"c"==r?function(e){if(!E||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;Ye(e,n,"true"),setTimeout((()=>Ye(e,n,"false")),20)}return!1}(e)||qe(e,1,r)||We(e):r==(T?"m":"c")&&(66==n||73==n||89==n||90==n)}(e,n)?n.preventDefault():dt(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout((()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",(t=>t(e,g(13,"Enter")))),e.input.lastIOSEnter=0)}),200)}},lt.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},lt.keypress=(e,t)=>{let n=t;if(Ct(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||T&&n.metaKey)return;if(e.someProp("handleKeyPress",(t=>t(e,n))))return void n.preventDefault();let o=e.state.selection;if(!(o instanceof r.U3&&o.$from.sameParent(o.$to))){let t=String.fromCharCode(n.charCode);/[\r\n]/.test(t)||e.someProp("handleTextInput",(n=>n(e,o.$from.pos,o.$to.pos,t)))||e.dispatch(e.state.tr.insertText(t).scrollIntoView()),n.preventDefault()}};const bt=T?"metaKey":"ctrlKey";at.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=kt(e),o=Date.now(),i="singleClick";o-e.input.lastClick.time<500&&function(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(n,e.input.lastClick)&&!n[bt]&&("singleClick"==e.input.lastClick.type?i="doubleClick":"doubleClick"==e.input.lastClick.type&&(i="tripleClick")),e.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i};let s=e.posAtCoords(mt(n));s&&("singleClick"==i?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new xt(e,s,n,!!r)):("doubleClick"==i?vt:wt)(e,s.pos,s.inside,n)?n.preventDefault():dt(e,"pointer"))};class xt{constructor(e,t,n,o){let i,s;if(this.view=e,this.pos=t,this.event=n,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[bt],this.allowDefault=n.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),s=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,s=n.depth?n.before():0}const a=o?null:n.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l?l.dom:null;let{selection:c}=e.state;(0==n.button&&i.type.spec.draggable&&!1!==i.type.spec.selectable||c instanceof r.nh&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!M||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)),dt(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((()=>Oe(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(mt(e))),this.updateAllowDefault(e),this.allowDefault||!t?dt(this.view,"pointer"):function(e,t,n,o,i){return gt(e,"handleClickOn",t,n,o)||e.someProp("handleClick",(n=>n(e,t,o)))||(i?function(e,t){if(-1==t)return!1;let n,o,i=e.state.selection;i instanceof r.nh&&(n=i.node);let s=e.state.doc.resolve(t);for(let e=s.depth+1;e>0;e--){let t=e>s.depth?s.nodeAfter:s.node(e);if(r.nh.isSelectable(t)){o=n&&i.$from.depth>0&&e>=i.$from.depth&&s.before(i.$from.depth+1)==i.$from.pos?s.before(i.$from.depth):s.before(e);break}}return null!=o&&(yt(e,r.nh.create(e.state.doc,o),"pointer"),!0)}(e,n):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),o=n.nodeAfter;return!!(o&&o.isAtom&&r.nh.isSelectable(o))&&(yt(e,new r.nh(n),"pointer"),!0)}(e,n))}(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||E&&this.mightDrag&&!this.mightDrag.node.isAtom||O&&!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)?(yt(this.view,r.LN.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):dt(this.view,"pointer")}move(e){this.updateAllowDefault(e),dt(this.view,"pointer"),0==e.buttons&&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)}}function Ct(e,t){return!!e.composing||!!(E&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}at.touchstart=e=>{e.input.lastTouch=Date.now(),kt(e),dt(e,"pointer")},at.touchmove=e=>{e.input.lastTouch=Date.now(),dt(e,"pointer")},at.contextmenu=e=>kt(e);const St=I?5e3:-1;function Mt(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout((()=>Ot(e)),t))}function Nt(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=function(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Ot(e,t=!1){if(!(I&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),Nt(e),t||e.docView&&e.docView.dirty){let t=Me(e);return t&&!t.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(t)):e.updateState(e.state),!0}return!1}}lt.compositionstart=lt.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$from;if(t.selection.empty&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((e=>!1===e.type.spec.inclusive))))e.markCursor=e.state.storedMarks||n.marks(),Ot(e,!0),e.markCursor=null;else if(Ot(e),M&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){e.domSelection().collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}Mt(e,St)},lt.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionID++,Mt(e,20))};const At=C&&S<15||D&&P<604;function Et(e,t,n,r,i){let s=Ge(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",(t=>t(e,i,s||o.Ji.empty))))return!0;if(!s)return!1;let a=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(s),l=a?e.state.tr.replaceSelectionWith(a,e.input.shiftKey):e.state.tr.replaceSelection(s);return e.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}at.copy=lt.cut=(e,t)=>{let n=t,r=e.state.selection,o="cut"==n.type;if(r.empty)return;let i=At?null:n.clipboardData,s=r.content(),{dom:a,text:l}=Ze(e,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout((()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()}),50)}(e,a),o&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},lt.paste=(e,t)=>{let n=t;if(e.composing&&!I)return;let r=At?null:n.clipboardData;r&&Et(e,r.getData("text/plain"),r.getData("text/html"),e.input.shiftKey,n)?n.preventDefault():function(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout((()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Et(e,r.value,null,e.input.shiftKey,t):Et(e,r.textContent,r.innerHTML,e.input.shiftKey,t)}),50)}(e,n)};class Dt{constructor(e,t){this.slice=e,this.move=t}}const Tt=T?"altKey":"ctrlKey";at.dragstart=(e,t)=>{let n=t,o=e.input.mouseDown;if(o&&o.done(),!n.dataTransfer)return;let i=e.state.selection,s=i.empty?null:e.posAtCoords(mt(n));if(s&&s.pos>=i.from&&s.pos<=(i instanceof r.nh?i.to-1:i.to));else if(o&&o.mightDrag)e.dispatch(e.state.tr.setSelection(r.nh.create(e.state.doc,o.mightDrag.pos)));else if(n.target&&1==n.target.nodeType){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&e.dispatch(e.state.tr.setSelection(r.nh.create(e.state.doc,t.posBefore)))}let a=e.state.selection.content(),{dom:l,text:c}=Ze(e,a);n.dataTransfer.clearData(),n.dataTransfer.setData(At?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",At||n.dataTransfer.setData("text/plain",c),e.dragging=new Dt(a,!n[Tt])},at.dragend=e=>{let t=e.dragging;window.setTimeout((()=>{e.dragging==t&&(e.dragging=null)}),50)},lt.dragover=lt.dragenter=(e,t)=>t.preventDefault(),lt.drop=(e,t)=>{let n=t,s=e.dragging;if(e.dragging=null,!n.dataTransfer)return;let a=e.posAtCoords(mt(n));if(!a)return;let l=e.state.doc.resolve(a.pos),c=s&&s.slice;c?e.someProp("transformPasted",(t=>{c=t(c,e)})):c=Ge(e,n.dataTransfer.getData(At?"Text":"text/plain"),At?null:n.dataTransfer.getData("text/html"),!1,l);let u=!(!s||n[Tt]);if(e.someProp("handleDrop",(t=>t(e,n,c||o.Ji.empty,u))))return void n.preventDefault();if(!c)return;n.preventDefault();let d=c?(0,i.Um)(e.state.doc,l.pos,c):l.pos;null==d&&(d=l.pos);let h=e.state.tr;u&&h.deleteSelection();let p=h.mapping.map(d),f=0==c.openStart&&0==c.openEnd&&1==c.content.childCount,m=h.doc;if(f?h.replaceRangeWith(p,p,c.content.firstChild):h.replaceRange(p,p,c),h.doc.eq(m))return;let g=h.doc.resolve(p);if(f&&r.nh.isSelectable(c.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(c.content.firstChild))h.setSelection(new r.nh(g));else{let t=h.mapping.map(d);h.mapping.maps[h.mapping.maps.length-1].forEach(((e,n,r,o)=>t=o)),h.setSelection(Re(e,g,h.doc.resolve(t)))}e.focus(),e.dispatch(h.setMeta("uiEvent","drop"))},at.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout((()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Oe(e)}),20))},at.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},at.beforeinput=(e,t)=>{if(O&&I&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout((()=>{if(e.input.domChangeCount!=t)return;if(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",(t=>t(e,g(8,"Backspace")))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())}),50)}};for(let e in lt)at[e]=lt[e];function Ft(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class It{constructor(e,t){this.toDOM=e,this.spec=t||zt,this.side=this.spec.side||0}map(e,t,n,r){let{pos:o,deleted:i}=e.mapResult(t.from+r,this.side<0?-1:1);return i?null:new Bt(o-n,o-n,this)}valid(){return!0}eq(e){return this==e||e instanceof It&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ft(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Rt{constructor(e,t){this.attrs=e,this.spec=t||zt}map(e,t,n,r){let o=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,i=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new Bt(o,i,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Rt&&Ft(this.attrs,e.attrs)&&Ft(this.spec,e.spec)}static is(e){return e.type instanceof Rt}destroy(){}}class Pt{constructor(e,t){this.attrs=e,this.spec=t||zt}map(e,t,n,r){let o=e.mapResult(t.from+r,1);if(o.deleted)return null;let i=e.mapResult(t.to+r,-1);return i.deleted||i.pos<=o.pos?null:new Bt(o.pos-n,i.pos-n,this)}valid(e,t){let n,{index:r,offset:o}=e.content.findIndex(t.from);return o==t.from&&!(n=e.child(r)).isText&&o+n.nodeSize==t.to}eq(e){return this==e||e instanceof Pt&&Ft(this.attrs,e.attrs)&&Ft(this.spec,e.spec)}destroy(){}}class Bt{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new Bt(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,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new Bt(e,e,new It(t,n))}static inline(e,t,n,r){return new Bt(e,t,new Rt(n,r))}static node(e,t,n,r){return new Bt(e,t,new Pt(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Rt}}const Lt=[],zt={};class $t{constructor(e,t){this.local=e.length?e:Lt,this.children=t.length?t:Lt}static create(e,t){return t.length?Kt(t,e,0,zt):jt}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,o){for(let i=0;i<this.local.length;i++){let s=this.local[i];s.from<=t&&s.to>=e&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<t&&this.children[i+1]>e){let s=this.children[i]+1;this.children[i+2].findInner(e-s,t-s,n,r+s,o)}}map(e,t,n){return this==jt||0==e.maps.length?this:this.mapInner(e,t,0,0,n||zt)}mapInner(e,t,n,r,o){let i;for(let s=0;s<this.local.length;s++){let a=this.local[s].map(e,n,r);a&&a.type.valid(t,a)?(i||(i=[])).push(a):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?function(e,t,n,r,o,i,s){let a=e.slice();for(let e=0,t=i;e<n.maps.length;e++){let r=0;n.maps[e].forEach(((e,n,i,s)=>{let l=s-i-(n-e);for(let s=0;s<a.length;s+=3){let c=a[s+1];if(c<0||e>c+t-r)continue;let u=a[s]+t-r;n>=u?a[s+1]=e<=u?-2:-1:i>=o&&l&&(a[s]+=l,a[s+1]+=l)}r+=l})),t=n.maps[e].map(t,-1)}let l=!1;for(let t=0;t<a.length;t+=3)if(a[t+1]<0){if(-2==a[t+1]){l=!0,a[t+1]=-1;continue}let c=n.map(e[t]+i),u=c-o;if(u<0||u>=r.content.size){l=!0;continue}let d=n.map(e[t+1]+i,-1)-o,{index:h,offset:p}=r.content.findIndex(u),f=r.maybeChild(h);if(f&&p==u&&p+f.nodeSize==d){let r=a[t+2].mapInner(n,f,c+1,e[t]+i+1,s);r!=jt?(a[t]=u,a[t+1]=d,a[t+2]=r):(a[t+1]=-2,l=!0)}else l=!0}if(l){let l=function(e,t,n,r,o,i,s){function a(e,t){for(let i=0;i<e.local.length;i++){let a=e.local[i].map(r,o,t);a?n.push(a):s.onRemove&&s.onRemove(e.local[i].spec)}for(let n=0;n<e.children.length;n+=3)a(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)-1==e[n+1]&&a(e[n+2],t[n]+i+1);return n}(a,e,t,n,o,i,s),c=Kt(l,r,0,s);t=c.local;for(let e=0;e<a.length;e+=3)a[e+1]<0&&(a.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<a.length&&a[t]<n;)t+=3;a.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new $t(t.sort(Jt),a)}(this.children,i||[],e,t,n,r,o):i?new $t(i.sort(Jt),Lt):jt}add(e,t){return t.length?this==jt?$t.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,o=0;e.forEach(((e,i)=>{let s,a=i+n;if(s=Wt(t,e,a)){for(r||(r=this.children.slice());o<r.length&&r[o]<i;)o+=3;r[o]==i?r[o+2]=r[o+2].addInner(e,s,a+1):r.splice(o,0,i,i+e.nodeSize,Kt(s,e,a+1,zt)),o+=3}}));let i=Vt(o?Ht(t):t,-n);for(let t=0;t<i.length;t++)i[t].type.valid(e,i[t])||i.splice(t--,1);return new $t(i.length?this.local.concat(i).sort(Jt):this.local,r||this.children)}remove(e){return 0==e.length||this==jt?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let r=0;r<n.length;r+=3){let o,i=n[r]+t,s=n[r+1]+t;for(let t,n=0;n<e.length;n++)(t=e[n])&&t.from>i&&t.to<s&&(e[n]=null,(o||(o=[])).push(t));if(!o)continue;n==this.children&&(n=this.children.slice());let a=n[r+2].removeInner(o,i+1);a!=jt?n[r+2]=a:(n.splice(r,3),r-=3)}if(r.length)for(let n,o=0;o<e.length;o++)if(n=e[o])for(let e=0;e<r.length;e++)r[e].eq(n,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1));return n==this.children&&r==this.local?this:r.length||n.length?new $t(r,n):jt}forChild(e,t){if(this==jt)return this;if(t.isLeaf)return $t.empty;let n,r;for(let t=0;t<this.children.length;t+=3)if(this.children[t]>=e){this.children[t]==e&&(n=this.children[t+2]);break}let o=e+1,i=o+t.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<i&&t.to>o&&t.type instanceof Rt){let e=Math.max(o,t.from)-o,n=Math.min(i,t.to)-o;e<n&&(r||(r=[])).push(t.copy(e,n))}}if(r){let e=new $t(r.sort(Jt),Lt);return n?new _t([e,n]):e}return n||jt}eq(e){if(this==e)return!0;if(!(e instanceof $t)||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 qt(this.localsInner(e))}localsInner(e){if(this==jt)return Lt;if(e.inlineContent||!this.local.some(Rt.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof Rt||t.push(this.local[e]);return t}}$t.empty=new $t([],[]),$t.removeOverlap=qt;const jt=$t.empty;class _t{constructor(e){this.members=e}map(e,t){const n=this.members.map((n=>n.map(e,t,zt)));return _t.from(n)}forChild(e,t){if(t.isLeaf)return $t.empty;let n=[];for(let r=0;r<this.members.length;r++){let o=this.members[r].forChild(e,t);o!=jt&&(o instanceof _t?n=n.concat(o.members):n.push(o))}return _t.from(n)}eq(e){if(!(e instanceof _t)||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,n=!0;for(let r=0;r<this.members.length;r++){let o=this.members[r].localsInner(e);if(o.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<o.length;e++)t.push(o[e])}else t=o}return t?qt(n?t:t.sort(Jt)):Lt}static from(e){switch(e.length){case 0:return jt;case 1:return e[0];default:return new _t(e.every((e=>e instanceof $t))?e:e.reduce(((e,t)=>e.concat(t instanceof $t?t:t.members)),[]))}}}function Vt(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let o=e[r];n.push(new Bt(o.from+t,o.to+t,o.type))}return n}function Wt(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,o=null;for(let t,i=0;i<e.length;i++)(t=e[i])&&t.from>n&&t.to<r&&((o||(o=[])).push(t),e[i]=null);return o}function Ht(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function Kt(e,t,n,r){let o=[],i=!1;t.forEach(((t,s)=>{let a=Wt(e,t,s+n);if(a){i=!0;let e=Kt(a,t,n+s+1,r);e!=jt&&o.push(s,s+t.nodeSize,e)}}));let s=Vt(i?Ht(e):e,-n).sort(Jt);for(let e=0;e<s.length;e++)s[e].type.valid(t,s[e])||(r.onRemove&&r.onRemove(s[e].spec),s.splice(e--,1));return s.length||o.length?new $t(s,o):jt}function Jt(e,t){return e.from-t.from||e.to-t.to}function qt(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let o=n+1;o<t.length;o++){let i=t[o];if(i.from!=r.from){i.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,i.from),Ut(t,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(t==e&&(t=e.slice()),t[o]=i.copy(i.from,r.to),Ut(t,o+1,i.copy(r.to,i.to)))}}return t}function Ut(e,t,n){for(;t<e.length&&Jt(n,e[t])>0;)t++;e.splice(t,0,n)}function Yt(e){let t=[];return e.someProp("decorations",(n=>{let r=n(e.state);r&&r!=jt&&t.push(r)})),e.cursorWrapper&&t.push($t.create(e.state.doc,[e.cursorWrapper.deco])),_t.from(t)}const Zt={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Gt=C&&S<=11;class Qt{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 Xt{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Qt,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver((e=>{for(let t=0;t<e.length;t++)this.queue.push(e[t]);C&&S<=11&&e.some((e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length))?this.flushSoon():this.flush()})),Gt&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.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,Zt)),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(Pe(this.view)){if(this.suppressingSelectionUpdates)return Oe(this.view);if(C&&S<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&u(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,n=new Set;for(let t=e.focusNode;t;t=a(t))n.add(t);for(let r=e.anchorNode;r;r=a(r))if(n.has(r)){t=r;break}let r=t&&this.view.docView.nearestDesc(t);return r&&r.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.observer?this.observer.takeRecords():[];this.queue.length&&(t=this.queue.concat(t),this.queue.length=0);let n=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&Pe(e)&&!this.ignoreSelectionChange(n),i=-1,s=-1,a=!1,l=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],l);n&&(i=i<0?n.from:Math.min(n.from,i),s=s<0?n.to:Math.max(n.to,s),n.typeOver&&(a=!0))}if(M&&l.length>1){let e=l.filter((e=>"BR"==e.nodeName));if(2==e.length){let t=e[0],n=e[1];t.parentNode&&t.parentNode.parentNode==n.parentNode?n.remove():t.remove()}}let c=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&m(n)&&(c=Me(e))&&c.eq(r.LN.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Oe(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||o)&&(i>-1&&(e.docView.markDirty(i,s),function(e){if(!en.has(e)&&(en.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))){if(e.requiresGeckoHackNode=M,tn)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."),tn=!0}}(e)),this.handleDOMChange(i,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||Oe(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++)t.push(e.addedNodes[n]);if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,o=e.nextSibling;if(C&&S<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:i}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!i||Array.prototype.indexOf.call(e.addedNodes,i)<0)&&(o=i)}let i=r&&r.parentNode==e.target?s(r)+1:0,a=n.localPosFromDOM(e.target,i,-1),l=o&&o.parentNode==e.target?s(o):e.target.childNodes.length;return{from:a,to:n.localPosFromDOM(e.target,l,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}}let en=new WeakMap,tn=!1;function nn(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(E&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}if(e.parentNode.lastChild==e||E&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const rn=/^(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 on(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Re(e,t.resolve(n.anchor),t.resolve(n.head))}function sn(e,t,n){let r=e.depth,o=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,o++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,o++}return o}class an{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 ut,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(hn),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=un(this),cn(this),this.nodeViews=dn(this),this.docView=ce(this.state.doc,ln(this),Yt(this),this.dom,this),this.domObserver=new Xt(this,((e,t,n,i)=>function(e,t,n,i,s){if(t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=Me(e,t);if(n&&!e.state.selection.eq(n)){if(O&&I&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",(t=>t(e,g(13,"Enter")))))return;let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),e.composing&&r.setMeta("composition",e.input.compositionID),e.dispatch(r)}return}let a=e.state.doc.resolve(t),l=a.sharedDepth(n);t=a.before(l+1),n=e.state.doc.resolve(n).after(l+1);let c,u,d=e.state.selection,h=function(e,t,n){let r,{node:i,fromOffset:s,toOffset:a,from:l,to:c}=e.docView.parseRange(t,n),u=e.domSelectionRange(),d=u.anchorNode;if(d&&e.dom.contains(1==d.nodeType?d:d.parentNode)&&(r=[{node:d,offset:u.anchorOffset}],m(u)||r.push({node:u.focusNode,offset:u.focusOffset})),O&&8===e.input.lastKeyCode)for(let e=a;e>s;e--){let t=i.childNodes[e-1],n=t.pmViewDesc;if("BR"==t.nodeName&&!n){a=e;break}if(!n||n.size)break}let h=e.state.doc,p=e.someProp("domParser")||o.S4.fromSchema(e.state.schema),f=h.resolve(l),g=null,y=p.parse(i,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:s,to:a,preserveWhitespace:"pre"!=f.parent.type.whitespace||"full",findPositions:r,ruleFromNode:nn,context:f});if(r&&null!=r[0].pos){let e=r[0].pos,t=r[1]&&r[1].pos;null==t&&(t=e),g={anchor:e+l,head:t+l}}return{doc:y,sel:g,from:l,to:c}}(e,t,n),p=e.state.doc,f=p.slice(h.from,h.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(c=e.state.selection.to,u="end"):(c=e.state.selection.from,u="start"),e.input.lastKeyCode=null;let y=function(e,t,n,r,o){let i=e.findDiffStart(t,n);if(null==i)return null;let{a:s,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);return"end"==o&&(r-=s+Math.max(0,i-Math.min(s,a))-i),s<i&&e.size<t.size?(i-=r<=i&&r>=s?i-r:0,a=i+(a-s),s=i):a<i&&(i-=r<=i&&r>=a?i-r:0,s=i+(s-a),a=i),{start:i,endA:s,endB:a}}(f.content,h.doc.content,h.from,c,u);if((D&&e.input.lastIOSEnter>Date.now()-225||I)&&s.some((e=>1==e.nodeType&&!rn.test(e.nodeName)))&&(!y||y.endA>=y.endB)&&e.someProp("handleKeyDown",(t=>t(e,g(13,"Enter")))))return void(e.input.lastIOSEnter=0);if(!y){if(!(i&&d instanceof r.U3&&!d.empty&&d.$head.sameParent(d.$anchor))||e.composing||h.sel&&h.sel.anchor!=h.sel.head){if(h.sel){let t=on(e,e.state.doc,h.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);e.composing&&n.setMeta("composition",e.input.compositionID),e.dispatch(n)}}return}y={start:d.from,endA:d.to,endB:d.to}}if(O&&e.cursorWrapper&&h.sel&&h.sel.anchor==e.cursorWrapper.deco.from&&h.sel.head==h.sel.anchor){let e=y.endB-y.start;h.sel={anchor:h.sel.anchor+e,head:h.sel.anchor+e}}e.input.domChangeCount++,e.state.selection.from<e.state.selection.to&&y.start==y.endB&&e.state.selection instanceof r.U3&&(y.start>e.state.selection.from&&y.start<=e.state.selection.from+2&&e.state.selection.from>=h.from?y.start=e.state.selection.from:y.endA<e.state.selection.to&&y.endA>=e.state.selection.to-2&&e.state.selection.to<=h.to&&(y.endB+=e.state.selection.to-y.endA,y.endA=e.state.selection.to)),C&&S<=11&&y.endB==y.start+1&&y.endA==y.start&&y.start>h.from&&" "==h.doc.textBetween(y.start-h.from-1,y.start-h.from+1)&&(y.start--,y.endA--,y.endB--);let v,w=h.doc.resolveNoCache(y.start-h.from),k=h.doc.resolveNoCache(y.endB-h.from),b=p.resolve(y.start),x=w.sameParent(k)&&w.parent.inlineContent&&b.end()>=y.endA;if((D&&e.input.lastIOSEnter>Date.now()-225&&(!x||s.some((e=>"DIV"==e.nodeName||"P"==e.nodeName)))||!x&&w.pos<h.doc.content.size&&(v=r.LN.findFrom(h.doc.resolve(w.pos+1),1,!0))&&v.head==k.pos)&&e.someProp("handleKeyDown",(t=>t(e,g(13,"Enter")))))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>y.start&&function(e,t,n,r,o){if(!r.parent.isTextblock||n-t<=o.pos-r.pos||sn(r,!0,!1)<o.pos)return!1;let i=e.resolve(t);if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=e.resolve(sn(i,!0,!0));return!(!s.parent.isTextblock||s.pos>n||sn(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(p,y.start,y.endA,w,k)&&e.someProp("handleKeyDown",(t=>t(e,g(8,"Backspace")))))return void(I&&O&&e.domObserver.suppressSelectionUpdates());O&&I&&y.endB==y.start&&(e.input.lastAndroidDelete=Date.now()),I&&!x&&w.start()!=k.start()&&0==k.parentOffset&&w.depth==k.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==y.endA&&(y.endB-=2,k=h.doc.resolveNoCache(y.endB-h.from),setTimeout((()=>{e.someProp("handleKeyDown",(function(t){return t(e,g(13,"Enter"))}))}),20));let M,N,A,E=y.start,T=y.endA;if(x)if(w.pos==k.pos)C&&S<=11&&0==w.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout((()=>Oe(e)),20)),M=e.state.tr.delete(E,T),N=p.resolve(y.start).marksAcross(p.resolve(y.endA));else if(y.endA==y.endB&&(A=function(e,t){let n,r,i,s=e.firstChild.marks,a=t.firstChild.marks,l=s,c=a;for(let e=0;e<a.length;e++)l=a[e].removeFromSet(l);for(let e=0;e<s.length;e++)c=s[e].removeFromSet(c);if(1==l.length&&0==c.length)r=l[0],n="add",i=e=>e.mark(r.addToSet(e.marks));else{if(0!=l.length||1!=c.length)return null;r=c[0],n="remove",i=e=>e.mark(r.removeFromSet(e.marks))}let u=[];for(let e=0;e<t.childCount;e++)u.push(i(t.child(e)));if(o.FK.from(u).eq(e))return{mark:r,type:n}}(w.parent.content.cut(w.parentOffset,k.parentOffset),b.parent.content.cut(b.parentOffset,y.endA-b.start()))))M=e.state.tr,"add"==A.type?M.addMark(E,T,A.mark):M.removeMark(E,T,A.mark);else if(w.parent.child(w.index()).isText&&w.index()==k.index()-(k.textOffset?0:1)){let t=w.parent.textBetween(w.parentOffset,k.parentOffset);if(e.someProp("handleTextInput",(n=>n(e,E,T,t))))return;M=e.state.tr.insertText(t,E,T)}if(M||(M=e.state.tr.replace(E,T,h.doc.slice(y.start-h.from,y.endB-h.from))),h.sel){let t=on(e,M.doc,h.sel);t&&!(O&&I&&e.composing&&t.empty&&(y.start!=y.endB||e.input.lastAndroidDelete<Date.now()-100)&&(t.head==E||t.head==M.mapping.map(T)-1)||C&&t.empty&&t.head==E)&&M.setSelection(t)}N&&M.ensureMarks(N),e.composing&&M.setMeta("composition",e.input.compositionID),e.dispatch(M.scrollIntoView())}(this,e,t,n,i))),this.domObserver.start(),function(e){for(let t in at){let n=at[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!ft(e,t)||pt(e,t)||!e.editable&&t.type in lt||n(e,t)},ct[t]?{passive:!0}:void 0)}E&&e.dom.addEventListener("input",(()=>null)),ht(e)}(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&&ht(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(hn),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){let n=this.state,r=!1,o=!1;e.storedMarks&&this.composing&&(Nt(this),o=!0),this.state=e;let i=n.plugins!=e.plugins||this._props.plugins!=t.plugins;if(i||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=dn(this);(function(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r})(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(i||t.handleDOMEvents!=this._props.handleDOMEvents)&&ht(this),this.editable=un(this),cn(this);let s=Yt(this),a=ln(this),l=n.plugins==e.plugins||n.doc.eq(e.doc)?e.scrollToSelection>n.scrollToSelection?"to selection":"preserve":"reset",c=r||!this.docView.matchesNode(e.doc,a,s);!c&&e.selection.eq(n.selection)||(o=!0);let d="preserve"==l&&o&&null==this.dom.style.overflowAnchor&&function(e){let t,n,r=e.dom.getBoundingClientRect(),o=Math.max(0,r.top);for(let i=(r.left+r.right)/2,s=o+1;s<Math.min(innerHeight,r.bottom);s+=5){let r=e.root.elementFromPoint(i,s);if(!r||r==e.dom||!e.dom.contains(r))continue;let a=r.getBoundingClientRect();if(a.top>=o-20){t=r,n=a.top;break}}return{refDOM:t,refTop:n,stack:j(e.dom)}}(this);if(o){this.domObserver.stop();let t=c&&(C||O)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&function(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}(n.selection,e.selection);if(c){let n=O?this.trackWrites=this.domSelectionRange().focusNode:null;!r&&this.docView.update(e.doc,a,s,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=ce(e.doc,a,s,this.dom,this)),n&&!this.trackWrites&&(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return u(t.node,t.offset,n.anchorNode,n.anchorOffset)}(this))?Oe(this,t):(Fe(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),"reset"==l?this.dom.scrollTop=0:"to selection"==l?this.scrollToSelection():d&&function({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;_(n,0==r?0:r-t)}(d)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(this.someProp("handleScrollToSelection",(e=>e(this))));else if(this.state.selection instanceof r.nh){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&$(this,t.getBoundingClientRect(),e)}else $(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)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}someProp(e,t){let n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;for(let r=0;r<this.directPlugins.length;r++){let o=this.directPlugins[r].props[e];if(null!=o&&(n=t?t(o):o))return n}let o=this.state.plugins;if(o)for(let r=0;r<o.length;r++){let i=o[r].props[e];if(null!=i&&(n=t?t(i):i))return n}}hasFocus(){if(C){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("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(V)return e.focus(V);let t=j(e);e.focus(null==V?{get preventScroll(){return V={preventScroll:!0},!0}}:void 0),V||(V=!1,_(t,0))}(this.dom),Oe(this),this.domObserver.start()}get root(){let e=this._root;if(null==e)for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e;return e||document}posAtCoords(e){return J(this,e)}coordsAtPos(e,t=1){return Z(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,n=-1){let r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return function(e,t,n){return te==t&&ne==n?re:(te=t,ne=n,re="up"==n||"down"==n?function(e,t,n){let r=t.selection,o="up"==n?r.$from:r.$to;return X(e,t,(()=>{let{node:t}=e.docView.domFromPos(o.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=Z(e,o.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=c(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let o=t[e];if(o.bottom>o.top+1&&("up"==n?r.top-o.top>2*(o.bottom-r.top):o.bottom-r.bottom>2*(r.bottom-o.top)))return!1}}return!0}))}(e,t,n):function(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=e.domSelection();return ee.test(r.parent.textContent)&&a.modify?X(e,t,(()=>{let{focusNode:t,focusOffset:o,anchorNode:i,anchorOffset:s}=e.domSelectionRange(),l=a.caretBidiLevel;a.modify("move",n,"character");let c=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),h=u&&!c.contains(1==u.nodeType?u:u.parentNode)||t==u&&o==d;try{a.collapse(i,s),t&&(t!=i||o!=s)&&a.extend&&a.extend(t,o)}catch(e){}return null!=l&&(a.caretBidiLevel=l),h})):"left"==n||"backward"==n?i:s}(e,t,n))}(this,t||this.state,e)}pasteHTML(e,t){return Et(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Et(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(function(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Yt(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)}get isDestroyed(){return null==this.docView}dispatchEvent(e){return function(e,t){pt(e,t)||!at[t.type]||!e.editable&&t.type in lt||at[t.type](e,t)}(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){return E&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom?function(e){let t;function n(e){e.preventDefault(),e.stopImmediatePropagation(),t=e.getTargetRanges()[0]}e.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",n,!0);let r=t.startContainer,o=t.startOffset,i=t.endContainer,s=t.endOffset,a=e.domAtPos(e.state.selection.anchor);return u(a.node,a.offset,i,s)&&([r,o,i,s]=[i,s,r,o]),{anchorNode:r,anchorOffset:o,focusNode:i,focusOffset:s}}(this):this.domSelection()}domSelection(){return this.root.getSelection()}}function ln(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",(n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))})),t.translate||(t.translate="no"),[Bt.node(0,e.state.doc.content.size,t)]}function cn(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:Bt.widget(e.state.selection.head,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function un(e){return!e.someProp("editable",(t=>!1===t(e.state)))}function dn(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function hn(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}},3751:(e,t,n)=>{"use strict";n.d(t,{B:()=>yt,y:()=>vt});var r=n(4254),o=n(1570),i=n(72);function s(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function a(e){return e instanceof s(e).Element||e instanceof Element}function l(e){return e instanceof s(e).HTMLElement||e instanceof HTMLElement}function c(e){return"undefined"!=typeof ShadowRoot&&(e instanceof s(e).ShadowRoot||e instanceof ShadowRoot)}var u=Math.max,d=Math.min,h=Math.round;function p(){var e=navigator.userAgentData;return null!=e&&e.brands&&Array.isArray(e.brands)?e.brands.map((function(e){return e.brand+"/"+e.version})).join(" "):navigator.userAgent}function f(){return!/^((?!chrome|android).)*safari/i.test(p())}function m(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);var r=e.getBoundingClientRect(),o=1,i=1;t&&l(e)&&(o=e.offsetWidth>0&&h(r.width)/e.offsetWidth||1,i=e.offsetHeight>0&&h(r.height)/e.offsetHeight||1);var c=(a(e)?s(e):window).visualViewport,u=!f()&&n,d=(r.left+(u&&c?c.offsetLeft:0))/o,p=(r.top+(u&&c?c.offsetTop:0))/i,m=r.width/o,g=r.height/i;return{width:m,height:g,top:p,right:d+m,bottom:p+g,left:d,x:d,y:p}}function g(e){var t=s(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function y(e){return e?(e.nodeName||"").toLowerCase():null}function v(e){return((a(e)?e.ownerDocument:e.document)||window.document).documentElement}function w(e){return m(v(e)).left+g(e).scrollLeft}function k(e){return s(e).getComputedStyle(e)}function b(e){var t=k(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function x(e,t,n){void 0===n&&(n=!1);var r,o,i=l(t),a=l(t)&&function(e){var t=e.getBoundingClientRect(),n=h(t.width)/e.offsetWidth||1,r=h(t.height)/e.offsetHeight||1;return 1!==n||1!==r}(t),c=v(t),u=m(e,a,n),d={scrollLeft:0,scrollTop:0},p={x:0,y:0};return(i||!i&&!n)&&(("body"!==y(t)||b(c))&&(d=(r=t)!==s(r)&&l(r)?{scrollLeft:(o=r).scrollLeft,scrollTop:o.scrollTop}:g(r)),l(t)?((p=m(t,!0)).x+=t.clientLeft,p.y+=t.clientTop):c&&(p.x=w(c))),{x:u.left+d.scrollLeft-p.x,y:u.top+d.scrollTop-p.y,width:u.width,height:u.height}}function C(e){var t=m(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function S(e){return"html"===y(e)?e:e.assignedSlot||e.parentNode||(c(e)?e.host:null)||v(e)}function M(e){return["html","body","#document"].indexOf(y(e))>=0?e.ownerDocument.body:l(e)&&b(e)?e:M(S(e))}function N(e,t){var n;void 0===t&&(t=[]);var r=M(e),o=r===(null==(n=e.ownerDocument)?void 0:n.body),i=s(r),a=o?[i].concat(i.visualViewport||[],b(r)?r:[]):r,l=t.concat(a);return o?l:l.concat(N(S(a)))}function O(e){return["table","td","th"].indexOf(y(e))>=0}function A(e){return l(e)&&"fixed"!==k(e).position?e.offsetParent:null}function E(e){for(var t=s(e),n=A(e);n&&O(n)&&"static"===k(n).position;)n=A(n);return n&&("html"===y(n)||"body"===y(n)&&"static"===k(n).position)?t:n||function(e){var t=/firefox/i.test(p());if(/Trident/i.test(p())&&l(e)&&"fixed"===k(e).position)return null;var n=S(e);for(c(n)&&(n=n.host);l(n)&&["html","body"].indexOf(y(n))<0;){var r=k(n);if("none"!==r.transform||"none"!==r.perspective||"paint"===r.contain||-1!==["transform","perspective"].indexOf(r.willChange)||t&&"filter"===r.willChange||t&&r.filter&&"none"!==r.filter)return n;n=n.parentNode}return null}(e)||t}var D="top",T="bottom",F="right",I="left",R="auto",P=[D,T,F,I],B="start",L="end",z="viewport",$="popper",j=P.reduce((function(e,t){return e.concat([t+"-"+B,t+"-"+L])}),[]),_=[].concat(P,[R]).reduce((function(e,t){return e.concat([t,t+"-"+B,t+"-"+L])}),[]),V=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function W(e){var t=new Map,n=new Set,r=[];function o(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!n.has(e)){var r=t.get(e);r&&o(r)}})),r.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){n.has(e.name)||o(e)})),r}var H={placement:"bottom",modifiers:[],strategy:"absolute"};function K(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some((function(e){return!(e&&"function"==typeof e.getBoundingClientRect)}))}function J(e){void 0===e&&(e={});var t=e,n=t.defaultModifiers,r=void 0===n?[]:n,o=t.defaultOptions,i=void 0===o?H:o;return function(e,t,n){void 0===n&&(n=i);var o,s,l={placement:"bottom",orderedModifiers:[],options:Object.assign({},H,i),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},c=[],u=!1,d={state:l,setOptions:function(n){var o="function"==typeof n?n(l.options):n;h(),l.options=Object.assign({},i,l.options,o),l.scrollParents={reference:a(e)?N(e):e.contextElement?N(e.contextElement):[],popper:N(t)};var s,u,p=function(e){var t=W(e);return V.reduce((function(e,n){return e.concat(t.filter((function(e){return e.phase===n})))}),[])}((s=[].concat(r,l.options.modifiers),u=s.reduce((function(e,t){var n=e[t.name];return e[t.name]=n?Object.assign({},n,t,{options:Object.assign({},n.options,t.options),data:Object.assign({},n.data,t.data)}):t,e}),{}),Object.keys(u).map((function(e){return u[e]}))));return l.orderedModifiers=p.filter((function(e){return e.enabled})),l.orderedModifiers.forEach((function(e){var t=e.name,n=e.options,r=void 0===n?{}:n,o=e.effect;if("function"==typeof o){var i=o({state:l,name:t,instance:d,options:r});c.push(i||function(){})}})),d.update()},forceUpdate:function(){if(!u){var e=l.elements,t=e.reference,n=e.popper;if(K(t,n)){l.rects={reference:x(t,E(n),"fixed"===l.options.strategy),popper:C(n)},l.reset=!1,l.placement=l.options.placement,l.orderedModifiers.forEach((function(e){return l.modifiersData[e.name]=Object.assign({},e.data)}));for(var r=0;r<l.orderedModifiers.length;r++)if(!0!==l.reset){var o=l.orderedModifiers[r],i=o.fn,s=o.options,a=void 0===s?{}:s,c=o.name;"function"==typeof i&&(l=i({state:l,options:a,name:c,instance:d})||l)}else l.reset=!1,r=-1}}},update:(o=function(){return new Promise((function(e){d.forceUpdate(),e(l)}))},function(){return s||(s=new Promise((function(e){Promise.resolve().then((function(){s=void 0,e(o())}))}))),s}),destroy:function(){h(),u=!0}};if(!K(e,t))return d;function h(){c.forEach((function(e){return e()})),c=[]}return d.setOptions(n).then((function(e){!u&&n.onFirstUpdate&&n.onFirstUpdate(e)})),d}}var q={passive:!0};function U(e){return e.split("-")[0]}function Y(e){return e.split("-")[1]}function Z(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function G(e){var t,n=e.reference,r=e.element,o=e.placement,i=o?U(o):null,s=o?Y(o):null,a=n.x+n.width/2-r.width/2,l=n.y+n.height/2-r.height/2;switch(i){case D:t={x:a,y:n.y-r.height};break;case T:t={x:a,y:n.y+n.height};break;case F:t={x:n.x+n.width,y:l};break;case I:t={x:n.x-r.width,y:l};break;default:t={x:n.x,y:n.y}}var c=i?Z(i):null;if(null!=c){var u="y"===c?"height":"width";switch(s){case B:t[c]=t[c]-(n[u]/2-r[u]/2);break;case L:t[c]=t[c]+(n[u]/2-r[u]/2)}}return t}var Q={top:"auto",right:"auto",bottom:"auto",left:"auto"};function X(e){var t,n=e.popper,r=e.popperRect,o=e.placement,i=e.variation,a=e.offsets,l=e.position,c=e.gpuAcceleration,u=e.adaptive,d=e.roundOffsets,p=e.isFixed,f=a.x,m=void 0===f?0:f,g=a.y,y=void 0===g?0:g,w="function"==typeof d?d({x:m,y}):{x:m,y};m=w.x,y=w.y;var b=a.hasOwnProperty("x"),x=a.hasOwnProperty("y"),C=I,S=D,M=window;if(u){var N=E(n),O="clientHeight",A="clientWidth";N===s(n)&&"static"!==k(N=v(n)).position&&"absolute"===l&&(O="scrollHeight",A="scrollWidth"),(o===D||(o===I||o===F)&&i===L)&&(S=T,y-=(p&&N===M&&M.visualViewport?M.visualViewport.height:N[O])-r.height,y*=c?1:-1),o!==I&&(o!==D&&o!==T||i!==L)||(C=F,m-=(p&&N===M&&M.visualViewport?M.visualViewport.width:N[A])-r.width,m*=c?1:-1)}var R,P=Object.assign({position:l},u&&Q),B=!0===d?function(e,t){var n=e.x,r=e.y,o=t.devicePixelRatio||1;return{x:h(n*o)/o||0,y:h(r*o)/o||0}}({x:m,y},s(n)):{x:m,y};return m=B.x,y=B.y,c?Object.assign({},P,((R={})[S]=x?"0":"",R[C]=b?"0":"",R.transform=(M.devicePixelRatio||1)<=1?"translate("+m+"px, "+y+"px)":"translate3d("+m+"px, "+y+"px, 0)",R)):Object.assign({},P,((t={})[S]=x?y+"px":"",t[C]=b?m+"px":"",t.transform="",t))}const ee={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var n=t.styles[e]||{},r=t.attributes[e]||{},o=t.elements[e];l(o)&&y(o)&&(Object.assign(o.style,n),Object.keys(r).forEach((function(e){var t=r[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach((function(e){var r=t.elements[e],o=t.attributes[e]||{},i=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce((function(e,t){return e[t]="",e}),{});l(r)&&y(r)&&(Object.assign(r.style,i),Object.keys(o).forEach((function(e){r.removeAttribute(e)})))}))}},requires:["computeStyles"]},te={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,n=e.options,r=e.name,o=n.offset,i=void 0===o?[0,0]:o,s=_.reduce((function(e,n){return e[n]=function(e,t,n){var r=U(e),o=[I,D].indexOf(r)>=0?-1:1,i="function"==typeof n?n(Object.assign({},t,{placement:e})):n,s=i[0],a=i[1];return s=s||0,a=(a||0)*o,[I,F].indexOf(r)>=0?{x:a,y:s}:{x:s,y:a}}(n,t.rects,i),e}),{}),a=s[t.placement],l=a.x,c=a.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[r]=s}};var ne={left:"right",right:"left",bottom:"top",top:"bottom"};function re(e){return e.replace(/left|right|bottom|top/g,(function(e){return ne[e]}))}var oe={start:"end",end:"start"};function ie(e){return e.replace(/start|end/g,(function(e){return oe[e]}))}function se(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&c(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function ae(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function le(e,t,n){return t===z?ae(function(e,t){var n=s(e),r=v(e),o=n.visualViewport,i=r.clientWidth,a=r.clientHeight,l=0,c=0;if(o){i=o.width,a=o.height;var u=f();(u||!u&&"fixed"===t)&&(l=o.offsetLeft,c=o.offsetTop)}return{width:i,height:a,x:l+w(e),y:c}}(e,n)):a(t)?function(e,t){var n=m(e,!1,"fixed"===t);return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}(t,n):ae(function(e){var t,n=v(e),r=g(e),o=null==(t=e.ownerDocument)?void 0:t.body,i=u(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),s=u(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),a=-r.scrollLeft+w(e),l=-r.scrollTop;return"rtl"===k(o||n).direction&&(a+=u(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:s,x:a,y:l}}(v(e)))}function ce(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function ue(e,t){return t.reduce((function(t,n){return t[n]=e,t}),{})}function de(e,t){void 0===t&&(t={});var n=t,r=n.placement,o=void 0===r?e.placement:r,i=n.strategy,s=void 0===i?e.strategy:i,c=n.boundary,h=void 0===c?"clippingParents":c,p=n.rootBoundary,f=void 0===p?z:p,g=n.elementContext,w=void 0===g?$:g,b=n.altBoundary,x=void 0!==b&&b,C=n.padding,M=void 0===C?0:C,O=ce("number"!=typeof M?M:ue(M,P)),A=w===$?"reference":$,I=e.rects.popper,R=e.elements[x?A:w],B=function(e,t,n,r){var o="clippingParents"===t?function(e){var t=N(S(e)),n=["absolute","fixed"].indexOf(k(e).position)>=0&&l(e)?E(e):e;return a(n)?t.filter((function(e){return a(e)&&se(e,n)&&"body"!==y(e)})):[]}(e):[].concat(t),i=[].concat(o,[n]),s=i[0],c=i.reduce((function(t,n){var o=le(e,n,r);return t.top=u(o.top,t.top),t.right=d(o.right,t.right),t.bottom=d(o.bottom,t.bottom),t.left=u(o.left,t.left),t}),le(e,s,r));return c.width=c.right-c.left,c.height=c.bottom-c.top,c.x=c.left,c.y=c.top,c}(a(R)?R:R.contextElement||v(e.elements.popper),h,f,s),L=m(e.elements.reference),j=G({reference:L,element:I,strategy:"absolute",placement:o}),_=ae(Object.assign({},I,j)),V=w===$?_:L,W={top:B.top-V.top+O.top,bottom:V.bottom-B.bottom+O.bottom,left:B.left-V.left+O.left,right:V.right-B.right+O.right},H=e.modifiersData.offset;if(w===$&&H){var K=H[o];Object.keys(W).forEach((function(e){var t=[F,T].indexOf(e)>=0?1:-1,n=[D,T].indexOf(e)>=0?"y":"x";W[e]+=K[n]*t}))}return W}const he={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,i=void 0===o||o,s=n.altAxis,a=void 0===s||s,l=n.fallbackPlacements,c=n.padding,u=n.boundary,d=n.rootBoundary,h=n.altBoundary,p=n.flipVariations,f=void 0===p||p,m=n.allowedAutoPlacements,g=t.options.placement,y=U(g),v=l||(y!==g&&f?function(e){if(U(e)===R)return[];var t=re(e);return[ie(e),t,ie(t)]}(g):[re(g)]),w=[g].concat(v).reduce((function(e,n){return e.concat(U(n)===R?function(e,t){void 0===t&&(t={});var n=t,r=n.placement,o=n.boundary,i=n.rootBoundary,s=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,c=void 0===l?_:l,u=Y(r),d=u?a?j:j.filter((function(e){return Y(e)===u})):P,h=d.filter((function(e){return c.indexOf(e)>=0}));0===h.length&&(h=d);var p=h.reduce((function(t,n){return t[n]=de(e,{placement:n,boundary:o,rootBoundary:i,padding:s})[U(n)],t}),{});return Object.keys(p).sort((function(e,t){return p[e]-p[t]}))}(t,{placement:n,boundary:u,rootBoundary:d,padding:c,flipVariations:f,allowedAutoPlacements:m}):n)}),[]),k=t.rects.reference,b=t.rects.popper,x=new Map,C=!0,S=w[0],M=0;M<w.length;M++){var N=w[M],O=U(N),A=Y(N)===B,E=[D,T].indexOf(O)>=0,L=E?"width":"height",z=de(t,{placement:N,boundary:u,rootBoundary:d,altBoundary:h,padding:c}),$=E?A?F:I:A?T:D;k[L]>b[L]&&($=re($));var V=re($),W=[];if(i&&W.push(z[O]<=0),a&&W.push(z[$]<=0,z[V]<=0),W.every((function(e){return e}))){S=N,C=!1;break}x.set(N,W)}if(C)for(var H=function(e){var t=w.find((function(t){var n=x.get(t);if(n)return n.slice(0,e).every((function(e){return e}))}));if(t)return S=t,"break"},K=f?3:1;K>0&&"break"!==H(K);K--);t.placement!==S&&(t.modifiersData[r]._skip=!0,t.placement=S,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function pe(e,t,n){return u(e,d(t,n))}function fe(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function me(e){return[D,F,T,I].some((function(t){return e[t]>=0}))}var ge=J({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,i=void 0===o||o,a=r.resize,l=void 0===a||a,c=s(t.elements.popper),u=[].concat(t.scrollParents.reference,t.scrollParents.popper);return i&&u.forEach((function(e){e.addEventListener("scroll",n.update,q)})),l&&c.addEventListener("resize",n.update,q),function(){i&&u.forEach((function(e){e.removeEventListener("scroll",n.update,q)})),l&&c.removeEventListener("resize",n.update,q)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,n=e.name;t.modifiersData[n]=G({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=void 0===r||r,i=n.adaptive,s=void 0===i||i,a=n.roundOffsets,l=void 0===a||a,c={placement:U(t.placement),variation:Y(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:"fixed"===t.options.strategy};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,X(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:s,roundOffsets:l})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,X(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}},ee,te,he,{name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,i=void 0===o||o,s=n.altAxis,a=void 0!==s&&s,l=n.boundary,c=n.rootBoundary,h=n.altBoundary,p=n.padding,f=n.tether,m=void 0===f||f,g=n.tetherOffset,y=void 0===g?0:g,v=de(t,{boundary:l,rootBoundary:c,padding:p,altBoundary:h}),w=U(t.placement),k=Y(t.placement),b=!k,x=Z(w),S="x"===x?"y":"x",M=t.modifiersData.popperOffsets,N=t.rects.reference,O=t.rects.popper,A="function"==typeof y?y(Object.assign({},t.rects,{placement:t.placement})):y,R="number"==typeof A?{mainAxis:A,altAxis:A}:Object.assign({mainAxis:0,altAxis:0},A),P=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,L={x:0,y:0};if(M){if(i){var z,$="y"===x?D:I,j="y"===x?T:F,_="y"===x?"height":"width",V=M[x],W=V+v[$],H=V-v[j],K=m?-O[_]/2:0,J=k===B?N[_]:O[_],q=k===B?-O[_]:-N[_],G=t.elements.arrow,Q=m&&G?C(G):{width:0,height:0},X=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},ee=X[$],te=X[j],ne=pe(0,N[_],Q[_]),re=b?N[_]/2-K-ne-ee-R.mainAxis:J-ne-ee-R.mainAxis,oe=b?-N[_]/2+K+ne+te+R.mainAxis:q+ne+te+R.mainAxis,ie=t.elements.arrow&&E(t.elements.arrow),se=ie?"y"===x?ie.clientTop||0:ie.clientLeft||0:0,ae=null!=(z=null==P?void 0:P[x])?z:0,le=V+oe-ae,ce=pe(m?d(W,V+re-ae-se):W,V,m?u(H,le):H);M[x]=ce,L[x]=ce-V}if(a){var ue,he="x"===x?D:I,fe="x"===x?T:F,me=M[S],ge="y"===S?"height":"width",ye=me+v[he],ve=me-v[fe],we=-1!==[D,I].indexOf(w),ke=null!=(ue=null==P?void 0:P[S])?ue:0,be=we?ye:me-N[ge]-O[ge]-ke+R.altAxis,xe=we?me+N[ge]+O[ge]-ke-R.altAxis:ve,Ce=m&&we?function(e,t,n){var r=pe(e,t,n);return r>n?n:r}(be,me,xe):pe(m?be:ye,me,m?xe:ve);M[S]=Ce,L[S]=Ce-me}t.modifiersData[r]=L}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state,r=e.name,o=e.options,i=n.elements.arrow,s=n.modifiersData.popperOffsets,a=U(n.placement),l=Z(a),c=[I,F].indexOf(a)>=0?"height":"width";if(i&&s){var u=function(e,t){return ce("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:ue(e,P))}(o.padding,n),d=C(i),h="y"===l?D:I,p="y"===l?T:F,f=n.rects.reference[c]+n.rects.reference[l]-s[l]-n.rects.popper[c],m=s[l]-n.rects.reference[l],g=E(i),y=g?"y"===l?g.clientHeight||0:g.clientWidth||0:0,v=f/2-m/2,w=u[h],k=y-d[c]-u[p],b=y/2-d[c]/2+v,x=pe(w,b,k),S=l;n.modifiersData[r]=((t={})[S]=x,t.centerOffset=x-b,t)}},effect:function(e){var t=e.state,n=e.options.element,r=void 0===n?"[data-popper-arrow]":n;null!=r&&("string"!=typeof r||(r=t.elements.popper.querySelector(r)))&&se(t.elements.popper,r)&&(t.elements.arrow=r)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,i=t.modifiersData.preventOverflow,s=de(t,{elementContext:"reference"}),a=de(t,{altBoundary:!0}),l=fe(s,r),c=fe(a,o,i),u=me(l),d=me(c);t.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}}]}),ye="tippy-content",ve="tippy-arrow",we="tippy-svg-arrow",ke={passive:!0,capture:!0},be=function(){return document.body};function xe(e,t,n){if(Array.isArray(e)){var r=e[t];return null==r?Array.isArray(n)?n[t]:n:r}return e}function Ce(e,t){var n={}.toString.call(e);return 0===n.indexOf("[object")&&n.indexOf(t+"]")>-1}function Se(e,t){return"function"==typeof e?e.apply(void 0,t):e}function Me(e,t){return 0===t?e:function(r){clearTimeout(n),n=setTimeout((function(){e(r)}),t)};var n}function Ne(e){return[].concat(e)}function Oe(e,t){-1===e.indexOf(t)&&e.push(t)}function Ae(e){return[].slice.call(e)}function Ee(e){return Object.keys(e).reduce((function(t,n){return void 0!==e[n]&&(t[n]=e[n]),t}),{})}function De(){return document.createElement("div")}function Te(e){return["Element","Fragment"].some((function(t){return Ce(e,t)}))}function Fe(e,t){e.forEach((function(e){e&&(e.style.transitionDuration=t+"ms")}))}function Ie(e,t){e.forEach((function(e){e&&e.setAttribute("data-state",t)}))}function Re(e,t,n){var r=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach((function(t){e[r](t,n)}))}function Pe(e,t){for(var n=t;n;){var r;if(e.contains(n))return!0;n=null==n.getRootNode||null==(r=n.getRootNode())?void 0:r.host}return!1}var Be={isTouch:!1},Le=0;function ze(){Be.isTouch||(Be.isTouch=!0,window.performance&&document.addEventListener("mousemove",$e))}function $e(){var e=performance.now();e-Le<20&&(Be.isTouch=!1,document.removeEventListener("mousemove",$e)),Le=e}function je(){var e,t=document.activeElement;if((e=t)&&e._tippy&&e._tippy.reference===e){var n=t._tippy;t.blur&&!n.state.isVisible&&t.blur()}}var _e=!("undefined"==typeof window||"undefined"==typeof document||!window.msCrypto),Ve=Object.assign({appendTo:be,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},{animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},{allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999}),We=Object.keys(Ve);function He(e){var t=(e.plugins||[]).reduce((function(t,n){var r,o=n.name,i=n.defaultValue;return o&&(t[o]=void 0!==e[o]?e[o]:null!=(r=Ve[o])?r:i),t}),{});return Object.assign({},e,t)}function Ke(e,t){var n=Object.assign({},t,{content:Se(t.content,[e])},t.ignoreAttributes?{}:function(e,t){return(t?Object.keys(He(Object.assign({},Ve,{plugins:t}))):We).reduce((function(t,n){var r=(e.getAttribute("data-tippy-"+n)||"").trim();if(!r)return t;if("content"===n)t[n]=r;else try{t[n]=JSON.parse(r)}catch(e){t[n]=r}return t}),{})}(e,t.plugins));return n.aria=Object.assign({},Ve.aria,n.aria),n.aria={expanded:"auto"===n.aria.expanded?t.interactive:n.aria.expanded,content:"auto"===n.aria.content?t.interactive?null:"describedby":n.aria.content},n}function Je(e,t){e.innerHTML=t}function qe(e){var t=De();return!0===e?t.className=ve:(t.className=we,Te(e)?t.appendChild(e):Je(t,e)),t}function Ue(e,t){Te(t.content)?(Je(e,""),e.appendChild(t.content)):"function"!=typeof t.content&&(t.allowHTML?Je(e,t.content):e.textContent=t.content)}function Ye(e){var t=e.firstElementChild,n=Ae(t.children);return{box:t,content:n.find((function(e){return e.classList.contains(ye)})),arrow:n.find((function(e){return e.classList.contains(ve)||e.classList.contains(we)})),backdrop:n.find((function(e){return e.classList.contains("tippy-backdrop")}))}}function Ze(e){var t=De(),n=De();n.className="tippy-box",n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=De();function o(n,r){var o=Ye(t),i=o.box,s=o.content,a=o.arrow;r.theme?i.setAttribute("data-theme",r.theme):i.removeAttribute("data-theme"),"string"==typeof r.animation?i.setAttribute("data-animation",r.animation):i.removeAttribute("data-animation"),r.inertia?i.setAttribute("data-inertia",""):i.removeAttribute("data-inertia"),i.style.maxWidth="number"==typeof r.maxWidth?r.maxWidth+"px":r.maxWidth,r.role?i.setAttribute("role",r.role):i.removeAttribute("role"),n.content===r.content&&n.allowHTML===r.allowHTML||Ue(s,e.props),r.arrow?a?n.arrow!==r.arrow&&(i.removeChild(a),i.appendChild(qe(r.arrow))):i.appendChild(qe(r.arrow)):a&&i.removeChild(a)}return r.className=ye,r.setAttribute("data-state","hidden"),Ue(r,e.props),t.appendChild(n),n.appendChild(r),o(e.props,e.props),{popper:t,onUpdate:o}}Ze.$$tippy=!0;var Ge=1,Qe=[],Xe=[];function et(e,t){var n,r,o,i,s,a,l,c,u=Ke(e,Object.assign({},Ve,He(Ee(t)))),d=!1,h=!1,p=!1,f=!1,m=[],g=Me(q,u.interactiveDebounce),y=Ge++,v=(c=u.plugins).filter((function(e,t){return c.indexOf(e)===t})),w={id:y,reference:e,popper:De(),popperInstance:null,props:u,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:v,clearDelayTimeouts:function(){clearTimeout(n),clearTimeout(r),cancelAnimationFrame(o)},setProps:function(t){if(!w.state.isDestroyed){I("onBeforeUpdate",[w,t]),K();var n=w.props,r=Ke(e,Object.assign({},n,Ee(t),{ignoreAttributes:!0}));w.props=r,H(),n.interactiveDebounce!==r.interactiveDebounce&&(B(),g=Me(q,r.interactiveDebounce)),n.triggerTarget&&!r.triggerTarget?Ne(n.triggerTarget).forEach((function(e){e.removeAttribute("aria-expanded")})):r.triggerTarget&&e.removeAttribute("aria-expanded"),P(),F(),x&&x(n,r),w.popperInstance&&(G(),X().forEach((function(e){requestAnimationFrame(e._tippy.popperInstance.forceUpdate)}))),I("onAfterUpdate",[w,t])}},setContent:function(e){w.setProps({content:e})},show:function(){var e=w.state.isVisible,t=w.state.isDestroyed,n=!w.state.isEnabled,r=Be.isTouch&&!w.props.touch,o=xe(w.props.duration,0,Ve.duration);if(!(e||t||n||r||A().hasAttribute("disabled")||(I("onShow",[w],!1),!1===w.props.onShow(w)))){if(w.state.isVisible=!0,O()&&(b.style.visibility="visible"),F(),j(),w.state.isMounted||(b.style.transition="none"),O()){var i=D();Fe([i.box,i.content],0)}var s,l,c;a=function(){var e;if(w.state.isVisible&&!f){if(f=!0,b.offsetHeight,b.style.transition=w.props.moveTransition,O()&&w.props.animation){var t=D(),n=t.box,r=t.content;Fe([n,r],o),Ie([n,r],"visible")}R(),P(),Oe(Xe,w),null==(e=w.popperInstance)||e.forceUpdate(),I("onMount",[w]),w.props.animation&&O()&&function(e){V(e,(function(){w.state.isShown=!0,I("onShown",[w])}))}(o)}},l=w.props.appendTo,c=A(),(s=w.props.interactive&&l===be||"parent"===l?c.parentNode:Se(l,[c])).contains(b)||s.appendChild(b),w.state.isMounted=!0,G()}},hide:function(){var e=!w.state.isVisible,t=w.state.isDestroyed,n=!w.state.isEnabled,r=xe(w.props.duration,1,Ve.duration);if(!(e||t||n)&&(I("onHide",[w],!1),!1!==w.props.onHide(w))){if(w.state.isVisible=!1,w.state.isShown=!1,f=!1,d=!1,O()&&(b.style.visibility="hidden"),B(),_(),F(!0),O()){var o=D(),i=o.box,s=o.content;w.props.animation&&(Fe([i,s],r),Ie([i,s],"hidden"))}R(),P(),w.props.animation?O()&&function(e,t){V(e,(function(){!w.state.isVisible&&b.parentNode&&b.parentNode.contains(b)&&t()}))}(r,w.unmount):w.unmount()}},hideWithInteractivity:function(e){E().addEventListener("mousemove",g),Oe(Qe,g),g(e)},enable:function(){w.state.isEnabled=!0},disable:function(){w.hide(),w.state.isEnabled=!1},unmount:function(){w.state.isVisible&&w.hide(),w.state.isMounted&&(Q(),X().forEach((function(e){e._tippy.unmount()})),b.parentNode&&b.parentNode.removeChild(b),Xe=Xe.filter((function(e){return e!==w})),w.state.isMounted=!1,I("onHidden",[w]))},destroy:function(){w.state.isDestroyed||(w.clearDelayTimeouts(),w.unmount(),K(),delete e._tippy,w.state.isDestroyed=!0,I("onDestroy",[w]))}};if(!u.render)return w;var k=u.render(w),b=k.popper,x=k.onUpdate;b.setAttribute("data-tippy-root",""),b.id="tippy-"+w.id,w.popper=b,e._tippy=w,b._tippy=w;var C=v.map((function(e){return e.fn(w)})),S=e.hasAttribute("aria-expanded");return H(),P(),F(),I("onCreate",[w]),u.showOnCreate&&ee(),b.addEventListener("mouseenter",(function(){w.props.interactive&&w.state.isVisible&&w.clearDelayTimeouts()})),b.addEventListener("mouseleave",(function(){w.props.interactive&&w.props.trigger.indexOf("mouseenter")>=0&&E().addEventListener("mousemove",g)})),w;function M(){var e=w.props.touch;return Array.isArray(e)?e:[e,0]}function N(){return"hold"===M()[0]}function O(){var e;return!(null==(e=w.props.render)||!e.$$tippy)}function A(){return l||e}function E(){var e,t,n=A().parentNode;return n?null!=(t=Ne(n)[0])&&null!=(e=t.ownerDocument)&&e.body?t.ownerDocument:document:document}function D(){return Ye(b)}function T(e){return w.state.isMounted&&!w.state.isVisible||Be.isTouch||i&&"focus"===i.type?0:xe(w.props.delay,e?0:1,Ve.delay)}function F(e){void 0===e&&(e=!1),b.style.pointerEvents=w.props.interactive&&!e?"":"none",b.style.zIndex=""+w.props.zIndex}function I(e,t,n){var r;void 0===n&&(n=!0),C.forEach((function(n){n[e]&&n[e].apply(n,t)})),n&&(r=w.props)[e].apply(r,t)}function R(){var t=w.props.aria;if(t.content){var n="aria-"+t.content,r=b.id;Ne(w.props.triggerTarget||e).forEach((function(e){var t=e.getAttribute(n);if(w.state.isVisible)e.setAttribute(n,t?t+" "+r:r);else{var o=t&&t.replace(r,"").trim();o?e.setAttribute(n,o):e.removeAttribute(n)}}))}}function P(){!S&&w.props.aria.expanded&&Ne(w.props.triggerTarget||e).forEach((function(e){w.props.interactive?e.setAttribute("aria-expanded",w.state.isVisible&&e===A()?"true":"false"):e.removeAttribute("aria-expanded")}))}function B(){E().removeEventListener("mousemove",g),Qe=Qe.filter((function(e){return e!==g}))}function L(t){if(!Be.isTouch||!p&&"mousedown"!==t.type){var n=t.composedPath&&t.composedPath()[0]||t.target;if(!w.props.interactive||!Pe(b,n)){if(Ne(w.props.triggerTarget||e).some((function(e){return Pe(e,n)}))){if(Be.isTouch)return;if(w.state.isVisible&&w.props.trigger.indexOf("click")>=0)return}else I("onClickOutside",[w,t]);!0===w.props.hideOnClick&&(w.clearDelayTimeouts(),w.hide(),h=!0,setTimeout((function(){h=!1})),w.state.isMounted||_())}}}function z(){p=!0}function $(){p=!1}function j(){var e=E();e.addEventListener("mousedown",L,!0),e.addEventListener("touchend",L,ke),e.addEventListener("touchstart",$,ke),e.addEventListener("touchmove",z,ke)}function _(){var e=E();e.removeEventListener("mousedown",L,!0),e.removeEventListener("touchend",L,ke),e.removeEventListener("touchstart",$,ke),e.removeEventListener("touchmove",z,ke)}function V(e,t){var n=D().box;function r(e){e.target===n&&(Re(n,"remove",r),t())}if(0===e)return t();Re(n,"remove",s),Re(n,"add",r),s=r}function W(t,n,r){void 0===r&&(r=!1),Ne(w.props.triggerTarget||e).forEach((function(e){e.addEventListener(t,n,r),m.push({node:e,eventType:t,handler:n,options:r})}))}function H(){var e;N()&&(W("touchstart",J,{passive:!0}),W("touchend",U,{passive:!0})),(e=w.props.trigger,e.split(/\s+/).filter(Boolean)).forEach((function(e){if("manual"!==e)switch(W(e,J),e){case"mouseenter":W("mouseleave",U);break;case"focus":W(_e?"focusout":"blur",Y);break;case"focusin":W("focusout",Y)}}))}function K(){m.forEach((function(e){var t=e.node,n=e.eventType,r=e.handler,o=e.options;t.removeEventListener(n,r,o)})),m=[]}function J(e){var t,n=!1;if(w.state.isEnabled&&!Z(e)&&!h){var r="focus"===(null==(t=i)?void 0:t.type);i=e,l=e.currentTarget,P(),!w.state.isVisible&&Ce(e,"MouseEvent")&&Qe.forEach((function(t){return t(e)})),"click"===e.type&&(w.props.trigger.indexOf("mouseenter")<0||d)&&!1!==w.props.hideOnClick&&w.state.isVisible?n=!0:ee(e),"click"===e.type&&(d=!n),n&&!r&&te(e)}}function q(e){var t=e.target,n=A().contains(t)||b.contains(t);if("mousemove"!==e.type||!n){var r=X().concat(b).map((function(e){var t,n=null==(t=e._tippy.popperInstance)?void 0:t.state;return n?{popperRect:e.getBoundingClientRect(),popperState:n,props:u}:null})).filter(Boolean);(function(e,t){var n=t.clientX,r=t.clientY;return e.every((function(e){var t=e.popperRect,o=e.popperState,i=e.props.interactiveBorder,s=o.placement.split("-")[0],a=o.modifiersData.offset;if(!a)return!0;var l="bottom"===s?a.top.y:0,c="top"===s?a.bottom.y:0,u="right"===s?a.left.x:0,d="left"===s?a.right.x:0,h=t.top-r+l>i,p=r-t.bottom-c>i,f=t.left-n+u>i,m=n-t.right-d>i;return h||p||f||m}))})(r,e)&&(B(),te(e))}}function U(e){Z(e)||w.props.trigger.indexOf("click")>=0&&d||(w.props.interactive?w.hideWithInteractivity(e):te(e))}function Y(e){w.props.trigger.indexOf("focusin")<0&&e.target!==A()||w.props.interactive&&e.relatedTarget&&b.contains(e.relatedTarget)||te(e)}function Z(e){return!!Be.isTouch&&N()!==e.type.indexOf("touch")>=0}function G(){Q();var t=w.props,n=t.popperOptions,r=t.placement,o=t.offset,i=t.getReferenceClientRect,s=t.moveTransition,l=O()?Ye(b).arrow:null,c=i?{getBoundingClientRect:i,contextElement:i.contextElement||A()}:e,u=[{name:"offset",options:{offset:o}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!s}},{name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(e){var t=e.state;if(O()){var n=D().box;["placement","reference-hidden","escaped"].forEach((function(e){"placement"===e?n.setAttribute("data-placement",t.placement):t.attributes.popper["data-popper-"+e]?n.setAttribute("data-"+e,""):n.removeAttribute("data-"+e)})),t.attributes.popper={}}}}];O()&&l&&u.push({name:"arrow",options:{element:l,padding:3}}),u.push.apply(u,(null==n?void 0:n.modifiers)||[]),w.popperInstance=ge(c,b,Object.assign({},n,{placement:r,onFirstUpdate:a,modifiers:u}))}function Q(){w.popperInstance&&(w.popperInstance.destroy(),w.popperInstance=null)}function X(){return Ae(b.querySelectorAll("[data-tippy-root]"))}function ee(e){w.clearDelayTimeouts(),e&&I("onTrigger",[w,e]),j();var t=T(!0),r=M(),o=r[0],i=r[1];Be.isTouch&&"hold"===o&&i&&(t=i),t?n=setTimeout((function(){w.show()}),t):w.show()}function te(e){if(w.clearDelayTimeouts(),I("onUntrigger",[w,e]),w.state.isVisible){if(!(w.props.trigger.indexOf("mouseenter")>=0&&w.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(e.type)>=0&&d)){var t=T(!1);t?r=setTimeout((function(){w.state.isVisible&&w.hide()}),t):o=requestAnimationFrame((function(){w.hide()}))}}else _()}}function tt(e,t){void 0===t&&(t={});var n=Ve.plugins.concat(t.plugins||[]);document.addEventListener("touchstart",ze,ke),window.addEventListener("blur",je);var r,o=Object.assign({},t,{plugins:n}),i=(r=e,Te(r)?[r]:function(e){return Ce(e,"NodeList")}(r)?Ae(r):Array.isArray(r)?r:Ae(document.querySelectorAll(r))).reduce((function(e,t){var n=t&&et(t,o);return n&&e.push(n),e}),[]);return Te(e)?i[0]:i}tt.defaultProps=Ve,tt.setDefaultProps=function(e){Object.keys(e).forEach((function(t){Ve[t]=e[t]}))},tt.currentInput=Be,Object.assign({},ee,{effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow)}}),tt.setDefaultProps({render:Ze});const nt=tt;var rt,ot,it,st,at,lt,ct,ut=n(6512),dt=Object.defineProperty,ht=(e,t,n)=>(((e,t,n)=>{t in e?dt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n),pt=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},ft=(e,t,n)=>(pt(e,t,"read from private field"),n?n.call(e):t.get(e)),mt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},gt=(e,t,n,r)=>(pt(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class yt{constructor(e){mt(this,lt),mt(this,rt,void 0),mt(this,ot,void 0),mt(this,it,void 0),mt(this,st,void 0),ht(this,"element"),mt(this,at,((e,t)=>{const{state:n,composing:o}=e,{selection:i,doc:s}=n,{ranges:a}=i,l=Math.min(...a.map((e=>e.$from.pos))),c=Math.max(...a.map((e=>e.$to.pos))),u=t&&t.doc.eq(s)&&t.selection.eq(i);if(ft(this,rt)??gt(this,rt,nt(e.dom,{trigger:"manual",interactive:!0,...ft(this,ot),content:this.element})),!o&&!u){if(!ft(this,st).call(this,e,t))return void this.hide();ft(this,rt).setProps({getReferenceClientRect:()=>(0,r.MG)(e,l,c)}),this.show()}})),ht(this,"update",((e,t)=>{i(ft(this,at),ft(this,it))(e,t)})),ht(this,"destroy",(()=>{var e;null==(e=ft(this,rt))||e.destroy()})),ht(this,"show",(()=>{var e;null==(e=ft(this,rt))||e.show()})),ht(this,"hide",(()=>{var e;null==(e=ft(this,rt))||e.hide()})),ht(this,"getInstance",(()=>ft(this,rt))),this.element=e.content,gt(this,ot,e.tippyOptions??{}),gt(this,it,e.debounce??200),gt(this,st,e.shouldShow??((e,t,n)=>(pt(this,t,"access private method"),n))(0,lt,ct))}}rt=new WeakMap,ot=new WeakMap,it=new WeakMap,st=new WeakMap,at=new WeakMap,lt=new WeakSet,ct=function(e){const{doc:t,selection:n}=e.state,{empty:r,from:i,to:s}=n,a=!t.textBetween(i,s).length&&e.state.selection instanceof o.U3,l=this.element.contains(document.activeElement),c=!e.hasFocus()&&!l,u=!e.editable;return!(c||r||a||u)};const vt=e=>{const t=(0,ut.Qx)({},`${e}_TOOLTIP_SPEC`),n=(0,ut.Gf)((n=>{const r=n.get(t.key);return new o.k_({key:new o.hs(`${e}_TOOLTIP`),...r})})),r=[t,n];return r.key=t.key,r.pluginKey=n.key,t.meta={package:"@milkdown/plugin-tooltip",displayName:`Ctx<tooltipSpec>|${e}`},n.meta={package:"@milkdown/plugin-tooltip",displayName:`Prose<tooltip>|${e}`},r}},3796:(e,t,n)=>{"use strict";function r(e,t,n){const r=[];let o=-1;for(;++o<e.length;){const i=e[o].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}n.d(t,{W:()=>r})},3890:(e,t,n)=>{"use strict";function r(e,t,n,r){const o=e.length;let i,s=0;if(t=t<0?-t>o?0:o+t:t>o?o:t,n=n>0?n:0,r.length<1e4)i=Array.from(r),i.unshift(t,n),[].splice.apply(e,i);else for(n&&[].splice.apply(e,[t,n]);s<r.length;)i=r.slice(s,s+1e4),i.unshift(t,0),[].splice.apply(e,i),s+=1e4,t+=1e4}function o(e,t){return e.length>0?(r(e,e.length,0,t),e):t}n.d(t,{V:()=>o,m:()=>r})},3971:(e,t,n)=>{"use strict";n.d(t,{vo:()=>T,e2:()=>y,$X:()=>w,hi:()=>x,Uv:()=>S,W4:()=>O,rJ:()=>E});var r,o,i,s,a=n(8769),l=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},c=(e,t,n)=>(((e,t)=>{if(!t.has(e))throw TypeError("Cannot access private method")})(e,t),n);class u{constructor({node:e,view:t,getPos:n,decorations:o,innerDecorations:i,options:s}){l(this,r),this.selected=!1,this.selectNode=()=>{var e,t;this.selected=!0,null==(t=(e=this.options).selectNode)||t.call(e)},this.deselectNode=()=>{var e,t;this.selected=!1,null==(t=(e=this.options).deselectNode)||t.call(e)},this.shouldUpdate=e=>!(e.type!==this.node.type||e.sameMarkup(this.node)&&e.content.eq(this.node.content)),this.update=(e,t,n)=>{var r,o;const i=this.options.update;let s;return i&&(s=i(e,t,n)),"boolean"!=typeof s&&(s=this.shouldUpdate(e)),this.node=e,this.decorations=t,this.innerDecorations=n,s&&(null==(o=(r=this.options).onUpdate)||o.call(r)),s},this.shouldIgnoreMutation=e=>!(this.dom&&this.contentDOM&&!this.node.isLeaf&&!this.node.isAtom)||"selection"!==e.type&&(this.contentDOM===e.target&&"attributes"===e.type||!this.contentDOM.contains(e.target)),this.ignoreMutation=e=>{if(!this.dom||!this.contentDOM)return!0;let t;const n=this.options.ignoreMutation;return n&&(t=n(e)),"boolean"!=typeof t&&(t=this.shouldIgnoreMutation(e)),t},this.destroy=()=>{var e,t,n;null==(t=(e=this.options).destroy)||t.call(e),this.dom.remove(),null==(n=this.contentDOM)||n.remove()},this.setAttrs=e=>{const{dispatch:t,state:n}=this.view,r=this.getPos();if("number"==typeof r)return t(n.tr.setNodeMarkup(r,void 0,{...this.node.attrs,...e}))},this.node=e,this.view=t,this.getPos=n,this.decorations=o,this.innerDecorations=i,this.options=s,this.dom=this.createDOM(s.as),this.contentDOM=e.isLeaf?null:this.createContentDOM(s.contentAs),this.dom.setAttribute("data-node-view-root","true"),this.contentDOM&&(this.contentDOM.setAttribute("data-node-view-content","true"),this.contentDOM.style.whiteSpace="inherit"),this.setSelection=s.setSelection,this.stopEvent=s.stopEvent}createDOM(e){return c(this,r,o).call(this,e)}createContentDOM(e){return c(this,r,o).call(this,e)}get component(){return this.options.component}}r=new WeakSet,o=function(e){const{node:t}=this;return null==e?document.createElement(t.isInline?"span":"div"):e instanceof HTMLElement?e:e instanceof Function?e(t):document.createElement(e)};class d{constructor(e){this.view=e.view,this.options=e.options}get component(){return this.options.component}get root(){var e,t;let n=null==(t=(e=this.options).root)?void 0:t.call(e,this.view.dom);return n||(n=this.view.dom.parentElement??document.body),n}update(e,t){var n,r;this.view=e,this.prevState=t,null==(r=(n=this.options).update)||r.call(n,e,t)}destroy(){var e,t;null==(t=(e=this.options).destroy)||t.call(e)}}class h{constructor({pos:e,spec:t,options:n}){l(this,i),this.pos=e,this.options=n,this.spec=t,this.dom=c(this,i,s).call(this,n.as),this.dom.setAttribute("data-widget-view-root","true")}bind(e,t){this.view=e,this.getPos=t}get component(){return this.options.component}}i=new WeakSet,s=function(e){return e instanceof HTMLElement?e:document.createElement(e)};var p=n(9742),f=n(9435),m=n(3686);const g=(0,a.createContext)({contentRef:()=>{},view:null,getPos:()=>0,setAttrs:()=>{},node:null,selected:!1,decorations:[],innerDecorations:null}),y=()=>(0,a.useContext)(g),v=(0,a.createContext)((e=>{throw new Error("out of scope")})),w=()=>(0,a.useContext)(v);class k extends u{constructor(){super(...arguments),this.key=(0,p.Ak)(),this.context={contentRef:e=>{e&&this.contentDOM&&e.firstChild!==this.contentDOM&&e.appendChild(this.contentDOM)},view:this.view,getPos:this.getPos,setAttrs:this.setAttrs,node:this.node,selected:this.selected,decorations:this.decorations,innerDecorations:this.innerDecorations},this.updateContext=()=>{Object.assign(this.context,{node:this.node,selected:this.selected,decorations:this.decorations,innerDecorations:this.innerDecorations})},this.render=()=>{const e=this.component;return(0,f.createPortal)(a.createElement(g.Provider,{value:this.context},a.createElement(e,null)),this.dom,this.key)}}}const b=(0,a.createContext)({view:null}),x=()=>(0,a.useContext)(b),C=(0,a.createContext)((e=>{throw new Error("out of scope")})),S=()=>(0,a.useContext)(C);class M extends d{constructor(){super(...arguments),this.key=(0,p.Ak)(),this.context={view:this.view,prevState:this.prevState},this.updateContext=()=>{Object.assign(this.context,{view:this.view,prevState:this.prevState})},this.render=()=>{const e=this.component;return(0,f.createPortal)(a.createElement(b.Provider,{value:this.context},a.createElement(e,null)),this.root,this.key)}}}const N=(0,a.createContext)({view:null,getPos:()=>{}}),O=()=>(0,a.useContext)(N),A=(0,a.createContext)((e=>{throw new Error("out of scope")})),E=()=>(0,a.useContext)(A);class D extends h{constructor(){super(...arguments),this.key=(0,p.Ak)(),this.context={view:this.view,getPos:this.getPos,spec:this.spec},this.updateContext=()=>{Object.assign(this.context,{view:this.view,getPos:this.getPos,spec:this.spec})},this.render=()=>{const e=this.component;return(0,f.createPortal)(a.createElement(N.Provider,{value:this.context},a.createElement(e,null)),this.dom,this.key)}}}const T=({children:e})=>{const{renderReactRenderer:t,removeReactRenderer:n,portals:r}=(()=>{const[e,t]=(0,a.useState)({}),n=(0,a.useRef)(!1);(0,a.useEffect)((()=>(requestAnimationFrame((()=>{n.current=!0})),()=>{n.current=!1})),[]);const r=(0,a.useCallback)((e=>{n.current?(0,f.flushSync)(e):e()}),[]);return{portals:e,renderReactRenderer:(0,a.useCallback)(((e,n=!0)=>{r((()=>{n&&e.updateContext(),t((t=>({...t,[e.key]:e.render()})))}))}),[r]),removeReactRenderer:(0,a.useCallback)((e=>{r((()=>{t((t=>{const n={...t};return delete n[e.key],n}))}))}),[r])}})(),o=((e,t)=>(0,a.useCallback)((n=>(r,o,i,s,a)=>{const l=new k({node:r,view:o,getPos:i,decorations:s,innerDecorations:a,options:{...n,onUpdate(){var t;null==(t=n.onUpdate)||t.call(n),e(l)},selectNode(){var t;null==(t=n.selectNode)||t.call(n),e(l)},deselectNode(){var t;null==(t=n.deselectNode)||t.call(n),e(l)},destroy(){var e;null==(e=n.destroy)||e.call(n),t(l)}}});return e(l,!1),l}),[t,e]))(t,n),i=((e,t)=>(0,a.useCallback)((n=>r=>{const o=new M({view:r,options:{...n,update:(t,r)=>{var i;null==(i=n.update)||i.call(n,t,r),e(o)},destroy:()=>{var e;null==(e=n.destroy)||e.call(n),t(o)}}});return e(o,!1),o}),[t,e]))(t,n),s=((e,t)=>(0,a.useCallback)((n=>(r,o={})=>{const i=new D({pos:r,options:n}),s={...o,destroy:e=>{var n;null==(n=o.destroy)||n.call(o,e),t(i)}};return i.spec=s,m.NZ.widget(r,((t,n)=>(i.bind(t,n),e(i),i.dom)),s)}),[t,e]))(t,n),l=(0,a.useMemo)((()=>Object.values(r)),[r]);return a.createElement(v.Provider,{value:o},a.createElement(C.Provider,{value:i},a.createElement(A.Provider,{value:s},e,l)))}},4254:(e,t,n)=>{"use strict";n.d(t,{I9:()=>z,KP:()=>j,MG:()=>L,T:()=>C,UM:()=>_,Z6:()=>N,xe:()=>$});var r=n(1570);const o="undefined"!=typeof navigator?navigator:null,i="undefined"!=typeof document?document:null,s=o&&o.userAgent||"",a=/Edge\/(\d+)/.exec(s),l=/MSIE \d/.exec(s),c=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(s),u=!!(l||c||a),d=l?document.documentMode:c?+c[1]:a?+a[1]:0,h=!u&&/gecko\/(\d+)/i.test(s),p=h&&+(/Firefox\/(\d+)/.exec(s)||[0,0])[1],f=!u&&/Chrome\/(\d+)/.exec(s),m=!!f,g=f?+f[1]:0,y=!u&&!!o&&/Apple Computer/.test(o.vendor),v=y&&(/Mobile\/\w+/.test(s)||!!o&&o.maxTouchPoints>2),w=v||!!o&&/Mac/.test(o.platform),k=/Android \d/.test(s),b=!!i&&"webkitFontSmoothing"in i.documentElement.style,x=b?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;var C=Object.freeze({__proto__:null,ie:u,ie_version:d,gecko:h,gecko_version:p,chrome:m,chrome_version:g,safari:y,ios:v,mac:w,android:k,webkit:b,webkit_version:x});function S(e,t,n,r,o,i){if(e.composing)return!1;const s=e.state,a=s.doc.resolve(t);if(a.parent.type.spec.code)return!1;const l=a.parent.textBetween(Math.max(0,a.parentOffset-500),a.parentOffset,void 0,"")+r;for(let a=0;a<o.length;a++){const c=o[a].match.exec(l),u=c&&c[0]&&o[a].handler(s,c,t-(c[0].length-r.length),n);if(u)return e.dispatch(u.setMeta(i,{transform:u,from:t,to:n,text:r})),!0}return!1}const M=new r.hs("MILKDOWN_CUSTOM_INPUTRULES"),N=({rules:e})=>{const t=new r.k_({key:M,isInputRules:!0,state:{init:()=>null,apply(e,t){return e.getMeta(this)||(e.selectionSet||e.docChanged?null:t)}},props:{handleTextInput:(n,r,o,i)=>S(n,r,o,i,e,t),handleDOMEvents:{compositionend:n=>(setTimeout((()=>{const{$cursor:r}=n.state.selection;r&&S(n,r.pos,r.pos,"",e,t)})),!1)},handleKeyDown(n,r){if("Enter"!==r.key)return!1;const{$cursor:o}=n.state.selection;return!!o&&S(n,o.pos,o.pos,"\n",e,t)}}});return t};var O=Object.defineProperty,A=Object.defineProperties,E=Object.getOwnPropertyDescriptors,D=Object.getOwnPropertySymbols,T=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable,I=(e,t,n)=>t in e?O(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,R=(e,t)=>{for(var n in t||(t={}))T.call(t,n)&&I(e,n,t[n]);if(D)for(var n of D(t))F.call(t,n)&&I(e,n,t[n]);return e},P=(e,t)=>A(e,E(t));function B(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function L(e,t,n){const r=e.state.doc.content.size,o=B(t,0,r),i=B(n,0,r),s=e.coordsAtPos(o),a=e.coordsAtPos(i,-1),l=Math.min(s.top,a.top),c=Math.max(s.bottom,a.bottom),u=Math.min(s.left,a.left),d=Math.max(s.right,a.right),h={top:l,bottom:c,left:u,right:d,width:d-u,height:c-l,x:u,y:l};return P(R({},h),{toJSON:()=>h})}const z=e=>Object.assign(Object.create(e),e).setTime(Date.now()),$=e=>(t,n)=>((e,t=!0)=>{const n=[];return e.descendants(((e,r)=>{if(n.push({node:e,pos:r}),!t)return!1})),n})(t,n).filter((t=>e(t.node))),j=e=>t=>(e=>t=>{for(let n=t.depth;n>0;n--){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}})(e)(t.$from),_=(e,t)=>{if(!(e instanceof r.nh))return;const{node:n,$from:o}=e;return((e,t)=>Array.isArray(e)&&e.includes(t.type)||t.type===e)(t,n)?{node:n,pos:o.pos,start:o.start(o.depth),depth:o.depth}:void 0}},4586:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(1369);function o(e,t,n){return(t=(0,r.A)(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},4635:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(2016);function o(e,t){(0,r.A)(e,t),t.add(e)}},5186:(e,t,n)=>{"use strict";n.d(t,{C:()=>r});const r=function(e){if(null==e)return i;if("string"==typeof e)return t=e,o((function(e){return e&&e.type===t}));var t;if("object"==typeof e)return Array.isArray(e)?function(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=r(e[n]);return o((function(...e){let n=-1;for(;++n<t.length;)if(t[n].call(this,...e))return!0;return!1}))}(e):function(e){return o((function(t){let n;for(n in e)if(t[n]!==e[n])return!1;return!0}))}(e);if("function"==typeof e)return o(e);throw new Error("Expected function, string, or object as test")};function o(e){return function(t,...n){return Boolean(t&&"object"==typeof t&&"type"in t&&Boolean(e.call(this,t,...n)))}}function i(){return!0}},5435:(e,t,n)=>{"use strict";n.d(t,{pZ:()=>a});var r=n(1570),o=n(6512);const i=(0,o.Qx)({type:"space",size:2},"indentConfig");i.meta={package:"@milkdown/plugin-indent",displayName:"Ctx<indentConfig>"};const s=(0,o.Ht)((e=>({Tab:(t,n)=>{const o=e.get(i.key),{tr:s}=t,a=((e,t)=>{const{doc:n,selection:o}=e;if(!n||!o||!(o instanceof r.U3||o instanceof r.i5))return e;const{to:i}=o,s="space"===t.type?Array(t.size).fill(" ").join(""):"\t";return e.insertText(s,i)})(s,o);return!!a.docChanged&&(null==n||n(a),!0)}})));s.meta={package:"@milkdown/plugin-indent",displayName:"Shortcut<indent>"};const a=[i,s]},5460:(e,t,n)=>{"use strict";n.d(t,{B:()=>i});var r=n(7508),o=n(7884);const i={tokenize:function(e,t,n){return function(t){return(0,o.On)(t)?(0,r.N)(e,i,"linePrefix")(t):i(t)};function i(e){return null===e||(0,o.HP)(e)?t(e):n(e)}},partial:!0}},5536:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(2559);function o(e,t,n){return n((0,r.A)(e,t))}},5715:(e,t,n)=>{"use strict";n.d(t,{Im:()=>g,RV:()=>S,wh:()=>v,y_:()=>y});var r=n(1329),o=n(6090),i=n(1570);const s=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function a(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}function l(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function c(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}function u(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var d;function h(e,t,n){let s,l,c=t.nodeBefore,u=t.nodeAfter;if(c.type.spec.isolating||u.type.spec.isolating)return!1;if(function(e,t,n){let o=t.nodeBefore,i=t.nodeAfter,s=t.index();return!(!(o&&i&&o.type.compatibleContent(i.type))||(!o.content.size&&t.parent.canReplace(s-1,s)?(n&&n(e.tr.delete(t.pos-o.nodeSize,t.pos).scrollIntoView()),0):!t.parent.canReplace(s,s+1)||!i.isTextblock&&!(0,r.n9)(e.doc,t.pos)||(n&&n(e.tr.clearIncompatible(t.pos,o.type,o.contentMatchAt(o.childCount)).join(t.pos).scrollIntoView()),0)))}(e,t,n))return!0;let d=t.parent.canReplace(t.index(),t.index()+1);if(d&&(s=(l=c.contentMatchAt(c.childCount)).findWrapping(u.type))&&l.matchType(s[0]||u.type).validEnd){if(n){let i=t.pos+u.nodeSize,a=o.FK.empty;for(let e=s.length-1;e>=0;e--)a=o.FK.from(s[e].create(null,a));a=o.FK.from(c.copy(a));let l=e.tr.step(new r.Wg(t.pos-1,i,t.pos,i,new o.Ji(a,1,0),s.length,!0)),d=i+2*s.length;(0,r.n9)(l.doc,d)&&l.join(d),n(l.scrollIntoView())}return!0}let h=i.LN.findFrom(t,1),p=h&&h.$from.blockRange(h.$to),f=p&&(0,r.jP)(p);if(null!=f&&f>=t.depth)return n&&n(e.tr.lift(p,f).scrollIntoView()),!0;if(d&&a(u,"start",!0)&&a(c,"end")){let i=c,s=[];for(;s.push(i),!i.isTextblock;)i=i.lastChild;let a=u,l=1;for(;!a.isTextblock;a=a.firstChild)l++;if(i.canReplace(i.childCount,i.childCount,a.content)){if(n){let i=o.FK.empty;for(let e=s.length-1;e>=0;e--)i=o.FK.from(s[e].copy(i));n(e.tr.step(new r.Wg(t.pos-s.length,t.pos+u.nodeSize,t.pos+l,t.pos+u.nodeSize-l,new o.Ji(i,s.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function p(e){return function(t,n){let r=t.selection,o=e<0?r.$from:r.$to,s=o.depth;for(;o.node(s).isInline;){if(!s)return!1;s--}return!!o.node(s).isTextblock&&(n&&n(t.tr.setSelection(i.U3.create(t.doc,e<0?o.start(s):o.end(s)))),!0)}}const f=p(-1),m=p(1);function g(e,t=null){return function(n,o){let{$from:i,$to:s}=n.selection,a=i.blockRange(s),l=a&&(0,r.oM)(a,e,t);return!!l&&(o&&o(n.tr.wrap(a,l).scrollIntoView()),!0)}}function y(e,t=null){return function(n,r){let o=!1;for(let r=0;r<n.selection.ranges.length&&!o;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];n.doc.nodesBetween(i,s,((r,i)=>{if(o)return!1;if(r.isTextblock&&!r.hasMarkup(e,t))if(r.type==e)o=!0;else{let t=n.doc.resolve(i),r=t.index();o=t.parent.canReplaceWith(r,r+1,e)}}))}if(!o)return!1;if(r){let o=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];o.setBlockType(i,s,e,t)}r(o.scrollIntoView())}return!0}}function v(e,t=null){return function(n,r){let{empty:o,$cursor:i,ranges:s}=n.selection;if(o&&!i||!function(e,t,n){for(let r=0;r<t.length;r++){let{$from:o,$to:i}=t[r],s=0==o.depth&&e.inlineContent&&e.type.allowsMarkType(n);if(e.nodesBetween(o.pos,i.pos,(e=>{if(s)return!1;s=e.inlineContent&&e.type.allowsMarkType(n)})),s)return!0}return!1}(n.doc,s,e))return!1;if(r)if(i)e.isInSet(n.storedMarks||i.marks())?r(n.tr.removeStoredMark(e)):r(n.tr.addStoredMark(e.create(t)));else{let o=!1,i=n.tr;for(let t=0;!o&&t<s.length;t++){let{$from:r,$to:i}=s[t];o=n.doc.rangeHasMark(r.pos,i.pos,e)}for(let n=0;n<s.length;n++){let{$from:r,$to:a}=s[n];if(o)i.removeMark(r.pos,a.pos,e);else{let n=r.pos,o=a.pos,s=r.nodeAfter,l=a.nodeBefore,c=s&&s.isText?/^\s*/.exec(s.text)[0].length:0,u=l&&l.isText?/\s*$/.exec(l.text)[0].length:0;n+c<o&&(n+=c,o-=u),i.addMark(n,o,e.create(t))}}r(i.scrollIntoView())}return!0}}function w(...e){return function(t,n,r){for(let o=0;o<e.length;o++)if(e[o](t,n,r))return!0;return!1}}let k=w(s,((e,t,n)=>{let s=function(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}(e,n);if(!s)return!1;let c=l(s);if(!c){let n=s.blockRange(),o=n&&(0,r.jP)(n);return null!=o&&(t&&t(e.tr.lift(n,o).scrollIntoView()),!0)}let u=c.nodeBefore;if(!u.type.spec.isolating&&h(e,c,t))return!0;if(0==s.parent.content.size&&(a(u,"end")||i.nh.isSelectable(u))){let n=(0,r.$L)(e.doc,s.before(),s.after(),o.Ji.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(a(u,"end")?i.LN.findFrom(r.doc.resolve(r.mapping.map(c.pos,-1)),-1):i.nh.create(r.doc,c.pos-u.nodeSize)),t(r.scrollIntoView())}return!0}}return!(!u.isAtom||c.depth!=s.depth-1||(t&&t(e.tr.delete(c.pos-u.nodeSize,c.pos).scrollIntoView()),0))}),((e,t,n)=>{let{$head:r,empty:o}=e.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;s=l(r)}let a=s&&s.nodeBefore;return!(!a||!i.nh.isSelectable(a)||(t&&t(e.tr.setSelection(i.nh.create(e.doc,s.pos-a.nodeSize)).scrollIntoView()),0))})),b=w(s,((e,t,n)=>{let s=function(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}(e,n);if(!s)return!1;let l=c(s);if(!l)return!1;let u=l.nodeAfter;if(h(e,l,t))return!0;if(0==s.parent.content.size&&(a(u,"start")||i.nh.isSelectable(u))){let n=(0,r.$L)(e.doc,s.before(),s.after(),o.Ji.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(a(u,"start")?i.LN.findFrom(r.doc.resolve(r.mapping.map(l.pos)),1):i.nh.create(r.doc,r.mapping.map(l.pos))),t(r.scrollIntoView())}return!0}}return!(!u.isAtom||l.depth!=s.depth-1||(t&&t(e.tr.delete(l.pos,l.pos+u.nodeSize).scrollIntoView()),0))}),((e,t,n)=>{let{$head:r,empty:o}=e.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;s=c(r)}let a=s&&s.nodeAfter;return!(!a||!i.nh.isSelectable(a)||(t&&t(e.tr.setSelection(i.nh.create(e.doc,s.pos)).scrollIntoView()),0))}));const x={Enter:w(((e,t)=>{let{$head:n,$anchor:r}=e.selection;return!(!n.parent.type.spec.code||!n.sameParent(r)||(t&&t(e.tr.insertText("\n").scrollIntoView()),0))}),((e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof i.i5||r.parent.inlineContent||o.parent.inlineContent)return!1;let s=u(o.parent.contentMatchAt(o.indexAfter()));if(!s||!s.isTextblock)return!1;if(t){let n=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=e.tr.insert(n,s.createAndFill());a.setSelection(i.U3.create(a.doc,n+1)),t(a.scrollIntoView())}return!0}),((e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if((0,r.zy)(e.doc,o))return t&&t(e.tr.split(o).scrollIntoView()),!0}let o=n.blockRange(),i=o&&(0,r.jP)(o);return null!=i&&(t&&t(e.tr.lift(o,i).scrollIntoView()),!0)}),((e,t)=>{let{$from:n,$to:o}=e.selection;if(e.selection instanceof i.nh&&e.selection.node.isBlock)return!(!n.parentOffset||!(0,r.zy)(e.doc,n.pos)||(t&&t(e.tr.split(n.pos).scrollIntoView()),0));if(!n.parent.isBlock)return!1;if(t){let s=o.parentOffset==o.parent.content.size,a=e.tr;(e.selection instanceof i.U3||e.selection instanceof i.i5)&&a.deleteSelection();let l=0==n.depth?null:u(n.node(-1).contentMatchAt(n.indexAfter(-1))),c=d?[d]:s&&l?[{type:l}]:void 0,h=(0,r.zy)(a.doc,a.mapping.map(n.pos),1,c);if(c||h||!(0,r.zy)(a.doc,a.mapping.map(n.pos),1,l?[{type:l}]:void 0)||(l&&(c=[{type:l}]),h=!0),h&&(a.split(a.mapping.map(n.pos),1,c),!s&&!n.parentOffset&&n.parent.type!=l)){let e=a.mapping.map(n.before()),t=a.doc.resolve(e);l&&n.node(-1).canReplaceWith(t.index(),t.index()+1,l)&&a.setNodeMarkup(a.mapping.map(n.before()),l)}t(a.scrollIntoView())}return!0})),"Mod-Enter":(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),s=n.indexAfter(-1),a=u(o.contentMatchAt(s));if(!a||!o.canReplaceWith(s,s,a))return!1;if(t){let r=n.after(),o=e.tr.replaceWith(r,r,a.createAndFill());o.setSelection(i.LN.near(o.doc.resolve(r),1)),t(o.scrollIntoView())}return!0},Backspace:k,"Mod-Backspace":k,"Shift-Backspace":k,Delete:b,"Mod-Delete":b,"Mod-a":(e,t)=>(t&&t(e.tr.setSelection(new i.i5(e.doc))),!0)},C={"Ctrl-h":x.Backspace,"Alt-Backspace":x["Mod-Backspace"],"Ctrl-d":x.Delete,"Ctrl-Alt-Backspace":x["Mod-Delete"],"Alt-Delete":x["Mod-Delete"],"Alt-d":x["Mod-Delete"],"Ctrl-a":f,"Ctrl-e":m};for(let e in x)C[e]=x[e];const S=("undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&"darwin"==os.platform())?C:x},5939:(e,t,n)=>{"use strict";n.d(t,{K:()=>g,w:()=>m});for(var r={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},o={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},i="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),s=("undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent),"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)),a="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),l=s||i&&+i[1]<57,c=0;c<10;c++)r[48+c]=r[96+c]=String(c);for(c=1;c<=24;c++)r[c+111]="F"+c;for(c=65;c<=90;c++)r[c]=String.fromCharCode(c+32),o[c]=String.fromCharCode(c);for(var u in r)o.hasOwnProperty(u)||(o[u]=r[u]);var d=n(1570);const h="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function p(e){let t,n,r,o,i=e.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(let e=0;e<i.length-1;e++){let s=i[e];if(/^(cmd|meta|m)$/i.test(s))o=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else{if(!/^mod$/i.test(s))throw new Error("Unrecognized modifier name: "+s);h?o=!0:n=!0}}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function f(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function m(e){return new d.k_({props:{handleKeyDown:g(e)}})}function g(e){let t=function(e){let t=Object.create(null);for(let n in e)t[p(n)]=e[n];return t}(e);return function(e,n){let i,s=function(e){var t=!(l&&(e.ctrlKey||e.altKey||e.metaKey)||a&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?o:r)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(n),c=t[f(s,n)];if(c&&c(e.state,e.dispatch,e))return!0;if(1==s.length&&" "!=s){if(n.shiftKey){let r=t[f(s,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.shiftKey||n.altKey||n.metaKey||s.charCodeAt(0)>127)&&(i=r[n.keyCode])&&i!=s){let r=t[f(i,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}},6090:(e,t,n)=>{"use strict";function r(e){this.content=e}n.d(t,{S4:()=>G,ZF:()=>ae,FK:()=>a,CU:()=>d,sX:()=>U,bP:()=>T,u$:()=>E,Z6:()=>J,vI:()=>h,Sj:()=>Y,Ji:()=>p}),r.prototype={constructor:r,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,t,n){var o=n&&n!=e?this.remove(n):this,i=o.find(e),s=o.content.slice();return-1==i?s.push(n||e,t):(s[i+1]=t,n&&(s[i]=n)),new r(s)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new r(n)},addToStart:function(e,t){return new r([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new r(n)},addBefore:function(e,t,n){var o=this.remove(t),i=o.content.slice(),s=o.find(e);return i.splice(-1==s?i.length:s,0,t,n),new r(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=r.from(e)).size?new r(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=r.from(e)).size?new r(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=r.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach((function(t,n){e[t]=n})),e},get size(){return this.content.length>>1}},r.from=function(e){if(e instanceof r)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new r(t)};const o=r;function i(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let o=e.child(r),s=t.child(r);if(o!=s){if(!o.sameMarkup(s))return n;if(o.isText&&o.text!=s.text){for(let e=0;o.text[e]==s.text[e];e++)n++;return n}if(o.content.size||s.content.size){let e=i(o.content,s.content,n+1);if(null!=e)return e}n+=o.nodeSize}else n+=o.nodeSize}}function s(e,t,n,r){for(let o=e.childCount,i=t.childCount;;){if(0==o||0==i)return o==i?null:{a:n,b:r};let a=e.child(--o),l=t.child(--i),c=a.nodeSize;if(a!=l){if(!a.sameMarkup(l))return{a:n,b:r};if(a.isText&&a.text!=l.text){let e=0,t=Math.min(a.text.length,l.text.length);for(;e<t&&a.text[a.text.length-e-1]==l.text[l.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(a.content.size||l.content.size){let e=s(a.content,l.content,n-1,r-1);if(e)return e}n-=c,r-=c}else n-=c,r-=c}}class a{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,o){for(let i=0,s=0;s<t;i++){let a=this.content[i],l=s+a.nodeSize;if(l>e&&!1!==n(a,r+s,o||null,i)&&a.content.size){let o=s+1;a.nodesBetween(Math.max(0,e-o),Math.min(a.content.size,t-o),n,r+o)}s=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let o="",i=!0;return this.nodesBetween(e,t,((s,a)=>{s.isText?(o+=s.text.slice(Math.max(e,a)-a,t-a),i=!n):s.isLeaf?(r?o+="function"==typeof r?r(s):r:s.type.spec.leafText&&(o+=s.type.spec.leafText(s)),i=!n):!i&&s.isBlock&&(o+=n,i=!0)}),0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,r=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),o=1);o<e.content.length;o++)r.push(e.content[o]);return new a(r,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let n=[],r=0;if(t>e)for(let o=0,i=0;i<t;o++){let s=this.content[o],a=i+s.nodeSize;a>e&&((i<e||a>t)&&(s=s.isText?s.cut(Math.max(0,e-i),Math.min(s.text.length,t-i)):s.cut(Math.max(0,e-i-1),Math.min(s.content.size,t-i-1))),n.push(s),r+=s.nodeSize),i=a}return new a(n,r)}cutByIndex(e,t){return e==t?a.empty:0==e&&t==this.content.length?this:new a(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let r=this.content.slice(),o=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new a(r,o)}addToStart(e){return new a([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new a(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let 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,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return i(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return s(this,e,t,n)}findIndex(e,t=-1){if(0==e)return c(0,e);if(e==this.size)return c(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=r+this.child(n).nodeSize;if(o>=e)return o==e||t>0?c(n+1,o):c(n,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map((e=>e.toJSON())):null}static fromJSON(e,t){if(!t)return a.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new a(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return a.empty;let t,n=0;for(let r=0;r<e.length;r++){let o=e[r];n+=o.nodeSize,r&&o.isText&&e[r-1].sameMarkup(o)?(t||(t=e.slice(0,r)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new a(t||e,n)}static from(e){if(!e)return a.empty;if(e instanceof a)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new a([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}a.empty=new a([],0);const l={index:0,offset:0};function c(e,t){return l.index=e,l.offset=t,l}function u(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!u(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!u(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}class d{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let o=e[r];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,r));else{if(o.type.excludes(this.type))return e;!n&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(o)}}return t||(t=e.slice()),n||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&&u(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 n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);return n.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return d.none;if(e instanceof d)return[e];let t=e.slice();return t.sort(((e,t)=>e.type.rank-t.type.rank)),t}}d.none=[];class h extends Error{}class p{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=m(this.content,e+this.openStart,t);return n&&new p(n,this.openStart,this.openEnd)}removeBetween(e,t){return new p(f(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 p.empty;let n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new p(a.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=e.lastChild;n&&!n.isLeaf&&(t||!n.type.spec.isolating);n=n.lastChild)r++;return new p(e,n,r)}}function f(e,t,n){let{index:r,offset:o}=e.findIndex(t),i=e.maybeChild(r),{index:s,offset:a}=e.findIndex(n);if(o==t||i.isText){if(a!=n&&!e.child(s).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return e.replaceChild(r,i.copy(f(i.content,t-o-1,n-o-1)))}function m(e,t,n,r){let{index:o,offset:i}=e.findIndex(t),s=e.maybeChild(o);if(i==t||s.isText)return r&&!r.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let a=m(s.content,t-i-1,n);return a&&e.replaceChild(o,s.copy(a))}function g(e,t,n){if(n.openStart>e.depth)throw new h("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new h("Inconsistent open depths");return y(e,t,n,0)}function y(e,t,n,r){let o=e.index(r),i=e.node(r);if(o==t.index(r)&&r<e.depth-n.openStart){let s=y(e,t,n,r+1);return i.copy(i.content.replaceChild(o,s))}if(n.content.size){if(n.openStart||n.openEnd||e.depth!=r||t.depth!=r){let{start:o,end:s}=function(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(a.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(n,e);return x(i,C(e,o,s,t,r))}{let r=e.parent,o=r.content;return x(r,o.cut(0,e.parentOffset).append(n.content).append(o.cut(t.parentOffset)))}}return x(i,S(e,t,r))}function v(e,t){if(!t.type.compatibleContent(e.type))throw new h("Cannot join "+t.type.name+" onto "+e.type.name)}function w(e,t,n){let r=e.node(n);return v(r,t.node(n)),r}function k(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function b(e,t,n,r){let o=(t||e).node(n),i=0,s=t?t.index(n):o.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(k(e.nodeAfter,r),i++));for(let e=i;e<s;e++)k(o.child(e),r);t&&t.depth==n&&t.textOffset&&k(t.nodeBefore,r)}function x(e,t){return e.type.checkContent(t),e.copy(t)}function C(e,t,n,r,o){let i=e.depth>o&&w(e,t,o+1),s=r.depth>o&&w(n,r,o+1),l=[];return b(null,e,o,l),i&&s&&t.index(o)==n.index(o)?(v(i,s),k(x(i,C(e,t,n,r,o+1)),l)):(i&&k(x(i,S(e,t,o+1)),l),b(t,n,o,l),s&&k(x(s,S(n,r,o+1)),l)),b(r,null,o,l),new a(l)}function S(e,t,n){let r=[];return b(null,e,n,r),e.depth>n&&k(x(w(e,t,n+1),S(e,t,n+1)),r),b(t,null,n,r),new a(r)}p.empty=new p(a.empty,0,0);class M{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?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[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].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 n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}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):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return d.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let o=n.marks;for(var i=0;i<o.length;i++)!1!==o[i].type.spec.inclusive||r&&o[i].isInSet(r.marks)||(o=o[i--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var o=0;o<n.length;o++)!1!==n[o].type.spec.inclusive||r&&n[o].isInSet(r.marks)||(n=n[o--].removeFromSet(n));return n}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 n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new E(this,e,n);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 n=[],r=0,o=t;for(let t=e;;){let{index:e,offset:i}=t.content.findIndex(o),s=o-i;if(n.push(t,e,r+i),!s)break;if(t=t.child(e),t.isText)break;o=s-1,r+=i+1}return new M(t,n,o)}static resolveCached(e,t){for(let n=0;n<N.length;n++){let r=N[n];if(r.pos==t&&r.doc==e)return r}let n=N[O]=M.resolve(e,t);return O=(O+1)%A,n}}let N=[],O=0,A=12;class E{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}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 D=Object.create(null);class T{constructor(e,t,n,r=d.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||a.empty}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,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&u(this.attrs,t||e.defaultAttrs||D)&&d.sameSet(this.marks,n||d.none)}copy(e=null){return e==this.content?this:new T(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new T(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return p.empty;let r=this.resolve(e),o=this.resolve(t),i=n?0:r.sharedDepth(t),s=r.start(i),a=r.node(i).content.cut(r.pos-s,o.pos-s);return new p(a,r.depth-i,o.depth-i)}replace(e,t,n){return g(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return M.resolveCached(this,e)}resolveNoCache(e){return M.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,(e=>(n.isInSet(e.marks)&&(r=!0),!r))),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),I(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,n=a.empty,r=0,o=n.childCount){let i=this.contentMatchAt(e).matchFragment(n,r,o),s=i&&i.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let e=r;e<o;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let o=this.contentMatchAt(e).matchType(n),i=o&&o.matchFragment(this.content,t);return!!i&&i.validEnd}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);let e=d.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!d.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((e=>e.type.name))}`);this.content.forEach((e=>e.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((e=>e.toJSON()))),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=a.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,r,n)}}T.prototype.text=void 0;class F extends T{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):I(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 F(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new F(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&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 I(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class R{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new P(e,t);if(null==n.next)return R.empty;let r=B(n);n.next&&n.err("Unexpected trailing text");let o=function(e){let t=Object.create(null);return function n(r){let o=[];r.forEach((t=>{e[t].forEach((({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<o.length;e++)o[e][0]==t&&(r=o[e][1]);V(e,n).forEach((e=>{r||o.push([t,r=[]]),-1==r.indexOf(e)&&r.push(e)}))}))}));let i=t[r.join(",")]=new R(r.indexOf(e.length-1)>-1);for(let e=0;e<o.length;e++){let r=o[e][1].sort(_);i.next.push({type:o[e][0],next:t[r.join(",")]||n(r)})}return i}(V(e,0))}(function(e){let t=[[]];return o(function e(t,i){if("choice"==t.type)return t.exprs.reduce(((t,n)=>t.concat(e(n,i))),[]);if("seq"!=t.type){if("star"==t.type){let s=n();return r(i,s),o(e(t.expr,s),s),[r(s)]}if("plus"==t.type){let s=n();return o(e(t.expr,i),s),o(e(t.expr,s),s),[r(s)]}if("opt"==t.type)return[r(i)].concat(e(t.expr,i));if("range"==t.type){let s=i;for(let r=0;r<t.min;r++){let r=n();o(e(t.expr,s),r),s=r}if(-1==t.max)o(e(t.expr,s),s);else for(let i=t.min;i<t.max;i++){let i=n();r(s,i),o(e(t.expr,s),i),s=i}return[r(s)]}if("name"==t.type)return[r(i,void 0,t.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let s=e(t.exprs[r],i);if(r==t.exprs.length-1)return s;o(s,i=n())}}(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let o={term:r,to:n};return t[e].push(o),o}function o(e,t){e.forEach((e=>e.to=t))}}(r));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],o=!e.validEnd,i=[];for(let t=0;t<e.next.length;t++){let{type:n,next:s}=e.next[t];i.push(n.name),!o||n.isText||n.hasRequiredAttrs()||(o=!1),-1==r.indexOf(s)&&r.push(s)}o&&t.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,n),o}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,n=e.childCount){let r=this;for(let o=t;r&&o<n;o++)r=r.matchType(e.child(o).type);return r}get inlineContent(){return 0!=this.next.length&&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 n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];return function o(i,s){let l=i.matchFragment(e,n);if(l&&(!t||l.validEnd))return a.from(s.map((e=>e.createAndFill())));for(let e=0;e<i.next.length;e++){let{type:t,next:n}=i.next[e];if(!t.isText&&!t.hasRequiredAttrs()&&-1==r.indexOf(n)){r.push(n);let e=o(n,s.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),o=r.match;if(o.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<o.next.length;e++){let{type:i,next:s}=o.next[e];i.isLeaf||i.hasRequiredAttrs()||i.name in t||r.type&&!s.validEnd||(n.push({match:i.contentMatch,type:i,via:r}),t[i.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=[];return function t(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map(((t,n)=>{let r=n+(t.validEnd?"*":" ")+" ";for(let n=0;n<t.next.length;n++)r+=(n?", ":"")+t.next[n].type.name+"->"+e.indexOf(t.next[n].next);return r})).join("\n")}}R.empty=new R(!0);class P{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 B(e){let t=[];do{t.push(L(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function L(e){let t=[];do{t.push(z(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function z(e){let t=function(e){if(e.eat("(")){let t=B(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){let t=function(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let o=[];for(let e in n){let r=n[e];r.groups.indexOf(t)>-1&&o.push(r)}return 0==o.length&&e.err("No node type or group '"+t+"' found"),o}(e,e.next).map((t=>(null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t})));return e.pos++,1==t.length?t[0]:{type:"choice",exprs:t}}e.err("Unexpected token '"+e.next+"'")}(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=j(e,t)}return t}function $(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function j(e,t){let n=$(e),r=n;return e.eat(",")&&(r="}"!=e.next?$(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function _(e,t){return t-e}function V(e,t){let n=[];return function t(r){let o=e[r];if(1==o.length&&!o[0].term)return t(o[0].to);n.push(r);for(let e=0;e<o.length;e++){let{term:r,to:i}=o[e];r||-1!=n.indexOf(i)||t(i)}}(t),n.sort(_)}function W(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function H(e,t){let n=Object.create(null);for(let r in e){let o=t&&t[r];if(void 0===o){let t=e[r];if(!t.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=t.default}n[r]=o}return n}function K(e){let t=Object.create(null);if(e)for(let n in e)t[n]=new q(e[n]);return t}class J{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=K(n.attrs),this.defaultAttrs=W(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==R.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}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:H(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new T(this,this.computeAttrs(e),a.from(t),d.setFrom(n))}createChecked(e=null,t,n){return t=a.from(t),this.checkContent(t),new T(this,this.computeAttrs(e),t,d.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=a.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),o=r&&r.fillBefore(a.empty,!0);return o?new T(this,e,t.append(o),d.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).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)}`)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(null==this.markSet)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:d.none:e}static compile(e,t){let n=Object.create(null);e.forEach(((e,r)=>n[e]=new J(e,t,r)));let r=t.spec.topNode||"doc";if(!n[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let e in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}}class q{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class U{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=K(r.attrs),this.excluded=null;let o=W(this.attrs);this.instance=o?new d(this,o):null}create(e=null){return!e&&this.instance?this.instance:new d(this,H(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach(((e,o)=>n[e]=new U(e,r++,t,o))),n}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]}excludes(e){return this.excluded.indexOf(e)>-1}}class Y{constructor(e){this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=o.from(e.nodes),t.marks=o.from(e.marks||{}),this.nodes=J.compile(this.spec.nodes,this),this.marks=U.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw new RangeError(e+" can not be both a node and a mark");let t=this.nodes[e],r=t.spec.content||"",o=t.spec.marks;t.contentMatch=n[r]||(n[r]=R.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.markSet="_"==o?null:o?Z(this,o.split(" ")):""!=o&&t.inlineContent?null:[]}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=null==n?[t]:""==n?[]:Z(this,n.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,n,r){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof J))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new F(n,n.defaultAttrs,e,d.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return T.fromJSON(this,e)}markFromJSON(e){return d.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Z(e,t){let n=[];for(let r=0;r<t.length;r++){let o=t[r],i=e.marks[o],s=i;if(i)n.push(i);else for(let t in e.marks){let r=e.marks[t];("_"==o||r.spec.group&&r.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=r)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class G{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[],t.forEach((e=>{e.tag?this.tags.push(e):e.style&&this.styles.push(e)})),this.normalizeLists=!this.tags.some((t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)}))}parse(e,t={}){let n=new re(this,t,!1);return n.addAll(e,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new re(this,t,!0);return n.addAll(e,t.from,t.to),p.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(oe(e,n.tag)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){let r=this.styles[o],i=r.style;if(!(0!=i.indexOf(e)||r.context&&!n.matchesContext(r.context)||i.length>e.length&&(61!=i.charCodeAt(e.length)||i.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((null==e.priority?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach((e=>{n(e=ie(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)}))}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach((e=>{n(e=ie(e)),e.node||e.ignore||e.mark||(e.node=t)}))}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new G(e,G.schemaRules(e)))}}const Q={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},X={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ee={ol:!0,ul:!0};function te(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}class ne{constructor(e,t,n,r,o,i,s){this.type=e,this.attrs=t,this.marks=n,this.pendingMarks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=d.none,this.stashMarks=[],this.match=i||(4&s?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(a.from(e));if(!t){let t,n=this.type.contentMatch;return(t=n.findWrapping(e.type))?(this.match=n,t):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e,t=this.content[this.content.length-1];if(t&&t.isText&&(e=/[ \t\r\n\u000c]+$/.exec(t.text))){let n=t;t.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length))}}let t=a.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(a.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}popFromStashMark(e){for(let t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}applyPending(e){for(let t=0,n=this.pendingMarks;t<n.length;t++){let r=n[t];(this.type?this.type.allowsMarkType(r.type):se(r.type,e))&&!r.isInSet(this.activeMarks)&&(this.activeMarks=r.addToSet(this.activeMarks),this.pendingMarks=r.removeFromSet(this.pendingMarks))}}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Q.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class re{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0;let r,o=t.topNode,i=te(null,t.preserveWhitespace,0)|(n?4:0);r=o?new ne(o.type,o.attrs,d.none,d.none,!0,t.topMatch||o.type.contentMatch,i):new ne(n?null:e.schema.topNodeType,null,d.none,d.none,!0,null,i),this.nodes=[r],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){if(3==e.nodeType)this.addTextNode(e);else if(1==e.nodeType){let t=e.getAttribute("style");if(t){let n=this.readStyles(function(e){let t,n=/\s*([\w-]+)\s*:\s*([^;]+)/g,r=[];for(;t=n.exec(e);)r.push(t[1],t[2].trim());return r}(t));if(!n)return;let[r,o]=n,i=this.top;for(let e=0;e<o.length;e++)this.removePendingMark(o[e],i);for(let e=0;e<r.length;e++)this.addPendingMark(r[e]);this.addElement(e);for(let e=0;e<r.length;e++)this.removePendingMark(r[e],i);for(let e=0;e<o.length;e++)this.addPendingMark(o[e])}else this.addElement(e)}}addTextNode(e){let t=e.nodeValue,n=this.top;if(2&n.options||n.inlineContext(e)||/[^ \t\r\n\u000c]/.test(t)){if(1&n.options)t=2&n.options?t.replace(/\r\n?/g,"\n"):t.replace(/\r?\n|\r/g," ");else if(t=t.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(t)&&this.open==this.nodes.length-1){let r=n.content[n.content.length-1],o=e.previousSibling;(!r||o&&"BR"==o.nodeName||r.isText&&/[ \t\r\n\u000c]$/.test(r.text))&&(t=t.slice(1))}t&&this.insertNode(this.parser.schema.text(t)),this.findInText(e)}else this.findInside(e)}addElement(e,t){let n,r=e.nodeName.toLowerCase();ee.hasOwnProperty(r)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&ee.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let o=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(n=this.parser.matchTag(e,this,t));if(o?o.ignore:X.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!o||o.skip||o.closeParent){o&&o.closeParent?this.open=Math.max(0,this.open-1):o&&o.skip.nodeType&&(e=o.skip);let t,n=this.top,i=this.needsBlock;if(Q.hasOwnProperty(r))n.content.length&&n.content[0].isInline&&this.open&&(this.open--,n=this.top),t=!0,n.type||(this.needsBlock=!0);else if(!e.firstChild)return void this.leafFallback(e);this.addAll(e),t&&this.sync(n),this.needsBlock=i}else this.addElementByRule(e,o,!1===o.consuming?n:void 0)}leafFallback(e){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"))}ignoreFallback(e){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"))}readStyles(e){let t=d.none,n=d.none;for(let r=0;r<e.length;r+=2)for(let o;;){let i=this.parser.matchStyle(e[r],e[r+1],this,o);if(!i)break;if(i.ignore)return null;if(i.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach((e=>{i.clearMark(e)&&(n=e.addToSet(n))})):t=this.parser.schema.marks[i.mark].create(i.attrs).addToSet(t),!1!==i.consuming)break;o=i}return[t,n]}addElementByRule(e,t,n){let r,o,i;t.node?(o=this.parser.schema.nodes[t.node],o.isLeaf?this.insertNode(o.create(t.attrs))||this.leafFallback(e):r=this.enter(o,t.attrs||null,t.preserveWhitespace)):(i=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(i));let s=this.top;if(o&&o.isLeaf)this.findInside(e);else if(n)this.addElement(e,n);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach((e=>this.insertNode(e)));else{let n=e;"string"==typeof t.contentElement?n=e.querySelector(t.contentElement):"function"==typeof t.contentElement?n=t.contentElement(e):t.contentElement&&(n=t.contentElement),this.findAround(e,n,!0),this.addAll(n)}r&&this.sync(s)&&this.open--,i&&this.removePendingMark(i,s)}addAll(e,t,n){let r=t||0;for(let o=t?e.childNodes[t]:e.firstChild,i=null==n?null:e.childNodes[n];o!=i;o=o.nextSibling,++r)this.findAtPoint(e,r),this.addDOM(o);this.findAtPoint(e,r)}findPlace(e){let t,n;for(let r=this.open;r>=0;r--){let o=this.nodes[r],i=o.findWrapping(e);if(i&&(!t||t.length>i.length)&&(t=i,n=o,!i.length))break;if(o.solid)break}if(!t)return!1;this.sync(n);for(let e=0;e<t.length;e++)this.enterInner(t[e],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&this.enterInner(e)}if(this.findPlace(e)){this.closeExtra();let t=this.top;t.applyPending(e.type),t.match&&(t.match=t.match.matchType(e.type));let n=t.activeMarks;for(let r=0;r<e.marks.length;r++)t.type&&!t.type.allowsMarkType(e.marks[r].type)||(n=e.marks[r].addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n){let r=this.findPlace(e.create(t));return r&&this.enterInner(e,t,!0,n),r}enterInner(e,t=null,n=!1,r){this.closeExtra();let o=this.top;o.applyPending(e),o.match=o.match&&o.match.matchType(e);let i=te(e,r,o.options);4&o.options&&0==o.content.length&&(i|=4),this.nodes.push(new ne(e,t,o.activeMarks,o.pendingMarks,n,null,i)),this.open++}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;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].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("/"),n=this.options.context,r=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),o=-(n?n.depth+1:0)+(r?0:1),i=(e,s)=>{for(;e>=0;e--){let a=t[e];if(""==a){if(e==t.length-1||0==e)continue;for(;s>=o;s--)if(i(e-1,s))return!0;return!1}{let e=s>0||0==s&&r?this.nodes[s].type:n&&s>=o?n.node(s-o).type:null;if(!e||e.name!=a&&-1==e.groups.indexOf(a))return!1;s--}}return!0};return i(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}addPendingMark(e){let t=function(e,t){for(let n=0;n<t.length;n++)if(e.eq(t[n]))return t[n]}(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,t){for(let n=this.open;n>=0;n--){let r=this.nodes[n];if(r.pendingMarks.lastIndexOf(e)>-1)r.pendingMarks=e.removeFromSet(r.pendingMarks);else{r.activeMarks=e.removeFromSet(r.activeMarks);let t=r.popFromStashMark(e);t&&r.type&&r.type.allowsMarkType(t.type)&&(r.activeMarks=t.addToSet(r.activeMarks))}if(r==t)break}}}function oe(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function ie(e){let t={};for(let n in e)t[n]=e[n];return t}function se(e,t){let n=t.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(e))continue;let i=[],s=e=>{i.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:o}=e.edge(n);if(r==t)return!0;if(i.indexOf(o)<0&&s(o))return!0}};if(s(o.contentMatch))return!0}}class ae{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=ce(t).createDocumentFragment());let r=n,o=[];return e.forEach((e=>{if(o.length||e.marks.length){let n=0,i=0;for(;n<o.length&&i<e.marks.length;){let t=e.marks[i];if(this.marks[t.type.name]){if(!t.eq(o[n][0])||!1===t.type.spec.spanning)break;n++,i++}else i++}for(;n<o.length;)r=o.pop()[1];for(;i<e.marks.length;){let n=e.marks[i++],s=this.serializeMark(n,e.isInline,t);s&&(o.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(e,t))})),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=ae.renderSpec(ce(t),this.nodes[e.type.name](e));if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let o=this.serializeMark(e.marks[r],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&ae.renderSpec(ce(n),r(e,t))}static renderSpec(e,t,n=null){if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;let r,o=t[0],i=o.indexOf(" ");i>0&&(n=o.slice(0,i),o=o.slice(i+1));let s=n?e.createElementNS(n,o):e.createElement(o),a=t[1],l=1;if(a&&"object"==typeof a&&null==a.nodeType&&!Array.isArray(a)){l=2;for(let e in a)if(null!=a[e]){let t=e.indexOf(" ");t>0?s.setAttributeNS(e.slice(0,t),e.slice(t+1),a[e]):s.setAttribute(e,a[e])}}for(let o=l;o<t.length;o++){let i=t[o];if(0===i){if(o<t.length-1||o>l)throw new RangeError("Content hole must be the only child of its parent node");return{dom:s,contentDOM:s}}{let{dom:t,contentDOM:o}=ae.renderSpec(e,i,n);if(s.appendChild(t),o){if(r)throw new RangeError("Multiple content holes");r=o}}}return{dom:s,contentDOM:r}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ae(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=le(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return le(e.marks)}}function le(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function ce(e){return e.document||window.document}},6243:(e,t,n)=>{"use strict";function r(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}n.d(t,{B:()=>r})},6325:e=>{e.exports=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}},6486:(e,t,n)=>{"use strict";n.d(t,{Se:()=>u,wu:()=>l});var r=n(2113),o=n(1570),i=n(3686),s=n(6512),a=n(1440);const l=(0,s.Qx)({uploader:async(e,t)=>{const n=[];for(let t=0;t<e.length;t++){const r=e.item(t);!r||!r.type.includes("image")||n.push(r)}const{image:r}=t.nodes;if(!r)throw(0,a.pj)("image");return(await Promise.all(n.map((e=>(e=>new Promise((t=>{const n=new FileReader;n.addEventListener("load",(()=>{t({alt:e.name,src:n.result})}),!1),n.readAsDataURL(e)})))(e))))).map((({alt:e,src:t})=>r.createAndFill({src:t,alt:e})))},enableHtmlFileUploader:!1,uploadWidgetFactory:(e,t)=>{const n=document.createElement("span");return n.textContent="Upload in progress...",i.NZ.widget(e,n,t)}},"uploadConfig");l.meta={package:"@milkdown/plugin-upload",displayName:"Ctx<uploadConfig>"};const c=(0,s.Gf)((e=>{const t=new o.hs("MILKDOWN_UPLOAD"),n=(n,o,i)=>{var s;if(!i||i.length<=0)return!1;const a=Symbol("upload symbol"),c=e.get(r.pZ),{tr:u}=n.state,d=o instanceof DragEvent?(null==(s=n.posAtCoords({left:o.clientX,top:o.clientY}))?void 0:s.pos)??u.selection.from:u.selection.from;n.dispatch(u.setMeta(t,{add:{id:a,pos:d}}));const{uploader:h}=e.get(l.key);return h(i,c).then((e=>{const r=((e,n)=>{var r;const o=t.getState(e);if(!o)return-1;const i=o.find(void 0,void 0,(e=>e.id===n));return i.length?(null==(r=i[0])?void 0:r.from)??-1:-1})(n.state,a);r<0||n.dispatch(n.state.tr.replaceWith(r,r,e).setMeta(t,{remove:{id:a}}))})).catch((e=>{console.error(e)})),!0};return new o.k_({key:t,state:{init:()=>i.zF.empty,apply(t,n){const r=n.map(t.mapping,t.doc),o=t.getMeta(this);if(!o)return r;if(o.add){const{uploadWidgetFactory:n}=e.get(l.key),i=n(o.add.pos,{id:o.add.id});return r.add(t.doc,[i])}if(o.remove){const e=r.find(void 0,void 0,(e=>e.id===o.remove.id));return r.remove(e)}return r}},props:{decorations(e){return this.getState(e)},handlePaste:(t,r)=>{var o,i;const{enableHtmlFileUploader:s}=e.get(l.key);return!(!(r instanceof ClipboardEvent)||!s&&(null==(o=r.clipboardData)?void 0:o.getData("text/html")))&&n(t,r,null==(i=r.clipboardData)?void 0:i.files)},handleDrop:(e,t)=>{var r;return t instanceof DragEvent&&n(e,t,null==(r=t.dataTransfer)?void 0:r.files)}}})}));c.meta={package:"@milkdown/plugin-upload",displayName:"Prose<upload>"};const u=[l,c]},6512:(e,t,n)=>{"use strict";n.d(t,{Fs:()=>M,Gf:()=>p,Ht:()=>m,JY:()=>x,KD:()=>C,Qx:()=>y,YR:()=>b,Yh:()=>v,b_:()=>d,dz:()=>h,hk:()=>w,lz:()=>f,m5:()=>g,pq:()=>k,yh:()=>S,yu:()=>u});var r=n(2113),o=n(7488),i=n(9742),s=n(1440),a=n(5939),l=n(6090),c=n(1570);(0,i.d_)("abcedfghicklmn",10);const u=(e,t)=>{const n=(0,r.qf)(e),o=i=>async()=>{o.key=n,await i.wait(r.x8);const s=t(i);return i.get(r.MD).create(n,s),o.run=t=>i.get(r.MD).call(e,t),()=>{i.get(r.MD).remove(n)}};return o},d=e=>{const t=n=>async()=>{await n.wait(r.x8);const o=e(n);return n.update(r.f4,(e=>[...e,o])),t.inputRule=o,()=>{n.update(r.f4,(e=>e.filter((e=>e!==o))))}};return t},h=(e,t)=>{let n;const o=i=>async()=>{const a=t(i);if(i.update(r.P_,(t=>[...t.filter((t=>t[0]!==e)),[e,a]])),o.id=e,o.schema=a,await i.wait(r.x8),n=i.get(r.pZ).nodes[e],!n)throw(0,s.pj)(e);return()=>{i.update(r.P_,(t=>t.filter((([t])=>t!==e))))}};return o.type=()=>n,o},p=e=>{let t;const n=n=>async()=>(await n.wait(r.x8),t=e(n),n.update(r.TP,(e=>[...e,t])),()=>{n.update(r.TP,(e=>e.filter((e=>e!==t))))});return n.plugin=()=>t,n.key=()=>t.spec.key,n},f=e=>{const t=n=>async()=>{await n.wait(r.ge);const o=e(n);return n.update(r.eM,(e=>[...e,o])),t.plugin=o,()=>{n.update(r.eM,(e=>e.filter((e=>e!==o))))}};return t},m=e=>{const t=n=>async()=>{await n.wait(r.x8);const o=e(n),i=(0,a.w)(o);return n.update(r.TP,(e=>[...e,i])),t.keymap=o,()=>{n.update(r.TP,(e=>e.filter((e=>e!==i))))}};return t},g=(e,t)=>{const n=o=>async()=>{await o.wait(r.x8);const i=t(o);return e.type()instanceof l.Z6?o.update(r.pe,(t=>[...t,[e.id,i]])):o.update(r.aD,(t=>[...t,[e.id,i]])),n.view=i,n.type=e,()=>{e.type()instanceof l.Z6?o.update(r.pe,(t=>t.filter((t=>t[0]!==e.id)))):o.update(r.aD,(t=>t.filter((t=>t[0]!==e.id))))}};return n},y=(e,t)=>{const n=(0,o.Z0)(e,t),r=e=>(e.inject(n),()=>()=>{e.remove(n)});return r.key=n,r},v=(e,t)=>{const n=y(t,e),o=h(e,(e=>e.get(n.key)(e))),i=[n,o];return i.id=o.id,i.node=o,i.type=o.type,i.schema=o.schema,i.ctx=n,i.key=n.key,i.extendSchema=t=>o=>()=>{const s=o.get(n.key),a=t(s)(o);o.update(r.P_,(t=>[...t.filter((t=>t[0]!==e)),[e,a]])),i.schema=a},i},w=(e,t)=>{const n=y(t,e),o=((e,t)=>{let n;const o=i=>async()=>{const a=t(i);if(i.update(r.u7,(t=>[...t.filter((t=>t[0]!==e)),[e,a]])),o.id=e,o.schema=a,await i.wait(r.x8),n=i.get(r.pZ).marks[e],!n)throw(0,s.sm)(e);return()=>{i.update(r.u7,(t=>t.filter((([t])=>t!==e))))}};return o.type=()=>n,o})(e,(e=>e.get(n.key)(e))),i=[n,o];return i.id=o.id,i.mark=o,i.type=o.type,i.schema=o.schema,i.ctx=n,i.key=n.key,i.extendSchema=t=>o=>()=>{const s=o.get(n.key),a=t(s)(o);o.update(r.u7,(t=>[...t.filter((t=>t[0]!==e)),[e,a]])),i.schema=a},i},k=(e,t)=>{const n=Object.fromEntries(Object.entries(t).map((([e,{shortcuts:t}])=>[e,t]))),r=y(n,`${e}Keymap`),o=m((e=>{const n=e.get(r.key),o=Object.entries(t).flatMap((([t,{command:r}])=>[n[t]].flat().map((t=>[t,r(e)]))));return Object.fromEntries(o)})),i=[r,o];return i.ctx=r,i.shortcuts=o,i.key=r.key,i.keymap=o.keymap,i},b=(e,t=()=>({}))=>y(t,`${e}Attr`),x=(e,t=()=>({}))=>y(t,`${e}Attr`);function C(e,t){return n=>n.get(r.MD).call(e,t)}const S=(e,t=!1)=>n=>{const o=n.get(r.kY),i=n.get(r.bQ)(e);if(!i)return;if(!t){const{state:e}=o;return o.dispatch(e.tr.replace(0,e.doc.content.size,new l.Ji(i.content,0,0)))}const s=n.get(r.pZ),a=n.get(r.Sr),u=n.get(r.TP),d=c.$t.create({schema:s,doc:i,plugins:u,...a});o.updateState(d)},M=(...e)=>{const t=e.length;let n=t;for(;n--;)if("function"!=typeof e[n])throw new TypeError("Expected a function");return(...n)=>{let r=0,o=t?e[r](...n):n[0];for(;++r<t;)o=e[r](o);return o}}},6641:(e,t,n)=>{"use strict";n.d(t,{dc:()=>o,_Z:()=>i,VG:()=>s});var r=n(5186);const o=!1,i="skip",s=function(e,t,n,s){"function"==typeof t&&"function"!=typeof n&&(s=n,n=t,t=null);const a=(0,r.C)(t),l=s?-1:1;!function e(r,c,u){const d=r&&"object"==typeof r?r:{};if("string"==typeof d.type){const e="string"==typeof d.tagName?d.tagName:"string"==typeof d.name?d.name:void 0;Object.defineProperty(h,"name",{value:"node ("+r.type+(e?"<"+e+">":"")+")"})}return h;function h(){let d,h,p,f=[];if((!t||a(r,c,u[u.length-1]||null))&&(f=function(e){return Array.isArray(e)?e:"number"==typeof e?[true,e]:[e]}(n(r,u)),f[0]===o))return f;if(r.children&&f[0]!==i)for(h=(s?r.children.length:-1)+l,p=u.concat(r);h>-1&&h<r.children.length;){if(d=e(r.children[h],h,p)(),d[0]===o)return d;h="number"==typeof d[1]?d[1]:h+l}return f}}(e,void 0,[])()}},6990:(e,t,n)=>{"use strict";n.d(t,{S:()=>o});var r=n(7884);function o(e){return null===e||(0,r.Ee)(e)||(0,r.Ny)(e)?1:(0,r.es)(e)?2:void 0}},7488:(e,t,n)=>{"use strict";n.d(t,{CR:()=>V,Kj:()=>F,Z0:()=>g,mc:()=>p,zD:()=>I});var r,o,i,s=n(1440),a=Object.defineProperty,l=(e,t,n)=>(((e,t,n)=>{t in e?a(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n),c=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},u=(e,t,n)=>(c(e,t,"read from private field"),n?n.call(e):t.get(e)),d=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},h=(e,t,n,r)=>(c(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class p{constructor(){l(this,"sliceMap",new Map),l(this,"get",(e=>{const t="string"==typeof e?[...this.sliceMap.values()].find((t=>t.type.name===e)):this.sliceMap.get(e.id);if(!t){const t="string"==typeof e?e:e.name;throw(0,s.XM)(t)}return t})),l(this,"remove",(e=>{const t="string"==typeof e?[...this.sliceMap.values()].find((t=>t.type.name===e)):this.sliceMap.get(e.id);!t||this.sliceMap.delete(t.type.id)})),l(this,"has",(e=>"string"==typeof e?[...this.sliceMap.values()].some((t=>t.type.name===e)):this.sliceMap.has(e.id)))}}class f{constructor(e,t,n){l(this,"type"),d(this,r,[]),d(this,o,void 0),d(this,i,(()=>{u(this,r).forEach((e=>e(u(this,o))))})),l(this,"set",(e=>{h(this,o,e),u(this,i).call(this)})),l(this,"get",(()=>u(this,o))),l(this,"update",(e=>{h(this,o,e(u(this,o))),u(this,i).call(this)})),this.type=n,h(this,o,t),e.set(n.id,this)}on(e){return u(this,r).push(e),()=>{h(this,r,u(this,r).filter((t=>t!==e)))}}once(e){const t=this.on((n=>{e(n),t()}));return t}off(e){h(this,r,u(this,r).filter((t=>t!==e)))}offAll(){h(this,r,[])}}r=new WeakMap,o=new WeakMap,i=new WeakMap;class m{constructor(e,t){l(this,"id"),l(this,"name"),l(this,"_typeInfo"),l(this,"_defaultValue"),this.id=Symbol(`Context-${t}`),this.name=t,this._defaultValue=e,this._typeInfo=()=>{throw(0,s.dI)()}}create(e,t=this._defaultValue){return new f(e,t,this)}}const g=(e,t)=>new m(e,t);var y,v,w,k,b,x,C,S,M,N,O,A,E;class D{constructor(e,t,n){d(this,y,void 0),d(this,v,void 0),d(this,w,void 0),d(this,k,new Set),d(this,b,new Set),d(this,x,new Map),d(this,C,new Map),l(this,"read",(()=>({metadata:u(this,y),injectedSlices:[...u(this,k)].map((e=>({name:"string"==typeof e?e:e.name,value:u(this,S).call(this,e)}))),consumedSlices:[...u(this,b)].map((e=>({name:"string"==typeof e?e:e.name,value:u(this,S).call(this,e)}))),recordedTimers:[...u(this,x)].map((([e,{duration:t}])=>({name:e.name,duration:t,status:u(this,M).call(this,e)}))),waitTimers:[...u(this,C)].map((([e,{duration:t}])=>({name:e.name,duration:t,status:u(this,M).call(this,e)})))}))),l(this,"onRecord",(e=>{u(this,x).set(e,{start:Date.now(),duration:0})})),l(this,"onClear",(e=>{u(this,x).delete(e)})),l(this,"onDone",(e=>{const t=u(this,x).get(e);!t||(t.duration=Date.now()-t.start)})),l(this,"onWait",((e,t)=>{const n=Date.now();t.finally((()=>{u(this,C).set(e,{duration:Date.now()-n})}))})),l(this,"onInject",(e=>{u(this,k).add(e)})),l(this,"onRemove",(e=>{u(this,k).delete(e)})),l(this,"onUse",(e=>{u(this,b).add(e)})),d(this,S,(e=>u(this,v).get(e).get())),d(this,M,(e=>u(this,w).get(e).status)),h(this,v,e),h(this,w,t),h(this,y,n)}}y=new WeakMap,v=new WeakMap,w=new WeakMap,k=new WeakMap,b=new WeakMap,x=new WeakMap,C=new WeakMap,S=new WeakMap,M=new WeakMap;const T=class{constructor(e,t,n){d(this,N,void 0),d(this,O,void 0),d(this,A,void 0),d(this,E,void 0),l(this,"produce",(e=>e&&Object.keys(e).length?new T(u(this,N),u(this,O),{...e}):this)),l(this,"inject",((e,t)=>{var n;const r=e.create(u(this,N).sliceMap);return null!=t&&r.set(t),null==(n=u(this,E))||n.onInject(e),this})),l(this,"remove",(e=>{var t;return u(this,N).remove(e),null==(t=u(this,E))||t.onRemove(e),this})),l(this,"record",(e=>{var t;return e.create(u(this,O).store),null==(t=u(this,E))||t.onRecord(e),this})),l(this,"clearTimer",(e=>{var t;return u(this,O).remove(e),null==(t=u(this,E))||t.onClear(e),this})),l(this,"isInjected",(e=>u(this,N).has(e))),l(this,"isRecorded",(e=>u(this,O).has(e))),l(this,"use",(e=>{var t;return null==(t=u(this,E))||t.onUse(e),u(this,N).get(e)})),l(this,"get",(e=>this.use(e).get())),l(this,"set",((e,t)=>this.use(e).set(t))),l(this,"update",((e,t)=>this.use(e).update(t))),l(this,"timer",(e=>u(this,O).get(e))),l(this,"done",(e=>{var t;this.timer(e).done(),null==(t=u(this,E))||t.onDone(e)})),l(this,"wait",(e=>{var t;const n=this.timer(e).start();return null==(t=u(this,E))||t.onWait(e,n),n})),l(this,"waitTimers",(async e=>{await Promise.all(this.get(e).map((e=>this.wait(e))))})),h(this,N,e),h(this,O,t),h(this,A,n),n&&h(this,E,new D(e,t,n))}get meta(){return u(this,A)}get inspector(){return u(this,E)}};let F=T;N=new WeakMap,O=new WeakMap,A=new WeakMap,E=new WeakMap;class I{constructor(){l(this,"store",new Map),l(this,"get",(e=>{const t=this.store.get(e.id);if(!t)throw(0,s.nr)(e.name);return t})),l(this,"remove",(e=>{this.store.delete(e.id)})),l(this,"has",(e=>this.store.has(e.id)))}}var R,P,B,L,z,$;class j{constructor(e,t){l(this,"type"),d(this,R,null),d(this,P,null),d(this,B,void 0),d(this,L,"pending"),l(this,"start",(()=>(u(this,R)??h(this,R,new Promise(((e,t)=>{h(this,P,(t=>{t instanceof CustomEvent&&t.detail.id===u(this,B)&&(h(this,L,"resolved"),u(this,z).call(this),t.stopImmediatePropagation(),e())})),u(this,$).call(this,(()=>{"pending"===u(this,L)&&h(this,L,"rejected"),u(this,z).call(this),t(new Error(`Timing ${this.type.name} timeout.`))})),h(this,L,"pending"),addEventListener(this.type.name,u(this,P))}))),u(this,R)))),l(this,"done",(()=>{const e=new CustomEvent(this.type.name,{detail:{id:u(this,B)}});dispatchEvent(e)})),d(this,z,(()=>{u(this,P)&&removeEventListener(this.type.name,u(this,P))})),d(this,$,(e=>{setTimeout((()=>{e()}),this.type.timeout)})),h(this,B,Symbol(t.name)),this.type=t,e.set(t.id,this)}get status(){return u(this,L)}}R=new WeakMap,P=new WeakMap,B=new WeakMap,L=new WeakMap,z=new WeakMap,$=new WeakMap;class _{constructor(e,t=3e3){l(this,"id"),l(this,"name"),l(this,"timeout"),l(this,"create",(e=>new j(e,this))),this.id=Symbol(`Timer-${e}`),this.name=e,this.timeout=t}}const V=(e,t=3e3)=>new _(e,t)},7508:(e,t,n)=>{"use strict";n.d(t,{N:()=>o});var r=n(7884);function o(e,t,n,o){const i=o?o-1:Number.POSITIVE_INFINITY;let s=0;return function(o){return(0,r.On)(o)?(e.enter(n),a(o)):t(o)};function a(o){return(0,r.On)(o)&&s++<i?(e.consume(o),a):(e.exit(n),t(o))}}},7884:(e,t,n)=>{"use strict";n.d(t,{CW:()=>r,lV:()=>s,cx:()=>l,JQ:()=>c,BM:()=>o,ok:()=>i,ol:()=>a,HP:()=>d,Ee:()=>u,On:()=>h,es:()=>f,Ny:()=>p});const r=m(/[A-Za-z]/),o=m(/\d/),i=m(/[\dA-Fa-f]/),s=m(/[\dA-Za-z]/),a=m(/[!-/:-@[-`{-~]/),l=m(/[#-'*+\--9=?A-Z^-~]/);function c(e){return null!==e&&(e<32||127===e)}function u(e){return null!==e&&(e<0||32===e)}function d(e){return null!==e&&e<-2}function h(e){return-2===e||-1===e||32===e}const p=m(/\s/),f=m(/[!-/:-@[-`{-~\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/);function m(e){return function(t){return null!==t&&e.test(String.fromCharCode(t))}}},7938:(e,t,n)=>{"use strict";n.d(t,{s:()=>s});var r=n(1157),o=n(9896);const i=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function s(e){return e.replace(i,a)}function a(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){const e=n.charCodeAt(1),t=120===e||88===e;return(0,o.C)(n.slice(t?2:1),t?16:10)}return(0,r.s)(n)||e}},8653:(e,t,n)=>{"use strict";n.d(t,{F_:()=>h,Ob:()=>u});var r=n(7488),o=n(2113),i=n(1570),s=n(72),a=Object.defineProperty,l=(e,t,n)=>(((e,t,n)=>{t in e?a(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);class c{constructor(){l(this,"beforeMountedListeners",[]),l(this,"mountedListeners",[]),l(this,"updatedListeners",[]),l(this,"markdownUpdatedListeners",[]),l(this,"blurListeners",[]),l(this,"focusListeners",[]),l(this,"destroyListeners",[]),l(this,"beforeMount",(e=>(this.beforeMountedListeners.push(e),this))),l(this,"mounted",(e=>(this.mountedListeners.push(e),this))),l(this,"updated",(e=>(this.updatedListeners.push(e),this)))}get listeners(){return{beforeMount:this.beforeMountedListeners,mounted:this.mountedListeners,updated:this.updatedListeners,markdownUpdated:this.markdownUpdatedListeners,blur:this.blurListeners,focus:this.focusListeners,destroy:this.destroyListeners}}markdownUpdated(e){return this.markdownUpdatedListeners.push(e),this}blur(e){return this.blurListeners.push(e),this}focus(e){return this.focusListeners.push(e),this}destroy(e){return this.destroyListeners.push(e),this}}const u=(0,r.Z0)(new c,"listener"),d=new i.hs("MILKDOWN_LISTENER"),h=e=>(e.inject(u,new c),async()=>{await e.wait(o.ge);const t=e.get(u),{listeners:n}=t;n.beforeMount.forEach((t=>t(e))),await e.wait(o.g3);const r=e.get(o.M);let a=null,l=null;const c=new i.k_({key:d,view:()=>({destroy:()=>{n.destroy.forEach((t=>t(e)))}}),props:{handleDOMEvents:{focus:()=>(n.focus.forEach((t=>t(e))),!1),blur:()=>(n.blur.forEach((t=>t(e))),!1)}},state:{init:()=>{},apply:t=>t.docChanged&&!1!==t.getMeta("addToHistory")?s((()=>{const{doc:o}=t;if(n.updated.length>0&&(null==a||!a.eq(o))&&n.updated.forEach((t=>{t(e,o,a)})),n.markdownUpdated.length>0&&(null==a||!a.eq(o))){const t=r(o);n.markdownUpdated.forEach((n=>{n(e,t,l)})),l=t}a=o}),200)():void 0}});e.update(o.TP,(e=>e.concat(c))),await e.wait(o.CU),n.mounted.forEach((t=>t(e)))});h.meta={package:"@milkdown/plugin-listener",displayName:"Listener"}},9492:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(2559);function o(e,t,n,o){return t((0,r.A)(e,n),o),o}},9575:(e,t,n)=>{"use strict";function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},r.apply(this,arguments)}n.d(t,{A:()=>r})},9742:(e,t,n)=>{"use strict";n.d(t,{Ak:()=>i,d_:()=>o});let r=e=>crypto.getRandomValues(new Uint8Array(e)),o=(e,t=21)=>((e,t,n)=>{let r=(2<<Math.log(e.length-1)/Math.LN2)-1,o=-~(1.6*r*t/e.length);return(i=t)=>{let s="";for(;;){let t=n(o),a=o;for(;a--;)if(s+=e[t[a]&r]||"",s.length===i)return s}}})(e,t,r),i=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce(((e,t)=>e+((t&=63)<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t>62?"-":"_")),"")},9760:(e,t,n)=>{"use strict";n.d(t,{E:()=>s});var r=n(2113);function o(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=o(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}const i=function(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=o(e))&&(r&&(r+=" "),r+=t);return r},s=e=>{e.update(r.QM,(e=>{const t=e.attributes;return{...e,attributes:e=>{const n="function"==typeof t?t(e):t;return{...n,class:i("prose dark:prose-invert outline-none",(null==n?void 0:n.class)||"","milkdown-theme-nord")}}}}))}},9796:(e,t,n)=>{"use strict";n.d(t,{Wj:()=>h,mS:()=>u});var r=n(4254),o=n(1570),i=n(6602),s=n(6512),a=n(3686);const l=(e,t=[])=>e.flatMap((e=>{var n;return"element"===e.type?l(e.children,[...t,...(null==(n=e.properties)?void 0:n.className)||[]]):[{text:e.value,className:t}]}));function c(e,t,n){const{highlight:o,listLanguages:i}=n,s=i(),c=[];return(0,r.xe)((e=>e.type.name===t))(e).forEach((e=>{let t=e.pos+1;const{language:n}=e.node.attrs;if(!n||!s.includes(n))return void console.warn("Unsupported language detected, this language has not been supported by current prism config: ",n);const r=o(e.node.textContent,n);l(r.children).forEach((e=>{const n=t+e.text.length;if(e.className.length){const r=a.NZ.inline(t,n,{class:e.className.join(" ")});c.push(r)}t=n}))})),a.zF.create(e,c)}const u=(0,s.Qx)({configureRefractor:()=>{}},"prismConfig");u.meta={package:"@milkdown/plugin-prism",displayName:"Ctx<prism>"};const d=(0,s.Gf)((e=>{const{configureRefractor:t}=e.get(u.key),n="code_block";return new o.k_({key:new o.hs("MILKDOWN_PRISM"),state:{init:(e,{doc:r})=>{const o=t(i.L);return c(r,n,o??i.L)},apply:(e,t,o,s)=>{var a,l;const u=s.selection.$head.parent.type.name===n,d=o.selection.$head.parent.type.name===n,h=(0,r.xe)((e=>e.type.name===n))(o.doc),p=(0,r.xe)((e=>e.type.name===n))(s.doc);return e.docChanged&&(u||d||h.length!==p.length||(null==(a=h[0])?void 0:a.node.attrs.language)!==(null==(l=p[0])?void 0:l.node.attrs.language)||e.steps.some((e=>{const t=e;return void 0!==t.from&&void 0!==t.to&&h.some((e=>e.pos>=t.from&&e.pos+e.node.nodeSize<=t.to))})))?c(e.doc,n,i.L):t.map(e.mapping,e.doc)}},props:{decorations(e){return this.getState(e)}}})}));d.meta={package:"@milkdown/plugin-prism",displayName:"Prose<prism>"};const h=[d,u]},9896:(e,t,n)=>{"use strict";function r(e,t){const n=Number.parseInt(e,t);return n<9||11===n||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||!(65535&~n)||65534==(65535&n)||n>1114111?"�":String.fromCharCode(n)}n.d(t,{C:()=>r})}}]);
|
|
3
|
-
//# sourceMappingURL=7768.
|
|
1
|
+
/*! For license information please see 7768.0fc422f7.js.LICENSE.txt */
|
|
2
|
+
(globalThis.webpackChunk_next_bricks_markdown=globalThis.webpackChunk_next_bricks_markdown||[]).push([[7768],{62:e=>{"use strict";e.exports=function(e,t){return t||(t={}),e?(e=String(e.__esModule?e.default:e),/^['"].*['"]$/.test(e)&&(e=e.slice(1,-1)),t.hash&&(e+=t.hash),/["'() \t\n]|(%20)/.test(e)||t.needQuotes?'"'.concat(e.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):e):e}},72:(e,t,n)=>{var r=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,s=/^0o[0-7]+$/i,a=parseInt,l="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,c="object"==typeof self&&self&&self.Object===Object&&self,u=l||c||Function("return this")(),d=Object.prototype.toString,h=Math.max,p=Math.min,f=function(){return u.Date.now()};function m(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function g(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==d.call(e)}(e))return NaN;if(m(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=m(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(r,"");var n=i.test(e);return n||s.test(e)?a(e.slice(2),n?2:8):o.test(e)?NaN:+e}e.exports=function(e,t,n){var r,o,i,s,a,l,c=0,u=!1,d=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function v(t){var n=r,i=o;return r=o=void 0,c=t,s=e.apply(i,n)}function w(e){var n=e-l;return void 0===l||n>=t||n<0||d&&e-c>=i}function k(){var e=f();if(w(e))return b(e);a=setTimeout(k,function(e){var n=t-(e-l);return d?p(n,i-(e-c)):n}(e))}function b(e){return a=void 0,y&&r?v(e):(r=o=void 0,s)}function x(){var e=f(),n=w(e);if(r=arguments,o=this,l=e,n){if(void 0===a)return function(e){return c=e,a=setTimeout(k,t),u?v(e):s}(l);if(d)return a=setTimeout(k,t),v(l)}return void 0===a&&(a=setTimeout(k,t)),s}return t=g(t)||0,m(n)&&(u=!!n.leading,i=(d="maxWait"in n)?h(g(n.maxWait)||0,t):i,y="trailing"in n?!!n.trailing:y),x.cancel=function(){void 0!==a&&clearTimeout(a),c=0,r=l=o=a=void 0},x.flush=function(){return void 0===a?s:b(f())},x}},96:(e,t,n)=>{"use strict";n.d(t,{JJ:()=>s,fV:()=>o,tG:()=>i});var r=n(1329);class o{constructor(e,t){var n;this.match=e,this.match=e,this.handler="string"==typeof t?(n=t,function(e,t,r,o){let i=n;if(t[1]){let e=t[0].lastIndexOf(t[1]);i+=t[0].slice(e+t[1].length);let n=(r+=e)-o;n>0&&(i=t[0].slice(e-n,e)+i,r=o)}return e.tr.insertText(i,r,o)}):t}}function i(e,t,n=null,i){return new o(e,((e,o,s,a)=>{let l=n instanceof Function?n(o):n,c=e.tr.delete(s,a),u=c.doc.resolve(s).blockRange(),d=u&&(0,r.oM)(u,t,l);if(!d)return null;c.wrap(u,d);let h=c.doc.resolve(s-1).nodeBefore;return h&&h.type==t&&(0,r.n9)(c.doc,s-1)&&(!i||i(o,h))&&c.join(s-1),c}))}function s(e,t,n=null){return new o(e,((e,r,o,i)=>{let s=e.doc.resolve(o),a=n instanceof Function?n(r):n;return s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),t)?e.tr.delete(o,i).setBlockType(o,o,t,a):null}))}new o(/--$/,"—"),new o(/\.\.\.$/,"…"),new o(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),new o(/"$/,"”"),new o(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),new o(/'$/,"’")},135:(e,t,n)=>{"use strict";n.d(t,{b6:()=>F,eD:()=>A,Eb:()=>O});var r=n(2113),o=200,i=function(){};i.prototype.append=function(e){return e.length?(e=i.from(e),!this.length&&e||e.length<o&&this.leafAppend(e)||this.length<o&&e.leafPrepend(this)||this.appendInner(e)):this},i.prototype.prepend=function(e){return e.length?i.from(e).append(this):this},i.prototype.appendInner=function(e){return new a(this,e)},i.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?i.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},i.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},i.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},i.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(t,n){return r.push(e(t,n))}),t,n),r},i.from=function(e){return e instanceof i?e:e&&e.length?new s(e):i.empty};var s=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var o=t;o<n;o++)if(!1===e(this.values[o],r+o))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var o=t-1;o>=n;o--)if(!1===e(this.values[o],r+o))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=o)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=o)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(i);i.empty=new s([]);var a=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var o=this.left.length;return!(t<o&&!1===this.left.forEachInner(e,t,Math.min(n,o),r))&&!(n>o&&!1===this.right.forEachInner(e,Math.max(t-o,0),Math.min(this.length,n)-o,r+o))&&void 0},t.prototype.forEachInvertedInner=function(e,t,n,r){var o=this.left.length;return!(t>o&&!1===this.right.forEachInvertedInner(e,t-o,Math.max(n,o)-o,r+o))&&!(n<o&&!1===this.left.forEachInvertedInner(e,Math.min(t,o),n,r))&&void 0},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(i);const l=i;var c=n(1329),u=n(1570);class d{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(0==this.eventCount)return null;let n,r,o=this.items.length;for(;;o--)if(this.items.get(o-1).selection){--o;break}t&&(n=this.remapping(o,this.items.length),r=n.maps.length);let i,s,a=e.tr,l=[],c=[];return this.items.forEach(((e,t)=>{if(!e.step)return n||(n=this.remapping(o,t+1),r=n.maps.length),r--,void c.push(e);if(n){c.push(new h(e.map));let t,o=e.step.map(n.slice(r));o&&a.maybeStep(o).doc&&(t=a.mapping.maps[a.mapping.maps.length-1],l.push(new h(t,void 0,void 0,l.length+c.length))),r--,t&&n.appendMap(t,r)}else a.maybeStep(e.step);return e.selection?(i=n?e.selection.map(n.slice(r)):e.selection,s=new d(this.items.slice(0,o).append(c.reverse().concat(l)),this.eventCount-1),!1):void 0}),this.items.length,0),{remaining:s,transform:a,selection:i}}addTransform(e,t,n,r){let o=[],i=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null;for(let n=0;n<e.steps.length;n++){let l,c=e.steps[n].invert(e.docs[n]),u=new h(e.mapping.maps[n],c,t);(l=a&&a.merge(u))&&(u=l,n?o.pop():s=s.slice(0,s.length-1)),o.push(u),t&&(i++,t=void 0),r||(a=u)}let l=i-n.depth;return l>f&&(s=function(e,t){let n;return e.forEach(((e,r)=>{if(e.selection&&0==t--)return n=r,!1})),e.slice(n)}(s,l),i-=l),new d(s.append(o),i)}remapping(e,t){let n=new c.X9;return this.items.forEach(((t,r)=>{let o=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,o)}),e,t),n}addMaps(e){return 0==this.eventCount?this:new d(this.items.append(e.map((e=>new h(e)))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),o=e.mapping,i=e.steps.length,s=this.eventCount;this.items.forEach((e=>{e.selection&&s--}),r);let a=t;this.items.forEach((t=>{let r=o.getMirror(--a);if(null==r)return;i=Math.min(i,r);let l=o.maps[r];if(t.step){let i=e.steps[r].invert(e.docs[r]),c=t.selection&&t.selection.map(o.slice(a+1,r));c&&s++,n.push(new h(l,i,c))}else n.push(new h(l))}),r);let l=[];for(let e=t;e<i;e++)l.push(new h(o.maps[e]));let c=this.items.slice(0,r).append(l).append(n),u=new d(c,s);return u.emptyItemCount()>500&&(u=u.compress(this.items.length-n.length)),u}emptyItemCount(){let e=0;return this.items.forEach((t=>{t.step||e++})),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],o=0;return this.items.forEach(((i,s)=>{if(s>=e)r.push(i),i.selection&&o++;else if(i.step){let e=i.step.map(t.slice(n)),s=e&&e.getMap();if(n--,s&&t.appendMap(s,n),e){let a=i.selection&&i.selection.map(t.slice(n));a&&o++;let l,c=new h(s.invert(),e,a),u=r.length-1;(l=r.length&&r[u].merge(c))?r[u]=l:r.push(c)}}else i.map&&n--}),this.items.length,0),new d(l.from(r.reverse()),o)}}d.empty=new d(l.empty,0);class h{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new h(t.getMap().invert(),t,this.selection)}}}class p{constructor(e,t,n,r,o){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=o}}const f=20;function m(e){let t=[];return e.forEach(((e,n,r,o)=>t.push(r,o))),t}function g(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let o=t.map(e[r],1),i=t.map(e[r+1],-1);o<=i&&n.push(o,i)}return n}function y(e,t,n,r){let o=k(t),i=b.get(t).spec.config,s=(r?e.undone:e.done).popEvent(t,o);if(!s)return;let a=s.selection.resolve(s.transform.doc),l=(r?e.done:e.undone).addTransform(s.transform,t.selection.getBookmark(),i,o),c=new p(r?l:s.remaining,r?s.remaining:l,null,0,-1);n(s.transform.setSelection(a).setMeta(b,{redo:r,historyState:c}).scrollIntoView())}let v=!1,w=null;function k(e){let t=e.plugins;if(w!=t){v=!1,w=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){v=!0;break}}return v}const b=new u.hs("history"),x=new u.hs("closeHistory");const C=(e,t)=>{let n=b.getState(e);return!(!n||0==n.done.eventCount||(t&&y(n,e,t,!1),0))},S=(e,t)=>{let n=b.getState(e);return!(!n||0==n.undone.eventCount||(t&&y(n,e,t,!0),0))};var M=n(6512);const N=(e,t)=>(Object.assign(e,{meta:{package:"@milkdown/plugin-history",...t}}),e),O=(0,M.yu)("Undo",(()=>()=>C));N(O,{displayName:"Command<undo>"});const A=(0,M.yu)("Undo",(()=>()=>S));N(O,{displayName:"Command<redo>"});const E=(0,M.Qx)({},"historyProviderConfig");N(E,{displayName:"Ctx<historyProviderConfig>"});const D=(0,M.Gf)((e=>function(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new u.k_({key:b,state:{init:()=>new p(d.empty,d.empty,null,0,-1),apply:(t,n,r)=>function(e,t,n,r){let o,i=n.getMeta(b);if(i)return i.historyState;n.getMeta(x)&&(e=new p(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(b))return s.getMeta(b).redo?new p(e.done.addTransform(n,void 0,r,k(t)),e.undone,m(n.mapping.maps[n.steps.length-1]),e.prevTime,e.prevComposition):new p(e.done,e.undone.addTransform(n,void 0,r,k(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new p(e.done.rebased(n,o),e.undone.rebased(n,o),g(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new p(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),g(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let o=n.getMeta("composition"),i=0==e.prevTime||!s&&e.prevComposition!=o&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach(((e,r)=>{for(let o=0;o<t.length;o+=2)e<=t[o+1]&&r>=t[o]&&(n=!0)})),n}(n,e.prevRanges)),a=s?g(e.prevRanges,n.mapping):m(n.mapping.maps[n.steps.length-1]);return new p(e.done.addTransform(n,i?t.selection.getBookmark():void 0,r,k(t)),d.empty,a,n.time,null==o?e.prevComposition:o)}}(n,r,t,e)},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?C:"historyRedo"==n?S:null;return!!r&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}(e.get(E.key))));N(D,{displayName:"Ctx<historyProviderPlugin>"});const T=(0,M.pq)("historyKeymap",{Undo:{shortcuts:"Mod-z",command:e=>{const t=e.get(r.MD);return()=>t.call(O.key)}},Redo:{shortcuts:["Mod-y","Shift-Mod-z"],command:e=>{const t=e.get(r.MD);return()=>t.call(A.key)}}});N(T.ctx,{displayName:"KeymapCtx<history>"}),N(T.shortcuts,{displayName:"Keymap<history>"});const F=[E,D,T,O,A].flat()},537:(e,t,n)=>{"use strict";n.d(t,{vh:()=>It,_r:()=>Ft,RP:()=>Pt,kD:()=>Rt,pK:()=>Tt,bA:()=>ot,xu:()=>it,Te:()=>Qt,f$:()=>Mt,tt:()=>Ot,lW:()=>Nt,cq:()=>Et,kr:()=>At,A7:()=>Dt,zF:()=>Bt,$l:()=>et});var r=n(1440),o=n(1854),i=n(96),s=n(6512),a=n(2113),l=n(1570),c=n(2402),u=n(4254),d=n(5715),h=n(660),p=n(7884);const f={tokenize:function(e,t,n){let r=0;return function t(i){return(87===i||119===i)&&r<3?(r++,e.consume(i),t):46===i&&3===r?(e.consume(i),o):n(i)};function o(e){return null===e?n(e):t(e)}},partial:!0},m={tokenize:function(e,t,n){let r,o,i;return s;function s(t){return 46===t||95===t?e.check(y,l,a)(t):null===t||(0,p.Ee)(t)||(0,p.Ny)(t)||45!==t&&(0,p.es)(t)?l(t):(i=!0,e.consume(t),s)}function a(t){return 95===t?r=!0:(o=r,r=void 0),e.consume(t),s}function l(e){return o||r||!i?n(e):t(e)}},partial:!0},g={tokenize:function(e,t){let n=0,r=0;return o;function o(s){return 40===s?(n++,e.consume(s),o):41===s&&r<n?i(s):33===s||34===s||38===s||39===s||41===s||42===s||44===s||46===s||58===s||59===s||60===s||63===s||93===s||95===s||126===s?e.check(y,t,i)(s):null===s||(0,p.Ee)(s)||(0,p.Ny)(s)?t(s):(e.consume(s),o)}function i(t){return 41===t&&r++,e.consume(t),o}},partial:!0},y={tokenize:function(e,t,n){return r;function r(s){return 33===s||34===s||39===s||41===s||42===s||44===s||46===s||58===s||59===s||63===s||95===s||126===s?(e.consume(s),r):38===s?(e.consume(s),i):93===s?(e.consume(s),o):60===s||null===s||(0,p.Ee)(s)||(0,p.Ny)(s)?t(s):n(s)}function o(e){return null===e||40===e||91===e||(0,p.Ee)(e)||(0,p.Ny)(e)?t(e):r(e)}function i(e){return(0,p.CW)(e)?s(e):n(e)}function s(t){return 59===t?(e.consume(t),r):(0,p.CW)(t)?(e.consume(t),s):n(t)}},partial:!0},v={tokenize:function(e,t,n){return function(t){return e.consume(t),r};function r(e){return(0,p.lV)(e)?n(e):t(e)}},partial:!0},w={tokenize:function(e,t,n){const r=this;return function(t){return 87!==t&&119!==t||!M.call(r,r.previous)||E(r.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(f,e.attempt(m,e.attempt(g,o),n),n)(t))};function o(n){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(n)}},previous:M},k={tokenize:function(e,t,n){const r=this;let o="",i=!1;return function(t){return 72!==t&&104!==t||!N.call(r,r.previous)||E(r.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(t),e.consume(t),s)};function s(t){if((0,p.CW)(t)&&o.length<5)return o+=String.fromCodePoint(t),e.consume(t),s;if(58===t){const n=o.toLowerCase();if("http"===n||"https"===n)return e.consume(t),a}return n(t)}function a(t){return 47===t?(e.consume(t),i?l:(i=!0,a)):n(t)}function l(t){return null===t||(0,p.JQ)(t)||(0,p.Ee)(t)||(0,p.Ny)(t)||(0,p.es)(t)?n(t):e.attempt(m,e.attempt(g,c),n)(t)}function c(n){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(n)}},previous:N},b={tokenize:function(e,t,n){const r=this;let o,i;return function(t){return A(t)&&O.call(r,r.previous)&&!E(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),s(t)):n(t)};function s(t){return A(t)?(e.consume(t),s):64===t?(e.consume(t),a):n(t)}function a(t){return 46===t?e.check(v,c,l)(t):45===t||95===t||(0,p.lV)(t)?(i=!0,e.consume(t),a):c(t)}function l(t){return e.consume(t),o=!0,a}function c(s){return i&&o&&(0,p.CW)(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(s)):n(s)}},previous:O},x={},C={text:x};let S=48;for(;S<123;)x[S]=b,S++,58===S?S=65:91===S&&(S=97);function M(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||(0,p.Ee)(e)}function N(e){return!(0,p.CW)(e)}function O(e){return!(47===e||A(e))}function A(e){return 43===e||45===e||46===e||95===e||(0,p.lV)(e)}function E(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}x[43]=b,x[45]=b,x[46]=b,x[95]=b,x[72]=[b,k],x[104]=[b,k],x[87]=[b,w],x[119]=[b,w];var D=n(5460),T=n(7508),F=n(6243);const I={tokenize:function(e,t,n){const r=this;return(0,T.N)(e,(function(e){const o=r.events[r.events.length-1];return o&&"gfmFootnoteDefinitionIndent"===o[1].type&&4===o[2].sliceSerialize(o[1],!0).length?t(e):n(e)}),"gfmFootnoteDefinitionIndent",5)},partial:!0};function R(e,t,n){const r=this;let o=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;o--;){const e=r.events[o][1];if("labelImage"===e.type){s=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(o){if(!s||!s._balanced)return n(o);const a=(0,F.B)(r.sliceSerialize({start:s.end,end:r.now()}));return 94===a.codePointAt(0)&&i.includes(a.slice(1))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(o),e.exit("gfmFootnoteCallLabelMarker"),t(o)):n(o)}}function P(e,t){let n,r=e.length;for(;r--;)if("labelImage"===e[r][1].type&&"enter"===e[r][0]){n=e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const o={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},l=[e[r+1],e[r+2],["enter",o,t],e[r+3],e[r+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",a,t],["exit",a,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",o,t]];return e.splice(r,e.length-r+1,...l),e}function B(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,s=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),a};function a(t){return 94!==t?n(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",l)}function l(a){if(s>999||93===a&&!i||null===a||91===a||(0,p.Ee)(a))return n(a);if(93===a){e.exit("chunkString");const i=e.exit("gfmFootnoteCallString");return o.includes((0,F.B)(r.sliceSerialize(i)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(a)}return(0,p.Ee)(a)||(i=!0),s++,e.consume(a),92===a?c:l}function c(t){return 91===t||92===t||93===t?(e.consume(t),s++,l):l(t)}}function L(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,s,a=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),l};function l(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(t)}function c(t){if(a>999||93===t&&!s||null===t||91===t||(0,p.Ee)(t))return n(t);if(93===t){e.exit("chunkString");const n=e.exit("gfmFootnoteDefinitionLabelString");return i=(0,F.B)(r.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return(0,p.Ee)(t)||(s=!0),a++,e.consume(t),92===t?u:c}function u(t){return 91===t||92===t||93===t?(e.consume(t),a++,c):c(t)}function d(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o.includes(i)||o.push(i),(0,T.N)(e,h,"gfmFootnoteDefinitionWhitespace")):n(t)}function h(e){return t(e)}}function z(e,t,n){return e.check(D.B,t,e.attempt(I,t,n))}function $(e){e.exit("gfmFootnoteDefinition")}var j=n(3890),_=n(6990),V=n(3796);function W(e){let t=(e||{}).singleTilde;const n={tokenize:function(e,n,r){const o=this.previous,i=this.events;let s=0;return function(t){return 126===o&&"characterEscape"!==i[i.length-1][1].type?r(t):(e.enter("strikethroughSequenceTemporary"),a(t))};function a(i){const l=(0,_.S)(o);if(126===i)return s>1?r(i):(e.consume(i),s++,a);if(s<2&&!t)return r(i);const c=e.exit("strikethroughSequenceTemporary"),u=(0,_.S)(i);return c._open=!u||2===u&&Boolean(l),c._close=!l||2===l&&Boolean(u),n(i)}},resolveAll:function(e,t){let n=-1;for(;++n<e.length;)if("enter"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._close){let r=n;for(;r--;)if("exit"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset==e[r][1].end.offset-e[r][1].start.offset){e[n][1].type="strikethroughSequence",e[r][1].type="strikethroughSequence";const o={type:"strikethrough",start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},i={type:"strikethroughText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},s=[["enter",o,t],["enter",e[r][1],t],["exit",e[r][1],t],["enter",i,t]],a=t.parser.constructs.insideSpan.null;a&&(0,j.m)(s,s.length,0,(0,V.W)(a,e.slice(r+1,n),t)),(0,j.m)(s,s.length,0,[["exit",i,t],["enter",e[n][1],t],["exit",e[n][1],t],["exit",o,t]]),(0,j.m)(e,r-1,n-r+3,s),n=r+s.length-2;break}}for(n=-1;++n<e.length;)"strikethroughSequenceTemporary"===e[n][1].type&&(e[n][1].type="data");return e}};return null==t&&(t=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}}}class H{constructor(){this.map=[]}add(e,t,n){!function(e,t,n,r){let o=0;if(0!==n||0!==r.length){for(;o<e.map.length;){if(e.map[o][0]===t)return e.map[o][1]+=n,void e.map[o][2].push(...r);o+=1}e.map.push([t,n,r])}}(this,e,t,n)}consume(e){if(this.map.sort(((e,t)=>e[0]-t[0])),0===this.map.length)return;let t=this.map.length;const n=[];for(;t>0;)t-=1,n.push(e.slice(this.map[t][0]+this.map[t][1])),n.push(this.map[t][2]),e.length=this.map[t][0];n.push([...e]),e.length=0;let r=n.pop();for(;r;)e.push(...r),r=n.pop();this.map.length=0}}function K(e,t){let n=!1;const r=[];for(;t<e.length;){const o=e[t];if(n){if("enter"===o[0])"tableContent"===o[1].type&&r.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===o[1].type){if("tableDelimiterMarker"===e[t-1][1].type){const e=r.length-1;r[e]="left"===r[e]?"center":"right"}}else if("tableDelimiterRow"===o[1].type)break}else"enter"===o[0]&&"tableDelimiterRow"===o[1].type&&(n=!0);t+=1}return r}const J={flow:{null:{tokenize:function(e,t,n){const r=this;let o,i=0,s=0;return function(e){let t=r.events.length-1;for(;t>-1;){const e=r.events[t][1].type;if("lineEnding"!==e&&"linePrefix"!==e)break;t--}const o=t>-1?r.events[t][1].type:null,i="tableHead"===o||"tableRow"===o?b:a;return i===b&&r.parser.lazy[r.now().line]?n(e):i(e)};function a(t){return e.enter("tableHead"),e.enter("tableRow"),function(e){return 124===e||(o=!0,s+=1),l(e)}(t)}function l(t){return null===t?n(t):(0,p.HP)(t)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),d):n(t):(0,p.On)(t)?(0,T.N)(e,l,"whitespace")(t):(s+=1,o&&(o=!1,i+=1),124===t?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),o=!0,l):(e.enter("data"),c(t)))}function c(t){return null===t||124===t||(0,p.Ee)(t)?(e.exit("data"),l(t)):(e.consume(t),92===t?u:c)}function u(t){return 92===t||124===t?(e.consume(t),c):c(t)}function d(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter("tableDelimiterRow"),o=!1,(0,p.On)(t)?(0,T.N)(e,h,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):h(t))}function h(t){return 45===t||58===t?m(t):124===t?(o=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),f):k(t)}function f(t){return(0,p.On)(t)?(0,T.N)(e,m,"whitespace")(t):m(t)}function m(t){return 58===t?(s+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),g):45===t?(s+=1,g(t)):null===t||(0,p.HP)(t)?w(t):k(t)}function g(t){return 45===t?(e.enter("tableDelimiterFiller"),y(t)):k(t)}function y(t){return 45===t?(e.consume(t),y):58===t?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),v):(e.exit("tableDelimiterFiller"),v(t))}function v(t){return(0,p.On)(t)?(0,T.N)(e,w,"whitespace")(t):w(t)}function w(n){return 124===n?h(n):(null===n||(0,p.HP)(n))&&o&&i===s?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(n)):k(n)}function k(e){return n(e)}function b(t){return e.enter("tableRow"),x(t)}function x(n){return 124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),x):null===n||(0,p.HP)(n)?(e.exit("tableRow"),t(n)):(0,p.On)(n)?(0,T.N)(e,x,"whitespace")(n):(e.enter("data"),C(n))}function C(t){return null===t||124===t||(0,p.Ee)(t)?(e.exit("data"),x(t)):(e.consume(t),92===t?S:C)}function S(t){return 92===t||124===t?(e.consume(t),C):C(t)}},resolveAll:function(e,t){let n,r,o,i=-1,s=!0,a=0,l=[0,0,0,0],c=[0,0,0,0],u=!1,d=0;const h=new H;for(;++i<e.length;){const p=e[i],f=p[1];"enter"===p[0]?"tableHead"===f.type?(u=!1,0!==d&&(U(h,t,d,n,r),r=void 0,d=0),n={type:"table",start:Object.assign({},f.start),end:Object.assign({},f.end)},h.add(i,0,[["enter",n,t]])):"tableRow"===f.type||"tableDelimiterRow"===f.type?(s=!0,o=void 0,l=[0,0,0,0],c=[0,i+1,0,0],u&&(u=!1,r={type:"tableBody",start:Object.assign({},f.start),end:Object.assign({},f.end)},h.add(i,0,[["enter",r,t]])),a="tableDelimiterRow"===f.type?2:r?3:1):!a||"data"!==f.type&&"tableDelimiterMarker"!==f.type&&"tableDelimiterFiller"!==f.type?"tableCellDivider"===f.type&&(s?s=!1:(0!==l[1]&&(c[0]=c[1],o=q(h,t,l,a,void 0,o)),l=c,c=[l[1],i,0,0])):(s=!1,0===c[2]&&(0!==l[1]&&(c[0]=c[1],o=q(h,t,l,a,void 0,o),l=[0,0,0,0]),c[2]=i)):"tableHead"===f.type?(u=!0,d=i):"tableRow"===f.type||"tableDelimiterRow"===f.type?(d=i,0!==l[1]?(c[0]=c[1],o=q(h,t,l,a,i,o)):0!==c[1]&&(o=q(h,t,c,a,i,o)),a=0):!a||"data"!==f.type&&"tableDelimiterMarker"!==f.type&&"tableDelimiterFiller"!==f.type||(c[3]=i)}for(0!==d&&U(h,t,d,n,r),h.consume(t.events),i=-1;++i<t.events.length;){const e=t.events[i];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=K(t.events,i))}return e}}}};function q(e,t,n,r,o,i){const s=1===r?"tableHeader":2===r?"tableDelimiter":"tableData";0!==n[0]&&(i.end=Object.assign({},Y(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const a=Y(t.events,n[1]);if(i={type:s,start:Object.assign({},a),end:Object.assign({},a)},e.add(n[1],0,[["enter",i,t]]),0!==n[2]){const o=Y(t.events,n[2]),i=Y(t.events,n[3]),s={type:"tableContent",start:Object.assign({},o),end:Object.assign({},i)};if(e.add(n[2],0,[["enter",s,t]]),2!==r){const r=t.events[n[2]],o=t.events[n[3]];if(r[1].end=Object.assign({},o[1].end),r[1].type="chunkText",r[1].contentType="text",n[3]>n[2]+1){const t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[["exit",s,t]])}return void 0!==o&&(i.end=Object.assign({},Y(t.events,o)),e.add(o,0,[["exit",i,t]]),i=void 0),i}function U(e,t,n,r,o){const i=[],s=Y(t.events,n);o&&(o.end=Object.assign({},s),i.push(["exit",o,t])),r.end=Object.assign({},s),i.push(["exit",r,t]),e.add(n+1,0,i)}function Y(e,t){const n=e[t],r="enter"===n[0]?"start":"end";return n[1][r]}const Z={tokenize:function(e,t,n){const r=this;return function(t){return null===r.previous&&r._gfmTasklistFirstContentOfListItem?(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),o):n(t)};function o(t){return(0,p.Ee)(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),i):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),i):n(t)}function i(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),s):n(t)}function s(r){return(0,p.HP)(r)?t(r):(0,p.On)(r)?e.check({tokenize:Q},t,n)(r):n(r)}}},G={text:{91:Z}};function Q(e,t,n){return(0,T.N)(e,(function(e){return null===e?n(e):t(e)}),"whitespace")}var X=n(8999),ee=n(7096),te=n(6641),ne=n(5186);const re={}.hasOwnProperty;function oe(e){return"string"==typeof e?new RegExp((0,ee.A)(e),"g"):e}function ie(e){return"function"==typeof e?e:()=>e}const se="phrasing",ae=["autolink","link","image","label"],le={transforms:[function(e){!function(e,t,n,r){let o,i;"string"==typeof t||t instanceof RegExp?(i=[[t,n]],o=r):(i=t,o=n),o||(o={});const s=(0,ne.C)(o.ignore||[]),a=function(e){const t=[];if("object"!=typeof e)throw new TypeError("Expected array or object as schema");if(Array.isArray(e)){let n=-1;for(;++n<e.length;)t.push([oe(e[n][0]),ie(e[n][1])])}else{let n;for(n in e)re.call(e,n)&&t.push([oe(n),ie(e[n])])}return t}(i);let l=-1;for(;++l<a.length;)(0,te.VG)(e,"text",c);return e;function c(e,t){let n,r=-1;for(;++r<t.length;){const e=t[r];if(s(e,n?n.children.indexOf(e):void 0,n))return;n=e}if(n)return function(e,t){const n=t[t.length-1],r=a[l][0],o=a[l][1];let i=0;const s=n.children.indexOf(e);let c=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){const n=d.index,s={index:d.index,input:d.input,stack:[...t,e]};let a=o(...d,s);if("string"==typeof a&&(a=a.length>0?{type:"text",value:a}:void 0),!1!==a&&(i!==n&&u.push({type:"text",value:e.value.slice(i,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),i=n+d[0].length,c=!0),!r.global)break;d=r.exec(e.value)}return c?(i<e.value.length&&u.push({type:"text",value:e.value.slice(i)}),n.children.splice(s,1,...u)):u=[e],s+u.length}(e,t)}}(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,de],[/([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/g,he]],{ignore:["link","linkReference"]})}],enter:{literalAutolink:function(e){this.enter({type:"link",title:null,url:"",children:[]},e)},literalAutolinkEmail:ue,literalAutolinkHttp:ue,literalAutolinkWww:ue},exit:{literalAutolink:function(e){this.exit(e)},literalAutolinkEmail:function(e){this.config.exit.autolinkEmail.call(this,e)},literalAutolinkHttp:function(e){this.config.exit.autolinkProtocol.call(this,e)},literalAutolinkWww:function(e){this.config.exit.data.call(this,e),this.stack[this.stack.length-1].url="http://"+this.sliceSerialize(e)}}},ce={unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:se,notInConstruct:ae},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:se,notInConstruct:ae},{character:":",before:"[ps]",after:"\\/",inConstruct:se,notInConstruct:ae}]};function ue(e){this.config.enter.autolinkProtocol.call(this,e)}function de(e,t,n,r,o){let i="";if(!pe(o))return!1;if(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!function(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}(n))return!1;const s=function(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const o=(0,X.D)(e,"(");let i=(0,X.D)(e,")");for(;-1!==r&&o>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}(n+r);if(!s[0])return!1;const a={type:"link",title:null,url:i+t+s[0],children:[{type:"text",value:t+s[0]}]};return s[1]?[a,{type:"text",value:s[1]}]:a}function he(e,t,n,r){return!(!pe(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function pe(e,t){const n=e.input.charCodeAt(e.index-1);return(0===e.index||(0,p.Ny)(n)||(0,p.es)(n))&&(!t||47!==n)}var fe=n(7938);function me(e){return e.label||!e.identifier?e.label||"":(0,fe.s)(e.identifier)}function ge(e,t,n,r){let o=r.join.length;for(;o--;){const i=r.join[o](e,t,n,r);if(!0===i||1===i)break;if("number"==typeof i)return"\n".repeat(1+i);if(!1===i)return"\n\n\x3c!----\x3e\n\n"}return"\n\n"}const ye=/\r?\n|\r/g;function ve(e){if(!e._compiled){const t=(e.atBreak?"[\\r\\n][\\t ]*":"")+(e.before?"(?:"+e.before+")":"");e._compiled=new RegExp((t?"("+t+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?"\\":"")+e.character+(e.after?"(?:"+e.after+")":""),"g")}return e._compiled}function we(e,t){return ke(e,t.inConstruct,!0)&&!ke(e,t.notInConstruct,!1)}function ke(e,t,n){if("string"==typeof t&&(t=[t]),!t||0===t.length)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function be(e,t,n){const r=(n.before||"")+(t||"")+(n.after||""),o=[],i=[],s={};let a=-1;for(;++a<e.unsafe.length;){const t=e.unsafe[a];if(!we(e.stack,t))continue;const n=ve(t);let i;for(;i=n.exec(r);){const e="before"in t||Boolean(t.atBreak),n="after"in t,r=i.index+(e?i[1].length:0);o.includes(r)?(s[r].before&&!e&&(s[r].before=!1),s[r].after&&!n&&(s[r].after=!1)):(o.push(r),s[r]={before:e,after:n})}}o.sort(xe);let l=n.before?n.before.length:0;const c=r.length-(n.after?n.after.length:0);for(a=-1;++a<o.length;){const e=o[a];e<l||e>=c||e+1<c&&o[a+1]===e+1&&s[e].after&&!s[e+1].before&&!s[e+1].after||o[a-1]===e-1&&s[e].before&&!s[e-1].before&&!s[e-1].after||(l!==e&&i.push(Ce(r.slice(l,e),"\\")),l=e,!/[!-/:-@[-`{-~]/.test(r.charAt(e))||n.encode&&n.encode.includes(r.charAt(e))?(i.push("&#x"+r.charCodeAt(e).toString(16).toUpperCase()+";"),l++):i.push("\\"))}return i.push(Ce(r.slice(l,c),n.after)),i.join("")}function xe(e,t){return e-t}function Ce(e,t){const n=/\\(?=[!-/:-@[-`{-~])/g,r=[],o=[],i=e+t;let s,a=-1,l=0;for(;s=n.exec(i);)r.push(s.index);for(;++a<r.length;)l!==r[a]&&o.push(e.slice(l,r[a])),o.push("\\"),l=r[a];return o.push(e.slice(l)),o.join("")}function Se(e){const t=e||{},n=t.now||{};let r=t.lineShift||0,o=n.line||1,i=n.column||1;return{move:function(e){const t=e||"",n=t.split(/\r?\n|\r/g),s=n[n.length-1];return o+=n.length-1,i=1===n.length?i+s.length:1+s.length+r,t},current:function(){return{now:{line:o,column:i},lineShift:r}},shift:function(e){r+=e}}}function Me(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Ne(){this.buffer()}function Oe(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=(0,F.B)(this.sliceSerialize(e)).toLowerCase()}function Ae(e){this.exit(e)}function Ee(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function De(){this.buffer()}function Te(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=(0,F.B)(this.sliceSerialize(e)).toLowerCase()}function Fe(e){this.exit(e)}function Ie(e,t,n,r){const o=Se(r);let i=o.move("[^");const s=n.enter("footnoteReference"),a=n.enter("reference");return i+=o.move(be(n,me(e),{...o.current(),before:i,after:"]"})),a(),s(),i+=o.move("]"),i}function Re(e,t,n,r){const o=Se(r);let i=o.move("[^");const s=n.enter("footnoteDefinition"),a=n.enter("label");return i+=o.move(be(n,me(e),{...o.current(),before:i,after:"]"})),a(),i+=o.move("]:"+(e.children&&e.children.length>0?" ":"")),o.shift(4),i+=o.move(function(e,t){const n=[];let r,o=0,i=0;for(;r=ye.exec(e);)s(e.slice(o,r.index)),n.push(r[0]),o=r.index+r[0].length,i++;return s(e.slice(o)),n.join("");function s(e){n.push(t(e,i,!e))}}(function(e,t,n){const r=t.indexStack,o=e.children||[],i=t.createTracker(n),s=[];let a=-1;for(r.push(-1);++a<o.length;){const n=o[a];r[r.length-1]=a,s.push(i.move(t.handle(n,e,t,{before:"\n",after:"\n",...i.current()}))),"list"!==n.type&&(t.bulletLastUsed=void 0),a<o.length-1&&s.push(i.move(ge(n,o[a+1],e,t)))}return r.pop(),s.join("")}(e,n,o.current()),Pe)),s(),i}function Pe(e,t,n){return 0===t?e:(n?"":" ")+e}function Be(e,t,n){const r=t.indexStack,o=e.children||[],i=[];let s=-1,a=n.before;r.push(-1);let l=t.createTracker(n);for(;++s<o.length;){const c=o[s];let u;if(r[r.length-1]=s,s+1<o.length){let n=t.handle.handlers[o[s+1].type];n&&n.peek&&(n=n.peek),u=n?n(o[s+1],e,t,{before:"",after:"",...l.current()}).charAt(0):""}else u=n.after;i.length>0&&("\r"===a||"\n"===a)&&"html"===c.type&&(i[i.length-1]=i[i.length-1].replace(/(\r?\n|\r)$/," "),a=" ",l=t.createTracker(n),l.move(i.join(""))),i.push(l.move(t.handle(c,e,t,{...l.current(),before:a,after:u}))),a=i[i.length-1].slice(-1)}return r.pop(),i.join("")}Ie.peek=function(){return"["},$e.peek=function(){return"~"};const Le={canContainEols:["delete"],enter:{strikethrough:function(e){this.enter({type:"delete",children:[]},e)}},exit:{strikethrough:function(e){this.exit(e)}}},ze={unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"]}],handlers:{delete:$e}};function $e(e,t,n,r){const o=Se(r),i=n.enter("strikethrough");let s=o.move("~~");return s+=Be(e,n,{...o.current(),before:s,after:"~"}),s+=o.move("~~"),i(),s}function je(e,t,n){let r=e.value||"",o="`",i=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(r);)o+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const e=n.unsafe[i],t=ve(e);let o;if(e.atBreak)for(;o=t.exec(r);){let e=o.index;10===r.charCodeAt(e)&&13===r.charCodeAt(e-1)&&e--,r=r.slice(0,e)+" "+r.slice(o.index+1)}}return o+r+o}je.peek=function(){return"`"};var _e=n(7395);const Ve={enter:{table:function(e){const t=e._align;this.enter({type:"table",align:t.map((e=>"none"===e?null:e)),children:[]},e),this.setData("inTable",!0)},tableData:He,tableHeader:He,tableRow:function(e){this.enter({type:"tableRow",children:[]},e)}},exit:{codeText:function(e){let t=this.resume();this.getData("inTable")&&(t=t.replace(/\\([\\|])/g,Ke)),this.stack[this.stack.length-1].value=t,this.exit(e)},table:function(e){this.exit(e),this.setData("inTable")},tableData:We,tableHeader:We,tableRow:We}};function We(e){this.exit(e)}function He(e){this.enter({type:"tableCell",children:[]},e)}function Ke(e,t){return"|"===t?t:e}function Je(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,o=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[\t :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{table:function(e,t,n,r){return a(function(e,t,n){const r=e.children;let o=-1;const i=[],s=t.enter("table");for(;++o<r.length;)i[o]=l(r[o],t,n);return s(),i}(e,n,r),e.align)},tableRow:function(e,t,n,r){const o=a([l(e,n,r)]);return o.slice(0,o.indexOf("\n"))},tableCell:s,inlineCode:function(e,t,n){let r=je(e,0,n);return n.stack.includes("tableCell")&&(r=r.replace(/\|/g,"\\$&")),r}}};function s(e,t,n,r){const o=n.enter("tableCell"),s=n.enter("phrasing"),a=Be(e,n,{...r,before:i,after:i});return s(),o(),a}function a(e,t){return(0,_e.Q)(e,{align:t,alignDelimiters:r,padding:n,stringLength:o})}function l(e,t,n){const r=e.children;let o=-1;const i=[],a=t.enter("tableRow");for(;++o<r.length;)i[o]=s(r[o],0,t,n);return a(),i}}const qe={exit:{taskListCheckValueChecked:Ye,taskListCheckValueUnchecked:Ye,paragraph:function(e){const t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){const e=this.stack[this.stack.length-1],n=e.children[0];if(n&&"text"===n.type){const r=t.children;let o,i=-1;for(;++i<r.length;){const e=r[i];if("paragraph"===e.type){o=e;break}}o===e&&(n.value=n.value.slice(1),0===n.value.length?e.children.shift():e.position&&n.position&&"number"==typeof n.position.start.offset&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}}},Ue={unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:function(e,t,n,r){const o=e.children[0],i="boolean"==typeof e.checked&&o&&"paragraph"===o.type,s="["+(e.checked?"x":" ")+"] ",a=Se(r);i&&a.move(s);let l=function(e,t,n,r){const o=function(e){const t=e.options.listItemIndent||"tab";if(1===t||"1"===t)return"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(n);let i=n.bulletCurrent||function(e){const t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}(n);t&&"list"===t.type&&t.ordered&&(i=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+i);let s=i.length+1;("tab"===o||"mixed"===o&&(t&&"list"===t.type&&t.spread||e.spread))&&(s=4*Math.ceil(s/4));const a=n.createTracker(r);a.move(i+" ".repeat(s-i.length)),a.shift(s);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,a.current()),(function(e,t,n){return t?(n?"":" ".repeat(s))+e:(n?i:i+" ".repeat(s-i.length))+e}));return l(),c}(e,t,n,{...r,...a.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,(function(e){return e+s}))),l}}};function Ye(e){this.stack[this.stack.length-2].checked="taskListCheckValueChecked"===e.type}function Ze(e={}){const t=this.data();function n(e,n){(t[e]?t[e]:t[e]=[]).push(n)}n("micromarkExtensions",function(e){return(0,h.y)([C,{document:{91:{tokenize:L,continuation:{tokenize:z},exit:$}},text:{91:{tokenize:B},93:{add:"after",tokenize:R,resolveTo:P}}},W(e),J,G])}(e)),n("fromMarkdownExtensions",[le,{enter:{gfmFootnoteDefinition:Me,gfmFootnoteDefinitionLabelString:Ne,gfmFootnoteCall:Ee,gfmFootnoteCallString:De},exit:{gfmFootnoteDefinition:Ae,gfmFootnoteDefinitionLabelString:Oe,gfmFootnoteCall:Fe,gfmFootnoteCallString:Te}},Le,Ve,qe]),n("toMarkdownExtensions",function(e){return{extensions:[ce,{unsafe:[{character:"[",inConstruct:["phrasing","label","reference"]}],handlers:{footnoteDefinition:Re,footnoteReference:Ie}},ze,Je(e),Ue]}}(e))}const Ge=(e,t)=>(Object.assign(e,{meta:{package:"@milkdown/preset-gfm",...t}}),e),Qe=(0,s.JY)("strike_through");Ge(Qe,{displayName:"Attr<strikethrough>",group:"Strikethrough"});const Xe=(0,s.hk)("strike_through",(e=>({inclusive:!1,parseDOM:[{tag:"del"},{style:"text-decoration",getAttrs:e=>"line-through"===e}],toDOM:t=>["del",e.get(Qe.key)(t)],parseMarkdown:{match:e=>"delete"===e.type,runner:(e,t,n)=>{e.openMark(n),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"strike_through"===e.type.name,runner:(e,t)=>{e.withMark(t,"delete")}}})));Ge(Xe.mark,{displayName:"MarkSchema<strikethrough>",group:"Strikethrough"}),Ge(Xe.ctx,{displayName:"MarkSchemaCtx<strikethrough>",group:"Strikethrough"});const et=(0,s.yu)("ToggleStrikeThrough",(()=>()=>(0,d.wh)(Xe.type())));Ge(et,{displayName:"Command<ToggleStrikethrough>",group:"Strikethrough"});const tt=(0,s.pq)("strikeThroughKeymap",{ToggleStrikethrough:{shortcuts:"Mod-Alt-x",command:e=>{const t=e.get(a.MD);return()=>t.call(et.key)}}});Ge(tt.ctx,{displayName:"KeymapCtx<strikethrough>",group:"Strikethrough"}),Ge(tt.shortcuts,{displayName:"Keymap<strikethrough>",group:"Strikethrough"});const nt=(e=3,t=3)=>{const n=Array(t).fill(0).map((()=>wt.type().createAndFill())),r=Array(t).fill(0).map((()=>kt.type().createAndFill())),o=Array(e).fill(0).map(((e,t)=>vt.type().create(null,0===t?r:n)));return yt.type().create(null,o)},rt=e=>(0,u.KP)((e=>"table"===e.type.spec.tableRole))(e),ot=(e,t)=>{const n=rt(t);if(!n)return;const r=c.J3.get(n.node);return e<0||e>=r.width?void 0:r.cellsInRect({left:e,right:e+1,top:0,bottom:r.height}).map((e=>{const t=n.node.nodeAt(e);if(!t)return;const r=e+n.start;return{pos:r,start:r+1,node:t}})).filter((e=>null!=e))},it=(e,t)=>{const n=rt(t);if(!n)return;const r=c.J3.get(n.node);return e<0||e>=r.height?void 0:r.cellsInRect({left:0,right:r.width,top:e,bottom:e+1}).map((e=>{const t=n.node.nodeAt(e);if(!t)return;const r=e+n.start;return{pos:r,start:r+1,node:t}})).filter((e=>null!=e))};function st(e,{map:t,tableStart:n,table:r},o){const i=Array(o).fill(0).reduce(((e,t,n)=>e+r.child(n).nodeSize),n),s=Array(t.width).fill(0).map(((e,n)=>{const o=r.nodeAt(t.map[n]);return wt.type().createAndFill({alignment:null==o?void 0:o.attrs.alignment})}));return e.insert(i,vt.type().create(null,s)),e}const at=e=>t=>n=>{const r=rt(n.selection),o="row"===e;if(r){const e=c.J3.get(r.node);if(t>=0&&t<(o?e.height:e.width)){const i=e.positionAt(o?t:e.height-1,o?e.width-1:t,r.node),s=n.doc.resolve(r.start+i),a=o?c.rn.rowSelection:c.rn.colSelection,l=e.positionAt(o?t:0,o?0:t,r.node),d=n.doc.resolve(r.start+l);return(0,u.I9)(n.setSelection(a(s,d)))}}return n},lt=at("row"),ct=at("col"),ut=e=>e[0].map(((t,n)=>e.map((e=>e[n])))),dt=(e,t)=>{const n=[],r=c.J3.get(e);for(let o=0;o<r.height;o++){const i=e.child(o),s=[];for(let n=0;n<r.width;n++){if(!t[o][n])continue;const i=r.map[o*r.width+n],a=t[o][n],l=e.nodeAt(i).type.createChecked(Object.assign({},a.attrs),a.content,a.marks);s.push(l)}n.push(i.type.createChecked(i.attrs,s,i.marks))}return e.type.createChecked(e.attrs,n,e.marks)},ht=e=>{const t=c.J3.get(e),n=[];for(let r=0;r<t.height;r++){const o=[],i={};for(let n=0;n<t.width;n++){const s=t.map[r*t.width+n],a=e.nodeAt(s),l=t.findCell(s);i[s]||l.top!==r?o.push(null):(i[s]=!0,o.push(a))}n.push(o)}return n},pt=(e,t,n,r)=>{const o=t[0]>n[0]?-1:1,i=e.splice(t[0],t.length),s=i.length%2==0?1:0;let a;return a=-1===r&&1===o?n[0]-1:1===r&&-1===o?n[n.length-1]-s+1:-1===o?n[0]:n[n.length-1]-s,e.splice(a,0,...i),e},ft=(e,t)=>{let n=e,r=e;for(let o=e;o>=0;o--){const e=ot(o,t.selection);e&&e.forEach((e=>{const t=e.node.attrs.colspan+o-1;t>=n&&(n=o),t>r&&(r=t)}))}for(let n=e;n<=r;n++){const e=ot(n,t.selection);e&&e.forEach((e=>{const t=e.node.attrs.colspan+n-1;e.node.attrs.colspan>1&&t>r&&(r=t)}))}const o=[];for(let e=n;e<=r;e++){const n=ot(e,t.selection);n&&n.length&&o.push(e)}n=o[0],r=o[o.length-1];const i=ot(n,t.selection),s=it(0,t.selection),a=t.doc.resolve(i[i.length-1].pos);let l;for(let e=r;e>=n;e--){const n=ot(e,t.selection);if(n&&n.length){for(let e=s.length-1;e>=0;e--)if(s[e].pos===n[0].pos){l=n[0];break}if(l)break}}return{$anchor:a,$head:t.doc.resolve(l.pos),indexes:o}},mt=(e,t)=>{let n=e,r=e;for(let o=e;o>=0;o--)it(o,t.selection).forEach((e=>{const t=e.node.attrs.rowspan+o-1;t>=n&&(n=o),t>r&&(r=t)}));for(let n=e;n<=r;n++)it(n,t.selection).forEach((e=>{const t=e.node.attrs.rowspan+n-1;e.node.attrs.rowspan>1&&t>r&&(r=t)}));const o=[];for(let e=n;e<=r;e++){const n=it(e,t.selection);n&&n.length&&o.push(e)}n=o[0],r=o[o.length-1];const i=it(n,t.selection),s=ot(0,t.selection),a=t.doc.resolve(i[i.length-1].pos);let l;for(let e=r;e>=n;e--){const n=it(e,t.selection);if(n&&n.length){for(let e=s.length-1;e>=0;e--)if(s[e].pos===n[0].pos){l=n[0];break}if(l)break}}return{$anchor:a,$head:t.doc.resolve(l.pos),indexes:o}};const gt=(0,c.of)({tableGroup:"block",cellContent:"paragraph",cellAttributes:{alignment:{default:"left",getFromDOM:e=>e.style.textAlign||"left",setDOMAttr:(e,t)=>{t.style=`text-align: ${e||"left"}`}}}}),yt=(0,s.Yh)("table",(()=>({...gt.table,parseMarkdown:{match:e=>"table"===e.type,runner:(e,t,n)=>{const r=t.align,o=t.children.map(((e,t)=>({...e,align:r,isHeader:0===t})));e.openNode(n),e.next(o),e.closeNode()}},toMarkdown:{match:e=>"table"===e.type.name,runner:(e,t)=>{var n;const r=null==(n=t.content.firstChild)?void 0:n.content;if(!r)return;const o=[];r.forEach((e=>{o.push(e.attrs.alignment)})),e.openNode("table",void 0,{align:o}),e.next(t.content),e.closeNode()}}})));Ge(yt.node,{displayName:"NodeSchema<table>",group:"Table"}),Ge(yt.ctx,{displayName:"NodeSchemaCtx<table>",group:"Table"});const vt=(0,s.Yh)("table_row",(()=>({...gt.table_row,parseMarkdown:{match:e=>"tableRow"===e.type,runner:(e,t,n)=>{const r=t.align,o=t.children.map(((e,n)=>({...e,align:r[n],isHeader:t.isHeader})));e.openNode(n),e.next(o),e.closeNode()}},toMarkdown:{match:e=>"table_row"===e.type.name,runner:(e,t)=>{e.openNode("tableRow"),e.next(t.content),e.closeNode()}}})));Ge(vt.node,{displayName:"NodeSchema<tableRow>",group:"Table"}),Ge(vt.ctx,{displayName:"NodeSchemaCtx<tableRow>",group:"Table"});const wt=(0,s.Yh)("table_cell",(()=>({...gt.table_cell,parseMarkdown:{match:e=>"tableCell"===e.type&&!e.isHeader,runner:(e,t,n)=>{const r=t.align;e.openNode(n,{alignment:r}).openNode(e.schema.nodes.paragraph).next(t.children).closeNode().closeNode()}},toMarkdown:{match:e=>"table_cell"===e.type.name,runner:(e,t)=>{e.openNode("tableCell").next(t.content).closeNode()}}})));Ge(wt.node,{displayName:"NodeSchema<tableCell>",group:"Table"}),Ge(wt.ctx,{displayName:"NodeSchemaCtx<tableCell>",group:"Table"});const kt=(0,s.Yh)("table_header",(()=>({...gt.table_header,parseMarkdown:{match:e=>"tableCell"===e.type&&!!e.isHeader,runner:(e,t,n)=>{const r=t.align;e.openNode(n,{alignment:r}),e.openNode(e.schema.nodes.paragraph),e.next(t.children),e.closeNode(),e.closeNode()}},toMarkdown:{match:e=>"table_header"===e.type.name,runner:(e,t)=>{e.openNode("tableCell"),e.next(t.content),e.closeNode()}}})));Ge(kt.node,{displayName:"NodeSchema<tableHeader>",group:"Table"}),Ge(kt.ctx,{displayName:"NodeSchemaCtx<tableHeader>",group:"Table"});const bt=(0,s.b_)((()=>new i.fV(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,((e,t,n,r)=>{var o,i;const s=e.doc.resolve(n);if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),yt.type()))return null;const a=nt(Number(null==(o=t.groups)?void 0:o.row),Number(null==(i=t.groups)?void 0:i.col)),c=e.tr.replaceRangeWith(n,r,a).scrollIntoView();return c.setSelection(l.U3.create(c.doc,n+3))}))));Ge(bt,{displayName:"InputRule<insertTableInputRule>",group:"Table"});const xt=(0,s.yu)("GoToPrevTableCell",(()=>()=>(0,c.D8)(-1)));Ge(xt,{displayName:"Command<goToPrevTableCellCommand>",group:"Table"});const Ct=(0,s.yu)("GoToNextTableCell",(()=>()=>(0,c.D8)(1)));Ge(Ct,{displayName:"Command<goToNextTableCellCommand>",group:"Table"});const St=(0,s.yu)("BreakTable",(()=>()=>(e,t)=>{if(!(0,c.aH)(e))return!1;const{$head:n}=e.selection,r=n.after(),i=e.tr.replaceWith(r,r,o.Wf.type().createAndFill());return i.setSelection(l.LN.near(i.doc.resolve(r),1)).scrollIntoView(),null==t||t(i),!0}));Ge(St,{displayName:"Command<breakTableCommand>",group:"Table"});const Mt=(0,s.yu)("InsertTable",(()=>({row:e,col:t}={})=>(n,r)=>{const{selection:o,tr:i}=n,{from:s}=o,a=nt(e,t),c=i.replaceSelectionWith(a),u=l.LN.findFrom(c.doc.resolve(s),1,!0);return u&&(null==r||r(c.setSelection(u))),!0}));Ge(Mt,{displayName:"Command<insertTableCommand>",group:"Table"});const Nt=(0,s.yu)("MoveRow",(()=>({from:e,to:t}={})=>(n,r)=>{const{tr:o}=n,i=null==r?void 0:r(function(e,t,n,r=!0){const o=rt(e.selection);if(!o)return e;const{indexes:i}=mt(t,e),{indexes:s}=mt(n,e);if(i.includes(n))return e;const a=((e,t,n)=>{let r=ht(e.node);return r=pt(r,t,n,0),dt(e.node,r)})(o,i,s),l=(0,u.I9)(e).replaceWith(o.pos,o.pos+o.node.nodeSize,a);if(!r)return l;const d=c.J3.get(a),h=o.start,p=n,f=d.positionAt(p,d.width-1,a),m=l.doc.resolve(h+f),g=c.rn.rowSelection,y=d.positionAt(p,0,a),v=l.doc.resolve(h+y);return l.setSelection(g(m,v))}(o,e??0,t??0,!0));return Boolean(i)}));Ge(Nt,{displayName:"Command<moveRowCommand>",group:"Table"});const Ot=(0,s.yu)("MoveCol",(()=>({from:e,to:t}={})=>(n,r)=>{const{tr:o}=n,i=null==r?void 0:r(function(e,t,n,r=!0){const o=rt(e.selection);if(!o)return e;const{indexes:i}=ft(t,e),{indexes:s}=ft(n,e);if(i.includes(n))return e;const a=((e,t,n)=>{let r=ut(ht(e.node));return r=pt(r,t,n,0),r=ut(r),dt(e.node,r)})(o,i,s),l=(0,u.I9)(e).replaceWith(o.pos,o.pos+o.node.nodeSize,a);if(!r)return l;const d=c.J3.get(a),h=o.start,p=n,f=d.positionAt(d.height-1,p,a),m=l.doc.resolve(h+f),g=c.rn.colSelection,y=d.positionAt(0,p,a),v=l.doc.resolve(h+y);return l.setSelection(g(m,v))}(o,e??0,t??0,!0));return Boolean(i)}));Ge(Ot,{displayName:"Command<moveColCommand>",group:"Table"});const At=(0,s.yu)("SelectRow",(()=>(e=0)=>(t,n)=>{const{tr:r}=t,o=null==n?void 0:n(lt(e)(r));return Boolean(o)}));Ge(At,{displayName:"Command<selectRowCommand>",group:"Table"});const Et=(0,s.yu)("SelectCol",(()=>(e=0)=>(t,n)=>{const{tr:r}=t,o=null==n?void 0:n(ct(e)(r));return Boolean(o)}));Ge(Et,{displayName:"Command<selectColCommand>",group:"Table"});const Dt=(0,s.yu)("SelectTable",(()=>()=>(e,t)=>{const{tr:n}=e,r=null==t?void 0:t((e=>{const t=(e=>{const t=rt(e);if(!t)return;const n=c.J3.get(t.node);return n.cellsInRect({left:0,right:n.width,top:0,bottom:n.height}).map((e=>{const n=t.node.nodeAt(e),r=e+t.start;return{pos:r,start:r+1,node:n}}))})(e.selection);if(t&&t[0]){const n=e.doc.resolve(t[0].pos),r=t[t.length-1];if(r){const t=e.doc.resolve(r.pos);return(0,u.I9)(e.setSelection(new c.rn(t,n)))}}return e})(n));return Boolean(r)}));Ge(Dt,{displayName:"Command<selectTableCommand>",group:"Table"});const Tt=(0,s.yu)("DeleteSelectedCells",(()=>()=>(e,t)=>{const{selection:n}=e;if(!(n instanceof c.rn))return!1;const r=n.isRowSelection(),o=n.isColSelection();return r&&o?(0,c.kG)(e,t):o?(0,c.gR)(e,t):(0,c.aR)(e,t)}));Ge(Tt,{displayName:"Command<deleteSelectedCellsCommand>",group:"Table"});const Ft=(0,s.yu)("AddColBefore",(()=>()=>c.RC));Ge(Ft,{displayName:"Command<addColBeforeCommand>",group:"Table"});const It=(0,s.yu)("AddColAfter",(()=>()=>c.GU));Ge(It,{displayName:"Command<addColAfterCommand>",group:"Table"});const Rt=(0,s.yu)("AddRowBefore",(()=>()=>(e,t)=>{if(!(0,c.aH)(e))return!1;if(t){const n=(0,c._t)(e);t(st(e.tr,n,n.top))}return!0}));Ge(Rt,{displayName:"Command<addRowBeforeCommand>",group:"Table"});const Pt=(0,s.yu)("AddRowAfter",(()=>()=>(e,t)=>{if(!(0,c.aH)(e))return!1;if(t){const n=(0,c._t)(e);t(st(e.tr,n,n.bottom))}return!0}));Ge(Pt,{displayName:"Command<addRowAfterCommand>",group:"Table"});const Bt=(0,s.yu)("SetAlign",(()=>(e="left")=>(0,c.i4)("alignment",e)));Ge(Bt,{displayName:"Command<setAlignCommand>",group:"Table"});const Lt=(0,s.pq)("tableKeymap",{NextCell:{shortcuts:["Mod-]","Tab"],command:e=>{const t=e.get(a.MD);return()=>t.call(Ct.key)}},PrevCell:{shortcuts:["Mod-[","Shift-Tab"],command:e=>{const t=e.get(a.MD);return()=>t.call(xt.key)}},ExitTable:{shortcuts:["Mod-Enter"],command:e=>{const t=e.get(a.MD);return()=>t.call(St.key)}}});Ge(Lt.ctx,{displayName:"KeymapCtx<table>",group:"Table"}),Ge(Lt.shortcuts,{displayName:"Keymap<table>",group:"Table"});const zt="footnote_definition",$t="footnoteDefinition",jt=(0,s.Yh)("footnote_definition",(()=>({group:"block",content:"block+",defining:!0,attrs:{label:{default:""}},parseDOM:[{tag:`dl[data-type="${zt}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw(0,r.Ik)(e);return{label:e.dataset.label}},contentElement:"dd"}],toDOM:e=>{const t=e.attrs.label;return["dl",{"data-label":t,"data-type":zt},["dt",t],["dd",0]]},parseMarkdown:{match:({type:e})=>e===$t,runner:(e,t,n)=>{e.openNode(n,{label:t.label}).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name===zt,runner:(e,t)=>{e.openNode($t,void 0,{label:t.attrs.label,identifier:t.attrs.label}).next(t.content).closeNode()}}})));Ge(jt.ctx,{displayName:"NodeSchemaCtx<footnodeDef>",group:"footnote"}),Ge(jt.node,{displayName:"NodeSchema<footnodeDef>",group:"footnote"});const _t="footnote_reference",Vt=(0,s.Yh)("footnote_reference",(()=>({group:"inline",inline:!0,atom:!0,attrs:{label:{default:""}},parseDOM:[{tag:`sup[data-type="${_t}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw(0,r.Ik)(e);return{label:e.dataset.label}}}],toDOM:e=>{const t=e.attrs.label;return["sup",{"data-label":t,"data-type":_t},t]},parseMarkdown:{match:({type:e})=>"footnoteReference"===e,runner:(e,t,n)=>{e.addNode(n,{label:t.label})}},toMarkdown:{match:e=>e.type.name===_t,runner:(e,t)=>{e.addNode("footnoteReference",void 0,void 0,{label:t.attrs.label,identifier:t.attrs.label})}}})));Ge(Vt.ctx,{displayName:"NodeSchemaCtx<footnodeRef>",group:"footnote"}),Ge(Vt.node,{displayName:"NodeSchema<footnodeRef>",group:"footnote"});const Wt=o.hm.extendSchema((e=>t=>{const n=e(t);return{...n,attrs:{...n.attrs,checked:{default:null}},parseDOM:[{tag:'li[data-item-type="task"]',getAttrs:e=>{if(!(e instanceof HTMLElement))throw(0,r.Ik)(e);return{label:e.dataset.label,listType:e.dataset["list-type"],spread:e.dataset.spread,checked:e.dataset.checked?"true"===e.dataset.checked:null}}},...(null==n?void 0:n.parseDOM)||[]],toDOM:e=>n.toDOM&&null==e.attrs.checked?n.toDOM(e):["li",{"data-item-type":"task","data-label":e.attrs.label,"data-list-type":e.attrs.listType,"data-spread":e.attrs.spread,"data-checked":e.attrs.checked},0],parseMarkdown:{match:({type:e})=>"listItem"===e,runner:(e,t,r)=>{if(null==t.checked)return void n.parseMarkdown.runner(e,t,r);const o=null!=t.label?`${t.label}.`:"•",i=null!=t.checked?Boolean(t.checked):null,s=null!=t.label?"ordered":"bullet",a=null!=t.spread?`${t.spread}`:"true";e.openNode(r,{label:o,listType:s,spread:a,checked:i}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>"list_item"===e.type.name,runner:(e,t)=>{if(null==t.attrs.checked)return void n.toMarkdown.runner(e,t);const r=t.attrs.label,o=t.attrs.listType,i="true"===t.attrs.spread,s=t.attrs.checked;e.openNode("listItem",void 0,{label:r,listType:o,spread:i,checked:s}),e.next(t.content),e.closeNode()}}}}));Ge(Wt,{displayName:"NodeSchema<listItem>",group:"ListItem"});const Ht=(0,s.b_)((()=>new i.fV(/^\[(?<checked>\s|x)\]\s$/,((e,t,n,r)=>{var o;const i=e.doc.resolve(n);let s=0,a=i.node(s);for(;a&&"list_item"!==a.type.name;)s--,a=i.node(s);if(!a||null!=a.attrs.checked)return null;const l=Boolean("x"===(null==(o=t.groups)?void 0:o.checked)),c=i.before(s),u=e.tr;return u.deleteRange(n,r).setNodeMarkup(c,void 0,{...a.attrs,checked:l}),u}))));Ge(Ht,{displayName:"InputRule<wrapInTaskListInputRule>",group:"ListItem"});const Kt=[tt,Lt].flat(),Jt=[bt,Ht],qt=(0,s.Gf)((()=>{const e=new l.hs("MILKDOWN_AUTO_INSERT_ZERO_SPACE"),t=e=>e.type===o.Wf.type();return new l.k_({key:e,props:{handleDOMEvents:{compositionstart(e){const{state:n,dispatch:r}=e,{tr:o,selection:i}=n,{$from:s}=i;return u.T.safari&&(0,c.aH)(n)&&i.empty&&(e=>t(e)&&2===e.nodeSize)(s.parent)&&r(o.insertText("",s.start())),!1},compositionend(e){const{state:n,dispatch:r}=e,{tr:o,selection:i}=n,{$from:s}=i;return u.T.safari&&(0,c.aH)(n)&&i.empty&&t(s.parent)&&s.parent.textContent.startsWith("")&&r(o.delete(s.start(),s.start()+1)),!1}}}})}));Ge(qt,{displayName:"Prose<autoInsertZeroSpaceInTablePlugin>",group:"Prose"});const Ut=(0,s.Gf)((()=>(0,c.AL)({})));Ge(Ut,{displayName:"Prose<columnResizingPlugin>",group:"Prose"});const Yt=(0,s.Gf)((()=>(0,c.LF)()));Ge(Yt,{displayName:"Prose<tableEditingPlugin>",group:"Prose"});const Zt=(0,s.lz)((()=>Ze));Ge(Zt,{displayName:"Remark<remarkGFMPlugin>",group:"Remark"});const Gt=[qt,Ut,Yt,Zt],Qt=[[Wt,yt,vt,kt,wt,jt,Vt,Qe,Xe].flat(),Jt,Kt,Gt,[Ct,xt,St,Mt,Nt,Ot,At,Et,Dt,Tt,Rt,Pt,Ft,It,Bt,et]].flat()},660:(e,t,n)=>{"use strict";n.d(t,{y:()=>i});var r=n(3890);const o={}.hasOwnProperty;function i(e){const t={};let n=-1;for(;++n<e.length;)s(t,e[n]);return t}function s(e,t){let n;for(n in t){const r=(o.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;for(s in i){o.call(r,s)||(r[s]=[]);const e=i[s];a(r[s],Array.isArray(e)?e:e?[e]:[])}}}function a(e,t){let n=-1;const o=[];for(;++n<t.length;)("after"===t[n].add?e:o).push(t[n]);(0,r.m)(e,0,0,o)}},1329:(e,t,n)=>{"use strict";n.d(t,{$L:()=>O,Ln:()=>y,Um:()=>N,Wg:()=>v,X9:()=>l,XE:()=>p,dL:()=>j,jP:()=>b,n9:()=>M,oM:()=>x,zy:()=>S});var r=n(6090);const o=Math.pow(2,16);function i(e){return 65535&e}class s{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class a{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&a.empty)return a.empty}recover(e){let t=0,n=i(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/o}(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?r:0);if(c>e)break;let u=this.ranges[l+i],d=this.ranges[l+a],h=c+u;if(e<=h){let i=c+r+((u?e==c?-1:e==h?1:t:t)<0?0:d);if(n)return i;let a=e==c?2:e==h?1:4;return(t<0?e!=c:e!=h)&&(a|=8),new s(i,a,e==(t<0?c:h)?null:l/3+(e-c)*o)}r+=d-u}return n?e+r:new s(e+r,0,null)}touches(e,t){let n=0,r=i(t),o=this.inverted?2:1,s=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let i=this.ranges[t]-(this.inverted?n:0);if(i>e)break;let a=this.ranges[t+o];if(e<=i+a&&t==3*r)return!0;n+=this.ranges[t+s]-a}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,o=0;r<this.ranges.length;r+=3){let i=this.ranges[r],s=i-(this.inverted?o:0),a=i+(this.inverted?0:o),l=this.ranges[r+t],c=this.ranges[r+n];e(s,s+l,a,a+c),o+=c-l}}invert(){return new a(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?a.empty:new a(e<0?[0,-e,0]:[0,0,e])}}a.empty=new a([]);class l{constructor(e=[],t,n=0,r=e.length){this.maps=e,this.mirror=t,this.from=n,this.to=r}slice(e=0,t=this.maps.length){return new l(this.maps,this.mirror,e,t)}copy(){return new l(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),null!=t&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,n=this.maps.length;t<e.maps.length;t++){let r=e.getMirror(t);this.appendMap(e.maps[t],null!=r&&r<t?n+r: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,n=this.maps.length+e.maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e.maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new l;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this.maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let o=this.maps[n].mapResult(e,t);if(null!=o.recover){let t=this.getMirror(n);if(null!=t&&t>n&&t<this.to){n=t,e=this.maps[t].recover(o.recover);continue}}r|=o.delInfo,e=o.pos}return n?e:new s(e,r,null)}}const c=Object.create(null);class u{getMap(){return a.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=c[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in c)throw new RangeError("Duplicate use of step JSON ID "+e);return c[e]=t,t.prototype.jsonID=e,t}}class d{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new d(e,null)}static fail(e){return new d(null,e)}static fromReplace(e,t,n,o){try{return d.ok(e.replace(t,n,o))}catch(e){if(e instanceof r.vI)return d.fail(e.message);throw e}}}function h(e,t,n){let o=[];for(let r=0;r<e.childCount;r++){let i=e.child(r);i.content.size&&(i=i.copy(h(i.content,t,i))),i.isInline&&(i=t(i,n,r)),o.push(i)}return r.FK.fromArray(o)}class p extends u{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),o=n.node(n.sharedDepth(this.to)),i=new r.Ji(h(t.content,((e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e),o),t.openStart,t.openEnd);return d.fromReplace(e,this.from,this.to,i)}invert(){return new f(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new p(t.pos,n.pos,this.mark)}merge(e){return e instanceof p&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new p(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("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new p(t.from,t.to,e.markFromJSON(t.mark))}}u.jsonID("addMark",p);class f extends u{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new r.Ji(h(t.content,(e=>e.mark(this.mark.removeFromSet(e.marks))),e),t.openStart,t.openEnd);return d.fromReplace(e,this.from,this.to,n)}invert(){return new p(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new f(t.pos,n.pos,this.mark)}merge(e){return e instanceof f&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new f(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("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new f(t.from,t.to,e.markFromJSON(t.mark))}}u.jsonID("removeMark",f);class m extends u{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return d.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return d.fromReplace(e,this.pos,this.pos+1,new r.Ji(r.FK.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new m(this.pos,t.marks[n]);return new m(this.pos,this.mark)}}return new g(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new m(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new m(t.pos,e.markFromJSON(t.mark))}}u.jsonID("addNodeMark",m);class g extends u{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return d.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return d.fromReplace(e,this.pos,this.pos+1,new r.Ji(r.FK.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new m(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new g(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new g(t.pos,e.markFromJSON(t.mark))}}u.jsonID("removeNodeMark",g);class y extends u{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&w(e,this.from,this.to)?d.fail("Structure replace would overwrite content"):d.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new a([this.from,this.to-this.from,this.slice.size])}invert(e){return new y(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new y(t.pos,Math.max(t.pos,n.pos),this.slice)}merge(e){if(!(e instanceof y)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;{let t=this.slice.size+e.slice.size==0?r.Ji.empty:new r.Ji(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new y(e.from,this.to,t,this.structure)}}{let t=this.slice.size+e.slice.size==0?r.Ji.empty:new r.Ji(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new y(this.from,this.to+(e.to-e.from),t,this.structure)}}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("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new y(t.from,t.to,r.Ji.fromJSON(e,t.slice),!!t.structure)}}u.jsonID("replace",y);class v extends u{constructor(e,t,n,r,o,i,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=o,this.insert=i,this.structure=s}apply(e){if(this.structure&&(w(e,this.from,this.gapFrom)||w(e,this.gapTo,this.to)))return d.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return d.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?d.fromReplace(e,this.from,this.to,n):d.fail("Content does not fit in gap")}getMap(){return new a([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 v(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),n=e.mapResult(this.to,-1),r=e.map(this.gapFrom,-1),o=e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||o>n.pos?null:new v(t.pos,n.pos,r,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new v(t.from,t.to,t.gapFrom,t.gapTo,r.Ji.fromJSON(e,t.slice),t.insert,!!t.structure)}}function w(e,t,n){let r=e.resolve(t),o=n-t,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let e=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,o--}}return!1}function k(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function b(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth;;--n){let r=e.$from.node(n),o=e.$from.index(n),i=e.$to.indexAfter(n);if(n<e.depth&&r.canReplace(o,i,t))return n;if(0==n||r.type.spec.isolating||!k(r,o,i))break}return null}function x(e,t,n=null,r=e){let o=function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.contentMatchAt(r).findWrapping(t);if(!i)return null;let s=i.length?i[0]:t;return n.canReplaceWith(r,o,s)?i:null}(e,t),i=o&&function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.child(r),s=t.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:t).contentMatch;for(let e=r;a&&e<o;e++)a=a.matchType(n.child(e).type);return a&&a.validEnd?s:null}(r,t);return i?o.map(C).concat({type:t,attrs:n}).concat(i.map(C)):null}function C(e){return{type:e,attrs:null}}function S(e,t,n=1,r){let o=e.resolve(t),i=o.depth-n,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 e=o.depth-1,t=n-2;e>i;e--,t--){let n=o.node(e),i=o.index(e);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(i,n.childCount),a=r&&r[t]||n;if(a!=n&&(s=s.replaceChild(0,a.type.create(a.attrs))),!n.canReplace(i+1,n.childCount)||!a.type.validContent(s))return!1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function M(e,t){let n=e.resolve(t),r=n.index();return o=n.nodeBefore,i=n.nodeAfter,!(!o||!i||o.isLeaf||!o.canAppend(i))&&n.parent.canReplace(r,r+1);var o,i}function N(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let o=n.content;for(let e=0;e<n.openStart;e++)o=o.firstChild.content;for(let e=1;e<=(0==n.openStart&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,i=r.index(t)+(n>0?1:0),s=r.node(t),a=!1;if(1==e)a=s.canReplace(i,i,o);else{let e=s.contentMatchAt(i).findWrapping(o.firstChild.type);a=e&&s.canReplaceWith(i,i,e[0])}if(a)return 0==n?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function O(e,t,n=t,o=r.Ji.empty){if(t==n&&!o.size)return null;let i=e.resolve(t),s=e.resolve(n);return A(i,s,o)?new y(t,n,o):new E(i,s,o).fit()}function A(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}u.jsonID("replaceAround",v);class E{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=r.FK.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=r.FK.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,o=this.close(e<0?this.$to:n.doc.resolve(e));if(!o)return null;let i=this.placed,s=n.depth,a=o.depth;for(;s&&a&&1==i.childCount;)i=i.firstChild.content,s--,a--;let l=new r.Ji(i,s,a);return e>-1?new v(n.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||n.pos!=this.$to.pos?new y(n.pos,o.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let o=t.firstChild;if(t.childCount>1&&(r=0),o.type.spec.isolating&&r<=n){e=n;break}t=o.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e,o=null;n?(o=F(this.unplaced.content,n-1).firstChild,e=o.content):e=this.unplaced.content;let i=e.firstChild;for(let e=this.depth;e>=0;e--){let s,{type:a,match:l}=this.frontier[e],c=null;if(1==t&&(i?l.matchType(i.type)||(c=l.fillBefore(r.FK.from(i),!1)):o&&a.compatibleContent(o.type)))return{sliceDepth:n,frontierDepth:e,parent:o,inject:c};if(2==t&&i&&(s=l.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:e,parent:o,wrap:s};if(o&&l.matchType(o.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,o=F(e,t);return!(!o.childCount||o.firstChild.isLeaf||(this.unplaced=new r.Ji(e,t+1,Math.max(n,o.size+t>=e.size-n?t+1:0)),0))}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,o=F(e,t);if(o.childCount<=1&&t>0){let i=e.size-t<=t+o.size;this.unplaced=new r.Ji(D(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new r.Ji(D(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:o,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let s=this.unplaced,a=n?n.content:s.content,l=s.openStart-e,c=0,u=[],{match:d,type:h}=this.frontier[t];if(o){for(let e=0;e<o.childCount;e++)u.push(o.child(e));d=d.matchFragment(o)}let p=a.size+e-(s.content.size-s.openEnd);for(;c<a.childCount;){let e=a.child(c),t=d.matchType(e.type);if(!t)break;c++,(c>1||0==l||e.content.size)&&(d=t,u.push(I(e.mark(h.allowedMarks(e.marks)),1==c?l:0,c==a.childCount?p:-1)))}let f=c==a.childCount;f||(p=-1),this.placed=T(this.placed,t,r.FK.from(u)),this.frontier[t].match=d,f&&p<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=a;e<p;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=f?0==e?r.Ji.empty:new r.Ji(D(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new r.Ji(D(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,t=this.frontier[this.depth];if(!t.type.isTextblock||!R(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),i=R(e,t,r,n,o);if(i){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],o=R(e,n,r,t,!0);if(!o||o.childCount)continue e}return{depth:t,fit:i,move:o?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=T(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=T(this.placed,this.depth,r.FK.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(r.FK.empty,!0);e.childCount&&(this.placed=T(this.placed,this.frontier.length,e))}}function D(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(D(e.firstChild.content,t-1,n)))}function T(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(T(e.lastChild.content,t-1,n)))}function F(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function I(e,t,n){if(t<=0)return e;let o=e.content;return t>1&&(o=o.replaceChild(0,I(o.firstChild,t-1,1==o.childCount?n-1:0))),t>0&&(o=e.type.contentMatch.fillBefore(o).append(o),n<=0&&(o=o.append(e.type.contentMatch.matchFragment(o).fillBefore(r.FK.empty,!0)))),e.copy(o)}function R(e,t,n,r,o){let i=e.node(t),s=o?e.indexAfter(t):e.index(t);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,i.content,s)?a:null}function P(e){return e.spec.defining||e.spec.definingForContent}function B(e,t,n,o,i){if(t<n){let r=e.firstChild;e=e.replaceChild(0,r.copy(B(r.content,t+1,n,o,r)))}if(t>o){let t=i.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(r.FK.empty,!0))}return e}function L(e,t){let n=[];for(let r=Math.min(e.depth,t.depth);r>=0;r--){let o=e.start(r);if(o<e.pos-(e.depth-r)||t.end(r)>t.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(o==t.start(r)||r==e.depth&&r==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==o-1)&&n.push(r)}return n}class z extends u{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return d.fail("No node at attribute step's position");let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let o=t.type.create(n,null,t.marks);return d.fromReplace(e,this.pos,this.pos+1,new r.Ji(r.FK.from(o),0,t.isLeaf?0:1))}getMap(){return a.empty}invert(e){return new z(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 z(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new z(t.pos,t.attr,t.value)}}u.jsonID("attr",z);let $=class extends Error{};$=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},($.prototype=Object.create(Error.prototype)).constructor=$,$.prototype.name="TransformError";class j{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new l}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new $(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,n=r.Ji.empty){let o=O(this.doc,e,t,n);return o&&this.step(o),this}replaceWith(e,t,n){return this.replace(e,t,new r.Ji(r.FK.from(n),0,0))}delete(e,t){return this.replace(e,t,r.Ji.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return function(e,t,n,o){if(!o.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),s=e.doc.resolve(n);if(A(i,s,o))return e.step(new y(t,n,o));let a=L(i,e.doc.resolve(n));0==a[a.length-1]&&a.pop();let l=-(i.depth+1);a.unshift(l);for(let e=i.depth,t=i.pos-1;e>0;e--,t--){let n=i.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;a.indexOf(e)>-1?l=e:i.before(e)==t&&a.splice(1,0,-e)}let c=a.indexOf(l),u=[],d=o.openStart;for(let e=o.content,t=0;;t++){let n=e.firstChild;if(u.push(n),t==o.openStart)break;e=n.content}for(let e=d-1;e>=0;e--){let t=u[e].type,n=P(t);if(n&&i.node(c).type!=t)d=e;else if(n||!t.isTextblock)break}for(let t=o.openStart;t>=0;t--){let l=(t+d+1)%(o.openStart+1),h=u[l];if(h)for(let t=0;t<a.length;t++){let u=a[(t+c)%a.length],d=!0;u<0&&(d=!1,u=-u);let p=i.node(u-1),f=i.index(u-1);if(p.canReplaceWith(f,f,h.type,h.marks))return e.replace(i.before(u),d?s.after(u):n,new r.Ji(B(o.content,0,o.openStart,l),l,o.openEnd))}}let h=e.steps.length;for(let r=a.length-1;r>=0&&(e.replace(t,n,o),!(e.steps.length>h));r--){let e=a[r];e<0||(t=i.before(e),n=s.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){return function(e,t,n,o){if(!o.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let r=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)return null}return null}(e.doc,t,o.type);null!=r&&(t=n=r)}e.replaceRange(t,n,new r.Ji(r.FK.from(o),0,0))}(this,e,t,n),this}deleteRange(e,t){return function(e,t,n){let r=e.doc.resolve(t),o=e.doc.resolve(n),i=L(r,o);for(let t=0;t<i.length;t++){let n=i[t],s=t==i.length-1;if(s&&0==n||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),o.end(n));if(n>0&&(s||r.node(n-1).canReplace(r.index(n-1),o.indexAfter(n-1))))return e.delete(r.before(n),o.after(n))}for(let i=1;i<=r.depth&&i<=o.depth;i++)if(t-r.start(i)==r.depth-i&&n>r.end(i)&&o.end(i)-n!=o.depth-i)return e.delete(r.before(i),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return function(e,t,n){let{$from:o,$to:i,depth:s}=t,a=o.before(s+1),l=i.after(s+1),c=a,u=l,d=r.FK.empty,h=0;for(let e=s,t=!1;e>n;e--)t||o.index(e)>0?(t=!0,d=r.FK.from(o.node(e).copy(d)),h++):c--;let p=r.FK.empty,f=0;for(let e=s,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,p=r.FK.from(i.node(e).copy(p)),f++):u++;e.step(new v(c,u,a,l,new r.Ji(d.append(p),h,f),d.size-h,!0))}(this,e,t),this}join(e,t=1){return function(e,t,n){let o=new y(t-n,t+n,r.Ji.empty,!0);e.step(o)}(this,e,t),this}wrap(e,t){return function(e,t,n){let o=r.FK.empty;for(let e=n.length-1;e>=0;e--){if(o.size){let t=n[e].type.contentMatch.matchFragment(o);if(!t||!t.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=r.FK.from(n[e].type.create(n[e].attrs,o))}let i=t.start,s=t.end;e.step(new v(i,s,i,s,new r.Ji(o,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,o=null){return function(e,t,n,o,i){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=e.steps.length;e.doc.nodesBetween(t,n,((t,n)=>{if(t.isTextblock&&!t.hasMarkup(o,i)&&function(e,t,n){let r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(e.doc,e.mapping.slice(s).map(n),o)){e.clearIncompatible(e.mapping.slice(s).map(n,1),o);let a=e.mapping.slice(s),l=a.map(n,1),c=a.map(n+t.nodeSize,1);return e.step(new v(l,c,l+1,c-1,new r.Ji(r.FK.from(o.create(i,null,t.marks)),0,0),1,!0)),!1}}))}(this,e,t,n,o),this}setNodeMarkup(e,t,n=null,o){return function(e,t,n,o,i){let s=e.doc.nodeAt(t);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let a=n.create(o,null,i||s.marks);if(s.isLeaf)return e.replaceWith(t,t+s.nodeSize,a);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new v(t,t+s.nodeSize,t+1,t+s.nodeSize-1,new r.Ji(r.FK.from(a),0,0),1,!0))}(this,e,t,n,o),this}setNodeAttribute(e,t,n){return this.step(new z(e,t,n)),this}addNodeMark(e,t){return this.step(new m(e,t)),this}removeNodeMark(e,t){if(!(t instanceof r.CU)){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(!(t=t.isInSet(n.marks)))return this}return this.step(new g(e,t)),this}split(e,t=1,n){return function(e,t,n=1,o){let i=e.doc.resolve(t),s=r.FK.empty,a=r.FK.empty;for(let e=i.depth,t=i.depth-n,l=n-1;e>t;e--,l--){s=r.FK.from(i.node(e).copy(s));let t=o&&o[l];a=r.FK.from(t?t.type.create(t.attrs,a):i.node(e).copy(a))}e.step(new y(t,t,new r.Ji(s.append(a),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){return function(e,t,n,r){let o,i,s=[],a=[];e.doc.nodesBetween(t,n,((e,l,c)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&c.type.allowsMarkType(r.type)){let c=Math.max(l,t),d=Math.min(l+e.nodeSize,n),h=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(h)||(o&&o.to==c&&o.mark.eq(u[e])?o.to=d:s.push(o=new f(c,d,u[e])));i&&i.to==c?i.to=d:a.push(i=new p(c,d,r))}})),s.forEach((t=>e.step(t))),a.forEach((t=>e.step(t)))}(this,e,t,n),this}removeMark(e,t,n){return function(e,t,n,o){let i=[],s=0;e.doc.nodesBetween(t,n,((e,a)=>{if(!e.isInline)return;s++;let l=null;if(o instanceof r.sX){let t,n=e.marks;for(;t=o.isInSet(n);)(l||(l=[])).push(t),n=t.removeFromSet(n)}else o?o.isInSet(e.marks)&&(l=[o]):l=e.marks;if(l&&l.length){let r=Math.min(a+e.nodeSize,n);for(let e=0;e<l.length;e++){let n,o=l[e];for(let e=0;e<i.length;e++){let t=i[e];t.step==s-1&&o.eq(i[e].style)&&(n=t)}n?(n.to=r,n.step=s):i.push({style:o,from:Math.max(a,t),to:r,step:s})}}})),i.forEach((t=>e.step(new f(t.from,t.to,t.style))))}(this,e,t,n),this}clearIncompatible(e,t,n){return function(e,t,n,o=n.contentMatch){let i=e.doc.nodeAt(t),s=[],a=t+1;for(let t=0;t<i.childCount;t++){let l=i.child(t),c=a+l.nodeSize,u=o.matchType(l.type);if(u){o=u;for(let t=0;t<l.marks.length;t++)n.allowsMarkType(l.marks[t].type)||e.step(new f(a,c,l.marks[t]))}else s.push(new y(a,c,r.Ji.empty));a=c}if(!o.validEnd){let t=o.fillBefore(r.FK.empty,!0);e.replace(a,a,new r.Ji(t,0,0))}for(let t=s.length-1;t>=0;t--)e.step(s[t])}(this,e,t,n),this}}},1408:(e,t,n)=>{"use strict";function r(e,t,n,r,o,i,s){try{var a=e[i](s),l=a.value}catch(e){return void n(e)}a.done?t(l):Promise.resolve(l).then(r,o)}n.d(t,{i:()=>i});var o=n(1361),i=function(){var e,t=(e=function*(e,t,n){var r=new FormData,i=function*(){if(Array.isArray(a)){var e="".concat(s,"[]");a.forEach((t=>{r.append(e,t)}))}else r.append(s,a)};for(var[s,a]of Object.entries(t))yield*i();return(yield o.http.put("api/gateway/object_store.object_store.PutObject/api/v1/objectStore/bucket/".concat(e,"/object"),r,n)).data},function(){var t=this,n=arguments;return new Promise((function(o,i){var s=e.apply(t,n);function a(e){r(s,o,i,a,l,"next",e)}function l(e){r(s,o,i,a,l,"throw",e)}a(void 0)}))});return function(e,n,r){return t.apply(this,arguments)}}()},1440:(e,t,n)=>{"use strict";n.d(t,{$D:()=>h,Ik:()=>g,TR:()=>p,XM:()=>c,Xm:()=>f,_K:()=>m,dI:()=>d,j7:()=>l,nr:()=>u,pj:()=>v,sm:()=>w,zD:()=>y});var r=Object.defineProperty,o=(e=>(e.docTypeError="docTypeError",e.contextNotFound="contextNotFound",e.timerNotFound="timerNotFound",e.ctxCallOutOfScope="ctxCallOutOfScope",e.createNodeInParserFail="createNodeInParserFail",e.stackOverFlow="stackOverFlow",e.parserMatchError="parserMatchError",e.serializerMatchError="serializerMatchError",e.getAtomFromSchemaFail="getAtomFromSchemaFail",e.expectDomTypeError="expectDomTypeError",e.callCommandBeforeEditorView="callCommandBeforeEditorView",e.missingRootElement="missingRootElement",e.missingNodeInSchema="missingNodeInSchema",e.missingMarkInSchema="missingMarkInSchema",e.ctxNotBind="ctxNotBind",e.missingYjsDoc="missingYjsDoc",e))(o||{});class i extends Error{constructor(e,t){super(t),((e,t,n)=>{((e,t,n)=>{t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n)})(this,"code"),this.name="MilkdownError",this.code=e}}const s=(e,t)=>"function"==typeof t?"[Function]":t,a=e=>JSON.stringify(e,s),l=e=>new i(o.docTypeError,`Doc type error, unsupported type: ${a(e)}`),c=e=>new i(o.contextNotFound,`Context "${e}" not found, do you forget to inject it?`),u=e=>new i(o.timerNotFound,`Timer "${e}" not found, do you forget to record it?`),d=()=>new i(o.ctxCallOutOfScope,"Should not call a context out of the plugin."),h=(...e)=>{const t=e.reduce(((e,t)=>{if(!t)return e;const n=e=>Array.isArray(e)?e.map((e=>n(e))).join(", "):e.toJSON?a(e.toJSON()):e.spec?a(e.spec):e.toString();return`${e}, ${n(t)}`}),"Create prosemirror node from remark failed in parser");return new i(o.createNodeInParserFail,t)},p=()=>new i(o.stackOverFlow,"Stack over flow, cannot pop on an empty stack."),f=e=>new i(o.parserMatchError,`Cannot match target parser for node: ${a(e)}.`),m=e=>new i(o.serializerMatchError,`Cannot match target serializer for node: ${a(e)}.`),g=e=>new i(o.expectDomTypeError,`Expect to be a dom, but get: ${a(e)}.`),y=()=>new i(o.callCommandBeforeEditorView,"You're trying to call a command before editor view initialized, make sure to get commandManager from ctx after editor view has been initialized"),v=e=>new i(o.missingNodeInSchema,`Missing node in schema, milkdown cannot find "${e}" in schema.`),w=e=>new i(o.missingMarkInSchema,`Missing mark in schema, milkdown cannot find "${e}" in schema.`)},1570:(e,t,n)=>{"use strict";n.d(t,{$t:()=>C,LN:()=>s,U3:()=>u,hs:()=>A,i5:()=>f,k_:()=>M,nh:()=>h,yn:()=>a});var r=n(6090),o=n(1329);const i=Object.create(null);class s{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new a(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=r.Ji.empty){let n=t.content.lastChild,o=null;for(let e=0;e<t.openEnd;e++)o=n,n=n.lastChild;let i=e.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:c}=s[a],u=e.mapping.slice(i);e.replaceRange(u.map(l.pos),u.map(c.pos),a?r.Ji.empty:t),0==a&&y(e,i,(n?n.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){let{$from:i,$to:s}=r[o],a=e.mapping.slice(n),l=a.map(i.pos),c=a.map(s.pos);o?e.deleteRange(l,c):(e.replaceRangeWith(l,c,t),y(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new u(e):g(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let o=t<0?g(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):g(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new f(e.node(0))}static atStart(e){return g(e,e,0,0,1)||new f(e)}static atEnd(e){return g(e,e,e.content.size,e.childCount,-1)||new f(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=i[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in i)throw new RangeError("Duplicate use of selection JSON ID "+e);return i[e]=t,t.prototype.jsonID=e,t}getBookmark(){return u.between(this.$anchor,this.$head).getBookmark()}}s.prototype.visible=!0;class a{constructor(e,t){this.$from=e,this.$to=t}}let l=!1;function c(e){l||e.parent.inlineContent||(l=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class u extends s{constructor(e,t=e){c(e),c(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return s.near(n);let r=e.resolve(t.map(this.anchor));return new u(r.parent.inlineContent?r:n,n)}replace(e,t=r.Ji.empty){if(super.replace(e,t),t==r.Ji.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof u&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new d(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new u(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if(n&&!r||(n=r>=0?1:-1),!t.parent.inlineContent){let e=s.findFrom(t,n,!0)||s.findFrom(t,-n,!0);if(!e)return s.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r||(e=(s.findFrom(e,-n,!0)||s.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0)&&(e=t),new u(e,t)}}s.jsonID("text",u);class d{constructor(e,t){this.anchor=e,this.head=t}map(e){return new d(e.map(this.anchor),e.map(this.head))}resolve(e){return u.between(e.resolve(this.anchor),e.resolve(this.head))}}class h extends s{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),o=e.resolve(r);return n?s.near(o):new h(o)}content(){return new r.Ji(r.FK.from(this.node),0,0)}eq(e){return e instanceof h&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new p(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new h(e.resolve(t.anchor))}static create(e,t){return new h(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}h.prototype.visible=!1,s.jsonID("node",h);class p{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new d(n,n):new p(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&h.isSelectable(n)?new h(t):s.near(t)}}class f extends s{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=r.Ji.empty){if(t==r.Ji.empty){e.delete(0,e.doc.content.size);let t=s.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new f(e)}map(e){return new f(e)}eq(e){return e instanceof f}getBookmark(){return m}}s.jsonID("all",f);const m={map(){return this},resolve:e=>new f(e)};function g(e,t,n,r,o,i=!1){if(t.inlineContent)return u.create(e,n);for(let s=r-(o>0?0:1);o>0?s<t.childCount:s>=0;s+=o){let r=t.child(s);if(r.isAtom){if(!i&&h.isSelectable(r))return h.create(e,n-(o<0?r.nodeSize:0))}else{let t=g(e,r,n+o,o<0?r.childCount:0,o,i);if(t)return t}n+=r.nodeSize*o}return null}function y(e,t,n){let r=e.steps.length-1;if(r<t)return;let i,a=e.steps[r];(a instanceof o.Ln||a instanceof o.Wg)&&(e.mapping.maps[r].forEach(((e,t,n,r)=>{null==i&&(i=r)})),e.setSelection(s.near(e.doc.resolve(i),n)))}class v extends o.dL{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=-3&this.updated|1,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return r.CU.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(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||r.CU.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(n=t),n=null==n?t:n,!e)return this.deleteRange(t,n);let o=this.storedMarks;if(!o){let e=this.doc.resolve(t);o=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,o)),this.selection.empty||this.setSelection(s.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function w(e,t){return t&&e?e.bind(t):e}class k{constructor(e,t,n){this.name=e,this.init=w(t.init,n),this.apply=w(t.apply,n)}}const b=[new k("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new k("selection",{init:(e,t)=>e.selection||s.atStart(t.doc),apply:e=>e.selection}),new k("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new k("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class x{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=b.slice(),t&&t.forEach((e=>{if(this.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new k(e.key,e.spec.state,e))}))}}class C{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 n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let o=!1;for(let i=0;i<this.config.plugins.length;i++){let s=this.config.plugins[i];if(s.spec.appendTransaction){let a=r?r[i].n:0,l=r?r[i].state:this,c=a<t.length&&s.spec.appendTransaction.call(s,a?t.slice(a):t,l,n);if(c&&n.filterTransaction(c,i)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<i?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),o=!0}r&&(r[i]={state:n,n:t.length})}}if(!o)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new C(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let o=n[r];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new v(this)}static create(e){let t=new x(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new C(t);for(let r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n}reconfigure(e){let t=new x(this.schema,e.plugins),n=t.fields,r=new C(t);for(let t=0;t<n.length;t++){let o=n[t].name;r[o]=this.hasOwnProperty(o)?this[o]:n[t].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map((e=>e.toJSON()))),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],o=r.spec.state;o&&o.toJSON&&(t[n]=o.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new x(e.schema,e.plugins),i=new C(o);return o.fields.forEach((o=>{if("doc"==o.name)i.doc=r.bP.fromJSON(e.schema,t.doc);else if("selection"==o.name)i.selection=s.fromJSON(i.doc,t.selection);else if("storedMarks"==o.name)t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let r in n){let s=n[r],a=s.spec.state;if(s.key==o.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(t,r))return void(i[o.name]=a.fromJSON.call(s,e,t[r],i))}i[o.name]=o.init(e,i)}})),i}}function S(e,t,n){for(let r in e){let o=e[r];o instanceof Function?o=o.bind(t):"handleDOMEvents"==r&&(o=S(o,t,{})),n[r]=o}return n}class M{constructor(e){this.spec=e,this.props={},e.props&&S(e.props,this,this.props),this.key=e.key?e.key.key:O("plugin")}getState(e){return e[this.key]}}const N=Object.create(null);function O(e){return e in N?e+"$"+ ++N[e]:(N[e]=0,e+"$")}class A{constructor(e="key"){this.key=O(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}},1854:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>ie,PD:()=>lt,hm:()=>Fe,Wf:()=>V,e0:()=>N,vY:()=>D,oO:()=>ne,Xk:()=>Se,Ej:()=>Ee});var r=n(6512),o=n(2113),i=n(5715),s=n(6090),a=n(1440),l=n(96),c=n(7096);const u=[["ß","ss"],["ẞ","Ss"],["ä","ae"],["Ä","Ae"],["ö","oe"],["Ö","Oe"],["ü","ue"],["Ü","Ue"],["À","A"],["Á","A"],["Â","A"],["Ã","A"],["Ä","Ae"],["Å","A"],["Æ","AE"],["Ç","C"],["È","E"],["É","E"],["Ê","E"],["Ë","E"],["Ì","I"],["Í","I"],["Î","I"],["Ï","I"],["Ð","D"],["Ñ","N"],["Ò","O"],["Ó","O"],["Ô","O"],["Õ","O"],["Ö","Oe"],["Ő","O"],["Ø","O"],["Ù","U"],["Ú","U"],["Û","U"],["Ü","Ue"],["Ű","U"],["Ý","Y"],["Þ","TH"],["ß","ss"],["à","a"],["á","a"],["â","a"],["ã","a"],["ä","ae"],["å","a"],["æ","ae"],["ç","c"],["è","e"],["é","e"],["ê","e"],["ë","e"],["ì","i"],["í","i"],["î","i"],["ï","i"],["ð","d"],["ñ","n"],["ò","o"],["ó","o"],["ô","o"],["õ","o"],["ö","oe"],["ő","o"],["ø","o"],["ù","u"],["ú","u"],["û","u"],["ü","ue"],["ű","u"],["ý","y"],["þ","th"],["ÿ","y"],["ẞ","SS"],["à","a"],["À","A"],["á","a"],["Á","A"],["â","a"],["Â","A"],["ã","a"],["Ã","A"],["è","e"],["È","E"],["é","e"],["É","E"],["ê","e"],["Ê","E"],["ì","i"],["Ì","I"],["í","i"],["Í","I"],["ò","o"],["Ò","O"],["ó","o"],["Ó","O"],["ô","o"],["Ô","O"],["õ","o"],["Õ","O"],["ù","u"],["Ù","U"],["ú","u"],["Ú","U"],["ý","y"],["Ý","Y"],["ă","a"],["Ă","A"],["Đ","D"],["đ","d"],["ĩ","i"],["Ĩ","I"],["ũ","u"],["Ũ","U"],["ơ","o"],["Ơ","O"],["ư","u"],["Ư","U"],["ạ","a"],["Ạ","A"],["ả","a"],["Ả","A"],["ấ","a"],["Ấ","A"],["ầ","a"],["Ầ","A"],["ẩ","a"],["Ẩ","A"],["ẫ","a"],["Ẫ","A"],["ậ","a"],["Ậ","A"],["ắ","a"],["Ắ","A"],["ằ","a"],["Ằ","A"],["ẳ","a"],["Ẳ","A"],["ẵ","a"],["Ẵ","A"],["ặ","a"],["Ặ","A"],["ẹ","e"],["Ẹ","E"],["ẻ","e"],["Ẻ","E"],["ẽ","e"],["Ẽ","E"],["ế","e"],["Ế","E"],["ề","e"],["Ề","E"],["ể","e"],["Ể","E"],["ễ","e"],["Ễ","E"],["ệ","e"],["Ệ","E"],["ỉ","i"],["Ỉ","I"],["ị","i"],["Ị","I"],["ọ","o"],["Ọ","O"],["ỏ","o"],["Ỏ","O"],["ố","o"],["Ố","O"],["ồ","o"],["Ồ","O"],["ổ","o"],["Ổ","O"],["ỗ","o"],["Ỗ","O"],["ộ","o"],["Ộ","O"],["ớ","o"],["Ớ","O"],["ờ","o"],["Ờ","O"],["ở","o"],["Ở","O"],["ỡ","o"],["Ỡ","O"],["ợ","o"],["Ợ","O"],["ụ","u"],["Ụ","U"],["ủ","u"],["Ủ","U"],["ứ","u"],["Ứ","U"],["ừ","u"],["Ừ","U"],["ử","u"],["Ử","U"],["ữ","u"],["Ữ","U"],["ự","u"],["Ự","U"],["ỳ","y"],["Ỳ","Y"],["ỵ","y"],["Ỵ","Y"],["ỷ","y"],["Ỷ","Y"],["ỹ","y"],["Ỹ","Y"],["ء","e"],["آ","a"],["أ","a"],["ؤ","w"],["إ","i"],["ئ","y"],["ا","a"],["ب","b"],["ة","t"],["ت","t"],["ث","th"],["ج","j"],["ح","h"],["خ","kh"],["د","d"],["ذ","dh"],["ر","r"],["ز","z"],["س","s"],["ش","sh"],["ص","s"],["ض","d"],["ط","t"],["ظ","z"],["ع","e"],["غ","gh"],["ـ","_"],["ف","f"],["ق","q"],["ك","k"],["ل","l"],["م","m"],["ن","n"],["ه","h"],["و","w"],["ى","a"],["ي","y"],["َ","a"],["ُ","u"],["ِ","i"],["٠","0"],["١","1"],["٢","2"],["٣","3"],["٤","4"],["٥","5"],["٦","6"],["٧","7"],["٨","8"],["٩","9"],["چ","ch"],["ک","k"],["گ","g"],["پ","p"],["ژ","zh"],["ی","y"],["۰","0"],["۱","1"],["۲","2"],["۳","3"],["۴","4"],["۵","5"],["۶","6"],["۷","7"],["۸","8"],["۹","9"],["ټ","p"],["ځ","z"],["څ","c"],["ډ","d"],["ﺫ","d"],["ﺭ","r"],["ړ","r"],["ﺯ","z"],["ږ","g"],["ښ","x"],["ګ","g"],["ڼ","n"],["ۀ","e"],["ې","e"],["ۍ","ai"],["ٹ","t"],["ڈ","d"],["ڑ","r"],["ں","n"],["ہ","h"],["ھ","h"],["ے","e"],["А","A"],["а","a"],["Б","B"],["б","b"],["В","V"],["в","v"],["Г","G"],["г","g"],["Д","D"],["д","d"],["ъе","ye"],["Ъе","Ye"],["ъЕ","yE"],["ЪЕ","YE"],["Е","E"],["е","e"],["Ё","Yo"],["ё","yo"],["Ж","Zh"],["ж","zh"],["З","Z"],["з","z"],["И","I"],["и","i"],["ый","iy"],["Ый","Iy"],["ЫЙ","IY"],["ыЙ","iY"],["Й","Y"],["й","y"],["К","K"],["к","k"],["Л","L"],["л","l"],["М","M"],["м","m"],["Н","N"],["н","n"],["О","O"],["о","o"],["П","P"],["п","p"],["Р","R"],["р","r"],["С","S"],["с","s"],["Т","T"],["т","t"],["У","U"],["у","u"],["Ф","F"],["ф","f"],["Х","Kh"],["х","kh"],["Ц","Ts"],["ц","ts"],["Ч","Ch"],["ч","ch"],["Ш","Sh"],["ш","sh"],["Щ","Sch"],["щ","sch"],["Ъ",""],["ъ",""],["Ы","Y"],["ы","y"],["Ь",""],["ь",""],["Э","E"],["э","e"],["Ю","Yu"],["ю","yu"],["Я","Ya"],["я","ya"],["ă","a"],["Ă","A"],["ș","s"],["Ș","S"],["ț","t"],["Ț","T"],["ţ","t"],["Ţ","T"],["ş","s"],["Ş","S"],["ç","c"],["Ç","C"],["ğ","g"],["Ğ","G"],["ı","i"],["İ","I"],["ա","a"],["Ա","A"],["բ","b"],["Բ","B"],["գ","g"],["Գ","G"],["դ","d"],["Դ","D"],["ե","ye"],["Ե","Ye"],["զ","z"],["Զ","Z"],["է","e"],["Է","E"],["ը","y"],["Ը","Y"],["թ","t"],["Թ","T"],["ժ","zh"],["Ժ","Zh"],["ի","i"],["Ի","I"],["լ","l"],["Լ","L"],["խ","kh"],["Խ","Kh"],["ծ","ts"],["Ծ","Ts"],["կ","k"],["Կ","K"],["հ","h"],["Հ","H"],["ձ","dz"],["Ձ","Dz"],["ղ","gh"],["Ղ","Gh"],["ճ","tch"],["Ճ","Tch"],["մ","m"],["Մ","M"],["յ","y"],["Յ","Y"],["ն","n"],["Ն","N"],["շ","sh"],["Շ","Sh"],["ո","vo"],["Ո","Vo"],["չ","ch"],["Չ","Ch"],["պ","p"],["Պ","P"],["ջ","j"],["Ջ","J"],["ռ","r"],["Ռ","R"],["ս","s"],["Ս","S"],["վ","v"],["Վ","V"],["տ","t"],["Տ","T"],["ր","r"],["Ր","R"],["ց","c"],["Ց","C"],["ու","u"],["ՈՒ","U"],["Ու","U"],["փ","p"],["Փ","P"],["ք","q"],["Ք","Q"],["օ","o"],["Օ","O"],["ֆ","f"],["Ֆ","F"],["և","yev"],["ა","a"],["ბ","b"],["გ","g"],["დ","d"],["ე","e"],["ვ","v"],["ზ","z"],["თ","t"],["ი","i"],["კ","k"],["ლ","l"],["მ","m"],["ნ","n"],["ო","o"],["პ","p"],["ჟ","zh"],["რ","r"],["ს","s"],["ტ","t"],["უ","u"],["ფ","ph"],["ქ","q"],["ღ","gh"],["ყ","k"],["შ","sh"],["ჩ","ch"],["ც","ts"],["ძ","dz"],["წ","ts"],["ჭ","tch"],["ხ","kh"],["ჯ","j"],["ჰ","h"],["č","c"],["ď","d"],["ě","e"],["ň","n"],["ř","r"],["š","s"],["ť","t"],["ů","u"],["ž","z"],["Č","C"],["Ď","D"],["Ě","E"],["Ň","N"],["Ř","R"],["Š","S"],["Ť","T"],["Ů","U"],["Ž","Z"],["ހ","h"],["ށ","sh"],["ނ","n"],["ރ","r"],["ބ","b"],["ޅ","lh"],["ކ","k"],["އ","a"],["ވ","v"],["މ","m"],["ފ","f"],["ދ","dh"],["ތ","th"],["ލ","l"],["ގ","g"],["ޏ","gn"],["ސ","s"],["ޑ","d"],["ޒ","z"],["ޓ","t"],["ޔ","y"],["ޕ","p"],["ޖ","j"],["ޗ","ch"],["ޘ","tt"],["ޙ","hh"],["ޚ","kh"],["ޛ","th"],["ޜ","z"],["ޝ","sh"],["ޞ","s"],["ޟ","d"],["ޠ","t"],["ޡ","z"],["ޢ","a"],["ޣ","gh"],["ޤ","q"],["ޥ","w"],["ަ","a"],["ާ","aa"],["ި","i"],["ީ","ee"],["ު","u"],["ޫ","oo"],["ެ","e"],["ޭ","ey"],["ޮ","o"],["ޯ","oa"],["ް",""],["α","a"],["β","v"],["γ","g"],["δ","d"],["ε","e"],["ζ","z"],["η","i"],["θ","th"],["ι","i"],["κ","k"],["λ","l"],["μ","m"],["ν","n"],["ξ","ks"],["ο","o"],["π","p"],["ρ","r"],["σ","s"],["τ","t"],["υ","y"],["φ","f"],["χ","x"],["ψ","ps"],["ω","o"],["ά","a"],["έ","e"],["ί","i"],["ό","o"],["ύ","y"],["ή","i"],["ώ","o"],["ς","s"],["ϊ","i"],["ΰ","y"],["ϋ","y"],["ΐ","i"],["Α","A"],["Β","B"],["Γ","G"],["Δ","D"],["Ε","E"],["Ζ","Z"],["Η","I"],["Θ","TH"],["Ι","I"],["Κ","K"],["Λ","L"],["Μ","M"],["Ν","N"],["Ξ","KS"],["Ο","O"],["Π","P"],["Ρ","R"],["Σ","S"],["Τ","T"],["Υ","Y"],["Φ","F"],["Χ","X"],["Ψ","PS"],["Ω","O"],["Ά","A"],["Έ","E"],["Ί","I"],["Ό","O"],["Ύ","Y"],["Ή","I"],["Ώ","O"],["Ϊ","I"],["Ϋ","Y"],["ā","a"],["ē","e"],["ģ","g"],["ī","i"],["ķ","k"],["ļ","l"],["ņ","n"],["ū","u"],["Ā","A"],["Ē","E"],["Ģ","G"],["Ī","I"],["Ķ","K"],["Ļ","L"],["Ņ","N"],["Ū","U"],["č","c"],["š","s"],["ž","z"],["Č","C"],["Š","S"],["Ž","Z"],["ą","a"],["č","c"],["ę","e"],["ė","e"],["į","i"],["š","s"],["ų","u"],["ū","u"],["ž","z"],["Ą","A"],["Č","C"],["Ę","E"],["Ė","E"],["Į","I"],["Š","S"],["Ų","U"],["Ū","U"],["Ќ","Kj"],["ќ","kj"],["Љ","Lj"],["љ","lj"],["Њ","Nj"],["њ","nj"],["Тс","Ts"],["тс","ts"],["ą","a"],["ć","c"],["ę","e"],["ł","l"],["ń","n"],["ś","s"],["ź","z"],["ż","z"],["Ą","A"],["Ć","C"],["Ę","E"],["Ł","L"],["Ń","N"],["Ś","S"],["Ź","Z"],["Ż","Z"],["Є","Ye"],["І","I"],["Ї","Yi"],["Ґ","G"],["є","ye"],["і","i"],["ї","yi"],["ґ","g"],["IJ","IJ"],["ij","ij"],["¢","c"],["¥","Y"],["߿","b"],["৳","t"],["૱","Bo"],["฿","B"],["₠","CE"],["₡","C"],["₢","Cr"],["₣","F"],["₥","m"],["₦","N"],["₧","Pt"],["₨","Rs"],["₩","W"],["₫","s"],["€","E"],["₭","K"],["₮","T"],["₯","Dp"],["₰","S"],["₱","P"],["₲","G"],["₳","A"],["₴","S"],["₵","C"],["₶","tt"],["₷","S"],["₸","T"],["₹","R"],["₺","L"],["₽","P"],["₿","B"],["﹩","$"],["¢","c"],["¥","Y"],["₩","W"],["𝐀","A"],["𝐁","B"],["𝐂","C"],["𝐃","D"],["𝐄","E"],["𝐅","F"],["𝐆","G"],["𝐇","H"],["𝐈","I"],["𝐉","J"],["𝐊","K"],["𝐋","L"],["𝐌","M"],["𝐍","N"],["𝐎","O"],["𝐏","P"],["𝐐","Q"],["𝐑","R"],["𝐒","S"],["𝐓","T"],["𝐔","U"],["𝐕","V"],["𝐖","W"],["𝐗","X"],["𝐘","Y"],["𝐙","Z"],["𝐚","a"],["𝐛","b"],["𝐜","c"],["𝐝","d"],["𝐞","e"],["𝐟","f"],["𝐠","g"],["𝐡","h"],["𝐢","i"],["𝐣","j"],["𝐤","k"],["𝐥","l"],["𝐦","m"],["𝐧","n"],["𝐨","o"],["𝐩","p"],["𝐪","q"],["𝐫","r"],["𝐬","s"],["𝐭","t"],["𝐮","u"],["𝐯","v"],["𝐰","w"],["𝐱","x"],["𝐲","y"],["𝐳","z"],["𝐴","A"],["𝐵","B"],["𝐶","C"],["𝐷","D"],["𝐸","E"],["𝐹","F"],["𝐺","G"],["𝐻","H"],["𝐼","I"],["𝐽","J"],["𝐾","K"],["𝐿","L"],["𝑀","M"],["𝑁","N"],["𝑂","O"],["𝑃","P"],["𝑄","Q"],["𝑅","R"],["𝑆","S"],["𝑇","T"],["𝑈","U"],["𝑉","V"],["𝑊","W"],["𝑋","X"],["𝑌","Y"],["𝑍","Z"],["𝑎","a"],["𝑏","b"],["𝑐","c"],["𝑑","d"],["𝑒","e"],["𝑓","f"],["𝑔","g"],["𝑖","i"],["𝑗","j"],["𝑘","k"],["𝑙","l"],["𝑚","m"],["𝑛","n"],["𝑜","o"],["𝑝","p"],["𝑞","q"],["𝑟","r"],["𝑠","s"],["𝑡","t"],["𝑢","u"],["𝑣","v"],["𝑤","w"],["𝑥","x"],["𝑦","y"],["𝑧","z"],["𝑨","A"],["𝑩","B"],["𝑪","C"],["𝑫","D"],["𝑬","E"],["𝑭","F"],["𝑮","G"],["𝑯","H"],["𝑰","I"],["𝑱","J"],["𝑲","K"],["𝑳","L"],["𝑴","M"],["𝑵","N"],["𝑶","O"],["𝑷","P"],["𝑸","Q"],["𝑹","R"],["𝑺","S"],["𝑻","T"],["𝑼","U"],["𝑽","V"],["𝑾","W"],["𝑿","X"],["𝒀","Y"],["𝒁","Z"],["𝒂","a"],["𝒃","b"],["𝒄","c"],["𝒅","d"],["𝒆","e"],["𝒇","f"],["𝒈","g"],["𝒉","h"],["𝒊","i"],["𝒋","j"],["𝒌","k"],["𝒍","l"],["𝒎","m"],["𝒏","n"],["𝒐","o"],["𝒑","p"],["𝒒","q"],["𝒓","r"],["𝒔","s"],["𝒕","t"],["𝒖","u"],["𝒗","v"],["𝒘","w"],["𝒙","x"],["𝒚","y"],["𝒛","z"],["𝒜","A"],["𝒞","C"],["𝒟","D"],["𝒢","g"],["𝒥","J"],["𝒦","K"],["𝒩","N"],["𝒪","O"],["𝒫","P"],["𝒬","Q"],["𝒮","S"],["𝒯","T"],["𝒰","U"],["𝒱","V"],["𝒲","W"],["𝒳","X"],["𝒴","Y"],["𝒵","Z"],["𝒶","a"],["𝒷","b"],["𝒸","c"],["𝒹","d"],["𝒻","f"],["𝒽","h"],["𝒾","i"],["𝒿","j"],["𝓀","h"],["𝓁","l"],["𝓂","m"],["𝓃","n"],["𝓅","p"],["𝓆","q"],["𝓇","r"],["𝓈","s"],["𝓉","t"],["𝓊","u"],["𝓋","v"],["𝓌","w"],["𝓍","x"],["𝓎","y"],["𝓏","z"],["𝓐","A"],["𝓑","B"],["𝓒","C"],["𝓓","D"],["𝓔","E"],["𝓕","F"],["𝓖","G"],["𝓗","H"],["𝓘","I"],["𝓙","J"],["𝓚","K"],["𝓛","L"],["𝓜","M"],["𝓝","N"],["𝓞","O"],["𝓟","P"],["𝓠","Q"],["𝓡","R"],["𝓢","S"],["𝓣","T"],["𝓤","U"],["𝓥","V"],["𝓦","W"],["𝓧","X"],["𝓨","Y"],["𝓩","Z"],["𝓪","a"],["𝓫","b"],["𝓬","c"],["𝓭","d"],["𝓮","e"],["𝓯","f"],["𝓰","g"],["𝓱","h"],["𝓲","i"],["𝓳","j"],["𝓴","k"],["𝓵","l"],["𝓶","m"],["𝓷","n"],["𝓸","o"],["𝓹","p"],["𝓺","q"],["𝓻","r"],["𝓼","s"],["𝓽","t"],["𝓾","u"],["𝓿","v"],["𝔀","w"],["𝔁","x"],["𝔂","y"],["𝔃","z"],["𝔄","A"],["𝔅","B"],["𝔇","D"],["𝔈","E"],["𝔉","F"],["𝔊","G"],["𝔍","J"],["𝔎","K"],["𝔏","L"],["𝔐","M"],["𝔑","N"],["𝔒","O"],["𝔓","P"],["𝔔","Q"],["𝔖","S"],["𝔗","T"],["𝔘","U"],["𝔙","V"],["𝔚","W"],["𝔛","X"],["𝔜","Y"],["𝔞","a"],["𝔟","b"],["𝔠","c"],["𝔡","d"],["𝔢","e"],["𝔣","f"],["𝔤","g"],["𝔥","h"],["𝔦","i"],["𝔧","j"],["𝔨","k"],["𝔩","l"],["𝔪","m"],["𝔫","n"],["𝔬","o"],["𝔭","p"],["𝔮","q"],["𝔯","r"],["𝔰","s"],["𝔱","t"],["𝔲","u"],["𝔳","v"],["𝔴","w"],["𝔵","x"],["𝔶","y"],["𝔷","z"],["𝔸","A"],["𝔹","B"],["𝔻","D"],["𝔼","E"],["𝔽","F"],["𝔾","G"],["𝕀","I"],["𝕁","J"],["𝕂","K"],["𝕃","L"],["𝕄","M"],["𝕆","N"],["𝕊","S"],["𝕋","T"],["𝕌","U"],["𝕍","V"],["𝕎","W"],["𝕏","X"],["𝕐","Y"],["𝕒","a"],["𝕓","b"],["𝕔","c"],["𝕕","d"],["𝕖","e"],["𝕗","f"],["𝕘","g"],["𝕙","h"],["𝕚","i"],["𝕛","j"],["𝕜","k"],["𝕝","l"],["𝕞","m"],["𝕟","n"],["𝕠","o"],["𝕡","p"],["𝕢","q"],["𝕣","r"],["𝕤","s"],["𝕥","t"],["𝕦","u"],["𝕧","v"],["𝕨","w"],["𝕩","x"],["𝕪","y"],["𝕫","z"],["𝕬","A"],["𝕭","B"],["𝕮","C"],["𝕯","D"],["𝕰","E"],["𝕱","F"],["𝕲","G"],["𝕳","H"],["𝕴","I"],["𝕵","J"],["𝕶","K"],["𝕷","L"],["𝕸","M"],["𝕹","N"],["𝕺","O"],["𝕻","P"],["𝕼","Q"],["𝕽","R"],["𝕾","S"],["𝕿","T"],["𝖀","U"],["𝖁","V"],["𝖂","W"],["𝖃","X"],["𝖄","Y"],["𝖅","Z"],["𝖆","a"],["𝖇","b"],["𝖈","c"],["𝖉","d"],["𝖊","e"],["𝖋","f"],["𝖌","g"],["𝖍","h"],["𝖎","i"],["𝖏","j"],["𝖐","k"],["𝖑","l"],["𝖒","m"],["𝖓","n"],["𝖔","o"],["𝖕","p"],["𝖖","q"],["𝖗","r"],["𝖘","s"],["𝖙","t"],["𝖚","u"],["𝖛","v"],["𝖜","w"],["𝖝","x"],["𝖞","y"],["𝖟","z"],["𝖠","A"],["𝖡","B"],["𝖢","C"],["𝖣","D"],["𝖤","E"],["𝖥","F"],["𝖦","G"],["𝖧","H"],["𝖨","I"],["𝖩","J"],["𝖪","K"],["𝖫","L"],["𝖬","M"],["𝖭","N"],["𝖮","O"],["𝖯","P"],["𝖰","Q"],["𝖱","R"],["𝖲","S"],["𝖳","T"],["𝖴","U"],["𝖵","V"],["𝖶","W"],["𝖷","X"],["𝖸","Y"],["𝖹","Z"],["𝖺","a"],["𝖻","b"],["𝖼","c"],["𝖽","d"],["𝖾","e"],["𝖿","f"],["𝗀","g"],["𝗁","h"],["𝗂","i"],["𝗃","j"],["𝗄","k"],["𝗅","l"],["𝗆","m"],["𝗇","n"],["𝗈","o"],["𝗉","p"],["𝗊","q"],["𝗋","r"],["𝗌","s"],["𝗍","t"],["𝗎","u"],["𝗏","v"],["𝗐","w"],["𝗑","x"],["𝗒","y"],["𝗓","z"],["𝗔","A"],["𝗕","B"],["𝗖","C"],["𝗗","D"],["𝗘","E"],["𝗙","F"],["𝗚","G"],["𝗛","H"],["𝗜","I"],["𝗝","J"],["𝗞","K"],["𝗟","L"],["𝗠","M"],["𝗡","N"],["𝗢","O"],["𝗣","P"],["𝗤","Q"],["𝗥","R"],["𝗦","S"],["𝗧","T"],["𝗨","U"],["𝗩","V"],["𝗪","W"],["𝗫","X"],["𝗬","Y"],["𝗭","Z"],["𝗮","a"],["𝗯","b"],["𝗰","c"],["𝗱","d"],["𝗲","e"],["𝗳","f"],["𝗴","g"],["𝗵","h"],["𝗶","i"],["𝗷","j"],["𝗸","k"],["𝗹","l"],["𝗺","m"],["𝗻","n"],["𝗼","o"],["𝗽","p"],["𝗾","q"],["𝗿","r"],["𝘀","s"],["𝘁","t"],["𝘂","u"],["𝘃","v"],["𝘄","w"],["𝘅","x"],["𝘆","y"],["𝘇","z"],["𝘈","A"],["𝘉","B"],["𝘊","C"],["𝘋","D"],["𝘌","E"],["𝘍","F"],["𝘎","G"],["𝘏","H"],["𝘐","I"],["𝘑","J"],["𝘒","K"],["𝘓","L"],["𝘔","M"],["𝘕","N"],["𝘖","O"],["𝘗","P"],["𝘘","Q"],["𝘙","R"],["𝘚","S"],["𝘛","T"],["𝘜","U"],["𝘝","V"],["𝘞","W"],["𝘟","X"],["𝘠","Y"],["𝘡","Z"],["𝘢","a"],["𝘣","b"],["𝘤","c"],["𝘥","d"],["𝘦","e"],["𝘧","f"],["𝘨","g"],["𝘩","h"],["𝘪","i"],["𝘫","j"],["𝘬","k"],["𝘭","l"],["𝘮","m"],["𝘯","n"],["𝘰","o"],["𝘱","p"],["𝘲","q"],["𝘳","r"],["𝘴","s"],["𝘵","t"],["𝘶","u"],["𝘷","v"],["𝘸","w"],["𝘹","x"],["𝘺","y"],["𝘻","z"],["𝘼","A"],["𝘽","B"],["𝘾","C"],["𝘿","D"],["𝙀","E"],["𝙁","F"],["𝙂","G"],["𝙃","H"],["𝙄","I"],["𝙅","J"],["𝙆","K"],["𝙇","L"],["𝙈","M"],["𝙉","N"],["𝙊","O"],["𝙋","P"],["𝙌","Q"],["𝙍","R"],["𝙎","S"],["𝙏","T"],["𝙐","U"],["𝙑","V"],["𝙒","W"],["𝙓","X"],["𝙔","Y"],["𝙕","Z"],["𝙖","a"],["𝙗","b"],["𝙘","c"],["𝙙","d"],["𝙚","e"],["𝙛","f"],["𝙜","g"],["𝙝","h"],["𝙞","i"],["𝙟","j"],["𝙠","k"],["𝙡","l"],["𝙢","m"],["𝙣","n"],["𝙤","o"],["𝙥","p"],["𝙦","q"],["𝙧","r"],["𝙨","s"],["𝙩","t"],["𝙪","u"],["𝙫","v"],["𝙬","w"],["𝙭","x"],["𝙮","y"],["𝙯","z"],["𝙰","A"],["𝙱","B"],["𝙲","C"],["𝙳","D"],["𝙴","E"],["𝙵","F"],["𝙶","G"],["𝙷","H"],["𝙸","I"],["𝙹","J"],["𝙺","K"],["𝙻","L"],["𝙼","M"],["𝙽","N"],["𝙾","O"],["𝙿","P"],["𝚀","Q"],["𝚁","R"],["𝚂","S"],["𝚃","T"],["𝚄","U"],["𝚅","V"],["𝚆","W"],["𝚇","X"],["𝚈","Y"],["𝚉","Z"],["𝚊","a"],["𝚋","b"],["𝚌","c"],["𝚍","d"],["𝚎","e"],["𝚏","f"],["𝚐","g"],["𝚑","h"],["𝚒","i"],["𝚓","j"],["𝚔","k"],["𝚕","l"],["𝚖","m"],["𝚗","n"],["𝚘","o"],["𝚙","p"],["𝚚","q"],["𝚛","r"],["𝚜","s"],["𝚝","t"],["𝚞","u"],["𝚟","v"],["𝚠","w"],["𝚡","x"],["𝚢","y"],["𝚣","z"],["𝚤","l"],["𝚥","j"],["𝛢","A"],["𝛣","B"],["𝛤","G"],["𝛥","D"],["𝛦","E"],["𝛧","Z"],["𝛨","I"],["𝛩","TH"],["𝛪","I"],["𝛫","K"],["𝛬","L"],["𝛭","M"],["𝛮","N"],["𝛯","KS"],["𝛰","O"],["𝛱","P"],["𝛲","R"],["𝛳","TH"],["𝛴","S"],["𝛵","T"],["𝛶","Y"],["𝛷","F"],["𝛸","x"],["𝛹","PS"],["𝛺","O"],["𝛻","D"],["𝛼","a"],["𝛽","b"],["𝛾","g"],["𝛿","d"],["𝜀","e"],["𝜁","z"],["𝜂","i"],["𝜃","th"],["𝜄","i"],["𝜅","k"],["𝜆","l"],["𝜇","m"],["𝜈","n"],["𝜉","ks"],["𝜊","o"],["𝜋","p"],["𝜌","r"],["𝜍","s"],["𝜎","s"],["𝜏","t"],["𝜐","y"],["𝜑","f"],["𝜒","x"],["𝜓","ps"],["𝜔","o"],["𝜕","d"],["𝜖","E"],["𝜗","TH"],["𝜘","K"],["𝜙","f"],["𝜚","r"],["𝜛","p"],["𝜜","A"],["𝜝","V"],["𝜞","G"],["𝜟","D"],["𝜠","E"],["𝜡","Z"],["𝜢","I"],["𝜣","TH"],["𝜤","I"],["𝜥","K"],["𝜦","L"],["𝜧","M"],["𝜨","N"],["𝜩","KS"],["𝜪","O"],["𝜫","P"],["𝜬","S"],["𝜭","TH"],["𝜮","S"],["𝜯","T"],["𝜰","Y"],["𝜱","F"],["𝜲","X"],["𝜳","PS"],["𝜴","O"],["𝜵","D"],["𝜶","a"],["𝜷","v"],["𝜸","g"],["𝜹","d"],["𝜺","e"],["𝜻","z"],["𝜼","i"],["𝜽","th"],["𝜾","i"],["𝜿","k"],["𝝀","l"],["𝝁","m"],["𝝂","n"],["𝝃","ks"],["𝝄","o"],["𝝅","p"],["𝝆","r"],["𝝇","s"],["𝝈","s"],["𝝉","t"],["𝝊","y"],["𝝋","f"],["𝝌","x"],["𝝍","ps"],["𝝎","o"],["𝝏","a"],["𝝐","e"],["𝝑","i"],["𝝒","k"],["𝝓","f"],["𝝔","r"],["𝝕","p"],["𝝖","A"],["𝝗","B"],["𝝘","G"],["𝝙","D"],["𝝚","E"],["𝝛","Z"],["𝝜","I"],["𝝝","TH"],["𝝞","I"],["𝝟","K"],["𝝠","L"],["𝝡","M"],["𝝢","N"],["𝝣","KS"],["𝝤","O"],["𝝥","P"],["𝝦","R"],["𝝧","TH"],["𝝨","S"],["𝝩","T"],["𝝪","Y"],["𝝫","F"],["𝝬","X"],["𝝭","PS"],["𝝮","O"],["𝝯","D"],["𝝰","a"],["𝝱","v"],["𝝲","g"],["𝝳","d"],["𝝴","e"],["𝝵","z"],["𝝶","i"],["𝝷","th"],["𝝸","i"],["𝝹","k"],["𝝺","l"],["𝝻","m"],["𝝼","n"],["𝝽","ks"],["𝝾","o"],["𝝿","p"],["𝞀","r"],["𝞁","s"],["𝞂","s"],["𝞃","t"],["𝞄","y"],["𝞅","f"],["𝞆","x"],["𝞇","ps"],["𝞈","o"],["𝞉","a"],["𝞊","e"],["𝞋","i"],["𝞌","k"],["𝞍","f"],["𝞎","r"],["𝞏","p"],["𝞐","A"],["𝞑","V"],["𝞒","G"],["𝞓","D"],["𝞔","E"],["𝞕","Z"],["𝞖","I"],["𝞗","TH"],["𝞘","I"],["𝞙","K"],["𝞚","L"],["𝞛","M"],["𝞜","N"],["𝞝","KS"],["𝞞","O"],["𝞟","P"],["𝞠","S"],["𝞡","TH"],["𝞢","S"],["𝞣","T"],["𝞤","Y"],["𝞥","F"],["𝞦","X"],["𝞧","PS"],["𝞨","O"],["𝞩","D"],["𝞪","av"],["𝞫","g"],["𝞬","d"],["𝞭","e"],["𝞮","z"],["𝞯","i"],["𝞰","i"],["𝞱","th"],["𝞲","i"],["𝞳","k"],["𝞴","l"],["𝞵","m"],["𝞶","n"],["𝞷","ks"],["𝞸","o"],["𝞹","p"],["𝞺","r"],["𝞻","s"],["𝞼","s"],["𝞽","t"],["𝞾","y"],["𝞿","f"],["𝟀","x"],["𝟁","ps"],["𝟂","o"],["𝟃","a"],["𝟄","e"],["𝟅","i"],["𝟆","k"],["𝟇","f"],["𝟈","r"],["𝟉","p"],["𝟊","F"],["𝟋","f"],["⒜","(a)"],["⒝","(b)"],["⒞","(c)"],["⒟","(d)"],["⒠","(e)"],["⒡","(f)"],["⒢","(g)"],["⒣","(h)"],["⒤","(i)"],["⒥","(j)"],["⒦","(k)"],["⒧","(l)"],["⒨","(m)"],["⒩","(n)"],["⒪","(o)"],["⒫","(p)"],["⒬","(q)"],["⒭","(r)"],["⒮","(s)"],["⒯","(t)"],["⒰","(u)"],["⒱","(v)"],["⒲","(w)"],["⒳","(x)"],["⒴","(y)"],["⒵","(z)"],["Ⓐ","(A)"],["Ⓑ","(B)"],["Ⓒ","(C)"],["Ⓓ","(D)"],["Ⓔ","(E)"],["Ⓕ","(F)"],["Ⓖ","(G)"],["Ⓗ","(H)"],["Ⓘ","(I)"],["Ⓙ","(J)"],["Ⓚ","(K)"],["Ⓛ","(L)"],["Ⓝ","(N)"],["Ⓞ","(O)"],["Ⓟ","(P)"],["Ⓠ","(Q)"],["Ⓡ","(R)"],["Ⓢ","(S)"],["Ⓣ","(T)"],["Ⓤ","(U)"],["Ⓥ","(V)"],["Ⓦ","(W)"],["Ⓧ","(X)"],["Ⓨ","(Y)"],["Ⓩ","(Z)"],["ⓐ","(a)"],["ⓑ","(b)"],["ⓒ","(b)"],["ⓓ","(c)"],["ⓔ","(e)"],["ⓕ","(f)"],["ⓖ","(g)"],["ⓗ","(h)"],["ⓘ","(i)"],["ⓙ","(j)"],["ⓚ","(k)"],["ⓛ","(l)"],["ⓜ","(m)"],["ⓝ","(n)"],["ⓞ","(o)"],["ⓟ","(p)"],["ⓠ","(q)"],["ⓡ","(r)"],["ⓢ","(s)"],["ⓣ","(t)"],["ⓤ","(u)"],["ⓥ","(v)"],["ⓦ","(w)"],["ⓧ","(x)"],["ⓨ","(y)"],["ⓩ","(z)"],["Ċ","C"],["ċ","c"],["Ġ","G"],["ġ","g"],["Ħ","H"],["ħ","h"],["Ż","Z"],["ż","z"],["𝟎","0"],["𝟏","1"],["𝟐","2"],["𝟑","3"],["𝟒","4"],["𝟓","5"],["𝟔","6"],["𝟕","7"],["𝟖","8"],["𝟗","9"],["𝟘","0"],["𝟙","1"],["𝟚","2"],["𝟛","3"],["𝟜","4"],["𝟝","5"],["𝟞","6"],["𝟟","7"],["𝟠","8"],["𝟡","9"],["𝟢","0"],["𝟣","1"],["𝟤","2"],["𝟥","3"],["𝟦","4"],["𝟧","5"],["𝟨","6"],["𝟩","7"],["𝟪","8"],["𝟫","9"],["𝟬","0"],["𝟭","1"],["𝟮","2"],["𝟯","3"],["𝟰","4"],["𝟱","5"],["𝟲","6"],["𝟳","7"],["𝟴","8"],["𝟵","9"],["𝟶","0"],["𝟷","1"],["𝟸","2"],["𝟹","3"],["𝟺","4"],["𝟻","5"],["𝟼","6"],["𝟽","7"],["𝟾","8"],["𝟿","9"],["①","1"],["②","2"],["③","3"],["④","4"],["⑤","5"],["⑥","6"],["⑦","7"],["⑧","8"],["⑨","9"],["⑩","10"],["⑪","11"],["⑫","12"],["⑬","13"],["⑭","14"],["⑮","15"],["⑯","16"],["⑰","17"],["⑱","18"],["⑲","19"],["⑳","20"],["⑴","1"],["⑵","2"],["⑶","3"],["⑷","4"],["⑸","5"],["⑹","6"],["⑺","7"],["⑻","8"],["⑼","9"],["⑽","10"],["⑾","11"],["⑿","12"],["⒀","13"],["⒁","14"],["⒂","15"],["⒃","16"],["⒄","17"],["⒅","18"],["⒆","19"],["⒇","20"],["⒈","1."],["⒉","2."],["⒊","3."],["⒋","4."],["⒌","5."],["⒍","6."],["⒎","7."],["⒏","8."],["⒐","9."],["⒑","10."],["⒒","11."],["⒓","12."],["⒔","13."],["⒕","14."],["⒖","15."],["⒗","16."],["⒘","17."],["⒙","18."],["⒚","19."],["⒛","20."],["⓪","0"],["⓫","11"],["⓬","12"],["⓭","13"],["⓮","14"],["⓯","15"],["⓰","16"],["⓱","17"],["⓲","18"],["⓳","19"],["⓴","20"],["⓵","1"],["⓶","2"],["⓷","3"],["⓸","4"],["⓹","5"],["⓺","6"],["⓻","7"],["⓼","8"],["⓽","9"],["⓾","10"],["⓿","0"],["🙰","&"],["🙱","&"],["🙲","&"],["🙳","&"],["🙴","&"],["🙵","&"],["🙶",'"'],["🙷",'"'],["🙸",'"'],["‽","?!"],["🙹","?!"],["🙺","?!"],["🙻","?!"],["🙼","/"],["🙽","\\"],["🜇","AR"],["🜈","V"],["🜉","V"],["🜆","VR"],["🜅","VF"],["🜩","2"],["🜪","5"],["🝡","f"],["🝢","W"],["🝣","U"],["🝧","V"],["🝨","T"],["🝪","V"],["🝫","MB"],["🝬","VB"],["🝲","3B"],["🝳","3B"],["💯","100"],["🔙","BACK"],["🔚","END"],["🔛","ON!"],["🔜","SOON"],["🔝","TOP"],["🔞","18"],["🔤","abc"],["🔠","ABCD"],["🔡","abcd"],["🔢","1234"],["🔣","T&@%"],["#️⃣","#"],["*️⃣","*"],["0️⃣","0"],["1️⃣","1"],["2️⃣","2"],["3️⃣","3"],["4️⃣","4"],["5️⃣","5"],["6️⃣","6"],["7️⃣","7"],["8️⃣","8"],["9️⃣","9"],["🔟","10"],["🅰️","A"],["🅱️","B"],["🆎","AB"],["🆑","CL"],["🅾️","O"],["🅿","P"],["🆘","SOS"],["🅲","C"],["🅳","D"],["🅴","E"],["🅵","F"],["🅶","G"],["🅷","H"],["🅸","I"],["🅹","J"],["🅺","K"],["🅻","L"],["🅼","M"],["🅽","N"],["🆀","Q"],["🆁","R"],["🆂","S"],["🆃","T"],["🆄","U"],["🆅","V"],["🆆","W"],["🆇","X"],["🆈","Y"],["🆉","Z"]];const d=[["&"," and "],["🦄"," unicorn "],["♥"," love "]];function h(e,t){if("string"!=typeof e)throw new TypeError(`Expected a string, got \`${typeof e}\``);const n=(t={separator:"-",lowercase:!0,decamelize:!0,customReplacements:[],preserveLeadingUnderscore:!1,preserveTrailingDash:!1,preserveCharacters:[],...t}).preserveLeadingUnderscore&&e.startsWith("_"),r=t.preserveTrailingDash&&e.endsWith("-");e=function(e,t){if("string"!=typeof e)throw new TypeError(`Expected a string, got \`${typeof e}\``);t={customReplacements:[],...t};const n=new Map([...u,...t.customReplacements]);return(e=((e,t)=>{for(const[n,r]of t)e=e.replace(new RegExp((0,c.A)(n),"g"),r);return e})(e=e.normalize(),n)).normalize("NFD").replace(/[\^`\xA8\xAF\xB4\xB7\xB8\u02B0-\u034E\u0350-\u0357\u035D-\u0362\u0374\u0375\u037A\u0384\u0385\u0483-\u0487\u0559\u0591-\u05A1\u05A3-\u05BD\u05BF\u05C1\u05C2\u05C4\u064B-\u0652\u0657\u0658\u06DF\u06E0\u06E5\u06E6\u06EA-\u06EC\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F5\u0818\u0819\u0898-\u089F\u08C9-\u08D2\u08E3-\u08FE\u093C\u094D\u0951-\u0954\u0971\u09BC\u09CD\u0A3C\u0A4D\u0ABC\u0ACD\u0AFD-\u0AFF\u0B3C\u0B4D\u0B55\u0BCD\u0C3C\u0C4D\u0CBC\u0CCD\u0D3B\u0D3C\u0D4D\u0DCA\u0E3A\u0E47-\u0E4C\u0E4E\u0EBA\u0EC8-\u0ECC\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F82-\u0F84\u0F86\u0F87\u0FC6\u1037\u1039\u103A\u1063\u1064\u1069-\u106D\u1087-\u108D\u108F\u109A\u109B\u135D-\u135F\u1714\u1715\u1734\u17C9-\u17D3\u17DD\u1939-\u193B\u1A60\u1A75-\u1A7C\u1A7F\u1AB0-\u1ABE\u1AC1-\u1ACB\u1B34\u1B44\u1B6B-\u1B73\u1BAA\u1BAB\u1BE6\u1BF2\u1BF3\u1C36\u1C37\u1C78-\u1C7D\u1CD0-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1D2C-\u1D6A\u1DC4-\u1DCF\u1DF5-\u1DFF\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2CEF-\u2CF1\u2E2F\u302A-\u302F\u3099-\u309C\u30FC\uA66F\uA67C\uA67D\uA67F\uA69C\uA69D\uA6F0\uA6F1\uA700-\uA721\uA788-\uA78A\uA7F8\uA7F9\uA806\uA82C\uA8C4\uA8E0-\uA8F1\uA92B-\uA92E\uA953\uA9B3\uA9C0\uA9E5\uAA7B-\uAA7D\uAABF-\uAAC2\uAAF6\uAB5B-\uAB5F\uAB69-\uAB6B\uABEC\uABED\uFB1E\uFE20-\uFE2F\uFF3E\uFF40\uFF70\uFF9E\uFF9F\uFFE3\u{102E0}\u{10780}-\u{10785}\u{10787}-\u{107B0}\u{107B2}-\u{107BA}\u{10A38}-\u{10A3A}\u{10A3F}\u{10AE5}\u{10AE6}\u{10D22}-\u{10D27}\u{10D4E}\u{10D69}-\u{10D6D}\u{10EFD}-\u{10EFF}\u{10F46}-\u{10F50}\u{10F82}-\u{10F85}\u{11046}\u{11070}\u{110B9}\u{110BA}\u{11133}\u{11134}\u{11173}\u{111C0}\u{111CA}-\u{111CC}\u{11235}\u{11236}\u{112E9}\u{112EA}\u{1133B}\u{1133C}\u{1134D}\u{11366}-\u{1136C}\u{11370}-\u{11374}\u{113CE}-\u{113D0}\u{113D2}\u{113D3}\u{113E1}\u{113E2}\u{11442}\u{11446}\u{114C2}\u{114C3}\u{115BF}\u{115C0}\u{1163F}\u{116B6}\u{116B7}\u{1172B}\u{11839}\u{1183A}\u{1193D}\u{1193E}\u{11943}\u{119E0}\u{11A34}\u{11A47}\u{11A99}\u{11C3F}\u{11D42}\u{11D44}\u{11D45}\u{11D97}\u{11F41}\u{11F42}\u{11F5A}\u{13447}-\u{13455}\u{1612F}\u{16AF0}-\u{16AF4}\u{16B30}-\u{16B36}\u{16D6B}\u{16D6C}\u{16F8F}-\u{16F9F}\u{16FF0}\u{16FF1}\u{1AFF0}-\u{1AFF3}\u{1AFF5}-\u{1AFFB}\u{1AFFD}\u{1AFFE}\u{1CF00}-\u{1CF2D}\u{1CF30}-\u{1CF46}\u{1D167}-\u{1D169}\u{1D16D}-\u{1D172}\u{1D17B}-\u{1D182}\u{1D185}-\u{1D18B}\u{1D1AA}-\u{1D1AD}\u{1E030}-\u{1E06D}\u{1E130}-\u{1E136}\u{1E2AE}\u{1E2EC}-\u{1E2EF}\u{1E5EE}\u{1E5EF}\u{1E8D0}-\u{1E8D6}\u{1E944}-\u{1E946}\u{1E948}-\u{1E94A}]/gu,"").normalize()}(e,{customReplacements:new Map([...d,...t.customReplacements])}),t.decamelize&&(e=(e=>e.replace(/([A-Z]{2,})(\d+)/g,"$1 $2").replace(/([a-z\d]+)([A-Z]{2,})/g,"$1 $2").replace(/([a-z\d])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-rt-z\d]+)/g,"$1 $2"))(e));const o=(e=>{let t="a-z\\d";if(t+=e.lowercase?"":"A-Z",e.preserveCharacters.length>0)for(const n of e.preserveCharacters){if(n===e.separator)throw new Error(`The separator character \`${e.separator}\` cannot be included in preserved characters: ${e.preserveCharacters}`);t+=(0,c.A)(n)}return new RegExp(`[^${t}]+`,"g")})(t);return t.lowercase&&(e=e.toLowerCase()),e=(e=(e=e.replace(/([a-zA-Z\d]+)'([ts])(\s|$)/g,"$1$2$3")).replace(o,t.separator)).replace(/\\/g,""),t.separator&&(e=((e,t)=>{const n=(0,c.A)(t);return e.replace(new RegExp(`${n}{2,}`,"g"),t).replace(new RegExp(`^${n}|${n}$`,"g"),"")})(e,t.separator)),n&&(e=`_${e}`),r&&(e=`${e}-`),e}var p=n(1570),f=n(4254),m=n(1329);var g=n(3686),y=n(6641);const v=function(e,t,n,r){"function"==typeof t&&"function"!=typeof n&&(r=n,n=t,t=null),(0,y.VG)(e,t,(function(e,t){const r=t[t.length-1];return n(e,r?r.children.indexOf(e):null,r)}),r)},w={}.hasOwnProperty;function k(e){return String(e||"").toUpperCase()}function b(){return e=>{const t=function(e){const t=Object.create(null);if(!e||!e.type)throw new Error("mdast-util-definitions expected node");return function(e,t,n,r){"function"==typeof t&&"function"!=typeof n&&(r=n,n=t,t=null),(0,y.VG)(e,t,(function(e,t){const r=t[t.length-1];return n(e,r?r.children.indexOf(e):null,r)}),r)}(e,"definition",(e=>{const n=k(e.identifier);n&&!w.call(t,n)&&(t[n]=e)})),function(e){const n=k(e);return n&&w.call(t,n)?t[n]:null}}(e);!function(e,t,n,r){"function"==typeof t&&"function"!=typeof n&&(r=n,n=t,t=null),(0,y.VG)(e,t,(function(e,t){const r=t[t.length-1];return n(e,r?r.children.indexOf(e):null,r)}),r)}(e,((e,n,r)=>{if("definition"===e.type&&null!==r&&"number"==typeof n)return r.children.splice(n,1),[y._Z,n];if("imageReference"===e.type||"linkReference"===e.type){const o=t(e.identifier);if(o&&null!==r&&"number"==typeof n){const t="imageReference"===e.type?{type:"image",url:o.url,title:o.title,alt:e.alt}:{type:"link",url:o.url,title:o.title,children:e.children};return r.children[n]=t,[y._Z,n]}}}))}}const x=(e,t)=>{var n;if(!(t.childCount>=1&&"hardbreak"===(null==(n=t.lastChild)?void 0:n.type.name)))return void e.next(t.content);const r=[];t.content.forEach(((e,n,o)=>{o!==t.childCount-1&&r.push(e)})),e.next(s.FK.fromArray(r))},C=(e,t)=>(Object.assign(e,{meta:{package:"@milkdown/preset-commonmark",...t}}),e),S=(0,r.JY)("emphasis");C(S,{displayName:"Attr<emphasis>",group:"Emphasis"});const M=(0,r.hk)("emphasis",(e=>({inclusive:!1,parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:e=>"italic"===e}],toDOM:t=>["em",e.get(S.key)(t)],parseMarkdown:{match:e=>"emphasis"===e.type,runner:(e,t,n)=>{e.openMark(n),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"emphasis"===e.type.name,runner:(e,t)=>{e.withMark(t,"emphasis")}}})));C(M.mark,{displayName:"MarkSchema<emphasis>",group:"Emphasis"}),C(M.ctx,{displayName:"MarkSchemaCtx<emphasis>",group:"Emphasis"});const N=(0,r.yu)("ToggleEmphasis",(()=>()=>(0,i.wh)(M.type())));C(N,{displayName:"Command<toggleEmphasisCommand>",group:"Emphasis"});const O=(0,r.pq)("emphasisKeymap",{ToggleEmphasis:{shortcuts:"Mod-i",command:e=>{const t=e.get(o.MD);return()=>t.call(N.key)}}});C(O.ctx,{displayName:"KeymapCtx<emphasis>",group:"Emphasis"}),C(O.shortcuts,{displayName:"Keymap<emphasis>",group:"Emphasis"});const A=(0,r.JY)("strong");C(A,{displayName:"Attr<strong>",group:"Strong"});const E=(0,r.hk)("strong",(e=>({inclusive:!1,parseDOM:[{tag:"b"},{tag:"strong"},{style:"font-style",getAttrs:e=>"bold"===e}],toDOM:t=>["strong",e.get(A.key)(t)],parseMarkdown:{match:e=>"strong"===e.type,runner:(e,t,n)=>{e.openMark(n),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"strong"===e.type.name,runner:(e,t)=>{e.withMark(t,"strong")}}})));C(E.mark,{displayName:"MarkSchema<strong>",group:"Strong"}),C(E.ctx,{displayName:"MarkSchemaCtx<strong>",group:"Strong"});const D=(0,r.yu)("ToggleStrong",(()=>()=>(0,i.wh)(E.type())));C(D,{displayName:"Command<toggleStrongCommand>",group:"Strong"});const T=(0,r.pq)("strongKeymap",{ToggleBold:{shortcuts:["Mod-b"],command:e=>{const t=e.get(o.MD);return()=>t.call(D.key)}}});C(T.ctx,{displayName:"KeymapCtx<strong>",group:"Strong"}),C(T.shortcuts,{displayName:"Keymap<strong>",group:"Strong"});const F=(0,r.JY)("inlineCode");C(F,{displayName:"Attr<inlineCode>",group:"InlineCode"});const I=(0,r.hk)("inlineCode",(e=>({priority:100,code:!0,inclusive:!1,parseDOM:[{tag:"code"}],toDOM:t=>["code",e.get(F.key)(t)],parseMarkdown:{match:e=>"inlineCode"===e.type,runner:(e,t,n)=>{e.openMark(n),e.addText(t.value),e.closeMark(n)}},toMarkdown:{match:e=>"inlineCode"===e.type.name,runner:(e,t,n)=>{e.withMark(t,"inlineCode",n.text||"")}}})));C(I.mark,{displayName:"MarkSchema<inlineCode>",group:"InlineCode"}),C(I.ctx,{displayName:"MarkSchemaCtx<inlineCode>",group:"InlineCode"});const R=(0,r.yu)("ToggleInlineCode",(()=>()=>(e,t)=>{const{selection:n,tr:r}=e;if(n.empty)return!1;const{from:o,to:i}=n;return e.doc.rangeHasMark(o,i,I.type())?(null==t||t(r.removeMark(o,i,I.type())),!0):(Object.keys(e.schema.marks).filter((e=>e!==I.type.name)).map((t=>e.schema.marks[t])).forEach((e=>{r.removeMark(o,i,e)})),null==t||t(r.addMark(o,i,I.type().create())),!0)}));C(R,{displayName:"Command<toggleInlineCodeCommand>",group:"InlineCode"});const P=(0,r.pq)("inlineCodeKeymap",{ToggleInlineCode:{shortcuts:"Mod-e",command:e=>{const t=e.get(o.MD);return()=>t.call(R.key)}}});C(P.ctx,{displayName:"KeymapCtx<inlineCode>",group:"InlineCode"}),C(P.shortcuts,{displayName:"Keymap<inlineCode>",group:"InlineCode"});const B=(0,r.JY)("link");C(B,{displayName:"Attr<link>",group:"Link"});const L=(0,r.hk)("link",(e=>({attrs:{href:{},title:{default:null}},parseDOM:[{tag:"a[href]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw(0,a.Ik)(e);return{href:e.getAttribute("href"),title:e.getAttribute("title")}}}],toDOM:t=>["a",{...e.get(B.key)(t),...t.attrs}],parseMarkdown:{match:e=>"link"===e.type,runner:(e,t,n)=>{const r=t.url,o=t.title;e.openMark(n,{href:r,title:o}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"link"===e.type.name,runner:(e,t)=>{e.withMark(t,"link",void 0,{title:t.attrs.title,url:t.attrs.href})}}})));C(L.mark,{displayName:"MarkSchema<link>",group:"Link"});const z=(0,r.yu)("ToggleLink",(()=>(e={})=>(0,i.wh)(L.type(),e)));C(z,{displayName:"Command<toggleLinkCommand>",group:"Link"});const $=(0,r.yu)("UpdateLink",(()=>(e={})=>(t,n)=>{if(!n)return!1;let r,o=-1;const{selection:i}=t,{from:s,to:a}=i;if(t.doc.nodesBetween(s,s===a?a+1:a,((e,t)=>{if(L.type().isInSet(e.marks))return r=e,o=t,!1})),!r)return!1;const l=r.marks.find((({type:e})=>e===L.type()));if(!l)return!1;const c=o,u=o+r.nodeSize,{tr:d}=t,h=L.type().create({...l.attrs,...e});return!!h&&(n(d.removeMark(c,u,l).addMark(c,u,h).setSelection(new p.U3(d.selection.$anchor)).scrollIntoView()),!0)}));C($,{displayName:"Command<updateLinkCommand>",group:"Link"});const j=(0,r.dz)("doc",(()=>({content:"block+",parseMarkdown:{match:({type:e})=>"root"===e,runner:(e,t,n)=>{e.injectRoot(t,n)}},toMarkdown:{match:e=>"doc"===e.type.name,runner:(e,t)=>{e.openNode("root"),e.next(t.content)}}})));C(j,{displayName:"NodeSchema<doc>",group:"Doc"});const _=(0,r.YR)("paragraph");C(_,{displayName:"Attr<paragraph>",group:"Paragraph"});const V=(0,r.Yh)("paragraph",(e=>({content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:t=>["p",e.get(_.key)(t),0],parseMarkdown:{match:e=>"paragraph"===e.type,runner:(e,t,n)=>{e.openNode(n),t.children?e.next(t.children):e.addText(t.value||""),e.closeNode()}},toMarkdown:{match:e=>"paragraph"===e.type.name,runner:(e,t)=>{e.openNode("paragraph"),x(e,t),e.closeNode()}}})));C(V.node,{displayName:"NodeSchema<paragraph>",group:"Paragraph"}),C(V.ctx,{displayName:"NodeSchemaCtx<paragraph>",group:"Paragraph"});const W=(0,r.yu)("TurnIntoText",(()=>()=>(0,i.y_)(V.type())));C(W,{displayName:"Command<turnIntoTextCommand>",group:"Paragraph"});const H=(0,r.pq)("paragraphKeymap",{TurnIntoText:{shortcuts:"Mod-Alt-0",command:e=>{const t=e.get(o.MD);return()=>t.call(W.key)}}});C(H.ctx,{displayName:"KeymapCtx<paragraph>",group:"Paragraph"}),C(H.shortcuts,{displayName:"Keymap<paragraph>",group:"Paragraph"});const K=Array(6).fill(0).map(((e,t)=>t+1)),J=(0,r.Qx)((e=>h(e.textContent)),"headingIdGenerator");C(J,{displayName:"Ctx<HeadingIdGenerator>",group:"Heading"});const q=(0,r.YR)("heading");C(q,{displayName:"Attr<heading>",group:"Heading"});const U=(0,r.Yh)("heading",(e=>{const t=e.get(J.key);return{content:"inline*",group:"block",defining:!0,attrs:{id:{default:""},level:{default:1}},parseDOM:K.map((e=>({tag:`h${e}`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw(0,a.Ik)(t);return{level:e,id:t.id}}}))),toDOM:n=>[`h${n.attrs.level}`,{...e.get(q.key)(n),id:n.attrs.id||t(n)},0],parseMarkdown:{match:({type:e})=>"heading"===e,runner:(e,t,n)=>{const r=t.depth;e.openNode(n,{level:r}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>"heading"===e.type.name,runner:(e,t)=>{e.openNode("heading",void 0,{depth:t.attrs.level}),x(e,t),e.closeNode()}}}}));C(U.node,{displayName:"NodeSchema<heading>",group:"Heading"}),C(U.ctx,{displayName:"NodeSchemaCtx<heading>",group:"Heading"});const Y=(0,r.b_)((e=>(0,l.JJ)(/^(?<hashes>#+)\s$/,U.type(),(t=>{var n,r;const i=(null==(r=null==(n=t.groups)?void 0:n.hashes)?void 0:r.length)||0,s=e.get(o.kY),{$from:a}=s.state.selection,l=a.node();if("heading"===l.type.name){let e=Number(l.attrs.level)+Number(i);return e>6&&(e=6),{level:e}}return{level:i}}))));C(Y,{displayName:"InputRule<wrapInHeadingInputRule>",group:"Heading"});const Z=(0,r.yu)("WrapInHeading",(()=>e=>(e??(e=1),e<1?(0,i.y_)(V.type()):(0,i.y_)(U.type(),{level:e}))));C(Z,{displayName:"Command<wrapInHeadingCommand>",group:"Heading"});const G=(0,r.yu)("DowngradeHeading",(()=>()=>(e,t,n)=>{const{$from:r}=e.selection,o=r.node();if(o.type!==U.type()||!e.selection.empty||0!==r.parentOffset)return!1;const s=o.attrs.level-1;return s?(null==t||t(e.tr.setNodeMarkup(e.selection.$from.before(),void 0,{...o.attrs,level:s})),!0):(0,i.y_)(V.type())(e,t,n)}));C(G,{displayName:"Command<downgradeHeadingCommand>",group:"Heading"});const Q=(0,r.pq)("headingKeymap",{TurnIntoH1:{shortcuts:"Mod-Alt-1",command:e=>{const t=e.get(o.MD);return()=>t.call(Z.key,1)}},TurnIntoH2:{shortcuts:"Mod-Alt-2",command:e=>{const t=e.get(o.MD);return()=>t.call(Z.key,2)}},TurnIntoH3:{shortcuts:"Mod-Alt-3",command:e=>{const t=e.get(o.MD);return()=>t.call(Z.key,3)}},TurnIntoH4:{shortcuts:"Mod-Alt-4",command:e=>{const t=e.get(o.MD);return()=>t.call(Z.key,3)}},TurnIntoH5:{shortcuts:"Mod-Alt-5",command:e=>{const t=e.get(o.MD);return()=>t.call(Z.key,3)}},TurnIntoH6:{shortcuts:"Mod-Alt-6",command:e=>{const t=e.get(o.MD);return()=>t.call(Z.key,3)}},DowngradeHeading:{shortcuts:["Delete","Backspace"],command:e=>{const t=e.get(o.MD);return()=>t.call(G.key)}}});C(Q.ctx,{displayName:"KeymapCtx<heading>",group:"Heading"}),C(Q.shortcuts,{displayName:"Keymap<heading>",group:"Heading"});const X=(0,r.YR)("blockquote");C(X,{displayName:"Attr<blockquote>",group:"Blockquote"});const ee=(0,r.Yh)("blockquote",(e=>({content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:t=>["blockquote",e.get(X.key)(t),0],parseMarkdown:{match:({type:e})=>"blockquote"===e,runner:(e,t,n)=>{e.openNode(n).next(t.children).closeNode()}},toMarkdown:{match:e=>"blockquote"===e.type.name,runner:(e,t)=>{e.openNode("blockquote").next(t.content).closeNode()}}})));C(ee.node,{displayName:"NodeSchema<blockquote>",group:"Blockquote"}),C(ee.ctx,{displayName:"NodeSchemaCtx<blockquote>",group:"Blockquote"});const te=(0,r.b_)((()=>(0,l.tG)(/^\s*>\s$/,ee.type())));C(te,{displayName:"InputRule<wrapInBlockquoteInputRule>",group:"Blockquote"});const ne=(0,r.yu)("WrapInBlockquote",(()=>()=>(0,i.Im)(ee.type())));C(ne,{displayName:"Command<wrapInBlockquoteCommand>",group:"Blockquote"});const re=(0,r.pq)("blockquoteKeymap",{WrapInBlockquote:{shortcuts:"Mod-Shift-b",command:e=>{const t=e.get(o.MD);return()=>t.call(ne.key)}}});C(re.ctx,{displayName:"KeymapCtx<blockquote>",group:"Blockquote"}),C(re.shortcuts,{displayName:"Keymap<blockquote>",group:"Blockquote"});const oe=(0,r.YR)("codeBlock",(()=>({pre:{},code:{}})));C(oe,{displayName:"Attr<codeBlock>",group:"CodeBlock"});const ie=(0,r.Yh)("code_block",(e=>({content:"text*",group:"block",marks:"",defining:!0,code:!0,attrs:{language:{default:""}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:e=>{if(!(e instanceof HTMLElement))throw(0,a.Ik)(e);return{language:e.dataset.language}}}],toDOM:t=>{const n=e.get(oe.key)(t);return["pre",{...n.pre,"data-language":t.attrs.language},["code",n.code,0]]},parseMarkdown:{match:({type:e})=>"code"===e,runner:(e,t,n)=>{const r=t.lang,o=t.value;e.openNode(n,{language:r}),o&&e.addText(o),e.closeNode()}},toMarkdown:{match:e=>"code_block"===e.type.name,runner:(e,t)=>{var n;e.addNode("code",void 0,(null==(n=t.content.firstChild)?void 0:n.text)||"",{lang:t.attrs.language})}}})));C(ie.node,{displayName:"NodeSchema<codeBlock>",group:"CodeBlock"}),C(ie.ctx,{displayName:"NodeSchemaCtx<codeBlock>",group:"CodeBlock"});const se=(0,r.b_)((()=>(0,l.JJ)(/^```(?<language>[a-z]*)?[\s\n]$/,ie.type(),(e=>{var t;return{language:(null==(t=e.groups)?void 0:t.language)??""}}))));C(se,{displayName:"InputRule<createCodeBlockInputRule>",group:"CodeBlock"});const ae=(0,r.yu)("CreateCodeBlock",(()=>(e="")=>(0,i.y_)(ie.type(),{language:e})));C(ae,{displayName:"Command<createCodeBlockCommand>",group:"CodeBlock"}),C((0,r.yu)("UpdateCodeBlockLanguage",(()=>({pos:e,language:t}={pos:-1,language:""})=>(n,r)=>e>=0&&(null==r||r(n.tr.setNodeAttribute(e,"language",t)),!0))),{displayName:"Command<updateCodeBlockLanguageCommand>",group:"CodeBlock"});const le=(0,r.pq)("codeBlockKeymap",{CreateCodeBlock:{shortcuts:"Mod-Alt-c",command:e=>{const t=e.get(o.MD);return()=>t.call(ae.key)}}});C(le.ctx,{displayName:"KeymapCtx<codeBlock>",group:"CodeBlock"}),C(le.shortcuts,{displayName:"Keymap<codeBlock>",group:"CodeBlock"});const ce=(0,r.YR)("image");C(ce,{displayName:"Attr<image>",group:"Image"});const ue=(0,r.Yh)("image",(e=>({inline:!0,group:"inline",selectable:!0,draggable:!0,marks:"",atom:!0,defining:!0,isolating:!0,attrs:{src:{default:""},alt:{default:""},title:{default:""}},parseDOM:[{tag:"img[src]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw(0,a.Ik)(e);return{src:e.getAttribute("src")||"",alt:e.getAttribute("alt")||"",title:e.getAttribute("title")||e.getAttribute("alt")||""}}}],toDOM:t=>["img",{...e.get(ce.key)(t),...t.attrs}],parseMarkdown:{match:({type:e})=>"image"===e,runner:(e,t,n)=>{const r=t.url,o=t.alt,i=t.title;e.addNode(n,{src:r,alt:o,title:i})}},toMarkdown:{match:e=>"image"===e.type.name,runner:(e,t)=>{e.addNode("image",void 0,void 0,{title:t.attrs.title,url:t.attrs.src,alt:t.attrs.alt})}}})));C(ue.node,{displayName:"NodeSchema<image>",group:"Image"}),C(ue.ctx,{displayName:"NodeSchemaCtx<image>",group:"Image"});const de=(0,r.yu)("InsertImage",(()=>(e={})=>(t,n)=>{if(!n)return!0;const{src:r="",alt:o="",title:i=""}=e,s=ue.type().create({src:r,alt:o,title:i});return s&&n(t.tr.replaceSelectionWith(s).scrollIntoView()),!0}));C(de,{displayName:"Command<insertImageCommand>",group:"Image"});const he=(0,r.yu)("UpdateImage",(()=>(e={})=>(t,n)=>{const r=(0,f.UM)(t.selection,ue.type());if(!r)return!1;const{node:o,pos:i}=r,s={...o.attrs},{src:a,alt:l,title:c}=e;return void 0!==a&&(s.src=a),void 0!==l&&(s.alt=l),void 0!==c&&(s.title=c),null==n||n(t.tr.setNodeMarkup(i,void 0,s).scrollIntoView()),!0}));C(he,{displayName:"Command<updateImageCommand>",group:"Image"}),C((0,r.b_)((()=>new l.fV(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,((e,t,n,r)=>{const[o,i,s="",a]=t;return o?e.tr.replaceWith(n,r,ue.type().create({src:s,alt:i,title:a})):null})))),{displayName:"InputRule<insertImageInputRule>",group:"Image"});const pe=(0,r.YR)("hardbreak",(e=>({"data-is-inline":e.attrs.isInline})));C(pe,{displayName:"Attr<hardbreak>",group:"Hardbreak"});const fe=(0,r.Yh)("hardbreak",(e=>({inline:!0,group:"inline",attrs:{isInline:{default:!1}},selectable:!1,parseDOM:[{tag:"br"}],toDOM:t=>["br",e.get(pe.key)(t)],parseMarkdown:{match:({type:e})=>"break"===e,runner:(e,t,n)=>{var r;e.addNode(n,{isInline:Boolean(null==(r=t.data)?void 0:r.isInline)})}},leafText:()=>"\n",toMarkdown:{match:e=>"hardbreak"===e.type.name,runner:(e,t)=>{t.attrs.isInline?e.addNode("text",void 0,"\n"):e.addNode("break")}}})));C(fe.node,{displayName:"NodeSchema<hardbreak>",group:"Hardbreak"}),C(fe.ctx,{displayName:"NodeSchemaCtx<hardbreak>",group:"Hardbreak"});const me=(0,r.yu)("InsertHardbreak",(()=>()=>(e,t)=>{var n;const{selection:r,tr:o}=e;if(r.empty){const i=r.$from.node();if(i.childCount>0&&"hardbreak"===(null==(n=i.lastChild)?void 0:n.type.name))return null==t||t(o.replaceRangeWith(r.to-1,r.to,e.schema.node("paragraph")).setSelection(p.LN.near(o.doc.resolve(r.to))).scrollIntoView()),!0}return null==t||t(o.setMeta("hardbreak",!0).replaceSelectionWith(fe.type().create()).scrollIntoView()),!0}));C(me,{displayName:"Command<insertHardbreakCommand>",group:"Hardbreak"});const ge=(0,r.pq)("hardbreakKeymap",{InsertHardbreak:{shortcuts:"Shift-Enter",command:e=>{const t=e.get(o.MD);return()=>t.call(me.key)}}});C(ge.ctx,{displayName:"KeymapCtx<hardbreak>",group:"Hardbreak"}),C(ge.shortcuts,{displayName:"Keymap<hardbreak>",group:"Hardbreak"});const ye=(0,r.YR)("hr");C(ye,{displayName:"Attr<hr>",group:"Hr"});const ve=(0,r.Yh)("hr",(e=>({group:"block",parseDOM:[{tag:"hr"}],toDOM:t=>["hr",e.get(ye.key)(t)],parseMarkdown:{match:({type:e})=>"thematicBreak"===e,runner:(e,t,n)=>{e.addNode(n)}},toMarkdown:{match:e=>"hr"===e.type.name,runner:e=>{e.addNode("thematicBreak")}}})));C(ve.node,{displayName:"NodeSchema<hr>",group:"Hr"}),C(ve.ctx,{displayName:"NodeSchemaCtx<hr>",group:"Hr"});const we=(0,r.b_)((()=>new l.fV(/^(?:---|___\s|\*\*\*\s)$/,((e,t,n,r)=>{const{tr:o}=e;return t[0]&&o.replaceWith(n-1,r,ve.type().create()),o}))));C(we,{displayName:"InputRule<insertHrInputRule>",group:"Hr"});const ke=(0,r.yu)("InsertHr",(()=>()=>(e,t)=>{if(!t)return!0;const n=V.node.type().create(),{tr:r,selection:o}=e,{from:i}=o,s=ve.type().create();if(!s)return!0;const a=r.replaceSelectionWith(s).insert(i,n),l=p.LN.findFrom(a.doc.resolve(i),1,!0);return l&&t(a.setSelection(l).scrollIntoView()),!0}));C(ke,{displayName:"Command<insertHrCommand>",group:"Hr"});const be=(0,r.YR)("bulletList");C(be,{displayName:"Attr<bulletList>",group:"BulletList"});const xe=(0,r.Yh)("bullet_list",(e=>({content:"listItem+",group:"block",attrs:{spread:{default:!1}},parseDOM:[{tag:"ul",getAttrs:e=>{if(!(e instanceof HTMLElement))throw(0,a.Ik)(e);return{spread:e.dataset.spread}}}],toDOM:t=>["ul",{...e.get(be.key)(t),"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>"list"===e&&!t,runner:(e,t,n)=>{const r=null!=t.spread?`${t.spread}`:"false";e.openNode(n,{spread:r}).next(t.children).closeNode()}},toMarkdown:{match:e=>"bullet_list"===e.type.name,runner:(e,t)=>{e.openNode("list",void 0,{ordered:!1,spread:"true"===t.attrs.spread}).next(t.content).closeNode()}}})));C(xe.node,{displayName:"NodeSchema<bulletList>",group:"BulletList"}),C(xe.ctx,{displayName:"NodeSchemaCtx<bulletList>",group:"BulletList"});const Ce=(0,r.b_)((()=>(0,l.tG)(/^\s*([-+*])\s$/,xe.type())));C(Ce,{displayName:"InputRule<wrapInBulletListInputRule>",group:"BulletList"});const Se=(0,r.yu)("WrapInBulletList",(()=>()=>(0,i.Im)(xe.type())));C(Se,{displayName:"Command<wrapInBulletListCommand>",group:"BulletList"});const Me=(0,r.pq)("bulletListKeymap",{WrapInBulletList:{shortcuts:"Mod-Alt-8",command:e=>{const t=e.get(o.MD);return()=>t.call(Se.key)}}});C(Me.ctx,{displayName:"KeymapCtx<bulletListKeymap>",group:"BulletList"}),C(Me.shortcuts,{displayName:"Keymap<bulletListKeymap>",group:"BulletList"});const Ne=(0,r.YR)("orderedList");C(Ne,{displayName:"Attr<orderedList>",group:"OrderedList"});const Oe=(0,r.Yh)("ordered_list",(e=>({content:"listItem+",group:"block",attrs:{order:{default:1},spread:{default:!1}},parseDOM:[{tag:"ol",getAttrs:e=>{if(!(e instanceof HTMLElement))throw(0,a.Ik)(e);return{spread:e.dataset.spread,order:e.hasAttribute("start")?Number(e.getAttribute("start")):1}}}],toDOM:t=>["ol",{...e.get(Ne.key)(t),...1===t.attrs.order?{}:t.attrs.order,"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>"list"===e&&!!t,runner:(e,t,n)=>{const r=null!=t.spread?`${t.spread}`:"true";e.openNode(n,{spread:r}).next(t.children).closeNode()}},toMarkdown:{match:e=>"ordered_list"===e.type.name,runner:(e,t)=>{e.openNode("list",void 0,{ordered:!0,start:1,spread:"true"===t.attrs.spread}),e.next(t.content),e.closeNode()}}})));C(Oe.node,{displayName:"NodeSchema<orderedList>",group:"OrderedList"}),C(Oe.ctx,{displayName:"NodeSchemaCtx<orderedList>",group:"OrderedList"});const Ae=(0,r.b_)((()=>(0,l.tG)(/^\s*(\d+)\.\s$/,Oe.type(),(e=>({order:Number(e[1])})),((e,t)=>t.childCount+t.attrs.order===Number(e[1])))));C(Ae,{displayName:"InputRule<wrapInOrderedListInputRule>",group:"OrderedList"});const Ee=(0,r.yu)("WrapInOrderedList",(()=>()=>(0,i.Im)(Oe.type())));C(Ee,{displayName:"Command<wrapInOrderedListCommand>",group:"OrderedList"});const De=(0,r.pq)("orderedListKeymap",{WrapInOrderedList:{shortcuts:"Mod-Alt-7",command:e=>{const t=e.get(o.MD);return()=>t.call(Ee.key)}}});C(De.ctx,{displayName:"KeymapCtx<orderedList>",group:"OrderedList"}),C(De.shortcuts,{displayName:"Keymap<orderedList>",group:"OrderedList"});const Te=(0,r.YR)("listItem");C(Te,{displayName:"Attr<listItem>",group:"ListItem"});const Fe=(0,r.Yh)("list_item",(e=>({group:"listItem",content:"paragraph block*",attrs:{label:{default:"•"},listType:{default:"bullet"},spread:{default:"true"}},defining:!0,parseDOM:[{tag:"li",getAttrs:e=>{if(!(e instanceof HTMLElement))throw(0,a.Ik)(e);return{label:e.dataset.label,listType:e.dataset["list-type"],spread:e.dataset.spread}}}],toDOM:t=>["li",{...e.get(Te.key)(t),"data-label":t.attrs.label,"data-list-type":t.attrs.listType,"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e})=>"listItem"===e,runner:(e,t,n)=>{const r=null!=t.label?`${t.label}.`:"•",o=null!=t.label?"ordered":"bullet",i=null!=t.spread?`${t.spread}`:"true";e.openNode(n,{label:r,listType:o,spread:i}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>"list_item"===e.type.name,runner:(e,t)=>{e.openNode("listItem",void 0,{spread:"true"===t.attrs.spread}),e.next(t.content),e.closeNode()}}})));C(Fe.node,{displayName:"NodeSchema<listItem>",group:"ListItem"}),C(Fe.ctx,{displayName:"NodeSchemaCtx<listItem>",group:"ListItem"});const Ie=(0,r.yu)("SinkListItem",(()=>()=>{return e=Fe.type(),function(t,n){let{$from:r,$to:o}=t.selection,i=r.blockRange(o,(t=>t.childCount>0&&t.firstChild.type==e));if(!i)return!1;let a=i.startIndex;if(0==a)return!1;let l=i.parent,c=l.child(a-1);if(c.type!=e)return!1;if(n){let r=c.lastChild&&c.lastChild.type==l.type,o=s.FK.from(r?e.create():null),a=new s.Ji(s.FK.from(e.create(null,s.FK.from(l.type.create(null,o)))),r?3:1,0),u=i.start,d=i.end;n(t.tr.step(new m.Wg(u-(r?3:1),d,u,d,a,1,!0)).scrollIntoView())}return!0};var e}));C(Ie,{displayName:"Command<sinkListItemCommand>",group:"ListItem"});const Re=(0,r.yu)("SplitListItem",(()=>()=>{return e=Fe.type(),function(t,n){let{$from:r,$to:o}=t.selection,i=r.blockRange(o,(t=>t.childCount>0&&t.firstChild.type==e));return!!i&&(!n||(r.node(i.depth-1).type==e?function(e,t,n,r){let o=e.tr,i=r.end,a=r.$to.end(r.depth);i<a&&(o.step(new m.Wg(i-1,a,i,a,new s.Ji(s.FK.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new s.u$(o.doc.resolve(r.$from.pos),o.doc.resolve(a),r.depth));const l=(0,m.jP)(r);if(null==l)return!1;o.lift(r,l);let c=o.mapping.map(i,-1)-1;return(0,m.n9)(o.doc,c)&&o.join(c),t(o.scrollIntoView()),!0}(t,n,e,i):function(e,t,n){let r=e.tr,o=n.parent;for(let e=n.end,t=n.endIndex-1,i=n.startIndex;t>i;t--)e-=o.child(t).nodeSize,r.delete(e-1,e+1);let i=r.doc.resolve(n.start),a=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=0==n.startIndex,c=n.endIndex==o.childCount,u=i.node(-1),d=i.index(-1);if(!u.canReplace(d+(l?0:1),d+1,a.content.append(c?s.FK.empty:s.FK.from(o))))return!1;let h=i.pos,p=h+a.nodeSize;return r.step(new m.Wg(h-(l?1:0),p+(c?1:0),h+1,p-1,new s.Ji((l?s.FK.empty:s.FK.from(o.copy(s.FK.empty))).append(c?s.FK.empty:s.FK.from(o.copy(s.FK.empty))),l?0:1,c?0:1),l?0:1)),t(r.scrollIntoView()),!0}(t,n,i)))};var e}));C(Re,{displayName:"Command<liftListItemCommand>",group:"ListItem"});const Pe=(0,r.yu)("SplitListItem",(()=>()=>{return e=Fe.type(),function(t,n){let{$from:r,$to:o,node:i}=t.selection;if(i&&i.isBlock||r.depth<2||!r.sameParent(o))return!1;let a=r.node(-1);if(a.type!=e)return!1;if(0==r.parent.content.size&&r.node(-1).childCount==r.indexAfter(-1)){if(3==r.depth||r.node(-3).type!=e||r.index(-2)!=r.node(-2).childCount-1)return!1;if(n){let o=s.FK.empty,i=r.index(-1)?1:r.index(-2)?2:3;for(let e=r.depth-i;e>=r.depth-3;e--)o=s.FK.from(r.node(e).copy(o));let a=r.indexAfter(-1)<r.node(-2).childCount?1:r.indexAfter(-2)<r.node(-3).childCount?2:3;o=o.append(s.FK.from(e.createAndFill()));let l=r.before(r.depth-(i-1)),c=t.tr.replace(l,r.after(-a),new s.Ji(o,4-i,0)),u=-1;c.doc.nodesBetween(l,c.doc.content.size,((e,t)=>{if(u>-1)return!1;e.isTextblock&&0==e.content.size&&(u=t+1)})),u>-1&&c.setSelection(p.LN.near(c.doc.resolve(u))),n(c.scrollIntoView())}return!0}let l=o.pos==r.end()?a.contentMatchAt(0).defaultType:null,c=t.tr.delete(r.pos,o.pos),u=l?[null,{type:l}]:void 0;return!!(0,m.zy)(c.doc,r.pos,2,u)&&(n&&n(c.split(r.pos,2,u).scrollIntoView()),!0)};var e}));C(Pe,{displayName:"Command<splitListItemCommand>",group:"ListItem"});const Be=(0,r.pq)("listItemKeymap",{NextListItem:{shortcuts:"Enter",command:e=>{const t=e.get(o.MD);return()=>t.call(Pe.key)}},SinkListItem:{shortcuts:["Tab","Mod-]"],command:e=>{const t=e.get(o.MD);return()=>t.call(Ie.key)}},LiftListItem:{shortcuts:["Shift-Tab","Mod-["],command:e=>{const t=e.get(o.MD);return()=>t.call(Re.key)}}});C(Be.ctx,{displayName:"KeymapCtx<listItem>",group:"ListItem"}),C(Be.shortcuts,{displayName:"Keymap<listItem>",group:"ListItem"});const Le=(0,r.dz)("text",(()=>({group:"inline",parseMarkdown:{match:({type:e})=>"text"===e,runner:(e,t)=>{e.addText(t.value)}},toMarkdown:{match:e=>"text"===e.type.name,runner:(e,t)=>{e.addNode("text",void 0,t.text)}}})));C(Le,{displayName:"NodeSchema<text>",group:"Text"});const ze=(0,r.YR)("html");C(ze,{displayName:"Attr<html>",group:"Html"});const $e=(0,r.Yh)("html",(e=>({atom:!0,group:"inline",inline:!0,attrs:{value:{default:""}},toDOM:t=>{const n=document.createElement("span"),r={...e.get(ze.key)(t),"data-value":t.attrs.value,"data-type":"html"};return n.textContent=t.attrs.value,["span",r,t.attrs.value]},parseDOM:[{tag:'span[data-type="html"]',getAttrs:e=>({value:e.dataset.value??""})}],parseMarkdown:{match:({type:e})=>Boolean("html"===e),runner:(e,t,n)=>{e.addNode(n,{value:t.value})}},toMarkdown:{match:e=>"html"===e.type.name,runner:(e,t)=>{e.addNode("html",void 0,t.attrs.value)}}})));C($e.node,{displayName:"NodeSchema<html>",group:"Html"}),C($e.ctx,{displayName:"NodeSchemaCtx<html>",group:"Html"});const je=[j,_,V,J,q,U,pe,fe,X,ee,oe,ie,ye,ve,ce,ue,be,xe,Ne,Oe,Te,Fe,S,M,A,E,F,I,B,L,ze,$e,Le].flat(),_e=[te,Ce,Ae,se,we,Y].flat(),Ve=[W,ne,Z,G,ae,me,ke,de,he,Ee,Se,Ie,Pe,Re,N,R,D,z,$],We=[re,le,ge,Q,Be,De,Me,H,O,P,T].flat(),He=/\[(?<span>((www|https:\/\/|http:\/\/)[^\s\]]+))]\((?<url>[^\s\]]+)\)/,Ke=e=>{let t=e,n=t.match(He);for(;n&&n.groups;){const{span:e}=n.groups;t=t.replace(He,e),n=t.match(He)}return t},Je=(e,t,n)=>{const r=e.split(""),o=r[t];return r[t]&&r[n]&&(r[t]=r[n],r[n]=o),r.join("").toString()},qe={placeholderConfig:{hole:"∅",punctuation:"⁂",char:"∴"},globalNodes:["footnote_definition"],shouldSyncNode:({prevNode:e,nextNode:t})=>e.inlineContent&&t&&e.type===t.type&&!e.eq(t),movePlaceholder:(e,t)=>{const n=["*","_"];let r=t.indexOf(e);for(;n.includes(t[r-1]||"")&&n.includes(t[r+1]||"");)t=Je(t,r,r+1),r+=1;return t}},Ue=(0,r.Qx)(qe,"inlineSyncConfig");C(Ue,{displayName:"Ctx<inlineSyncConfig>",group:"Prose"});const Ye=e=>e.split("\n\n")[0]||"",Ze=(e,t)=>{try{const n=((e,t)=>{const{globalNodes:n}=e.get(Ue.key),r=[];return t.doc.descendants((e=>{if(n.includes(e.type.name)||n.includes(e.type))return r.push(e),!1})),r})(e,t),i=(e=>e.selection.$from.node())(t),s=((e,t,n,r)=>e.get(o.M)(t.schema.topNodeType.create(void 0,[n,...r])))(e,t,i,n),[a,l]=((e,t)=>{const n=e.get(Ue.key),o=n.placeholderConfig.hole,[i="",...s]=t.split("\n\n");let a=(0,r.Fs)((e=>t=>t.replace((e=>new RegExp(`\\\\(?=[^\\w\\s${e}\\\\]|_)`,"g"))(e),""))(o),(e=>n.movePlaceholder(o,e)),Ke)(i);const l=(e=>t=>{const n=t.indexOf(e.hole),r=t.charAt(n-1),o=t.charAt(n+1),i=/[^\w]|_/;return o?r&&i.test(r)&&i.test(o)?e.punctuation:e.char:e.punctuation})(n.placeholderConfig)(a);return a=a.replace(o,l),a=[a,...s].join("\n\n"),[a,l]})(e,s),c=((e,t)=>{const n=e.get(o.bQ)(t);return n?n.firstChild:null})(e,a);return!c||i.type!==c.type||(e=>1===e.childCount&&"html"===e.child(0).type.name)(c)?null:(c.attrs={...i.attrs},c.descendants((e=>{var t;const n=e.marks.find((e=>"link"===e.type.name));n&&(null==(t=e.text)?void 0:t.includes(l))&&n.attrs.href.includes(l)&&(n.attrs.href=n.attrs.href.replace(l,""))})),{text:Ye(a),prevNode:i,nextNode:c,placeholder:l})}catch{return null}},Ge=(0,r.Gf)((e=>{let t=null;const n=new p.hs("MILKDOWN_INLINE_SYNC");return new p.k_({key:n,state:{init:()=>null,apply:(r,i,s,a)=>{var l;const c=e.get(o.kY);if(null==(l=c.hasFocus)||!l.call(c)||!c.editable||!r.docChanged||r.getMeta(n))return null;const u=Ze(e,a);if(!u)return null;t&&(cancelAnimationFrame(t),t=null);const{prevNode:d,nextNode:h,text:f}=u,{shouldSyncNode:m}=e.get(Ue.key);return m({prevNode:d,nextNode:h,ctx:e,tr:r,text:f})&&(t=requestAnimationFrame((()=>{t=null;const{dispatch:r,state:i}=e.get(o.kY);((e,t,n,r,o)=>{const{placeholderConfig:i}=e.get(Ue.key),s=i.hole;let a=n.tr.setMeta(t,!0).insertText(s,n.selection.from);const l=n.apply(a),c=Ze(e,l);if(!c)return;const{$from:u}=l.selection,d=u.before(),h=u.after(),f=((e,t,n)=>{let r=t,o=!1;return e.descendants((e=>{var t;if(o)return!1;if(e.isText){const i=null==(t=e.text)?void 0:t.indexOf(n);if(null!=i&&i>=0)return o=!0,r+=i,!1}r+=e.nodeSize})),r})(c.nextNode,d,c.placeholder);a=a.replaceWith(d,h,c.nextNode).setNodeMarkup(d,void 0,o).delete(f+1,f+2),a=a.setSelection(p.U3.near(a.doc.resolve(f+1))),r(a)})(e,n,i,r,d.attrs)})),r.setMeta("addToHistory",!1)),null}}})}));C(Ge,{displayName:"Prose<inlineSyncPlugin>",group:"Prose"});const Qe=(0,r.lz)((()=>()=>e=>{v(e,"list",(e=>{if(e.ordered){const t=e.start??1;e.children.forEach(((e,n)=>{e.label=n+t}))}}))}));C(Qe,{displayName:"Remark<remarkAddOrderInListPlugin>",group:"Remark"});const Xe=(0,r.lz)((()=>()=>e=>{const t=/[\t ]*(?:\r?\n|\r)/g;v(e,"text",((e,n,r)=>{if(!e.value||"string"!=typeof e.value)return;const o=[];let i=0;t.lastIndex=0;let s=t.exec(e.value);for(;s;){const n=s.index;i!==n&&o.push({type:"text",value:e.value.slice(i,n)}),o.push({type:"break",data:{isInline:!0}}),i=n+s[0].length,s=t.exec(e.value)}return o.length>0&&r&&"number"==typeof n?(i<e.value.length&&o.push({type:"text",value:e.value.slice(i)}),r.children.splice(n,1,...o),n+o.length):void 0}))}));C(Xe,{displayName:"Remark<remarkLineBreak>",group:"Remark"});const et=(0,r.lz)((()=>b));C(et,{displayName:"Remark<remarkInlineLinkPlugin>",group:"Remark"});const tt=(0,r.lz)((()=>()=>e=>{!function(e){(function e(t,n,r){if((e=>!!e.children)(t)){const n=[];for(let r=0,o=t.children.length;r<o;r++){const o=t.children[r];if(o){const i=e(o,r,t);if(i)for(let e=0,t=i.length;e<t;e++){const t=i[e];t&&n.push(t)}}}t.children=n}return((e,t,n)=>(e=>"html"===e.type)(e)?("root"===(null==n?void 0:n.type)&&(e.children=[{...e}],delete e.value,e.type="paragraph"),[e]):[e])(t,0,r)})(e,0,null)[0]}(e)}));C(tt,{displayName:"Remark<remarkHtmlTransformer>",group:"Remark"});const nt=(0,r.Gf)((()=>{let e=!1;const t=new p.hs("MILKDOWN_INLINE_NODES_CURSOR"),n=new p.k_({key:t,state:{init:()=>!1,apply(e){if(!e.selection.empty)return!1;const t=e.selection.$from,n=t.nodeBefore,r=t.nodeAfter;return!(!(n&&r&&n.isInline&&!n.isText&&r.isInline)||r.isText)}},props:{handleDOMEvents:{compositionend:(t,r)=>!!e&&(e=!1,requestAnimationFrame((()=>{if(n.getState(t.state)){const e=t.state.selection.from;r.preventDefault(),t.dispatch(t.state.tr.insertText(r.data||"",e))}})),!0),compositionstart:t=>(n.getState(t.state)&&(e=!0),!1),beforeinput:(t,r)=>{if(n.getState(t.state)&&r instanceof InputEvent&&r.data&&!e){const e=t.state.selection.from;return r.preventDefault(),t.dispatch(t.state.tr.insertText(r.data||"",e)),!0}return!1}},decorations(e){if(n.getState(e)){const t=e.selection.$from.pos,n=document.createElement("span"),r=g.NZ.widget(t,n,{side:-1}),o=document.createElement("span"),i=g.NZ.widget(t,o);return setTimeout((()=>{n.contentEditable="true",o.contentEditable="true"})),g.zF.create(e.doc,[r,i])}return g.zF.empty}}});return n}));C(nt,{displayName:"Prose<inlineNodesCursorPlugin>",group:"Prose"});const rt=(0,r.Gf)((()=>new p.k_({key:new p.hs("MILKDOWN_HARDBREAK_MARKS"),appendTransaction:(e,t,n)=>{if(!e.length)return;const[r]=e;if(!r)return;const[o]=r.steps;if(r.getMeta("hardbreak")){if(!(o instanceof m.Ln))return;const{from:e}=o;return n.tr.setNodeMarkup(e,fe.type(),void 0,[])}if(o instanceof m.XE){let e=n.tr;const{from:t,to:r}=o;return n.doc.nodesBetween(t,r,((t,n)=>{t.type===fe.type()&&(e=e.setNodeMarkup(n,fe.type(),void 0,[]))})),e}}})));C(rt,{displayName:"Prose<hardbreakClearMarkPlugin>",group:"Prose"});const ot=(0,r.Qx)(["table","code_block"],"hardbreakFilterNodes");C(ot,{displayName:"Ctx<hardbreakFilterNodes>",group:"Prose"});const it=(0,r.Gf)((e=>{const t=e.get(ot.key);return new p.k_({key:new p.hs("MILKDOWN_HARDBREAK_FILTER"),filterTransaction:(e,n)=>{const r=e.getMeta("hardbreak"),[o]=e.steps;if(r&&o){const{from:e}=o,r=n.doc.resolve(e);let i=r.depth,s=!0;for(;i>0;)t.includes(r.node(i).type.name)&&(s=!1),i--;return s}return!0}})}));C(it,{displayName:"Prose<hardbreakFilterPlugin>",group:"Prose"});const st=(0,r.Gf)((e=>{const t=new p.hs("MILKDOWN_HEADING_ID"),n=n=>{if(n.composing||!n.editable)return;const r=e.get(J.key),o=n.state.tr.setMeta("addToHistory",!1);let i=!1;n.state.doc.descendants(((e,n)=>{if(e.type===U.type()){if(0===e.textContent.trim().length)return;const s=e.attrs,a=r(e);s.id!==a&&(i=!0,o.setMeta(t,!0).setNodeMarkup(n,void 0,{...s,id:a}))}})),i&&n.dispatch(o)};return new p.k_({key:t,view:e=>(n(e),{update:e=>{n(e)}})})}));C(st,{displayName:"Prose<syncHeadingIdPlugin>",group:"Prose"});const at=(0,r.Gf)((()=>{const e=e=>{if(e.composing||!e.editable)return;const t=Oe.type(),n=xe.type(),r=Fe.type(),o=e.state,i=(e,t)=>{let n=!1;const r=`${t+1}.`;return e.label!==r&&(e.label=r,n=!0),n};let s=o.tr,a=!1;o.doc.descendants(((e,o,l,c)=>{if(e.type===n){const n=e.maybeChild(0);(null==n?void 0:n.type)===r&&"ordered"===n.attrs.listType&&(a=!0,s.setNodeMarkup(o,t,{spread:"true"}),e.descendants(((e,t,n,o)=>{if(e.type===r){const n={...e.attrs};i(n,o)&&(s=s.setNodeMarkup(t,void 0,n))}return!1})))}else if(e.type===r&&(null==l?void 0:l.type)===t){const t={...e.attrs};let n=!1;"ordered"!==t.listType&&(t.listType="ordered",n=!0),(null==l?void 0:l.maybeChild(0))&&(n=i(t,c)),n&&(s=s.setNodeMarkup(o,void 0,t),a=!0)}})),a&&e.dispatch(s.setMeta("addToHistory",!1))};return new p.k_({key:new p.hs("MILKDOWN_KEEP_LIST_ORDER"),view:t=>(e(t),{update:t=>{e(t)}})})}));C(at,{displayName:"Prose<syncListOrderPlugin>",group:"Prose"});const lt=[je,_e,Ve,We,[Ue,Ge,rt,ot,it,nt,Qe,et,Xe,tt,st,at]].flat()},2113:(e,t,n)=>{"use strict";n.d(t,{KE:()=>fo,CU:()=>Pr,ge:()=>nr,x8:()=>pr,g3:()=>Sr,MD:()=>qr,qf:()=>Jr,CI:()=>Ar,Sr:()=>Dr,kY:()=>Br,QM:()=>zr,f4:()=>ir,aD:()=>cr,u7:()=>yr,pe:()=>lr,P_:()=>gr,bQ:()=>br,TP:()=>sr,eM:()=>ar,k:()=>$r,pZ:()=>mr,M:()=>Nr});var r={};n.r(r),n.d(r,{attentionMarkers:()=>Se,contentInitial:()=>ve,disable:()=>Me,document:()=>ye,flow:()=>ke,flowInitial:()=>we,insideSpan:()=>Ce,string:()=>be,text:()=>xe});var o=n(7488),i=n(6090);const s={};function a(e,t){const n=t||s;return l(e,"boolean"!=typeof n.includeImageAlt||n.includeImageAlt,"boolean"!=typeof n.includeHtml||n.includeHtml)}function l(e,t,n){if(function(e){return Boolean(e&&"object"==typeof e)}(e)){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return c(e.children,t,n)}return Array.isArray(e)?c(e,t,n):""}function c(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=l(e[o],t,n);return r.join("")}var u=n(660),d=n(7508),h=n(7884);const p={tokenize:function(e){const t=e.attempt(this.parser.constructs.contentInitial,(function(n){if(null!==n)return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),(0,d.N)(e,t,"linePrefix");e.consume(n)}),(function(t){return e.enter("paragraph"),r(t)}));let n;return t;function r(t){const r=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){return null===t?(e.exit("chunkText"),e.exit("paragraph"),void e.consume(t)):(0,h.HP)(t)?(e.consume(t),e.exit("chunkText"),r):(e.consume(t),o)}}};var f=n(3890);const m={tokenize:function(e){const t=this,n=[];let r,o,i,s=0;return a;function a(r){if(s<n.length){const o=n[s];return t.containerState=o[1],e.attempt(o[0].continuation,l,c)(r)}return c(r)}function l(e){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,r&&b();const n=t.events.length;let o,i=n;for(;i--;)if("exit"===t.events[i][0]&&"chunkFlow"===t.events[i][1].type){o=t.events[i][1].end;break}k(s);let a=n;for(;a<t.events.length;)t.events[a][1].end=Object.assign({},o),a++;return(0,f.m)(t.events,i+1,0,t.events.slice(n)),t.events.length=a,c(e)}return a(e)}function c(o){if(s===n.length){if(!r)return p(o);if(r.currentConstruct&&r.currentConstruct.concrete)return y(o);t.interrupt=Boolean(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(g,u,d)(o)}function u(e){return r&&b(),k(s),p(e)}function d(e){return t.parser.lazy[t.now().line]=s!==n.length,i=t.now().offset,y(e)}function p(n){return t.containerState={},e.attempt(g,m,y)(n)}function m(e){return s++,n.push([t.currentConstruct,t.containerState]),p(e)}function y(n){return null===n?(r&&b(),k(0),void e.consume(n)):(r=r||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:o,_tokenizer:r}),v(n))}function v(n){return null===n?(w(e.exit("chunkFlow"),!0),k(0),void e.consume(n)):(0,h.HP)(n)?(e.consume(n),w(e.exit("chunkFlow")),s=0,t.interrupt=void 0,a):(e.consume(n),v)}function w(e,n){const a=t.sliceStream(e);if(n&&a.push(null),e.previous=o,o&&(o.next=e),o=e,r.defineSkip(e.start),r.write(a),t.parser.lazy[e.start.line]){let e=r.events.length;for(;e--;)if(r.events[e][1].start.offset<i&&(!r.events[e][1].end||r.events[e][1].end.offset>i))return;const n=t.events.length;let o,a,l=n;for(;l--;)if("exit"===t.events[l][0]&&"chunkFlow"===t.events[l][1].type){if(o){a=t.events[l][1].end;break}o=!0}for(k(s),e=n;e<t.events.length;)t.events[e][1].end=Object.assign({},a),e++;(0,f.m)(t.events,l+1,0,t.events.slice(n)),t.events.length=e}}function k(r){let o=n.length;for(;o-- >r;){const r=n[o];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function b(){r.write([null]),o=void 0,r=void 0,t.containerState._closeFlow=void 0}}},g={tokenize:function(e,t,n){return(0,d.N)(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};var y=n(5460);function v(e){const t={};let n,r,o,i,s,a,l,c=-1;for(;++c<e.length;){for(;c in t;)c=t[c];if(n=e[c],c&&"chunkFlow"===n[1].type&&"listItemPrefix"===e[c-1][1].type&&(a=n[1]._tokenizer.events,o=0,o<a.length&&"lineEndingBlank"===a[o][1].type&&(o+=2),o<a.length&&"content"===a[o][1].type))for(;++o<a.length&&"content"!==a[o][1].type;)"chunkText"===a[o][1].type&&(a[o][1]._isInFirstContentOfListItem=!0,o++);if("enter"===n[0])n[1].contentType&&(Object.assign(t,w(e,c)),c=t[c],l=!0);else if(n[1]._container){for(o=c,r=void 0;o--&&(i=e[o],"lineEnding"===i[1].type||"lineEndingBlank"===i[1].type);)"enter"===i[0]&&(r&&(e[r][1].type="lineEndingBlank"),i[1].type="lineEnding",r=o);r&&(n[1].end=Object.assign({},e[r][1].start),s=e.slice(r,c),s.unshift(n),(0,f.m)(e,r,c-r+1,s))}}return!l}function w(e,t){const n=e[t][1],r=e[t][2];let o=t-1;const i=[],s=n._tokenizer||r.parser[n.contentType](n.start),a=s.events,l=[],c={};let u,d,h=-1,p=n,m=0,g=0;const y=[g];for(;p;){for(;e[++o][1]!==p;);i.push(o),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&s.defineSkip(p.start),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(u),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++h<a.length;)"exit"===a[h][0]&&"enter"===a[h-1][0]&&a[h][1].type===a[h-1][1].type&&a[h][1].start.line!==a[h][1].end.line&&(g=h+1,y.push(g),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(s.events=[],p?(p._tokenizer=void 0,p.previous=void 0):y.pop(),h=y.length;h--;){const t=a.slice(y[h],y[h+1]),n=i.pop();l.unshift([n,n+t.length-1]),(0,f.m)(e,n,2,t)}for(h=-1;++h<l.length;)c[m+l[h][0]]=m+l[h][1],m+=l[h][1]-l[h][0]-1;return c}const k={tokenize:function(e,t){let n;return function(t){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(t)};function r(t){return null===t?o(t):(0,h.HP)(t)?e.check(b,i,o)(t):(e.consume(t),r)}function o(n){return e.exit("chunkContent"),e.exit("content"),t(n)}function i(t){return e.consume(t),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}},resolve:function(e){return v(e),e}},b={tokenize:function(e,t,n){const r=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),(0,d.N)(e,o,"linePrefix")};function o(o){if(null===o||(0,h.HP)(o))return n(o);const i=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}},partial:!0},x={tokenize:function(e){const t=this,n=e.attempt(y.B,(function(r){if(null!==r)return e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n;e.consume(r)}),e.attempt(this.parser.constructs.flowInitial,r,(0,d.N)(e,e.attempt(this.parser.constructs.flow,r,e.attempt(k,r)),"linePrefix")));return n;function r(r){if(null!==r)return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n;e.consume(r)}}},C={resolveAll:O()},S=N("string"),M=N("text");function N(e){return{tokenize:function(t){const n=this,r=this.parser.constructs[e],o=t.attempt(r,i,s);return i;function i(e){return l(e)?o(e):s(e)}function s(e){if(null!==e)return t.enter("data"),t.consume(e),a;t.consume(e)}function a(e){return l(e)?(t.exit("data"),o(e)):(t.consume(e),a)}function l(e){if(null===e)return!0;const t=r[e];let o=-1;if(t)for(;++o<t.length;){const e=t[o];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}},resolveAll:O("text"===e?A:void 0)}}function O(e){return function(t,n){let r,o=-1;for(;++o<=t.length;)void 0===r?t[o]&&"data"===t[o][1].type&&(r=o,o++):t[o]&&"data"===t[o][1].type||(o!==r+2&&(t[r][1].end=t[o-1][1].end,t.splice(r+2,o-r-2),o=r+2),r=void 0);return e?e(t,n):t}}function A(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||"lineEnding"===e[n][1].type)&&"data"===e[n-1][1].type){const r=e[n-1][1],o=t.sliceStream(r);let i,s=o.length,a=-1,l=0;for(;s--;){const e=o[s];if("string"==typeof e){for(a=e.length;32===e.charCodeAt(a-1);)l++,a--;if(a)break;a=-1}else if(-2===e)i=!0,l++;else if(-1!==e){s++;break}}if(l){const o={type:n===e.length||i||l<2?"lineSuffix":"hardBreakTrailing",start:{line:r.end.line,column:r.end.column-l,offset:r.end.offset-l,_index:r.start._index+s,_bufferIndex:s?a:r.start._bufferIndex+a},end:Object.assign({},r.end)};r.end=Object.assign({},o.start),r.start.offset===r.end.offset?Object.assign(r,o):(e.splice(n,0,["enter",o,t],["exit",o,t]),n+=2)}n++}return e}var E=n(3796);function D(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const o={},i=[];let s=[],a=[],l=!0;const c={consume:function(e){(0,h.HP)(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,b()):-1!==e&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=e,l=!0},enter:function(e,t){const n=t||{};return n.type=e,n.start=g(),u.events.push(["enter",n,u]),a.push(n),n},exit:function(e){const t=a.pop();return t.end=g(),u.events.push(["exit",t,u]),t},attempt:w((function(e,t){k(e,t.from)})),check:w(v),interrupt:w(v,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:m,sliceSerialize:function(e,t){return function(e,t){let n=-1;const r=[];let o;for(;++n<e.length;){const i=e[n];let s;if("string"==typeof i)s=i;else switch(i){case-5:s="\r";break;case-4:s="\n";break;case-3:s="\r\n";break;case-2:s=t?" ":"\t";break;case-1:if(!t&&o)continue;s=" ";break;default:s=String.fromCharCode(i)}o=-2===i,r.push(s)}return r.join("")}(m(e),t)},now:g,defineSkip:function(e){o[e.line]=e.column,b()},write:function(e){return s=(0,f.V)(s,e),function(){let e;for(;r._index<s.length;){const t=s[r._index];if("string"==typeof t)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)y(t.charCodeAt(r._bufferIndex));else y(t)}}(),null!==s[s.length-1]?[]:(k(t,0),u.events=(0,E.W)(i,u.events,u),u.events)}};let d,p=t.tokenize.call(u,c);return t.resolveAll&&i.push(t),u;function m(e){return function(e,t){const n=t.start._index,r=t.start._bufferIndex,o=t.end._index,i=t.end._bufferIndex;let s;return n===o?s=[e[n].slice(r,i)]:(s=e.slice(n,o),r>-1&&(s[0]=s[0].slice(r)),i>0&&s.push(e[o].slice(0,i))),s}(s,e)}function g(){return Object.assign({},r)}function y(e){l=void 0,d=e,p=p(e)}function v(e,t){t.restore()}function w(e,t){return function(n,o,i){let s,d,h,p;return Array.isArray(n)?f(n):"tokenize"in n?f([n]):function(e){return function(t){const n=null!==t&&e[t],r=null!==t&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}(n);function f(e){return s=e,d=0,0===e.length?i:m(e[d])}function m(e){return function(n){return p=function(){const e=g(),t=u.previous,n=u.currentConstruct,o=u.events.length,i=Array.from(a);return{restore:function(){r=e,u.previous=t,u.currentConstruct=n,u.events.length=o,a=i,b()},from:o}}(),h=e,e.partial||(u.currentConstruct=e),e.name&&u.parser.constructs.disable.null.includes(e.name)?v():e.tokenize.call(t?Object.assign(Object.create(u),t):u,c,y,v)(n)}}function y(t){return l=!0,e(h,p),o}function v(e){return l=!0,p.restore(),++d<s.length?m(s[d]):i}}}function k(e,t){e.resolveAll&&!i.includes(e)&&i.push(e),e.resolve&&(0,f.m)(u.events,t,u.events.length-t,e.resolve(u.events.slice(t),u)),e.resolveTo&&(u.events=e.resolveTo(u.events,u))}function b(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}const T={name:"thematicBreak",tokenize:function(e,t,n){let r,o=0;return function(t){return e.enter("thematicBreak"),function(e){return r=e,i(e)}(t)};function i(i){return i===r?(e.enter("thematicBreakSequence"),s(i)):o>=3&&(null===i||(0,h.HP)(i))?(e.exit("thematicBreak"),t(i)):n(i)}function s(t){return t===r?(e.consume(t),o++,s):(e.exit("thematicBreakSequence"),(0,h.On)(t)?(0,d.N)(e,i,"whitespace")(t):i(t))}}},F={name:"list",tokenize:function(e,t,n){const r=this,o=r.events[r.events.length-1];let i=o&&"linePrefix"===o[1].type?o[2].sliceSerialize(o[1],!0).length:0,s=0;return function(t){const o=r.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===o?!r.containerState.marker||t===r.containerState.marker:(0,h.BM)(t)){if(r.containerState.type||(r.containerState.type=o,e.enter(o,{_container:!0})),"listUnordered"===o)return e.enter("listItemPrefix"),42===t||45===t?e.check(T,n,l)(t):l(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),a(t)}return n(t)};function a(t){return(0,h.BM)(t)&&++s<10?(e.consume(t),a):(!r.interrupt||s<2)&&(r.containerState.marker?t===r.containerState.marker:41===t||46===t)?(e.exit("listItemValue"),l(t)):n(t)}function l(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||t,e.check(y.B,r.interrupt?n:c,e.attempt(I,d,u))}function c(e){return r.containerState.initialBlankLine=!0,i++,d(e)}function u(t){return(0,h.On)(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),d):n(t)}function d(n){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}},continuation:{tokenize:function(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(y.B,(function(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,(0,d.N)(e,t,"listItemIndent",r.containerState.size+1)(n)}),(function(n){return r.containerState.furtherBlankLines||!(0,h.On)(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(R,t,o)(n))}));function o(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,(0,d.N)(e,e.attempt(F,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}},exit:function(e){e.exit(this.containerState.type)}},I={tokenize:function(e,t,n){const r=this;return(0,d.N)(e,(function(e){const o=r.events[r.events.length-1];return!(0,h.On)(e)&&o&&"listItemPrefixWhitespace"===o[1].type?t(e):n(e)}),"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)},partial:!0},R={tokenize:function(e,t,n){const r=this;return(0,d.N)(e,(function(e){const o=r.events[r.events.length-1];return o&&"listItemIndent"===o[1].type&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(e):n(e)}),"listItemIndent",r.containerState.size+1)},partial:!0},P={name:"blockQuote",tokenize:function(e,t,n){const r=this;return function(t){if(62===t){const n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),o}return n(t)};function o(n){return(0,h.On)(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}},continuation:{tokenize:function(e,t,n){const r=this;return function(t){return(0,h.On)(t)?(0,d.N)(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):o(t)};function o(r){return e.attempt(P,t,n)(r)}}},exit:function(e){e.exit("blockQuote")}};function B(e,t,n,r,o,i,s,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return function(t){return 60===t?(e.enter(r),e.enter(o),e.enter(i),e.consume(t),e.exit(i),d):null===t||41===t||(0,h.JQ)(t)?n(t):(e.enter(r),e.enter(s),e.enter(a),e.enter("chunkString",{contentType:"string"}),m(t))};function d(n){return 62===n?(e.enter(i),e.consume(n),e.exit(i),e.exit(o),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(n))}function p(t){return 62===t?(e.exit("chunkString"),e.exit(a),d(t)):null===t||60===t||(0,h.HP)(t)?n(t):(e.consume(t),92===t?f:p)}function f(t){return 60===t||62===t||92===t?(e.consume(t),p):p(t)}function m(o){return 40===o?++u>c?n(o):(e.consume(o),m):41===o?u--?(e.consume(o),m):(e.exit("chunkString"),e.exit(a),e.exit(s),e.exit(r),t(o)):null===o||(0,h.Ee)(o)?u?n(o):(e.exit("chunkString"),e.exit(a),e.exit(s),e.exit(r),t(o)):(0,h.JQ)(o)?n(o):(e.consume(o),92===o?g:m)}function g(t){return 40===t||41===t||92===t?(e.consume(t),m):m(t)}}function L(e,t,n,r,o,i){const s=this;let a,l=0;return function(t){return e.enter(r),e.enter(o),e.consume(t),e.exit(o),e.enter(i),c};function c(d){return null===d||91===d||93===d&&!a||94===d&&!l&&"_hiddenFootnoteSupport"in s.parser.constructs||l>999?n(d):93===d?(e.exit(i),e.enter(o),e.consume(d),e.exit(o),e.exit(r),t):(0,h.HP)(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),u(d))}function u(t){return null===t||91===t||93===t||(0,h.HP)(t)||l++>999?(e.exit("chunkString"),c(t)):(e.consume(t),a=a||!(0,h.On)(t),92===t?d:u)}function d(t){return 91===t||92===t||93===t?(e.consume(t),l++,u):u(t)}}function z(e,t,n,r,o,i){let s;return function(t){return e.enter(r),e.enter(o),e.consume(t),e.exit(o),s=40===t?41:t,a};function a(n){return n===s?(e.enter(o),e.consume(n),e.exit(o),e.exit(r),t):(e.enter(i),l(n))}function l(t){return t===s?(e.exit(i),a(s)):null===t?n(t):(0,h.HP)(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),(0,d.N)(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(t))}function c(t){return t===s||null===t||(0,h.HP)(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?u:c)}function u(t){return t===s||92===t?(e.consume(t),c):c(t)}}function $(e,t){let n;return function r(o){return(0,h.HP)(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):(0,h.On)(o)?(0,d.N)(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}var j=n(6243);const _={name:"definition",tokenize:function(e,t,n){const r=this;let o;return function(t){return e.enter("definition"),function(t){return L.call(r,e,i,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(t)}(t)};function i(t){return o=(0,j.B)(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),s):n(t)}function s(t){return(0,h.Ee)(t)?$(e,a)(t):a(t)}function a(t){return B(e,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(V,c,c)(t)}function c(t){return(0,h.On)(t)?(0,d.N)(e,u,"whitespace")(t):u(t)}function u(i){return null===i||(0,h.HP)(i)?(e.exit("definition"),r.parser.defined.push(o),t(i)):n(i)}}},V={tokenize:function(e,t,n){return function(t){return(0,h.Ee)(t)?$(e,r)(t):n(t)};function r(t){return z(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function o(t){return(0,h.On)(t)?(0,d.N)(e,i,"whitespace")(t):i(t)}function i(e){return null===e||(0,h.HP)(e)?t(e):n(e)}},partial:!0},W={name:"codeIndented",tokenize:function(e,t,n){const r=this;return function(t){return e.enter("codeIndented"),(0,d.N)(e,o,"linePrefix",5)(t)};function o(e){const t=r.events[r.events.length-1];return t&&"linePrefix"===t[1].type&&t[2].sliceSerialize(t[1],!0).length>=4?i(e):n(e)}function i(t){return null===t?a(t):(0,h.HP)(t)?e.attempt(H,i,a)(t):(e.enter("codeFlowValue"),s(t))}function s(t){return null===t||(0,h.HP)(t)?(e.exit("codeFlowValue"),i(t)):(e.consume(t),s)}function a(n){return e.exit("codeIndented"),t(n)}}},H={tokenize:function(e,t,n){const r=this;return o;function o(t){return r.parser.lazy[r.now().line]?n(t):(0,h.HP)(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o):(0,d.N)(e,i,"linePrefix",5)(t)}function i(e){const i=r.events[r.events.length-1];return i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?t(e):(0,h.HP)(e)?o(e):n(e)}},partial:!0},K={name:"headingAtx",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("atxHeading"),function(t){return e.enter("atxHeadingSequence"),o(t)}(t)};function o(t){return 35===t&&r++<6?(e.consume(t),o):null===t||(0,h.Ee)(t)?(e.exit("atxHeadingSequence"),i(t)):n(t)}function i(n){return 35===n?(e.enter("atxHeadingSequence"),s(n)):null===n||(0,h.HP)(n)?(e.exit("atxHeading"),t(n)):(0,h.On)(n)?(0,d.N)(e,i,"whitespace")(n):(e.enter("atxHeadingText"),a(n))}function s(t){return 35===t?(e.consume(t),s):(e.exit("atxHeadingSequence"),i(t))}function a(t){return null===t||35===t||(0,h.Ee)(t)?(e.exit("atxHeadingText"),i(t)):(e.consume(t),a)}},resolve:function(e,t){let n,r,o=e.length-2,i=3;return"whitespace"===e[i][1].type&&(i+=2),o-2>i&&"whitespace"===e[o][1].type&&(o-=2),"atxHeadingSequence"===e[o][1].type&&(i===o-1||o-4>i&&"whitespace"===e[o-2][1].type)&&(o-=i+1===o?2:4),o>i&&(n={type:"atxHeadingText",start:e[i][1].start,end:e[o][1].end},r={type:"chunkText",start:e[i][1].start,end:e[o][1].end,contentType:"text"},(0,f.m)(e,i,o-i+1,[["enter",n,t],["enter",r,t],["exit",r,t],["exit",n,t]])),e}},J={name:"setextUnderline",tokenize:function(e,t,n){const r=this;let o;return function(t){let s,a=r.events.length;for(;a--;)if("lineEnding"!==r.events[a][1].type&&"linePrefix"!==r.events[a][1].type&&"content"!==r.events[a][1].type){s="paragraph"===r.events[a][1].type;break}return r.parser.lazy[r.now().line]||!r.interrupt&&!s?n(t):(e.enter("setextHeadingLine"),o=t,function(t){return e.enter("setextHeadingLineSequence"),i(t)}(t))};function i(t){return t===o?(e.consume(t),i):(e.exit("setextHeadingLineSequence"),(0,h.On)(t)?(0,d.N)(e,s,"lineSuffix")(t):s(t))}function s(r){return null===r||(0,h.HP)(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}},resolveTo:function(e,t){let n,r,o,i=e.length;for(;i--;)if("enter"===e[i][0]){if("content"===e[i][1].type){n=i;break}"paragraph"===e[i][1].type&&(r=i)}else"content"===e[i][1].type&&e.splice(i,1),o||"definition"!==e[i][1].type||(o=i);const s={type:"setextHeading",start:Object.assign({},e[r][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[r][1].type="setextHeadingText",o?(e.splice(r,0,["enter",s,t]),e.splice(o+1,0,["exit",e[n][1],t]),e[n][1].end=Object.assign({},e[o][1].end)):e[n][1]=s,e.push(["exit",s,t]),e}},q=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],U=["pre","script","style","textarea"],Y={name:"htmlFlow",tokenize:function(e,t,n){const r=this;let o,i,s,a,l;return function(t){return function(t){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(t),c}(t)};function c(a){return 33===a?(e.consume(a),u):47===a?(e.consume(a),i=!0,f):63===a?(e.consume(a),o=3,r.interrupt?t:P):(0,h.CW)(a)?(e.consume(a),s=String.fromCharCode(a),m):n(a)}function u(i){return 45===i?(e.consume(i),o=2,d):91===i?(e.consume(i),o=5,a=0,p):(0,h.CW)(i)?(e.consume(i),o=4,r.interrupt?t:P):n(i)}function d(o){return 45===o?(e.consume(o),r.interrupt?t:P):n(o)}function p(o){return o==="CDATA[".charCodeAt(a++)?(e.consume(o),6===a?r.interrupt?t:O:p):n(o)}function f(t){return(0,h.CW)(t)?(e.consume(t),s=String.fromCharCode(t),m):n(t)}function m(a){if(null===a||47===a||62===a||(0,h.Ee)(a)){const l=47===a,c=s.toLowerCase();return l||i||!U.includes(c)?q.includes(s.toLowerCase())?(o=6,l?(e.consume(a),g):r.interrupt?t(a):O(a)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(a):i?y(a):v(a)):(o=1,r.interrupt?t(a):O(a))}return 45===a||(0,h.lV)(a)?(e.consume(a),s+=String.fromCharCode(a),m):n(a)}function g(o){return 62===o?(e.consume(o),r.interrupt?t:O):n(o)}function y(t){return(0,h.On)(t)?(e.consume(t),y):M(t)}function v(t){return 47===t?(e.consume(t),M):58===t||95===t||(0,h.CW)(t)?(e.consume(t),w):(0,h.On)(t)?(e.consume(t),v):M(t)}function w(t){return 45===t||46===t||58===t||95===t||(0,h.lV)(t)?(e.consume(t),w):k(t)}function k(t){return 61===t?(e.consume(t),b):(0,h.On)(t)?(e.consume(t),k):v(t)}function b(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),l=t,x):(0,h.On)(t)?(e.consume(t),b):C(t)}function x(t){return t===l?(e.consume(t),l=null,S):null===t||(0,h.HP)(t)?n(t):(e.consume(t),x)}function C(t){return null===t||34===t||39===t||47===t||60===t||61===t||62===t||96===t||(0,h.Ee)(t)?k(t):(e.consume(t),C)}function S(e){return 47===e||62===e||(0,h.On)(e)?v(e):n(e)}function M(t){return 62===t?(e.consume(t),N):n(t)}function N(t){return null===t||(0,h.HP)(t)?O(t):(0,h.On)(t)?(e.consume(t),N):n(t)}function O(t){return 45===t&&2===o?(e.consume(t),T):60===t&&1===o?(e.consume(t),F):62===t&&4===o?(e.consume(t),B):63===t&&3===o?(e.consume(t),P):93===t&&5===o?(e.consume(t),R):!(0,h.HP)(t)||6!==o&&7!==o?null===t||(0,h.HP)(t)?(e.exit("htmlFlowData"),A(t)):(e.consume(t),O):(e.exit("htmlFlowData"),e.check(Z,L,A)(t))}function A(t){return e.check(G,E,L)(t)}function E(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),D}function D(t){return null===t||(0,h.HP)(t)?A(t):(e.enter("htmlFlowData"),O(t))}function T(t){return 45===t?(e.consume(t),P):O(t)}function F(t){return 47===t?(e.consume(t),s="",I):O(t)}function I(t){if(62===t){const n=s.toLowerCase();return U.includes(n)?(e.consume(t),B):O(t)}return(0,h.CW)(t)&&s.length<8?(e.consume(t),s+=String.fromCharCode(t),I):O(t)}function R(t){return 93===t?(e.consume(t),P):O(t)}function P(t){return 62===t?(e.consume(t),B):45===t&&2===o?(e.consume(t),P):O(t)}function B(t){return null===t||(0,h.HP)(t)?(e.exit("htmlFlowData"),L(t)):(e.consume(t),B)}function L(n){return e.exit("htmlFlow"),t(n)}},resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e},concrete:!0},Z={tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(y.B,t,n)}},partial:!0},G={tokenize:function(e,t,n){const r=this;return function(t){return(0,h.HP)(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o):n(t)};function o(e){return r.parser.lazy[r.now().line]?n(e):t(e)}},partial:!0},Q={tokenize:function(e,t,n){const r=this;return function(t){return null===t?n(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o)};function o(e){return r.parser.lazy[r.now().line]?n(e):t(e)}},partial:!0},X={name:"codeFenced",tokenize:function(e,t,n){const r=this,o={tokenize:function(e,t,n){let o=0;return function(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),s};function s(t){return e.enter("codeFencedFence"),(0,h.On)(t)?(0,d.N)(e,l,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):l(t)}function l(t){return t===i?(e.enter("codeFencedFenceSequence"),c(t)):n(t)}function c(t){return t===i?(o++,e.consume(t),c):o>=a?(e.exit("codeFencedFenceSequence"),(0,h.On)(t)?(0,d.N)(e,u,"whitespace")(t):u(t)):n(t)}function u(r){return null===r||(0,h.HP)(r)?(e.exit("codeFencedFence"),t(r)):n(r)}},partial:!0};let i,s=0,a=0;return function(t){return function(t){const n=r.events[r.events.length-1];return s=n&&"linePrefix"===n[1].type?n[2].sliceSerialize(n[1],!0).length:0,i=t,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),l(t)}(t)};function l(t){return t===i?(a++,e.consume(t),l):a<3?n(t):(e.exit("codeFencedFenceSequence"),(0,h.On)(t)?(0,d.N)(e,c,"whitespace")(t):c(t))}function c(n){return null===n||(0,h.HP)(n)?(e.exit("codeFencedFence"),r.interrupt?t(n):e.check(Q,m,k)(n)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),u(n))}function u(t){return null===t||(0,h.HP)(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(t)):(0,h.On)(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),(0,d.N)(e,p,"whitespace")(t)):96===t&&t===i?n(t):(e.consume(t),u)}function p(t){return null===t||(0,h.HP)(t)?c(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),f(t))}function f(t){return null===t||(0,h.HP)(t)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(t)):96===t&&t===i?n(t):(e.consume(t),f)}function m(t){return e.attempt(o,k,g)(t)}function g(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),y}function y(t){return s>0&&(0,h.On)(t)?(0,d.N)(e,v,"linePrefix",s+1)(t):v(t)}function v(t){return null===t||(0,h.HP)(t)?e.check(Q,m,k)(t):(e.enter("codeFlowValue"),w(t))}function w(t){return null===t||(0,h.HP)(t)?(e.exit("codeFlowValue"),v(t)):(e.consume(t),w)}function k(n){return e.exit("codeFenced"),t(n)}},concrete:!0};var ee=n(1157);const te={name:"characterReference",tokenize:function(e,t,n){const r=this;let o,i,s=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),a};function a(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),o=31,i=h.lV,c(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,i=h.ok,c):(e.enter("characterReferenceValue"),o=7,i=h.BM,c(t))}function c(a){if(59===a&&s){const o=e.exit("characterReferenceValue");return i!==h.lV||(0,ee.s)(r.sliceSerialize(o))?(e.enter("characterReferenceMarker"),e.consume(a),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(a)}return i(a)&&s++<o?(e.consume(a),c):n(a)}}},ne={name:"characterEscape",tokenize:function(e,t,n){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),r};function r(r){return(0,h.ol)(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}},re={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),(0,d.N)(e,t,"linePrefix")}}},oe={name:"labelEnd",tokenize:function(e,t,n){const r=this;let o,i,s=r.events.length;for(;s--;)if(("labelImage"===r.events[s][1].type||"labelLink"===r.events[s][1].type)&&!r.events[s][1]._balanced){o=r.events[s][1];break}return function(t){return o?o._inactive?u(t):(i=r.parser.defined.includes((0,j.B)(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),a):n(t)};function a(t){return 40===t?e.attempt(ie,c,i?c:u)(t):91===t?e.attempt(se,c,i?l:u)(t):i?c(t):u(t)}function l(t){return e.attempt(ae,c,u)(t)}function c(e){return t(e)}function u(e){return o._balanced=!0,n(e)}},resolveTo:function(e,t){let n,r,o,i,s=e.length,a=0;for(;s--;)if(n=e[s][1],r){if("link"===n.type||"labelLink"===n.type&&n._inactive)break;"enter"===e[s][0]&&"labelLink"===n.type&&(n._inactive=!0)}else if(o){if("enter"===e[s][0]&&("labelImage"===n.type||"labelLink"===n.type)&&!n._balanced&&(r=s,"labelLink"!==n.type)){a=2;break}}else"labelEnd"===n.type&&(o=s);const l={type:"labelLink"===e[r][1].type?"link":"image",start:Object.assign({},e[r][1].start),end:Object.assign({},e[e.length-1][1].end)},c={type:"label",start:Object.assign({},e[r][1].start),end:Object.assign({},e[o][1].end)},u={type:"labelText",start:Object.assign({},e[r+a+2][1].end),end:Object.assign({},e[o-2][1].start)};return i=[["enter",l,t],["enter",c,t]],i=(0,f.V)(i,e.slice(r+1,r+a+3)),i=(0,f.V)(i,[["enter",u,t]]),i=(0,f.V)(i,(0,E.W)(t.parser.constructs.insideSpan.null,e.slice(r+a+4,o-3),t)),i=(0,f.V)(i,[["exit",u,t],e[o-2],e[o-1],["exit",c,t]]),i=(0,f.V)(i,e.slice(o+1)),i=(0,f.V)(i,[["exit",l,t]]),(0,f.m)(e,r,e.length,i),e},resolveAll:function(e){let t=-1;for(;++t<e.length;){const n=e[t][1];"labelImage"!==n.type&&"labelLink"!==n.type&&"labelEnd"!==n.type||(e.splice(t+1,"labelImage"===n.type?4:2),n.type="data",t++)}return e}},ie={tokenize:function(e,t,n){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),r};function r(t){return(0,h.Ee)(t)?$(e,o)(t):o(t)}function o(t){return 41===t?c(t):B(e,i,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function i(t){return(0,h.Ee)(t)?$(e,a)(t):c(t)}function s(e){return n(e)}function a(t){return 34===t||39===t||40===t?z(e,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):c(t)}function l(t){return(0,h.Ee)(t)?$(e,c)(t):c(t)}function c(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),t):n(r)}}},se={tokenize:function(e,t,n){const r=this;return function(t){return L.call(r,e,o,i,"reference","referenceMarker","referenceString")(t)};function o(e){return r.parser.defined.includes((0,j.B)(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function i(e){return n(e)}}},ae={tokenize:function(e,t,n){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),r};function r(r){return 93===r?(e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),e.exit("reference"),t):n(r)}}},le={name:"labelStartImage",tokenize:function(e,t,n){const r=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),o};function o(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),i):n(t)}function i(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}},resolveAll:oe.resolveAll};var ce=n(6990);const ue={name:"attention",tokenize:function(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=(0,ce.S)(r);let i;return function(t){return i=t,e.enter("attentionSequence"),s(t)};function s(a){if(a===i)return e.consume(a),s;const l=e.exit("attentionSequence"),c=(0,ce.S)(a),u=!c||2===c&&o||n.includes(a),d=!o||2===o&&c||n.includes(r);return l._open=Boolean(42===i?u:u&&(o||!d)),l._close=Boolean(42===i?d:d&&(c||!u)),t(a)}},resolveAll:function(e,t){let n,r,o,i,s,a,l,c,u=-1;for(;++u<e.length;)if("enter"===e[u][0]&&"attentionSequence"===e[u][1].type&&e[u][1]._close)for(n=u;n--;)if("exit"===e[n][0]&&"attentionSequence"===e[n][1].type&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[u][1]).charCodeAt(0)){if((e[n][1]._close||e[u][1]._open)&&(e[u][1].end.offset-e[u][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[u][1].end.offset-e[u][1].start.offset)%3))continue;a=e[n][1].end.offset-e[n][1].start.offset>1&&e[u][1].end.offset-e[u][1].start.offset>1?2:1;const d=Object.assign({},e[n][1].end),h=Object.assign({},e[u][1].start);de(d,-a),de(h,a),i={type:a>1?"strongSequence":"emphasisSequence",start:d,end:Object.assign({},e[n][1].end)},s={type:a>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[u][1].start),end:h},o={type:a>1?"strongText":"emphasisText",start:Object.assign({},e[n][1].end),end:Object.assign({},e[u][1].start)},r={type:a>1?"strong":"emphasis",start:Object.assign({},i.start),end:Object.assign({},s.end)},e[n][1].end=Object.assign({},i.start),e[u][1].start=Object.assign({},s.end),l=[],e[n][1].end.offset-e[n][1].start.offset&&(l=(0,f.V)(l,[["enter",e[n][1],t],["exit",e[n][1],t]])),l=(0,f.V)(l,[["enter",r,t],["enter",i,t],["exit",i,t],["enter",o,t]]),l=(0,f.V)(l,(0,E.W)(t.parser.constructs.insideSpan.null,e.slice(n+1,u),t)),l=(0,f.V)(l,[["exit",o,t],["enter",s,t],["exit",s,t],["exit",r,t]]),e[u][1].end.offset-e[u][1].start.offset?(c=2,l=(0,f.V)(l,[["enter",e[u][1],t],["exit",e[u][1],t]])):c=0,(0,f.m)(e,n-1,u-n+3,l),u=n+l.length-c-2;break}for(u=-1;++u<e.length;)"attentionSequence"===e[u][1].type&&(e[u][1].type="data");return e}};function de(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const he={name:"autolink",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o};function o(t){return(0,h.CW)(t)?(e.consume(t),i):l(t)}function i(e){return 43===e||45===e||46===e||(0,h.lV)(e)?(r=1,s(e)):l(e)}function s(t){return 58===t?(e.consume(t),r=0,a):(43===t||45===t||46===t||(0,h.lV)(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function a(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),t):null===r||32===r||60===r||(0,h.JQ)(r)?n(r):(e.consume(r),a)}function l(t){return 64===t?(e.consume(t),c):(0,h.cx)(t)?(e.consume(t),l):n(t)}function c(e){return(0,h.lV)(e)?u(e):n(e)}function u(n){return 46===n?(e.consume(n),r=0,c):62===n?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(n),e.exit("autolinkMarker"),e.exit("autolink"),t):d(n)}function d(t){if((45===t||(0,h.lV)(t))&&r++<63){const n=45===t?d:u;return e.consume(t),n}return n(t)}}},pe={name:"htmlText",tokenize:function(e,t,n){const r=this;let o,i,s;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),a};function a(t){return 33===t?(e.consume(t),l):47===t?(e.consume(t),x):63===t?(e.consume(t),k):(0,h.CW)(t)?(e.consume(t),M):n(t)}function l(t){return 45===t?(e.consume(t),c):91===t?(e.consume(t),i=0,m):(0,h.CW)(t)?(e.consume(t),w):n(t)}function c(t){return 45===t?(e.consume(t),f):n(t)}function u(t){return null===t?n(t):45===t?(e.consume(t),p):(0,h.HP)(t)?(s=u,R(t)):(e.consume(t),u)}function p(t){return 45===t?(e.consume(t),f):u(t)}function f(e){return 62===e?I(e):45===e?p(e):u(e)}function m(t){return t==="CDATA[".charCodeAt(i++)?(e.consume(t),6===i?g:m):n(t)}function g(t){return null===t?n(t):93===t?(e.consume(t),y):(0,h.HP)(t)?(s=g,R(t)):(e.consume(t),g)}function y(t){return 93===t?(e.consume(t),v):g(t)}function v(t){return 62===t?I(t):93===t?(e.consume(t),v):g(t)}function w(t){return null===t||62===t?I(t):(0,h.HP)(t)?(s=w,R(t)):(e.consume(t),w)}function k(t){return null===t?n(t):63===t?(e.consume(t),b):(0,h.HP)(t)?(s=k,R(t)):(e.consume(t),k)}function b(e){return 62===e?I(e):k(e)}function x(t){return(0,h.CW)(t)?(e.consume(t),C):n(t)}function C(t){return 45===t||(0,h.lV)(t)?(e.consume(t),C):S(t)}function S(t){return(0,h.HP)(t)?(s=S,R(t)):(0,h.On)(t)?(e.consume(t),S):I(t)}function M(t){return 45===t||(0,h.lV)(t)?(e.consume(t),M):47===t||62===t||(0,h.Ee)(t)?N(t):n(t)}function N(t){return 47===t?(e.consume(t),I):58===t||95===t||(0,h.CW)(t)?(e.consume(t),O):(0,h.HP)(t)?(s=N,R(t)):(0,h.On)(t)?(e.consume(t),N):I(t)}function O(t){return 45===t||46===t||58===t||95===t||(0,h.lV)(t)?(e.consume(t),O):A(t)}function A(t){return 61===t?(e.consume(t),E):(0,h.HP)(t)?(s=A,R(t)):(0,h.On)(t)?(e.consume(t),A):N(t)}function E(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),o=t,D):(0,h.HP)(t)?(s=E,R(t)):(0,h.On)(t)?(e.consume(t),E):(e.consume(t),T)}function D(t){return t===o?(e.consume(t),o=void 0,F):null===t?n(t):(0,h.HP)(t)?(s=D,R(t)):(e.consume(t),D)}function T(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||(0,h.Ee)(t)?N(t):(e.consume(t),T)}function F(e){return 47===e||62===e||(0,h.Ee)(e)?N(e):n(e)}function I(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),t):n(r)}function R(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),P}function P(t){return(0,h.On)(t)?(0,d.N)(e,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):B(t)}function B(t){return e.enter("htmlTextData"),s(t)}}},fe={name:"labelStartLink",tokenize:function(e,t,n){const r=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),o};function o(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}},resolveAll:oe.resolveAll},me={name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return(0,h.HP)(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}},ge={name:"codeText",tokenize:function(e,t,n){let r,o,i=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),s(t)};function s(t){return 96===t?(e.consume(t),i++,s):(e.exit("codeTextSequence"),a(t))}function a(t){return null===t?n(t):32===t?(e.enter("space"),e.consume(t),e.exit("space"),a):96===t?(o=e.enter("codeTextSequence"),r=0,c(t)):(0,h.HP)(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a):(e.enter("codeTextData"),l(t))}function l(t){return null===t||32===t||96===t||(0,h.HP)(t)?(e.exit("codeTextData"),a(t)):(e.consume(t),l)}function c(n){return 96===n?(e.consume(n),r++,c):r===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(n)):(o.type="codeTextData",l(n))}},resolve:function(e){let t,n,r=e.length-4,o=3;if(!("lineEnding"!==e[o][1].type&&"space"!==e[o][1].type||"lineEnding"!==e[r][1].type&&"space"!==e[r][1].type))for(t=o;++t<r;)if("codeTextData"===e[t][1].type){e[o][1].type="codeTextPadding",e[r][1].type="codeTextPadding",o+=2,r-=2;break}for(t=o-1,r++;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):t!==r&&"lineEnding"!==e[t][1].type||(e[n][1].type="codeTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e},previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type}},ye={42:F,43:F,45:F,48:F,49:F,50:F,51:F,52:F,53:F,54:F,55:F,56:F,57:F,62:P},ve={91:_},we={[-2]:W,[-1]:W,32:W},ke={35:K,42:T,45:[J,T],60:Y,61:J,95:T,96:X,126:X},be={38:te,92:ne},xe={[-5]:re,[-4]:re,[-3]:re,33:le,38:te,42:ue,60:[he,pe],91:fe,92:[me,ne],93:oe,95:ue,96:ge},Ce={null:[ue,C]},Se={null:[42,95]},Me={null:[]},Ne=/[\0\t\n\r]/g;var Oe=n(9896),Ae=n(7938);function Ee(e){return e&&"object"==typeof e?"position"in e||"type"in e?Te(e.position):"start"in e||"end"in e?Te(e):"line"in e||"column"in e?De(e):"":""}function De(e){return Fe(e&&e.line)+":"+Fe(e&&e.column)}function Te(e){return De(e&&e.start)+"-"+De(e&&e.end)}function Fe(e){return e&&"number"==typeof e?e:1}const Ie={}.hasOwnProperty,Re=function(e,t,n){return"string"!=typeof t&&(n=t,t=void 0),function(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(b),autolinkProtocol:p,autolinkEmail:p,atxHeading:s(v),blockQuote:s((function(){return{type:"blockquote",children:[]}})),characterEscape:p,characterReference:p,codeFenced:s(y),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:s(y,l),codeText:s((function(){return{type:"inlineCode",value:""}}),l),codeTextData:p,data:p,codeFlowValue:p,definition:s((function(){return{type:"definition",identifier:"",label:null,title:null,url:""}})),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:s((function(){return{type:"emphasis",children:[]}})),hardBreakEscape:s(w),hardBreakTrailing:s(w),htmlFlow:s(k,l),htmlFlowData:p,htmlText:s(k,l),htmlTextData:p,image:s((function(){return{type:"image",title:null,url:"",alt:null}})),label:l,link:s(b),listItem:s((function(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}})),listItemValue:function(e){i("expectingFirstListItemValue")&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),o("expectingFirstListItemValue"))},listOrdered:s(x,(function(){o("expectingFirstListItemValue",!0)})),listUnordered:s(x),paragraph:s((function(){return{type:"paragraph",children:[]}})),reference:function(){o("referenceType","collapsed")},referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:s(v),strong:s((function(){return{type:"strong",children:[]}})),thematicBreak:s((function(){return{type:"thematicBreak"}}))},exit:{atxHeading:u(),atxHeadingSequence:function(e){const t=this.stack[this.stack.length-1];if(!t.depth){const n=this.sliceSerialize(e).length;t.depth=n}},autolink:u(),autolinkEmail:function(e){f.call(this,e),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)},autolinkProtocol:function(e){f.call(this,e),this.stack[this.stack.length-1].url=this.sliceSerialize(e)},blockQuote:u(),characterEscapeValue:f,characterReferenceMarkerHexadecimal:g,characterReferenceMarkerNumeric:g,characterReferenceValue:function(e){const t=this.sliceSerialize(e),n=i("characterReferenceType");let r;n?(r=(0,Oe.C)(t,"characterReferenceMarkerNumeric"===n?10:16),o("characterReferenceType")):r=(0,ee.s)(t);const s=this.stack.pop();s.value+=r,s.position.end=Pe(e.end)},codeFenced:u((function(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),o("flowCodeInside")})),codeFencedFence:function(){i("flowCodeInside")||(this.buffer(),o("flowCodeInside",!0))},codeFencedFenceInfo:function(){const e=this.resume();this.stack[this.stack.length-1].lang=e},codeFencedFenceMeta:function(){const e=this.resume();this.stack[this.stack.length-1].meta=e},codeFlowValue:f,codeIndented:u((function(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")})),codeText:u((function(){const e=this.resume();this.stack[this.stack.length-1].value=e})),codeTextData:f,data:f,definition:u(),definitionDestinationString:function(){const e=this.resume();this.stack[this.stack.length-1].url=e},definitionLabelString:function(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=(0,j.B)(this.sliceSerialize(e)).toLowerCase()},definitionTitleString:function(){const e=this.resume();this.stack[this.stack.length-1].title=e},emphasis:u(),hardBreakEscape:u(m),hardBreakTrailing:u(m),htmlFlow:u((function(){const e=this.resume();this.stack[this.stack.length-1].value=e})),htmlFlowData:f,htmlText:u((function(){const e=this.resume();this.stack[this.stack.length-1].value=e})),htmlTextData:f,image:u((function(){const e=this.stack[this.stack.length-1];if(i("inReference")){const t=i("referenceType")||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;o("referenceType")})),label:function(){const e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];if(o("inReference",!0),"link"===n.type){const t=e.children;n.children=t}else n.alt=t},labelText:function(e){const t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=(0,Ae.s)(t),n.identifier=(0,j.B)(t).toLowerCase()},lineEnding:function(e){const n=this.stack[this.stack.length-1];if(i("atHardBreak"))return n.children[n.children.length-1].position.end=Pe(e.end),void o("atHardBreak");!i("setextHeadingSlurpLineEnding")&&t.canContainEols.includes(n.type)&&(p.call(this,e),f.call(this,e))},link:u((function(){const e=this.stack[this.stack.length-1];if(i("inReference")){const t=i("referenceType")||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;o("referenceType")})),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:function(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=(0,j.B)(this.sliceSerialize(e)).toLowerCase(),o("referenceType","full")},resourceDestinationString:function(){const e=this.resume();this.stack[this.stack.length-1].url=e},resourceTitleString:function(){const e=this.resume();this.stack[this.stack.length-1].title=e},resource:function(){o("inReference")},setextHeading:u((function(){o("setextHeadingSlurpLineEnding")})),setextHeadingLineSequence:function(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).charCodeAt(0)?1:2},setextHeadingText:function(){o("setextHeadingSlurpLineEnding",!0)},strong:u(),thematicBreak:u()}};Be(t,(e||{}).mdastExtensions||[]);const n={};return function(e){let n={type:"root",children:[]};const s={stack:[n],tokenStack:[],config:t,enter:c,exit:d,buffer:l,resume:h,setData:o,getData:i},a=[];let u=-1;for(;++u<e.length;)"listOrdered"!==e[u][1].type&&"listUnordered"!==e[u][1].type||("enter"===e[u][0]?a.push(u):u=r(e,a.pop(),u));for(u=-1;++u<e.length;){const n=t[e[u][0]];Ie.call(n,e[u][1].type)&&n[e[u][1].type].call(Object.assign({sliceSerialize:e[u][2].sliceSerialize},s),e[u][1])}if(s.tokenStack.length>0){const e=s.tokenStack[s.tokenStack.length-1];(e[1]||ze).call(s,void 0,e[0])}for(n.position={start:Pe(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Pe(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},u=-1;++u<t.transforms.length;)n=t.transforms[u](n)||n;return n};function r(e,t,n){let r,o,i,s,a=t-1,l=-1,c=!1;for(;++a<=n;){const t=e[a];if("listUnordered"===t[1].type||"listOrdered"===t[1].type||"blockQuote"===t[1].type?("enter"===t[0]?l++:l--,s=void 0):"lineEndingBlank"===t[1].type?"enter"===t[0]&&(!r||s||l||i||(i=a),s=void 0):"linePrefix"===t[1].type||"listItemValue"===t[1].type||"listItemMarker"===t[1].type||"listItemPrefix"===t[1].type||"listItemPrefixWhitespace"===t[1].type||(s=void 0),!l&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===l&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(r){let s=a;for(o=void 0;s--;){const t=e[s];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;o&&(e[o][1].type="lineEndingBlank",c=!0),t[1].type="lineEnding",o=s}else if("linePrefix"!==t[1].type&&"blockQuotePrefix"!==t[1].type&&"blockQuotePrefixWhitespace"!==t[1].type&&"blockQuoteMarker"!==t[1].type&&"listItemIndent"!==t[1].type)break}i&&(!o||i<o)&&(r._spread=!0),r.end=Object.assign({},o?e[o][1].start:t[1].end),e.splice(o||a,0,["exit",r,t[2]]),a++,n++}"listItemPrefix"===t[1].type&&(r={type:"listItem",_spread:!1,start:Object.assign({},t[1].start)},e.splice(a,0,["enter",r,t[2]]),a++,n++,i=void 0,s=!0)}}return e[t][1]._spread=c,n}function o(e,t){n[e]=t}function i(e){return n[e]}function s(e,t){return function(n){c.call(this,e(n),n),t&&t.call(this,n)}}function l(){this.stack.push({type:"fragment",children:[]})}function c(e,t,n){return this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n]),e.position={start:Pe(t.start)},e}function u(e){return function(t){e&&e.call(this,t),d.call(this,t)}}function d(e,t){const n=this.stack.pop(),r=this.tokenStack.pop();if(!r)throw new Error("Cannot close `"+e.type+"` ("+Ee({start:e.start,end:e.end})+"): it’s not open");return r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||ze).call(this,e,r[0])),n.position.end=Pe(e.end),n}function h(){return a(this.stack.pop())}function p(e){const t=this.stack[this.stack.length-1];let n=t.children[t.children.length-1];n&&"text"===n.type||(n={type:"text",value:""},n.position={start:Pe(e.start)},t.children.push(n)),this.stack.push(n)}function f(e){const t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=Pe(e.end)}function m(){o("atHardBreak",!0)}function g(e){o("characterReferenceType",e.type)}function y(){return{type:"code",lang:null,meta:null,value:""}}function v(){return{type:"heading",depth:void 0,children:[]}}function w(){return{type:"break"}}function k(){return{type:"html",value:""}}function b(){return{type:"link",title:null,url:"",children:[]}}function x(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}}(n)(function(e){for(;!v(e););return e}(function(e={}){const t={defined:[],lazy:{},constructs:(0,u.y)([r].concat(e.extensions||[])),content:n(p),document:n(m),flow:n(x),string:n(S),text:n(M)};return t;function n(e){return function(n){return D(t,e,n)}}}(n).document().write(function(){let e,t=1,n="",r=!0;return function(o,i,s){const a=[];let l,c,u,d,h;for(o=n+o.toString(i),u=0,n="",r&&(65279===o.charCodeAt(0)&&u++,r=void 0);u<o.length;){if(Ne.lastIndex=u,l=Ne.exec(o),d=l&&void 0!==l.index?l.index:o.length,h=o.charCodeAt(d),!l){n=o.slice(u);break}if(10===h&&u===d&&e)a.push(-3),e=void 0;else switch(e&&(a.push(-5),e=void 0),u<d&&(a.push(o.slice(u,d)),t+=d-u),h){case 0:a.push(65533),t++;break;case 9:for(c=4*Math.ceil(t/4),a.push(-2);t++<c;)a.push(-1);break;case 10:a.push(-4),t=1;break;default:e=!0,t=1}u=d+1}return s&&(e&&a.push(-5),n&&a.push(n),a.push(null)),a}}()(e,t,!0))))};function Pe(e){return{line:e.line,column:e.column,offset:e.offset}}function Be(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Be(e,r):Le(e,r)}}function Le(e,t){let n;for(n in t)if(Ie.call(t,n))if("canContainEols"===n){const r=t[n];r&&e[n].push(...r)}else if("transforms"===n){const r=t[n];r&&e[n].push(...r)}else if("enter"===n||"exit"===n){const r=t[n];r&&Object.assign(e[n],r)}}function ze(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ee({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ee({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ee({start:t.start,end:t.end})+") is still open")}function $e(e){Object.assign(this,{Parser:t=>{const n=this.data("settings");return Re(t,Object.assign({},n,e,{extensions:this.data("micromarkExtensions")||[],mdastExtensions:this.data("fromMarkdownExtensions")||[]}))}})}const je={}.hasOwnProperty;function _e(e,t){let n,r=-1;if(t.extensions)for(;++r<t.extensions.length;)_e(e,t.extensions[r]);for(n in t)"extensions"===n||("unsafe"===n||"join"===n?e[n]=[...e[n]||[],...t[n]||[]]:"handlers"===n?e[n]=Object.assign(e[n],t[n]||{}):e.options[n]=t[n]);return e}function Ve(e,t,n){return">"+(n?"":" ")+e}function We(e,t){return He(e,t.inConstruct,!0)&&!He(e,t.notInConstruct,!1)}function He(e,t,n){if("string"==typeof t&&(t=[t]),!t||0===t.length)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function Ke(e,t,n,r){let o=-1;for(;++o<n.unsafe.length;)if("\n"===n.unsafe[o].character&&We(n.stack,n.unsafe[o]))return/[ \t]/.test(r.before)?"":" ";return"\\\n"}var Je=n(5344);function qe(e,t){return Boolean(!t.options.fences&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Ue(e,t,n){return(n?"":" ")+e}function Ye(e){const t=e.options.quote||'"';if('"'!==t&&"'"!==t)throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Ze(e,t,n,r){const o=function(e){const t=e.options.emphasis||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}(n),i=n.enter("emphasis"),s=n.createTracker(r);let a=s.move(o);return a+=s.move(n.containerPhrasing(e,{before:a,after:o,...s.current()})),a+=s.move(o),i(),a}Ze.peek=function(e,t,n){return n.options.emphasis||"*"};var Ge=n(6641);function Qe(e,t){let n=!1;var r,o,i,s;return r=e,o=e=>{if("value"in e&&/\r?\n|\r/.test(e.value)||"break"===e.type)return n=!0,Ge.dc},"function"==typeof o&&"function"!=typeof i&&(s=i,i=o,o=null),(0,Ge.VG)(r,o,(function(e,t){const n=t[t.length-1];return i(e,n?n.children.indexOf(e):null,n)}),s),Boolean((!e.depth||e.depth<3)&&a(e)&&(t.options.setext||n))}function Xe(e){return e.value||""}function et(e,t,n,r){const o=Ye(n),i='"'===o?"Quote":"Apostrophe",s=n.enter("image");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("![");return c+=l.move(n.safe(e.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":")",...l.current()}))),a(),e.title&&(a=n.enter(`title${i}`),c+=l.move(" "+o),c+=l.move(n.safe(e.title,{before:c,after:o,...l.current()})),c+=l.move(o),a()),c+=l.move(")"),s(),c}function tt(e,t,n,r){const o=e.referenceType,i=n.enter("imageReference");let s=n.enter("label");const a=n.createTracker(r);let l=a.move("![");const c=n.safe(e.alt,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),s();const u=n.stack;n.stack=[],s=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return s(),n.stack=u,i(),"full"!==o&&c&&c===d?"shortcut"===o?l=l.slice(0,-1):l+=a.move("]"):l+=a.move(d+"]"),l}function nt(e){if(!e._compiled){const t=(e.atBreak?"[\\r\\n][\\t ]*":"")+(e.before?"(?:"+e.before+")":"");e._compiled=new RegExp((t?"("+t+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?"\\":"")+e.character+(e.after?"(?:"+e.after+")":""),"g")}return e._compiled}function rt(e,t,n){let r=e.value||"",o="`",i=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(r);)o+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const e=n.unsafe[i],t=nt(e);let o;if(e.atBreak)for(;o=t.exec(r);){let e=o.index;10===r.charCodeAt(e)&&13===r.charCodeAt(e-1)&&e--,r=r.slice(0,e)+" "+r.slice(o.index+1)}}return o+r+o}function ot(e,t){const n=a(e);return Boolean(!t.options.resourceLink&&e.url&&!e.title&&e.children&&1===e.children.length&&"text"===e.children[0].type&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}function it(e,t,n,r){const o=Ye(n),i='"'===o?"Quote":"Apostrophe",s=n.createTracker(r);let a,l;if(ot(e,n)){const t=n.stack;n.stack=[],a=n.enter("autolink");let r=s.move("<");return r+=s.move(n.containerPhrasing(e,{before:r,after:">",...s.current()})),r+=s.move(">"),a(),n.stack=t,r}a=n.enter("link"),l=n.enter("label");let c=s.move("[");return c+=s.move(n.containerPhrasing(e,{before:c,after:"](",...s.current()})),c+=s.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=s.move("<"),c+=s.move(n.safe(e.url,{before:c,after:">",...s.current()})),c+=s.move(">")):(l=n.enter("destinationRaw"),c+=s.move(n.safe(e.url,{before:c,after:e.title?" ":")",...s.current()}))),l(),e.title&&(l=n.enter(`title${i}`),c+=s.move(" "+o),c+=s.move(n.safe(e.title,{before:c,after:o,...s.current()})),c+=s.move(o),l()),c+=s.move(")"),a(),c}function st(e,t,n,r){const o=e.referenceType,i=n.enter("linkReference");let s=n.enter("label");const a=n.createTracker(r);let l=a.move("[");const c=n.containerPhrasing(e,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),s();const u=n.stack;n.stack=[],s=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return s(),n.stack=u,i(),"full"!==o&&c&&c===d?"shortcut"===o?l=l.slice(0,-1):l+=a.move("]"):l+=a.move(d+"]"),l}function at(e){const t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function lt(e){const t=e.options.bulletOrdered||".";if("."!==t&&")"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function ct(e){const t=e.options.rule||"*";if("*"!==t&&"-"!==t&&"_"!==t)throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}Xe.peek=function(){return"<"},et.peek=function(){return"!"},tt.peek=function(){return"!"},rt.peek=function(){return"`"},it.peek=function(e,t,n){return ot(e,n)?"<":"["},st.peek=function(){return"["};const ut=(0,n(5186).C)(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","link","linkReference","strong","text"]);function dt(e,t,n,r){const o=function(e){const t=e.options.strong||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}(n),i=n.enter("strong"),s=n.createTracker(r);let a=s.move(o+o);return a+=s.move(n.containerPhrasing(e,{before:a,after:o,...s.current()})),a+=s.move(o+o),i(),a}dt.peek=function(e,t,n){return n.options.strong||"*"};const ht={blockquote:function(e,t,n,r){const o=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const s=n.indentLines(n.containerFlow(e,i.current()),Ve);return o(),s},break:Ke,code:function(e,t,n,r){const o=function(e){const t=e.options.fence||"`";if("`"!==t&&"~"!==t)throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}(n),i=e.value||"",s="`"===o?"GraveAccent":"Tilde";if(qe(e,n)){const e=n.enter("codeIndented"),t=n.indentLines(i,Ue);return e(),t}const a=n.createTracker(r),l=o.repeat(Math.max((0,Je.D)(i,o)+1,3)),c=n.enter("codeFenced");let u=a.move(l);if(e.lang){const t=n.enter(`codeFencedLang${s}`);u+=a.move(n.safe(e.lang,{before:u,after:" ",encode:["`"],...a.current()})),t()}if(e.lang&&e.meta){const t=n.enter(`codeFencedMeta${s}`);u+=a.move(" "),u+=a.move(n.safe(e.meta,{before:u,after:"\n",encode:["`"],...a.current()})),t()}return u+=a.move("\n"),i&&(u+=a.move(i+"\n")),u+=a.move(l),c(),u},definition:function(e,t,n,r){const o=Ye(n),i='"'===o?"Quote":"Apostrophe",s=n.enter("definition");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("[");return c+=l.move(n.safe(n.associationId(e),{before:c,after:"]",...l.current()})),c+=l.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":"\n",...l.current()}))),a(),e.title&&(a=n.enter(`title${i}`),c+=l.move(" "+o),c+=l.move(n.safe(e.title,{before:c,after:o,...l.current()})),c+=l.move(o),a()),s(),c},emphasis:Ze,hardBreak:Ke,heading:function(e,t,n,r){const o=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(Qe(e,n)){const t=n.enter("headingSetext"),r=n.enter("phrasing"),s=n.containerPhrasing(e,{...i.current(),before:"\n",after:"\n"});return r(),t(),s+"\n"+(1===o?"=":"-").repeat(s.length-(Math.max(s.lastIndexOf("\r"),s.lastIndexOf("\n"))+1))}const s="#".repeat(o),a=n.enter("headingAtx"),l=n.enter("phrasing");i.move(s+" ");let c=n.containerPhrasing(e,{before:"# ",after:"\n",...i.current()});return/^[\t ]/.test(c)&&(c="&#x"+c.charCodeAt(0).toString(16).toUpperCase()+";"+c.slice(1)),c=c?s+" "+c:s,n.options.closeAtx&&(c+=" "+s),l(),a(),c},html:Xe,image:et,imageReference:tt,inlineCode:rt,link:it,linkReference:st,list:function(e,t,n,r){const o=n.enter("list"),i=n.bulletCurrent;let s=e.ordered?lt(n):at(n);const a=e.ordered?function(e){const t=lt(e),n=e.options.bulletOrderedOther;if(!n)return"."===t?")":".";if("."!==n&&")"!==n)throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOrderedOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bulletOrdered` (`"+t+"`) and `bulletOrderedOther` (`"+n+"`) to be different");return n}(n):function(e){const t=at(e),n=e.options.bulletOther;if(!n)return"*"===t?"-":"*";if("*"!==n&&"+"!==n&&"-"!==n)throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}(n),l=n.bulletLastUsed;let c=!1;if(t&&(e.ordered?n.options.bulletOrderedOther:n.options.bulletOther)&&l&&s===l&&(c=!0),!e.ordered){const t=e.children?e.children[0]:void 0;if("*"!==s&&"-"!==s||!t||t.children&&t.children[0]||"list"!==n.stack[n.stack.length-1]||"listItem"!==n.stack[n.stack.length-2]||"list"!==n.stack[n.stack.length-3]||"listItem"!==n.stack[n.stack.length-4]||0!==n.indexStack[n.indexStack.length-1]||0!==n.indexStack[n.indexStack.length-2]||0!==n.indexStack[n.indexStack.length-3]||(c=!0),ct(n)===s&&t){let t=-1;for(;++t<e.children.length;){const n=e.children[t];if(n&&"listItem"===n.type&&n.children&&n.children[0]&&"thematicBreak"===n.children[0].type){c=!0;break}}}}c&&(s=a),n.bulletCurrent=s;const u=n.containerFlow(e,r);return n.bulletLastUsed=s,n.bulletCurrent=i,o(),u},listItem:function(e,t,n,r){const o=function(e){const t=e.options.listItemIndent||"tab";if(1===t||"1"===t)return"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(n);let i=n.bulletCurrent||at(n);t&&"list"===t.type&&t.ordered&&(i=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+i);let s=i.length+1;("tab"===o||"mixed"===o&&(t&&"list"===t.type&&t.spread||e.spread))&&(s=4*Math.ceil(s/4));const a=n.createTracker(r);a.move(i+" ".repeat(s-i.length)),a.shift(s);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,a.current()),(function(e,t,n){return t?(n?"":" ".repeat(s))+e:(n?i:i+" ".repeat(s-i.length))+e}));return l(),c},paragraph:function(e,t,n,r){const o=n.enter("paragraph"),i=n.enter("phrasing"),s=n.containerPhrasing(e,r);return i(),o(),s},root:function(e,t,n,r){const o=e.children.some((e=>ut(e)));return(o?n.containerPhrasing:n.containerFlow).call(n,e,r)},strong:dt,text:function(e,t,n,r){return n.safe(e.value,r)},thematicBreak:function(e,t,n){const r=(ct(n)+(n.options.ruleSpaces?" ":"")).repeat(function(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}(n));return n.options.ruleSpaces?r.slice(0,-1):r}},pt=[function(e,t,n,r){if("code"===t.type&&qe(t,r)&&("list"===e.type||e.type===t.type&&qe(e,r)))return!1;if("list"===e.type&&e.type===t.type&&Boolean(e.ordered)===Boolean(t.ordered)&&!(e.ordered?r.options.bulletOrderedOther:r.options.bulletOther))return!1;if("spread"in n&&"boolean"==typeof n.spread){if("paragraph"===e.type&&(e.type===t.type||"definition"===t.type||"heading"===t.type&&Qe(t,r)))return;return n.spread?1:0}}],ft=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],mt=[{character:"\t",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"\t",before:"[\\r\\n]",inConstruct:"phrasing"},{character:"\t",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:"\n",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:ft},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:"(?:[\r\n]|$)"},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:ft},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:"(?:[ \t\r\n*])"},{character:"*",inConstruct:"phrasing",notInConstruct:ft},{atBreak:!0,character:"+",after:"(?:[ \t\r\n])"},{atBreak:!0,character:"-",after:"(?:[ \t\r\n-])"},{atBreak:!0,before:"\\d+",character:".",after:"(?:[ \t\r\n]|$)"},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:ft},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:ft},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:ft},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:ft},{atBreak:!0,character:"~"}];function gt(e){return e.label||!e.identifier?e.label||"":(0,Ae.s)(e.identifier)}function yt(e,t,n,r){let o=r.join.length;for(;o--;){const i=r.join[o](e,t,n,r);if(!0===i||1===i)break;if("number"==typeof i)return"\n".repeat(1+i);if(!1===i)return"\n\n\x3c!----\x3e\n\n"}return"\n\n"}const vt=/\r?\n|\r/g;function wt(e,t){const n=[];let r,o=0,i=0;for(;r=vt.exec(e);)s(e.slice(o,r.index)),n.push(r[0]),o=r.index+r[0].length,i++;return s(e.slice(o)),n.join("");function s(e){n.push(t(e,i,!e))}}function kt(e,t){return e-t}function bt(e,t){const n=/\\(?=[!-/:-@[-`{-~])/g,r=[],o=[],i=e+t;let s,a=-1,l=0;for(;s=n.exec(i);)r.push(s.index);for(;++a<r.length;)l!==r[a]&&o.push(e.slice(l,r[a])),o.push("\\"),l=r[a];return o.push(e.slice(l)),o.join("")}function xt(e){const t=e||{},n=t.now||{};let r=t.lineShift||0,o=n.line||1,i=n.column||1;return{move:function(e){const t=e||"",n=t.split(/\r?\n|\r/g),s=n[n.length-1];return o+=n.length-1,i=1===n.length?i+s.length:1+s.length+r,t},current:function(){return{now:{line:o,column:i},lineShift:r}},shift:function(e){r+=e}}}function Ct(e){throw new Error("Cannot handle value `"+e+"`, expected node")}function St(e){throw new Error("Cannot handle unknown node `"+e.type+"`")}function Mt(e,t){if("definition"===e.type&&e.type===t.type)return 0}function Nt(e,t){return function(e,t,n){const r=t.indexStack,o=e.children||[],i=[];let s=-1,a=n.before;r.push(-1);let l=t.createTracker(n);for(;++s<o.length;){const c=o[s];let u;if(r[r.length-1]=s,s+1<o.length){let n=t.handle.handlers[o[s+1].type];n&&n.peek&&(n=n.peek),u=n?n(o[s+1],e,t,{before:"",after:"",...l.current()}).charAt(0):""}else u=n.after;i.length>0&&("\r"===a||"\n"===a)&&"html"===c.type&&(i[i.length-1]=i[i.length-1].replace(/(\r?\n|\r)$/," "),a=" ",l=t.createTracker(n),l.move(i.join(""))),i.push(l.move(t.handle(c,e,t,{...l.current(),before:a,after:u}))),a=i[i.length-1].slice(-1)}return r.pop(),i.join("")}(e,this,t)}function Ot(e,t){return function(e,t,n){const r=t.indexStack,o=e.children||[],i=t.createTracker(n),s=[];let a=-1;for(r.push(-1);++a<o.length;){const n=o[a];r[r.length-1]=a,s.push(i.move(t.handle(n,e,t,{before:"\n",after:"\n",...i.current()}))),"list"!==n.type&&(t.bulletLastUsed=void 0),a<o.length-1&&s.push(i.move(yt(n,o[a+1],e,t)))}return r.pop(),s.join("")}(e,this,t)}function At(e,t){return function(e,t,n){const r=(n.before||"")+(t||"")+(n.after||""),o=[],i=[],s={};let a=-1;for(;++a<e.unsafe.length;){const t=e.unsafe[a];if(!We(e.stack,t))continue;const n=nt(t);let i;for(;i=n.exec(r);){const e="before"in t||Boolean(t.atBreak),n="after"in t,r=i.index+(e?i[1].length:0);o.includes(r)?(s[r].before&&!e&&(s[r].before=!1),s[r].after&&!n&&(s[r].after=!1)):(o.push(r),s[r]={before:e,after:n})}}o.sort(kt);let l=n.before?n.before.length:0;const c=r.length-(n.after?n.after.length:0);for(a=-1;++a<o.length;){const e=o[a];e<l||e>=c||e+1<c&&o[a+1]===e+1&&s[e].after&&!s[e+1].before&&!s[e+1].after||o[a-1]===e-1&&s[e].before&&!s[e-1].before&&!s[e-1].after||(l!==e&&i.push(bt(r.slice(l,e),"\\")),l=e,!/[!-/:-@[-`{-~]/.test(r.charAt(e))||n.encode&&n.encode.includes(r.charAt(e))?(i.push("&#x"+r.charCodeAt(e).toString(16).toUpperCase()+";"),l++):i.push("\\"))}return i.push(bt(r.slice(l,c),n.after)),i.join("")}(this,e,t)}function Et(e){Object.assign(this,{Compiler:t=>{const n=this.data("settings");return function(e,t={}){const n={enter:function(e){return n.stack.push(e),function(){n.stack.pop()}},indentLines:wt,associationId:gt,containerPhrasing:Nt,containerFlow:Ot,createTracker:xt,safe:At,stack:[],unsafe:[],join:[],handlers:{},options:{},indexStack:[],handle:void 0};_e(n,{unsafe:mt,join:pt,handlers:ht}),_e(n,t),n.options.tightDefinitions&&_e(n,{join:[Mt]}),n.handle=function(e,t){const n=t||{};function r(t,...n){let o=r.invalid;const i=r.handlers;if(t&&je.call(t,e)){const n=String(t[e]);o=je.call(i,n)?i[n]:r.unknown}if(o)return o.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}("type",{invalid:Ct,unknown:St,handlers:n.handlers});let r=n.handle(e,void 0,n,{before:"\n",after:"\n",now:{line:1,column:1},lineShift:0});return r&&10!==r.charCodeAt(r.length-1)&&13!==r.charCodeAt(r.length-1)&&(r+="\n"),r}(t,Object.assign({},n,e,{extensions:this.data("toMarkdownExtensions")||[]}))}})}var Dt=n(659),Tt=n(6325),Ft=n(9710);function It(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)}var Rt=n(4934);function Pt(e){return Lt(e&&e.line)+":"+Lt(e&&e.column)}function Bt(e){return Pt(e&&e.start)+"-"+Pt(e&&e.end)}function Lt(e){return e&&"number"==typeof e?e:1}class zt extends Error{constructor(e,t,n){const r=[null,null];let o={start:{line:null,column:null},end:{line:null,column:null}};if(super(),"string"==typeof t&&(n=t,t=void 0),"string"==typeof n){const e=n.indexOf(":");-1===e?r[1]=n:(r[0]=n.slice(0,e),r[1]=n.slice(e+1))}var i;t&&("type"in t||"position"in t?t.position&&(o=t.position):"start"in t||"end"in t?o=t:("line"in t||"column"in t)&&(o.start=t)),this.name=((i=t)&&"object"==typeof i?"position"in i||"type"in i?Bt(i.position):"start"in i||"end"in i?Bt(i):"line"in i||"column"in i?Pt(i):"":"")||"1:1",this.message="object"==typeof e?e.message:e,this.stack="","object"==typeof e&&e.stack&&(this.stack=e.stack),this.reason=this.message,this.fatal,this.line=o.start.line,this.column=o.start.column,this.position=o,this.source=r[0],this.ruleId=r[1],this.file,this.actual,this.expected,this.url,this.note}}zt.prototype.file="",zt.prototype.name="",zt.prototype.reason="",zt.prototype.message="",zt.prototype.stack="",zt.prototype.fatal=null,zt.prototype.column=null,zt.prototype.line=null,zt.prototype.source=null,zt.prototype.ruleId=null,zt.prototype.position=null;const $t=function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');Ht(e);let n,r=0,o=-1,i=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;i--;)if(47===e.charCodeAt(i)){if(n){r=i+1;break}}else o<0&&(n=!0,o=i+1);return o<0?"":e.slice(r,o)}if(t===e)return"";let s=-1,a=t.length-1;for(;i--;)if(47===e.charCodeAt(i)){if(n){r=i+1;break}}else s<0&&(n=!0,s=i+1),a>-1&&(e.charCodeAt(i)===t.charCodeAt(a--)?a<0&&(o=i):(a=-1,o=s));return r===o?o=s:o<0&&(o=e.length),e.slice(r,o)},jt=function(e){if(Ht(e),0===e.length)return".";let t,n=-1,r=e.length;for(;--r;)if(47===e.charCodeAt(r)){if(t){n=r;break}}else t||(t=!0);return n<0?47===e.charCodeAt(0)?"/":".":1===n&&47===e.charCodeAt(0)?"//":e.slice(0,n)},_t=function(e){Ht(e);let t,n=e.length,r=-1,o=0,i=-1,s=0;for(;n--;){const a=e.charCodeAt(n);if(47!==a)r<0&&(t=!0,r=n+1),46===a?i<0?i=n:1!==s&&(s=1):i>-1&&(s=-1);else if(t){o=n+1;break}}return i<0||r<0||0===s||1===s&&i===r-1&&i===o+1?"":e.slice(i,r)},Vt=function(...e){let t,n=-1;for(;++n<e.length;)Ht(e[n]),e[n]&&(t=void 0===t?e[n]:t+"/"+e[n]);return void 0===t?".":function(e){Ht(e);const t=47===e.charCodeAt(0);let n=function(e,t){let n,r,o="",i=0,s=-1,a=0,l=-1;for(;++l<=e.length;){if(l<e.length)n=e.charCodeAt(l);else{if(47===n)break;n=47}if(47===n){if(s===l-1||1===a);else if(s!==l-1&&2===a){if(o.length<2||2!==i||46!==o.charCodeAt(o.length-1)||46!==o.charCodeAt(o.length-2))if(o.length>2){if(r=o.lastIndexOf("/"),r!==o.length-1){r<0?(o="",i=0):(o=o.slice(0,r),i=o.length-1-o.lastIndexOf("/")),s=l,a=0;continue}}else if(o.length>0){o="",i=0,s=l,a=0;continue}t&&(o=o.length>0?o+"/..":"..",i=2)}else o.length>0?o+="/"+e.slice(s+1,l):o=e.slice(s+1,l),i=l-s-1;s=l,a=0}else 46===n&&a>-1?a++:a=-1}return o}(e,!t);return 0!==n.length||t||(n="."),n.length>0&&47===e.charCodeAt(e.length-1)&&(n+="/"),t?"/"+n:n}(t)},Wt="/";function Ht(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Kt=function(){return"/"};function Jt(e){return null!==e&&"object"==typeof e&&e.href&&e.origin}const qt=["history","path","basename","stem","extname","dirname"];class Ut{constructor(e){let t;t=e?"string"==typeof e||function(e){return Tt(e)}(e)?{value:e}:Jt(e)?{path:e}:e:{},this.data={},this.messages=[],this.history=[],this.cwd=Kt(),this.value,this.stored,this.result,this.map;let n,r=-1;for(;++r<qt.length;){const e=qt[r];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(n in t)qt.includes(n)||(this[n]=t[n])}get path(){return this.history[this.history.length-1]}set path(e){Jt(e)&&(e=function(e){if("string"==typeof e)e=new URL(e);else if(!Jt(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if("file:"!==e.protocol){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){const e=new TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}const t=e.pathname;let n=-1;for(;++n<t.length;)if(37===t.charCodeAt(n)&&50===t.charCodeAt(n+1)){const e=t.charCodeAt(n+2);if(70===e||102===e){const e=new TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}(e)),Zt(e,"path"),this.path!==e&&this.history.push(e)}get dirname(){return"string"==typeof this.path?jt(this.path):void 0}set dirname(e){Gt(this.basename,"dirname"),this.path=Vt(e||"",this.basename)}get basename(){return"string"==typeof this.path?$t(this.path):void 0}set basename(e){Zt(e,"basename"),Yt(e,"basename"),this.path=Vt(this.dirname||"",e)}get extname(){return"string"==typeof this.path?_t(this.path):void 0}set extname(e){if(Yt(e,"extname"),Gt(this.dirname,"extname"),e){if(46!==e.charCodeAt(0))throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Vt(this.dirname,this.stem+(e||""))}get stem(){return"string"==typeof this.path?$t(this.path,this.extname):void 0}set stem(e){Zt(e,"stem"),Yt(e,"stem"),this.path=Vt(this.dirname||"",e+(this.extname||""))}toString(e){return(this.value||"").toString(e||void 0)}message(e,t,n){const r=new zt(e,t,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}info(e,t,n){const r=this.message(e,t,n);return r.fatal=null,r}fail(e,t,n){const r=this.message(e,t,n);throw r.fatal=!0,r}}function Yt(e,t){if(e&&e.includes(Wt))throw new Error("`"+t+"` cannot be a path: did not expect `"+Wt+"`")}function Zt(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Gt(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}const Qt=function e(){const t=(0,Rt.S)(),n=[];let r,o={},i=-1;return s.data=function(e,t){return"string"==typeof e?2===arguments.length?(rn("data",r),o[e]=t,s):Xt.call(o,e)&&o[e]||null:e?(rn("data",r),o=e,s):o},s.Parser=void 0,s.Compiler=void 0,s.freeze=function(){if(r)return s;for(;++i<n.length;){const[e,...r]=n[i];if(!1===r[0])continue;!0===r[0]&&(r[0]=void 0);const o=e.call(s,...r);"function"==typeof o&&t.use(o)}return r=!0,i=Number.POSITIVE_INFINITY,s},s.attachers=n,s.use=function(e,...t){let i;if(rn("use",r),null==e);else if("function"==typeof e)u(e,...t);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");Array.isArray(e)?c(e):l(e)}return i&&(o.settings=Object.assign(o.settings||{},i)),s;function a(e){if("function"==typeof e)u(e);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");if(Array.isArray(e)){const[t,...n]=e;u(t,...n)}else l(e)}}function l(e){c(e.plugins),e.settings&&(i=Object.assign(i||{},e.settings))}function c(e){let t=-1;if(null==e);else{if(!Array.isArray(e))throw new TypeError("Expected a list of plugins, not `"+e+"`");for(;++t<e.length;)a(e[t])}}function u(e,t){let r,o=-1;for(;++o<n.length;)if(n[o][0]===e){r=n[o];break}r?(It(r[1])&&It(t)&&(t=Ft(!0,r[1],t)),r[1]=t):n.push([...arguments])}},s.parse=function(e){s.freeze();const t=an(e),n=s.Parser;return tn("parse",n),en(n,"parse")?new n(String(t),t).parse():n(String(t),t)},s.stringify=function(e,t){s.freeze();const n=an(t),r=s.Compiler;return nn("stringify",r),on(e),en(r,"compile")?new r(e,n).compile():r(e,n)},s.run=function(e,n,r){if(on(e),s.freeze(),r||"function"!=typeof n||(r=n,n=void 0),!r)return new Promise(o);function o(o,i){t.run(e,an(n),(function(t,n,s){n=n||e,t?i(t):o?o(n):r(null,n,s)}))}o(null,r)},s.runSync=function(e,t){let n,r;return s.run(e,t,(function(e,t){(0,Dt.V)(e),n=t,r=!0})),sn("runSync","run",r),n},s.process=function(e,t){if(s.freeze(),tn("process",s.Parser),nn("process",s.Compiler),!t)return new Promise(n);function n(n,r){const o=an(e);function i(e,o){e||!o?r(e):n?n(o):t(null,o)}s.run(s.parse(o),o,((e,t,n)=>{if(!e&&t&&n){const o=s.stringify(t,n);null==o||("string"==typeof(r=o)||Tt(r)?n.value=o:n.result=o),i(e,n)}else i(e);var r}))}n(null,t)},s.processSync=function(e){let t;s.freeze(),tn("processSync",s.Parser),nn("processSync",s.Compiler);const n=an(e);return s.process(n,(function(e){t=!0,(0,Dt.V)(e)})),sn("processSync","process",t),n},s;function s(){const t=e();let r=-1;for(;++r<n.length;)t.use(...n[r]);return t.data(Ft(!0,{},o)),t}}().freeze(),Xt={}.hasOwnProperty;function en(e,t){return"function"==typeof e&&e.prototype&&(function(e){let t;for(t in e)if(Xt.call(e,t))return!0;return!1}(e.prototype)||t in e.prototype)}function tn(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `Parser`")}function nn(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `Compiler`")}function rn(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function on(e){if(!It(e)||"string"!=typeof e.type)throw new TypeError("Expected node, got `"+e+"`")}function sn(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function an(e){return function(e){return Boolean(e&&"object"==typeof e&&"message"in e&&"messages"in e)}(e)?e:new Ut(e)}var ln,cn,un,dn,hn,pn,fn,mn=n(1440),gn=Object.defineProperty,yn=(e,t,n)=>(((e,t,n)=>{t in e?gn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n),vn=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},wn=(e,t,n)=>(vn(e,t,"read from private field"),n?n.call(e):t.get(e)),kn=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},bn=(e,t,n,r)=>(vn(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class xn{}class Cn{constructor(){yn(this,"elements",[]),yn(this,"size",(()=>this.elements.length)),yn(this,"top",(()=>this.elements.at(-1))),yn(this,"push",(e=>{var t;null==(t=this.top())||t.push(e)})),yn(this,"open",(e=>{this.elements.push(e)})),yn(this,"close",(()=>{const e=this.elements.pop();if(!e)throw(0,mn.TR)();return e}))}}class Sn extends xn{constructor(e,t,n){super(),this.type=e,this.content=t,this.attrs=n}push(e,...t){this.content.push(e,...t)}pop(){return this.content.pop()}static create(e,t,n){return new Sn(e,t,n)}}const Mn=class extends Cn{constructor(e){super(),yn(this,"schema"),kn(this,ln,i.CU.none),kn(this,cn,(e=>e.isText)),kn(this,un,((e,t)=>{if(wn(this,cn).call(this,e)&&wn(this,cn).call(this,t)&&i.CU.sameSet(e.marks,t.marks))return this.schema.text(e.text+t.text,e.marks)})),kn(this,dn,(e=>{const t=Object.values({...this.schema.nodes,...this.schema.marks}).find((t=>t.spec.parseMarkdown.match(e)));if(!t)throw(0,mn.Xm)(e);return t})),kn(this,hn,(e=>{const t=wn(this,dn).call(this,e);t.spec.parseMarkdown.runner(this,e,t)})),yn(this,"injectRoot",((e,t,n)=>(this.openNode(t,n),this.next(e.children),this))),yn(this,"openNode",((e,t)=>(this.open(Sn.create(e,[],t)),this))),kn(this,pn,(()=>{bn(this,ln,i.CU.none);const e=this.close();return wn(this,fn).call(this,e.type,e.attrs,e.content)})),yn(this,"closeNode",(()=>(wn(this,pn).call(this),this))),kn(this,fn,((e,t,n)=>{const r=e.createAndFill(t,n,wn(this,ln));if(!r)throw(0,mn.$D)(e,t,n);return this.push(r),r})),yn(this,"addNode",((e,t,n)=>(wn(this,fn).call(this,e,t,n),this))),yn(this,"openMark",((e,t)=>{const n=e.create(t);return bn(this,ln,n.addToSet(wn(this,ln))),this})),yn(this,"closeMark",(e=>(bn(this,ln,e.removeFromSet(wn(this,ln))),this))),yn(this,"addText",(e=>{const t=this.top();if(!t)throw(0,mn.TR)();const n=t.pop(),r=this.schema.text(e,wn(this,ln));if(!n)return t.push(r),this;const o=wn(this,un).call(this,n,r);return o?(t.push(o),this):(t.push(n,r),this)})),yn(this,"build",(()=>{let e;do{e=wn(this,pn).call(this)}while(this.size());return e})),yn(this,"next",((e=[])=>([e].flat().forEach((e=>wn(this,hn).call(this,e))),this))),yn(this,"toDoc",(()=>this.build())),yn(this,"run",((e,t)=>{const n=e.runSync(e.parse(t),t);return this.next(n),this})),this.schema=e}};let Nn=Mn;ln=new WeakMap,cn=new WeakMap,un=new WeakMap,dn=new WeakMap,hn=new WeakMap,pn=new WeakMap,fn=new WeakMap,yn(Nn,"create",((e,t)=>{const n=new Mn(e);return e=>(n.run(t,e),n.toDoc())}));const On=class extends xn{constructor(e,t,n,r={}){super(),yn(this,"push",((e,...t)=>{this.children||(this.children=[]),this.children.push(e,...t)})),yn(this,"pop",(()=>{var e;return null==(e=this.children)?void 0:e.pop()})),this.type=e,this.children=t,this.value=n,this.props=r}};let An=On;var En,Dn,Tn,Fn,In,Rn,Pn,Bn,Ln,zn,$n,jn;yn(An,"create",((e,t,n,r={})=>new On(e,t,n,r)));const _n=class extends Cn{constructor(e){super(),kn(this,En,i.CU.none),yn(this,"schema"),kn(this,Dn,(e=>{const t=Object.values({...this.schema.nodes,...this.schema.marks}).find((t=>t.spec.toMarkdown.match(e)));if(!t)throw(0,mn._K)(e.type);return t})),kn(this,Tn,(e=>wn(this,Dn).call(this,e).spec.toMarkdown.runner(this,e))),kn(this,Fn,((e,t)=>wn(this,Dn).call(this,e).spec.toMarkdown.runner(this,e,t))),kn(this,In,(e=>{const{marks:t}=e,n=e=>e.type.spec.priority??50;[...t].sort(((e,t)=>n(e)-n(t))).every((t=>!wn(this,Fn).call(this,t,e)))&&wn(this,Tn).call(this,e),t.forEach((e=>wn(this,jn).call(this,e)))})),kn(this,Rn,((e,t)=>{var n;if(e.type===t||1!==(null==(n=e.children)?void 0:n.length))return e;const r=e=>{var n;if(e.type===t)return e;if(1!==(null==(n=e.children)?void 0:n.length))return null;const[o]=e.children;return o?r(o):null},o=r(e);if(!o)return e;const i=o.children?[...o.children]:void 0,s={...e,children:i};return s.children=i,o.children=[s],o})),kn(this,Pn,(e=>{const{children:t}=e;return t&&(e.children=t.reduce(((e,t,n)=>{if(0===n)return[t];const r=e.at(-1);if(r&&r.isMark&&t.isMark){t=wn(this,Rn).call(this,t,r.type);const{children:n,...o}=t,{children:i,...s}=r;if(t.type===r.type&&n&&i&&JSON.stringify(o)===JSON.stringify(s)){const t={...s,children:[...i,...n]};return e.slice(0,-1).concat(wn(this,Pn).call(this,t))}}return e.concat(t)}),[])),e})),kn(this,Bn,(e=>{const t={...e.props,type:e.type};return e.children&&(t.children=e.children),e.value&&(t.value=e.value),t})),yn(this,"openNode",((e,t,n)=>(this.open(An.create(e,void 0,t,n)),this))),kn(this,Ln,(()=>{const e=this.close();return wn(this,zn).call(this,e.type,e.children,e.value,e.props)})),yn(this,"closeNode",(()=>(wn(this,Ln).call(this),this))),kn(this,zn,((e,t,n,r)=>{const o=An.create(e,t,n,r),i=wn(this,Pn).call(this,wn(this,Bn).call(this,o));return this.push(i),i})),yn(this,"addNode",((e,t,n,r)=>(wn(this,zn).call(this,e,t,n,r),this))),kn(this,$n,((e,t,n,r)=>e.isInSet(wn(this,En))?this:(bn(this,En,e.addToSet(wn(this,En))),this.openNode(t,n,{...r,isMark:!0})))),kn(this,jn,(e=>{!e.isInSet(wn(this,En))||(bn(this,En,e.type.removeFromSet(wn(this,En))),wn(this,Ln).call(this))})),yn(this,"withMark",((e,t,n,r)=>(wn(this,$n).call(this,e,t,n,r),this))),yn(this,"closeMark",(e=>(wn(this,jn).call(this,e),this))),yn(this,"build",(()=>{let e=null;do{e=wn(this,Ln).call(this)}while(this.size());return e})),yn(this,"next",(e=>{return t=e,Object.prototype.hasOwnProperty.call(t,"size")?(e.forEach((e=>{wn(this,In).call(this,e)})),this):(wn(this,In).call(this,e),this);var t})),yn(this,"toString",(e=>e.stringify(this.build()))),yn(this,"run",(e=>(this.next(e),this))),this.schema=e}};let Vn=_n;En=new WeakMap,Dn=new WeakMap,Tn=new WeakMap,Fn=new WeakMap,In=new WeakMap,Rn=new WeakMap,Pn=new WeakMap,Bn=new WeakMap,Ln=new WeakMap,zn=new WeakMap,$n=new WeakMap,jn=new WeakMap,yn(Vn,"create",((e,t)=>{const n=new _n(e);return e=>(n.run(e),n.toString(t))}));var Wn=n(1570),Hn=n(3686),Kn=n(4254),Jn=n(5715),qn=n(5939),Un=Object.defineProperty,Yn=(e,t,n)=>(((e,t,n)=>{t in e?Un(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n),Zn=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Gn=(e,t,n)=>(Zn(e,t,"read from private field"),n?n.call(e):t.get(e)),Qn=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Xn=(e,t,n,r)=>(Zn(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);const er=(e,t)=>(e.meta={package:"@milkdown/core",group:"System",...t},e),tr=(0,o.CR)("ConfigReady"),nr=(0,o.CR)("InitReady"),rr=(0,o.Z0)([],"initTimer"),or=(0,o.Z0)({},"editor"),ir=(0,o.Z0)([],"inputRules"),sr=(0,o.Z0)([],"prosePlugins"),ar=(0,o.Z0)([],"remarkPlugins"),lr=(0,o.Z0)([],"nodeView"),cr=(0,o.Z0)([],"markView"),ur=(0,o.Z0)(Qt().use($e).use(Et),"remark"),dr=(0,o.Z0)({},"remarkStringifyOptions"),hr=e=>{const t=t=>(t.inject(or,e).inject(sr).inject(ar).inject(ir).inject(lr).inject(cr).inject(dr).inject(ur,Qt().use($e).use(Et)).inject(rr,[tr]).record(nr),async()=>{await t.waitTimers(rr);const e=t.get(dr);return t.set(ur,Qt().use($e).use(Et,e)),t.done(nr),()=>{t.remove(or).remove(sr).remove(ar).remove(ir).remove(lr).remove(cr).remove(dr).remove(ur).remove(rr).clearTimer(nr)}});return er(t,{displayName:"Init"}),t},pr=(0,o.CR)("SchemaReady"),fr=(0,o.Z0)([],"schemaTimer"),mr=(0,o.Z0)({},"schema"),gr=(0,o.Z0)([],"nodes"),yr=(0,o.Z0)([],"marks"),vr=e=>{var t;return{...e,parseDOM:null==(t=e.parseDOM)?void 0:t.map((t=>({priority:e.priority,...t})))}},wr=e=>(e.inject(mr).inject(gr).inject(yr).inject(fr,[nr]).record(pr),async()=>{await e.waitTimers(fr);const t=e.get(ur),n=e.get(ar).reduce(((e,t)=>e.use(t)),t);e.set(ur,n);const r=Object.fromEntries(e.get(gr).map((([e,t])=>[e,vr(t)]))),o=Object.fromEntries(e.get(yr).map((([e,t])=>[e,vr(t)])));return e.set(mr,new i.Sj({nodes:r,marks:o})),e.done(pr),()=>{e.remove(mr).remove(gr).remove(yr).remove(fr).clearTimer(pr)}});er(wr,{displayName:"Schema"});const kr=(0,o.CR)("ParserReady"),br=(0,o.Z0)((()=>{throw(0,mn.dI)()}),"parser"),xr=(0,o.Z0)([],"parserTimer"),Cr=e=>(e.inject(br).inject(xr,[pr]).record(kr),async()=>{await e.waitTimers(xr);const t=e.get(ur),n=e.get(mr);return e.set(br,Nn.create(n,t)),e.done(kr),()=>{e.remove(br).remove(xr).clearTimer(kr)}});er(Cr,{displayName:"Parser"});const Sr=(0,o.CR)("SerializerReady"),Mr=(0,o.Z0)([],"serializerTimer"),Nr=(0,o.Z0)((()=>""),"serializer"),Or=e=>(e.inject(Nr).inject(Mr,[pr]).record(Sr),async()=>{await e.waitTimers(Mr);const t=e.get(ur),n=e.get(mr);return e.set(Nr,Vn.create(n,t)),e.done(Sr),()=>{e.remove(Nr).remove(Mr).clearTimer(Sr)}});er(Or,{displayName:"Serializer"});const Ar=(0,o.Z0)("","defaultValue"),Er=(0,o.Z0)({},"editorState"),Dr=(0,o.Z0)((e=>e),"stateOptions"),Tr=(0,o.Z0)([],"editorStateTimer"),Fr=(0,o.CR)("EditorStateReady"),Ir=new Wn.hs("MILKDOWN_STATE_TRACKER"),Rr=e=>(e.inject(Ar).inject(Er).inject(Dr).inject(Tr,[kr,Sr,Yr]).record(Fr),async()=>{await e.waitTimers(Tr);const t=e.get(mr),n=e.get(br),r=e.get(ir),o=e.get(Dr),s=e.get(sr),a=((e,t,n)=>{if("string"==typeof e)return t(e);if("html"===e.type)return i.S4.fromSchema(n).parse(e.dom);if("json"===e.type)return i.bP.fromJSON(n,e.value);throw(0,mn.j7)(e)})(e.get(Ar),n,t),l=[...s,new Wn.k_({key:Ir,state:{init:()=>{},apply:(t,n,r,o)=>{e.set(Er,o)}}}),(0,Kn.Z6)({rules:r}),(0,qn.w)(Jn.RV)];e.set(sr,l);const c=o({schema:t,doc:a,plugins:l}),u=Wn.$t.create(c);return e.set(Er,u),e.done(Fr),()=>{e.remove(Ar).remove(Er).remove(Dr).remove(Tr).clearTimer(Fr)}});er(Rr,{displayName:"EditorState"});const Pr=(0,o.CR)("EditorViewReady"),Br=(0,o.Z0)({},"editorView"),Lr=(0,o.Z0)([],"editorViewTimer"),zr=(0,o.Z0)({},"editorViewOptions"),$r=(0,o.Z0)(null,"root"),jr=(0,o.Z0)(null,"rootDOM"),_r=(0,o.Z0)({},"rootAttrs"),Vr=new Wn.hs("MILKDOWN_VIEW_CLEAR"),Wr=e=>(e.inject($r,document.body).inject(Br).inject(zr).inject(jr).inject(_r).inject(Lr,[Fr]).record(Pr),async()=>{await e.wait(nr);const t=e.get($r)||document.body,n="string"==typeof t?document.querySelector(t):t;e.update(sr,(t=>[new Wn.k_({key:Vr,view:t=>{const r=n?((e,t)=>{const n=document.createElement("div");n.className="milkdown",e.appendChild(n),t.set(jr,n);const r=t.get(_r);return Object.entries(r).forEach((([e,t])=>n.setAttribute(e,t))),n})(n,e):void 0;return(()=>{if(r&&n){const e=t.dom;n.replaceChild(r,e),r.appendChild(e)}})(),{destroy:()=>{null!=r&&r.parentNode&&(null==r||r.parentNode.replaceChild(t.dom,r)),null==r||r.remove()}}}}),...t])),await e.waitTimers(Lr);const r=e.get(Er),o=e.get(zr),i=Object.fromEntries(e.get(lr)),s=Object.fromEntries(e.get(cr)),a=new Hn.Lz(n,{state:r,nodeViews:i,markViews:s,...o});return(e=>{e.classList.add("editor"),e.setAttribute("role","textbox")})(a.dom),e.set(Br,a),e.done(Pr),()=>{null==a||a.destroy(),e.remove($r).remove(Br).remove(zr).remove(jr).remove(_r).remove(Lr).clearTimer(Pr)}});var Hr,Kr;er(Wr,{displayName:"EditorView"}),Hr=new WeakMap,Kr=new WeakMap;const Jr=(e="cmdKey")=>(0,o.Z0)((()=>()=>!1),e),qr=(0,o.Z0)(new class{constructor(){Qn(this,Hr,new o.mc),Qn(this,Kr,null),Yn(this,"setCtx",(e=>{Xn(this,Kr,e)}))}create(e,t){const n=e.create(Gn(this,Hr).sliceMap);return n.set(t),n}get(e){return Gn(this,Hr).get(e).get()}remove(e){return Gn(this,Hr).remove(e)}call(e,t){if(null==Gn(this,Kr))throw(0,mn.zD)();const n=this.get(e)(t),r=Gn(this,Kr).get(Br);return n(r.state,r.dispatch,r)}},"commands"),Ur=(0,o.Z0)([pr],"commandsTimer"),Yr=(0,o.CR)("CommandsReady"),Zr=e=>(e.inject(qr).inject(Ur).record(Yr),e.get(qr).setCtx(e),async()=>(await e.waitTimers(Ur),e.done(Yr),()=>{e.remove(qr).remove(Ur).clearTimer(Yr)}));var Gr,Qr,Xr,eo,to,no,ro,oo,io,so,ao,lo,co,uo,ho;er(Zr,{displayName:"Commands"});const po=class{constructor(){Qn(this,Gr,!1),Qn(this,Qr,"Idle"),Qn(this,Xr,[]),Qn(this,eo,(()=>{})),Qn(this,to,new o.mc),Qn(this,no,new o.zD),Qn(this,ro,new Map),Qn(this,oo,new Map),Qn(this,io,new o.Kj(Gn(this,to),Gn(this,no))),Qn(this,so,(()=>{const e=(e=>{const t=t=>(t.record(tr),async()=>(await e(t),t.done(tr),()=>{t.clearTimer(tr)}));return er(t,{displayName:"Config"}),t})((async e=>{await Promise.all(Gn(this,Xr).map((t=>t(e))))})),t=[wr,Cr,Or,Zr,Rr,Wr,hr(this),e];Gn(this,ao).call(this,t,Gn(this,oo))})),Qn(this,ao,((e,t)=>{e.forEach((e=>{const n=Gn(this,io).produce(Gn(this,Gr)?e.meta:void 0),r=e(n);t.set(e,{ctx:n,handler:r,cleanup:void 0})}))})),Qn(this,lo,((e,t=!1)=>Promise.all([e].flat().map((e=>{const n=Gn(this,ro).get(e),r=null==n?void 0:n.cleanup;return t?Gn(this,ro).delete(e):Gn(this,ro).set(e,{ctx:void 0,handler:void 0,cleanup:void 0}),"function"==typeof r?r():r}))))),Qn(this,co,(async()=>{await Promise.all([...Gn(this,oo).entries()].map((([e,{cleanup:t}])=>"function"==typeof t?t():t))),Gn(this,oo).clear()})),Qn(this,uo,(e=>{Xn(this,Qr,e),Gn(this,eo).call(this,e)})),Qn(this,ho,(e=>[...e.entries()].map((async([t,n])=>{const{ctx:r,handler:o}=n;if(!o)return;const i=await o();e.set(t,{ctx:r,handler:o,cleanup:i})})))),Yn(this,"enableInspector",((e=!0)=>(Xn(this,Gr,e),this))),Yn(this,"onStatusChange",(e=>(Xn(this,eo,e),this))),Yn(this,"config",(e=>(Gn(this,Xr).push(e),this))),Yn(this,"removeConfig",(e=>(Xn(this,Xr,Gn(this,Xr).filter((t=>t!==e))),this))),Yn(this,"use",(e=>{const t=[e].flat();return t.flat().forEach((e=>{Gn(this,ro).set(e,{ctx:void 0,handler:void 0,cleanup:void 0})})),"Created"===Gn(this,Qr)&&Gn(this,ao).call(this,t,Gn(this,ro)),this})),Yn(this,"remove",(async e=>"OnCreate"===Gn(this,Qr)?(console.warn("[Milkdown]: You are trying to remove plugins when the editor is creating, this is not recommended, please check your code."),new Promise((t=>{setTimeout((()=>{t(this.remove(e))}),50)}))):(await Gn(this,lo).call(this,[e].flat(),!0),this))),Yn(this,"create",(async()=>("OnCreate"===Gn(this,Qr)||("Created"===Gn(this,Qr)&&await this.destroy(),Gn(this,uo).call(this,"OnCreate"),Gn(this,so).call(this),Gn(this,ao).call(this,[...Gn(this,ro).keys()],Gn(this,ro)),await Promise.all([Gn(this,ho).call(this,Gn(this,oo)),Gn(this,ho).call(this,Gn(this,ro))].flat()),Gn(this,uo).call(this,"Created")),this))),Yn(this,"destroy",(async(e=!1)=>"Destroyed"===Gn(this,Qr)||"OnDestroy"===Gn(this,Qr)?this:"OnCreate"===Gn(this,Qr)?new Promise((t=>{setTimeout((()=>{t(this.destroy(e))}),50)})):(e&&Xn(this,Xr,[]),Gn(this,uo).call(this,"OnDestroy"),await Gn(this,lo).call(this,[...Gn(this,ro).keys()],e),await Gn(this,co).call(this),Gn(this,uo).call(this,"Destroyed"),this))),Yn(this,"action",(e=>e(Gn(this,io)))),Yn(this,"inspect",(()=>Gn(this,Gr)?[...Gn(this,oo).values(),...Gn(this,ro).values()].map((({ctx:e})=>{var t;return null==(t=null==e?void 0:e.inspector)?void 0:t.read()})).filter((e=>Boolean(e))):(console.warn("[Milkdown]: You are trying to collect inspection when inspector is disabled, please enable inspector by `editor.enableInspector()` first."),[])))}static make(){return new po}get ctx(){return Gn(this,io)}get status(){return Gn(this,Qr)}};let fo=po;Gr=new WeakMap,Qr=new WeakMap,Xr=new WeakMap,eo=new WeakMap,to=new WeakMap,no=new WeakMap,ro=new WeakMap,oo=new WeakMap,io=new WeakMap,so=new WeakMap,ao=new WeakMap,lo=new WeakMap,co=new WeakMap,uo=new WeakMap,ho=new WeakMap},2402:(e,t,n)=>{"use strict";n.d(t,{AL:()=>Y,D8:()=>de,GU:()=>re,J3:()=>u,LF:()=>pe,RC:()=>ne,_t:()=>ee,aH:()=>v,aR:()=>ae,gR:()=>ie,i4:()=>le,kG:()=>he,of:()=>f,rn:()=>M});var r,o,i=n(1570),s=n(6090),a=n(3686),l=n(5939),c=n(1329);if("undefined"!=typeof WeakMap){let e=new WeakMap;r=t=>e.get(t),o=(t,n)=>(e.set(t,n),n)}else{const e=[],t=10;let n=0;r=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},o=(r,o)=>(n==t&&(n=0),e[n++]=r,e[n++]=o)}var u=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){const n=this.map[t];if(n!=e)continue;const r=t%this.width,o=t/this.width|0;let i=r+1,s=o+1;for(let e=1;i<this.width&&this.map[t+e]==n;e++)i++;for(let e=1;s<this.height&&this.map[t+this.width*e]==n;e++)s++;return{left:r,top:o,right:i,bottom:s}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){const{left:r,right:o,top:i,bottom:s}=this.findCell(e);return"horiz"==t?(n<0?0==r:o==this.width)?null:this.map[i*this.width+(n<0?r-1:o)]:(n<0?0==i:s==this.height)?null:this.map[r+this.width*(n<0?i-1:s)]}rectBetween(e,t){const{left:n,right:r,top:o,bottom:i}=this.findCell(e),{left:s,right:a,top:l,bottom:c}=this.findCell(t);return{left:Math.min(n,s),top:Math.min(o,l),right:Math.max(r,a),bottom:Math.max(i,c)}}cellsInRect(e){const t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let o=e.left;o<e.right;o++){const i=r*this.width+o,s=this.map[i];n[s]||(n[s]=!0,o==e.left&&o&&this.map[i-1]==s||r==e.top&&r&&this.map[i-this.width]==s||t.push(s))}return t}positionAt(e,t,n){for(let r=0,o=0;;r++){const i=o+n.child(r).nodeSize;if(r==e){let n=t+e*this.width;const r=(e+1)*this.width;for(;n<r&&this.map[n]<o;)n++;return n==r?i-1:this.map[n]}o=i}}static get(e){return r(e)||o(e,function(e){if("table"!=e.type.spec.tableRole)throw new RangeError("Not a table node: "+e.type.name);const t=function(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){const o=e.child(r);let i=0;if(n)for(let t=0;t<r;t++){const n=e.child(t);for(let e=0;e<n.childCount;e++){const o=n.child(e);t+o.attrs.rowspan>r&&(i+=o.attrs.colspan)}}for(let e=0;e<o.childCount;e++){const t=o.child(e);i+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}-1==t?t=i:t!=i&&(t=Math.max(t,i))}return t}(e),n=e.childCount,r=[];let o=0,i=null;const s=[];for(let e=0,o=t*n;e<o;e++)r[e]=0;for(let a=0,l=0;a<n;a++){const c=e.child(a);l++;for(let e=0;;e++){for(;o<r.length&&0!=r[o];)o++;if(e==c.childCount)break;const u=c.child(e),{colspan:d,rowspan:h,colwidth:p}=u.attrs;for(let e=0;e<h;e++){if(e+a>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:l,n:h-e});break}const c=o+e*t;for(let e=0;e<d;e++){0==r[c+e]?r[c+e]=l:(i||(i=[])).push({type:"collision",row:a,pos:l,n:d-e});const n=p&&p[e];if(n){const r=(c+e)%t*2,o=s[r];null==o||o!=n&&1==s[r+1]?(s[r]=n,s[r+1]=1):o==n&&s[r+1]++}}}o+=d,l+=u.nodeSize}const u=(a+1)*t;let d=0;for(;o<u;)0==r[o++]&&d++;d&&(i||(i=[])).push({type:"missing",row:a,n:d}),l++}const a=new u(t,n,r,i);let l=!1;for(let e=0;!l&&e<s.length;e+=2)null!=s[e]&&s[e+1]<n&&(l=!0);return l&&function(e,t,n){e.problems||(e.problems=[]);const r={};for(let o=0;o<e.map.length;o++){const i=e.map[o];if(r[i])continue;r[i]=!0;const s=n.nodeAt(i);if(!s)throw new RangeError(`No cell with offset ${i} found`);let a=null;const l=s.attrs;for(let n=0;n<l.colspan;n++){const r=t[(o+n)%e.width*2];null==r||l.colwidth&&l.colwidth[n]==r||((a||(a=d(l)))[n]=r)}a&&e.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:a})}}(a,s,e),a}(e))}};function d(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function h(e,t){if("string"==typeof e)return{};const n=e.getAttribute("data-colwidth"),r=n&&/^\d+(,\d+)*$/.test(n)?n.split(",").map((e=>Number(e))):null,o=Number(e.getAttribute("colspan")||1),i={colspan:o,rowspan:Number(e.getAttribute("rowspan")||1),colwidth:r&&r.length==o?r:null};for(const n in t){const r=t[n].getFromDOM,o=r&&r(e);null!=o&&(i[n]=o)}return i}function p(e,t){const n={};1!=e.attrs.colspan&&(n.colspan=e.attrs.colspan),1!=e.attrs.rowspan&&(n.rowspan=e.attrs.rowspan),e.attrs.colwidth&&(n["data-colwidth"]=e.attrs.colwidth.join(","));for(const r in t){const o=t[r].setDOMAttr;o&&o(e.attrs[r],n)}return n}function f(e){const t=e.cellAttributes||{},n={colspan:{default:1},rowspan:{default:1},colwidth:{default:null}};for(const e in t)n[e]={default:t[e].default};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:e.tableGroup,parseDOM:[{tag:"table"}],toDOM:()=>["table",["tbody",0]]},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM:()=>["tr",0]},table_cell:{content:e.cellContent,attrs:n,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:e=>h(e,t)}],toDOM:e=>["td",p(e,t),0]},table_header:{content:e.cellContent,attrs:n,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:e=>h(e,t)}],toDOM:e=>["th",p(e,t),0]}}}function m(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(const n in e.nodes){const r=e.nodes[n],o=r.spec.tableRole;o&&(t[o]=r)}}return t}var g=new i.hs("selectingCells");function y(e){for(let t=e.depth-1;t>0;t--)if("row"==e.node(t).type.spec.tableRole)return e.node(0).resolve(e.before(t+1));return null}function v(e){const t=e.selection.$head;for(let e=t.depth;e>0;e--)if("row"==t.node(e).type.spec.tableRole)return!0;return!1}function w(e){const t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&"cell"==t.node.type.spec.tableRole)return t.$anchor;const n=y(t.$head)||function(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){const r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){const r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n-t.nodeSize)}}(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function k(e){return"row"==e.parent.type.spec.tableRole&&!!e.nodeAfter}function b(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function x(e,t,n){const r=e.node(-1),o=u.get(r),i=e.start(-1),s=o.nextCell(e.pos-i,t,n);return null==s?null:e.node(0).resolve(i+s)}function C(e,t,n=1){const r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some((e=>e>0))||(r.colwidth=null)),r}function S(e,t,n=1){const r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}var M=class extends i.LN{constructor(e,t=e){const n=e.node(-1),r=u.get(n),o=e.start(-1),s=r.rectBetween(e.pos-o,t.pos-o),a=e.node(0),l=r.cellsInRect(s).filter((e=>e!=t.pos-o));l.unshift(t.pos-o);const c=l.map((e=>{const t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);const r=o+e+1;return new i.yn(a.resolve(r),a.resolve(r+t.content.size))}));super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){const n=e.resolve(t.map(this.$anchorCell.pos)),r=e.resolve(t.map(this.$headCell.pos));if(k(n)&&k(r)&&b(n,r)){const e=this.$anchorCell.node(-1)!=n.node(-1);return e&&this.isRowSelection()?M.rowSelection(n,r):e&&this.isColSelection()?M.colSelection(n,r):new M(n,r)}return i.U3.between(n,r)}content(){const e=this.$anchorCell.node(-1),t=u.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),o={},i=[];for(let n=r.top;n<r.bottom;n++){const a=[];for(let i=n*t.width+r.left,s=r.left;s<r.right;s++,i++){const n=t.map[i];if(o[n])continue;o[n]=!0;const s=t.findCell(n);let l=e.nodeAt(n);if(!l)throw RangeError(`No cell with offset ${n} found`);const c=r.left-s.left,u=s.right-r.right;if(c>0||u>0){let e=l.attrs;if(c>0&&(e=C(e,0,c)),u>0&&(e=C(e,e.colspan-u,u)),s.left<r.left){if(l=l.type.createAndFill(e),!l)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else l=l.type.create(e,l.content)}if(s.top<r.top||s.bottom>r.bottom){const e={...l.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};l=s.top<r.top?l.type.createAndFill(e):l.type.create(e,l.content)}a.push(l)}i.push(e.child(n).copy(s.FK.from(a)))}const a=this.isColSelection()&&this.isRowSelection()?e:i;return new s.Ji(s.FK.from(a),1,1)}replace(e,t=s.Ji.empty){const n=e.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){const{$from:i,$to:a}=r[o],l=e.mapping.slice(n);e.replace(l.map(i.pos),l.map(a.pos),o?s.Ji.empty:t)}const o=i.LN.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);o&&e.setSelection(o)}replaceWith(e,t){this.replace(e,new s.Ji(s.FK.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),n=u.get(t),r=this.$anchorCell.start(-1),o=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<o.length;n++)e(t.nodeAt(o[n]),r+o[n])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const n=e.node(-1),r=u.get(n),o=e.start(-1),i=r.findCell(e.pos-o),s=r.findCell(t.pos-o),a=e.node(0);return i.top<=s.top?(i.top>0&&(e=a.resolve(o+r.map[i.left])),s.bottom<r.height&&(t=a.resolve(o+r.map[r.width*(r.height-1)+s.right-1]))):(s.top>0&&(t=a.resolve(o+r.map[s.left])),i.bottom<r.height&&(e=a.resolve(o+r.map[r.width*(r.height-1)+i.right-1]))),new M(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=u.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),o=t.colCount(this.$headCell.pos-n);if(Math.min(r,o)>0)return!1;const i=r+this.$anchorCell.nodeAfter.attrs.colspan,s=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(i,s)==t.width}eq(e){return e instanceof M&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const n=e.node(-1),r=u.get(n),o=e.start(-1),i=r.findCell(e.pos-o),s=r.findCell(t.pos-o),a=e.node(0);return i.left<=s.left?(i.left>0&&(e=a.resolve(o+r.map[i.top*r.width])),s.right<r.width&&(t=a.resolve(o+r.map[r.width*(s.top+1)-1]))):(s.left>0&&(t=a.resolve(o+r.map[s.top*r.width])),i.right<r.width&&(e=a.resolve(o+r.map[r.width*(i.top+1)-1]))),new M(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new M(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){return new M(e.resolve(t),e.resolve(n))}getBookmark(){return new N(this.$anchorCell.pos,this.$headCell.pos)}};M.prototype.visible=!1,i.LN.jsonID("cell",M);var N=class{constructor(e,t){this.anchor=e,this.head=t}map(e){return new N(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),n=e.resolve(this.head);return"row"==t.parent.type.spec.tableRole&&"row"==n.parent.type.spec.tableRole&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&b(t,n)?new M(t,n):i.LN.near(n,1)}};function O(e){if(!(e.selection instanceof M))return null;const t=[];return e.selection.forEachCell(((e,n)=>{t.push(a.NZ.node(n,n+e.nodeSize,{class:"selectedCell"}))})),a.zF.create(e.doc,t)}var A=new i.hs("fix-tables");function E(e,t,n,r){const o=e.childCount,i=t.childCount;e:for(let s=0,a=0;s<i;s++){const i=t.child(s);for(let t=a,r=Math.min(o,s+3);t<r;t++)if(e.child(t)==i){a=t+1,n+=i.nodeSize;continue e}r(i,n),a<o&&e.child(a).sameMarkup(i)?E(e.child(a),i,n+1,r):i.nodesBetween(0,i.content.size,r,n+1),n+=i.nodeSize}}function D(e,t){let n;const r=(t,r)=>{"table"==t.type.spec.tableRole&&(n=function(e,t,n,r){const o=u.get(t);if(!o.problems)return r;r||(r=e.tr);const i=[];for(let e=0;e<o.height;e++)i.push(0);for(let e=0;e<o.problems.length;e++){const s=o.problems[e];if("collision"==s.type){const e=t.nodeAt(s.pos);if(!e)continue;const o=e.attrs;for(let e=0;e<o.rowspan;e++)i[s.row+e]+=s.n;r.setNodeMarkup(r.mapping.map(n+1+s.pos),null,C(o,o.colspan-s.n,s.n))}else if("missing"==s.type)i[s.row]+=s.n;else if("overlong_rowspan"==s.type){const e=t.nodeAt(s.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+s.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-s.n})}else if("colwidth mismatch"==s.type){const e=t.nodeAt(s.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+s.pos),null,{...e.attrs,colwidth:s.colwidth})}}let s,a;for(let e=0;e<i.length;e++)i[e]&&(null==s&&(s=e),a=e);for(let l=0,c=n+1;l<o.height;l++){const n=t.child(l),o=c+n.nodeSize,u=i[l];if(u>0){let t="cell";n.firstChild&&(t=n.firstChild.type.spec.tableRole);const i=[];for(let n=0;n<u;n++){const n=m(e.schema)[t].createAndFill();n&&i.push(n)}const d=0!=l&&s!=l-1||a!=l?o-1:c+1;r.insert(r.mapping.map(d),i)}c=o}return r.setMeta(A,{fixTables:!0})}(e,t,r,n))};return t?t.doc!=e.doc&&E(t.doc,e.doc,0,r):e.doc.descendants(r),n}function T(e,t){const n=e.createAndFill();return new c.dL(n).replace(0,n.content.size,t).doc}function F(e,t,n,r,o,i,s,a){if(0==s||s==t.height)return!1;let l=!1;for(let c=o;c<i;c++){const o=s*t.width+c,i=t.map[o];if(t.map[o-t.width]==i){l=!0;const o=n.nodeAt(i),{top:u,left:d}=t.findCell(i);e.setNodeMarkup(e.mapping.slice(a).map(i+r),null,{...o.attrs,rowspan:s-u}),e.insert(e.mapping.slice(a).map(t.positionAt(s,d,n)),o.type.createAndFill({...o.attrs,rowspan:u+o.attrs.rowspan-s})),c+=o.attrs.colspan-1}}return l}function I(e,t,n,r,o,i,s,a){if(0==s||s==t.width)return!1;let l=!1;for(let c=o;c<i;c++){const o=c*t.width+s,i=t.map[o];if(t.map[o-1]==i){l=!0;const o=n.nodeAt(i),u=t.colCount(i),d=e.mapping.slice(a).map(i+r);e.setNodeMarkup(d,null,C(o.attrs,s-u,o.attrs.colspan-(s-u))),e.insert(d+o.nodeSize,o.type.createAndFill(C(o.attrs,0,s-u))),c+=o.attrs.rowspan-1}}return l}function R(e,t,n,r,o){let i=n?e.doc.nodeAt(n-1):e.doc;if(!i)throw new Error("No table found");let a=u.get(i);const{top:l,left:c}=r,d=c+o.width,h=l+o.height,p=e.tr;let f=0;function g(){if(i=n?p.doc.nodeAt(n-1):p.doc,!i)throw new Error("No table found");a=u.get(i),f=p.mapping.maps.length}(function(e,t,n,r,o,i,a){const l=m(e.doc.type.schema);let c,u;if(o>t.width)for(let i=0,s=0;i<t.height;i++){const d=n.child(i);s+=d.nodeSize;const h=[];let p;p=null==d.lastChild||d.lastChild.type==l.cell?c||(c=l.cell.createAndFill()):u||(u=l.header_cell.createAndFill());for(let e=t.width;e<o;e++)h.push(p);e.insert(e.mapping.slice(a).map(s-1+r),h)}if(i>t.height){const d=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,o);e++){const o=!(e>=t.width)&&n.nodeAt(t.map[r+e]).type==l.header_cell;d.push(o?u||(u=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()))}const h=l.row.create(null,s.FK.from(d)),p=[];for(let e=t.height;e<i;e++)p.push(h);e.insert(e.mapping.slice(a).map(r+n.nodeSize-2),p)}return!(!c&&!u)})(p,a,i,n,d,h,f)&&g(),F(p,a,i,n,c,d,l,f)&&g(),F(p,a,i,n,c,d,h,f)&&g(),I(p,a,i,n,l,h,c,f)&&g(),I(p,a,i,n,l,h,d,f)&&g();for(let e=l;e<h;e++){const t=a.positionAt(e,c,i),r=a.positionAt(e,d,i);p.replace(p.mapping.slice(f).map(t+n),p.mapping.slice(f).map(r+n),new s.Ji(o.rows[e-l],0,0))}g(),p.setSelection(new M(p.doc.resolve(n+a.positionAt(l,c,i)),p.doc.resolve(n+a.positionAt(h-1,d-1,i)))),t(p)}var P=(0,l.K)({ArrowLeft:L("horiz",-1),ArrowRight:L("horiz",1),ArrowUp:L("vert",-1),ArrowDown:L("vert",1),"Shift-ArrowLeft":z("horiz",-1),"Shift-ArrowRight":z("horiz",1),"Shift-ArrowUp":z("vert",-1),"Shift-ArrowDown":z("vert",1),Backspace:$,"Mod-Backspace":$,Delete:$,"Mod-Delete":$});function B(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function L(e,t){return(n,r,o)=>{if(!o)return!1;const s=n.selection;if(s instanceof M)return B(n,r,i.LN.near(s.$headCell,t));if("horiz"!=e&&!s.empty)return!1;const a=W(o,e,t);if(null==a)return!1;if("horiz"==e)return B(n,r,i.LN.near(n.doc.resolve(s.head+t),t));{const o=n.doc.resolve(a),s=x(o,e,t);let l;return l=s?i.LN.near(s,1):t<0?i.LN.near(n.doc.resolve(o.before(-1)),-1):i.LN.near(n.doc.resolve(o.after(-1)),1),B(n,r,l)}}}function z(e,t){return(n,r,o)=>{if(!o)return!1;const i=n.selection;let s;if(i instanceof M)s=i;else{const r=W(o,e,t);if(null==r)return!1;s=new M(n.doc.resolve(r))}const a=x(s.$headCell,e,t);return!!a&&B(n,r,new M(s.$anchorCell,a))}}function $(e,t){const n=e.selection;if(!(n instanceof M))return!1;if(t){const r=e.tr,o=m(e.schema).cell.createAndFill().content;n.forEachCell(((e,t)=>{e.content.eq(o)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new s.Ji(o,0,0))})),r.docChanged&&t(r)}return!0}function j(e,t){const n=y(e.state.doc.resolve(t));return!!n&&(e.dispatch(e.state.tr.setSelection(new M(n))),!0)}function _(e,t,n){if(!v(e.state))return!1;let r=function(e){if(!e.size)return null;let{content:t,openStart:n,openEnd:r}=e;for(;1==t.childCount&&(n>0&&r>0||"table"==t.child(0).type.spec.tableRole);)n--,r--,t=t.child(0).content;const o=t.child(0),i=o.type.spec.tableRole,a=o.type.schema,l=[];if("row"==i)for(let e=0;e<t.childCount;e++){let o=t.child(e).content;const i=e?0:Math.max(0,n-1),c=e<t.childCount-1?0:Math.max(0,r-1);(i||c)&&(o=T(m(a).row,new s.Ji(o,i,c)).content),l.push(o)}else{if("cell"!=i&&"header_cell"!=i)return null;l.push(n||r?T(m(a).row,new s.Ji(t,n,r)).content:t)}return function(e,t){const n=[];for(let e=0;e<t.length;e++){const r=t[e];for(let t=r.childCount-1;t>=0;t--){const{rowspan:o,colspan:i}=r.child(t).attrs;for(let t=e;t<e+o;t++)n[t]=(n[t]||0)+i}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let o=0;o<n.length;o++)if(o>=t.length&&t.push(s.FK.empty),n[o]<r){const i=m(e).cell.createAndFill(),a=[];for(let e=n[o];e<r;e++)a.push(i);t[o]=t[o].append(s.FK.from(a))}return{height:t.length,width:r,rows:t}}(a,l)}(n);const o=e.state.selection;if(o instanceof M){r||(r={width:1,height:1,rows:[s.FK.from(T(m(e.state.schema).cell,n))]});const t=o.$anchorCell.node(-1),i=o.$anchorCell.start(-1),a=u.get(t).rectBetween(o.$anchorCell.pos-i,o.$headCell.pos-i);return r=function({width:e,height:t,rows:n},r,o){if(e!=r){const t=[],o=[];for(let e=0;e<n.length;e++){const i=n[e],a=[];for(let n=t[e]||0,o=0;n<r;o++){let s=i.child(o%i.childCount);n+s.attrs.colspan>r&&(s=s.type.createChecked(C(s.attrs,s.attrs.colspan,n+s.attrs.colspan-r),s.content)),a.push(s),n+=s.attrs.colspan;for(let n=1;n<s.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+s.attrs.colspan}o.push(s.FK.from(a))}n=o,e=r}if(t!=o){const e=[];for(let r=0,i=0;r<o;r++,i++){const a=[],l=n[i%t];for(let e=0;e<l.childCount;e++){let t=l.child(e);r+t.attrs.rowspan>o&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,o-t.attrs.rowspan)},t.content)),a.push(t)}e.push(s.FK.from(a))}n=e,t=o}return{width:e,height:t,rows:n}}(r,a.right-a.left,a.bottom-a.top),R(e.state,e.dispatch,i,a,r),!0}if(r){const t=w(e.state),n=t.start(-1);return R(e.state,e.dispatch,n,u.get(t.node(-1)).findCell(t.pos-n),r),!0}return!1}function V(e,t){var n;if(t.ctrlKey||t.metaKey)return;const r=H(e,t.target);let o;if(t.shiftKey&&e.state.selection instanceof M)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&r&&null!=(o=y(e.state.selection.$anchor))&&(null==(n=K(e,t))?void 0:n.pos)!=o.pos)i(o,t),t.preventDefault();else if(!r)return;function i(t,n){let r=K(e,n);const o=null==g.getState(e.state);if(!r||!b(t,r)){if(!o)return;r=t}const i=new M(t,r);if(o||!e.state.selection.eq(i)){const n=e.state.tr.setSelection(i);o&&n.setMeta(g,t.pos),e.dispatch(n)}}function s(){e.root.removeEventListener("mouseup",s),e.root.removeEventListener("dragstart",s),e.root.removeEventListener("mousemove",a),null!=g.getState(e.state)&&e.dispatch(e.state.tr.setMeta(g,-1))}function a(n){const o=n,a=g.getState(e.state);let l;if(null!=a)l=e.state.doc.resolve(a);else if(H(e,o.target)!=r&&(l=K(e,t),!l))return s();l&&i(l,o)}e.root.addEventListener("mouseup",s),e.root.addEventListener("dragstart",s),e.root.addEventListener("mousemove",a)}function W(e,t,n){if(!(e.state.selection instanceof i.U3))return null;const{$head:r}=e.state.selection;for(let o=r.depth-1;o>=0;o--){const i=r.node(o);if((n<0?r.index(o):r.indexAfter(o))!=(n<0?0:i.childCount))return null;if("cell"==i.type.spec.tableRole||"header_cell"==i.type.spec.tableRole){const i=r.before(o),s="vert"==t?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(s)?i:null}}return null}function H(e,t){for(;t&&t!=e.dom;t=t.parentNode)if("TD"==t.nodeName||"TH"==t.nodeName)return t;return null}function K(e,t){const n=e.posAtCoords({left:t.clientX,top:t.clientY});return n&&n?y(e.state.doc.resolve(n.pos)):null}var J=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")),q(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type==this.node.type&&(this.node=e,q(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return"attributes"==e.type&&(e.target==this.table||this.colgroup.contains(e.target))}};function q(e,t,n,r,o,i){var s;let a=0,l=!0,c=t.firstChild;const u=e.firstChild;if(u){for(let e=0,n=0;e<u.childCount;e++){const{colspan:s,colwidth:d}=u.child(e).attrs;for(let e=0;e<s;e++,n++){const s=o==n?i:d&&d[e],u=s?s+"px":"";a+=s||r,s||(l=!1),c?(c.style.width!=u&&(c.style.width=u),c=c.nextSibling):t.appendChild(document.createElement("col")).style.width=u}}for(;c;){const e=c.nextSibling;null==(s=c.parentNode)||s.removeChild(c),c=e}l?(n.style.width=a+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=a+"px")}}var U=new i.hs("tableColumnResizing");function Y({handleWidth:e=5,cellMinWidth:t=25,View:n=J,lastColumnResizable:r=!0}={}){const o=new i.k_({key:U,state:{init:(e,r)=>(o.spec.props.nodeViews[m(r.schema).table.name]=(e,r)=>new n(e,t,r),new Z(-1,!1)),apply:(e,t)=>t.apply(e)},props:{attributes:e=>{const t=U.getState(e);return t&&t.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(t,n)=>{!function(e,t,n,r,o){const i=U.getState(e.state);if(i&&!i.dragging){const r=function(e){for(;e&&"TD"!=e.nodeName&&"TH"!=e.nodeName;)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}(t.target);let s=-1;if(r){const{left:o,right:i}=r.getBoundingClientRect();t.clientX-o<=n?s=G(e,t,"left"):i-t.clientX<=n&&(s=G(e,t,"right"))}if(s!=i.activeHandle){if(!o&&-1!==s){const t=e.state.doc.resolve(s),n=t.node(-1),r=u.get(n),o=t.start(-1);if(r.colCount(t.pos-o)+t.nodeAfter.attrs.colspan-1==r.width-1)return}X(e,s)}}}(t,n,e,0,r)},mouseleave:e=>{!function(e){const t=U.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&X(e,-1)}(e)},mousedown:(e,n)=>{!function(e,t,n){const r=U.getState(e.state);if(!r||-1==r.activeHandle||r.dragging)return!1;const o=e.state.doc.nodeAt(r.activeHandle),i=function(e,t,{colspan:n,colwidth:r}){const o=r&&r[r.length-1];if(o)return o;const i=e.domAtPos(t);let s=i.node.childNodes[i.offset].offsetWidth,a=n;if(r)for(let e=0;e<n;e++)r[e]&&(s-=r[e],a--);return s/a}(e,r.activeHandle,o.attrs);function s(t){window.removeEventListener("mouseup",s),window.removeEventListener("mousemove",a);const r=U.getState(e.state);(null==r?void 0:r.dragging)&&(function(e,t,n){const r=e.state.doc.resolve(t),o=r.node(-1),i=u.get(o),s=r.start(-1),a=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,l=e.state.tr;for(let e=0;e<i.height;e++){const t=e*i.width+a;if(e&&i.map[t]==i.map[t-i.width])continue;const r=i.map[t],u=o.nodeAt(r).attrs,d=1==u.colspan?0:a-i.colCount(r);if(u.colwidth&&u.colwidth[d]==n)continue;const h=u.colwidth?u.colwidth.slice():(c=u.colspan,Array(c).fill(0));h[d]=n,l.setNodeMarkup(s+r,null,{...u,colwidth:h})}var c;l.docChanged&&e.dispatch(l)}(e,r.activeHandle,Q(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(U,{setDragging:null})))}function a(t){if(!t.which)return s(t);const r=U.getState(e.state);if(r&&r.dragging){const o=Q(r.dragging,t,n);!function(e,t,n,r){const o=e.state.doc.resolve(t),i=o.node(-1),s=o.start(-1),a=u.get(i).colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;let l=e.domAtPos(o.start(-1)).node;for(;l&&"TABLE"!=l.nodeName;)l=l.parentNode;l&&q(i,l.firstChild,l,r,a,n)}(e,r.activeHandle,o,n)}}e.dispatch(e.state.tr.setMeta(U,{setDragging:{startX:t.clientX,startWidth:i}})),window.addEventListener("mouseup",s),window.addEventListener("mousemove",a),t.preventDefault()}(e,n,t)}},decorations:e=>{const t=U.getState(e);if(t&&t.activeHandle>-1)return function(e,t){const n=[],r=e.doc.resolve(t),o=r.node(-1);if(!o)return a.zF.empty;const i=u.get(o),s=r.start(-1),l=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan;for(let e=0;e<i.height;e++){const t=l+e*i.width-1;if(!(l!=i.width&&i.map[t]==i.map[t+1]||0!=e&&i.map[t-1]==i.map[t-1-i.width])){const e=i.map[t],r=s+e+o.nodeAt(e).nodeSize-1,l=document.createElement("div");l.className="column-resize-handle",n.push(a.NZ.widget(r,l))}}return a.zF.create(e.doc,n)}(e,t.activeHandle)},nodeViews:{}}});return o}var Z=class{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,n=e.getMeta(U);if(n&&null!=n.setHandle)return new Z(n.setHandle,!1);if(n&&void 0!==n.setDragging)return new Z(t.activeHandle,n.setDragging);if(t.activeHandle>-1&&e.docChanged){let n=e.mapping.map(t.activeHandle,-1);return k(e.doc.resolve(n))||(n=-1),new Z(n,t.dragging)}return t}};function G(e,t,n){const r=e.posAtCoords({left:t.clientX,top:t.clientY});if(!r)return-1;const{pos:o}=r,i=y(e.state.doc.resolve(o));if(!i)return-1;if("right"==n)return i.pos;const s=u.get(i.node(-1)),a=i.start(-1),l=s.map.indexOf(i.pos-a);return l%s.width==0?-1:a+s.map[l-1]}function Q(e,t,n){const r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function X(e,t){e.dispatch(e.state.tr.setMeta(U,{setHandle:t}))}function ee(e){const t=e.selection,n=w(e),r=n.node(-1),o=n.start(-1),i=u.get(r);return{...t instanceof M?i.rectBetween(t.$anchorCell.pos-o,t.$headCell.pos-o):i.findCell(n.pos-o),tableStart:o,map:i,table:r}}function te(e,{map:t,tableStart:n,table:r},o){let i=o>0?-1:0;(function(e,t,n){const r=m(t.type.schema).header_cell;for(let o=0;o<e.height;o++)if(t.nodeAt(e.map[n+o*e.width]).type!=r)return!1;return!0})(t,r,o+i)&&(i=0==o||o==t.width?null:0);for(let s=0;s<t.height;s++){const a=s*t.width+o;if(o>0&&o<t.width&&t.map[a-1]==t.map[a]){const i=t.map[a],l=r.nodeAt(i);e.setNodeMarkup(e.mapping.map(n+i),null,S(l.attrs,o-t.colCount(i))),s+=l.attrs.rowspan-1}else{const l=null==i?m(r.type.schema).cell:r.nodeAt(t.map[a+i]).type,c=t.positionAt(s,o,r);e.insert(e.mapping.map(n+c),l.createAndFill())}}return e}function ne(e,t){if(!v(e))return!1;if(t){const n=ee(e);t(te(e.tr,n,n.left))}return!0}function re(e,t){if(!v(e))return!1;if(t){const n=ee(e);t(te(e.tr,n,n.right))}return!0}function oe(e,{map:t,table:n,tableStart:r},o){const i=e.mapping.maps.length;for(let s=0;s<t.height;){const a=s*t.width+o,l=t.map[a],c=n.nodeAt(l),u=c.attrs;if(o>0&&t.map[a-1]==l||o<t.width-1&&t.map[a+1]==l)e.setNodeMarkup(e.mapping.slice(i).map(r+l),null,C(u,o-t.colCount(l)));else{const t=e.mapping.slice(i).map(r+l);e.delete(t,t+c.nodeSize)}s+=u.rowspan}}function ie(e,t){if(!v(e))return!1;if(t){const n=ee(e),r=e.tr;if(0==n.left&&n.right==n.map.width)return!1;for(let e=n.right-1;oe(r,n,e),e!=n.left;e--){const e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError("No table found");n.table=e,n.map=u.get(e)}t(r)}return!0}function se(e,{map:t,table:n,tableStart:r},o){let i=0;for(let e=0;e<o;e++)i+=n.child(e).nodeSize;const s=i+n.child(o).nodeSize,a=e.mapping.maps.length;e.delete(i+r,s+r);for(let i=0,s=o*t.width;i<t.width;i++,s++){const l=t.map[s];if(o>0&&l==t.map[s-t.width]){const t=n.nodeAt(l).attrs;e.setNodeMarkup(e.mapping.slice(a).map(l+r),null,{...t,rowspan:t.rowspan-1}),i+=t.colspan-1}else if(o<t.width&&l==t.map[s+t.width]){const s=n.nodeAt(l),c=s.attrs,u=s.type.create({...c,rowspan:s.attrs.rowspan-1},s.content),d=t.positionAt(o+1,i,n);e.insert(e.mapping.slice(a).map(r+d),u),i+=c.colspan-1}}}function ae(e,t){if(!v(e))return!1;if(t){const n=ee(e),r=e.tr;if(0==n.top&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;se(r,n,e),e!=n.top;e--){const e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError("No table found");n.table=e,n.map=u.get(n.table)}t(r)}return!0}function le(e,t){return function(n,r){if(!v(n))return!1;const o=w(n);if(o.nodeAfter.attrs[e]===t)return!1;if(r){const i=n.tr;n.selection instanceof M?n.selection.forEachCell(((n,r)=>{n.attrs[e]!==t&&i.setNodeMarkup(r,null,{...n.attrs,[e]:t})})):i.setNodeMarkup(o.pos,null,{...o.nodeAfter.attrs,[e]:t}),r(i)}return!0}}function ce(e,t,n){const r=t.map.cellsInRect({left:0,top:0,right:"row"==e?t.map.width:1,bottom:"column"==e?t.map.height:1});for(let e=0;e<r.length;e++){const o=t.table.nodeAt(r[e]);if(o&&o.type!==n.header_cell)return!1}return!0}function ue(e,t){return(t=t||{useDeprecatedLogic:!1}).useDeprecatedLogic?function(e){return function(t,n){if(!v(t))return!1;if(n){const r=m(t.schema),o=ee(t),i=t.tr,s=o.map.cellsInRect("column"==e?{left:o.left,top:0,right:o.right,bottom:o.map.height}:"row"==e?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),a=s.map((e=>o.table.nodeAt(e)));for(let e=0;e<s.length;e++)a[e].type==r.header_cell&&i.setNodeMarkup(o.tableStart+s[e],r.cell,a[e].attrs);if(0==i.steps.length)for(let e=0;e<s.length;e++)i.setNodeMarkup(o.tableStart+s[e],r.header_cell,a[e].attrs);n(i)}return!0}}(e):function(t,n){if(!v(t))return!1;if(n){const r=m(t.schema),o=ee(t),i=t.tr,s=ce("row",o,r),a=ce("column",o,r),l=("column"===e?s:"row"===e&&a)?1:0,c="column"==e?{left:0,top:l,right:1,bottom:o.map.height}:"row"==e?{left:l,top:0,right:o.map.width,bottom:1}:o,u="column"==e?a?r.cell:r.header_cell:"row"==e?s?r.cell:r.header_cell:r.cell;o.map.cellsInRect(c).forEach((e=>{const t=e+o.tableStart,n=i.doc.nodeAt(t);n&&i.setNodeMarkup(t,u,n.attrs)})),n(i)}return!0}}function de(e){return function(t,n){if(!v(t))return!1;const r=function(e,t){if(t<0){const t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){const r=e.node(-1).child(t),o=r.lastChild;if(o)return n-1-o.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;const t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){const e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}(w(t),e);if(null==r)return!1;if(n){const e=t.doc.resolve(r);n(t.tr.setSelection(i.U3.between(e,(o=e,o.node(0).resolve(o.pos+o.nodeAfter.nodeSize)))).scrollIntoView())}var o;return!0}}function he(e,t){const n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if("table"==n.node(r).type.spec.tableRole)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function pe({allowTableNodeSelection:e=!1}={}){return new i.k_({key:g,state:{init:()=>null,apply(e,t){const n=e.getMeta(g);if(null!=n)return-1==n?null:n;if(null==t||!e.docChanged)return t;const{deleted:r,pos:o}=e.mapping.mapResult(t);return r?null:o}},props:{decorations:O,handleDOMEvents:{mousedown:V},createSelectionBetween:e=>null!=g.getState(e.state)?e.state.selection:null,handleTripleClick:j,handleKeyDown:P,handlePaste:_},appendTransaction:(t,n,r)=>function(e,t,n){const r=(t||e).selection,o=(t||e).doc;let s,a;if(r instanceof i.nh&&(a=r.node.type.spec.tableRole)){if("cell"==a||"header_cell"==a)s=M.create(o,r.from);else if("row"==a){const e=o.resolve(r.from+1);s=M.rowSelection(e,e)}else if(!n){const e=u.get(r.node),t=r.from+1,n=t+e.map[e.width*e.height-1];s=M.create(o,t+1,n)}}else r instanceof i.U3&&function({$from:e,$to:t}){if(e.pos==t.pos||e.pos<e.pos-6)return!1;let n=e.pos,r=t.pos,o=e.depth;for(;o>=0&&!(e.after(o+1)<e.end(o));o--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(o).type.spec.tableRole)}(r)?s=i.U3.create(o,r.from):r instanceof i.U3&&function({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){const r=e.node(t);if("cell"===r.type.spec.tableRole||"header_cell"===r.type.spec.tableRole){n=r;break}}for(let e=t.depth;e>0;e--){const n=t.node(e);if("cell"===n.type.spec.tableRole||"header_cell"===n.type.spec.tableRole){r=n;break}}return n!==r&&0===t.parentOffset}(r)&&(s=i.U3.create(o,r.$from.start(),r.$from.end()));return s&&(t||(t=e.tr)).setSelection(s),t}(r,D(r,n),e)})}ue("row",{useDeprecatedLogic:!0}),ue("column",{useDeprecatedLogic:!0}),ue("cell",{useDeprecatedLogic:!0})},2466:(e,t,n)=>{"use strict";n.d(t,{Nj:()=>l,hG:()=>a,pb:()=>s,y5:()=>i});var r=n(8769);const o=(0,r.createContext)({}),i=()=>{const e=(()=>{const{dom:e,editor:t,setLoading:n,editorFactory:i}=(0,r.useContext)(o),s=(0,r.useRef)(null);return(0,r.useEffect)((()=>{const r=s.current;if(!i||!r)return;e.current=r;const o=i(r);return o?(n(!0),o.create().then((e=>{t.current=e})).finally((()=>{n(!1)})).catch(console.error),()=>{var e;null==(e=t.current)||e.destroy()}):void 0}),[e,t,i,n]),s})();return r.createElement("div",{"data-milkdown-root":!0,ref:e})},s=({children:e})=>{const t=(0,r.useRef)(void 0),[n,i]=(0,r.useState)(void 0),s=(0,r.useRef)(),[a,l]=(0,r.useState)(!0),c=(0,r.useMemo)((()=>({loading:a,dom:t,editor:s,setLoading:l,editorFactory:n,setEditorFactory:i})),[a,n]);return r.createElement(o.Provider,{value:c},e)},a=(e,t=[])=>{const n=(0,r.useContext)(o),i=(0,r.useCallback)(e,t);return(0,r.useLayoutEffect)((()=>{n.setEditorFactory((()=>i))}),[n,i]),{loading:n.loading,get:()=>n.editor.current}},l=()=>{const e=(0,r.useContext)(o),t=(0,r.useCallback)((()=>e.editor.current),[e.editor]);return[e.loading,t]}},3373:(e,t)=>{var n;!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=s(e,i(n)))}return e}function i(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return o.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var n in e)r.call(e,n)&&e[n]&&(t=s(t,n));return t}function s(e,t){return t?e?e+" "+t:e+t:e}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},3686:(e,t,n)=>{"use strict";n.d(t,{Lz:()=>an,NZ:()=>Bt,zF:()=>$t});var r=n(1570),o=n(6090),i=n(1329);const s=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},a=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t};let l=null;const c=function(e,t,n){let r=l||(l=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},u=function(e,t,n,r){return n&&(h(e,t,n,r,-1)||h(e,t,n,r,1))},d=/^(img|br|input|textarea|hr)$/i;function h(e,t,n,r,o){for(;;){if(e==n&&t==r)return!0;if(t==(o<0?0:p(e))){let n=e.parentNode;if(!n||1!=n.nodeType||f(e)||d.test(e.nodeName)||"false"==e.contentEditable)return!1;t=s(e)+(o<0?0:1),e=n}else{if(1!=e.nodeType)return!1;if("false"==(e=e.childNodes[t+(o<0?-1:0)]).contentEditable)return!1;t=o<0?p(e):0}}}function p(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function f(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const m=function(e){return e.focusNode&&u(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function g(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}const y="undefined"!=typeof navigator?navigator:null,v="undefined"!=typeof document?document:null,w=y&&y.userAgent||"",k=/Edge\/(\d+)/.exec(w),b=/MSIE \d/.exec(w),x=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(w),C=!!(b||x||k),S=b?document.documentMode:x?+x[1]:k?+k[1]:0,M=!C&&/gecko\/(\d+)/i.test(w);M&&(/Firefox\/(\d+)/.exec(w)||[0,0])[1];const N=!C&&/Chrome\/(\d+)/.exec(w),O=!!N,A=N?+N[1]:0,E=!C&&!!y&&/Apple Computer/.test(y.vendor),D=E&&(/Mobile\/\w+/.test(w)||!!y&&y.maxTouchPoints>2),T=D||!!y&&/Mac/.test(y.platform),F=!!y&&/Win/.test(y.platform),I=/Android \d/.test(w),R=!!v&&"webkitFontSmoothing"in v.documentElement.style,P=R?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function B(e){return{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function L(e,t){return"number"==typeof e?e:e[t]}function z(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function $(e,t,n){let r=e.someProp("scrollThreshold")||0,o=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument;for(let s=n||e.dom;s;s=a(s)){if(1!=s.nodeType)continue;let e=s,n=e==i.body,a=n?B(i):z(e),l=0,c=0;if(t.top<a.top+L(r,"top")?c=-(a.top-t.top+L(o,"top")):t.bottom>a.bottom-L(r,"bottom")&&(c=t.bottom-a.bottom+L(o,"bottom")),t.left<a.left+L(r,"left")?l=-(a.left-t.left+L(o,"left")):t.right>a.right-L(r,"right")&&(l=t.right-a.right+L(o,"right")),l||c)if(n)i.defaultView.scrollBy(l,c);else{let n=e.scrollLeft,r=e.scrollTop;c&&(e.scrollTop+=c),l&&(e.scrollLeft+=l);let o=e.scrollLeft-n,i=e.scrollTop-r;t={left:t.left-o,top:t.top-i,right:t.right-o,bottom:t.bottom-i}}if(n)break}}function j(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=a(r));return t}function _(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:o,left:i}=e[n];r.scrollTop!=o+t&&(r.scrollTop=o+t),r.scrollLeft!=i&&(r.scrollLeft=i)}}let V=null;function W(e,t){let n,r,o,i,s=2e8,a=0,l=t.top,u=t.top;for(let d=e.firstChild,h=0;d;d=d.nextSibling,h++){let e;if(1==d.nodeType)e=d.getClientRects();else{if(3!=d.nodeType)continue;e=c(d).getClientRects()}for(let c=0;c<e.length;c++){let p=e[c];if(p.top<=l&&p.bottom>=u){l=Math.max(p.bottom,l),u=Math.min(p.top,u);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<s){n=d,s=e,r=e&&3==n.nodeType?{left:p.right<t.left?p.right:p.left,top:t.top}:t,1==d.nodeType&&e&&(a=h+(t.left>=(p.left+p.right)/2?1:0));continue}}else p.top>t.top&&!o&&p.left<=t.left&&p.right>=t.left&&(o=d,i={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=h+1)}}return!n&&o&&(n=o,r=i,s=0),n&&3==n.nodeType?function(e,t){let n=e.nodeValue.length,r=document.createRange();for(let o=0;o<n;o++){r.setEnd(e,o+1),r.setStart(e,o);let n=U(r,1);if(n.top!=n.bottom&&H(t,n))return{node:e,offset:o+(t.left>=(n.left+n.right)/2?1:0)}}return{node:e,offset:0}}(n,r):!n||s&&1==n.nodeType?{node:e,offset:a}:W(n,r)}function H(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function K(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let n=e.childNodes[i];if(1==n.nodeType){let e=n.getClientRects();for(let r=0;r<e.length;r++){let o=e[r];if(H(t,o))return K(n,t,o)}}if((i=(i+1)%r)==o)break}return e}function J(e,t){let n,r=e.dom.ownerDocument,o=0,i=function(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:r.offset}}catch(e){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:r.startOffset}}}(r,t.left,t.top);i&&({node:n,offset:o}=i);let s,l=(e.root.elementFromPoint?e.root:r).elementFromPoint(t.left,t.top);if(!l||!e.dom.contains(1!=l.nodeType?l.parentNode:l)){let n=e.dom.getBoundingClientRect();if(!H(t,n))return null;if(l=K(e.dom,t,n),!l)return null}if(E)for(let e=l;n&&e;e=a(e))e.draggable&&(n=void 0);if(l=function(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(l,t),n){if(M&&1==n.nodeType&&(o=Math.min(o,n.childNodes.length),o<n.childNodes.length)){let e,r=n.childNodes[o];"IMG"==r.nodeName&&(e=r.getBoundingClientRect()).right<=t.left&&e.bottom>t.top&&o++}n==e.dom&&o==n.childNodes.length-1&&1==n.lastChild.nodeType&&t.top>n.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:0!=o&&1==n.nodeType&&"BR"==n.childNodes[o-1].nodeName||(s=function(e,t,n,r){let o=-1;for(let n=t,i=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0);if(!t)return null;if(1==t.dom.nodeType&&(t.node.isBlock&&t.parent&&!i||!t.contentDOM)){let e=t.dom.getBoundingClientRect();if(t.node.isBlock&&t.parent&&!i&&(i=!0,e.left>r.left||e.top>r.top?o=t.posBefore:(e.right<r.left||e.bottom<r.top)&&(o=t.posAfter)),!t.contentDOM&&o<0)return(t.node.isBlock?r.top<(e.top+e.bottom)/2:r.left<(e.left+e.right)/2)?t.posBefore:t.posAfter}n=t.dom.parentNode}return o>-1?o:e.docView.posFromDOM(t,n,-1)}(e,n,o,t))}null==s&&(s=function(e,t,n){let{node:r,offset:o}=W(t,n),i=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();i=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,o,i)}(e,l,t));let c=e.docView.nearestDesc(l,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function q(e){return e.top<e.bottom||e.left<e.right}function U(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(q(e))return e}return Array.prototype.find.call(n,q)||e.getBoundingClientRect()}const Y=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Z(e,t,n){let{node:r,offset:o,atom:i}=e.docView.domFromPos(t,n<0?-1:1),s=R||M;if(3==r.nodeType){if(!s||!Y.test(r.nodeValue)&&(n<0?o:o!=r.nodeValue.length)){let e=o,t=o,i=n<0?1:-1;return n<0&&!o?(t++,i=-1):n>=0&&o==r.nodeValue.length?(e--,i=1):n<0?e--:t++,G(U(c(r,e,t),i),i<0)}{let e=U(c(r,o,o),n);if(M&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let t=U(c(r,o-1,o-1),-1);if(t.top==e.top){let n=U(c(r,o,o+1),-1);if(n.top!=e.top)return G(n,n.left<t.left)}}return e}}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(null==i&&o&&(n<0||o==p(r))){let e=r.childNodes[o-1];if(1==e.nodeType)return Q(e.getBoundingClientRect(),!1)}if(null==i&&o<p(r)){let e=r.childNodes[o];if(1==e.nodeType)return Q(e.getBoundingClientRect(),!0)}return Q(r.getBoundingClientRect(),n>=0)}if(null==i&&o&&(n<0||o==p(r))){let e=r.childNodes[o-1],t=3==e.nodeType?c(e,p(e)-(s?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return G(U(t,1),!1)}if(null==i&&o<p(r)){let e=r.childNodes[o];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?c(e,0,s?0:1):1==e.nodeType?e:null:null;if(t)return G(U(t,-1),!0)}return G(U(3==r.nodeType?c(r):r,-n),n>=0)}function G(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function Q(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function X(e,t,n){let r=e.state,o=e.root.activeElement;r!=t&&e.updateState(t),o!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),o!=e.dom&&o&&o.focus()}}const ee=/[\u0590-\u08ac]/;let te=null,ne=null,re=!1;class oe{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){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,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}}let r;if(e==this.dom&&this.contentDOM)r=t>s(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let o,i=this.getDesc(r);if(i&&(!t||i.node)){if(!n||!(o=i.nodeDOM)||(1==o.nodeType?o.contains(1==e.nodeType?e:e.parentNode):o==e))return i;n=!1}}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let o=this.getDesc(r);if(o)return o.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],o=n+r.size;if(n==e&&o!=n){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(e<o)return r.descAt(e-n-r.border);n=o}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let o=this.children[n],i=t+o.size;if(i>e||o instanceof de){r=e-t;break}t=i}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof ie&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,e&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?s(e.dom)+1:0}}{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,e&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?s(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,o=-1;for(let i=n,a=0;;a++){let n=this.children[a],l=i+n.size;if(-1==r&&e<=l){let o=i+n.border;if(e>=o&&t<=l-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,o);e=i;for(let t=a;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=s(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(l>t||a==this.children.length-1)){t=l;for(let e=a+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){o=s(n.dom);break}t+=n.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=l}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(1!=t.nodeType||n==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let o=Math.min(e,t),i=Math.max(e,t);for(let s=0,a=0;s<this.children.length;s++){let l=this.children[s],c=a+l.size;if(o>a&&i<c)return l.setSelection(e-a-l.border,t-a-l.border,n,r);a=c}let s=this.domFromPos(e,e?-1:1),a=t==e?s:this.domFromPos(t,t?-1:1),l=n.getSelection(),c=!1;if((M||E)&&e==t){let{node:e,offset:t}=s;if(3==e.nodeType)c=!(!t||"\n"!=e.nodeValue[t-1]);else{let n=e.childNodes[t-1];c=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(M&&l.focusNode&&l.focusNode!=a.node&&1==l.focusNode.nodeType){let e=l.focusNode.childNodes[l.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||c&&E)&&u(s.node,s.offset,l.anchorNode,l.anchorOffset)&&u(a.node,a.offset,l.focusNode,l.focusOffset))return;let d=!1;if((l.extend||e==t)&&!c){l.collapse(s.node,s.offset);try{e!=t&&l.extend(a.node,a.offset),d=!0}catch(e){}}if(!d){if(e>t){let e=s;s=a,a=e}let n=document.createRange();n.setEnd(a.node,a.offset),n.setStart(s.node,s.offset),l.removeAllRanges(),l.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let o=this.children[r],i=n+o.size;if(n==i?e<=i&&t>=n:e<i&&t>n){let r=n+o.border,s=i-o.border;if(e>=r&&t<=s)return this.dirty=e==n||t==i?2:1,void(e!=r||t!=s||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(e-r,t-r):o.dirty=3);o.dirty=o.dom!=o.contentDOM||o.dom.parentNode!=this.contentDOM||o.children.length?3:2}n=i}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}}class ie extends oe{constructor(e,t,n,r){let o,i=t.type.toDOM;if("function"==typeof i&&(i=i(n,(()=>o?o.parent?o.parent.posBeforeChild(o):void 0:r))),!t.type.spec.raw){if(1!=i.nodeType){let e=document.createElement("span");e.appendChild(i),i=e}i.contentEditable="false",i.classList.add("ProseMirror-widget")}super(e,[],i,null),this.widget=t,this.widget=t,o=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||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 se extends oe{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}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"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class ae extends oe{constructor(e,t,n,r){super(e,[],n,r),this.mark=t}static create(e,t,n,r){let i=r.nodeViews[t.type.name],s=i&&i(t,r,n);return s&&s.dom||(s=o.ZF.renderSpec(document,t.type.spec.toDOM(t,n))),new ae(e,t,s.dom,s.contentDOM||s.dom)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM||void 0}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,n){let r=ae.create(this.parent,this.mark,!0,n),o=this.children,i=this.size;t<i&&(o=Se(o,t,i,n)),e>0&&(o=Se(o,0,e,n));for(let e=0;e<o.length;e++)o[e].parent=r;return r.children=o,r}}class le extends oe{constructor(e,t,n,r,o,i,s,a,l){super(e,[],o,i),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=s}static create(e,t,n,r,i,s){let a,l=i.nodeViews[t.type.name],c=l&&l(t,i,(()=>a?a.parent?a.parent.posBeforeChild(a):void 0:s),n,r),u=c&&c.dom,d=c&&c.contentDOM;if(t.isText)if(u){if(3!=u.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else u=document.createTextNode(t.text);else u||({dom:u,contentDOM:d}=o.ZF.renderSpec(document,t.type.spec.toDOM(t)));d||t.isText||"BR"==u.nodeName||(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let h=u;return u=we(u,n,t),c?a=new he(e,t,n,r,u,d||null,h,c,i,s+1):t.isText?new ue(e,t,n,r,u,h,i):new le(e,t,n,r,u,d||null,h,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>o.FK.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&ke(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,s=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new xe(this,s&&s.node,e);!function(e,t,n,r){let o=t.locals(e),i=0;if(0==o.length){for(let n=0;n<e.childCount;n++){let s=e.child(n);r(s,o,t.forChild(i,s),n),i+=s.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){if(s<o.length&&o[s].to==i){let e,t=o[s++];for(;s<o.length&&o[s].to==i;)(e||(e=[t])).push(o[s++]);if(e){e.sort(Ce);for(let t=0;t<e.length;t++)n(e[t],c,!!l)}else n(t,c,!!l)}let u,d;if(l)d=-1,u=l,l=null;else{if(!(c<e.childCount))break;d=c,u=e.child(c++)}for(let e=0;e<a.length;e++)a[e].to<=i&&a.splice(e--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)a.push(o[s++]);let h=i+u.nodeSize;if(u.isText){let e=h;s<o.length&&o[s].from<e&&(e=o[s].from);for(let t=0;t<a.length;t++)a[t].to<e&&(e=a[t].to);e<h&&(l=u.cut(e-i),u=u.cut(0,e-i),h=e,d=-1)}r(u,u.isInline&&!u.isLeaf?a.filter((e=>!e.inline)):a.slice(),t.forChild(i,u),d),i=h}}(this.node,this.innerDeco,((t,i,s)=>{t.spec.marks?l.syncToMarks(t.spec.marks,n,e):t.type.side>=0&&!s&&l.syncToMarks(i==this.node.childCount?o.CU.none:this.node.child(i).marks,n,e),l.placeWidget(t,e,r)}),((t,o,s,c)=>{let u;l.syncToMarks(t.marks,n,e),l.findNodeMatch(t,o,s,c)||a&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(u=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(t,o,s,u,e)||l.updateNextNode(t,o,s,e,c,r)||l.addNode(t,o,s,e,r),r+=t.nodeSize})),l.syncToMarks([],n,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||2==this.dirty)&&(s&&this.protectLocalComposition(e,s),pe(this.contentDOM,this.children,e),D&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:n,to:o}=e.state.selection;if(!(e.state.selection instanceof r.U3)||n<t||o>t+this.node.content.size)return null;let i=e.domSelectionRange(),s=function(e,t){for(;;){if(3==e.nodeType)return e;if(1==e.nodeType&&t>0){if(e.childNodes.length>t&&3==e.childNodes[t].nodeType)return e.childNodes[t];t=p(e=e.childNodes[t-1])}else{if(!(1==e.nodeType&&t<e.childNodes.length))return null;e=e.childNodes[t],t=0}}}(i.focusNode,i.focusOffset);if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let e=s.nodeValue,r=function(e,t,n,r){for(let o=0,i=0;o<e.childCount&&i<=r;){let s=e.child(o++),a=i;if(i+=s.nodeSize,!s.isText)continue;let l=s.text;for(;o<e.childCount;){let t=e.child(o++);if(i+=t.nodeSize,!t.isText)break;l+=t.text}if(i>=n){let e=a<r?l.lastIndexOf(t,r-a-1):-1;if(e>=0&&e+t.length+a>=n)return a+e;if(n==r&&l.length>=r+t.length-a&&l.slice(r-a,r-a+t.length)==t)return r}}return-1}(this.node.content,e,n-t,o-t);return r<0?null:{node:s,pos:r,text:e}}return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let o=t;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let i=new se(this,o,t,r);e.input.compositionNodes.push(i),this.children=Se(this.children,n,n+r.length,e,i)}update(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node)||(this.updateInner(e,t,n,r),0))}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(ke(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=ye(this.dom,this.nodeDOM,ge(this.outerDeco,this.node,t),ge(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)}deselectNode(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable")}get domAtom(){return this.node.isAtom}}function ce(e,t,n,r,o){we(r,t,e);let i=new le(void 0,e,t,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class ue extends le{constructor(e,t,n,r,o,i,s){super(e,t,n,r,o,null,i,s,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node)||(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,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,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),o=document.createTextNode(r.text);return new ue(this.parent,r,this.outerDeco,this.innerDeco,o,o,n)}markDirty(e,t){super.markDirty(e,t),this.dom==this.nodeDOM||0!=e&&t!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}}class de extends oe{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class he extends le{constructor(e,t,n,r,o,i,s,a,l,c){super(e,t,n,r,o,i,s,l,c),this.spec=a}update(e,t,n,r){if(3==this.dirty)return!1;if(this.spec.update){let o=this.spec.update(e,t,n);return o&&this.updateInner(e,t,n,r),o}return!(!this.contentDOM&&!e.isLeaf)&&super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function pe(e,t,n){let r=e.firstChild,o=!1;for(let i=0;i<t.length;i++){let s=t[i],a=s.dom;if(a.parentNode==e){for(;a!=r;)r=be(r),o=!0;r=r.nextSibling}else o=!0,e.insertBefore(a,r);if(s instanceof ae){let t=r?r.previousSibling:e.lastChild;pe(s.contentDOM,s.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=be(r),o=!0;o&&n.trackWrites==e&&(n.trackWrites=null)}const fe=function(e){e&&(this.nodeName=e)};fe.prototype=Object.create(null);const me=[new fe];function ge(e,t,n){if(0==e.length)return me;let r=n?me[0]:new fe,o=[r];for(let i=0;i<e.length;i++){let s=e[i].type.attrs;if(s){s.nodeName&&o.push(r=new fe(s.nodeName));for(let e in s){let i=s[e];null!=i&&(n&&1==o.length&&o.push(r=new fe(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+i:"style"==e?r.style=(r.style?r.style+";":"")+i:"nodeName"!=e&&(r[e]=i))}}}return o}function ye(e,t,n,r){if(n==me&&r==me)return t;let o=t;for(let t=0;t<r.length;t++){let i=r[t],s=n[t];if(t){let t;s&&s.nodeName==i.nodeName&&o!=e&&(t=o.parentNode)&&t.nodeName.toLowerCase()==i.nodeName||(t=document.createElement(i.nodeName),t.pmIsDeco=!0,t.appendChild(o),s=me[0]),o=t}ve(o,s||me[0],i)}return o}function ve(e,t,n){for(let r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let t=0;t<r.length;t++)-1==o.indexOf(r[t])&&e.classList.remove(r[t]);for(let t=0;t<o.length;t++)-1==r.indexOf(o[t])&&e.classList.add(o[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let n,r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;n=r.exec(t.style);)e.style.removeProperty(n[1])}n.style&&(e.style.cssText+=n.style)}}function we(e,t,n){return ye(e,e,me,ge(t,n,1!=e.nodeType))}function ke(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function be(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class xe{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,r=n.children.length,o=e.childCount,i=new Map,s=[];e:for(;o>0;){let a;for(;;)if(r){let e=n.children[r-1];if(!(e instanceof ae)){a=e,r--;break}n=e,r=e.children.length}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=e.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n){let r=0,o=this.stack.length>>1,i=Math.min(o,e.length);for(;r<i&&(r==o-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&!1!==e[r].type.spec.spanning;)r++;for(;r<o;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let r=-1;for(let t=this.index;t<Math.min(this.index+3,this.top.children.length);t++){let n=this.top.children[t];if(n.matchesMark(e[o])&&!this.isLocked(n.dom)){r=t;break}}if(r>-1)r>this.index&&(this.changed=!0,this.destroyBetween(this.index,r)),this.top=this.top.children[this.index];else{let r=ae.create(this.top,e[o],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,n,r){let o,i=-1;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))i=this.top.children.indexOf(o,this.index);else for(let r=this.index,o=Math.min(this.top.children.length,r+5);r<o;r++){let o=this.top.children[r];if(o.matchesNode(e,t,n)&&!this.preMatch.matched.has(o)){i=r;break}}return!(i<0||(this.destroyBetween(this.index,i),this.index++,0))}updateNodeAt(e,t,n,r,o){let i=this.top.children[r];return 3==i.dirty&&i.dom==i.contentDOM&&(i.dirty=2),!!i.update(e,t,n,o)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t)for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e;return-1}e=t}}updateNextNode(e,t,n,r,o,i){for(let s=this.index;s<this.top.children.length;s++){let a=this.top.children[s];if(a instanceof le){let l=this.preMatch.matched.get(a);if(null!=l&&l!=o)return!1;let c,u=a.dom,d=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&ke(t,a.outerDeco));if(!d&&a.update(e,t,n,r))return this.destroyBetween(this.index,s),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!d&&(c=this.recreateWrapper(a,e,t,n,r,i)))return this.top.children[this.index]=c,c.dirty=2,c.updateChildren(r,i+1),c.dirty=0,this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,o,i){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content))return null;let s=le.create(this.top,t,n,r,o,i);if(!s.contentDOM)return null;s.children=e.children,e.children=[];for(let e of s.children)e.parent=s;return s}addNode(e,t,n,r,o){let i=le.create(this.top,e,t,n,r,o);i.contentDOM&&i.updateChildren(r,o+1),this.top.children.splice(this.index++,0,i),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){let r=new ie(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}else this.index++}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof ae;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof ue)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((E||O)&&e&&"false"==e.dom.contentEditable&&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 n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new de(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function Ce(e,t){return e.type.side-t.type.side}function Se(e,t,n,r,o){let i=[];for(let s=0,a=0;s<e.length;s++){let l=e[s],c=a,u=a+=l.size;c>=n||u<=t?i.push(l):(c<t&&i.push(l.slice(0,t-c,r)),o&&(i.push(o),o=void 0),u>n&&i.push(l.slice(n-c,l.size,r)))}return i}function Me(e,t=null){let n=e.domSelectionRange(),o=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),a=i&&0==i.size,l=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(l<0)return null;let c,u,d=o.resolve(l);if(m(n)){for(c=d;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&r.nh.isSelectable(e)&&i.parent&&(!e.isInline||!function(e,t,n){for(let r=0==t,o=t==p(e);r||o;){if(e==n)return!0;let t=s(e);if(!(e=e.parentNode))return!1;r=r&&0==t,o=o&&t==p(e)}}(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;u=new r.nh(l==e?d:o.resolve(e))}}else{let t=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(t<0)return null;c=o.resolve(t)}return u||(u=Re(e,c,d,"pointer"==t||e.state.selection.head<d.pos&&!a?1:-1)),u}function Ne(e){return e.editable?e.hasFocus():Be(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Oe(e,t=!1){let n=e.state.selection;if(Fe(e,n),Ne(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&O){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&u(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection(),n=document.createRange(),r=e.cursorWrapper.dom,o="IMG"==r.nodeName;o?n.setEnd(r.parentNode,s(r)+1):n.setEnd(r,0),n.collapse(!1),t.removeAllRanges(),t.addRange(n),!o&&!e.state.selection.visible&&C&&S<=11&&(r.disabled=!0,r.disabled=!1)}(e);else{let o,i,{anchor:s,head:a}=n;!Ae||n instanceof r.U3||(n.$from.parent.inlineContent||(o=Ee(e,n.from)),n.empty||n.$from.parent.inlineContent||(i=Ee(e,n.to))),e.docView.setSelection(s,a,e.root,t),Ae&&(o&&Te(o),i&&Te(i)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{n.anchorNode==r&&n.anchorOffset==o||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout((()=>{Ne(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")}),20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const Ae=E||O&&A<63;function Ee(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(E&&o&&"false"==o.contentEditable)return De(o);if(!(o&&"false"!=o.contentEditable||i&&"false"!=i.contentEditable)){if(o)return De(o);if(i)return De(i)}}function De(e){return e.contentEditable="true",E&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function Te(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function Fe(e,t){if(t instanceof r.nh){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Ie(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Ie(e)}function Ie(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function Re(e,t,n,o){return e.someProp("createSelectionBetween",(r=>r(e,t,n)))||r.U3.between(t,n,o)}function Pe(e){return!(e.editable&&!e.hasFocus())&&Be(e)}function Be(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function Le(e,t){let{$anchor:n,$head:o}=e.selection,i=t>0?n.max(o):n.min(o),s=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return s&&r.LN.findFrom(s,t)}function ze(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function $e(e,t,n){let o=e.state.selection;if(!(o instanceof r.U3)){if(o instanceof r.nh&&o.node.isInline)return ze(e,new r.U3(t>0?o.$to:o.$from));{let n=Le(e.state,t);return!!n&&ze(e,n)}}if(!o.empty||n.indexOf("s")>-1)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){let n=Le(e.state,t);return!!(n&&n instanceof r.nh)&&ze(e,n)}if(!(T&&n.indexOf("m")>-1)){let n,i=o.$head,s=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText)return!1;let a=t<0?i.pos-s.nodeSize:i.pos;return!!(s.isAtom||(n=e.docView.descAt(a))&&!n.contentDOM)&&(r.nh.isSelectable(s)?ze(e,new r.nh(t<0?e.state.doc.resolve(i.pos-s.nodeSize):i)):!!R&&ze(e,new r.U3(e.state.doc.resolve(t<0?a:a+s.nodeSize))))}}function je(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function _e(e){let t=e.pmViewDesc;return t&&0==t.size&&(e.nextSibling||"BR"!=e.nodeName)}function Ve(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,a=!1;for(M&&1==n.nodeType&&r<je(n)&&_e(n.childNodes[r])&&(a=!0);;)if(r>0){if(1!=n.nodeType)break;{let e=n.childNodes[r-1];if(_e(e))o=n,i=--r;else{if(3!=e.nodeType)break;n=e,r=n.nodeValue.length}}}else{if(He(n))break;{let t=n.previousSibling;for(;t&&_e(t);)o=n.parentNode,i=s(t),t=t.previousSibling;if(t)n=t,r=je(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}a?Ke(e,n,r):o&&Ke(e,o,i)}(e):We(e)}function We(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,a=je(n);for(;;)if(r<a){if(1!=n.nodeType)break;if(!_e(n.childNodes[r]))break;o=n,i=++r}else{if(He(n))break;{let t=n.nextSibling;for(;t&&_e(t);)o=t.parentNode,i=s(t)+1,t=t.nextSibling;if(t)n=t,r=0,a=je(n);else{if(n=n.parentNode,n==e.dom)break;r=a=0}}}o&&Ke(e,o,i)}function He(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Ke(e,t,n){let r=e.domSelection();if(m(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:o}=e;setTimeout((()=>{e.state==o&&Oe(e)}),50)}function Je(e,t){let n=e.state.doc.resolve(t);if(!O&&!F&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(t<n.end()){let n=e.coordsAtPos(t+1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function qe(e,t,n){let o=e.state.selection;if(o instanceof r.U3&&!o.empty||n.indexOf("s")>-1)return!1;if(T&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=o;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=Le(e.state,t);if(n&&n instanceof r.nh)return ze(e,n)}if(!i.parent.inlineContent){let n=t<0?i:s,a=o instanceof r.i5?r.LN.near(n,t):r.LN.findFrom(n,t);return!!a&&ze(e,a)}return!1}function Ue(e,t){if(!(e.state.selection instanceof r.U3))return!0;let{$head:n,$anchor:o,empty:i}=e.state.selection;if(!n.sameParent(o))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let s=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let r=e.state.tr;return t<0?r.delete(n.pos-s.nodeSize,n.pos):r.delete(n.pos,n.pos+s.nodeSize),e.dispatch(r),!0}return!1}function Ye(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Ze(e,t){e.someProp("transformCopied",(n=>{t=n(t,e)}));let n=[],{content:r,openStart:i,openEnd:s}=t;for(;i>1&&s>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,s--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let a=e.someProp("clipboardSerializer")||o.ZF.fromSchema(e.state.schema),l=st(),c=l.createElement("div");c.appendChild(a.serializeFragment(r,{document:l}));let u,d=c.firstChild,h=0;for(;d&&1==d.nodeType&&(u=ot[d.nodeName.toLowerCase()]);){for(let e=u.length-1;e>=0;e--){let t=l.createElement(u[e]);for(;c.firstChild;)t.appendChild(c.firstChild);c.appendChild(t),h++}d=c.firstChild}return d&&1==d.nodeType&&d.setAttribute("data-pm-slice",`${i} ${s}${h?` -${h}`:""} ${JSON.stringify(n)}`),{dom:c,text:e.someProp("clipboardTextSerializer",(n=>n(t,e)))||t.content.textBetween(0,t.content.size,"\n\n")}}function Ge(e,t,n,r,i){let s,a,l=i.parent.type.spec.code;if(!n&&!t)return null;let c=t&&(r||l||!n);if(c){if(e.someProp("transformPastedText",(n=>{t=n(t,l||r,e)})),l)return t?new o.Ji(o.FK.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0):o.Ji.empty;let n=e.someProp("clipboardTextParser",(n=>n(t,i,r,e)));if(n)a=n;else{let n=i.marks(),{schema:r}=e.state,a=o.ZF.fromSchema(r);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach((e=>{let t=s.appendChild(document.createElement("p"));e&&t.appendChild(a.serializeNode(r.text(e,n)))}))}}else e.someProp("transformPastedHTML",(t=>{n=t(n,e)})),s=function(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n,r=st().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e);if((n=o&&ot[o[1].toLowerCase()])&&(e=n.map((e=>"<"+e+">")).join("")+e+n.map((e=>"</"+e+">")).reverse().join("")),r.innerHTML=e,n)for(let e=0;e<n.length;e++)r=r.querySelector(n[e])||r;return r}(n),R&&function(e){let t=e.querySelectorAll(O?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(s);let u=s&&s.querySelector("[data-pm-slice]"),d=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let e=+d[3];e>0;e--){let e=s.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;s=e}if(!a){let t=e.someProp("clipboardParser")||e.someProp("domParser")||o.S4.fromSchema(e.state.schema);a=t.parseSlice(s,{preserveWhitespace:!(!c&&!d),context:i,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||Qe.test(e.parentNode.nodeName)?null:{ignore:!0}})}if(d)a=function(e,t){if(!e.size)return e;let n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(t){return e}let{content:i,openStart:s,openEnd:a}=e;for(let e=n.length-2;e>=0;e-=2){let t=r.nodes[n[e]];if(!t||t.hasRequiredAttrs())break;i=o.FK.from(t.create(n[e+1],i)),s++,a++}return new o.Ji(i,s,a)}(rt(a,+d[1],+d[2]),d[4]);else if(a=o.Ji.maxOpen(function(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r,i=t.node(n).contentMatchAt(t.index(n)),s=[];if(e.forEach((e=>{if(!s)return;let t,n=i.findWrapping(e.type);if(!n)return s=null;if(t=s.length&&r.length&&et(n,r,e,s[s.length-1],0))s[s.length-1]=t;else{s.length&&(s[s.length-1]=tt(s[s.length-1],r.length));let t=Xe(e,n);s.push(t),i=i.matchType(t.type),r=n}})),s)return o.FK.from(s)}return e}(a.content,i),!0),a.openStart||a.openEnd){let e=0,t=0;for(let t=a.content.firstChild;e<a.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=a.content.lastChild;t<a.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);a=rt(a,e,t)}return e.someProp("transformPasted",(t=>{a=t(a,e)})),a}const Qe=/^(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 Xe(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,o.FK.from(e));return e}function et(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let s=et(e,t,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(o.FK.from(Xe(n,e,i+1))))}}function tt(e,t){if(0==t)return e;let n=e.content.replaceChild(e.childCount-1,tt(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(o.FK.empty,!0);return e.copy(n.append(r))}function nt(e,t,n,r,i,s){let a=t<0?e.firstChild:e.lastChild,l=a.content;return e.childCount>1&&(s=0),i<r-1&&(l=nt(l,t,n,r,i+1,s)),i>=n&&(l=t<0?a.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(a.contentMatchAt(a.childCount).fillBefore(o.FK.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,a.copy(l))}function rt(e,t,n){return t<e.openStart&&(e=new o.Ji(nt(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new o.Ji(nt(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const ot={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 it=null;function st(){return it||(it=document.implementation.createHTMLDocument("title"))}const at={},lt={},ct={touchstart:!0,touchmove:!0};class ut{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.lastAndroidDelete=0,this.composing=!1,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function dt(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function ht(e){e.someProp("handleDOMEvents",(t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>pt(e,t))}))}function pt(e,t){return e.someProp("handleDOMEvents",(n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)}))}function ft(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function mt(e){return{left:e.clientX,top:e.clientY}}function gt(e,t,n,r,o){if(-1==r)return!1;let i=e.state.doc.resolve(r);for(let r=i.depth+1;r>0;r--)if(e.someProp(t,(t=>r>i.depth?t(e,n,i.nodeAfter,i.before(r),o,!0):t(e,n,i.node(r),i.before(r),o,!1))))return!0;return!1}function yt(e,t,n){e.focused||e.focus();let r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}function vt(e,t,n,r){return gt(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",(n=>n(e,t,r)))}function wt(e,t,n,o){return gt(e,"handleTripleClickOn",t,n,o)||e.someProp("handleTripleClick",(n=>n(e,t,o)))||function(e,t,n){if(0!=n.button)return!1;let o=e.state.doc;if(-1==t)return!!o.inlineContent&&(yt(e,r.U3.create(o,0,o.content.size),"pointer"),!0);let i=o.resolve(t);for(let t=i.depth+1;t>0;t--){let n=t>i.depth?i.nodeAfter:i.node(t),s=i.before(t);if(n.inlineContent)yt(e,r.U3.create(o,s+1,s+1+n.content.size),"pointer");else{if(!r.nh.isSelectable(n))continue;yt(e,r.nh.create(o,s),"pointer")}return!0}}(e,n,o)}function kt(e){return Ot(e)}lt.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!Ct(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!I||!O||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!D||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)e.someProp("handleKeyDown",(t=>t(e,n)))||function(e,t){let n=t.keyCode,r=function(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);if(8==n||T&&72==n&&"c"==r)return Ue(e,-1)||Ve(e,-1);if(46==n||T&&68==n&&"c"==r)return Ue(e,1)||Ve(e,1);if(13==n||27==n)return!0;if(37==n||T&&66==n&&"c"==r){let t=37==n?"ltr"==Je(e,e.state.selection.from)?-1:1:-1;return $e(e,t,r)||Ve(e,t)}if(39==n||T&&70==n&&"c"==r){let t=39==n?"ltr"==Je(e,e.state.selection.from)?1:-1:1;return $e(e,t,r)||Ve(e,t)}return 38==n||T&&80==n&&"c"==r?qe(e,-1,r)||Ve(e,-1):40==n||T&&78==n&&"c"==r?function(e){if(!E||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;Ye(e,n,"true"),setTimeout((()=>Ye(e,n,"false")),20)}return!1}(e)||qe(e,1,r)||We(e):r==(T?"m":"c")&&(66==n||73==n||89==n||90==n)}(e,n)?n.preventDefault():dt(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout((()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",(t=>t(e,g(13,"Enter")))),e.input.lastIOSEnter=0)}),200)}},lt.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},lt.keypress=(e,t)=>{let n=t;if(Ct(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||T&&n.metaKey)return;if(e.someProp("handleKeyPress",(t=>t(e,n))))return void n.preventDefault();let o=e.state.selection;if(!(o instanceof r.U3&&o.$from.sameParent(o.$to))){let t=String.fromCharCode(n.charCode);/[\r\n]/.test(t)||e.someProp("handleTextInput",(n=>n(e,o.$from.pos,o.$to.pos,t)))||e.dispatch(e.state.tr.insertText(t).scrollIntoView()),n.preventDefault()}};const bt=T?"metaKey":"ctrlKey";at.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=kt(e),o=Date.now(),i="singleClick";o-e.input.lastClick.time<500&&function(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(n,e.input.lastClick)&&!n[bt]&&("singleClick"==e.input.lastClick.type?i="doubleClick":"doubleClick"==e.input.lastClick.type&&(i="tripleClick")),e.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i};let s=e.posAtCoords(mt(n));s&&("singleClick"==i?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new xt(e,s,n,!!r)):("doubleClick"==i?vt:wt)(e,s.pos,s.inside,n)?n.preventDefault():dt(e,"pointer"))};class xt{constructor(e,t,n,o){let i,s;if(this.view=e,this.pos=t,this.event=n,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[bt],this.allowDefault=n.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),s=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,s=n.depth?n.before():0}const a=o?null:n.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l?l.dom:null;let{selection:c}=e.state;(0==n.button&&i.type.spec.draggable&&!1!==i.type.spec.selectable||c instanceof r.nh&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!M||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)),dt(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((()=>Oe(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(mt(e))),this.updateAllowDefault(e),this.allowDefault||!t?dt(this.view,"pointer"):function(e,t,n,o,i){return gt(e,"handleClickOn",t,n,o)||e.someProp("handleClick",(n=>n(e,t,o)))||(i?function(e,t){if(-1==t)return!1;let n,o,i=e.state.selection;i instanceof r.nh&&(n=i.node);let s=e.state.doc.resolve(t);for(let e=s.depth+1;e>0;e--){let t=e>s.depth?s.nodeAfter:s.node(e);if(r.nh.isSelectable(t)){o=n&&i.$from.depth>0&&e>=i.$from.depth&&s.before(i.$from.depth+1)==i.$from.pos?s.before(i.$from.depth):s.before(e);break}}return null!=o&&(yt(e,r.nh.create(e.state.doc,o),"pointer"),!0)}(e,n):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),o=n.nodeAfter;return!!(o&&o.isAtom&&r.nh.isSelectable(o))&&(yt(e,new r.nh(n),"pointer"),!0)}(e,n))}(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||E&&this.mightDrag&&!this.mightDrag.node.isAtom||O&&!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)?(yt(this.view,r.LN.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):dt(this.view,"pointer")}move(e){this.updateAllowDefault(e),dt(this.view,"pointer"),0==e.buttons&&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)}}function Ct(e,t){return!!e.composing||!!(E&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}at.touchstart=e=>{e.input.lastTouch=Date.now(),kt(e),dt(e,"pointer")},at.touchmove=e=>{e.input.lastTouch=Date.now(),dt(e,"pointer")},at.contextmenu=e=>kt(e);const St=I?5e3:-1;function Mt(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout((()=>Ot(e)),t))}function Nt(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=function(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Ot(e,t=!1){if(!(I&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),Nt(e),t||e.docView&&e.docView.dirty){let t=Me(e);return t&&!t.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(t)):e.updateState(e.state),!0}return!1}}lt.compositionstart=lt.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$from;if(t.selection.empty&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((e=>!1===e.type.spec.inclusive))))e.markCursor=e.state.storedMarks||n.marks(),Ot(e,!0),e.markCursor=null;else if(Ot(e),M&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){e.domSelection().collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}Mt(e,St)},lt.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionID++,Mt(e,20))};const At=C&&S<15||D&&P<604;function Et(e,t,n,r,i){let s=Ge(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",(t=>t(e,i,s||o.Ji.empty))))return!0;if(!s)return!1;let a=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(s),l=a?e.state.tr.replaceSelectionWith(a,e.input.shiftKey):e.state.tr.replaceSelection(s);return e.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}at.copy=lt.cut=(e,t)=>{let n=t,r=e.state.selection,o="cut"==n.type;if(r.empty)return;let i=At?null:n.clipboardData,s=r.content(),{dom:a,text:l}=Ze(e,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout((()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()}),50)}(e,a),o&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},lt.paste=(e,t)=>{let n=t;if(e.composing&&!I)return;let r=At?null:n.clipboardData;r&&Et(e,r.getData("text/plain"),r.getData("text/html"),e.input.shiftKey,n)?n.preventDefault():function(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout((()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Et(e,r.value,null,e.input.shiftKey,t):Et(e,r.textContent,r.innerHTML,e.input.shiftKey,t)}),50)}(e,n)};class Dt{constructor(e,t){this.slice=e,this.move=t}}const Tt=T?"altKey":"ctrlKey";at.dragstart=(e,t)=>{let n=t,o=e.input.mouseDown;if(o&&o.done(),!n.dataTransfer)return;let i=e.state.selection,s=i.empty?null:e.posAtCoords(mt(n));if(s&&s.pos>=i.from&&s.pos<=(i instanceof r.nh?i.to-1:i.to));else if(o&&o.mightDrag)e.dispatch(e.state.tr.setSelection(r.nh.create(e.state.doc,o.mightDrag.pos)));else if(n.target&&1==n.target.nodeType){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&e.dispatch(e.state.tr.setSelection(r.nh.create(e.state.doc,t.posBefore)))}let a=e.state.selection.content(),{dom:l,text:c}=Ze(e,a);n.dataTransfer.clearData(),n.dataTransfer.setData(At?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",At||n.dataTransfer.setData("text/plain",c),e.dragging=new Dt(a,!n[Tt])},at.dragend=e=>{let t=e.dragging;window.setTimeout((()=>{e.dragging==t&&(e.dragging=null)}),50)},lt.dragover=lt.dragenter=(e,t)=>t.preventDefault(),lt.drop=(e,t)=>{let n=t,s=e.dragging;if(e.dragging=null,!n.dataTransfer)return;let a=e.posAtCoords(mt(n));if(!a)return;let l=e.state.doc.resolve(a.pos),c=s&&s.slice;c?e.someProp("transformPasted",(t=>{c=t(c,e)})):c=Ge(e,n.dataTransfer.getData(At?"Text":"text/plain"),At?null:n.dataTransfer.getData("text/html"),!1,l);let u=!(!s||n[Tt]);if(e.someProp("handleDrop",(t=>t(e,n,c||o.Ji.empty,u))))return void n.preventDefault();if(!c)return;n.preventDefault();let d=c?(0,i.Um)(e.state.doc,l.pos,c):l.pos;null==d&&(d=l.pos);let h=e.state.tr;u&&h.deleteSelection();let p=h.mapping.map(d),f=0==c.openStart&&0==c.openEnd&&1==c.content.childCount,m=h.doc;if(f?h.replaceRangeWith(p,p,c.content.firstChild):h.replaceRange(p,p,c),h.doc.eq(m))return;let g=h.doc.resolve(p);if(f&&r.nh.isSelectable(c.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(c.content.firstChild))h.setSelection(new r.nh(g));else{let t=h.mapping.map(d);h.mapping.maps[h.mapping.maps.length-1].forEach(((e,n,r,o)=>t=o)),h.setSelection(Re(e,g,h.doc.resolve(t)))}e.focus(),e.dispatch(h.setMeta("uiEvent","drop"))},at.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout((()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Oe(e)}),20))},at.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},at.beforeinput=(e,t)=>{if(O&&I&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout((()=>{if(e.input.domChangeCount!=t)return;if(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",(t=>t(e,g(8,"Backspace")))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())}),50)}};for(let e in lt)at[e]=lt[e];function Ft(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class It{constructor(e,t){this.toDOM=e,this.spec=t||zt,this.side=this.spec.side||0}map(e,t,n,r){let{pos:o,deleted:i}=e.mapResult(t.from+r,this.side<0?-1:1);return i?null:new Bt(o-n,o-n,this)}valid(){return!0}eq(e){return this==e||e instanceof It&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ft(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Rt{constructor(e,t){this.attrs=e,this.spec=t||zt}map(e,t,n,r){let o=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,i=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new Bt(o,i,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Rt&&Ft(this.attrs,e.attrs)&&Ft(this.spec,e.spec)}static is(e){return e.type instanceof Rt}destroy(){}}class Pt{constructor(e,t){this.attrs=e,this.spec=t||zt}map(e,t,n,r){let o=e.mapResult(t.from+r,1);if(o.deleted)return null;let i=e.mapResult(t.to+r,-1);return i.deleted||i.pos<=o.pos?null:new Bt(o.pos-n,i.pos-n,this)}valid(e,t){let n,{index:r,offset:o}=e.content.findIndex(t.from);return o==t.from&&!(n=e.child(r)).isText&&o+n.nodeSize==t.to}eq(e){return this==e||e instanceof Pt&&Ft(this.attrs,e.attrs)&&Ft(this.spec,e.spec)}destroy(){}}class Bt{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new Bt(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,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new Bt(e,e,new It(t,n))}static inline(e,t,n,r){return new Bt(e,t,new Rt(n,r))}static node(e,t,n,r){return new Bt(e,t,new Pt(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Rt}}const Lt=[],zt={};class $t{constructor(e,t){this.local=e.length?e:Lt,this.children=t.length?t:Lt}static create(e,t){return t.length?Kt(t,e,0,zt):jt}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,o){for(let i=0;i<this.local.length;i++){let s=this.local[i];s.from<=t&&s.to>=e&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<t&&this.children[i+1]>e){let s=this.children[i]+1;this.children[i+2].findInner(e-s,t-s,n,r+s,o)}}map(e,t,n){return this==jt||0==e.maps.length?this:this.mapInner(e,t,0,0,n||zt)}mapInner(e,t,n,r,o){let i;for(let s=0;s<this.local.length;s++){let a=this.local[s].map(e,n,r);a&&a.type.valid(t,a)?(i||(i=[])).push(a):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?function(e,t,n,r,o,i,s){let a=e.slice();for(let e=0,t=i;e<n.maps.length;e++){let r=0;n.maps[e].forEach(((e,n,i,s)=>{let l=s-i-(n-e);for(let s=0;s<a.length;s+=3){let c=a[s+1];if(c<0||e>c+t-r)continue;let u=a[s]+t-r;n>=u?a[s+1]=e<=u?-2:-1:i>=o&&l&&(a[s]+=l,a[s+1]+=l)}r+=l})),t=n.maps[e].map(t,-1)}let l=!1;for(let t=0;t<a.length;t+=3)if(a[t+1]<0){if(-2==a[t+1]){l=!0,a[t+1]=-1;continue}let c=n.map(e[t]+i),u=c-o;if(u<0||u>=r.content.size){l=!0;continue}let d=n.map(e[t+1]+i,-1)-o,{index:h,offset:p}=r.content.findIndex(u),f=r.maybeChild(h);if(f&&p==u&&p+f.nodeSize==d){let r=a[t+2].mapInner(n,f,c+1,e[t]+i+1,s);r!=jt?(a[t]=u,a[t+1]=d,a[t+2]=r):(a[t+1]=-2,l=!0)}else l=!0}if(l){let l=function(e,t,n,r,o,i,s){function a(e,t){for(let i=0;i<e.local.length;i++){let a=e.local[i].map(r,o,t);a?n.push(a):s.onRemove&&s.onRemove(e.local[i].spec)}for(let n=0;n<e.children.length;n+=3)a(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)-1==e[n+1]&&a(e[n+2],t[n]+i+1);return n}(a,e,t,n,o,i,s),c=Kt(l,r,0,s);t=c.local;for(let e=0;e<a.length;e+=3)a[e+1]<0&&(a.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<a.length&&a[t]<n;)t+=3;a.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new $t(t.sort(Jt),a)}(this.children,i||[],e,t,n,r,o):i?new $t(i.sort(Jt),Lt):jt}add(e,t){return t.length?this==jt?$t.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,o=0;e.forEach(((e,i)=>{let s,a=i+n;if(s=Wt(t,e,a)){for(r||(r=this.children.slice());o<r.length&&r[o]<i;)o+=3;r[o]==i?r[o+2]=r[o+2].addInner(e,s,a+1):r.splice(o,0,i,i+e.nodeSize,Kt(s,e,a+1,zt)),o+=3}}));let i=Vt(o?Ht(t):t,-n);for(let t=0;t<i.length;t++)i[t].type.valid(e,i[t])||i.splice(t--,1);return new $t(i.length?this.local.concat(i).sort(Jt):this.local,r||this.children)}remove(e){return 0==e.length||this==jt?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let r=0;r<n.length;r+=3){let o,i=n[r]+t,s=n[r+1]+t;for(let t,n=0;n<e.length;n++)(t=e[n])&&t.from>i&&t.to<s&&(e[n]=null,(o||(o=[])).push(t));if(!o)continue;n==this.children&&(n=this.children.slice());let a=n[r+2].removeInner(o,i+1);a!=jt?n[r+2]=a:(n.splice(r,3),r-=3)}if(r.length)for(let n,o=0;o<e.length;o++)if(n=e[o])for(let e=0;e<r.length;e++)r[e].eq(n,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1));return n==this.children&&r==this.local?this:r.length||n.length?new $t(r,n):jt}forChild(e,t){if(this==jt)return this;if(t.isLeaf)return $t.empty;let n,r;for(let t=0;t<this.children.length;t+=3)if(this.children[t]>=e){this.children[t]==e&&(n=this.children[t+2]);break}let o=e+1,i=o+t.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<i&&t.to>o&&t.type instanceof Rt){let e=Math.max(o,t.from)-o,n=Math.min(i,t.to)-o;e<n&&(r||(r=[])).push(t.copy(e,n))}}if(r){let e=new $t(r.sort(Jt),Lt);return n?new _t([e,n]):e}return n||jt}eq(e){if(this==e)return!0;if(!(e instanceof $t)||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 qt(this.localsInner(e))}localsInner(e){if(this==jt)return Lt;if(e.inlineContent||!this.local.some(Rt.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof Rt||t.push(this.local[e]);return t}}$t.empty=new $t([],[]),$t.removeOverlap=qt;const jt=$t.empty;class _t{constructor(e){this.members=e}map(e,t){const n=this.members.map((n=>n.map(e,t,zt)));return _t.from(n)}forChild(e,t){if(t.isLeaf)return $t.empty;let n=[];for(let r=0;r<this.members.length;r++){let o=this.members[r].forChild(e,t);o!=jt&&(o instanceof _t?n=n.concat(o.members):n.push(o))}return _t.from(n)}eq(e){if(!(e instanceof _t)||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,n=!0;for(let r=0;r<this.members.length;r++){let o=this.members[r].localsInner(e);if(o.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<o.length;e++)t.push(o[e])}else t=o}return t?qt(n?t:t.sort(Jt)):Lt}static from(e){switch(e.length){case 0:return jt;case 1:return e[0];default:return new _t(e.every((e=>e instanceof $t))?e:e.reduce(((e,t)=>e.concat(t instanceof $t?t:t.members)),[]))}}}function Vt(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let o=e[r];n.push(new Bt(o.from+t,o.to+t,o.type))}return n}function Wt(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,o=null;for(let t,i=0;i<e.length;i++)(t=e[i])&&t.from>n&&t.to<r&&((o||(o=[])).push(t),e[i]=null);return o}function Ht(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function Kt(e,t,n,r){let o=[],i=!1;t.forEach(((t,s)=>{let a=Wt(e,t,s+n);if(a){i=!0;let e=Kt(a,t,n+s+1,r);e!=jt&&o.push(s,s+t.nodeSize,e)}}));let s=Vt(i?Ht(e):e,-n).sort(Jt);for(let e=0;e<s.length;e++)s[e].type.valid(t,s[e])||(r.onRemove&&r.onRemove(s[e].spec),s.splice(e--,1));return s.length||o.length?new $t(s,o):jt}function Jt(e,t){return e.from-t.from||e.to-t.to}function qt(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let o=n+1;o<t.length;o++){let i=t[o];if(i.from!=r.from){i.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,i.from),Ut(t,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(t==e&&(t=e.slice()),t[o]=i.copy(i.from,r.to),Ut(t,o+1,i.copy(r.to,i.to)))}}return t}function Ut(e,t,n){for(;t<e.length&&Jt(n,e[t])>0;)t++;e.splice(t,0,n)}function Yt(e){let t=[];return e.someProp("decorations",(n=>{let r=n(e.state);r&&r!=jt&&t.push(r)})),e.cursorWrapper&&t.push($t.create(e.state.doc,[e.cursorWrapper.deco])),_t.from(t)}const Zt={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Gt=C&&S<=11;class Qt{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 Xt{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Qt,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver((e=>{for(let t=0;t<e.length;t++)this.queue.push(e[t]);C&&S<=11&&e.some((e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length))?this.flushSoon():this.flush()})),Gt&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.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,Zt)),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(Pe(this.view)){if(this.suppressingSelectionUpdates)return Oe(this.view);if(C&&S<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&u(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,n=new Set;for(let t=e.focusNode;t;t=a(t))n.add(t);for(let r=e.anchorNode;r;r=a(r))if(n.has(r)){t=r;break}let r=t&&this.view.docView.nearestDesc(t);return r&&r.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.observer?this.observer.takeRecords():[];this.queue.length&&(t=this.queue.concat(t),this.queue.length=0);let n=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&Pe(e)&&!this.ignoreSelectionChange(n),i=-1,s=-1,a=!1,l=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],l);n&&(i=i<0?n.from:Math.min(n.from,i),s=s<0?n.to:Math.max(n.to,s),n.typeOver&&(a=!0))}if(M&&l.length>1){let e=l.filter((e=>"BR"==e.nodeName));if(2==e.length){let t=e[0],n=e[1];t.parentNode&&t.parentNode.parentNode==n.parentNode?n.remove():t.remove()}}let c=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&m(n)&&(c=Me(e))&&c.eq(r.LN.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Oe(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||o)&&(i>-1&&(e.docView.markDirty(i,s),function(e){if(!en.has(e)&&(en.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))){if(e.requiresGeckoHackNode=M,tn)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."),tn=!0}}(e)),this.handleDOMChange(i,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||Oe(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++)t.push(e.addedNodes[n]);if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,o=e.nextSibling;if(C&&S<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:i}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!i||Array.prototype.indexOf.call(e.addedNodes,i)<0)&&(o=i)}let i=r&&r.parentNode==e.target?s(r)+1:0,a=n.localPosFromDOM(e.target,i,-1),l=o&&o.parentNode==e.target?s(o):e.target.childNodes.length;return{from:a,to:n.localPosFromDOM(e.target,l,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}}let en=new WeakMap,tn=!1;function nn(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(E&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}if(e.parentNode.lastChild==e||E&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const rn=/^(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 on(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Re(e,t.resolve(n.anchor),t.resolve(n.head))}function sn(e,t,n){let r=e.depth,o=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,o++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,o++}return o}class an{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 ut,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(hn),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=un(this),cn(this),this.nodeViews=dn(this),this.docView=ce(this.state.doc,ln(this),Yt(this),this.dom,this),this.domObserver=new Xt(this,((e,t,n,i)=>function(e,t,n,i,s){if(t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=Me(e,t);if(n&&!e.state.selection.eq(n)){if(O&&I&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",(t=>t(e,g(13,"Enter")))))return;let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),e.composing&&r.setMeta("composition",e.input.compositionID),e.dispatch(r)}return}let a=e.state.doc.resolve(t),l=a.sharedDepth(n);t=a.before(l+1),n=e.state.doc.resolve(n).after(l+1);let c,u,d=e.state.selection,h=function(e,t,n){let r,{node:i,fromOffset:s,toOffset:a,from:l,to:c}=e.docView.parseRange(t,n),u=e.domSelectionRange(),d=u.anchorNode;if(d&&e.dom.contains(1==d.nodeType?d:d.parentNode)&&(r=[{node:d,offset:u.anchorOffset}],m(u)||r.push({node:u.focusNode,offset:u.focusOffset})),O&&8===e.input.lastKeyCode)for(let e=a;e>s;e--){let t=i.childNodes[e-1],n=t.pmViewDesc;if("BR"==t.nodeName&&!n){a=e;break}if(!n||n.size)break}let h=e.state.doc,p=e.someProp("domParser")||o.S4.fromSchema(e.state.schema),f=h.resolve(l),g=null,y=p.parse(i,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:s,to:a,preserveWhitespace:"pre"!=f.parent.type.whitespace||"full",findPositions:r,ruleFromNode:nn,context:f});if(r&&null!=r[0].pos){let e=r[0].pos,t=r[1]&&r[1].pos;null==t&&(t=e),g={anchor:e+l,head:t+l}}return{doc:y,sel:g,from:l,to:c}}(e,t,n),p=e.state.doc,f=p.slice(h.from,h.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(c=e.state.selection.to,u="end"):(c=e.state.selection.from,u="start"),e.input.lastKeyCode=null;let y=function(e,t,n,r,o){let i=e.findDiffStart(t,n);if(null==i)return null;let{a:s,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);return"end"==o&&(r-=s+Math.max(0,i-Math.min(s,a))-i),s<i&&e.size<t.size?(i-=r<=i&&r>=s?i-r:0,a=i+(a-s),s=i):a<i&&(i-=r<=i&&r>=a?i-r:0,s=i+(s-a),a=i),{start:i,endA:s,endB:a}}(f.content,h.doc.content,h.from,c,u);if((D&&e.input.lastIOSEnter>Date.now()-225||I)&&s.some((e=>1==e.nodeType&&!rn.test(e.nodeName)))&&(!y||y.endA>=y.endB)&&e.someProp("handleKeyDown",(t=>t(e,g(13,"Enter")))))return void(e.input.lastIOSEnter=0);if(!y){if(!(i&&d instanceof r.U3&&!d.empty&&d.$head.sameParent(d.$anchor))||e.composing||h.sel&&h.sel.anchor!=h.sel.head){if(h.sel){let t=on(e,e.state.doc,h.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);e.composing&&n.setMeta("composition",e.input.compositionID),e.dispatch(n)}}return}y={start:d.from,endA:d.to,endB:d.to}}if(O&&e.cursorWrapper&&h.sel&&h.sel.anchor==e.cursorWrapper.deco.from&&h.sel.head==h.sel.anchor){let e=y.endB-y.start;h.sel={anchor:h.sel.anchor+e,head:h.sel.anchor+e}}e.input.domChangeCount++,e.state.selection.from<e.state.selection.to&&y.start==y.endB&&e.state.selection instanceof r.U3&&(y.start>e.state.selection.from&&y.start<=e.state.selection.from+2&&e.state.selection.from>=h.from?y.start=e.state.selection.from:y.endA<e.state.selection.to&&y.endA>=e.state.selection.to-2&&e.state.selection.to<=h.to&&(y.endB+=e.state.selection.to-y.endA,y.endA=e.state.selection.to)),C&&S<=11&&y.endB==y.start+1&&y.endA==y.start&&y.start>h.from&&" "==h.doc.textBetween(y.start-h.from-1,y.start-h.from+1)&&(y.start--,y.endA--,y.endB--);let v,w=h.doc.resolveNoCache(y.start-h.from),k=h.doc.resolveNoCache(y.endB-h.from),b=p.resolve(y.start),x=w.sameParent(k)&&w.parent.inlineContent&&b.end()>=y.endA;if((D&&e.input.lastIOSEnter>Date.now()-225&&(!x||s.some((e=>"DIV"==e.nodeName||"P"==e.nodeName)))||!x&&w.pos<h.doc.content.size&&(v=r.LN.findFrom(h.doc.resolve(w.pos+1),1,!0))&&v.head==k.pos)&&e.someProp("handleKeyDown",(t=>t(e,g(13,"Enter")))))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>y.start&&function(e,t,n,r,o){if(!r.parent.isTextblock||n-t<=o.pos-r.pos||sn(r,!0,!1)<o.pos)return!1;let i=e.resolve(t);if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=e.resolve(sn(i,!0,!0));return!(!s.parent.isTextblock||s.pos>n||sn(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(p,y.start,y.endA,w,k)&&e.someProp("handleKeyDown",(t=>t(e,g(8,"Backspace")))))return void(I&&O&&e.domObserver.suppressSelectionUpdates());O&&I&&y.endB==y.start&&(e.input.lastAndroidDelete=Date.now()),I&&!x&&w.start()!=k.start()&&0==k.parentOffset&&w.depth==k.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==y.endA&&(y.endB-=2,k=h.doc.resolveNoCache(y.endB-h.from),setTimeout((()=>{e.someProp("handleKeyDown",(function(t){return t(e,g(13,"Enter"))}))}),20));let M,N,A,E=y.start,T=y.endA;if(x)if(w.pos==k.pos)C&&S<=11&&0==w.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout((()=>Oe(e)),20)),M=e.state.tr.delete(E,T),N=p.resolve(y.start).marksAcross(p.resolve(y.endA));else if(y.endA==y.endB&&(A=function(e,t){let n,r,i,s=e.firstChild.marks,a=t.firstChild.marks,l=s,c=a;for(let e=0;e<a.length;e++)l=a[e].removeFromSet(l);for(let e=0;e<s.length;e++)c=s[e].removeFromSet(c);if(1==l.length&&0==c.length)r=l[0],n="add",i=e=>e.mark(r.addToSet(e.marks));else{if(0!=l.length||1!=c.length)return null;r=c[0],n="remove",i=e=>e.mark(r.removeFromSet(e.marks))}let u=[];for(let e=0;e<t.childCount;e++)u.push(i(t.child(e)));if(o.FK.from(u).eq(e))return{mark:r,type:n}}(w.parent.content.cut(w.parentOffset,k.parentOffset),b.parent.content.cut(b.parentOffset,y.endA-b.start()))))M=e.state.tr,"add"==A.type?M.addMark(E,T,A.mark):M.removeMark(E,T,A.mark);else if(w.parent.child(w.index()).isText&&w.index()==k.index()-(k.textOffset?0:1)){let t=w.parent.textBetween(w.parentOffset,k.parentOffset);if(e.someProp("handleTextInput",(n=>n(e,E,T,t))))return;M=e.state.tr.insertText(t,E,T)}if(M||(M=e.state.tr.replace(E,T,h.doc.slice(y.start-h.from,y.endB-h.from))),h.sel){let t=on(e,M.doc,h.sel);t&&!(O&&I&&e.composing&&t.empty&&(y.start!=y.endB||e.input.lastAndroidDelete<Date.now()-100)&&(t.head==E||t.head==M.mapping.map(T)-1)||C&&t.empty&&t.head==E)&&M.setSelection(t)}N&&M.ensureMarks(N),e.composing&&M.setMeta("composition",e.input.compositionID),e.dispatch(M.scrollIntoView())}(this,e,t,n,i))),this.domObserver.start(),function(e){for(let t in at){let n=at[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!ft(e,t)||pt(e,t)||!e.editable&&t.type in lt||n(e,t)},ct[t]?{passive:!0}:void 0)}E&&e.dom.addEventListener("input",(()=>null)),ht(e)}(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&&ht(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(hn),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){let n=this.state,r=!1,o=!1;e.storedMarks&&this.composing&&(Nt(this),o=!0),this.state=e;let i=n.plugins!=e.plugins||this._props.plugins!=t.plugins;if(i||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=dn(this);(function(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r})(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(i||t.handleDOMEvents!=this._props.handleDOMEvents)&&ht(this),this.editable=un(this),cn(this);let s=Yt(this),a=ln(this),l=n.plugins==e.plugins||n.doc.eq(e.doc)?e.scrollToSelection>n.scrollToSelection?"to selection":"preserve":"reset",c=r||!this.docView.matchesNode(e.doc,a,s);!c&&e.selection.eq(n.selection)||(o=!0);let d="preserve"==l&&o&&null==this.dom.style.overflowAnchor&&function(e){let t,n,r=e.dom.getBoundingClientRect(),o=Math.max(0,r.top);for(let i=(r.left+r.right)/2,s=o+1;s<Math.min(innerHeight,r.bottom);s+=5){let r=e.root.elementFromPoint(i,s);if(!r||r==e.dom||!e.dom.contains(r))continue;let a=r.getBoundingClientRect();if(a.top>=o-20){t=r,n=a.top;break}}return{refDOM:t,refTop:n,stack:j(e.dom)}}(this);if(o){this.domObserver.stop();let t=c&&(C||O)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&function(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}(n.selection,e.selection);if(c){let n=O?this.trackWrites=this.domSelectionRange().focusNode:null;!r&&this.docView.update(e.doc,a,s,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=ce(e.doc,a,s,this.dom,this)),n&&!this.trackWrites&&(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return u(t.node,t.offset,n.anchorNode,n.anchorOffset)}(this))?Oe(this,t):(Fe(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),"reset"==l?this.dom.scrollTop=0:"to selection"==l?this.scrollToSelection():d&&function({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;_(n,0==r?0:r-t)}(d)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(this.someProp("handleScrollToSelection",(e=>e(this))));else if(this.state.selection instanceof r.nh){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&$(this,t.getBoundingClientRect(),e)}else $(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)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}someProp(e,t){let n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;for(let r=0;r<this.directPlugins.length;r++){let o=this.directPlugins[r].props[e];if(null!=o&&(n=t?t(o):o))return n}let o=this.state.plugins;if(o)for(let r=0;r<o.length;r++){let i=o[r].props[e];if(null!=i&&(n=t?t(i):i))return n}}hasFocus(){if(C){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("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(V)return e.focus(V);let t=j(e);e.focus(null==V?{get preventScroll(){return V={preventScroll:!0},!0}}:void 0),V||(V=!1,_(t,0))}(this.dom),Oe(this),this.domObserver.start()}get root(){let e=this._root;if(null==e)for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e;return e||document}posAtCoords(e){return J(this,e)}coordsAtPos(e,t=1){return Z(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,n=-1){let r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return function(e,t,n){return te==t&&ne==n?re:(te=t,ne=n,re="up"==n||"down"==n?function(e,t,n){let r=t.selection,o="up"==n?r.$from:r.$to;return X(e,t,(()=>{let{node:t}=e.docView.domFromPos(o.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=Z(e,o.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=c(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let o=t[e];if(o.bottom>o.top+1&&("up"==n?r.top-o.top>2*(o.bottom-r.top):o.bottom-r.bottom>2*(r.bottom-o.top)))return!1}}return!0}))}(e,t,n):function(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=e.domSelection();return ee.test(r.parent.textContent)&&a.modify?X(e,t,(()=>{let{focusNode:t,focusOffset:o,anchorNode:i,anchorOffset:s}=e.domSelectionRange(),l=a.caretBidiLevel;a.modify("move",n,"character");let c=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),h=u&&!c.contains(1==u.nodeType?u:u.parentNode)||t==u&&o==d;try{a.collapse(i,s),t&&(t!=i||o!=s)&&a.extend&&a.extend(t,o)}catch(e){}return null!=l&&(a.caretBidiLevel=l),h})):"left"==n||"backward"==n?i:s}(e,t,n))}(this,t||this.state,e)}pasteHTML(e,t){return Et(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Et(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(function(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Yt(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)}get isDestroyed(){return null==this.docView}dispatchEvent(e){return function(e,t){pt(e,t)||!at[t.type]||!e.editable&&t.type in lt||at[t.type](e,t)}(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){return E&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom?function(e){let t;function n(e){e.preventDefault(),e.stopImmediatePropagation(),t=e.getTargetRanges()[0]}e.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",n,!0);let r=t.startContainer,o=t.startOffset,i=t.endContainer,s=t.endOffset,a=e.domAtPos(e.state.selection.anchor);return u(a.node,a.offset,i,s)&&([r,o,i,s]=[i,s,r,o]),{anchorNode:r,anchorOffset:o,focusNode:i,focusOffset:s}}(this):this.domSelection()}domSelection(){return this.root.getSelection()}}function ln(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",(n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))})),t.translate||(t.translate="no"),[Bt.node(0,e.state.doc.content.size,t)]}function cn(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:Bt.widget(e.state.selection.head,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function un(e){return!e.someProp("editable",(t=>!1===t(e.state)))}function dn(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function hn(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}},3751:(e,t,n)=>{"use strict";n.d(t,{B:()=>yt,y:()=>vt});var r=n(4254),o=n(1570),i=n(72);function s(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function a(e){return e instanceof s(e).Element||e instanceof Element}function l(e){return e instanceof s(e).HTMLElement||e instanceof HTMLElement}function c(e){return"undefined"!=typeof ShadowRoot&&(e instanceof s(e).ShadowRoot||e instanceof ShadowRoot)}var u=Math.max,d=Math.min,h=Math.round;function p(){var e=navigator.userAgentData;return null!=e&&e.brands&&Array.isArray(e.brands)?e.brands.map((function(e){return e.brand+"/"+e.version})).join(" "):navigator.userAgent}function f(){return!/^((?!chrome|android).)*safari/i.test(p())}function m(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);var r=e.getBoundingClientRect(),o=1,i=1;t&&l(e)&&(o=e.offsetWidth>0&&h(r.width)/e.offsetWidth||1,i=e.offsetHeight>0&&h(r.height)/e.offsetHeight||1);var c=(a(e)?s(e):window).visualViewport,u=!f()&&n,d=(r.left+(u&&c?c.offsetLeft:0))/o,p=(r.top+(u&&c?c.offsetTop:0))/i,m=r.width/o,g=r.height/i;return{width:m,height:g,top:p,right:d+m,bottom:p+g,left:d,x:d,y:p}}function g(e){var t=s(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function y(e){return e?(e.nodeName||"").toLowerCase():null}function v(e){return((a(e)?e.ownerDocument:e.document)||window.document).documentElement}function w(e){return m(v(e)).left+g(e).scrollLeft}function k(e){return s(e).getComputedStyle(e)}function b(e){var t=k(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function x(e,t,n){void 0===n&&(n=!1);var r,o,i=l(t),a=l(t)&&function(e){var t=e.getBoundingClientRect(),n=h(t.width)/e.offsetWidth||1,r=h(t.height)/e.offsetHeight||1;return 1!==n||1!==r}(t),c=v(t),u=m(e,a,n),d={scrollLeft:0,scrollTop:0},p={x:0,y:0};return(i||!i&&!n)&&(("body"!==y(t)||b(c))&&(d=(r=t)!==s(r)&&l(r)?{scrollLeft:(o=r).scrollLeft,scrollTop:o.scrollTop}:g(r)),l(t)?((p=m(t,!0)).x+=t.clientLeft,p.y+=t.clientTop):c&&(p.x=w(c))),{x:u.left+d.scrollLeft-p.x,y:u.top+d.scrollTop-p.y,width:u.width,height:u.height}}function C(e){var t=m(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function S(e){return"html"===y(e)?e:e.assignedSlot||e.parentNode||(c(e)?e.host:null)||v(e)}function M(e){return["html","body","#document"].indexOf(y(e))>=0?e.ownerDocument.body:l(e)&&b(e)?e:M(S(e))}function N(e,t){var n;void 0===t&&(t=[]);var r=M(e),o=r===(null==(n=e.ownerDocument)?void 0:n.body),i=s(r),a=o?[i].concat(i.visualViewport||[],b(r)?r:[]):r,l=t.concat(a);return o?l:l.concat(N(S(a)))}function O(e){return["table","td","th"].indexOf(y(e))>=0}function A(e){return l(e)&&"fixed"!==k(e).position?e.offsetParent:null}function E(e){for(var t=s(e),n=A(e);n&&O(n)&&"static"===k(n).position;)n=A(n);return n&&("html"===y(n)||"body"===y(n)&&"static"===k(n).position)?t:n||function(e){var t=/firefox/i.test(p());if(/Trident/i.test(p())&&l(e)&&"fixed"===k(e).position)return null;var n=S(e);for(c(n)&&(n=n.host);l(n)&&["html","body"].indexOf(y(n))<0;){var r=k(n);if("none"!==r.transform||"none"!==r.perspective||"paint"===r.contain||-1!==["transform","perspective"].indexOf(r.willChange)||t&&"filter"===r.willChange||t&&r.filter&&"none"!==r.filter)return n;n=n.parentNode}return null}(e)||t}var D="top",T="bottom",F="right",I="left",R="auto",P=[D,T,F,I],B="start",L="end",z="viewport",$="popper",j=P.reduce((function(e,t){return e.concat([t+"-"+B,t+"-"+L])}),[]),_=[].concat(P,[R]).reduce((function(e,t){return e.concat([t,t+"-"+B,t+"-"+L])}),[]),V=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function W(e){var t=new Map,n=new Set,r=[];function o(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!n.has(e)){var r=t.get(e);r&&o(r)}})),r.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){n.has(e.name)||o(e)})),r}var H={placement:"bottom",modifiers:[],strategy:"absolute"};function K(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some((function(e){return!(e&&"function"==typeof e.getBoundingClientRect)}))}function J(e){void 0===e&&(e={});var t=e,n=t.defaultModifiers,r=void 0===n?[]:n,o=t.defaultOptions,i=void 0===o?H:o;return function(e,t,n){void 0===n&&(n=i);var o,s,l={placement:"bottom",orderedModifiers:[],options:Object.assign({},H,i),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},c=[],u=!1,d={state:l,setOptions:function(n){var o="function"==typeof n?n(l.options):n;h(),l.options=Object.assign({},i,l.options,o),l.scrollParents={reference:a(e)?N(e):e.contextElement?N(e.contextElement):[],popper:N(t)};var s,u,p=function(e){var t=W(e);return V.reduce((function(e,n){return e.concat(t.filter((function(e){return e.phase===n})))}),[])}((s=[].concat(r,l.options.modifiers),u=s.reduce((function(e,t){var n=e[t.name];return e[t.name]=n?Object.assign({},n,t,{options:Object.assign({},n.options,t.options),data:Object.assign({},n.data,t.data)}):t,e}),{}),Object.keys(u).map((function(e){return u[e]}))));return l.orderedModifiers=p.filter((function(e){return e.enabled})),l.orderedModifiers.forEach((function(e){var t=e.name,n=e.options,r=void 0===n?{}:n,o=e.effect;if("function"==typeof o){var i=o({state:l,name:t,instance:d,options:r});c.push(i||function(){})}})),d.update()},forceUpdate:function(){if(!u){var e=l.elements,t=e.reference,n=e.popper;if(K(t,n)){l.rects={reference:x(t,E(n),"fixed"===l.options.strategy),popper:C(n)},l.reset=!1,l.placement=l.options.placement,l.orderedModifiers.forEach((function(e){return l.modifiersData[e.name]=Object.assign({},e.data)}));for(var r=0;r<l.orderedModifiers.length;r++)if(!0!==l.reset){var o=l.orderedModifiers[r],i=o.fn,s=o.options,a=void 0===s?{}:s,c=o.name;"function"==typeof i&&(l=i({state:l,options:a,name:c,instance:d})||l)}else l.reset=!1,r=-1}}},update:(o=function(){return new Promise((function(e){d.forceUpdate(),e(l)}))},function(){return s||(s=new Promise((function(e){Promise.resolve().then((function(){s=void 0,e(o())}))}))),s}),destroy:function(){h(),u=!0}};if(!K(e,t))return d;function h(){c.forEach((function(e){return e()})),c=[]}return d.setOptions(n).then((function(e){!u&&n.onFirstUpdate&&n.onFirstUpdate(e)})),d}}var q={passive:!0};function U(e){return e.split("-")[0]}function Y(e){return e.split("-")[1]}function Z(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function G(e){var t,n=e.reference,r=e.element,o=e.placement,i=o?U(o):null,s=o?Y(o):null,a=n.x+n.width/2-r.width/2,l=n.y+n.height/2-r.height/2;switch(i){case D:t={x:a,y:n.y-r.height};break;case T:t={x:a,y:n.y+n.height};break;case F:t={x:n.x+n.width,y:l};break;case I:t={x:n.x-r.width,y:l};break;default:t={x:n.x,y:n.y}}var c=i?Z(i):null;if(null!=c){var u="y"===c?"height":"width";switch(s){case B:t[c]=t[c]-(n[u]/2-r[u]/2);break;case L:t[c]=t[c]+(n[u]/2-r[u]/2)}}return t}var Q={top:"auto",right:"auto",bottom:"auto",left:"auto"};function X(e){var t,n=e.popper,r=e.popperRect,o=e.placement,i=e.variation,a=e.offsets,l=e.position,c=e.gpuAcceleration,u=e.adaptive,d=e.roundOffsets,p=e.isFixed,f=a.x,m=void 0===f?0:f,g=a.y,y=void 0===g?0:g,w="function"==typeof d?d({x:m,y}):{x:m,y};m=w.x,y=w.y;var b=a.hasOwnProperty("x"),x=a.hasOwnProperty("y"),C=I,S=D,M=window;if(u){var N=E(n),O="clientHeight",A="clientWidth";N===s(n)&&"static"!==k(N=v(n)).position&&"absolute"===l&&(O="scrollHeight",A="scrollWidth"),(o===D||(o===I||o===F)&&i===L)&&(S=T,y-=(p&&N===M&&M.visualViewport?M.visualViewport.height:N[O])-r.height,y*=c?1:-1),o!==I&&(o!==D&&o!==T||i!==L)||(C=F,m-=(p&&N===M&&M.visualViewport?M.visualViewport.width:N[A])-r.width,m*=c?1:-1)}var R,P=Object.assign({position:l},u&&Q),B=!0===d?function(e,t){var n=e.x,r=e.y,o=t.devicePixelRatio||1;return{x:h(n*o)/o||0,y:h(r*o)/o||0}}({x:m,y},s(n)):{x:m,y};return m=B.x,y=B.y,c?Object.assign({},P,((R={})[S]=x?"0":"",R[C]=b?"0":"",R.transform=(M.devicePixelRatio||1)<=1?"translate("+m+"px, "+y+"px)":"translate3d("+m+"px, "+y+"px, 0)",R)):Object.assign({},P,((t={})[S]=x?y+"px":"",t[C]=b?m+"px":"",t.transform="",t))}const ee={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var n=t.styles[e]||{},r=t.attributes[e]||{},o=t.elements[e];l(o)&&y(o)&&(Object.assign(o.style,n),Object.keys(r).forEach((function(e){var t=r[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach((function(e){var r=t.elements[e],o=t.attributes[e]||{},i=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce((function(e,t){return e[t]="",e}),{});l(r)&&y(r)&&(Object.assign(r.style,i),Object.keys(o).forEach((function(e){r.removeAttribute(e)})))}))}},requires:["computeStyles"]},te={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,n=e.options,r=e.name,o=n.offset,i=void 0===o?[0,0]:o,s=_.reduce((function(e,n){return e[n]=function(e,t,n){var r=U(e),o=[I,D].indexOf(r)>=0?-1:1,i="function"==typeof n?n(Object.assign({},t,{placement:e})):n,s=i[0],a=i[1];return s=s||0,a=(a||0)*o,[I,F].indexOf(r)>=0?{x:a,y:s}:{x:s,y:a}}(n,t.rects,i),e}),{}),a=s[t.placement],l=a.x,c=a.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[r]=s}};var ne={left:"right",right:"left",bottom:"top",top:"bottom"};function re(e){return e.replace(/left|right|bottom|top/g,(function(e){return ne[e]}))}var oe={start:"end",end:"start"};function ie(e){return e.replace(/start|end/g,(function(e){return oe[e]}))}function se(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&c(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function ae(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function le(e,t,n){return t===z?ae(function(e,t){var n=s(e),r=v(e),o=n.visualViewport,i=r.clientWidth,a=r.clientHeight,l=0,c=0;if(o){i=o.width,a=o.height;var u=f();(u||!u&&"fixed"===t)&&(l=o.offsetLeft,c=o.offsetTop)}return{width:i,height:a,x:l+w(e),y:c}}(e,n)):a(t)?function(e,t){var n=m(e,!1,"fixed"===t);return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}(t,n):ae(function(e){var t,n=v(e),r=g(e),o=null==(t=e.ownerDocument)?void 0:t.body,i=u(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),s=u(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),a=-r.scrollLeft+w(e),l=-r.scrollTop;return"rtl"===k(o||n).direction&&(a+=u(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:s,x:a,y:l}}(v(e)))}function ce(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function ue(e,t){return t.reduce((function(t,n){return t[n]=e,t}),{})}function de(e,t){void 0===t&&(t={});var n=t,r=n.placement,o=void 0===r?e.placement:r,i=n.strategy,s=void 0===i?e.strategy:i,c=n.boundary,h=void 0===c?"clippingParents":c,p=n.rootBoundary,f=void 0===p?z:p,g=n.elementContext,w=void 0===g?$:g,b=n.altBoundary,x=void 0!==b&&b,C=n.padding,M=void 0===C?0:C,O=ce("number"!=typeof M?M:ue(M,P)),A=w===$?"reference":$,I=e.rects.popper,R=e.elements[x?A:w],B=function(e,t,n,r){var o="clippingParents"===t?function(e){var t=N(S(e)),n=["absolute","fixed"].indexOf(k(e).position)>=0&&l(e)?E(e):e;return a(n)?t.filter((function(e){return a(e)&&se(e,n)&&"body"!==y(e)})):[]}(e):[].concat(t),i=[].concat(o,[n]),s=i[0],c=i.reduce((function(t,n){var o=le(e,n,r);return t.top=u(o.top,t.top),t.right=d(o.right,t.right),t.bottom=d(o.bottom,t.bottom),t.left=u(o.left,t.left),t}),le(e,s,r));return c.width=c.right-c.left,c.height=c.bottom-c.top,c.x=c.left,c.y=c.top,c}(a(R)?R:R.contextElement||v(e.elements.popper),h,f,s),L=m(e.elements.reference),j=G({reference:L,element:I,strategy:"absolute",placement:o}),_=ae(Object.assign({},I,j)),V=w===$?_:L,W={top:B.top-V.top+O.top,bottom:V.bottom-B.bottom+O.bottom,left:B.left-V.left+O.left,right:V.right-B.right+O.right},H=e.modifiersData.offset;if(w===$&&H){var K=H[o];Object.keys(W).forEach((function(e){var t=[F,T].indexOf(e)>=0?1:-1,n=[D,T].indexOf(e)>=0?"y":"x";W[e]+=K[n]*t}))}return W}const he={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,i=void 0===o||o,s=n.altAxis,a=void 0===s||s,l=n.fallbackPlacements,c=n.padding,u=n.boundary,d=n.rootBoundary,h=n.altBoundary,p=n.flipVariations,f=void 0===p||p,m=n.allowedAutoPlacements,g=t.options.placement,y=U(g),v=l||(y!==g&&f?function(e){if(U(e)===R)return[];var t=re(e);return[ie(e),t,ie(t)]}(g):[re(g)]),w=[g].concat(v).reduce((function(e,n){return e.concat(U(n)===R?function(e,t){void 0===t&&(t={});var n=t,r=n.placement,o=n.boundary,i=n.rootBoundary,s=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,c=void 0===l?_:l,u=Y(r),d=u?a?j:j.filter((function(e){return Y(e)===u})):P,h=d.filter((function(e){return c.indexOf(e)>=0}));0===h.length&&(h=d);var p=h.reduce((function(t,n){return t[n]=de(e,{placement:n,boundary:o,rootBoundary:i,padding:s})[U(n)],t}),{});return Object.keys(p).sort((function(e,t){return p[e]-p[t]}))}(t,{placement:n,boundary:u,rootBoundary:d,padding:c,flipVariations:f,allowedAutoPlacements:m}):n)}),[]),k=t.rects.reference,b=t.rects.popper,x=new Map,C=!0,S=w[0],M=0;M<w.length;M++){var N=w[M],O=U(N),A=Y(N)===B,E=[D,T].indexOf(O)>=0,L=E?"width":"height",z=de(t,{placement:N,boundary:u,rootBoundary:d,altBoundary:h,padding:c}),$=E?A?F:I:A?T:D;k[L]>b[L]&&($=re($));var V=re($),W=[];if(i&&W.push(z[O]<=0),a&&W.push(z[$]<=0,z[V]<=0),W.every((function(e){return e}))){S=N,C=!1;break}x.set(N,W)}if(C)for(var H=function(e){var t=w.find((function(t){var n=x.get(t);if(n)return n.slice(0,e).every((function(e){return e}))}));if(t)return S=t,"break"},K=f?3:1;K>0&&"break"!==H(K);K--);t.placement!==S&&(t.modifiersData[r]._skip=!0,t.placement=S,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function pe(e,t,n){return u(e,d(t,n))}function fe(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function me(e){return[D,F,T,I].some((function(t){return e[t]>=0}))}var ge=J({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,i=void 0===o||o,a=r.resize,l=void 0===a||a,c=s(t.elements.popper),u=[].concat(t.scrollParents.reference,t.scrollParents.popper);return i&&u.forEach((function(e){e.addEventListener("scroll",n.update,q)})),l&&c.addEventListener("resize",n.update,q),function(){i&&u.forEach((function(e){e.removeEventListener("scroll",n.update,q)})),l&&c.removeEventListener("resize",n.update,q)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,n=e.name;t.modifiersData[n]=G({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=void 0===r||r,i=n.adaptive,s=void 0===i||i,a=n.roundOffsets,l=void 0===a||a,c={placement:U(t.placement),variation:Y(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:"fixed"===t.options.strategy};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,X(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:s,roundOffsets:l})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,X(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}},ee,te,he,{name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,i=void 0===o||o,s=n.altAxis,a=void 0!==s&&s,l=n.boundary,c=n.rootBoundary,h=n.altBoundary,p=n.padding,f=n.tether,m=void 0===f||f,g=n.tetherOffset,y=void 0===g?0:g,v=de(t,{boundary:l,rootBoundary:c,padding:p,altBoundary:h}),w=U(t.placement),k=Y(t.placement),b=!k,x=Z(w),S="x"===x?"y":"x",M=t.modifiersData.popperOffsets,N=t.rects.reference,O=t.rects.popper,A="function"==typeof y?y(Object.assign({},t.rects,{placement:t.placement})):y,R="number"==typeof A?{mainAxis:A,altAxis:A}:Object.assign({mainAxis:0,altAxis:0},A),P=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,L={x:0,y:0};if(M){if(i){var z,$="y"===x?D:I,j="y"===x?T:F,_="y"===x?"height":"width",V=M[x],W=V+v[$],H=V-v[j],K=m?-O[_]/2:0,J=k===B?N[_]:O[_],q=k===B?-O[_]:-N[_],G=t.elements.arrow,Q=m&&G?C(G):{width:0,height:0},X=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},ee=X[$],te=X[j],ne=pe(0,N[_],Q[_]),re=b?N[_]/2-K-ne-ee-R.mainAxis:J-ne-ee-R.mainAxis,oe=b?-N[_]/2+K+ne+te+R.mainAxis:q+ne+te+R.mainAxis,ie=t.elements.arrow&&E(t.elements.arrow),se=ie?"y"===x?ie.clientTop||0:ie.clientLeft||0:0,ae=null!=(z=null==P?void 0:P[x])?z:0,le=V+oe-ae,ce=pe(m?d(W,V+re-ae-se):W,V,m?u(H,le):H);M[x]=ce,L[x]=ce-V}if(a){var ue,he="x"===x?D:I,fe="x"===x?T:F,me=M[S],ge="y"===S?"height":"width",ye=me+v[he],ve=me-v[fe],we=-1!==[D,I].indexOf(w),ke=null!=(ue=null==P?void 0:P[S])?ue:0,be=we?ye:me-N[ge]-O[ge]-ke+R.altAxis,xe=we?me+N[ge]+O[ge]-ke-R.altAxis:ve,Ce=m&&we?function(e,t,n){var r=pe(e,t,n);return r>n?n:r}(be,me,xe):pe(m?be:ye,me,m?xe:ve);M[S]=Ce,L[S]=Ce-me}t.modifiersData[r]=L}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state,r=e.name,o=e.options,i=n.elements.arrow,s=n.modifiersData.popperOffsets,a=U(n.placement),l=Z(a),c=[I,F].indexOf(a)>=0?"height":"width";if(i&&s){var u=function(e,t){return ce("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:ue(e,P))}(o.padding,n),d=C(i),h="y"===l?D:I,p="y"===l?T:F,f=n.rects.reference[c]+n.rects.reference[l]-s[l]-n.rects.popper[c],m=s[l]-n.rects.reference[l],g=E(i),y=g?"y"===l?g.clientHeight||0:g.clientWidth||0:0,v=f/2-m/2,w=u[h],k=y-d[c]-u[p],b=y/2-d[c]/2+v,x=pe(w,b,k),S=l;n.modifiersData[r]=((t={})[S]=x,t.centerOffset=x-b,t)}},effect:function(e){var t=e.state,n=e.options.element,r=void 0===n?"[data-popper-arrow]":n;null!=r&&("string"!=typeof r||(r=t.elements.popper.querySelector(r)))&&se(t.elements.popper,r)&&(t.elements.arrow=r)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,i=t.modifiersData.preventOverflow,s=de(t,{elementContext:"reference"}),a=de(t,{altBoundary:!0}),l=fe(s,r),c=fe(a,o,i),u=me(l),d=me(c);t.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}}]}),ye="tippy-content",ve="tippy-arrow",we="tippy-svg-arrow",ke={passive:!0,capture:!0},be=function(){return document.body};function xe(e,t,n){if(Array.isArray(e)){var r=e[t];return null==r?Array.isArray(n)?n[t]:n:r}return e}function Ce(e,t){var n={}.toString.call(e);return 0===n.indexOf("[object")&&n.indexOf(t+"]")>-1}function Se(e,t){return"function"==typeof e?e.apply(void 0,t):e}function Me(e,t){return 0===t?e:function(r){clearTimeout(n),n=setTimeout((function(){e(r)}),t)};var n}function Ne(e){return[].concat(e)}function Oe(e,t){-1===e.indexOf(t)&&e.push(t)}function Ae(e){return[].slice.call(e)}function Ee(e){return Object.keys(e).reduce((function(t,n){return void 0!==e[n]&&(t[n]=e[n]),t}),{})}function De(){return document.createElement("div")}function Te(e){return["Element","Fragment"].some((function(t){return Ce(e,t)}))}function Fe(e,t){e.forEach((function(e){e&&(e.style.transitionDuration=t+"ms")}))}function Ie(e,t){e.forEach((function(e){e&&e.setAttribute("data-state",t)}))}function Re(e,t,n){var r=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach((function(t){e[r](t,n)}))}function Pe(e,t){for(var n=t;n;){var r;if(e.contains(n))return!0;n=null==n.getRootNode||null==(r=n.getRootNode())?void 0:r.host}return!1}var Be={isTouch:!1},Le=0;function ze(){Be.isTouch||(Be.isTouch=!0,window.performance&&document.addEventListener("mousemove",$e))}function $e(){var e=performance.now();e-Le<20&&(Be.isTouch=!1,document.removeEventListener("mousemove",$e)),Le=e}function je(){var e,t=document.activeElement;if((e=t)&&e._tippy&&e._tippy.reference===e){var n=t._tippy;t.blur&&!n.state.isVisible&&t.blur()}}var _e=!("undefined"==typeof window||"undefined"==typeof document||!window.msCrypto),Ve=Object.assign({appendTo:be,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},{animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},{allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999}),We=Object.keys(Ve);function He(e){var t=(e.plugins||[]).reduce((function(t,n){var r,o=n.name,i=n.defaultValue;return o&&(t[o]=void 0!==e[o]?e[o]:null!=(r=Ve[o])?r:i),t}),{});return Object.assign({},e,t)}function Ke(e,t){var n=Object.assign({},t,{content:Se(t.content,[e])},t.ignoreAttributes?{}:function(e,t){return(t?Object.keys(He(Object.assign({},Ve,{plugins:t}))):We).reduce((function(t,n){var r=(e.getAttribute("data-tippy-"+n)||"").trim();if(!r)return t;if("content"===n)t[n]=r;else try{t[n]=JSON.parse(r)}catch(e){t[n]=r}return t}),{})}(e,t.plugins));return n.aria=Object.assign({},Ve.aria,n.aria),n.aria={expanded:"auto"===n.aria.expanded?t.interactive:n.aria.expanded,content:"auto"===n.aria.content?t.interactive?null:"describedby":n.aria.content},n}function Je(e,t){e.innerHTML=t}function qe(e){var t=De();return!0===e?t.className=ve:(t.className=we,Te(e)?t.appendChild(e):Je(t,e)),t}function Ue(e,t){Te(t.content)?(Je(e,""),e.appendChild(t.content)):"function"!=typeof t.content&&(t.allowHTML?Je(e,t.content):e.textContent=t.content)}function Ye(e){var t=e.firstElementChild,n=Ae(t.children);return{box:t,content:n.find((function(e){return e.classList.contains(ye)})),arrow:n.find((function(e){return e.classList.contains(ve)||e.classList.contains(we)})),backdrop:n.find((function(e){return e.classList.contains("tippy-backdrop")}))}}function Ze(e){var t=De(),n=De();n.className="tippy-box",n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=De();function o(n,r){var o=Ye(t),i=o.box,s=o.content,a=o.arrow;r.theme?i.setAttribute("data-theme",r.theme):i.removeAttribute("data-theme"),"string"==typeof r.animation?i.setAttribute("data-animation",r.animation):i.removeAttribute("data-animation"),r.inertia?i.setAttribute("data-inertia",""):i.removeAttribute("data-inertia"),i.style.maxWidth="number"==typeof r.maxWidth?r.maxWidth+"px":r.maxWidth,r.role?i.setAttribute("role",r.role):i.removeAttribute("role"),n.content===r.content&&n.allowHTML===r.allowHTML||Ue(s,e.props),r.arrow?a?n.arrow!==r.arrow&&(i.removeChild(a),i.appendChild(qe(r.arrow))):i.appendChild(qe(r.arrow)):a&&i.removeChild(a)}return r.className=ye,r.setAttribute("data-state","hidden"),Ue(r,e.props),t.appendChild(n),n.appendChild(r),o(e.props,e.props),{popper:t,onUpdate:o}}Ze.$$tippy=!0;var Ge=1,Qe=[],Xe=[];function et(e,t){var n,r,o,i,s,a,l,c,u=Ke(e,Object.assign({},Ve,He(Ee(t)))),d=!1,h=!1,p=!1,f=!1,m=[],g=Me(q,u.interactiveDebounce),y=Ge++,v=(c=u.plugins).filter((function(e,t){return c.indexOf(e)===t})),w={id:y,reference:e,popper:De(),popperInstance:null,props:u,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:v,clearDelayTimeouts:function(){clearTimeout(n),clearTimeout(r),cancelAnimationFrame(o)},setProps:function(t){if(!w.state.isDestroyed){I("onBeforeUpdate",[w,t]),K();var n=w.props,r=Ke(e,Object.assign({},n,Ee(t),{ignoreAttributes:!0}));w.props=r,H(),n.interactiveDebounce!==r.interactiveDebounce&&(B(),g=Me(q,r.interactiveDebounce)),n.triggerTarget&&!r.triggerTarget?Ne(n.triggerTarget).forEach((function(e){e.removeAttribute("aria-expanded")})):r.triggerTarget&&e.removeAttribute("aria-expanded"),P(),F(),x&&x(n,r),w.popperInstance&&(G(),X().forEach((function(e){requestAnimationFrame(e._tippy.popperInstance.forceUpdate)}))),I("onAfterUpdate",[w,t])}},setContent:function(e){w.setProps({content:e})},show:function(){var e=w.state.isVisible,t=w.state.isDestroyed,n=!w.state.isEnabled,r=Be.isTouch&&!w.props.touch,o=xe(w.props.duration,0,Ve.duration);if(!(e||t||n||r||A().hasAttribute("disabled")||(I("onShow",[w],!1),!1===w.props.onShow(w)))){if(w.state.isVisible=!0,O()&&(b.style.visibility="visible"),F(),j(),w.state.isMounted||(b.style.transition="none"),O()){var i=D();Fe([i.box,i.content],0)}var s,l,c;a=function(){var e;if(w.state.isVisible&&!f){if(f=!0,b.offsetHeight,b.style.transition=w.props.moveTransition,O()&&w.props.animation){var t=D(),n=t.box,r=t.content;Fe([n,r],o),Ie([n,r],"visible")}R(),P(),Oe(Xe,w),null==(e=w.popperInstance)||e.forceUpdate(),I("onMount",[w]),w.props.animation&&O()&&function(e){V(e,(function(){w.state.isShown=!0,I("onShown",[w])}))}(o)}},l=w.props.appendTo,c=A(),(s=w.props.interactive&&l===be||"parent"===l?c.parentNode:Se(l,[c])).contains(b)||s.appendChild(b),w.state.isMounted=!0,G()}},hide:function(){var e=!w.state.isVisible,t=w.state.isDestroyed,n=!w.state.isEnabled,r=xe(w.props.duration,1,Ve.duration);if(!(e||t||n)&&(I("onHide",[w],!1),!1!==w.props.onHide(w))){if(w.state.isVisible=!1,w.state.isShown=!1,f=!1,d=!1,O()&&(b.style.visibility="hidden"),B(),_(),F(!0),O()){var o=D(),i=o.box,s=o.content;w.props.animation&&(Fe([i,s],r),Ie([i,s],"hidden"))}R(),P(),w.props.animation?O()&&function(e,t){V(e,(function(){!w.state.isVisible&&b.parentNode&&b.parentNode.contains(b)&&t()}))}(r,w.unmount):w.unmount()}},hideWithInteractivity:function(e){E().addEventListener("mousemove",g),Oe(Qe,g),g(e)},enable:function(){w.state.isEnabled=!0},disable:function(){w.hide(),w.state.isEnabled=!1},unmount:function(){w.state.isVisible&&w.hide(),w.state.isMounted&&(Q(),X().forEach((function(e){e._tippy.unmount()})),b.parentNode&&b.parentNode.removeChild(b),Xe=Xe.filter((function(e){return e!==w})),w.state.isMounted=!1,I("onHidden",[w]))},destroy:function(){w.state.isDestroyed||(w.clearDelayTimeouts(),w.unmount(),K(),delete e._tippy,w.state.isDestroyed=!0,I("onDestroy",[w]))}};if(!u.render)return w;var k=u.render(w),b=k.popper,x=k.onUpdate;b.setAttribute("data-tippy-root",""),b.id="tippy-"+w.id,w.popper=b,e._tippy=w,b._tippy=w;var C=v.map((function(e){return e.fn(w)})),S=e.hasAttribute("aria-expanded");return H(),P(),F(),I("onCreate",[w]),u.showOnCreate&&ee(),b.addEventListener("mouseenter",(function(){w.props.interactive&&w.state.isVisible&&w.clearDelayTimeouts()})),b.addEventListener("mouseleave",(function(){w.props.interactive&&w.props.trigger.indexOf("mouseenter")>=0&&E().addEventListener("mousemove",g)})),w;function M(){var e=w.props.touch;return Array.isArray(e)?e:[e,0]}function N(){return"hold"===M()[0]}function O(){var e;return!(null==(e=w.props.render)||!e.$$tippy)}function A(){return l||e}function E(){var e,t,n=A().parentNode;return n?null!=(t=Ne(n)[0])&&null!=(e=t.ownerDocument)&&e.body?t.ownerDocument:document:document}function D(){return Ye(b)}function T(e){return w.state.isMounted&&!w.state.isVisible||Be.isTouch||i&&"focus"===i.type?0:xe(w.props.delay,e?0:1,Ve.delay)}function F(e){void 0===e&&(e=!1),b.style.pointerEvents=w.props.interactive&&!e?"":"none",b.style.zIndex=""+w.props.zIndex}function I(e,t,n){var r;void 0===n&&(n=!0),C.forEach((function(n){n[e]&&n[e].apply(n,t)})),n&&(r=w.props)[e].apply(r,t)}function R(){var t=w.props.aria;if(t.content){var n="aria-"+t.content,r=b.id;Ne(w.props.triggerTarget||e).forEach((function(e){var t=e.getAttribute(n);if(w.state.isVisible)e.setAttribute(n,t?t+" "+r:r);else{var o=t&&t.replace(r,"").trim();o?e.setAttribute(n,o):e.removeAttribute(n)}}))}}function P(){!S&&w.props.aria.expanded&&Ne(w.props.triggerTarget||e).forEach((function(e){w.props.interactive?e.setAttribute("aria-expanded",w.state.isVisible&&e===A()?"true":"false"):e.removeAttribute("aria-expanded")}))}function B(){E().removeEventListener("mousemove",g),Qe=Qe.filter((function(e){return e!==g}))}function L(t){if(!Be.isTouch||!p&&"mousedown"!==t.type){var n=t.composedPath&&t.composedPath()[0]||t.target;if(!w.props.interactive||!Pe(b,n)){if(Ne(w.props.triggerTarget||e).some((function(e){return Pe(e,n)}))){if(Be.isTouch)return;if(w.state.isVisible&&w.props.trigger.indexOf("click")>=0)return}else I("onClickOutside",[w,t]);!0===w.props.hideOnClick&&(w.clearDelayTimeouts(),w.hide(),h=!0,setTimeout((function(){h=!1})),w.state.isMounted||_())}}}function z(){p=!0}function $(){p=!1}function j(){var e=E();e.addEventListener("mousedown",L,!0),e.addEventListener("touchend",L,ke),e.addEventListener("touchstart",$,ke),e.addEventListener("touchmove",z,ke)}function _(){var e=E();e.removeEventListener("mousedown",L,!0),e.removeEventListener("touchend",L,ke),e.removeEventListener("touchstart",$,ke),e.removeEventListener("touchmove",z,ke)}function V(e,t){var n=D().box;function r(e){e.target===n&&(Re(n,"remove",r),t())}if(0===e)return t();Re(n,"remove",s),Re(n,"add",r),s=r}function W(t,n,r){void 0===r&&(r=!1),Ne(w.props.triggerTarget||e).forEach((function(e){e.addEventListener(t,n,r),m.push({node:e,eventType:t,handler:n,options:r})}))}function H(){var e;N()&&(W("touchstart",J,{passive:!0}),W("touchend",U,{passive:!0})),(e=w.props.trigger,e.split(/\s+/).filter(Boolean)).forEach((function(e){if("manual"!==e)switch(W(e,J),e){case"mouseenter":W("mouseleave",U);break;case"focus":W(_e?"focusout":"blur",Y);break;case"focusin":W("focusout",Y)}}))}function K(){m.forEach((function(e){var t=e.node,n=e.eventType,r=e.handler,o=e.options;t.removeEventListener(n,r,o)})),m=[]}function J(e){var t,n=!1;if(w.state.isEnabled&&!Z(e)&&!h){var r="focus"===(null==(t=i)?void 0:t.type);i=e,l=e.currentTarget,P(),!w.state.isVisible&&Ce(e,"MouseEvent")&&Qe.forEach((function(t){return t(e)})),"click"===e.type&&(w.props.trigger.indexOf("mouseenter")<0||d)&&!1!==w.props.hideOnClick&&w.state.isVisible?n=!0:ee(e),"click"===e.type&&(d=!n),n&&!r&&te(e)}}function q(e){var t=e.target,n=A().contains(t)||b.contains(t);if("mousemove"!==e.type||!n){var r=X().concat(b).map((function(e){var t,n=null==(t=e._tippy.popperInstance)?void 0:t.state;return n?{popperRect:e.getBoundingClientRect(),popperState:n,props:u}:null})).filter(Boolean);(function(e,t){var n=t.clientX,r=t.clientY;return e.every((function(e){var t=e.popperRect,o=e.popperState,i=e.props.interactiveBorder,s=o.placement.split("-")[0],a=o.modifiersData.offset;if(!a)return!0;var l="bottom"===s?a.top.y:0,c="top"===s?a.bottom.y:0,u="right"===s?a.left.x:0,d="left"===s?a.right.x:0,h=t.top-r+l>i,p=r-t.bottom-c>i,f=t.left-n+u>i,m=n-t.right-d>i;return h||p||f||m}))})(r,e)&&(B(),te(e))}}function U(e){Z(e)||w.props.trigger.indexOf("click")>=0&&d||(w.props.interactive?w.hideWithInteractivity(e):te(e))}function Y(e){w.props.trigger.indexOf("focusin")<0&&e.target!==A()||w.props.interactive&&e.relatedTarget&&b.contains(e.relatedTarget)||te(e)}function Z(e){return!!Be.isTouch&&N()!==e.type.indexOf("touch")>=0}function G(){Q();var t=w.props,n=t.popperOptions,r=t.placement,o=t.offset,i=t.getReferenceClientRect,s=t.moveTransition,l=O()?Ye(b).arrow:null,c=i?{getBoundingClientRect:i,contextElement:i.contextElement||A()}:e,u=[{name:"offset",options:{offset:o}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!s}},{name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(e){var t=e.state;if(O()){var n=D().box;["placement","reference-hidden","escaped"].forEach((function(e){"placement"===e?n.setAttribute("data-placement",t.placement):t.attributes.popper["data-popper-"+e]?n.setAttribute("data-"+e,""):n.removeAttribute("data-"+e)})),t.attributes.popper={}}}}];O()&&l&&u.push({name:"arrow",options:{element:l,padding:3}}),u.push.apply(u,(null==n?void 0:n.modifiers)||[]),w.popperInstance=ge(c,b,Object.assign({},n,{placement:r,onFirstUpdate:a,modifiers:u}))}function Q(){w.popperInstance&&(w.popperInstance.destroy(),w.popperInstance=null)}function X(){return Ae(b.querySelectorAll("[data-tippy-root]"))}function ee(e){w.clearDelayTimeouts(),e&&I("onTrigger",[w,e]),j();var t=T(!0),r=M(),o=r[0],i=r[1];Be.isTouch&&"hold"===o&&i&&(t=i),t?n=setTimeout((function(){w.show()}),t):w.show()}function te(e){if(w.clearDelayTimeouts(),I("onUntrigger",[w,e]),w.state.isVisible){if(!(w.props.trigger.indexOf("mouseenter")>=0&&w.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(e.type)>=0&&d)){var t=T(!1);t?r=setTimeout((function(){w.state.isVisible&&w.hide()}),t):o=requestAnimationFrame((function(){w.hide()}))}}else _()}}function tt(e,t){void 0===t&&(t={});var n=Ve.plugins.concat(t.plugins||[]);document.addEventListener("touchstart",ze,ke),window.addEventListener("blur",je);var r,o=Object.assign({},t,{plugins:n}),i=(r=e,Te(r)?[r]:function(e){return Ce(e,"NodeList")}(r)?Ae(r):Array.isArray(r)?r:Ae(document.querySelectorAll(r))).reduce((function(e,t){var n=t&&et(t,o);return n&&e.push(n),e}),[]);return Te(e)?i[0]:i}tt.defaultProps=Ve,tt.setDefaultProps=function(e){Object.keys(e).forEach((function(t){Ve[t]=e[t]}))},tt.currentInput=Be,Object.assign({},ee,{effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow)}}),tt.setDefaultProps({render:Ze});const nt=tt;var rt,ot,it,st,at,lt,ct,ut=n(6512),dt=Object.defineProperty,ht=(e,t,n)=>(((e,t,n)=>{t in e?dt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n),pt=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},ft=(e,t,n)=>(pt(e,t,"read from private field"),n?n.call(e):t.get(e)),mt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},gt=(e,t,n,r)=>(pt(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class yt{constructor(e){mt(this,lt),mt(this,rt,void 0),mt(this,ot,void 0),mt(this,it,void 0),mt(this,st,void 0),ht(this,"element"),mt(this,at,((e,t)=>{const{state:n,composing:o}=e,{selection:i,doc:s}=n,{ranges:a}=i,l=Math.min(...a.map((e=>e.$from.pos))),c=Math.max(...a.map((e=>e.$to.pos))),u=t&&t.doc.eq(s)&&t.selection.eq(i);if(ft(this,rt)??gt(this,rt,nt(e.dom,{trigger:"manual",interactive:!0,...ft(this,ot),content:this.element})),!o&&!u){if(!ft(this,st).call(this,e,t))return void this.hide();ft(this,rt).setProps({getReferenceClientRect:()=>(0,r.MG)(e,l,c)}),this.show()}})),ht(this,"update",((e,t)=>{i(ft(this,at),ft(this,it))(e,t)})),ht(this,"destroy",(()=>{var e;null==(e=ft(this,rt))||e.destroy()})),ht(this,"show",(()=>{var e;null==(e=ft(this,rt))||e.show()})),ht(this,"hide",(()=>{var e;null==(e=ft(this,rt))||e.hide()})),ht(this,"getInstance",(()=>ft(this,rt))),this.element=e.content,gt(this,ot,e.tippyOptions??{}),gt(this,it,e.debounce??200),gt(this,st,e.shouldShow??((e,t,n)=>(pt(this,t,"access private method"),n))(0,lt,ct))}}rt=new WeakMap,ot=new WeakMap,it=new WeakMap,st=new WeakMap,at=new WeakMap,lt=new WeakSet,ct=function(e){const{doc:t,selection:n}=e.state,{empty:r,from:i,to:s}=n,a=!t.textBetween(i,s).length&&e.state.selection instanceof o.U3,l=this.element.contains(document.activeElement),c=!e.hasFocus()&&!l,u=!e.editable;return!(c||r||a||u)};const vt=e=>{const t=(0,ut.Qx)({},`${e}_TOOLTIP_SPEC`),n=(0,ut.Gf)((n=>{const r=n.get(t.key);return new o.k_({key:new o.hs(`${e}_TOOLTIP`),...r})})),r=[t,n];return r.key=t.key,r.pluginKey=n.key,t.meta={package:"@milkdown/plugin-tooltip",displayName:`Ctx<tooltipSpec>|${e}`},n.meta={package:"@milkdown/plugin-tooltip",displayName:`Prose<tooltip>|${e}`},r}},3796:(e,t,n)=>{"use strict";function r(e,t,n){const r=[];let o=-1;for(;++o<e.length;){const i=e[o].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}n.d(t,{W:()=>r})},3890:(e,t,n)=>{"use strict";function r(e,t,n,r){const o=e.length;let i,s=0;if(t=t<0?-t>o?0:o+t:t>o?o:t,n=n>0?n:0,r.length<1e4)i=Array.from(r),i.unshift(t,n),[].splice.apply(e,i);else for(n&&[].splice.apply(e,[t,n]);s<r.length;)i=r.slice(s,s+1e4),i.unshift(t,0),[].splice.apply(e,i),s+=1e4,t+=1e4}function o(e,t){return e.length>0?(r(e,e.length,0,t),e):t}n.d(t,{V:()=>o,m:()=>r})},3971:(e,t,n)=>{"use strict";n.d(t,{vo:()=>T,e2:()=>y,$X:()=>w,hi:()=>x,Uv:()=>S,W4:()=>O,rJ:()=>E});var r,o,i,s,a=n(8769),l=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},c=(e,t,n)=>(((e,t)=>{if(!t.has(e))throw TypeError("Cannot access private method")})(e,t),n);class u{constructor({node:e,view:t,getPos:n,decorations:o,innerDecorations:i,options:s}){l(this,r),this.selected=!1,this.selectNode=()=>{var e,t;this.selected=!0,null==(t=(e=this.options).selectNode)||t.call(e)},this.deselectNode=()=>{var e,t;this.selected=!1,null==(t=(e=this.options).deselectNode)||t.call(e)},this.shouldUpdate=e=>!(e.type!==this.node.type||e.sameMarkup(this.node)&&e.content.eq(this.node.content)),this.update=(e,t,n)=>{var r,o;const i=this.options.update;let s;return i&&(s=i(e,t,n)),"boolean"!=typeof s&&(s=this.shouldUpdate(e)),this.node=e,this.decorations=t,this.innerDecorations=n,s&&(null==(o=(r=this.options).onUpdate)||o.call(r)),s},this.shouldIgnoreMutation=e=>!(this.dom&&this.contentDOM&&!this.node.isLeaf&&!this.node.isAtom)||"selection"!==e.type&&(this.contentDOM===e.target&&"attributes"===e.type||!this.contentDOM.contains(e.target)),this.ignoreMutation=e=>{if(!this.dom||!this.contentDOM)return!0;let t;const n=this.options.ignoreMutation;return n&&(t=n(e)),"boolean"!=typeof t&&(t=this.shouldIgnoreMutation(e)),t},this.destroy=()=>{var e,t,n;null==(t=(e=this.options).destroy)||t.call(e),this.dom.remove(),null==(n=this.contentDOM)||n.remove()},this.setAttrs=e=>{const{dispatch:t,state:n}=this.view,r=this.getPos();if("number"==typeof r)return t(n.tr.setNodeMarkup(r,void 0,{...this.node.attrs,...e}))},this.node=e,this.view=t,this.getPos=n,this.decorations=o,this.innerDecorations=i,this.options=s,this.dom=this.createDOM(s.as),this.contentDOM=e.isLeaf?null:this.createContentDOM(s.contentAs),this.dom.setAttribute("data-node-view-root","true"),this.contentDOM&&(this.contentDOM.setAttribute("data-node-view-content","true"),this.contentDOM.style.whiteSpace="inherit"),this.setSelection=s.setSelection,this.stopEvent=s.stopEvent}createDOM(e){return c(this,r,o).call(this,e)}createContentDOM(e){return c(this,r,o).call(this,e)}get component(){return this.options.component}}r=new WeakSet,o=function(e){const{node:t}=this;return null==e?document.createElement(t.isInline?"span":"div"):e instanceof HTMLElement?e:e instanceof Function?e(t):document.createElement(e)};class d{constructor(e){this.view=e.view,this.options=e.options}get component(){return this.options.component}get root(){var e,t;let n=null==(t=(e=this.options).root)?void 0:t.call(e,this.view.dom);return n||(n=this.view.dom.parentElement??document.body),n}update(e,t){var n,r;this.view=e,this.prevState=t,null==(r=(n=this.options).update)||r.call(n,e,t)}destroy(){var e,t;null==(t=(e=this.options).destroy)||t.call(e)}}class h{constructor({pos:e,spec:t,options:n}){l(this,i),this.pos=e,this.options=n,this.spec=t,this.dom=c(this,i,s).call(this,n.as),this.dom.setAttribute("data-widget-view-root","true")}bind(e,t){this.view=e,this.getPos=t}get component(){return this.options.component}}i=new WeakSet,s=function(e){return e instanceof HTMLElement?e:document.createElement(e)};var p=n(9742),f=n(9435),m=n(3686);const g=(0,a.createContext)({contentRef:()=>{},view:null,getPos:()=>0,setAttrs:()=>{},node:null,selected:!1,decorations:[],innerDecorations:null}),y=()=>(0,a.useContext)(g),v=(0,a.createContext)((e=>{throw new Error("out of scope")})),w=()=>(0,a.useContext)(v);class k extends u{constructor(){super(...arguments),this.key=(0,p.Ak)(),this.context={contentRef:e=>{e&&this.contentDOM&&e.firstChild!==this.contentDOM&&e.appendChild(this.contentDOM)},view:this.view,getPos:this.getPos,setAttrs:this.setAttrs,node:this.node,selected:this.selected,decorations:this.decorations,innerDecorations:this.innerDecorations},this.updateContext=()=>{Object.assign(this.context,{node:this.node,selected:this.selected,decorations:this.decorations,innerDecorations:this.innerDecorations})},this.render=()=>{const e=this.component;return(0,f.createPortal)(a.createElement(g.Provider,{value:this.context},a.createElement(e,null)),this.dom,this.key)}}}const b=(0,a.createContext)({view:null}),x=()=>(0,a.useContext)(b),C=(0,a.createContext)((e=>{throw new Error("out of scope")})),S=()=>(0,a.useContext)(C);class M extends d{constructor(){super(...arguments),this.key=(0,p.Ak)(),this.context={view:this.view,prevState:this.prevState},this.updateContext=()=>{Object.assign(this.context,{view:this.view,prevState:this.prevState})},this.render=()=>{const e=this.component;return(0,f.createPortal)(a.createElement(b.Provider,{value:this.context},a.createElement(e,null)),this.root,this.key)}}}const N=(0,a.createContext)({view:null,getPos:()=>{}}),O=()=>(0,a.useContext)(N),A=(0,a.createContext)((e=>{throw new Error("out of scope")})),E=()=>(0,a.useContext)(A);class D extends h{constructor(){super(...arguments),this.key=(0,p.Ak)(),this.context={view:this.view,getPos:this.getPos,spec:this.spec},this.updateContext=()=>{Object.assign(this.context,{view:this.view,getPos:this.getPos,spec:this.spec})},this.render=()=>{const e=this.component;return(0,f.createPortal)(a.createElement(N.Provider,{value:this.context},a.createElement(e,null)),this.dom,this.key)}}}const T=({children:e})=>{const{renderReactRenderer:t,removeReactRenderer:n,portals:r}=(()=>{const[e,t]=(0,a.useState)({}),n=(0,a.useRef)(!1);(0,a.useEffect)((()=>(requestAnimationFrame((()=>{n.current=!0})),()=>{n.current=!1})),[]);const r=(0,a.useCallback)((e=>{n.current?(0,f.flushSync)(e):e()}),[]);return{portals:e,renderReactRenderer:(0,a.useCallback)(((e,n=!0)=>{r((()=>{n&&e.updateContext(),t((t=>({...t,[e.key]:e.render()})))}))}),[r]),removeReactRenderer:(0,a.useCallback)((e=>{r((()=>{t((t=>{const n={...t};return delete n[e.key],n}))}))}),[r])}})(),o=((e,t)=>(0,a.useCallback)((n=>(r,o,i,s,a)=>{const l=new k({node:r,view:o,getPos:i,decorations:s,innerDecorations:a,options:{...n,onUpdate(){var t;null==(t=n.onUpdate)||t.call(n),e(l)},selectNode(){var t;null==(t=n.selectNode)||t.call(n),e(l)},deselectNode(){var t;null==(t=n.deselectNode)||t.call(n),e(l)},destroy(){var e;null==(e=n.destroy)||e.call(n),t(l)}}});return e(l,!1),l}),[t,e]))(t,n),i=((e,t)=>(0,a.useCallback)((n=>r=>{const o=new M({view:r,options:{...n,update:(t,r)=>{var i;null==(i=n.update)||i.call(n,t,r),e(o)},destroy:()=>{var e;null==(e=n.destroy)||e.call(n),t(o)}}});return e(o,!1),o}),[t,e]))(t,n),s=((e,t)=>(0,a.useCallback)((n=>(r,o={})=>{const i=new D({pos:r,options:n}),s={...o,destroy:e=>{var n;null==(n=o.destroy)||n.call(o,e),t(i)}};return i.spec=s,m.NZ.widget(r,((t,n)=>(i.bind(t,n),e(i),i.dom)),s)}),[t,e]))(t,n),l=(0,a.useMemo)((()=>Object.values(r)),[r]);return a.createElement(v.Provider,{value:o},a.createElement(C.Provider,{value:i},a.createElement(A.Provider,{value:s},e,l)))}},4254:(e,t,n)=>{"use strict";n.d(t,{I9:()=>z,KP:()=>j,MG:()=>L,T:()=>C,UM:()=>_,Z6:()=>N,xe:()=>$});var r=n(1570);const o="undefined"!=typeof navigator?navigator:null,i="undefined"!=typeof document?document:null,s=o&&o.userAgent||"",a=/Edge\/(\d+)/.exec(s),l=/MSIE \d/.exec(s),c=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(s),u=!!(l||c||a),d=l?document.documentMode:c?+c[1]:a?+a[1]:0,h=!u&&/gecko\/(\d+)/i.test(s),p=h&&+(/Firefox\/(\d+)/.exec(s)||[0,0])[1],f=!u&&/Chrome\/(\d+)/.exec(s),m=!!f,g=f?+f[1]:0,y=!u&&!!o&&/Apple Computer/.test(o.vendor),v=y&&(/Mobile\/\w+/.test(s)||!!o&&o.maxTouchPoints>2),w=v||!!o&&/Mac/.test(o.platform),k=/Android \d/.test(s),b=!!i&&"webkitFontSmoothing"in i.documentElement.style,x=b?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;var C=Object.freeze({__proto__:null,ie:u,ie_version:d,gecko:h,gecko_version:p,chrome:m,chrome_version:g,safari:y,ios:v,mac:w,android:k,webkit:b,webkit_version:x});function S(e,t,n,r,o,i){if(e.composing)return!1;const s=e.state,a=s.doc.resolve(t);if(a.parent.type.spec.code)return!1;const l=a.parent.textBetween(Math.max(0,a.parentOffset-500),a.parentOffset,void 0,"")+r;for(let a=0;a<o.length;a++){const c=o[a].match.exec(l),u=c&&c[0]&&o[a].handler(s,c,t-(c[0].length-r.length),n);if(u)return e.dispatch(u.setMeta(i,{transform:u,from:t,to:n,text:r})),!0}return!1}const M=new r.hs("MILKDOWN_CUSTOM_INPUTRULES"),N=({rules:e})=>{const t=new r.k_({key:M,isInputRules:!0,state:{init:()=>null,apply(e,t){return e.getMeta(this)||(e.selectionSet||e.docChanged?null:t)}},props:{handleTextInput:(n,r,o,i)=>S(n,r,o,i,e,t),handleDOMEvents:{compositionend:n=>(setTimeout((()=>{const{$cursor:r}=n.state.selection;r&&S(n,r.pos,r.pos,"",e,t)})),!1)},handleKeyDown(n,r){if("Enter"!==r.key)return!1;const{$cursor:o}=n.state.selection;return!!o&&S(n,o.pos,o.pos,"\n",e,t)}}});return t};var O=Object.defineProperty,A=Object.defineProperties,E=Object.getOwnPropertyDescriptors,D=Object.getOwnPropertySymbols,T=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable,I=(e,t,n)=>t in e?O(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,R=(e,t)=>{for(var n in t||(t={}))T.call(t,n)&&I(e,n,t[n]);if(D)for(var n of D(t))F.call(t,n)&&I(e,n,t[n]);return e},P=(e,t)=>A(e,E(t));function B(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function L(e,t,n){const r=e.state.doc.content.size,o=B(t,0,r),i=B(n,0,r),s=e.coordsAtPos(o),a=e.coordsAtPos(i,-1),l=Math.min(s.top,a.top),c=Math.max(s.bottom,a.bottom),u=Math.min(s.left,a.left),d=Math.max(s.right,a.right),h={top:l,bottom:c,left:u,right:d,width:d-u,height:c-l,x:u,y:l};return P(R({},h),{toJSON:()=>h})}const z=e=>Object.assign(Object.create(e),e).setTime(Date.now()),$=e=>(t,n)=>((e,t=!0)=>{const n=[];return e.descendants(((e,r)=>{if(n.push({node:e,pos:r}),!t)return!1})),n})(t,n).filter((t=>e(t.node))),j=e=>t=>(e=>t=>{for(let n=t.depth;n>0;n--){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}})(e)(t.$from),_=(e,t)=>{if(!(e instanceof r.nh))return;const{node:n,$from:o}=e;return((e,t)=>Array.isArray(e)&&e.includes(t.type)||t.type===e)(t,n)?{node:n,pos:o.pos,start:o.start(o.depth),depth:o.depth}:void 0}},4586:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(1369);function o(e,t,n){return(t=(0,r.A)(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},4635:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(2016);function o(e,t){(0,r.A)(e,t),t.add(e)}},5186:(e,t,n)=>{"use strict";n.d(t,{C:()=>r});const r=function(e){if(null==e)return i;if("string"==typeof e)return t=e,o((function(e){return e&&e.type===t}));var t;if("object"==typeof e)return Array.isArray(e)?function(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=r(e[n]);return o((function(...e){let n=-1;for(;++n<t.length;)if(t[n].call(this,...e))return!0;return!1}))}(e):function(e){return o((function(t){let n;for(n in e)if(t[n]!==e[n])return!1;return!0}))}(e);if("function"==typeof e)return o(e);throw new Error("Expected function, string, or object as test")};function o(e){return function(t,...n){return Boolean(t&&"object"==typeof t&&"type"in t&&Boolean(e.call(this,t,...n)))}}function i(){return!0}},5435:(e,t,n)=>{"use strict";n.d(t,{pZ:()=>a});var r=n(1570),o=n(6512);const i=(0,o.Qx)({type:"space",size:2},"indentConfig");i.meta={package:"@milkdown/plugin-indent",displayName:"Ctx<indentConfig>"};const s=(0,o.Ht)((e=>({Tab:(t,n)=>{const o=e.get(i.key),{tr:s}=t,a=((e,t)=>{const{doc:n,selection:o}=e;if(!n||!o||!(o instanceof r.U3||o instanceof r.i5))return e;const{to:i}=o,s="space"===t.type?Array(t.size).fill(" ").join(""):"\t";return e.insertText(s,i)})(s,o);return!!a.docChanged&&(null==n||n(a),!0)}})));s.meta={package:"@milkdown/plugin-indent",displayName:"Shortcut<indent>"};const a=[i,s]},5460:(e,t,n)=>{"use strict";n.d(t,{B:()=>i});var r=n(7508),o=n(7884);const i={tokenize:function(e,t,n){return function(t){return(0,o.On)(t)?(0,r.N)(e,i,"linePrefix")(t):i(t)};function i(e){return null===e||(0,o.HP)(e)?t(e):n(e)}},partial:!0}},5536:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(2559);function o(e,t,n){return n((0,r.A)(e,t))}},5715:(e,t,n)=>{"use strict";n.d(t,{Im:()=>g,RV:()=>S,wh:()=>v,y_:()=>y});var r=n(1329),o=n(6090),i=n(1570);const s=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function a(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}function l(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function c(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}function u(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var d;function h(e,t,n){let s,l,c=t.nodeBefore,u=t.nodeAfter;if(c.type.spec.isolating||u.type.spec.isolating)return!1;if(function(e,t,n){let o=t.nodeBefore,i=t.nodeAfter,s=t.index();return!(!(o&&i&&o.type.compatibleContent(i.type))||(!o.content.size&&t.parent.canReplace(s-1,s)?(n&&n(e.tr.delete(t.pos-o.nodeSize,t.pos).scrollIntoView()),0):!t.parent.canReplace(s,s+1)||!i.isTextblock&&!(0,r.n9)(e.doc,t.pos)||(n&&n(e.tr.clearIncompatible(t.pos,o.type,o.contentMatchAt(o.childCount)).join(t.pos).scrollIntoView()),0)))}(e,t,n))return!0;let d=t.parent.canReplace(t.index(),t.index()+1);if(d&&(s=(l=c.contentMatchAt(c.childCount)).findWrapping(u.type))&&l.matchType(s[0]||u.type).validEnd){if(n){let i=t.pos+u.nodeSize,a=o.FK.empty;for(let e=s.length-1;e>=0;e--)a=o.FK.from(s[e].create(null,a));a=o.FK.from(c.copy(a));let l=e.tr.step(new r.Wg(t.pos-1,i,t.pos,i,new o.Ji(a,1,0),s.length,!0)),d=i+2*s.length;(0,r.n9)(l.doc,d)&&l.join(d),n(l.scrollIntoView())}return!0}let h=i.LN.findFrom(t,1),p=h&&h.$from.blockRange(h.$to),f=p&&(0,r.jP)(p);if(null!=f&&f>=t.depth)return n&&n(e.tr.lift(p,f).scrollIntoView()),!0;if(d&&a(u,"start",!0)&&a(c,"end")){let i=c,s=[];for(;s.push(i),!i.isTextblock;)i=i.lastChild;let a=u,l=1;for(;!a.isTextblock;a=a.firstChild)l++;if(i.canReplace(i.childCount,i.childCount,a.content)){if(n){let i=o.FK.empty;for(let e=s.length-1;e>=0;e--)i=o.FK.from(s[e].copy(i));n(e.tr.step(new r.Wg(t.pos-s.length,t.pos+u.nodeSize,t.pos+l,t.pos+u.nodeSize-l,new o.Ji(i,s.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function p(e){return function(t,n){let r=t.selection,o=e<0?r.$from:r.$to,s=o.depth;for(;o.node(s).isInline;){if(!s)return!1;s--}return!!o.node(s).isTextblock&&(n&&n(t.tr.setSelection(i.U3.create(t.doc,e<0?o.start(s):o.end(s)))),!0)}}const f=p(-1),m=p(1);function g(e,t=null){return function(n,o){let{$from:i,$to:s}=n.selection,a=i.blockRange(s),l=a&&(0,r.oM)(a,e,t);return!!l&&(o&&o(n.tr.wrap(a,l).scrollIntoView()),!0)}}function y(e,t=null){return function(n,r){let o=!1;for(let r=0;r<n.selection.ranges.length&&!o;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];n.doc.nodesBetween(i,s,((r,i)=>{if(o)return!1;if(r.isTextblock&&!r.hasMarkup(e,t))if(r.type==e)o=!0;else{let t=n.doc.resolve(i),r=t.index();o=t.parent.canReplaceWith(r,r+1,e)}}))}if(!o)return!1;if(r){let o=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];o.setBlockType(i,s,e,t)}r(o.scrollIntoView())}return!0}}function v(e,t=null){return function(n,r){let{empty:o,$cursor:i,ranges:s}=n.selection;if(o&&!i||!function(e,t,n){for(let r=0;r<t.length;r++){let{$from:o,$to:i}=t[r],s=0==o.depth&&e.inlineContent&&e.type.allowsMarkType(n);if(e.nodesBetween(o.pos,i.pos,(e=>{if(s)return!1;s=e.inlineContent&&e.type.allowsMarkType(n)})),s)return!0}return!1}(n.doc,s,e))return!1;if(r)if(i)e.isInSet(n.storedMarks||i.marks())?r(n.tr.removeStoredMark(e)):r(n.tr.addStoredMark(e.create(t)));else{let o=!1,i=n.tr;for(let t=0;!o&&t<s.length;t++){let{$from:r,$to:i}=s[t];o=n.doc.rangeHasMark(r.pos,i.pos,e)}for(let n=0;n<s.length;n++){let{$from:r,$to:a}=s[n];if(o)i.removeMark(r.pos,a.pos,e);else{let n=r.pos,o=a.pos,s=r.nodeAfter,l=a.nodeBefore,c=s&&s.isText?/^\s*/.exec(s.text)[0].length:0,u=l&&l.isText?/\s*$/.exec(l.text)[0].length:0;n+c<o&&(n+=c,o-=u),i.addMark(n,o,e.create(t))}}r(i.scrollIntoView())}return!0}}function w(...e){return function(t,n,r){for(let o=0;o<e.length;o++)if(e[o](t,n,r))return!0;return!1}}let k=w(s,((e,t,n)=>{let s=function(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}(e,n);if(!s)return!1;let c=l(s);if(!c){let n=s.blockRange(),o=n&&(0,r.jP)(n);return null!=o&&(t&&t(e.tr.lift(n,o).scrollIntoView()),!0)}let u=c.nodeBefore;if(!u.type.spec.isolating&&h(e,c,t))return!0;if(0==s.parent.content.size&&(a(u,"end")||i.nh.isSelectable(u))){let n=(0,r.$L)(e.doc,s.before(),s.after(),o.Ji.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(a(u,"end")?i.LN.findFrom(r.doc.resolve(r.mapping.map(c.pos,-1)),-1):i.nh.create(r.doc,c.pos-u.nodeSize)),t(r.scrollIntoView())}return!0}}return!(!u.isAtom||c.depth!=s.depth-1||(t&&t(e.tr.delete(c.pos-u.nodeSize,c.pos).scrollIntoView()),0))}),((e,t,n)=>{let{$head:r,empty:o}=e.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;s=l(r)}let a=s&&s.nodeBefore;return!(!a||!i.nh.isSelectable(a)||(t&&t(e.tr.setSelection(i.nh.create(e.doc,s.pos-a.nodeSize)).scrollIntoView()),0))})),b=w(s,((e,t,n)=>{let s=function(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}(e,n);if(!s)return!1;let l=c(s);if(!l)return!1;let u=l.nodeAfter;if(h(e,l,t))return!0;if(0==s.parent.content.size&&(a(u,"start")||i.nh.isSelectable(u))){let n=(0,r.$L)(e.doc,s.before(),s.after(),o.Ji.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(a(u,"start")?i.LN.findFrom(r.doc.resolve(r.mapping.map(l.pos)),1):i.nh.create(r.doc,r.mapping.map(l.pos))),t(r.scrollIntoView())}return!0}}return!(!u.isAtom||l.depth!=s.depth-1||(t&&t(e.tr.delete(l.pos,l.pos+u.nodeSize).scrollIntoView()),0))}),((e,t,n)=>{let{$head:r,empty:o}=e.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;s=c(r)}let a=s&&s.nodeAfter;return!(!a||!i.nh.isSelectable(a)||(t&&t(e.tr.setSelection(i.nh.create(e.doc,s.pos)).scrollIntoView()),0))}));const x={Enter:w(((e,t)=>{let{$head:n,$anchor:r}=e.selection;return!(!n.parent.type.spec.code||!n.sameParent(r)||(t&&t(e.tr.insertText("\n").scrollIntoView()),0))}),((e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof i.i5||r.parent.inlineContent||o.parent.inlineContent)return!1;let s=u(o.parent.contentMatchAt(o.indexAfter()));if(!s||!s.isTextblock)return!1;if(t){let n=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=e.tr.insert(n,s.createAndFill());a.setSelection(i.U3.create(a.doc,n+1)),t(a.scrollIntoView())}return!0}),((e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if((0,r.zy)(e.doc,o))return t&&t(e.tr.split(o).scrollIntoView()),!0}let o=n.blockRange(),i=o&&(0,r.jP)(o);return null!=i&&(t&&t(e.tr.lift(o,i).scrollIntoView()),!0)}),((e,t)=>{let{$from:n,$to:o}=e.selection;if(e.selection instanceof i.nh&&e.selection.node.isBlock)return!(!n.parentOffset||!(0,r.zy)(e.doc,n.pos)||(t&&t(e.tr.split(n.pos).scrollIntoView()),0));if(!n.parent.isBlock)return!1;if(t){let s=o.parentOffset==o.parent.content.size,a=e.tr;(e.selection instanceof i.U3||e.selection instanceof i.i5)&&a.deleteSelection();let l=0==n.depth?null:u(n.node(-1).contentMatchAt(n.indexAfter(-1))),c=d?[d]:s&&l?[{type:l}]:void 0,h=(0,r.zy)(a.doc,a.mapping.map(n.pos),1,c);if(c||h||!(0,r.zy)(a.doc,a.mapping.map(n.pos),1,l?[{type:l}]:void 0)||(l&&(c=[{type:l}]),h=!0),h&&(a.split(a.mapping.map(n.pos),1,c),!s&&!n.parentOffset&&n.parent.type!=l)){let e=a.mapping.map(n.before()),t=a.doc.resolve(e);l&&n.node(-1).canReplaceWith(t.index(),t.index()+1,l)&&a.setNodeMarkup(a.mapping.map(n.before()),l)}t(a.scrollIntoView())}return!0})),"Mod-Enter":(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),s=n.indexAfter(-1),a=u(o.contentMatchAt(s));if(!a||!o.canReplaceWith(s,s,a))return!1;if(t){let r=n.after(),o=e.tr.replaceWith(r,r,a.createAndFill());o.setSelection(i.LN.near(o.doc.resolve(r),1)),t(o.scrollIntoView())}return!0},Backspace:k,"Mod-Backspace":k,"Shift-Backspace":k,Delete:b,"Mod-Delete":b,"Mod-a":(e,t)=>(t&&t(e.tr.setSelection(new i.i5(e.doc))),!0)},C={"Ctrl-h":x.Backspace,"Alt-Backspace":x["Mod-Backspace"],"Ctrl-d":x.Delete,"Ctrl-Alt-Backspace":x["Mod-Delete"],"Alt-Delete":x["Mod-Delete"],"Alt-d":x["Mod-Delete"],"Ctrl-a":f,"Ctrl-e":m};for(let e in x)C[e]=x[e];const S=("undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&"darwin"==os.platform())?C:x},5939:(e,t,n)=>{"use strict";n.d(t,{K:()=>g,w:()=>m});for(var r={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},o={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},i="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),s=("undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent),"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)),a="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),l=s||i&&+i[1]<57,c=0;c<10;c++)r[48+c]=r[96+c]=String(c);for(c=1;c<=24;c++)r[c+111]="F"+c;for(c=65;c<=90;c++)r[c]=String.fromCharCode(c+32),o[c]=String.fromCharCode(c);for(var u in r)o.hasOwnProperty(u)||(o[u]=r[u]);var d=n(1570);const h="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function p(e){let t,n,r,o,i=e.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(let e=0;e<i.length-1;e++){let s=i[e];if(/^(cmd|meta|m)$/i.test(s))o=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else{if(!/^mod$/i.test(s))throw new Error("Unrecognized modifier name: "+s);h?o=!0:n=!0}}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function f(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function m(e){return new d.k_({props:{handleKeyDown:g(e)}})}function g(e){let t=function(e){let t=Object.create(null);for(let n in e)t[p(n)]=e[n];return t}(e);return function(e,n){let i,s=function(e){var t=!(l&&(e.ctrlKey||e.altKey||e.metaKey)||a&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?o:r)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(n),c=t[f(s,n)];if(c&&c(e.state,e.dispatch,e))return!0;if(1==s.length&&" "!=s){if(n.shiftKey){let r=t[f(s,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.shiftKey||n.altKey||n.metaKey||s.charCodeAt(0)>127)&&(i=r[n.keyCode])&&i!=s){let r=t[f(i,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}},6090:(e,t,n)=>{"use strict";function r(e){this.content=e}n.d(t,{S4:()=>G,ZF:()=>ae,FK:()=>a,CU:()=>d,sX:()=>U,bP:()=>T,u$:()=>E,Z6:()=>J,vI:()=>h,Sj:()=>Y,Ji:()=>p}),r.prototype={constructor:r,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,t,n){var o=n&&n!=e?this.remove(n):this,i=o.find(e),s=o.content.slice();return-1==i?s.push(n||e,t):(s[i+1]=t,n&&(s[i]=n)),new r(s)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new r(n)},addToStart:function(e,t){return new r([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new r(n)},addBefore:function(e,t,n){var o=this.remove(t),i=o.content.slice(),s=o.find(e);return i.splice(-1==s?i.length:s,0,t,n),new r(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=r.from(e)).size?new r(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=r.from(e)).size?new r(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=r.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach((function(t,n){e[t]=n})),e},get size(){return this.content.length>>1}},r.from=function(e){if(e instanceof r)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new r(t)};const o=r;function i(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let o=e.child(r),s=t.child(r);if(o!=s){if(!o.sameMarkup(s))return n;if(o.isText&&o.text!=s.text){for(let e=0;o.text[e]==s.text[e];e++)n++;return n}if(o.content.size||s.content.size){let e=i(o.content,s.content,n+1);if(null!=e)return e}n+=o.nodeSize}else n+=o.nodeSize}}function s(e,t,n,r){for(let o=e.childCount,i=t.childCount;;){if(0==o||0==i)return o==i?null:{a:n,b:r};let a=e.child(--o),l=t.child(--i),c=a.nodeSize;if(a!=l){if(!a.sameMarkup(l))return{a:n,b:r};if(a.isText&&a.text!=l.text){let e=0,t=Math.min(a.text.length,l.text.length);for(;e<t&&a.text[a.text.length-e-1]==l.text[l.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(a.content.size||l.content.size){let e=s(a.content,l.content,n-1,r-1);if(e)return e}n-=c,r-=c}else n-=c,r-=c}}class a{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,o){for(let i=0,s=0;s<t;i++){let a=this.content[i],l=s+a.nodeSize;if(l>e&&!1!==n(a,r+s,o||null,i)&&a.content.size){let o=s+1;a.nodesBetween(Math.max(0,e-o),Math.min(a.content.size,t-o),n,r+o)}s=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let o="",i=!0;return this.nodesBetween(e,t,((s,a)=>{s.isText?(o+=s.text.slice(Math.max(e,a)-a,t-a),i=!n):s.isLeaf?(r?o+="function"==typeof r?r(s):r:s.type.spec.leafText&&(o+=s.type.spec.leafText(s)),i=!n):!i&&s.isBlock&&(o+=n,i=!0)}),0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,r=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),o=1);o<e.content.length;o++)r.push(e.content[o]);return new a(r,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let n=[],r=0;if(t>e)for(let o=0,i=0;i<t;o++){let s=this.content[o],a=i+s.nodeSize;a>e&&((i<e||a>t)&&(s=s.isText?s.cut(Math.max(0,e-i),Math.min(s.text.length,t-i)):s.cut(Math.max(0,e-i-1),Math.min(s.content.size,t-i-1))),n.push(s),r+=s.nodeSize),i=a}return new a(n,r)}cutByIndex(e,t){return e==t?a.empty:0==e&&t==this.content.length?this:new a(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let r=this.content.slice(),o=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new a(r,o)}addToStart(e){return new a([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new a(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let 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,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return i(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return s(this,e,t,n)}findIndex(e,t=-1){if(0==e)return c(0,e);if(e==this.size)return c(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=r+this.child(n).nodeSize;if(o>=e)return o==e||t>0?c(n+1,o):c(n,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map((e=>e.toJSON())):null}static fromJSON(e,t){if(!t)return a.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new a(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return a.empty;let t,n=0;for(let r=0;r<e.length;r++){let o=e[r];n+=o.nodeSize,r&&o.isText&&e[r-1].sameMarkup(o)?(t||(t=e.slice(0,r)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new a(t||e,n)}static from(e){if(!e)return a.empty;if(e instanceof a)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new a([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}a.empty=new a([],0);const l={index:0,offset:0};function c(e,t){return l.index=e,l.offset=t,l}function u(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!u(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!u(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}class d{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let o=e[r];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,r));else{if(o.type.excludes(this.type))return e;!n&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(o)}}return t||(t=e.slice()),n||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&&u(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 n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);return n.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return d.none;if(e instanceof d)return[e];let t=e.slice();return t.sort(((e,t)=>e.type.rank-t.type.rank)),t}}d.none=[];class h extends Error{}class p{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=m(this.content,e+this.openStart,t);return n&&new p(n,this.openStart,this.openEnd)}removeBetween(e,t){return new p(f(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 p.empty;let n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new p(a.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=e.lastChild;n&&!n.isLeaf&&(t||!n.type.spec.isolating);n=n.lastChild)r++;return new p(e,n,r)}}function f(e,t,n){let{index:r,offset:o}=e.findIndex(t),i=e.maybeChild(r),{index:s,offset:a}=e.findIndex(n);if(o==t||i.isText){if(a!=n&&!e.child(s).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return e.replaceChild(r,i.copy(f(i.content,t-o-1,n-o-1)))}function m(e,t,n,r){let{index:o,offset:i}=e.findIndex(t),s=e.maybeChild(o);if(i==t||s.isText)return r&&!r.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let a=m(s.content,t-i-1,n);return a&&e.replaceChild(o,s.copy(a))}function g(e,t,n){if(n.openStart>e.depth)throw new h("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new h("Inconsistent open depths");return y(e,t,n,0)}function y(e,t,n,r){let o=e.index(r),i=e.node(r);if(o==t.index(r)&&r<e.depth-n.openStart){let s=y(e,t,n,r+1);return i.copy(i.content.replaceChild(o,s))}if(n.content.size){if(n.openStart||n.openEnd||e.depth!=r||t.depth!=r){let{start:o,end:s}=function(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(a.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(n,e);return x(i,C(e,o,s,t,r))}{let r=e.parent,o=r.content;return x(r,o.cut(0,e.parentOffset).append(n.content).append(o.cut(t.parentOffset)))}}return x(i,S(e,t,r))}function v(e,t){if(!t.type.compatibleContent(e.type))throw new h("Cannot join "+t.type.name+" onto "+e.type.name)}function w(e,t,n){let r=e.node(n);return v(r,t.node(n)),r}function k(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function b(e,t,n,r){let o=(t||e).node(n),i=0,s=t?t.index(n):o.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(k(e.nodeAfter,r),i++));for(let e=i;e<s;e++)k(o.child(e),r);t&&t.depth==n&&t.textOffset&&k(t.nodeBefore,r)}function x(e,t){return e.type.checkContent(t),e.copy(t)}function C(e,t,n,r,o){let i=e.depth>o&&w(e,t,o+1),s=r.depth>o&&w(n,r,o+1),l=[];return b(null,e,o,l),i&&s&&t.index(o)==n.index(o)?(v(i,s),k(x(i,C(e,t,n,r,o+1)),l)):(i&&k(x(i,S(e,t,o+1)),l),b(t,n,o,l),s&&k(x(s,S(n,r,o+1)),l)),b(r,null,o,l),new a(l)}function S(e,t,n){let r=[];return b(null,e,n,r),e.depth>n&&k(x(w(e,t,n+1),S(e,t,n+1)),r),b(t,null,n,r),new a(r)}p.empty=new p(a.empty,0,0);class M{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?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[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].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 n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}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):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return d.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let o=n.marks;for(var i=0;i<o.length;i++)!1!==o[i].type.spec.inclusive||r&&o[i].isInSet(r.marks)||(o=o[i--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var o=0;o<n.length;o++)!1!==n[o].type.spec.inclusive||r&&n[o].isInSet(r.marks)||(n=n[o--].removeFromSet(n));return n}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 n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new E(this,e,n);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 n=[],r=0,o=t;for(let t=e;;){let{index:e,offset:i}=t.content.findIndex(o),s=o-i;if(n.push(t,e,r+i),!s)break;if(t=t.child(e),t.isText)break;o=s-1,r+=i+1}return new M(t,n,o)}static resolveCached(e,t){for(let n=0;n<N.length;n++){let r=N[n];if(r.pos==t&&r.doc==e)return r}let n=N[O]=M.resolve(e,t);return O=(O+1)%A,n}}let N=[],O=0,A=12;class E{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}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 D=Object.create(null);class T{constructor(e,t,n,r=d.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||a.empty}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,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&u(this.attrs,t||e.defaultAttrs||D)&&d.sameSet(this.marks,n||d.none)}copy(e=null){return e==this.content?this:new T(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new T(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return p.empty;let r=this.resolve(e),o=this.resolve(t),i=n?0:r.sharedDepth(t),s=r.start(i),a=r.node(i).content.cut(r.pos-s,o.pos-s);return new p(a,r.depth-i,o.depth-i)}replace(e,t,n){return g(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return M.resolveCached(this,e)}resolveNoCache(e){return M.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,(e=>(n.isInSet(e.marks)&&(r=!0),!r))),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),I(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,n=a.empty,r=0,o=n.childCount){let i=this.contentMatchAt(e).matchFragment(n,r,o),s=i&&i.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let e=r;e<o;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let o=this.contentMatchAt(e).matchType(n),i=o&&o.matchFragment(this.content,t);return!!i&&i.validEnd}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);let e=d.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!d.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((e=>e.type.name))}`);this.content.forEach((e=>e.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((e=>e.toJSON()))),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=a.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,r,n)}}T.prototype.text=void 0;class F extends T{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):I(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 F(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new F(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&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 I(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class R{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new P(e,t);if(null==n.next)return R.empty;let r=B(n);n.next&&n.err("Unexpected trailing text");let o=function(e){let t=Object.create(null);return function n(r){let o=[];r.forEach((t=>{e[t].forEach((({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<o.length;e++)o[e][0]==t&&(r=o[e][1]);V(e,n).forEach((e=>{r||o.push([t,r=[]]),-1==r.indexOf(e)&&r.push(e)}))}))}));let i=t[r.join(",")]=new R(r.indexOf(e.length-1)>-1);for(let e=0;e<o.length;e++){let r=o[e][1].sort(_);i.next.push({type:o[e][0],next:t[r.join(",")]||n(r)})}return i}(V(e,0))}(function(e){let t=[[]];return o(function e(t,i){if("choice"==t.type)return t.exprs.reduce(((t,n)=>t.concat(e(n,i))),[]);if("seq"!=t.type){if("star"==t.type){let s=n();return r(i,s),o(e(t.expr,s),s),[r(s)]}if("plus"==t.type){let s=n();return o(e(t.expr,i),s),o(e(t.expr,s),s),[r(s)]}if("opt"==t.type)return[r(i)].concat(e(t.expr,i));if("range"==t.type){let s=i;for(let r=0;r<t.min;r++){let r=n();o(e(t.expr,s),r),s=r}if(-1==t.max)o(e(t.expr,s),s);else for(let i=t.min;i<t.max;i++){let i=n();r(s,i),o(e(t.expr,s),i),s=i}return[r(s)]}if("name"==t.type)return[r(i,void 0,t.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let s=e(t.exprs[r],i);if(r==t.exprs.length-1)return s;o(s,i=n())}}(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let o={term:r,to:n};return t[e].push(o),o}function o(e,t){e.forEach((e=>e.to=t))}}(r));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],o=!e.validEnd,i=[];for(let t=0;t<e.next.length;t++){let{type:n,next:s}=e.next[t];i.push(n.name),!o||n.isText||n.hasRequiredAttrs()||(o=!1),-1==r.indexOf(s)&&r.push(s)}o&&t.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,n),o}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,n=e.childCount){let r=this;for(let o=t;r&&o<n;o++)r=r.matchType(e.child(o).type);return r}get inlineContent(){return 0!=this.next.length&&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 n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];return function o(i,s){let l=i.matchFragment(e,n);if(l&&(!t||l.validEnd))return a.from(s.map((e=>e.createAndFill())));for(let e=0;e<i.next.length;e++){let{type:t,next:n}=i.next[e];if(!t.isText&&!t.hasRequiredAttrs()&&-1==r.indexOf(n)){r.push(n);let e=o(n,s.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),o=r.match;if(o.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<o.next.length;e++){let{type:i,next:s}=o.next[e];i.isLeaf||i.hasRequiredAttrs()||i.name in t||r.type&&!s.validEnd||(n.push({match:i.contentMatch,type:i,via:r}),t[i.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=[];return function t(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map(((t,n)=>{let r=n+(t.validEnd?"*":" ")+" ";for(let n=0;n<t.next.length;n++)r+=(n?", ":"")+t.next[n].type.name+"->"+e.indexOf(t.next[n].next);return r})).join("\n")}}R.empty=new R(!0);class P{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 B(e){let t=[];do{t.push(L(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function L(e){let t=[];do{t.push(z(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function z(e){let t=function(e){if(e.eat("(")){let t=B(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){let t=function(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let o=[];for(let e in n){let r=n[e];r.groups.indexOf(t)>-1&&o.push(r)}return 0==o.length&&e.err("No node type or group '"+t+"' found"),o}(e,e.next).map((t=>(null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t})));return e.pos++,1==t.length?t[0]:{type:"choice",exprs:t}}e.err("Unexpected token '"+e.next+"'")}(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=j(e,t)}return t}function $(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function j(e,t){let n=$(e),r=n;return e.eat(",")&&(r="}"!=e.next?$(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function _(e,t){return t-e}function V(e,t){let n=[];return function t(r){let o=e[r];if(1==o.length&&!o[0].term)return t(o[0].to);n.push(r);for(let e=0;e<o.length;e++){let{term:r,to:i}=o[e];r||-1!=n.indexOf(i)||t(i)}}(t),n.sort(_)}function W(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function H(e,t){let n=Object.create(null);for(let r in e){let o=t&&t[r];if(void 0===o){let t=e[r];if(!t.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=t.default}n[r]=o}return n}function K(e){let t=Object.create(null);if(e)for(let n in e)t[n]=new q(e[n]);return t}class J{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=K(n.attrs),this.defaultAttrs=W(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==R.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}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:H(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new T(this,this.computeAttrs(e),a.from(t),d.setFrom(n))}createChecked(e=null,t,n){return t=a.from(t),this.checkContent(t),new T(this,this.computeAttrs(e),t,d.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=a.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),o=r&&r.fillBefore(a.empty,!0);return o?new T(this,e,t.append(o),d.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).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)}`)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(null==this.markSet)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:d.none:e}static compile(e,t){let n=Object.create(null);e.forEach(((e,r)=>n[e]=new J(e,t,r)));let r=t.spec.topNode||"doc";if(!n[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let e in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}}class q{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class U{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=K(r.attrs),this.excluded=null;let o=W(this.attrs);this.instance=o?new d(this,o):null}create(e=null){return!e&&this.instance?this.instance:new d(this,H(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach(((e,o)=>n[e]=new U(e,r++,t,o))),n}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]}excludes(e){return this.excluded.indexOf(e)>-1}}class Y{constructor(e){this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=o.from(e.nodes),t.marks=o.from(e.marks||{}),this.nodes=J.compile(this.spec.nodes,this),this.marks=U.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw new RangeError(e+" can not be both a node and a mark");let t=this.nodes[e],r=t.spec.content||"",o=t.spec.marks;t.contentMatch=n[r]||(n[r]=R.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.markSet="_"==o?null:o?Z(this,o.split(" ")):""!=o&&t.inlineContent?null:[]}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=null==n?[t]:""==n?[]:Z(this,n.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,n,r){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof J))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new F(n,n.defaultAttrs,e,d.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return T.fromJSON(this,e)}markFromJSON(e){return d.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Z(e,t){let n=[];for(let r=0;r<t.length;r++){let o=t[r],i=e.marks[o],s=i;if(i)n.push(i);else for(let t in e.marks){let r=e.marks[t];("_"==o||r.spec.group&&r.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=r)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class G{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[],t.forEach((e=>{e.tag?this.tags.push(e):e.style&&this.styles.push(e)})),this.normalizeLists=!this.tags.some((t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)}))}parse(e,t={}){let n=new re(this,t,!1);return n.addAll(e,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new re(this,t,!0);return n.addAll(e,t.from,t.to),p.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(oe(e,n.tag)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){let r=this.styles[o],i=r.style;if(!(0!=i.indexOf(e)||r.context&&!n.matchesContext(r.context)||i.length>e.length&&(61!=i.charCodeAt(e.length)||i.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((null==e.priority?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach((e=>{n(e=ie(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)}))}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach((e=>{n(e=ie(e)),e.node||e.ignore||e.mark||(e.node=t)}))}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new G(e,G.schemaRules(e)))}}const Q={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},X={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ee={ol:!0,ul:!0};function te(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}class ne{constructor(e,t,n,r,o,i,s){this.type=e,this.attrs=t,this.marks=n,this.pendingMarks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=d.none,this.stashMarks=[],this.match=i||(4&s?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(a.from(e));if(!t){let t,n=this.type.contentMatch;return(t=n.findWrapping(e.type))?(this.match=n,t):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e,t=this.content[this.content.length-1];if(t&&t.isText&&(e=/[ \t\r\n\u000c]+$/.exec(t.text))){let n=t;t.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length))}}let t=a.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(a.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}popFromStashMark(e){for(let t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}applyPending(e){for(let t=0,n=this.pendingMarks;t<n.length;t++){let r=n[t];(this.type?this.type.allowsMarkType(r.type):se(r.type,e))&&!r.isInSet(this.activeMarks)&&(this.activeMarks=r.addToSet(this.activeMarks),this.pendingMarks=r.removeFromSet(this.pendingMarks))}}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Q.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class re{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0;let r,o=t.topNode,i=te(null,t.preserveWhitespace,0)|(n?4:0);r=o?new ne(o.type,o.attrs,d.none,d.none,!0,t.topMatch||o.type.contentMatch,i):new ne(n?null:e.schema.topNodeType,null,d.none,d.none,!0,null,i),this.nodes=[r],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){if(3==e.nodeType)this.addTextNode(e);else if(1==e.nodeType){let t=e.getAttribute("style");if(t){let n=this.readStyles(function(e){let t,n=/\s*([\w-]+)\s*:\s*([^;]+)/g,r=[];for(;t=n.exec(e);)r.push(t[1],t[2].trim());return r}(t));if(!n)return;let[r,o]=n,i=this.top;for(let e=0;e<o.length;e++)this.removePendingMark(o[e],i);for(let e=0;e<r.length;e++)this.addPendingMark(r[e]);this.addElement(e);for(let e=0;e<r.length;e++)this.removePendingMark(r[e],i);for(let e=0;e<o.length;e++)this.addPendingMark(o[e])}else this.addElement(e)}}addTextNode(e){let t=e.nodeValue,n=this.top;if(2&n.options||n.inlineContext(e)||/[^ \t\r\n\u000c]/.test(t)){if(1&n.options)t=2&n.options?t.replace(/\r\n?/g,"\n"):t.replace(/\r?\n|\r/g," ");else if(t=t.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(t)&&this.open==this.nodes.length-1){let r=n.content[n.content.length-1],o=e.previousSibling;(!r||o&&"BR"==o.nodeName||r.isText&&/[ \t\r\n\u000c]$/.test(r.text))&&(t=t.slice(1))}t&&this.insertNode(this.parser.schema.text(t)),this.findInText(e)}else this.findInside(e)}addElement(e,t){let n,r=e.nodeName.toLowerCase();ee.hasOwnProperty(r)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&ee.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let o=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(n=this.parser.matchTag(e,this,t));if(o?o.ignore:X.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!o||o.skip||o.closeParent){o&&o.closeParent?this.open=Math.max(0,this.open-1):o&&o.skip.nodeType&&(e=o.skip);let t,n=this.top,i=this.needsBlock;if(Q.hasOwnProperty(r))n.content.length&&n.content[0].isInline&&this.open&&(this.open--,n=this.top),t=!0,n.type||(this.needsBlock=!0);else if(!e.firstChild)return void this.leafFallback(e);this.addAll(e),t&&this.sync(n),this.needsBlock=i}else this.addElementByRule(e,o,!1===o.consuming?n:void 0)}leafFallback(e){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"))}ignoreFallback(e){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"))}readStyles(e){let t=d.none,n=d.none;for(let r=0;r<e.length;r+=2)for(let o;;){let i=this.parser.matchStyle(e[r],e[r+1],this,o);if(!i)break;if(i.ignore)return null;if(i.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach((e=>{i.clearMark(e)&&(n=e.addToSet(n))})):t=this.parser.schema.marks[i.mark].create(i.attrs).addToSet(t),!1!==i.consuming)break;o=i}return[t,n]}addElementByRule(e,t,n){let r,o,i;t.node?(o=this.parser.schema.nodes[t.node],o.isLeaf?this.insertNode(o.create(t.attrs))||this.leafFallback(e):r=this.enter(o,t.attrs||null,t.preserveWhitespace)):(i=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(i));let s=this.top;if(o&&o.isLeaf)this.findInside(e);else if(n)this.addElement(e,n);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach((e=>this.insertNode(e)));else{let n=e;"string"==typeof t.contentElement?n=e.querySelector(t.contentElement):"function"==typeof t.contentElement?n=t.contentElement(e):t.contentElement&&(n=t.contentElement),this.findAround(e,n,!0),this.addAll(n)}r&&this.sync(s)&&this.open--,i&&this.removePendingMark(i,s)}addAll(e,t,n){let r=t||0;for(let o=t?e.childNodes[t]:e.firstChild,i=null==n?null:e.childNodes[n];o!=i;o=o.nextSibling,++r)this.findAtPoint(e,r),this.addDOM(o);this.findAtPoint(e,r)}findPlace(e){let t,n;for(let r=this.open;r>=0;r--){let o=this.nodes[r],i=o.findWrapping(e);if(i&&(!t||t.length>i.length)&&(t=i,n=o,!i.length))break;if(o.solid)break}if(!t)return!1;this.sync(n);for(let e=0;e<t.length;e++)this.enterInner(t[e],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&this.enterInner(e)}if(this.findPlace(e)){this.closeExtra();let t=this.top;t.applyPending(e.type),t.match&&(t.match=t.match.matchType(e.type));let n=t.activeMarks;for(let r=0;r<e.marks.length;r++)t.type&&!t.type.allowsMarkType(e.marks[r].type)||(n=e.marks[r].addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n){let r=this.findPlace(e.create(t));return r&&this.enterInner(e,t,!0,n),r}enterInner(e,t=null,n=!1,r){this.closeExtra();let o=this.top;o.applyPending(e),o.match=o.match&&o.match.matchType(e);let i=te(e,r,o.options);4&o.options&&0==o.content.length&&(i|=4),this.nodes.push(new ne(e,t,o.activeMarks,o.pendingMarks,n,null,i)),this.open++}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;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].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("/"),n=this.options.context,r=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),o=-(n?n.depth+1:0)+(r?0:1),i=(e,s)=>{for(;e>=0;e--){let a=t[e];if(""==a){if(e==t.length-1||0==e)continue;for(;s>=o;s--)if(i(e-1,s))return!0;return!1}{let e=s>0||0==s&&r?this.nodes[s].type:n&&s>=o?n.node(s-o).type:null;if(!e||e.name!=a&&-1==e.groups.indexOf(a))return!1;s--}}return!0};return i(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}addPendingMark(e){let t=function(e,t){for(let n=0;n<t.length;n++)if(e.eq(t[n]))return t[n]}(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,t){for(let n=this.open;n>=0;n--){let r=this.nodes[n];if(r.pendingMarks.lastIndexOf(e)>-1)r.pendingMarks=e.removeFromSet(r.pendingMarks);else{r.activeMarks=e.removeFromSet(r.activeMarks);let t=r.popFromStashMark(e);t&&r.type&&r.type.allowsMarkType(t.type)&&(r.activeMarks=t.addToSet(r.activeMarks))}if(r==t)break}}}function oe(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function ie(e){let t={};for(let n in e)t[n]=e[n];return t}function se(e,t){let n=t.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(e))continue;let i=[],s=e=>{i.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:o}=e.edge(n);if(r==t)return!0;if(i.indexOf(o)<0&&s(o))return!0}};if(s(o.contentMatch))return!0}}class ae{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=ce(t).createDocumentFragment());let r=n,o=[];return e.forEach((e=>{if(o.length||e.marks.length){let n=0,i=0;for(;n<o.length&&i<e.marks.length;){let t=e.marks[i];if(this.marks[t.type.name]){if(!t.eq(o[n][0])||!1===t.type.spec.spanning)break;n++,i++}else i++}for(;n<o.length;)r=o.pop()[1];for(;i<e.marks.length;){let n=e.marks[i++],s=this.serializeMark(n,e.isInline,t);s&&(o.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(e,t))})),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=ae.renderSpec(ce(t),this.nodes[e.type.name](e));if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let o=this.serializeMark(e.marks[r],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&ae.renderSpec(ce(n),r(e,t))}static renderSpec(e,t,n=null){if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;let r,o=t[0],i=o.indexOf(" ");i>0&&(n=o.slice(0,i),o=o.slice(i+1));let s=n?e.createElementNS(n,o):e.createElement(o),a=t[1],l=1;if(a&&"object"==typeof a&&null==a.nodeType&&!Array.isArray(a)){l=2;for(let e in a)if(null!=a[e]){let t=e.indexOf(" ");t>0?s.setAttributeNS(e.slice(0,t),e.slice(t+1),a[e]):s.setAttribute(e,a[e])}}for(let o=l;o<t.length;o++){let i=t[o];if(0===i){if(o<t.length-1||o>l)throw new RangeError("Content hole must be the only child of its parent node");return{dom:s,contentDOM:s}}{let{dom:t,contentDOM:o}=ae.renderSpec(e,i,n);if(s.appendChild(t),o){if(r)throw new RangeError("Multiple content holes");r=o}}}return{dom:s,contentDOM:r}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ae(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=le(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return le(e.marks)}}function le(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function ce(e){return e.document||window.document}},6243:(e,t,n)=>{"use strict";function r(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}n.d(t,{B:()=>r})},6325:e=>{e.exports=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}},6486:(e,t,n)=>{"use strict";n.d(t,{Se:()=>u,wu:()=>l});var r=n(2113),o=n(1570),i=n(3686),s=n(6512),a=n(1440);const l=(0,s.Qx)({uploader:async(e,t)=>{const n=[];for(let t=0;t<e.length;t++){const r=e.item(t);!r||!r.type.includes("image")||n.push(r)}const{image:r}=t.nodes;if(!r)throw(0,a.pj)("image");return(await Promise.all(n.map((e=>(e=>new Promise((t=>{const n=new FileReader;n.addEventListener("load",(()=>{t({alt:e.name,src:n.result})}),!1),n.readAsDataURL(e)})))(e))))).map((({alt:e,src:t})=>r.createAndFill({src:t,alt:e})))},enableHtmlFileUploader:!1,uploadWidgetFactory:(e,t)=>{const n=document.createElement("span");return n.textContent="Upload in progress...",i.NZ.widget(e,n,t)}},"uploadConfig");l.meta={package:"@milkdown/plugin-upload",displayName:"Ctx<uploadConfig>"};const c=(0,s.Gf)((e=>{const t=new o.hs("MILKDOWN_UPLOAD"),n=(n,o,i)=>{var s;if(!i||i.length<=0)return!1;const a=Symbol("upload symbol"),c=e.get(r.pZ),{tr:u}=n.state,d=o instanceof DragEvent?(null==(s=n.posAtCoords({left:o.clientX,top:o.clientY}))?void 0:s.pos)??u.selection.from:u.selection.from;n.dispatch(u.setMeta(t,{add:{id:a,pos:d}}));const{uploader:h}=e.get(l.key);return h(i,c).then((e=>{const r=((e,n)=>{var r;const o=t.getState(e);if(!o)return-1;const i=o.find(void 0,void 0,(e=>e.id===n));return i.length?(null==(r=i[0])?void 0:r.from)??-1:-1})(n.state,a);r<0||n.dispatch(n.state.tr.replaceWith(r,r,e).setMeta(t,{remove:{id:a}}))})).catch((e=>{console.error(e)})),!0};return new o.k_({key:t,state:{init:()=>i.zF.empty,apply(t,n){const r=n.map(t.mapping,t.doc),o=t.getMeta(this);if(!o)return r;if(o.add){const{uploadWidgetFactory:n}=e.get(l.key),i=n(o.add.pos,{id:o.add.id});return r.add(t.doc,[i])}if(o.remove){const e=r.find(void 0,void 0,(e=>e.id===o.remove.id));return r.remove(e)}return r}},props:{decorations(e){return this.getState(e)},handlePaste:(t,r)=>{var o,i;const{enableHtmlFileUploader:s}=e.get(l.key);return!(!(r instanceof ClipboardEvent)||!s&&(null==(o=r.clipboardData)?void 0:o.getData("text/html")))&&n(t,r,null==(i=r.clipboardData)?void 0:i.files)},handleDrop:(e,t)=>{var r;return t instanceof DragEvent&&n(e,t,null==(r=t.dataTransfer)?void 0:r.files)}}})}));c.meta={package:"@milkdown/plugin-upload",displayName:"Prose<upload>"};const u=[l,c]},6512:(e,t,n)=>{"use strict";n.d(t,{Fs:()=>M,Gf:()=>p,Ht:()=>m,JY:()=>x,KD:()=>C,Qx:()=>y,YR:()=>b,Yh:()=>v,b_:()=>d,dz:()=>h,hk:()=>w,lz:()=>f,m5:()=>g,pq:()=>k,yh:()=>S,yu:()=>u});var r=n(2113),o=n(7488),i=n(9742),s=n(1440),a=n(5939),l=n(6090),c=n(1570);(0,i.d_)("abcedfghicklmn",10);const u=(e,t)=>{const n=(0,r.qf)(e),o=i=>async()=>{o.key=n,await i.wait(r.x8);const s=t(i);return i.get(r.MD).create(n,s),o.run=t=>i.get(r.MD).call(e,t),()=>{i.get(r.MD).remove(n)}};return o},d=e=>{const t=n=>async()=>{await n.wait(r.x8);const o=e(n);return n.update(r.f4,(e=>[...e,o])),t.inputRule=o,()=>{n.update(r.f4,(e=>e.filter((e=>e!==o))))}};return t},h=(e,t)=>{let n;const o=i=>async()=>{const a=t(i);if(i.update(r.P_,(t=>[...t.filter((t=>t[0]!==e)),[e,a]])),o.id=e,o.schema=a,await i.wait(r.x8),n=i.get(r.pZ).nodes[e],!n)throw(0,s.pj)(e);return()=>{i.update(r.P_,(t=>t.filter((([t])=>t!==e))))}};return o.type=()=>n,o},p=e=>{let t;const n=n=>async()=>(await n.wait(r.x8),t=e(n),n.update(r.TP,(e=>[...e,t])),()=>{n.update(r.TP,(e=>e.filter((e=>e!==t))))});return n.plugin=()=>t,n.key=()=>t.spec.key,n},f=e=>{const t=n=>async()=>{await n.wait(r.ge);const o=e(n);return n.update(r.eM,(e=>[...e,o])),t.plugin=o,()=>{n.update(r.eM,(e=>e.filter((e=>e!==o))))}};return t},m=e=>{const t=n=>async()=>{await n.wait(r.x8);const o=e(n),i=(0,a.w)(o);return n.update(r.TP,(e=>[...e,i])),t.keymap=o,()=>{n.update(r.TP,(e=>e.filter((e=>e!==i))))}};return t},g=(e,t)=>{const n=o=>async()=>{await o.wait(r.x8);const i=t(o);return e.type()instanceof l.Z6?o.update(r.pe,(t=>[...t,[e.id,i]])):o.update(r.aD,(t=>[...t,[e.id,i]])),n.view=i,n.type=e,()=>{e.type()instanceof l.Z6?o.update(r.pe,(t=>t.filter((t=>t[0]!==e.id)))):o.update(r.aD,(t=>t.filter((t=>t[0]!==e.id))))}};return n},y=(e,t)=>{const n=(0,o.Z0)(e,t),r=e=>(e.inject(n),()=>()=>{e.remove(n)});return r.key=n,r},v=(e,t)=>{const n=y(t,e),o=h(e,(e=>e.get(n.key)(e))),i=[n,o];return i.id=o.id,i.node=o,i.type=o.type,i.schema=o.schema,i.ctx=n,i.key=n.key,i.extendSchema=t=>o=>()=>{const s=o.get(n.key),a=t(s)(o);o.update(r.P_,(t=>[...t.filter((t=>t[0]!==e)),[e,a]])),i.schema=a},i},w=(e,t)=>{const n=y(t,e),o=((e,t)=>{let n;const o=i=>async()=>{const a=t(i);if(i.update(r.u7,(t=>[...t.filter((t=>t[0]!==e)),[e,a]])),o.id=e,o.schema=a,await i.wait(r.x8),n=i.get(r.pZ).marks[e],!n)throw(0,s.sm)(e);return()=>{i.update(r.u7,(t=>t.filter((([t])=>t!==e))))}};return o.type=()=>n,o})(e,(e=>e.get(n.key)(e))),i=[n,o];return i.id=o.id,i.mark=o,i.type=o.type,i.schema=o.schema,i.ctx=n,i.key=n.key,i.extendSchema=t=>o=>()=>{const s=o.get(n.key),a=t(s)(o);o.update(r.u7,(t=>[...t.filter((t=>t[0]!==e)),[e,a]])),i.schema=a},i},k=(e,t)=>{const n=Object.fromEntries(Object.entries(t).map((([e,{shortcuts:t}])=>[e,t]))),r=y(n,`${e}Keymap`),o=m((e=>{const n=e.get(r.key),o=Object.entries(t).flatMap((([t,{command:r}])=>[n[t]].flat().map((t=>[t,r(e)]))));return Object.fromEntries(o)})),i=[r,o];return i.ctx=r,i.shortcuts=o,i.key=r.key,i.keymap=o.keymap,i},b=(e,t=()=>({}))=>y(t,`${e}Attr`),x=(e,t=()=>({}))=>y(t,`${e}Attr`);function C(e,t){return n=>n.get(r.MD).call(e,t)}const S=(e,t=!1)=>n=>{const o=n.get(r.kY),i=n.get(r.bQ)(e);if(!i)return;if(!t){const{state:e}=o;return o.dispatch(e.tr.replace(0,e.doc.content.size,new l.Ji(i.content,0,0)))}const s=n.get(r.pZ),a=n.get(r.Sr),u=n.get(r.TP),d=c.$t.create({schema:s,doc:i,plugins:u,...a});o.updateState(d)},M=(...e)=>{const t=e.length;let n=t;for(;n--;)if("function"!=typeof e[n])throw new TypeError("Expected a function");return(...n)=>{let r=0,o=t?e[r](...n):n[0];for(;++r<t;)o=e[r](o);return o}}},6641:(e,t,n)=>{"use strict";n.d(t,{dc:()=>o,_Z:()=>i,VG:()=>s});var r=n(5186);const o=!1,i="skip",s=function(e,t,n,s){"function"==typeof t&&"function"!=typeof n&&(s=n,n=t,t=null);const a=(0,r.C)(t),l=s?-1:1;!function e(r,c,u){const d=r&&"object"==typeof r?r:{};if("string"==typeof d.type){const e="string"==typeof d.tagName?d.tagName:"string"==typeof d.name?d.name:void 0;Object.defineProperty(h,"name",{value:"node ("+r.type+(e?"<"+e+">":"")+")"})}return h;function h(){let d,h,p,f=[];if((!t||a(r,c,u[u.length-1]||null))&&(f=function(e){return Array.isArray(e)?e:"number"==typeof e?[true,e]:[e]}(n(r,u)),f[0]===o))return f;if(r.children&&f[0]!==i)for(h=(s?r.children.length:-1)+l,p=u.concat(r);h>-1&&h<r.children.length;){if(d=e(r.children[h],h,p)(),d[0]===o)return d;h="number"==typeof d[1]?d[1]:h+l}return f}}(e,void 0,[])()}},6990:(e,t,n)=>{"use strict";n.d(t,{S:()=>o});var r=n(7884);function o(e){return null===e||(0,r.Ee)(e)||(0,r.Ny)(e)?1:(0,r.es)(e)?2:void 0}},7488:(e,t,n)=>{"use strict";n.d(t,{CR:()=>V,Kj:()=>F,Z0:()=>g,mc:()=>p,zD:()=>I});var r,o,i,s=n(1440),a=Object.defineProperty,l=(e,t,n)=>(((e,t,n)=>{t in e?a(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n),c=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},u=(e,t,n)=>(c(e,t,"read from private field"),n?n.call(e):t.get(e)),d=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},h=(e,t,n,r)=>(c(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class p{constructor(){l(this,"sliceMap",new Map),l(this,"get",(e=>{const t="string"==typeof e?[...this.sliceMap.values()].find((t=>t.type.name===e)):this.sliceMap.get(e.id);if(!t){const t="string"==typeof e?e:e.name;throw(0,s.XM)(t)}return t})),l(this,"remove",(e=>{const t="string"==typeof e?[...this.sliceMap.values()].find((t=>t.type.name===e)):this.sliceMap.get(e.id);!t||this.sliceMap.delete(t.type.id)})),l(this,"has",(e=>"string"==typeof e?[...this.sliceMap.values()].some((t=>t.type.name===e)):this.sliceMap.has(e.id)))}}class f{constructor(e,t,n){l(this,"type"),d(this,r,[]),d(this,o,void 0),d(this,i,(()=>{u(this,r).forEach((e=>e(u(this,o))))})),l(this,"set",(e=>{h(this,o,e),u(this,i).call(this)})),l(this,"get",(()=>u(this,o))),l(this,"update",(e=>{h(this,o,e(u(this,o))),u(this,i).call(this)})),this.type=n,h(this,o,t),e.set(n.id,this)}on(e){return u(this,r).push(e),()=>{h(this,r,u(this,r).filter((t=>t!==e)))}}once(e){const t=this.on((n=>{e(n),t()}));return t}off(e){h(this,r,u(this,r).filter((t=>t!==e)))}offAll(){h(this,r,[])}}r=new WeakMap,o=new WeakMap,i=new WeakMap;class m{constructor(e,t){l(this,"id"),l(this,"name"),l(this,"_typeInfo"),l(this,"_defaultValue"),this.id=Symbol(`Context-${t}`),this.name=t,this._defaultValue=e,this._typeInfo=()=>{throw(0,s.dI)()}}create(e,t=this._defaultValue){return new f(e,t,this)}}const g=(e,t)=>new m(e,t);var y,v,w,k,b,x,C,S,M,N,O,A,E;class D{constructor(e,t,n){d(this,y,void 0),d(this,v,void 0),d(this,w,void 0),d(this,k,new Set),d(this,b,new Set),d(this,x,new Map),d(this,C,new Map),l(this,"read",(()=>({metadata:u(this,y),injectedSlices:[...u(this,k)].map((e=>({name:"string"==typeof e?e:e.name,value:u(this,S).call(this,e)}))),consumedSlices:[...u(this,b)].map((e=>({name:"string"==typeof e?e:e.name,value:u(this,S).call(this,e)}))),recordedTimers:[...u(this,x)].map((([e,{duration:t}])=>({name:e.name,duration:t,status:u(this,M).call(this,e)}))),waitTimers:[...u(this,C)].map((([e,{duration:t}])=>({name:e.name,duration:t,status:u(this,M).call(this,e)})))}))),l(this,"onRecord",(e=>{u(this,x).set(e,{start:Date.now(),duration:0})})),l(this,"onClear",(e=>{u(this,x).delete(e)})),l(this,"onDone",(e=>{const t=u(this,x).get(e);!t||(t.duration=Date.now()-t.start)})),l(this,"onWait",((e,t)=>{const n=Date.now();t.finally((()=>{u(this,C).set(e,{duration:Date.now()-n})}))})),l(this,"onInject",(e=>{u(this,k).add(e)})),l(this,"onRemove",(e=>{u(this,k).delete(e)})),l(this,"onUse",(e=>{u(this,b).add(e)})),d(this,S,(e=>u(this,v).get(e).get())),d(this,M,(e=>u(this,w).get(e).status)),h(this,v,e),h(this,w,t),h(this,y,n)}}y=new WeakMap,v=new WeakMap,w=new WeakMap,k=new WeakMap,b=new WeakMap,x=new WeakMap,C=new WeakMap,S=new WeakMap,M=new WeakMap;const T=class{constructor(e,t,n){d(this,N,void 0),d(this,O,void 0),d(this,A,void 0),d(this,E,void 0),l(this,"produce",(e=>e&&Object.keys(e).length?new T(u(this,N),u(this,O),{...e}):this)),l(this,"inject",((e,t)=>{var n;const r=e.create(u(this,N).sliceMap);return null!=t&&r.set(t),null==(n=u(this,E))||n.onInject(e),this})),l(this,"remove",(e=>{var t;return u(this,N).remove(e),null==(t=u(this,E))||t.onRemove(e),this})),l(this,"record",(e=>{var t;return e.create(u(this,O).store),null==(t=u(this,E))||t.onRecord(e),this})),l(this,"clearTimer",(e=>{var t;return u(this,O).remove(e),null==(t=u(this,E))||t.onClear(e),this})),l(this,"isInjected",(e=>u(this,N).has(e))),l(this,"isRecorded",(e=>u(this,O).has(e))),l(this,"use",(e=>{var t;return null==(t=u(this,E))||t.onUse(e),u(this,N).get(e)})),l(this,"get",(e=>this.use(e).get())),l(this,"set",((e,t)=>this.use(e).set(t))),l(this,"update",((e,t)=>this.use(e).update(t))),l(this,"timer",(e=>u(this,O).get(e))),l(this,"done",(e=>{var t;this.timer(e).done(),null==(t=u(this,E))||t.onDone(e)})),l(this,"wait",(e=>{var t;const n=this.timer(e).start();return null==(t=u(this,E))||t.onWait(e,n),n})),l(this,"waitTimers",(async e=>{await Promise.all(this.get(e).map((e=>this.wait(e))))})),h(this,N,e),h(this,O,t),h(this,A,n),n&&h(this,E,new D(e,t,n))}get meta(){return u(this,A)}get inspector(){return u(this,E)}};let F=T;N=new WeakMap,O=new WeakMap,A=new WeakMap,E=new WeakMap;class I{constructor(){l(this,"store",new Map),l(this,"get",(e=>{const t=this.store.get(e.id);if(!t)throw(0,s.nr)(e.name);return t})),l(this,"remove",(e=>{this.store.delete(e.id)})),l(this,"has",(e=>this.store.has(e.id)))}}var R,P,B,L,z,$;class j{constructor(e,t){l(this,"type"),d(this,R,null),d(this,P,null),d(this,B,void 0),d(this,L,"pending"),l(this,"start",(()=>(u(this,R)??h(this,R,new Promise(((e,t)=>{h(this,P,(t=>{t instanceof CustomEvent&&t.detail.id===u(this,B)&&(h(this,L,"resolved"),u(this,z).call(this),t.stopImmediatePropagation(),e())})),u(this,$).call(this,(()=>{"pending"===u(this,L)&&h(this,L,"rejected"),u(this,z).call(this),t(new Error(`Timing ${this.type.name} timeout.`))})),h(this,L,"pending"),addEventListener(this.type.name,u(this,P))}))),u(this,R)))),l(this,"done",(()=>{const e=new CustomEvent(this.type.name,{detail:{id:u(this,B)}});dispatchEvent(e)})),d(this,z,(()=>{u(this,P)&&removeEventListener(this.type.name,u(this,P))})),d(this,$,(e=>{setTimeout((()=>{e()}),this.type.timeout)})),h(this,B,Symbol(t.name)),this.type=t,e.set(t.id,this)}get status(){return u(this,L)}}R=new WeakMap,P=new WeakMap,B=new WeakMap,L=new WeakMap,z=new WeakMap,$=new WeakMap;class _{constructor(e,t=3e3){l(this,"id"),l(this,"name"),l(this,"timeout"),l(this,"create",(e=>new j(e,this))),this.id=Symbol(`Timer-${e}`),this.name=e,this.timeout=t}}const V=(e,t=3e3)=>new _(e,t)},7508:(e,t,n)=>{"use strict";n.d(t,{N:()=>o});var r=n(7884);function o(e,t,n,o){const i=o?o-1:Number.POSITIVE_INFINITY;let s=0;return function(o){return(0,r.On)(o)?(e.enter(n),a(o)):t(o)};function a(o){return(0,r.On)(o)&&s++<i?(e.consume(o),a):(e.exit(n),t(o))}}},7884:(e,t,n)=>{"use strict";n.d(t,{CW:()=>r,lV:()=>s,cx:()=>l,JQ:()=>c,BM:()=>o,ok:()=>i,ol:()=>a,HP:()=>d,Ee:()=>u,On:()=>h,es:()=>f,Ny:()=>p});const r=m(/[A-Za-z]/),o=m(/\d/),i=m(/[\dA-Fa-f]/),s=m(/[\dA-Za-z]/),a=m(/[!-/:-@[-`{-~]/),l=m(/[#-'*+\--9=?A-Z^-~]/);function c(e){return null!==e&&(e<32||127===e)}function u(e){return null!==e&&(e<0||32===e)}function d(e){return null!==e&&e<-2}function h(e){return-2===e||-1===e||32===e}const p=m(/\s/),f=m(/[!-/:-@[-`{-~\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/);function m(e){return function(t){return null!==t&&e.test(String.fromCharCode(t))}}},7938:(e,t,n)=>{"use strict";n.d(t,{s:()=>s});var r=n(1157),o=n(9896);const i=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function s(e){return e.replace(i,a)}function a(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){const e=n.charCodeAt(1),t=120===e||88===e;return(0,o.C)(n.slice(t?2:1),t?16:10)}return(0,r.s)(n)||e}},8653:(e,t,n)=>{"use strict";n.d(t,{F_:()=>h,Ob:()=>u});var r=n(7488),o=n(2113),i=n(1570),s=n(72),a=Object.defineProperty,l=(e,t,n)=>(((e,t,n)=>{t in e?a(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);class c{constructor(){l(this,"beforeMountedListeners",[]),l(this,"mountedListeners",[]),l(this,"updatedListeners",[]),l(this,"markdownUpdatedListeners",[]),l(this,"blurListeners",[]),l(this,"focusListeners",[]),l(this,"destroyListeners",[]),l(this,"beforeMount",(e=>(this.beforeMountedListeners.push(e),this))),l(this,"mounted",(e=>(this.mountedListeners.push(e),this))),l(this,"updated",(e=>(this.updatedListeners.push(e),this)))}get listeners(){return{beforeMount:this.beforeMountedListeners,mounted:this.mountedListeners,updated:this.updatedListeners,markdownUpdated:this.markdownUpdatedListeners,blur:this.blurListeners,focus:this.focusListeners,destroy:this.destroyListeners}}markdownUpdated(e){return this.markdownUpdatedListeners.push(e),this}blur(e){return this.blurListeners.push(e),this}focus(e){return this.focusListeners.push(e),this}destroy(e){return this.destroyListeners.push(e),this}}const u=(0,r.Z0)(new c,"listener"),d=new i.hs("MILKDOWN_LISTENER"),h=e=>(e.inject(u,new c),async()=>{await e.wait(o.ge);const t=e.get(u),{listeners:n}=t;n.beforeMount.forEach((t=>t(e))),await e.wait(o.g3);const r=e.get(o.M);let a=null,l=null;const c=new i.k_({key:d,view:()=>({destroy:()=>{n.destroy.forEach((t=>t(e)))}}),props:{handleDOMEvents:{focus:()=>(n.focus.forEach((t=>t(e))),!1),blur:()=>(n.blur.forEach((t=>t(e))),!1)}},state:{init:()=>{},apply:t=>t.docChanged&&!1!==t.getMeta("addToHistory")?s((()=>{const{doc:o}=t;if(n.updated.length>0&&(null==a||!a.eq(o))&&n.updated.forEach((t=>{t(e,o,a)})),n.markdownUpdated.length>0&&(null==a||!a.eq(o))){const t=r(o);n.markdownUpdated.forEach((n=>{n(e,t,l)})),l=t}a=o}),200)():void 0}});e.update(o.TP,(e=>e.concat(c))),await e.wait(o.CU),n.mounted.forEach((t=>t(e)))});h.meta={package:"@milkdown/plugin-listener",displayName:"Listener"}},9492:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(2559);function o(e,t,n,o){return t((0,r.A)(e,n),o),o}},9575:(e,t,n)=>{"use strict";function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},r.apply(this,arguments)}n.d(t,{A:()=>r})},9742:(e,t,n)=>{"use strict";n.d(t,{Ak:()=>i,d_:()=>o});let r=e=>crypto.getRandomValues(new Uint8Array(e)),o=(e,t=21)=>((e,t,n)=>{let r=(2<<Math.log(e.length-1)/Math.LN2)-1,o=-~(1.6*r*t/e.length);return(i=t)=>{let s="";for(;;){let t=n(o),a=o;for(;a--;)if(s+=e[t[a]&r]||"",s.length===i)return s}}})(e,t,r),i=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce(((e,t)=>e+((t&=63)<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t>62?"-":"_")),"")},9760:(e,t,n)=>{"use strict";n.d(t,{E:()=>s});var r=n(2113);function o(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=o(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}const i=function(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=o(e))&&(r&&(r+=" "),r+=t);return r},s=e=>{e.update(r.QM,(e=>{const t=e.attributes;return{...e,attributes:e=>{const n="function"==typeof t?t(e):t;return{...n,class:i("prose dark:prose-invert outline-none",(null==n?void 0:n.class)||"","milkdown-theme-nord")}}}}))}},9796:(e,t,n)=>{"use strict";n.d(t,{Wj:()=>h,mS:()=>u});var r=n(4254),o=n(1570),i=n(798),s=n(6512),a=n(3686);const l=(e,t=[])=>e.flatMap((e=>{var n;return"element"===e.type?l(e.children,[...t,...(null==(n=e.properties)?void 0:n.className)||[]]):[{text:e.value,className:t}]}));function c(e,t,n){const{highlight:o,listLanguages:i}=n,s=i(),c=[];return(0,r.xe)((e=>e.type.name===t))(e).forEach((e=>{let t=e.pos+1;const{language:n}=e.node.attrs;if(!n||!s.includes(n))return void console.warn("Unsupported language detected, this language has not been supported by current prism config: ",n);const r=o(e.node.textContent,n);l(r.children).forEach((e=>{const n=t+e.text.length;if(e.className.length){const r=a.NZ.inline(t,n,{class:e.className.join(" ")});c.push(r)}t=n}))})),a.zF.create(e,c)}const u=(0,s.Qx)({configureRefractor:()=>{}},"prismConfig");u.meta={package:"@milkdown/plugin-prism",displayName:"Ctx<prism>"};const d=(0,s.Gf)((e=>{const{configureRefractor:t}=e.get(u.key),n="code_block";return new o.k_({key:new o.hs("MILKDOWN_PRISM"),state:{init:(e,{doc:r})=>{const o=t(i.L);return c(r,n,o??i.L)},apply:(e,t,o,s)=>{var a,l;const u=s.selection.$head.parent.type.name===n,d=o.selection.$head.parent.type.name===n,h=(0,r.xe)((e=>e.type.name===n))(o.doc),p=(0,r.xe)((e=>e.type.name===n))(s.doc);return e.docChanged&&(u||d||h.length!==p.length||(null==(a=h[0])?void 0:a.node.attrs.language)!==(null==(l=p[0])?void 0:l.node.attrs.language)||e.steps.some((e=>{const t=e;return void 0!==t.from&&void 0!==t.to&&h.some((e=>e.pos>=t.from&&e.pos+e.node.nodeSize<=t.to))})))?c(e.doc,n,i.L):t.map(e.mapping,e.doc)}},props:{decorations(e){return this.getState(e)}}})}));d.meta={package:"@milkdown/plugin-prism",displayName:"Prose<prism>"};const h=[d,u]},9896:(e,t,n)=>{"use strict";function r(e,t){const n=Number.parseInt(e,t);return n<9||11===n||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||!(65535&~n)||65534==(65535&n)||n>1114111?"�":String.fromCharCode(n)}n.d(t,{C:()=>r})}}]);
|
|
3
|
+
//# sourceMappingURL=7768.0fc422f7.js.map
|