@thebase/ui 0.0.4 → 0.0.5
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/CHANGELOG.md +5 -0
- package/README.md +49 -8
- package/bin/create-baseui-app.mjs +268 -0
- package/dist/baseui.esm.js +1 -1
- package/dist/baseui.min.js +1 -1
- package/dist/baseui.registry.json +2 -2
- package/dist/runtime/block-N5MIBOMO.js +1 -0
- package/dist/runtime/chunk-23NN352E.js +1 -0
- package/dist/runtime/chunk-6X7NT7KH.js +2 -0
- package/dist/runtime/chunk-7R5G6FRT.js +1 -0
- package/dist/runtime/chunk-7R75J74M.js +1 -0
- package/dist/runtime/chunk-EAFZBBCI.js +10 -0
- package/dist/runtime/chunk-GF2LJCG5.js +1 -0
- package/dist/runtime/chunk-HKUJH2VC.js +1 -0
- package/dist/runtime/chunk-KX3KYRT7.js +1 -0
- package/dist/runtime/chunk-MAWHENWJ.js +1 -0
- package/dist/runtime/chunk-OESZ7FEN.js +1 -0
- package/dist/runtime/chunk-P3WV3MLS.js +35 -0
- package/dist/runtime/chunk-SGGMD6DA.js +5 -0
- package/dist/runtime/chunk-URTGZHMG.js +3 -0
- package/dist/runtime/chunk-XLIC2WFB.js +1 -0
- package/dist/runtime/clipboard-6EHVQ6GB.js +4 -0
- package/dist/runtime/commonmark-FAT3C7WA.js +1 -0
- package/dist/runtime/core-IEFFKRMW.js +1 -0
- package/dist/runtime/cursor-3BFXMKNC.js +1 -0
- package/dist/runtime/diff-ALMDXB3Z.js +1 -0
- package/dist/runtime/gfm-JUXF3E6O.js +5 -0
- package/dist/runtime/history-OU6CQBOY.js +1 -0
- package/dist/runtime/indent-RP5Y5HNK.js +1 -0
- package/dist/runtime/lib-TTIE4EGJ.js +1 -0
- package/dist/runtime/listener-JBODN3BE.js +1 -0
- package/dist/runtime/marked.min.js +69 -0
- package/dist/runtime/mermaid.esm.min.mjs +3593 -0
- package/dist/runtime/milkdown-editor.js +1 -0
- package/dist/runtime/prosemirror-text-editor.js +1 -0
- package/dist/runtime/slash-I56NP4SS.js +1 -0
- package/dist/runtime/streaming-WPAF6YN6.js +3 -0
- package/dist/runtime/tooltip-XDWVKIO5.js +1 -0
- package/dist/runtime/upload-MYBCHYBD.js +1 -0
- package/dist/runtime/y-webrtc-WDTQEBWZ.js +1 -0
- package/dist/runtime/yjs-SRZJJJEG.js +1 -0
- package/docs/blocks.md +4 -2
- package/docs/icons.md +4 -2
- package/docs/installation.md +36 -28
- package/docs/owl-components.md +7 -5
- package/docs/theming.md +2 -2
- package/docs/usage-guide.md +64 -60
- package/package.json +6 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{pa as tn,y as Se}from"./chunk-URTGZHMG.js";import"./chunk-7R5G6FRT.js";import{a as N,b as xe,c as Yt,e as de,h as q,i as Zt,j as Pe,l as Qt,m as en}from"./chunk-GF2LJCG5.js";import{A as ye,B as Ie,F as qt,H as _e,K as Ut,M as Xt,a as be,h as ke,i as Pt,j as J,k as te,l as Ce,la as pe,m as Ot,n as Y,o as v,p as K,q as fe,r as V,s as I,t as Ee,u as $t,v as Ht,w as Bt,y as jt}from"./chunk-P3WV3MLS.js";import{H as Gt,L as Jt,M as ne,N as oe,a as M,c as D,q as Wt,r as F,s as Kt,t as P,u as Vt,x as Z,y as G}from"./chunk-EAFZBBCI.js";import"./chunk-23NN352E.js";var $e,He;if(typeof WeakMap<"u"){let e=new WeakMap;$e=t=>e.get(t),He=(t,n)=>(e.set(t,n),n)}else{let e=[],n=0;$e=o=>{for(let r=0;r<e.length;r+=2)if(e[r]==o)return e[r+1]},He=(o,r)=>(n==10&&(n=0),e[n++]=o,e[n++]=r)}var x=class{constructor(e,t,n,o){this.width=e,this.height=t,this.map=n,this.problems=o}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let o=t%this.width,r=t/this.width|0,i=o+1,l=r+1;for(let s=1;i<this.width&&this.map[t+s]==n;s++)i++;for(let s=1;l<this.height&&this.map[t+this.width*s]==n;s++)l++;return{left:o,top:r,right:i,bottom:l}}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){let{left:o,right:r,top:i,bottom:l}=this.findCell(e);return t=="horiz"?(n<0?o==0:r==this.width)?null:this.map[i*this.width+(n<0?o-1:r)]:(n<0?i==0:l==this.height)?null:this.map[o+this.width*(n<0?i-1:l)]}rectBetween(e,t){let{left:n,right:o,top:r,bottom:i}=this.findCell(e),{left:l,right:s,top:a,bottom:c}=this.findCell(t);return{left:Math.min(n,l),top:Math.min(r,a),right:Math.max(o,s),bottom:Math.max(i,c)}}cellsInRect(e){let t=[],n={};for(let o=e.top;o<e.bottom;o++)for(let r=e.left;r<e.right;r++){let i=o*this.width+r,l=this.map[i];n[l]||(n[l]=!0,!(r==e.left&&r&&this.map[i-1]==l||o==e.top&&o&&this.map[i-this.width]==l)&&t.push(l))}return t}positionAt(e,t,n){for(let o=0,r=0;;o++){let i=r+n.child(o).nodeSize;if(o==e){let l=t+e*this.width,s=(e+1)*this.width;for(;l<s&&this.map[l]<r;)l++;return l==s?i-1:this.map[l]}r=i}}static get(e){return $e(e)||He(e,Mo(e))}};function Mo(e){if(e.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+e.type.name);let t=No(e),n=e.childCount,o=[],r=0,i=null,l=[];for(let c=0,f=t*n;c<f;c++)o[c]=0;for(let c=0,f=0;c<n;c++){let u=e.child(c);f++;for(let d=0;;d++){for(;r<o.length&&o[r]!=0;)r++;if(d==u.childCount)break;let w=u.child(d),{colspan:b,rowspan:g,colwidth:C}=w.attrs;for(let y=0;y<g;y++){if(y+c>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:f,n:g-y});break}let R=r+y*t;for(let S=0;S<b;S++){o[R+S]==0?o[R+S]=f:(i||(i=[])).push({type:"collision",row:c,pos:f,n:b-S});let T=C&&C[S];if(T){let _=(R+S)%t*2,W=l[_];W==null||W!=T&&l[_+1]==1?(l[_]=T,l[_+1]=1):W==T&&l[_+1]++}}}r+=b,f+=w.nodeSize}let p=(c+1)*t,h=0;for(;r<p;)o[r++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:c,n:h}),f++}(t===0||n===0)&&(i||(i=[])).push({type:"zero_sized"});let s=new x(t,n,o,i),a=!1;for(let c=0;!a&&c<l.length;c+=2)l[c]!=null&&l[c+1]<n&&(a=!0);return a&&Do(s,l,e),s}function No(e){let t=-1,n=!1;for(let o=0;o<e.childCount;o++){let r=e.child(o),i=0;if(n)for(let l=0;l<o;l++){let s=e.child(l);for(let a=0;a<s.childCount;a++){let c=s.child(a);l+c.attrs.rowspan>o&&(i+=c.attrs.colspan)}}for(let l=0;l<r.childCount;l++){let s=r.child(l);i+=s.attrs.colspan,s.attrs.rowspan>1&&(n=!0)}t==-1?t=i:t!=i&&(t=Math.max(t,i))}return t}function Do(e,t,n){e.problems||(e.problems=[]);let o={};for(let r=0;r<e.map.length;r++){let i=e.map[r];if(o[i])continue;o[i]=!0;let l=n.nodeAt(i);if(!l)throw new RangeError(`No cell with offset ${i} found`);let s=null,a=l.attrs;for(let c=0;c<a.colspan;c++){let f=t[(r+c)%e.width*2];f!=null&&(!a.colwidth||a.colwidth[c]!=f)&&((s||(s=Fo(a)))[c]=f)}s&&e.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:s})}}function Fo(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function nn(e,t){if(typeof e=="string")return{};let n=e.getAttribute("data-colwidth"),o=n&&/^\d+(,\d+)*$/.test(n)?n.split(",").map(l=>Number(l)):null,r=Number(e.getAttribute("colspan")||1),i={colspan:r,rowspan:Number(e.getAttribute("rowspan")||1),colwidth:o&&o.length==r?o:null};for(let l in t){let s=t[l].getFromDOM,a=s&&s(e);a!=null&&(i[l]=a)}return i}function on(e,t){let n={};e.attrs.colspan!=1&&(n.colspan=e.attrs.colspan),e.attrs.rowspan!=1&&(n.rowspan=e.attrs.rowspan),e.attrs.colwidth&&(n["data-colwidth"]=e.attrs.colwidth.join(","));for(let o in t){let r=t[o].setDOMAttr;r&&r(e.attrs[o],n)}return n}function zo(e){if(e!==null){if(!Array.isArray(e))throw new TypeError("colwidth must be null or an array");for(let t of e)if(typeof t!="number")throw new TypeError("colwidth must be null or an array of numbers")}}function gn(e){let t=e.cellAttributes||{},n={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:zo}};for(let o in t)n[o]={default:t[o].default,validate:t[o].validate};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:e.tableGroup,parseDOM:[{tag:"table"}],toDOM(){return["table",["tbody",0]]}},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM(){return["tr",0]}},table_cell:{content:e.cellContent,attrs:n,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:o=>nn(o,t)}],toDOM(o){return["td",on(o,t),0]}},table_header:{content:e.cellContent,attrs:n,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:o=>nn(o,t)}],toDOM(o){return["th",on(o,t),0]}}}}function E(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let o=e.nodes[n],r=o.spec.tableRole;r&&(t[r]=o)}}return t}var U=new G("selectingCells");function ie(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return e.node(0).resolve(e.before(t+1));return null}function L(e){let t=e.selection.$head;for(let n=t.depth;n>0;n--)if(t.node(n).type.spec.tableRole=="row")return!0;return!1}function Ne(e){let 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&&t.node.type.spec.tableRole=="cell")return t.$anchor;let n=ie(t.$head)||Lo(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function Lo(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let o=t.type.spec.tableRole;if(o=="cell"||o=="header_cell")return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let o=t.type.spec.tableRole;if(o=="cell"||o=="header_cell")return e.doc.resolve(n-t.nodeSize)}}function Be(e){return e.parent.type.spec.tableRole=="row"&&!!e.nodeAfter}function Eo(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function Ke(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function wn(e,t,n){let o=e.node(-1),r=x.get(o),i=e.start(-1),l=r.nextCell(e.pos-i,t,n);return l==null?null:e.node(0).resolve(i+l)}function Q(e,t,n=1){let o={...e,colspan:e.colspan-n};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(t,n),o.colwidth.some(r=>r>0)||(o.colwidth=null)),o}function Io(e,t,n=1){let o={...e,colspan:e.colspan+n};if(o.colwidth){o.colwidth=o.colwidth.slice();for(let r=0;r<n;r++)o.colwidth.splice(t,0,0)}return o}function _o(e,t,n){let o=E(t.type.schema).header_cell;for(let r=0;r<e.height;r++)if(t.nodeAt(e.map[n+r*e.width]).type!=o)return!1;return!0}var A=class $ extends F{constructor(t,n=t){let o=t.node(-1),r=x.get(o),i=t.start(-1),l=r.rectBetween(t.pos-i,n.pos-i),s=t.node(0),a=r.cellsInRect(l).filter(f=>f!=n.pos-i);a.unshift(n.pos-i);let c=a.map(f=>{let u=o.nodeAt(f);if(!u)throw new RangeError(`No cell with offset ${f} found`);let p=i+f+1;return new Kt(s.resolve(p),s.resolve(p+u.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=t,this.$headCell=n}map(t,n){let o=t.resolve(n.map(this.$anchorCell.pos)),r=t.resolve(n.map(this.$headCell.pos));if(Be(o)&&Be(r)&&Ke(o,r)){let i=this.$anchorCell.node(-1)!=o.node(-1);return i&&this.isRowSelection()?$.rowSelection(o,r):i&&this.isColSelection()?$.colSelection(o,r):new $(o,r)}return P.between(o,r)}content(){let t=this.$anchorCell.node(-1),n=x.get(t),o=this.$anchorCell.start(-1),r=n.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o),i={},l=[];for(let a=r.top;a<r.bottom;a++){let c=[];for(let f=a*n.width+r.left,u=r.left;u<r.right;u++,f++){let p=n.map[f];if(i[p])continue;i[p]=!0;let h=n.findCell(p),d=t.nodeAt(p);if(!d)throw new RangeError(`No cell with offset ${p} found`);let w=r.left-h.left,b=h.right-r.right;if(w>0||b>0){let g=d.attrs;if(w>0&&(g=Q(g,0,w)),b>0&&(g=Q(g,g.colspan-b,b)),h.left<r.left){if(d=d.type.createAndFill(g),!d)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(g)}`)}else d=d.type.create(g,d.content)}if(h.top<r.top||h.bottom>r.bottom){let g={...d.attrs,rowspan:Math.min(h.bottom,r.bottom)-Math.max(h.top,r.top)};h.top<r.top?d=d.type.createAndFill(g):d=d.type.create(g,d.content)}c.push(d)}l.push(t.child(a).copy(M.from(c)))}let s=this.isColSelection()&&this.isRowSelection()?t:l;return new D(M.from(s),1,1)}replace(t,n=D.empty){let o=t.steps.length,r=this.ranges;for(let l=0;l<r.length;l++){let{$from:s,$to:a}=r[l],c=t.mapping.slice(o);t.replace(c.map(s.pos),c.map(a.pos),l?D.empty:n)}let i=F.findFrom(t.doc.resolve(t.mapping.slice(o).map(this.to)),-1);i&&t.setSelection(i)}replaceWith(t,n){this.replace(t,new D(M.from(n),0,0))}forEachCell(t){let n=this.$anchorCell.node(-1),o=x.get(n),r=this.$anchorCell.start(-1),i=o.cellsInRect(o.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let l=0;l<i.length;l++)t(n.nodeAt(i[l]),r+i[l])}isColSelection(){let t=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(t,n)>0)return!1;let o=t+this.$anchorCell.nodeAfter.attrs.rowspan,r=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(o,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let o=t.node(-1),r=x.get(o),i=t.start(-1),l=r.findCell(t.pos-i),s=r.findCell(n.pos-i),a=t.node(0);return l.top<=s.top?(l.top>0&&(t=a.resolve(i+r.map[l.left])),s.bottom<r.height&&(n=a.resolve(i+r.map[r.width*(r.height-1)+s.right-1]))):(s.top>0&&(n=a.resolve(i+r.map[s.left])),l.bottom<r.height&&(t=a.resolve(i+r.map[r.width*(r.height-1)+l.right-1]))),new $(t,n)}isRowSelection(){let t=this.$anchorCell.node(-1),n=x.get(t),o=this.$anchorCell.start(-1),r=n.colCount(this.$anchorCell.pos-o),i=n.colCount(this.$headCell.pos-o);if(Math.min(r,i)>0)return!1;let l=r+this.$anchorCell.nodeAfter.attrs.colspan,s=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(l,s)==n.width}eq(t){return t instanceof $&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let o=t.node(-1),r=x.get(o),i=t.start(-1),l=r.findCell(t.pos-i),s=r.findCell(n.pos-i),a=t.node(0);return l.left<=s.left?(l.left>0&&(t=a.resolve(i+r.map[l.top*r.width])),s.right<r.width&&(n=a.resolve(i+r.map[r.width*(s.top+1)-1]))):(s.left>0&&(n=a.resolve(i+r.map[s.top*r.width])),l.right<r.width&&(t=a.resolve(i+r.map[r.width*(l.top+1)-1]))),new $(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new $(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,o=n){return new $(t.resolve(n),t.resolve(o))}getBookmark(){return new Po(this.$anchorCell.pos,this.$headCell.pos)}};A.prototype.visible=!1;F.jsonID("cell",A);var Po=class bn{constructor(t,n){this.anchor=t,this.head=n}map(t){return new bn(t.map(this.anchor),t.map(this.head))}resolve(t){let n=t.resolve(this.anchor),o=t.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&o.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&o.index()<o.parent.childCount&&Ke(n,o)?new A(n,o):F.near(o,1)}};function Oo(e){if(!(e.selection instanceof A))return null;let t=[];return e.selection.forEachCell((n,o)=>{t.push(ne.node(o,o+n.nodeSize,{class:"selectedCell"}))}),oe.create(e.doc,t)}function $o({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,o=t.pos,r=e.depth;for(;r>=0&&!(e.after(r+1)<e.end(r));r--,n++);for(let i=t.depth;i>=0&&!(t.before(i+1)>t.start(i));i--,o--);return n==o&&/row|table/.test(e.node(r).type.spec.tableRole)}function Ho({$from:e,$to:t}){let n,o;for(let r=e.depth;r>0;r--){let i=e.node(r);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){n=i;break}}for(let r=t.depth;r>0;r--){let i=t.node(r);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){o=i;break}}return n!==o&&t.parentOffset===0}function Bo(e,t,n){let o=(t||e).selection,r=(t||e).doc,i,l;if(o instanceof Vt&&(l=o.node.type.spec.tableRole)){if(l=="cell"||l=="header_cell")i=A.create(r,o.from);else if(l=="row"){let s=r.resolve(o.from+1);i=A.rowSelection(s,s)}else if(!n){let s=x.get(o.node),a=o.from+1,c=a+s.map[s.width*s.height-1];i=A.create(r,a+1,c)}}else o instanceof P&&$o(o)?i=P.create(r,o.from):o instanceof P&&Ho(o)&&(i=P.create(r,o.$from.start(),o.$from.end()));return i&&(t||(t=e.tr)).setSelection(i),t}var jo=new G("fix-tables");function kn(e,t,n,o){let r=e.childCount,i=t.childCount;e:for(let l=0,s=0;l<i;l++){let a=t.child(l);for(let c=s,f=Math.min(r,l+3);c<f;c++)if(e.child(c)==a){s=c+1,n+=a.nodeSize;continue e}o(a,n),s<r&&e.child(s).sameMarkup(a)?kn(e.child(s),a,n+1,o):a.nodesBetween(0,a.content.size,o,n+1),n+=a.nodeSize}}function Wo(e,t){let n,o=(r,i)=>{r.type.spec.tableRole=="table"&&(n=Ko(e,r,i,n))};return t?t.doc!=e.doc&&kn(t.doc,e.doc,0,o):e.doc.descendants(o),n}function Ko(e,t,n,o){let r=x.get(t);if(!r.problems)return o;o||(o=e.tr);let i=[];for(let a=0;a<r.height;a++)i.push(0);for(let a=0;a<r.problems.length;a++){let c=r.problems[a];if(c.type=="collision"){let f=t.nodeAt(c.pos);if(!f)continue;let u=f.attrs;for(let p=0;p<u.rowspan;p++)i[c.row+p]+=c.n;o.setNodeMarkup(o.mapping.map(n+1+c.pos),null,Q(u,u.colspan-c.n,c.n))}else if(c.type=="missing")i[c.row]+=c.n;else if(c.type=="overlong_rowspan"){let f=t.nodeAt(c.pos);if(!f)continue;o.setNodeMarkup(o.mapping.map(n+1+c.pos),null,{...f.attrs,rowspan:f.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){let f=t.nodeAt(c.pos);if(!f)continue;o.setNodeMarkup(o.mapping.map(n+1+c.pos),null,{...f.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){let f=o.mapping.map(n);o.delete(f,f+t.nodeSize)}}let l,s;for(let a=0;a<i.length;a++)i[a]&&(l==null&&(l=a),s=a);for(let a=0,c=n+1;a<r.height;a++){let f=t.child(a),u=c+f.nodeSize,p=i[a];if(p>0){let h="cell";f.firstChild&&(h=f.firstChild.type.spec.tableRole);let d=[];for(let b=0;b<p;b++){let g=E(e.schema)[h].createAndFill();g&&d.push(g)}let w=(a==0||l==a-1)&&s==a?c+1:u-1;o.insert(o.mapping.map(w),d)}c=u}return o.setMeta(jo,{fixTables:!0})}function Cn(e){let t=x.get(e),n=[],o=t.height,r=t.width;for(let i=0;i<o;i++){let l=[];for(let s=0;s<r;s++){let a=i*r+s,c=t.map[a];if(i>0){let f=a-r;if(c===t.map[f]){l.push(null);continue}}if(s>0){let f=a-1;if(c===t.map[f]){l.push(null);continue}}l.push(e.nodeAt(c))}n.push(l)}return n}function yn(e,t){let n=[],o=x.get(e),r=o.height,i=o.width;for(let l=0;l<r;l++){let s=e.child(l),a=[];for(let f=0;f<i;f++){let u=t[l][f];if(!u)continue;let p=o.map[l*o.width+f],h=e.nodeAt(p);if(!h)continue;let d=h.type.createChecked(u.attrs,u.content,u.marks);a.push(d)}let c=s.type.createChecked(s.attrs,a,s.marks);n.push(c)}return e.type.createChecked(e.attrs,n,e.marks)}function xn(e,t,n,o){let r=t[0]>n[0]?-1:1,i=e.splice(t[0],t.length),l=i.length%2===0?1:0,s;return o===-1&&r===1?s=n[0]-1:o===1&&r===-1?s=n[n.length-1]-l+1:s=r===-1?n[0]:n[n.length-1]-l,e.splice(s,0,...i),e}function X(e){return Vo(t=>t.type.spec.tableRole==="table",e)}function Vo(e,t){for(let n=t.depth;n>=0;n-=1){let o=t.node(n);if(e(o))return{node:o,pos:n===0?0:t.before(n),start:t.start(n),depth:n}}return null}function re(e,t){let n=X(t.$from);if(!n)return;let o=x.get(n.node);if(!(e<0||e>o.width-1))return o.cellsInRect({left:e,right:e+1,top:0,bottom:o.height}).map(r=>{let i=n.node.nodeAt(r),l=r+n.start;return{pos:l,start:l+1,node:i,depth:n.depth+2}})}function le(e,t){let n=X(t.$from);if(!n)return;let o=x.get(n.node);if(!(e<0||e>o.height-1))return o.cellsInRect({left:0,right:o.width,top:e,bottom:e+1}).map(r=>{let i=n.node.nodeAt(r),l=r+n.start;return{pos:l,start:l+1,node:i,depth:n.depth+2}})}function rn(e,t,n=t){let o=t,r=n;for(let f=t;f>=0;f--){let u=re(f,e.selection);u&&u.forEach(p=>{let h=p.node.attrs.colspan+f-1;h>=o&&(o=f),h>r&&(r=h)})}for(let f=t;f<=r;f++){let u=re(f,e.selection);u&&u.forEach(p=>{let h=p.node.attrs.colspan+f-1;p.node.attrs.colspan>1&&h>r&&(r=h)})}let i=[];for(let f=o;f<=r;f++){let u=re(f,e.selection);u&&u.length>0&&i.push(f)}o=i[0],r=i[i.length-1];let l=re(o,e.selection),s=le(0,e.selection);if(!l||!s)return;let a=e.doc.resolve(l[l.length-1].pos),c;for(let f=r;f>=o;f--){let u=re(f,e.selection);if(u&&u.length>0){for(let p=s.length-1;p>=0;p--)if(s[p].pos===u[0].pos){c=u[0];break}if(c)break}}if(c)return{$anchor:a,$head:e.doc.resolve(c.pos),indexes:i}}function ln(e,t,n=t){let o=t,r=n;for(let f=t;f>=0;f--){let u=le(f,e.selection);u&&u.forEach(p=>{let h=p.node.attrs.rowspan+f-1;h>=o&&(o=f),h>r&&(r=h)})}for(let f=t;f<=r;f++){let u=le(f,e.selection);u&&u.forEach(p=>{let h=p.node.attrs.rowspan+f-1;p.node.attrs.rowspan>1&&h>r&&(r=h)})}let i=[];for(let f=o;f<=r;f++){let u=le(f,e.selection);u&&u.length>0&&i.push(f)}o=i[0],r=i[i.length-1];let l=le(o,e.selection),s=re(0,e.selection);if(!l||!s)return;let a=e.doc.resolve(l[l.length-1].pos),c;for(let f=r;f>=o;f--){let u=le(f,e.selection);if(u&&u.length>0){for(let p=s.length-1;p>=0;p--)if(s[p].pos===u[0].pos){c=u[0];break}if(c)break}}if(c)return{$anchor:a,$head:e.doc.resolve(c.pos),indexes:i}}function an(e){return e[0].map((t,n)=>e.map(o=>o[n]))}function Go(e){var t,n;let{tr:o,originIndex:r,targetIndex:i,select:l,pos:s}=e,a=X(o.doc.resolve(s));if(!a)return!1;let c=(t=rn(o,r))===null||t===void 0?void 0:t.indexes,f=(n=rn(o,i))===null||n===void 0?void 0:n.indexes;if(!c||!f||c.includes(i))return!1;let u=qo(a.node,c,f,0);if(o.replaceWith(a.pos,a.pos+a.node.nodeSize,u),!l)return!0;let p=x.get(u),h=a.start,d=i,w=p.positionAt(p.height-1,d,u),b=o.doc.resolve(h+w),g=p.positionAt(0,d,u),C=o.doc.resolve(h+g);return o.setSelection(A.colSelection(b,C)),!0}function qo(e,t,n,o){let r=an(Cn(e));return r=xn(r,t,n,o),r=an(r),yn(e,r)}function Uo(e){var t,n;let{tr:o,originIndex:r,targetIndex:i,select:l,pos:s}=e,a=X(o.doc.resolve(s));if(!a)return!1;let c=(t=ln(o,r))===null||t===void 0?void 0:t.indexes,f=(n=ln(o,i))===null||n===void 0?void 0:n.indexes;if(!c||!f||c.includes(i))return!1;let u=Xo(a.node,c,f,0);if(o.replaceWith(a.pos,a.pos+a.node.nodeSize,u),!l)return!0;let p=x.get(u),h=a.start,d=i,w=p.positionAt(d,p.width-1,u),b=o.doc.resolve(h+w),g=p.positionAt(d,0,u),C=o.doc.resolve(h+g);return o.setSelection(A.rowSelection(b,C)),!0}function Xo(e,t,n,o){let r=Cn(e);return r=xn(r,t,n,o),yn(e,r)}function H(e){let t=e.selection,n=Ne(e),o=n.node(-1),r=n.start(-1),i=x.get(o);return{...t instanceof A?i.rectBetween(t.$anchorCell.pos-r,t.$headCell.pos-r):i.findCell(n.pos-r),tableStart:r,map:i,table:o}}function Sn(e,{map:t,tableStart:n,table:o},r){let i=r>0?-1:0;_o(t,o,r+i)&&(i=r==0||r==t.width?null:0);for(let l=0;l<t.height;l++){let s=l*t.width+r;if(r>0&&r<t.width&&t.map[s-1]==t.map[s]){let a=t.map[s],c=o.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,Io(c.attrs,r-t.colCount(a))),l+=c.attrs.rowspan-1}else{let a=i==null?E(o.type.schema).cell:o.nodeAt(t.map[s+i]).type,c=t.positionAt(l,r,o);e.insert(e.mapping.map(n+c),a.createAndFill())}}return e}function An(e,t){if(!L(e))return!1;if(t){let n=H(e);t(Sn(e.tr,n,n.left))}return!0}function Rn(e,t){if(!L(e))return!1;if(t){let n=H(e);t(Sn(e.tr,n,n.right))}return!0}function Jo(e,{map:t,table:n,tableStart:o},r){let i=e.mapping.maps.length;for(let l=0;l<t.height;){let s=l*t.width+r,a=t.map[s],c=n.nodeAt(a),f=c.attrs;if(r>0&&t.map[s-1]==a||r<t.width-1&&t.map[s+1]==a)e.setNodeMarkup(e.mapping.slice(i).map(o+a),null,Q(f,r-t.colCount(a)));else{let u=e.mapping.slice(i).map(o+a);e.delete(u,u+c.nodeSize)}l+=f.rowspan}}function Tn(e,t){if(!L(e))return!1;if(t){let n=H(e),o=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let r=n.right-1;Jo(o,n,r),r!=n.left;r--){let i=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!i)throw new RangeError("No table found");n.table=i,n.map=x.get(i)}t(o)}return!0}function Yo(e,{map:t,table:n,tableStart:o},r){let i=0;for(let c=0;c<r;c++)i+=n.child(c).nodeSize;let l=i+n.child(r).nodeSize,s=e.mapping.maps.length;e.delete(i+o,l+o);let a=new Set;for(let c=0,f=r*t.width;c<t.width;c++,f++){let u=t.map[f];if(!a.has(u)){if(a.add(u),r>0&&u==t.map[f-t.width]){let p=n.nodeAt(u).attrs;e.setNodeMarkup(e.mapping.slice(s).map(u+o),null,{...p,rowspan:p.rowspan-1}),c+=p.colspan-1}else if(r<t.height&&u==t.map[f+t.width]){let p=n.nodeAt(u),h=p.attrs,d=p.type.create({...h,rowspan:p.attrs.rowspan-1},p.content),w=t.positionAt(r+1,c,n);e.insert(e.mapping.slice(s).map(o+w),d),c+=h.colspan-1}}}}function vn(e,t){if(!L(e))return!1;if(t){let n=H(e),o=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let r=n.bottom-1;Yo(o,n,r),r!=n.top;r--){let i=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!i)throw new RangeError("No table found");n.table=i,n.map=x.get(n.table)}t(o)}return!0}function Mn(e,t){return function(n,o){if(!L(n))return!1;let r=Ne(n);if(r.nodeAfter.attrs[e]===t)return!1;if(o){let i=n.tr;n.selection instanceof A?n.selection.forEachCell((l,s)=>{l.attrs[e]!==t&&i.setNodeMarkup(s,null,{...l.attrs,[e]:t})}):i.setNodeMarkup(r.pos,null,{...r.nodeAfter.attrs,[e]:t}),o(i)}return!0}}function Zo(e){return function(t,n){if(!L(t))return!1;if(n){let o=E(t.schema),r=H(t),i=t.tr,l=r.map.cellsInRect(e=="column"?{left:r.left,top:0,right:r.right,bottom:r.map.height}:e=="row"?{left:0,top:r.top,right:r.map.width,bottom:r.bottom}:r),s=l.map(a=>r.table.nodeAt(a));for(let a=0;a<l.length;a++)s[a].type==o.header_cell&&i.setNodeMarkup(r.tableStart+l[a],o.cell,s[a].attrs);if(i.steps.length===0)for(let a=0;a<l.length;a++)i.setNodeMarkup(r.tableStart+l[a],o.header_cell,s[a].attrs);n(i)}return!0}}function sn(e,t,n){let o=t.map.cellsInRect({left:0,top:0,right:e=="row"?t.map.width:1,bottom:e=="column"?t.map.height:1});for(let r=0;r<o.length;r++){let i=t.table.nodeAt(o[r]);if(i&&i.type!==n.header_cell)return!1}return!0}function Ve(e,t){return t=t||{useDeprecatedLogic:!1},t.useDeprecatedLogic?Zo(e):function(n,o){if(!L(n))return!1;if(o){let r=E(n.schema),i=H(n),l=n.tr,s=sn("row",i,r),a=sn("column",i,r),c=(e==="column"?s:e==="row"&&a)?1:0,f=e=="column"?{left:0,top:c,right:1,bottom:i.map.height}:e=="row"?{left:c,top:0,right:i.map.width,bottom:1}:i,u=e=="column"?a?r.cell:r.header_cell:e=="row"?s?r.cell:r.header_cell:r.cell;i.map.cellsInRect(f).forEach(p=>{let h=p+i.tableStart,d=l.doc.nodeAt(h);d&&l.setNodeMarkup(h,u,d.attrs)}),o(l)}return!0}}var Ql=Ve("row",{useDeprecatedLogic:!0}),ei=Ve("column",{useDeprecatedLogic:!0}),ti=Ve("cell",{useDeprecatedLogic:!0});function Qo(e,t){if(t<0){let n=e.nodeBefore;if(n)return e.pos-n.nodeSize;for(let o=e.index(-1)-1,r=e.before();o>=0;o--){let i=e.node(-1).child(o),l=i.lastChild;if(l)return r-1-l.nodeSize;r-=i.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let n=e.node(-1);for(let o=e.indexAfter(-1),r=e.after();o<n.childCount;o++){let i=n.child(o);if(i.childCount)return r+1;r+=i.nodeSize}}return null}function Ge(e){return function(t,n){if(!L(t))return!1;let o=Qo(Ne(t),e);if(o==null)return!1;if(n){let r=t.doc.resolve(o);n(t.tr.setSelection(P.between(r,Eo(r))).scrollIntoView())}return!0}}function Nn(e,t){let n=e.selection.$anchor;for(let o=n.depth;o>0;o--)if(n.node(o).type.spec.tableRole=="table")return t&&t(e.tr.delete(n.before(o),n.after(o)).scrollIntoView()),!0;return!1}function Ae(e,t){let n=e.selection;if(!(n instanceof A))return!1;if(t){let o=e.tr,r=E(e.schema).cell.createAndFill().content;n.forEachCell((i,l)=>{i.content.eq(r)||o.replace(o.mapping.map(l+1),o.mapping.map(l+i.nodeSize-1),new D(r,0,0))}),o.docChanged&&t(o)}return!0}function Dn(e){return(t,n)=>{let{from:o,to:r,select:i=!0,pos:l=t.selection.from}=e,s=t.tr;return Uo({tr:s,originIndex:o,targetIndex:r,select:i,pos:l})?(n?.(s),!0):!1}}function Fn(e){return(t,n)=>{let{from:o,to:r,select:i=!0,pos:l=t.selection.from}=e,s=t.tr;return Go({tr:s,originIndex:o,targetIndex:r,select:i,pos:l})?(n?.(s),!0):!1}}function er(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:o}=e;for(;t.childCount==1&&(n>0&&o>0||t.child(0).type.spec.tableRole=="table");)n--,o--,t=t.child(0).content;let r=t.child(0),i=r.type.spec.tableRole,l=r.type.schema,s=[];if(i=="row")for(let a=0;a<t.childCount;a++){let c=t.child(a).content,f=a?0:Math.max(0,n-1),u=a<t.childCount-1?0:Math.max(0,o-1);(f||u)&&(c=je(E(l).row,new D(c,f,u)).content),s.push(c)}else if(i=="cell"||i=="header_cell")s.push(n||o?je(E(l).row,new D(t,n,o)).content:t);else return null;return tr(l,s)}function tr(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r];for(let l=i.childCount-1;l>=0;l--){let{rowspan:s,colspan:a}=i.child(l).attrs;for(let c=r;c<r+s;c++)n[c]=(n[c]||0)+a}}let o=0;for(let r=0;r<n.length;r++)o=Math.max(o,n[r]);for(let r=0;r<n.length;r++)if(r>=t.length&&t.push(M.empty),n[r]<o){let i=E(e).cell.createAndFill(),l=[];for(let s=n[r];s<o;s++)l.push(i);t[r]=t[r].append(M.from(l))}return{height:t.length,width:o,rows:t}}function je(e,t){let n=e.createAndFill();return new Wt(n).replace(0,n.content.size,t).doc}function nr({width:e,height:t,rows:n},o,r){if(e!=o){let i=[],l=[];for(let s=0;s<n.length;s++){let a=n[s],c=[];for(let f=i[s]||0,u=0;f<o;u++){let p=a.child(u%a.childCount);f+p.attrs.colspan>o&&(p=p.type.createChecked(Q(p.attrs,p.attrs.colspan,f+p.attrs.colspan-o),p.content)),c.push(p),f+=p.attrs.colspan;for(let h=1;h<p.attrs.rowspan;h++)i[s+h]=(i[s+h]||0)+p.attrs.colspan}l.push(M.from(c))}n=l,e=o}if(t!=r){let i=[];for(let l=0,s=0;l<r;l++,s++){let a=[],c=n[s%t];for(let f=0;f<c.childCount;f++){let u=c.child(f);l+u.attrs.rowspan>r&&(u=u.type.create({...u.attrs,rowspan:Math.max(1,r-u.attrs.rowspan)},u.content)),a.push(u)}i.push(M.from(a))}n=i,t=r}return{width:e,height:t,rows:n}}function or(e,t,n,o,r,i,l){let s=e.doc.type.schema,a=E(s),c,f;if(r>t.width)for(let u=0,p=0;u<t.height;u++){let h=n.child(u);p+=h.nodeSize;let d=[],w;h.lastChild==null||h.lastChild.type==a.cell?w=c||(c=a.cell.createAndFill()):w=f||(f=a.header_cell.createAndFill());for(let b=t.width;b<r;b++)d.push(w);e.insert(e.mapping.slice(l).map(p-1+o),d)}if(i>t.height){let u=[];for(let d=0,w=(t.height-1)*t.width;d<Math.max(t.width,r);d++){let b=d>=t.width?!1:n.nodeAt(t.map[w+d]).type==a.header_cell;u.push(b?f||(f=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}let p=a.row.create(null,M.from(u)),h=[];for(let d=t.height;d<i;d++)h.push(p);e.insert(e.mapping.slice(l).map(o+n.nodeSize-2),h)}return!!(c||f)}function cn(e,t,n,o,r,i,l,s){if(l==0||l==t.height)return!1;let a=!1;for(let c=r;c<i;c++){let f=l*t.width+c,u=t.map[f];if(t.map[f-t.width]==u){a=!0;let p=n.nodeAt(u),{top:h,left:d}=t.findCell(u);e.setNodeMarkup(e.mapping.slice(s).map(u+o),null,{...p.attrs,rowspan:l-h}),e.insert(e.mapping.slice(s).map(t.positionAt(l,d,n)),p.type.createAndFill({...p.attrs,rowspan:h+p.attrs.rowspan-l})),c+=p.attrs.colspan-1}}return a}function un(e,t,n,o,r,i,l,s){if(l==0||l==t.width)return!1;let a=!1;for(let c=r;c<i;c++){let f=c*t.width+l,u=t.map[f];if(t.map[f-1]==u){a=!0;let p=n.nodeAt(u),h=t.colCount(u),d=e.mapping.slice(s).map(u+o);e.setNodeMarkup(d,null,Q(p.attrs,l-h,p.attrs.colspan-(l-h))),e.insert(d+p.nodeSize,p.type.createAndFill(Q(p.attrs,0,l-h))),c+=p.attrs.rowspan-1}}return a}function fn(e,t,n,o,r){let i=n?e.doc.nodeAt(n-1):e.doc;if(!i)throw new Error("No table found");let l=x.get(i),{top:s,left:a}=o,c=a+r.width,f=s+r.height,u=e.tr,p=0;function h(){if(i=n?u.doc.nodeAt(n-1):u.doc,!i)throw new Error("No table found");l=x.get(i),p=u.mapping.maps.length}or(u,l,i,n,c,f,p)&&h(),cn(u,l,i,n,a,c,s,p)&&h(),cn(u,l,i,n,a,c,f,p)&&h(),un(u,l,i,n,s,f,a,p)&&h(),un(u,l,i,n,s,f,c,p)&&h();for(let d=s;d<f;d++){let w=l.positionAt(d,a,i),b=l.positionAt(d,c,i);u.replace(u.mapping.slice(p).map(w+n),u.mapping.slice(p).map(b+n),new D(r.rows[d-s],0,0))}h(),u.setSelection(new A(u.doc.resolve(n+l.positionAt(s,a,i)),u.doc.resolve(n+l.positionAt(f-1,c-1,i)))),t(u)}var rr=Jt({ArrowLeft:Re("horiz",-1),ArrowRight:Re("horiz",1),ArrowUp:Re("vert",-1),ArrowDown:Re("vert",1),"Shift-ArrowLeft":Te("horiz",-1),"Shift-ArrowRight":Te("horiz",1),"Shift-ArrowUp":Te("vert",-1),"Shift-ArrowDown":Te("vert",1),Backspace:Ae,"Mod-Backspace":Ae,Delete:Ae,"Mod-Delete":Ae});function ve(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function Re(e,t){return(n,o,r)=>{if(!r)return!1;let i=n.selection;if(i instanceof A)return ve(n,o,F.near(i.$headCell,t));if(e!="horiz"&&!i.empty)return!1;let l=zn(r,e,t);if(l==null)return!1;if(e=="horiz")return ve(n,o,F.near(n.doc.resolve(i.head+t),t));{let s=n.doc.resolve(l),a=wn(s,e,t),c;return a?c=F.near(a,1):t<0?c=F.near(n.doc.resolve(s.before(-1)),-1):c=F.near(n.doc.resolve(s.after(-1)),1),ve(n,o,c)}}}function Te(e,t){return(n,o,r)=>{if(!r)return!1;let i=n.selection,l;if(i instanceof A)l=i;else{let a=zn(r,e,t);if(a==null)return!1;l=new A(n.doc.resolve(a))}let s=wn(l.$headCell,e,t);return s?ve(n,o,new A(l.$anchorCell,s)):!1}}function lr(e,t){let n=e.state.doc,o=ie(n.resolve(t));return o?(e.dispatch(e.state.tr.setSelection(new A(o))),!0):!1}function ir(e,t,n){if(!L(e.state))return!1;let o=er(n),r=e.state.selection;if(r instanceof A){o||(o={width:1,height:1,rows:[M.from(je(E(e.state.schema).cell,n))]});let i=r.$anchorCell.node(-1),l=r.$anchorCell.start(-1),s=x.get(i).rectBetween(r.$anchorCell.pos-l,r.$headCell.pos-l);return o=nr(o,s.right-s.left,s.bottom-s.top),fn(e.state,e.dispatch,l,s,o),!0}else if(o){let i=Ne(e.state),l=i.start(-1);return fn(e.state,e.dispatch,l,x.get(i.node(-1)).findCell(i.pos-l),o),!0}else return!1}function ar(e,t){var n;if(t.button!=0||t.ctrlKey||t.metaKey)return;let o=pn(e,t.target),r;if(t.shiftKey&&e.state.selection instanceof A)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&o&&(r=ie(e.state.selection.$anchor))!=null&&((n=Oe(e,t))===null||n===void 0?void 0:n.pos)!=r.pos)i(r,t),t.preventDefault();else if(!o)return;function i(a,c){let f=Oe(e,c),u=U.getState(e.state)==null;if(!f||!Ke(a,f))if(u)f=a;else return;let p=new A(a,f);if(u||!e.state.selection.eq(p)){let h=e.state.tr.setSelection(p);u&&h.setMeta(U,a.pos),e.dispatch(h)}}function l(){e.root.removeEventListener("mouseup",l),e.root.removeEventListener("dragstart",l),e.root.removeEventListener("mousemove",s),U.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(U,-1))}function s(a){let c=a,f=U.getState(e.state),u;if(f!=null)u=e.state.doc.resolve(f);else if(pn(e,c.target)!=o&&(u=Oe(e,t),!u))return l();u&&i(u,c)}e.root.addEventListener("mouseup",l),e.root.addEventListener("dragstart",l),e.root.addEventListener("mousemove",s)}function zn(e,t,n){if(!(e.state.selection instanceof P))return null;let{$head:o}=e.state.selection;for(let r=o.depth-1;r>=0;r--){let i=o.node(r);if((n<0?o.index(r):o.indexAfter(r))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){let l=o.before(r),s=t=="vert"?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(s)?l:null}}return null}function pn(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName=="TD"||t.nodeName=="TH")return t;return null}function Oe(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:o,pos:r}=n;return o>=0&&ie(e.state.doc.resolve(o))||ie(e.state.doc.resolve(r))}var sr=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),We(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,We(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function We(e,t,n,o,r,i){let l=0,s=!0,a=t.firstChild,c=e.firstChild;if(c){for(let u=0,p=0;u<c.childCount;u++){let{colspan:h,colwidth:d}=c.child(u).attrs;for(let w=0;w<h;w++,p++){let b=r==p?i:d&&d[w],g=b?b+"px":"";if(l+=b||o,b||(s=!1),a)a.style.width!=g&&(a.style.width=g),a=a.nextSibling;else{let C=document.createElement("col");C.style.width=g,t.appendChild(C)}}}for(;a;){var f;let u=a.nextSibling;(f=a.parentNode)===null||f===void 0||f.removeChild(a),a=u}s?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}var z=new G("tableColumnResizing");function Ln({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:o=sr,lastColumnResizable:r=!0}={}){let i=new Z({key:z,state:{init(l,s){var a;let c=(a=i.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,f=E(s.schema).table.name;return o&&c&&(c[f]=(u,p)=>new o(u,n,p)),new cr(-1,!1)},apply(l,s){return s.apply(l)}},props:{attributes:l=>{let s=z.getState(l);return s&&s.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(l,s)=>{ur(l,s,e,r)},mouseleave:l=>{fr(l)},mousedown:(l,s)=>{pr(l,s,t,n)}},decorations:l=>{let s=z.getState(l);if(s&&s.activeHandle>-1)return wr(l,s.activeHandle)},nodeViews:{}}});return i}var cr=class Me{constructor(t,n){this.activeHandle=t,this.dragging=n}apply(t){let n=this,o=t.getMeta(z);if(o&&o.setHandle!=null)return new Me(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new Me(n.activeHandle,o.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return Be(t.doc.resolve(r))||(r=-1),new Me(r,n.dragging)}return n}};function ur(e,t,n,o){if(!e.editable)return;let r=z.getState(e.state);if(r&&!r.dragging){let i=hr(t.target),l=-1;if(i){let{left:s,right:a}=i.getBoundingClientRect();t.clientX-s<=n?l=dn(e,t,"left",n):a-t.clientX<=n&&(l=dn(e,t,"right",n))}if(l!=r.activeHandle){if(!o&&l!==-1){let s=e.state.doc.resolve(l),a=s.node(-1),c=x.get(a),f=s.start(-1);if(c.colCount(s.pos-f)+s.nodeAfter.attrs.colspan-1==c.width-1)return}En(e,l)}}}function fr(e){if(!e.editable)return;let t=z.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&En(e,-1)}function pr(e,t,n,o){var r;if(!e.editable)return!1;let i=(r=e.dom.ownerDocument.defaultView)!==null&&r!==void 0?r:window,l=z.getState(e.state);if(!l||l.activeHandle==-1||l.dragging)return!1;let s=e.state.doc.nodeAt(l.activeHandle),a=dr(e,l.activeHandle,s.attrs);e.dispatch(e.state.tr.setMeta(z,{setDragging:{startX:t.clientX,startWidth:a}}));function c(u){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",f);let p=z.getState(e.state);p?.dragging&&(mr(e,p.activeHandle,hn(p.dragging,u,n)),e.dispatch(e.state.tr.setMeta(z,{setDragging:null})))}function f(u){if(!u.which)return c(u);let p=z.getState(e.state);if(p&&p.dragging){let h=hn(p.dragging,u,n);mn(e,p.activeHandle,h,o)}}return mn(e,l.activeHandle,a,o),i.addEventListener("mouseup",c),i.addEventListener("mousemove",f),t.preventDefault(),!0}function dr(e,t,{colspan:n,colwidth:o}){let r=o&&o[o.length-1];if(r)return r;let i=e.domAtPos(t),l=i.node.childNodes[i.offset].offsetWidth,s=n;if(o)for(let a=0;a<n;a++)o[a]&&(l-=o[a],s--);return l/s}function hr(e){for(;e&&e.nodeName!="TD"&&e.nodeName!="TH";)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}function dn(e,t,n,o){let r=n=="right"?-o:o,i=e.posAtCoords({left:t.clientX+r,top:t.clientY});if(!i)return-1;let{pos:l}=i,s=ie(e.state.doc.resolve(l));if(!s)return-1;if(n=="right")return s.pos;let a=x.get(s.node(-1)),c=s.start(-1),f=a.map.indexOf(s.pos-c);return f%a.width==0?-1:c+a.map[f-1]}function hn(e,t,n){let o=t.clientX-e.startX;return Math.max(n,e.startWidth+o)}function En(e,t){e.dispatch(e.state.tr.setMeta(z,{setHandle:t}))}function mr(e,t,n){let o=e.state.doc.resolve(t),r=o.node(-1),i=x.get(r),l=o.start(-1),s=i.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1,a=e.state.tr;for(let c=0;c<i.height;c++){let f=c*i.width+s;if(c&&i.map[f]==i.map[f-i.width])continue;let u=i.map[f],p=r.nodeAt(u).attrs,h=p.colspan==1?0:s-i.colCount(u);if(p.colwidth&&p.colwidth[h]==n)continue;let d=p.colwidth?p.colwidth.slice():gr(p.colspan);d[h]=n,a.setNodeMarkup(l+u,null,{...p,colwidth:d})}a.docChanged&&e.dispatch(a)}function mn(e,t,n,o){let r=e.state.doc.resolve(t),i=r.node(-1),l=r.start(-1),s=x.get(i).colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1,a=e.domAtPos(r.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&We(i,a.firstChild,a,o,s,n)}function gr(e){return Array(e).fill(0)}function wr(e,t){let n=[],o=e.doc.resolve(t),r=o.node(-1);if(!r)return oe.empty;let i=x.get(r),l=o.start(-1),s=i.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1;for(let c=0;c<i.height;c++){let f=s+c*i.width;if((s==i.width-1||i.map[f]!=i.map[f+1])&&(c==0||i.map[f]!=i.map[f-i.width])){var a;let u=i.map[f],p=l+u+r.nodeAt(u).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",!((a=z.getState(e))===null||a===void 0)&&a.dragging&&n.push(ne.node(l+u,l+u+r.nodeAt(u).nodeSize,{class:"column-resize-dragging"})),n.push(ne.widget(p,h))}}return oe.create(e.doc,n)}function In({allowTableNodeSelection:e=!1}={}){return new Z({key:U,state:{init(){return null},apply(t,n){let o=t.getMeta(U);if(o!=null)return o==-1?null:o;if(n==null||!t.docChanged)return n;let{deleted:r,pos:i}=t.mapping.mapResult(n);return r?null:i}},props:{decorations:Oo,handleDOMEvents:{mousedown:ar},createSelectionBetween(t){return U.getState(t.state)!=null?t.state.selection:null},handleTripleClick:lr,handleKeyDown:rr,handlePaste:ir},appendTransaction(t,n,o){return Bo(o,Wo(o,n),e)}})}var De=typeof navigator<"u"?navigator:null,Ue=De&&De.userAgent||"",br=/Edge\/(\d+)/.exec(Ue),kr=/MSIE \d/.exec(Ue),Cr=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ue),yr=!!(kr||Cr||br),xr=!yr&&!!De&&/Apple Computer/.test(De.vendor),_n=new G("safari-ime-span"),qe=!1,Sr={key:_n,props:{decorations:Ar,handleDOMEvents:{compositionstart:()=>{qe=!0},compositionend:()=>{qe=!1}}}};function Ar(e){let{$from:t,$to:n,to:o}=e.selection;if(qe&&t.sameParent(n)){let r=ne.widget(o,Rr,{ignoreSelection:!0,key:"safari-ime-span"});return oe.create(e.doc,[r])}}function Rr(e){let t=e.dom.ownerDocument.createElement("span");return t.className="ProseMirror-safari-ime-span",t}var Pn=new Z(xr?Sr:{key:_n});function Xe(e,t){let n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let o=0,r=n.indexOf(t);for(;r!==-1;)o++,r=n.indexOf(t,r+t.length);return o}function Je(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Ye(e,t,n){let r=Bt((n||{}).ignore||[]),i=Tr(t),l=-1;for(;++l<i.length;)jt(e,"text",s);function s(c,f){let u=-1,p;for(;++u<f.length;){let h=f[u],d=p?p.children:void 0;if(r(h,d?d.indexOf(h):void 0,p))return;p=h}if(p)return a(c,f)}function a(c,f){let u=f[f.length-1],p=i[l][0],h=i[l][1],d=0,b=u.children.indexOf(c),g=!1,C=[];p.lastIndex=0;let y=p.exec(c.value);for(;y;){let R=y.index,S={index:y.index,input:y.input,stack:[...f,c]},T=h(...y,S);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1?p.lastIndex=R+1:(d!==R&&C.push({type:"text",value:c.value.slice(d,R)}),Array.isArray(T)?C.push(...T):T&&C.push(T),d=R+y[0].length,g=!0),!p.global)break;y=p.exec(c.value)}return g?(d<c.value.length&&C.push({type:"text",value:c.value.slice(d)}),u.children.splice(b,1,...C)):C=[c],b+C.length}}function Tr(e){let t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");let n=!e[0]||Array.isArray(e[0])?e:[e],o=-1;for(;++o<n.length;){let r=n[o];t.push([vr(r[0]),Mr(r[1])])}return t}function vr(e){return typeof e=="string"?new RegExp(Je(e),"g"):e}function Mr(e){return typeof e=="function"?e:function(){return e}}var Ze="phrasing",Qe=["autolink","link","image","label"];function tt(){return{transforms:[Er],enter:{literalAutolink:Nr,literalAutolinkEmail:et,literalAutolinkHttp:et,literalAutolinkWww:et},exit:{literalAutolink:Lr,literalAutolinkEmail:zr,literalAutolinkHttp:Dr,literalAutolinkWww:Fr}}}function nt(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Ze,notInConstruct:Qe},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Ze,notInConstruct:Qe},{character:":",before:"[ps]",after:"\\/",inConstruct:Ze,notInConstruct:Qe}]}}function Nr(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function et(e){this.config.enter.autolinkProtocol.call(this,e)}function Dr(e){this.config.exit.autolinkProtocol.call(this,e)}function Fr(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function zr(e){this.config.exit.autolinkEmail.call(this,e)}function Lr(e){this.exit(e)}function Er(e){Ye(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Ir],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,_r]],{ignore:["link","linkReference"]})}function Ir(e,t,n,o,r){let i="";if(!On(r)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!Pr(n)))return!1;let l=Or(n+o);if(!l[0])return!1;let s={type:"link",title:null,url:i+t+l[0],children:[{type:"text",value:t+l[0]}]};return l[1]?[s,{type:"text",value:l[1]}]:s}function _r(e,t,n,o){return!On(o,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function Pr(e){let 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])))}function Or(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],o=n.indexOf(")"),r=Xe(e,"("),i=Xe(e,")");for(;o!==-1&&r>i;)e+=n.slice(0,o+1),n=n.slice(o+1),o=n.indexOf(")"),i++;return[e,n]}function On(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||V(n)||fe(n))&&(!t||n!==47)}$n.peek=qr;function $r(){this.buffer()}function Hr(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Br(){this.buffer()}function jr(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Wr(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=J(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Kr(e){this.exit(e)}function Vr(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=J(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Gr(e){this.exit(e)}function qr(){return"["}function $n(e,t,n,o){let r=n.createTracker(o),i=r.move("[^"),l=n.enter("footnoteReference"),s=n.enter("reference");return i+=r.move(n.safe(n.associationId(e),{after:"]",before:i})),s(),l(),i+=r.move("]"),i}function ot(){return{enter:{gfmFootnoteCallString:$r,gfmFootnoteCall:Hr,gfmFootnoteDefinitionLabelString:Br,gfmFootnoteDefinition:jr},exit:{gfmFootnoteCallString:Wr,gfmFootnoteCall:Kr,gfmFootnoteDefinitionLabelString:Vr,gfmFootnoteDefinition:Gr}}}function rt(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:$n},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(o,r,i,l){let s=i.createTracker(l),a=s.move("[^"),c=i.enter("footnoteDefinition"),f=i.enter("label");return a+=s.move(i.safe(i.associationId(o),{before:a,after:"]"})),f(),a+=s.move("]:"),o.children&&o.children.length>0&&(s.shift(4),a+=s.move((t?`
|
|
2
|
+
`:" ")+i.indentLines(i.containerFlow(o,s.current()),t?Hn:Ur))),c(),a}}function Ur(e,t,n){return t===0?e:Hn(e,t,n)}function Hn(e,t,n){return(n?"":" ")+e}var Xr=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Bn.peek=Zr;function lt(){return{canContainEols:["delete"],enter:{strikethrough:Jr},exit:{strikethrough:Yr}}}function it(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Xr}],handlers:{delete:Bn}}}function Jr(e){this.enter({type:"delete",children:[]},e)}function Yr(e){this.exit(e)}function Bn(e,t,n,o){let r=n.createTracker(o),i=n.enter("strikethrough"),l=r.move("~~");return l+=n.containerPhrasing(e,{...r.current(),before:l,after:"~"}),l+=r.move("~~"),i(),l}function Zr(){return"~"}function Qr(e){return e.length}function Wn(e,t){let n=t||{},o=(n.align||[]).concat(),r=n.stringLength||Qr,i=[],l=[],s=[],a=[],c=0,f=-1;for(;++f<e.length;){let w=[],b=[],g=-1;for(e[f].length>c&&(c=e[f].length);++g<e[f].length;){let C=el(e[f][g]);if(n.alignDelimiters!==!1){let y=r(C);b[g]=y,(a[g]===void 0||y>a[g])&&(a[g]=y)}w.push(C)}l[f]=w,s[f]=b}let u=-1;if(typeof o=="object"&&"length"in o)for(;++u<c;)i[u]=jn(o[u]);else{let w=jn(o);for(;++u<c;)i[u]=w}u=-1;let p=[],h=[];for(;++u<c;){let w=i[u],b="",g="";w===99?(b=":",g=":"):w===108?b=":":w===114&&(g=":");let C=n.alignDelimiters===!1?1:Math.max(1,a[u]-b.length-g.length),y=b+"-".repeat(C)+g;n.alignDelimiters!==!1&&(C=b.length+C+g.length,C>a[u]&&(a[u]=C),h[u]=C),p[u]=y}l.splice(1,0,p),s.splice(1,0,h),f=-1;let d=[];for(;++f<l.length;){let w=l[f],b=s[f];u=-1;let g=[];for(;++u<c;){let C=w[u]||"",y="",R="";if(n.alignDelimiters!==!1){let S=a[u]-(b[u]||0),T=i[u];T===114?y=" ".repeat(S):T===99?S%2?(y=" ".repeat(S/2+.5),R=" ".repeat(S/2-.5)):(y=" ".repeat(S/2),R=y):R=" ".repeat(S)}n.delimiterStart!==!1&&!u&&g.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&C==="")&&(n.delimiterStart!==!1||u)&&g.push(" "),n.alignDelimiters!==!1&&g.push(y),g.push(C),n.alignDelimiters!==!1&&g.push(R),n.padding!==!1&&g.push(" "),(n.delimiterEnd!==!1||u!==c-1)&&g.push("|")}d.push(n.delimiterEnd===!1?g.join("").replace(/ +$/,""):g.join(""))}return d.join(`
|
|
3
|
+
`)}function el(e){return e==null?"":String(e)}function jn(e){let t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function st(){return{enter:{table:tl,tableData:Kn,tableHeader:Kn,tableRow:ol},exit:{codeText:rl,table:nl,tableData:at,tableHeader:at,tableRow:at}}}function tl(e){let t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function nl(e){this.exit(e),this.data.inTable=void 0}function ol(e){this.enter({type:"tableRow",children:[]},e)}function at(e){this.exit(e)}function Kn(e){this.enter({type:"tableCell",children:[]},e)}function rl(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,ll));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function ll(e,t){return t==="|"?t:e}function ct(e){let t=e||{},n=t.tableCellPadding,o=t.tablePipeAlign,r=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
4
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:l,tableCell:a,tableRow:s}};function l(h,d,w,b){return c(f(h,w,b),h.align)}function s(h,d,w,b){let g=u(h,w,b),C=c([g]);return C.slice(0,C.indexOf(`
|
|
5
|
+
`))}function a(h,d,w,b){let g=w.enter("tableCell"),C=w.enter("phrasing"),y=w.containerPhrasing(h,{...b,before:i,after:i});return C(),g(),y}function c(h,d){return Wn(h,{align:d,alignDelimiters:o,padding:n,stringLength:r})}function f(h,d,w){let b=h.children,g=-1,C=[],y=d.enter("table");for(;++g<b.length;)C[g]=u(b[g],d,w);return y(),C}function u(h,d,w){let b=h.children,g=-1,C=[],y=d.enter("tableRow");for(;++g<b.length;)C[g]=a(b[g],h,d,w);return y(),C}function p(h,d,w){let b=ye.inlineCode(h,d,w);return w.stack.includes("tableCell")&&(b=b.replace(/\|/g,"\\$&")),b}}function ut(){return{exit:{taskListCheckValueChecked:Vn,taskListCheckValueUnchecked:Vn,paragraph:il}}}function ft(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:al}}}function Vn(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function il(e){let t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){let n=this.stack[this.stack.length-1];n.type;let o=n.children[0];if(o&&o.type==="text"){let r=t.children,i=-1,l;for(;++i<r.length;){let s=r[i];if(s.type==="paragraph"){l=s;break}}l===n&&(o.value=o.value.slice(1),o.value.length===0?n.children.shift():n.position&&o.position&&typeof o.position.start.offset=="number"&&(o.position.start.column++,o.position.start.offset++,n.position.start=Object.assign({},o.position.start)))}}this.exit(e)}function al(e,t,n,o){let r=e.children[0],i=typeof e.checked=="boolean"&&r&&r.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",s=n.createTracker(o);i&&s.move(l);let a=ye.listItem(e,t,n,{...o,...s.current()});return i&&(a=a.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),a;function c(f){return f+l}}function pt(){return[tt(),ot(),lt(),st(),ut()]}function dt(e){return{extensions:[nt(),rt(e),it(),ct(e),ft()]}}var sl={tokenize:dl,partial:!0},Gn={tokenize:hl,partial:!0},qn={tokenize:ml,partial:!0},Un={tokenize:gl,partial:!0},cl={tokenize:wl,partial:!0},Xn={name:"wwwAutolink",tokenize:fl,previous:Yn},Jn={name:"protocolAutolink",tokenize:pl,previous:Zn},B={name:"emailAutolink",tokenize:ul,previous:Qn},O={};function mt(){return{text:O}}var ee=48;for(;ee<123;)O[ee]=B,ee++,ee===58?ee=65:ee===91&&(ee=97);O[43]=B;O[45]=B;O[46]=B;O[95]=B;O[72]=[B,Jn];O[104]=[B,Jn];O[87]=[B,Xn];O[119]=[B,Xn];function ul(e,t,n){let o=this,r,i;return l;function l(u){return!ht(u)||!Qn.call(o,o.previous)||gt(o.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),s(u))}function s(u){return ht(u)?(e.consume(u),s):u===64?(e.consume(u),a):n(u)}function a(u){return u===46?e.check(cl,f,c)(u):u===45||u===95||Ce(u)?(i=!0,e.consume(u),a):f(u)}function c(u){return e.consume(u),r=!0,a}function f(u){return i&&r&&te(o.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(u)):n(u)}}function fl(e,t,n){let o=this;return r;function r(l){return l!==87&&l!==119||!Yn.call(o,o.previous)||gt(o.events)?n(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(sl,e.attempt(Gn,e.attempt(qn,i),n),n)(l))}function i(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function pl(e,t,n){let o=this,r="",i=!1;return l;function l(u){return(u===72||u===104)&&Zn.call(o,o.previous)&&!gt(o.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),r+=String.fromCodePoint(u),e.consume(u),s):n(u)}function s(u){if(te(u)&&r.length<5)return r+=String.fromCodePoint(u),e.consume(u),s;if(u===58){let p=r.toLowerCase();if(p==="http"||p==="https")return e.consume(u),a}return n(u)}function a(u){return u===47?(e.consume(u),i?c:(i=!0,a)):n(u)}function c(u){return u===null||Ot(u)||v(u)||V(u)||fe(u)?n(u):e.attempt(Gn,e.attempt(qn,f),n)(u)}function f(u){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(u)}}function dl(e,t,n){let o=0;return r;function r(l){return(l===87||l===119)&&o<3?(o++,e.consume(l),r):l===46&&o===3?(e.consume(l),i):n(l)}function i(l){return l===null?n(l):t(l)}}function hl(e,t,n){let o,r,i;return l;function l(c){return c===46||c===95?e.check(Un,a,s)(c):c===null||v(c)||V(c)||c!==45&&fe(c)?a(c):(i=!0,e.consume(c),l)}function s(c){return c===95?o=!0:(r=o,o=void 0),e.consume(c),l}function a(c){return r||o||!i?n(c):t(c)}}function ml(e,t){let n=0,o=0;return r;function r(l){return l===40?(n++,e.consume(l),r):l===41&&o<n?i(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(Un,t,i)(l):l===null||v(l)||V(l)?t(l):(e.consume(l),r)}function i(l){return l===41&&o++,e.consume(l),r}}function gl(e,t,n){return o;function o(s){return s===33||s===34||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===63||s===95||s===126?(e.consume(s),o):s===38?(e.consume(s),i):s===93?(e.consume(s),r):s===60||s===null||v(s)||V(s)?t(s):n(s)}function r(s){return s===null||s===40||s===91||v(s)||V(s)?t(s):o(s)}function i(s){return te(s)?l(s):n(s)}function l(s){return s===59?(e.consume(s),o):te(s)?(e.consume(s),l):n(s)}}function wl(e,t,n){return o;function o(i){return e.consume(i),r}function r(i){return Ce(i)?n(i):t(i)}}function Yn(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||v(e)}function Zn(e){return!te(e)}function Qn(e){return!(e===47||ht(e))}function ht(e){return e===43||e===45||e===46||e===95||Ce(e)}function gt(e){let t=e.length,n=!1;for(;t--;){let o=e[t][1];if((o.type==="labelLink"||o.type==="labelImage")&&!o._balanced){n=!0;break}if(o._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var bl={tokenize:Rl,partial:!0};function wt(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:xl,continuation:{tokenize:Sl},exit:Al}},text:{91:{name:"gfmFootnoteCall",tokenize:yl},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:kl,resolveTo:Cl}}}}function kl(e,t,n){let o=this,r=o.events.length,i=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]),l;for(;r--;){let a=o.events[r][1];if(a.type==="labelImage"){l=a;break}if(a.type==="gfmFootnoteCall"||a.type==="labelLink"||a.type==="label"||a.type==="image"||a.type==="link")break}return s;function s(a){if(!l||!l._balanced)return n(a);let c=J(o.sliceSerialize({start:l.end,end:o.now()}));return c.codePointAt(0)!==94||!i.includes(c.slice(1))?n(a):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),t(a))}}function Cl(e,t){let n=e.length,o;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){o=e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";let r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let l={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},l.start),end:Object.assign({},l.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",l,t],["enter",s,t],["exit",s,t],["exit",l,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function yl(e,t,n){let o=this,r=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]),i=0,l;return s;function s(u){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),a}function a(u){return u!==94?n(u):(e.enter("gfmFootnoteCallMarker"),e.consume(u),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(u){if(i>999||u===93&&!l||u===null||u===91||v(u))return n(u);if(u===93){e.exit("chunkString");let p=e.exit("gfmFootnoteCallString");return r.includes(J(o.sliceSerialize(p)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(u)}return v(u)||(l=!0),i++,e.consume(u),u===92?f:c}function f(u){return u===91||u===92||u===93?(e.consume(u),i++,c):c(u)}}function xl(e,t,n){let o=this,r=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]),i,l=0,s;return a;function a(d){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(d),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(d){return d===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(d),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",f):n(d)}function f(d){if(l>999||d===93&&!s||d===null||d===91||v(d))return n(d);if(d===93){e.exit("chunkString");let w=e.exit("gfmFootnoteDefinitionLabelString");return i=J(o.sliceSerialize(w)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(d),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),p}return v(d)||(s=!0),l++,e.consume(d),d===92?u:f}function u(d){return d===91||d===92||d===93?(e.consume(d),l++,f):f(d)}function p(d){return d===58?(e.enter("definitionMarker"),e.consume(d),e.exit("definitionMarker"),r.includes(i)||r.push(i),I(e,h,"gfmFootnoteDefinitionWhitespace")):n(d)}function h(d){return t(d)}}function Sl(e,t,n){return e.check(Ht,t,e.attempt(bl,t,n))}function Al(e){e.exit("gfmFootnoteDefinition")}function Rl(e,t,n){let o=this;return I(e,r,"gfmFootnoteDefinitionIndent",5);function r(i){let l=o.events[o.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(i):n(i)}}function bt(e){let n=(e||{}).singleTilde,o={name:"strikethrough",tokenize:i,resolveAll:r};return n==null&&(n=!0),{text:{126:o},insideSpan:{null:[o]},attentionMarkers:{null:[126]}};function r(l,s){let a=-1;for(;++a<l.length;)if(l[a][0]==="enter"&&l[a][1].type==="strikethroughSequenceTemporary"&&l[a][1]._close){let c=a;for(;c--;)if(l[c][0]==="exit"&&l[c][1].type==="strikethroughSequenceTemporary"&&l[c][1]._open&&l[a][1].end.offset-l[a][1].start.offset===l[c][1].end.offset-l[c][1].start.offset){l[a][1].type="strikethroughSequence",l[c][1].type="strikethroughSequence";let f={type:"strikethrough",start:Object.assign({},l[c][1].start),end:Object.assign({},l[a][1].end)},u={type:"strikethroughText",start:Object.assign({},l[c][1].end),end:Object.assign({},l[a][1].start)},p=[["enter",f,s],["enter",l[c][1],s],["exit",l[c][1],s],["enter",u,s]],h=s.parser.constructs.insideSpan.null;h&&ke(p,p.length,0,$t(h,l.slice(c+1,a),s)),ke(p,p.length,0,[["exit",u,s],["enter",l[a][1],s],["exit",l[a][1],s],["exit",f,s]]),ke(l,c-1,a-c+3,p),a=c+p.length-2;break}}for(a=-1;++a<l.length;)l[a][1].type==="strikethroughSequenceTemporary"&&(l[a][1].type="data");return l}function i(l,s,a){let c=this.previous,f=this.events,u=0;return p;function p(d){return c===126&&f[f.length-1][1].type!=="characterEscape"?a(d):(l.enter("strikethroughSequenceTemporary"),h(d))}function h(d){let w=Ee(c);if(d===126)return u>1?a(d):(l.consume(d),u++,h);if(u<2&&!n)return a(d);let b=l.exit("strikethroughSequenceTemporary"),g=Ee(d);return b._open=!g||g===2&&!!w,b._close=!w||w===2&&!!g,s(d)}}}var Fe=class{constructor(){this.map=[]}add(t,n,o){Tl(this,t,n,o)}consume(t){if(this.map.sort(function(i,l){return i[0]-l[0]}),this.map.length===0)return;let n=this.map.length,o=[];for(;n>0;)n-=1,o.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];o.push(t.slice()),t.length=0;let r=o.pop();for(;r;){for(let i of r)t.push(i);r=o.pop()}this.map.length=0}};function Tl(e,t,n,o){let r=0;if(!(n===0&&o.length===0)){for(;r<e.map.length;){if(e.map[r][0]===t){e.map[r][1]+=n,e.map[r][2].push(...o);return}r+=1}e.map.push([t,n,o])}}function eo(e,t){let n=!1,o=[];for(;t<e.length;){let r=e[t];if(n){if(r[0]==="enter")r[1].type==="tableContent"&&o.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(r[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){let i=o.length-1;o[i]=o[i]==="left"?"center":"right"}}else if(r[1].type==="tableDelimiterRow")break}else r[0]==="enter"&&r[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return o}function kt(){return{flow:{null:{name:"table",tokenize:vl,resolveAll:Ml}}}}function vl(e,t,n){let o=this,r=0,i=0,l;return s;function s(m){let ue=o.events.length-1;for(;ue>-1;){let _t=o.events[ue][1].type;if(_t==="lineEnding"||_t==="linePrefix")ue--;else break}let Et=ue>-1?o.events[ue][1].type:null,It=Et==="tableHead"||Et==="tableRow"?T:a;return It===T&&o.parser.lazy[o.now().line]?n(m):It(m)}function a(m){return e.enter("tableHead"),e.enter("tableRow"),c(m)}function c(m){return m===124||(l=!0,i+=1),f(m)}function f(m){return m===null?n(m):Y(m)?i>1?(i=0,o.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),h):n(m):K(m)?I(e,f,"whitespace")(m):(i+=1,l&&(l=!1,r+=1),m===124?(e.enter("tableCellDivider"),e.consume(m),e.exit("tableCellDivider"),l=!0,f):(e.enter("data"),u(m)))}function u(m){return m===null||m===124||v(m)?(e.exit("data"),f(m)):(e.consume(m),m===92?p:u)}function p(m){return m===92||m===124?(e.consume(m),u):u(m)}function h(m){return o.interrupt=!1,o.parser.lazy[o.now().line]?n(m):(e.enter("tableDelimiterRow"),l=!1,K(m)?I(e,d,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m):d(m))}function d(m){return m===45||m===58?b(m):m===124?(l=!0,e.enter("tableCellDivider"),e.consume(m),e.exit("tableCellDivider"),w):S(m)}function w(m){return K(m)?I(e,b,"whitespace")(m):b(m)}function b(m){return m===58?(i+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(m),e.exit("tableDelimiterMarker"),g):m===45?(i+=1,g(m)):m===null||Y(m)?R(m):S(m)}function g(m){return m===45?(e.enter("tableDelimiterFiller"),C(m)):S(m)}function C(m){return m===45?(e.consume(m),C):m===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(m),e.exit("tableDelimiterMarker"),y):(e.exit("tableDelimiterFiller"),y(m))}function y(m){return K(m)?I(e,R,"whitespace")(m):R(m)}function R(m){return m===124?d(m):m===null||Y(m)?!l||r!==i?S(m):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(m)):S(m)}function S(m){return n(m)}function T(m){return e.enter("tableRow"),_(m)}function _(m){return m===124?(e.enter("tableCellDivider"),e.consume(m),e.exit("tableCellDivider"),_):m===null||Y(m)?(e.exit("tableRow"),t(m)):K(m)?I(e,_,"whitespace")(m):(e.enter("data"),W(m))}function W(m){return m===null||m===124||v(m)?(e.exit("data"),_(m)):(e.consume(m),m===92?vo:W)}function vo(m){return m===92||m===124?(e.consume(m),W):W(m)}}function Ml(e,t){let n=-1,o=!0,r=0,i=[0,0,0,0],l=[0,0,0,0],s=!1,a=0,c,f,u,p=new Fe;for(;++n<e.length;){let h=e[n],d=h[1];h[0]==="enter"?d.type==="tableHead"?(s=!1,a!==0&&(to(p,t,a,c,f),f=void 0,a=0),c={type:"table",start:Object.assign({},d.start),end:Object.assign({},d.end)},p.add(n,0,[["enter",c,t]])):d.type==="tableRow"||d.type==="tableDelimiterRow"?(o=!0,u=void 0,i=[0,0,0,0],l=[0,n+1,0,0],s&&(s=!1,f={type:"tableBody",start:Object.assign({},d.start),end:Object.assign({},d.end)},p.add(n,0,[["enter",f,t]])),r=d.type==="tableDelimiterRow"?2:f?3:1):r&&(d.type==="data"||d.type==="tableDelimiterMarker"||d.type==="tableDelimiterFiller")?(o=!1,l[2]===0&&(i[1]!==0&&(l[0]=l[1],u=ze(p,t,i,r,void 0,u),i=[0,0,0,0]),l[2]=n)):d.type==="tableCellDivider"&&(o?o=!1:(i[1]!==0&&(l[0]=l[1],u=ze(p,t,i,r,void 0,u)),i=l,l=[i[1],n,0,0])):d.type==="tableHead"?(s=!0,a=n):d.type==="tableRow"||d.type==="tableDelimiterRow"?(a=n,i[1]!==0?(l[0]=l[1],u=ze(p,t,i,r,n,u)):l[1]!==0&&(u=ze(p,t,l,r,n,u)),r=0):r&&(d.type==="data"||d.type==="tableDelimiterMarker"||d.type==="tableDelimiterFiller")&&(l[3]=n)}for(a!==0&&to(p,t,a,c,f),p.consume(t.events),n=-1;++n<t.events.length;){let h=t.events[n];h[0]==="enter"&&h[1].type==="table"&&(h[1]._align=eo(t.events,n))}return e}function ze(e,t,n,o,r,i){let l=o===1?"tableHeader":o===2?"tableDelimiter":"tableData",s="tableContent";n[0]!==0&&(i.end=Object.assign({},ae(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));let a=ae(t.events,n[1]);if(i={type:l,start:Object.assign({},a),end:Object.assign({},a)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){let c=ae(t.events,n[2]),f=ae(t.events,n[3]),u={type:s,start:Object.assign({},c),end:Object.assign({},f)};if(e.add(n[2],0,[["enter",u,t]]),o!==2){let p=t.events[n[2]],h=t.events[n[3]];if(p[1].end=Object.assign({},h[1].end),p[1].type="chunkText",p[1].contentType="text",n[3]>n[2]+1){let d=n[2]+1,w=n[3]-n[2]-1;e.add(d,w,[])}}e.add(n[3]+1,0,[["exit",u,t]])}return r!==void 0&&(i.end=Object.assign({},ae(t.events,r)),e.add(r,0,[["exit",i,t]]),i=void 0),i}function to(e,t,n,o,r){let i=[],l=ae(t.events,n);r&&(r.end=Object.assign({},l),i.push(["exit",r,t])),o.end=Object.assign({},l),i.push(["exit",o,t]),e.add(n+1,0,i)}function ae(e,t){let n=e[t],o=n[0]==="enter"?"start":"end";return n[1][o]}var Nl={name:"tasklistCheck",tokenize:Dl};function Ct(){return{text:{91:Nl}}}function Dl(e,t,n){let o=this;return r;function r(a){return o.previous!==null||!o._gfmTasklistFirstContentOfListItem?n(a):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(a),e.exit("taskListCheckMarker"),i)}function i(a){return v(a)?(e.enter("taskListCheckValueUnchecked"),e.consume(a),e.exit("taskListCheckValueUnchecked"),l):a===88||a===120?(e.enter("taskListCheckValueChecked"),e.consume(a),e.exit("taskListCheckValueChecked"),l):n(a)}function l(a){return a===93?(e.enter("taskListCheckMarker"),e.consume(a),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),s):n(a)}function s(a){return Y(a)?t(a):K(a)?e.check({tokenize:Fl},t,n)(a):n(a)}}function Fl(e,t,n){return I(e,o,"whitespace");function o(r){return r===null?n(r):t(r)}}function no(e){return Pt([mt(),wt(),bt(e),kt(),Ct()])}var zl={};function Le(e){let t=this,n=e||zl,o=t.data(),r=o.micromarkExtensions||(o.micromarkExtensions=[]),i=o.fromMarkdownExtensions||(o.fromMarkdownExtensions=[]),l=o.toMarkdownExtensions||(o.toMarkdownExtensions=[]);r.push(no(n)),i.push(pt()),l.push(dt(n))}function k(e,t){return Object.assign(e,{meta:{package:"@milkdown/preset-gfm",...t}}),e}var St=Qt("strike_through");k(St,{displayName:"Attr<strikethrough>",group:"Strikethrough"});var he=Zt("strike_through",e=>({parseDOM:[{tag:"del"},{style:"text-decoration",getAttrs:t=>t==="line-through"}],toDOM:t=>["del",e.get(St.key)(t)],parseMarkdown:{match:t=>t.type==="delete",runner:(t,n,o)=>{t.openMark(o),t.next(n.children),t.closeMark(o)}},toMarkdown:{match:t=>t.type.name==="strike_through",runner:(t,n)=>{t.withMark(n,"delete")}}}));k(he.mark,{displayName:"MarkSchema<strikethrough>",group:"Strikethrough"});k(he.ctx,{displayName:"MarkSchemaCtx<strikethrough>",group:"Strikethrough"});var At=N("ToggleStrikeThrough",e=>()=>Gt(he.type(e)));k(At,{displayName:"Command<ToggleStrikethrough>",group:"Strikethrough"});var ro=xe(e=>qt(/(?<![\w:/])(~{1,2})(.+?)\1(?!\w|\/)$/,he.type(e)));k(ro,{displayName:"InputRule<strikethrough>",group:"Strikethrough"});var Rt=Pe("strikeThroughKeymap",{ToggleStrikethrough:{shortcuts:"Mod-Alt-x",command:e=>{let t=e.get(pe);return()=>t.call(At.key)}}});k(Rt.ctx,{displayName:"KeymapCtx<strikethrough>",group:"Strikethrough"});k(Rt.shortcuts,{displayName:"Keymap<strikethrough>",group:"Strikethrough"});var me=gn({tableGroup:"block",cellContent:"paragraph",cellAttributes:{alignment:{default:"left",getFromDOM:e=>e.style.textAlign||"left",setDOMAttr:(e,t)=>{t.style=`text-align: ${e||"left"}`}}}}),j=q("table",()=>({...me.table,content:"table_header_row table_row+",disableDropCursor:!0,parseMarkdown:{match:e=>e.type==="table",runner:(e,t,n)=>{let o=t.align,r=t.children.map((i,l)=>({...i,align:o,isHeader:l===0}));e.openNode(n),e.next(r),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="table",runner:(e,t)=>{let n=t.content.firstChild?.content;if(!n)return;let o=[];n.forEach(r=>{o.push(r.attrs.alignment)}),e.openNode("table",void 0,{align:o}),e.next(t.content),e.closeNode()}}}));k(j.node,{displayName:"NodeSchema<table>",group:"Table"});k(j.ctx,{displayName:"NodeSchemaCtx<table>",group:"Table"});var ge=q("table_header_row",()=>({...me.table_row,disableDropCursor:!0,content:"(table_header)*",parseDOM:[{tag:"tr[data-is-header]"},{tag:"tr",getAttrs:e=>e instanceof HTMLElement&&e.querySelector("th")?{}:!1}],toDOM(){return["tr",{"data-is-header":!0},0]},parseMarkdown:{match:e=>!!(e.type==="tableRow"&&e.isHeader),runner:(e,t,n)=>{let o=t.align,r=t.children.map((i,l)=>({...i,align:o[l],isHeader:t.isHeader}));e.openNode(n),e.next(r),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="table_header_row",runner:(e,t)=>{t.content.size!==0&&(e.openNode("tableRow",void 0,{isHeader:!0}),e.next(t.content),e.closeNode())}}}));k(ge.node,{displayName:"NodeSchema<tableHeaderRow>",group:"Table"});k(ge.ctx,{displayName:"NodeSchemaCtx<tableHeaderRow>",group:"Table"});var ce=q("table_row",()=>({...me.table_row,disableDropCursor:!0,content:"(table_cell)*",parseMarkdown:{match:e=>e.type==="tableRow",runner:(e,t,n)=>{let o=t.align,r=t.children.map((i,l)=>({...i,align:o[l]}));e.openNode(n),e.next(r),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="table_row",runner:(e,t)=>{t.content.size!==0&&(e.openNode("tableRow"),e.next(t.content),e.closeNode())}}}));k(ce.node,{displayName:"NodeSchema<tableRow>",group:"Table"});k(ce.ctx,{displayName:"NodeSchemaCtx<tableRow>",group:"Table"});var we=q("table_cell",()=>({...me.table_cell,disableDropCursor:!0,parseMarkdown:{match:e=>e.type==="tableCell"&&!e.isHeader,runner:(e,t,n)=>{let o=t.align;e.openNode(n,{alignment:o}).openNode(e.schema.nodes.paragraph).next(t.children).closeNode().closeNode()}},toMarkdown:{match:e=>e.type.name==="table_cell",runner:(e,t)=>{e.openNode("tableCell").next(t.content).closeNode()}}}));k(we.node,{displayName:"NodeSchema<tableCell>",group:"Table"});k(we.ctx,{displayName:"NodeSchemaCtx<tableCell>",group:"Table"});var se=q("table_header",()=>({...me.table_header,disableDropCursor:!0,parseMarkdown:{match:e=>e.type==="tableCell"&&!!e.isHeader,runner:(e,t,n)=>{let o=t.align;e.openNode(n,{alignment:o}),e.openNode(e.schema.nodes.paragraph),e.next(t.children),e.closeNode(),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="table_header",runner:(e,t)=>{e.openNode("tableCell"),e.next(t.content),e.closeNode()}}}));k(se.node,{displayName:"NodeSchema<tableHeader>",group:"Table"});k(se.ctx,{displayName:"NodeSchemaCtx<tableHeader>",group:"Table"});function lo(e,t=3,n=3){let o=Array(n).fill(0).map(()=>we.type(e).createAndFill()),r=Array(n).fill(0).map(()=>se.type(e).createAndFill()),i=Array(t).fill(0).map((l,s)=>s===0?ge.type(e).create(null,r):ce.type(e).create(null,o));return j.type(e).create(null,i)}function es(e,t){let n=X(t.$from);if(!n)return;let o=x.get(n.node);return(Array.isArray(e)?e:[e]).filter(r=>r>=0&&r<=o.width-1).flatMap(r=>o.cellsInRect({left:r,right:r+1,top:0,bottom:o.height}).map(i=>{let l=n.node.nodeAt(i),s=i+n.start;return{pos:s,start:s+1,node:l,depth:n.depth+2}}))}function ts(e,t){let n=X(t.$from);if(!n)return;let o=x.get(n.node);return(Array.isArray(e)?e:[e]).filter(r=>r>=0&&r<=o.height-1).flatMap(r=>o.cellsInRect({left:0,right:o.width,top:r,bottom:r+1}).map(i=>{let l=n.node.nodeAt(i),s=i+n.start;return{pos:s,start:s+1,node:l,depth:n.depth+2}}))}function io(e){return(t,n)=>o=>{n=n??o.selection.from;let r=o.doc.resolve(n),i=Xt(a=>a.type.name==="table")(r),l=i?{node:i.node,from:i.start}:void 0,s=e==="row";if(l){let a=x.get(l.node);if(t>=0&&t<(s?a.height:a.width)){let c=a.positionAt(s?t:a.height-1,s?a.width-1:t,l.node),f=o.doc.resolve(l.from+c),u=s?A.rowSelection:A.colSelection,p=a.positionAt(s?t:0,s?0:t,l.node),h=o.doc.resolve(l.from+p);return _e(o.setSelection(u(f,h)))}}return o}}var Ll=io("row"),El=io("col");function ao(e,t,{map:n,tableStart:o,table:r},i){let l=Array(i).fill(0).reduce((a,c,f)=>a+r.child(f).nodeSize,o),s=Array(n.width).fill(0).map((a,c)=>{let f=r.nodeAt(n.map[c]);return we.type(e).createAndFill({alignment:f?.attrs.alignment})});return t.insert(l,ce.type(e).create(null,s)),t}function Il(e){let t=X(e.$from);if(!t)return;let n=x.get(t.node);return n.cellsInRect({left:0,right:n.width,top:0,bottom:n.height}).map(o=>{let r=t.node.nodeAt(o),i=o+t.start;return{pos:i,start:i+1,node:r}})}function _l(e){let t=Il(e.selection);if(t&&t[0]){let n=e.doc.resolve(t[0].pos),o=t[t.length-1];if(o){let r=e.doc.resolve(o.pos);return _e(e.setSelection(new A(r,n)))}}return e}var Tt=N("GoToPrevTableCell",()=>()=>Ge(-1));k(Tt,{displayName:"Command<goToPrevTableCellCommand>",group:"Table"});var vt=N("GoToNextTableCell",()=>()=>Ge(1));k(vt,{displayName:"Command<goToNextTableCellCommand>",group:"Table"});var Mt=N("ExitTable",e=>()=>(t,n)=>{if(!L(t))return!1;let{$head:o}=t.selection,r=Ut(o,j.type(e));if(!r)return!1;let{to:i}=r,l=t.tr.replaceWith(i,i,Se.type(e).createAndFill());return l.setSelection(F.near(l.doc.resolve(i),1)).scrollIntoView(),n?.(l),!0});k(Mt,{displayName:"Command<breakTableCommand>",group:"Table"});var so=N("InsertTable",e=>({row:t,col:n}={})=>(o,r)=>{let{selection:i,tr:l}=o,{from:s}=i,a=lo(e,t,n),c=l.replaceSelectionWith(a),f=F.findFrom(c.doc.resolve(s),1,!0);return f&&c.setSelection(f),r?.(c),!0});k(so,{displayName:"Command<insertTableCommand>",group:"Table"});var co=N("MoveRow",()=>({from:e,to:t,pos:n}={})=>Dn({from:e??0,to:t??0,pos:n}));k(co,{displayName:"Command<moveRowCommand>",group:"Table"});var uo=N("MoveCol",()=>({from:e,to:t,pos:n}={})=>Fn({from:e??0,to:t??0,pos:n}));k(uo,{displayName:"Command<moveColCommand>",group:"Table"});var fo=N("SelectRow",()=>(e={index:0})=>(t,n)=>{let{tr:o}=t;return!!n?.(Ll(e.index,e.pos)(o))});k(fo,{displayName:"Command<selectRowCommand>",group:"Table"});var po=N("SelectCol",()=>(e={index:0})=>(t,n)=>{let{tr:o}=t;return!!n?.(El(e.index,e.pos)(o))});k(po,{displayName:"Command<selectColCommand>",group:"Table"});var ho=N("SelectTable",()=>()=>(e,t)=>{let{tr:n}=e;return!!t?.(_l(n))});k(ho,{displayName:"Command<selectTableCommand>",group:"Table"});var mo=N("DeleteSelectedCells",()=>()=>(e,t)=>{let{selection:n}=e;if(!(n instanceof A))return!1;let o=n.isRowSelection(),r=n.isColSelection();return o&&r?Nn(e,t):r?Tn(e,t):vn(e,t)});k(mo,{displayName:"Command<deleteSelectedCellsCommand>",group:"Table"});var go=N("AddColBefore",()=>()=>An);k(go,{displayName:"Command<addColBeforeCommand>",group:"Table"});var wo=N("AddColAfter",()=>()=>Rn);k(wo,{displayName:"Command<addColAfterCommand>",group:"Table"});var bo=N("AddRowBefore",e=>()=>(t,n)=>{if(!L(t))return!1;if(n){let o=H(t);n(ao(e,t.tr,o,o.top))}return!0});k(bo,{displayName:"Command<addRowBeforeCommand>",group:"Table"});var ko=N("AddRowAfter",e=>()=>(t,n)=>{if(!L(t))return!1;if(n){let o=H(t);n(ao(e,t.tr,o,o.bottom))}return!0});k(ko,{displayName:"Command<addRowAfterCommand>",group:"Table"});var Co=N("SetAlign",()=>(e="left")=>Mn("alignment",e));k(Co,{displayName:"Command<setAlignCommand>",group:"Table"});var yo=xe(e=>new Ie(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,(t,n,o,r)=>{let i=t.doc.resolve(o);if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),j.type(e)))return null;let l=lo(e,Math.max(Number(n.groups?.row??0),2),Number(n.groups?.col)),s=t.tr.replaceRangeWith(o,r,l);return s.setSelection(P.create(s.doc,o+3)).scrollIntoView()}));k(yo,{displayName:"InputRule<insertTableInputRule>",group:"Table"});var xo=Yt(e=>({run:(t,n,o)=>{if(o)return t;function r(c){let f=c.childCount,u=c.lastChild?.childCount??0;if(f===0||u===0)return Se.type(e).create();let p=c.firstChild;if(!(u>0&&p&&p.childCount===0))return c;if(f>=3){let b=c.child(1),g=[];for(let R=0;R<b.childCount;R++){let S=b.child(R);g.push(se.type(e).create(S.attrs,S.content,S.marks))}let C=p.type.create(p.attrs,g),y=[];for(let R=2;R<f;R++)y.push(c.child(R));return c.type.create(c.attrs,[C,...y])}let h=Array(u).fill(0).map(()=>se.type(e).createAndFill()),d=new D(M.from(h),0,0),w=p.replace(0,0,d);return c.replace(0,p.nodeSize,new D(M.from(w),0,0))}function i(c){let f=ce.type(e),u=[],p=[],h=!1;function d(){if(p.length===0)return;let w=ge.type(e).createAndFill(),b=j.type(e).create(null,[w,...p]);u.push(r(b)),p=[]}return c.forEach(w=>{w.type===f?(h=!0,p.push(w)):(d(),u.push(w))}),d(),h?M.from(u):c}function l(c){let f=i(c),u=f!==c,p=[];return f.forEach(h=>{if(h.type===j.type(e)){let d=r(h);d!==h&&(u=!0),p.push(d)}else if(h.childCount>0){let d=l(h.content);d!==h.content?(u=!0,p.push(h.copy(d))):p.push(h)}else p.push(h)}),u?M.from(p):c}function s(c){let f=[],u=[];c.forEach(p=>u.push(p));for(let p=0;p<u.length;p++){let h=u[p],d=u[p+1];h.type===Se.type(e)&&h.content.size===0&&d&&d.type===j.type(e)||f.push(h)}return f.length<u.length?M.from(f):c}let a=l(t.content);return a=s(a),new D(M.from(a),t.openStart,t.openEnd)}}));k(xo,{displayName:"PasteRule<table>",group:"Table"});var Nt=Pe("tableKeymap",{NextCell:{priority:100,shortcuts:["Mod-]","Tab"],command:e=>{let t=e.get(pe);return()=>t.call(vt.key)}},PrevCell:{shortcuts:["Mod-[","Shift-Tab"],command:e=>{let t=e.get(pe);return()=>t.call(Tt.key)}},ExitTable:{shortcuts:["Mod-Enter","Enter"],command:e=>{let t=e.get(pe);return()=>t.call(Mt.key)}}});k(Nt.ctx,{displayName:"KeymapCtx<table>",group:"Table"});k(Nt.shortcuts,{displayName:"Keymap<table>",group:"Table"});var yt="footnote_definition",oo="footnoteDefinition",Dt=q("footnote_definition",()=>({group:"block",content:"block+",defining:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`dl[data-type="${yt}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw be(e);return{label:e.dataset.label}},contentElement:"dd"}],toDOM:e=>{let t=e.attrs.label;return["dl",{"data-label":t,"data-type":yt},["dt",t],["dd",0]]},parseMarkdown:{match:({type:e})=>e===oo,runner:(e,t,n)=>{e.openNode(n,{label:t.label}).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name===yt,runner:(e,t)=>{e.openNode(oo,void 0,{label:t.attrs.label,identifier:t.attrs.label}).next(t.content).closeNode()}}}));k(Dt.ctx,{displayName:"NodeSchemaCtx<footnodeDef>",group:"footnote"});k(Dt.node,{displayName:"NodeSchema<footnodeDef>",group:"footnote"});var xt="footnote_reference",Ft=q("footnote_reference",()=>({group:"inline",inline:!0,atom:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`sup[data-type="${xt}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw be(e);return{label:e.dataset.label}}}],toDOM:e=>{let t=e.attrs.label;return["sup",{"data-label":t,"data-type":xt},t]},parseMarkdown:{match:({type:e})=>e==="footnoteReference",runner:(e,t,n)=>{e.addNode(n,{label:t.label})}},toMarkdown:{match:e=>e.type.name===xt,runner:(e,t)=>{e.addNode("footnoteReference",void 0,void 0,{label:t.attrs.label,identifier:t.attrs.label})}}}));k(Ft.ctx,{displayName:"NodeSchemaCtx<footnodeRef>",group:"footnote"});k(Ft.node,{displayName:"NodeSchema<footnodeRef>",group:"footnote"});var zt=tn.extendSchema(e=>t=>{let n=e(t);return{...n,attrs:{...n.attrs,checked:{default:null,validate:"boolean|null"}},parseDOM:[{tag:'li[data-item-type="task"]',getAttrs:o=>{if(!(o instanceof HTMLElement))throw be(o);return{label:o.dataset.label,listType:o.dataset.listType,spread:o.dataset.spread==="true",checked:o.dataset.checked?o.dataset.checked==="true":null}}},...n?.parseDOM||[]],toDOM:o=>n.toDOM&&o.attrs.checked==null?n.toDOM(o):["li",{"data-item-type":"task","data-label":o.attrs.label,"data-list-type":o.attrs.listType,"data-spread":o.attrs.spread,"data-checked":o.attrs.checked},0],parseMarkdown:{match:({type:o})=>o==="listItem",runner:(o,r,i)=>{if(r.checked==null){n.parseMarkdown.runner(o,r,i);return}let l=r.label!=null?`${r.label}.`:"\u2022",s=r.checked!=null?!!r.checked:null,a=r.label!=null?"ordered":"bullet",c=r.spread??!0;o.openNode(i,{label:l,listType:a,spread:c,checked:s}),o.next(r.children),o.closeNode()}},toMarkdown:{match:o=>o.type.name==="list_item",runner:(o,r)=>{if(r.attrs.checked==null){n.toMarkdown.runner(o,r);return}let i=r.attrs.label,l=r.attrs.listType,s=r.attrs.spread,a=r.attrs.checked;o.openNode("listItem",void 0,{label:i,listType:l,spread:s,checked:a}),o.next(r.content),o.closeNode()}}}});k(zt.node,{displayName:"NodeSchema<taskListItem>",group:"ListItem"});k(zt.ctx,{displayName:"NodeSchemaCtx<taskListItem>",group:"ListItem"});var So=xe(()=>new Ie(/^\[(?<checked>\s|x)\]\s$/,(e,t,n,o)=>{let r=e.doc.resolve(n),i=0,l=r.node(i);for(;l&&l.type.name!=="list_item";)i--,l=r.node(i);if(!l||l.attrs.checked!=null)return null;let s=t.groups?.checked==="x",a=r.before(i),c=e.tr;return c.deleteRange(n,o).setNodeMarkup(a,void 0,{...l.attrs,checked:s}),c}));k(So,{displayName:"InputRule<wrapInTaskListInputRule>",group:"ListItem"});var Pl=[Rt,Nt].flat(),Ol=[yo,So],$l=[ro],Hl=[xo],Ao=de(()=>Pn);k(Ao,{displayName:"Prose<autoInsertSpanPlugin>",group:"Prose"});var Bl=de(()=>Ln({}));k(Bl,{displayName:"Prose<columnResizingPlugin>",group:"Prose"});var Ro=de(()=>In({allowTableNodeSelection:!0}));k(Ro,{displayName:"Prose<tableEditingPlugin>",group:"Prose"});var Lt=en("remarkGFM",()=>Le);k(Lt.plugin,{displayName:"Remark<remarkGFMPlugin>",group:"Remark"});k(Lt.options,{displayName:"RemarkConfig<remarkGFMPlugin>",group:"Remark"});var jl=new G("MILKDOWN_KEEP_TABLE_ALIGN_PLUGIN");function Wl(e,t){let n=0;return t.forEach((o,r,i)=>{o===e&&(n=i)}),n}function Kl(e,t){let n=e.content.findDiffStart(t.content);if(n==null)return null;let o=e.content.findDiffEnd(t.content);return o?{from:n,to:Math.max(o.b,n)}:null}var To=de(()=>new Z({key:jl,appendTransaction:(e,t,n)=>{if(t.doc===n.doc)return;let o=Kl(t.doc,n.doc);if(!o)return;let r,i=(l,s)=>{if(l.type.name!=="table_cell")return;let a=n.doc.resolve(s),c=a.node(a.depth),f=a.node(a.depth-1).firstChild;if(!f)return;let u=Wl(l,c),p=f.maybeChild(u);if(!p)return;let h=p.attrs.alignment;h!==l.attrs.alignment&&(r||(r=n.tr),r.setNodeMarkup(s,void 0,{...l.attrs,alignment:h}))};return n.doc.nodesBetween(o.from,o.to,(l,s)=>l.type.name!=="table"?!0:(n.doc.nodesBetween(s,s+l.nodeSize,i),!1)),r}}));k(To,{displayName:"Prose<keepTableAlignPlugin>",group:"Prose"});var Vl=[To,Ao,Lt,Ro].flat(),Gl=[zt,j,ge,ce,se,we,Dt,Ft,St,he].flat(),ql=[vt,Tt,Mt,so,co,uo,fo,po,ho,mo,bo,ko,go,wo,Co,At],ns=[Gl,Ol,Hl,$l,Pl,ql,Vl].flat();export{wo as addColAfterCommand,go as addColBeforeCommand,ko as addRowAfterCommand,bo as addRowBeforeCommand,ao as addRowWithAlignment,Ao as autoInsertSpanPlugin,Bl as columnResizingPlugin,ql as commands,lo as createTable,mo as deleteSelectedCellsCommand,Mt as exitTable,zt as extendListItemSchemaForTask,Dt as footnoteDefinitionSchema,Ft as footnoteReferenceSchema,Il as getAllCellsInTable,es as getCellsInCol,ts as getCellsInRow,ns as gfm,vt as goToNextTableCellCommand,Tt as goToPrevTableCellCommand,Ol as inputRules,so as insertTableCommand,yo as insertTableInputRule,To as keepTableAlignPlugin,Pl as keymap,$l as markInputRules,uo as moveColCommand,co as moveRowCommand,Hl as pasteRules,Vl as plugins,Lt as remarkGFMPlugin,Gl as schema,El as selectCol,po as selectColCommand,io as selectLine,Ll as selectRow,fo as selectRowCommand,_l as selectTable,ho as selectTableCommand,Co as setAlignCommand,St as strikethroughAttr,ro as strikethroughInputRule,Rt as strikethroughKeymap,he as strikethroughSchema,we as tableCellSchema,Ro as tableEditingPlugin,ge as tableHeaderRowSchema,se as tableHeaderSchema,Nt as tableKeymap,xo as tablePasteRule,ce as tableRowSchema,j as tableSchema,At as toggleStrikethroughCommand,So as wrapInTaskListInputRule};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as h,b as p,c as l}from"./chunk-HKUJH2VC.js";import{a as m,e as n,g as y,j as c}from"./chunk-GF2LJCG5.js";import{la as a}from"./chunk-P3WV3MLS.js";import"./chunk-EAFZBBCI.js";import"./chunk-23NN352E.js";function r(o,t){return Object.assign(o,{meta:{package:"@milkdown/plugin-history",...t}}),o}var e=m("Undo",()=>()=>p);r(e,{displayName:"Command<undo>"});var i=m("Redo",()=>()=>l);r(i,{displayName:"Command<redo>"});var d=y({},"historyProviderConfig");r(d,{displayName:"Ctx<historyProviderConfig>"});var u=n(o=>h(o.get(d.key)));r(u,{displayName:"Ctx<historyProviderPlugin>"});var s=c("historyKeymap",{Undo:{shortcuts:"Mod-z",command:o=>{let t=o.get(a);return()=>t.call(e.key)}},Redo:{shortcuts:["Mod-y","Shift-Mod-z"],command:o=>{let t=o.get(a);return()=>t.call(i.key)}}});r(s.ctx,{displayName:"KeymapCtx<history>"});r(s.shortcuts,{displayName:"Keymap<history>"});var g=[d,u,s,e,i].flat();export{g as history,s as historyKeymap,d as historyProviderConfig,u as historyProviderPlugin,i as redoCommand,e as undoCommand};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as s,g as f}from"./chunk-GF2LJCG5.js";import"./chunk-P3WV3MLS.js";import{t as c,v as d}from"./chunk-EAFZBBCI.js";import"./chunk-23NN352E.js";function p(n,e){let{doc:o,selection:t}=n;if(!o||!t||!(t instanceof c||t instanceof d))return n;let{to:r}=t,i=e.type==="space"?Array(e.size).fill(" ").join(""):" ";return n.insertText(i,r)}var a=f({type:"space",size:2},"indentConfig");a.meta={package:"@milkdown/plugin-indent",displayName:"Ctx<indentConfig>"};var l=s(n=>({Tab:(e,o)=>{let t=n.get(a.key),{tr:r}=e,i=p(r,t);return i.docChanged?(o?.(i),!0):!1}}));l.meta={package:"@milkdown/plugin-indent",displayName:"Shortcut<indent>"};var m=[a,l];export{m as indent,a as indentConfig,l as indentPlugin};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as R,b as j,c as E,d as L,e as X,f as Y,h as z,i as B,j as b,m as V}from"./chunk-KX3KYRT7.js";import"./chunk-XLIC2WFB.js";import{la as U,na as A}from"./chunk-SGGMD6DA.js";import{Ga as N,Ma as T,Q as F,V as y,d,e as w,f as K,fa as C,g as x,va as M}from"./chunk-P3WV3MLS.js";import{L as k,x as D,y as O}from"./chunk-EAFZBBCI.js";import{f as e,g as a,h as l,i as g}from"./chunk-23NN352E.js";var I=new O("MILKDOWN_COLLAB_KEYMAP"),Z=[I,R,E,j],c,o,m,s,h,n,q,G,v,H,W=(H=class{constructor(){a(this,n);a(this,c,{});a(this,o,null);a(this,m,null);a(this,s,null);a(this,h,!1)}bindCtx(t){return l(this,s,t),this}bindDoc(t){return l(this,o,t.getXmlFragment("prosemirror")),this}bindXmlFragment(t){return l(this,o,t),this}setOptions(t){return l(this,c,t),this}mergeOptions(t){return Object.assign(e(this,c),t),this}setAwareness(t){return l(this,m,t),this}applyTemplate(t,i){if(!e(this,s))throw d();if(!e(this,o))throw w();let r=i||(u=>u.textContent.length===0),p=g(this,n,q).call(this,t),f=e(this,s).get(C),J=X(e(this,o),f);if(p&&r(J,p)){let u=e(this,o);u.delete(0,u.length);let S=Y(p),Q=A(S);u.doc&&U(u.doc,Q),S.destroy()}return this}connect(){if(!e(this,s))throw d();if(e(this,h))return;let t=e(this,s).get(y),i=g(this,n,G).call(this),r=t.concat(i);return g(this,n,v).call(this,r),l(this,h,!0),this}disconnect(){if(!e(this,s))throw d();if(!e(this,h))return this;let t=e(this,s).get(y).filter(i=>!i.spec.key||!Z.includes(i.spec.key));return g(this,n,v).call(this,t),l(this,h,!1),this}},c=new WeakMap,o=new WeakMap,m=new WeakMap,s=new WeakMap,h=new WeakMap,n=new WeakSet,q=function(t){if(!e(this,s))throw d();let i=e(this,s).get(C),r=e(this,s).get(M);return N(t,r,i)},G=function(){if(!e(this,o))throw w();let{ySyncOpts:t,yUndoOpts:i}=e(this,c),r=[L(e(this,o),t),V(i),new D({key:I,props:{handleKeyDown:k({"Mod-z":B,"Mod-y":b,"Mod-Shift-z":b})}})];if(e(this,m)){let{yCursorOpts:p,yCursorStateField:f}=e(this,c);r.push(z(e(this,m),p,f))}return r},v=function(t){if(!e(this,s))throw d();e(this,s).set(y,t);let i=e(this,s).get(F),r=i.state.reconfigure({plugins:t});i.updateState(r)},H),_=K(new W,"collabServiceCtx"),P=x("CollabReady"),$=t=>{let i=new W;return t.inject(_,i).record(P),async()=>(await t.wait(T),i.bindCtx(t),t.done(P),()=>{t.remove(_).clearTimer(P)})};$.meta={package:"@milkdown/plugin-collab",displayName:"Collab"};export{I as CollabKeymapPluginKey,P as CollabReady,W as CollabService,$ as collab,_ as collabServiceCtx};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as b}from"./chunk-OESZ7FEN.js";import{Aa as w,Ma as y,V as f,ba as L,f as h,ya as m}from"./chunk-P3WV3MLS.js";import{x as p,y as c}from"./chunk-EAFZBBCI.js";import"./chunk-23NN352E.js";var k=class{constructor(){this.beforeMountedListeners=[],this.mountedListeners=[],this.updatedListeners=[],this.selectionUpdatedListeners=[],this.markdownUpdatedListeners=[],this.blurListeners=[],this.focusListeners=[],this.destroyListeners=[],this.beforeMount=e=>(this.beforeMountedListeners.push(e),this),this.mounted=e=>(this.mountedListeners.push(e),this),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,selectionUpdated:this.selectionUpdatedListeners}}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}selectionUpdated(e){return this.selectionUpdatedListeners.push(e),this}},g=h(new k,"listener"),E=new c("MILKDOWN_LISTENER"),M=e=>(e.inject(g,new k),async()=>{await e.wait(L);let{listeners:r}=e.get(g);r.beforeMount.forEach(t=>t(e)),await e.wait(m);let u=e.get(w),n=null,d=null,i=null,o=null,l=b(()=>{if(!o)return;let{doc:t}=o;if(r.updated.length>0&&n&&!n.eq(t)&&r.updated.forEach(s=>{s(e,t,n)}),r.markdownUpdated.length>0&&n&&!n.eq(t)){let s=u(t);r.markdownUpdated.forEach(a=>{a(e,s,d)}),d=s}n=t,o=null},200),U=new p({key:E,view:()=>({destroy:()=>{l.cancel(),r.destroy.forEach(t=>t(e))}}),props:{handleDOMEvents:{focus:()=>(r.focus.forEach(t=>t(e)),!1),blur:()=>(r.blur.forEach(t=>t(e)),!1)}},state:{init:(t,s)=>{n=s.doc,d=u(s.doc)},apply:t=>{let s=t.selection;(!i&&s||i&&!s.eq(i))&&(r.selectionUpdated.forEach(a=>{a(e,s,i)}),i=s),!(!(t.docChanged||t.storedMarksSet)||t.getMeta("addToHistory")===!1)&&(o=t,l())}}});e.update(f,t=>t.concat(U)),await e.wait(y),r.mounted.forEach(t=>t(e))});M.meta={package:"@milkdown/plugin-listener",displayName:"Listener"};export{k as ListenerManager,E as key,M as listener,g as listenerCtx};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* marked v15.0.12 - a markdown parser
|
|
3
|
+
* Copyright (c) 2011-2025, Christopher Jeffrey. (MIT Licensed)
|
|
4
|
+
* https://github.com/markedjs/marked
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* DO NOT EDIT THIS FILE
|
|
9
|
+
* The code in this file is generated from files in ./src/
|
|
10
|
+
*/
|
|
11
|
+
(function(g,f){if(typeof exports=="object"&&typeof module<"u"){module.exports=f()}else if("function"==typeof define && define.amd){define("marked",f)}else {g["marked"]=f()}}(typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : this,function(){var exports={};var __exports=exports;var module={exports};
|
|
12
|
+
"use strict";var H=Object.defineProperty;var be=Object.getOwnPropertyDescriptor;var Te=Object.getOwnPropertyNames;var we=Object.prototype.hasOwnProperty;var ye=(l,e)=>{for(var t in e)H(l,t,{get:e[t],enumerable:!0})},Re=(l,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Te(e))!we.call(l,s)&&s!==t&&H(l,s,{get:()=>e[s],enumerable:!(n=be(e,s))||n.enumerable});return l};var Se=l=>Re(H({},"__esModule",{value:!0}),l);var kt={};ye(kt,{Hooks:()=>L,Lexer:()=>x,Marked:()=>E,Parser:()=>b,Renderer:()=>$,TextRenderer:()=>_,Tokenizer:()=>S,defaults:()=>w,getDefaults:()=>z,lexer:()=>ht,marked:()=>k,options:()=>it,parse:()=>pt,parseInline:()=>ct,parser:()=>ut,setOptions:()=>ot,use:()=>lt,walkTokens:()=>at});module.exports=Se(kt);function z(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var w=z();function N(l){w=l}var I={exec:()=>null};function h(l,e=""){let t=typeof l=="string"?l:l.source,n={replace:(s,i)=>{let r=typeof i=="string"?i:i.source;return r=r.replace(m.caret,"$1"),t=t.replace(s,r),n},getRegex:()=>new RegExp(t,e)};return n}var m={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:l=>new RegExp(`^( {0,3}${l})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:l=>new RegExp(`^ {0,${Math.min(3,l-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:l=>new RegExp(`^ {0,${Math.min(3,l-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:l=>new RegExp(`^ {0,${Math.min(3,l-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:l=>new RegExp(`^ {0,${Math.min(3,l-1)}}#`),htmlBeginRegex:l=>new RegExp(`^ {0,${Math.min(3,l-1)}}<(?:[a-z].*>|!--)`,"i")},$e=/^(?:[ \t]*(?:\n|$))+/,_e=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Le=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,O=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ze=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,F=/(?:[*+-]|\d{1,9}[.)])/,ie=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,oe=h(ie).replace(/bull/g,F).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Me=h(ie).replace(/bull/g,F).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Q=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Pe=/^[^\n]+/,U=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Ae=h(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",U).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ee=h(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,F).getRegex(),v="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",K=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ce=h("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",K).replace("tag",v).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),le=h(Q).replace("hr",O).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",v).getRegex(),Ie=h(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",le).getRegex(),X={blockquote:Ie,code:_e,def:Ae,fences:Le,heading:ze,hr:O,html:Ce,lheading:oe,list:Ee,newline:$e,paragraph:le,table:I,text:Pe},re=h("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",O).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",v).getRegex(),Oe={...X,lheading:Me,table:re,paragraph:h(Q).replace("hr",O).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",re).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",v).getRegex()},Be={...X,html:h(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",K).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:I,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:h(Q).replace("hr",O).replace("heading",` *#{1,6} *[^
|
|
13
|
+
]`).replace("lheading",oe).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},qe=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ve=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ae=/^( {2,}|\\)\n(?!\s*$)/,De=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,D=/[\p{P}\p{S}]/u,W=/[\s\p{P}\p{S}]/u,ce=/[^\s\p{P}\p{S}]/u,Ze=h(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,W).getRegex(),pe=/(?!~)[\p{P}\p{S}]/u,Ge=/(?!~)[\s\p{P}\p{S}]/u,He=/(?:[^\s\p{P}\p{S}]|~)/u,Ne=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,ue=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,je=h(ue,"u").replace(/punct/g,D).getRegex(),Fe=h(ue,"u").replace(/punct/g,pe).getRegex(),he="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Qe=h(he,"gu").replace(/notPunctSpace/g,ce).replace(/punctSpace/g,W).replace(/punct/g,D).getRegex(),Ue=h(he,"gu").replace(/notPunctSpace/g,He).replace(/punctSpace/g,Ge).replace(/punct/g,pe).getRegex(),Ke=h("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ce).replace(/punctSpace/g,W).replace(/punct/g,D).getRegex(),Xe=h(/\\(punct)/,"gu").replace(/punct/g,D).getRegex(),We=h(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Je=h(K).replace("(?:-->|$)","-->").getRegex(),Ve=h("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Je).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),q=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Ye=h(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",q).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ke=h(/^!?\[(label)\]\[(ref)\]/).replace("label",q).replace("ref",U).getRegex(),ge=h(/^!?\[(ref)\](?:\[\])?/).replace("ref",U).getRegex(),et=h("reflink|nolink(?!\\()","g").replace("reflink",ke).replace("nolink",ge).getRegex(),J={_backpedal:I,anyPunctuation:Xe,autolink:We,blockSkip:Ne,br:ae,code:ve,del:I,emStrongLDelim:je,emStrongRDelimAst:Qe,emStrongRDelimUnd:Ke,escape:qe,link:Ye,nolink:ge,punctuation:Ze,reflink:ke,reflinkSearch:et,tag:Ve,text:De,url:I},tt={...J,link:h(/^!?\[(label)\]\((.*?)\)/).replace("label",q).getRegex(),reflink:h(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",q).getRegex()},j={...J,emStrongRDelimAst:Ue,emStrongLDelim:Fe,url:h(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},nt={...j,br:h(ae).replace("{2,}","*").getRegex(),text:h(j.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},B={normal:X,gfm:Oe,pedantic:Be},P={normal:J,gfm:j,breaks:nt,pedantic:tt};var st={"&":"&","<":"<",">":">",'"':""","'":"'"},fe=l=>st[l];function R(l,e){if(e){if(m.escapeTest.test(l))return l.replace(m.escapeReplace,fe)}else if(m.escapeTestNoEncode.test(l))return l.replace(m.escapeReplaceNoEncode,fe);return l}function V(l){try{l=encodeURI(l).replace(m.percentDecode,"%")}catch{return null}return l}function Y(l,e){let t=l.replace(m.findPipe,(i,r,o)=>{let a=!1,c=r;for(;--c>=0&&o[c]==="\\";)a=!a;return a?"|":" |"}),n=t.split(m.splitPipe),s=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;s<n.length;s++)n[s]=n[s].trim().replace(m.slashPipe,"|");return n}function A(l,e,t){let n=l.length;if(n===0)return"";let s=0;for(;s<n;){let i=l.charAt(n-s-1);if(i===e&&!t)s++;else if(i!==e&&t)s++;else break}return l.slice(0,n-s)}function de(l,e){if(l.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<l.length;n++)if(l[n]==="\\")n++;else if(l[n]===e[0])t++;else if(l[n]===e[1]&&(t--,t<0))return n;return t>0?-2:-1}function me(l,e,t,n,s){let i=e.href,r=e.title||null,o=l[1].replace(s.other.outputLinkReplace,"$1");n.state.inLink=!0;let a={type:l[0].charAt(0)==="!"?"image":"link",raw:t,href:i,title:r,text:o,tokens:n.inlineTokens(o)};return n.state.inLink=!1,a}function rt(l,e,t){let n=l.match(t.other.indentCodeCompensation);if(n===null)return e;let s=n[1];return e.split(`
|
|
14
|
+
`).map(i=>{let r=i.match(t.other.beginningSpace);if(r===null)return i;let[o]=r;return o.length>=s.length?i.slice(s.length):i}).join(`
|
|
15
|
+
`)}var S=class{options;rules;lexer;constructor(e){this.options=e||w}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:A(n,`
|
|
16
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],s=rt(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let s=A(n,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(n=s.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:A(t[0],`
|
|
17
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=A(t[0],`
|
|
18
|
+
`).split(`
|
|
19
|
+
`),s="",i="",r=[];for(;n.length>0;){let o=!1,a=[],c;for(c=0;c<n.length;c++)if(this.rules.other.blockquoteStart.test(n[c]))a.push(n[c]),o=!0;else if(!o)a.push(n[c]);else break;n=n.slice(c);let p=a.join(`
|
|
20
|
+
`),u=p.replace(this.rules.other.blockquoteSetextReplace,`
|
|
21
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
|
22
|
+
${p}`:p,i=i?`${i}
|
|
23
|
+
${u}`:u;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,r,!0),this.lexer.state.top=d,n.length===0)break;let g=r.at(-1);if(g?.type==="code")break;if(g?.type==="blockquote"){let T=g,f=T.raw+`
|
|
24
|
+
`+n.join(`
|
|
25
|
+
`),y=this.blockquote(f);r[r.length-1]=y,s=s.substring(0,s.length-T.raw.length)+y.raw,i=i.substring(0,i.length-T.text.length)+y.text;break}else if(g?.type==="list"){let T=g,f=T.raw+`
|
|
26
|
+
`+n.join(`
|
|
27
|
+
`),y=this.list(f);r[r.length-1]=y,s=s.substring(0,s.length-g.raw.length)+y.raw,i=i.substring(0,i.length-T.raw.length)+y.raw,n=f.substring(r.at(-1).raw.length).split(`
|
|
28
|
+
`);continue}}return{type:"blockquote",raw:s,tokens:r,text:i}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),s=n.length>1,i={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");let r=this.rules.other.listItemRegex(n),o=!1;for(;e;){let c=!1,p="",u="";if(!(t=r.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let d=t[2].split(`
|
|
29
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,Z=>" ".repeat(3*Z.length)),g=e.split(`
|
|
30
|
+
`,1)[0],T=!d.trim(),f=0;if(this.options.pedantic?(f=2,u=d.trimStart()):T?f=t[1].length+1:(f=t[2].search(this.rules.other.nonSpaceChar),f=f>4?1:f,u=d.slice(f),f+=t[1].length),T&&this.rules.other.blankLine.test(g)&&(p+=g+`
|
|
31
|
+
`,e=e.substring(g.length+1),c=!0),!c){let Z=this.rules.other.nextBulletRegex(f),te=this.rules.other.hrRegex(f),ne=this.rules.other.fencesBeginRegex(f),se=this.rules.other.headingBeginRegex(f),xe=this.rules.other.htmlBeginRegex(f);for(;e;){let G=e.split(`
|
|
32
|
+
`,1)[0],C;if(g=G,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),C=g):C=g.replace(this.rules.other.tabCharGlobal," "),ne.test(g)||se.test(g)||xe.test(g)||Z.test(g)||te.test(g))break;if(C.search(this.rules.other.nonSpaceChar)>=f||!g.trim())u+=`
|
|
33
|
+
`+C.slice(f);else{if(T||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||ne.test(d)||se.test(d)||te.test(d))break;u+=`
|
|
34
|
+
`+g}!T&&!g.trim()&&(T=!0),p+=G+`
|
|
35
|
+
`,e=e.substring(G.length+1),d=C.slice(f)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(o=!0));let y=null,ee;this.options.gfm&&(y=this.rules.other.listIsTask.exec(u),y&&(ee=y[0]!=="[ ] ",u=u.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:p,task:!!y,checked:ee,loose:!1,text:u,tokens:[]}),i.raw+=p}let a=i.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let c=0;c<i.items.length;c++)if(this.lexer.state.top=!1,i.items[c].tokens=this.lexer.blockTokens(i.items[c].text,[]),!i.loose){let p=i.items[c].tokens.filter(d=>d.type==="space"),u=p.length>0&&p.some(d=>this.rules.other.anyLine.test(d.raw));i.loose=u}if(i.loose)for(let c=0;c<i.items.length;c++)i.items[c].loose=!0;return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:s,title:i}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Y(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
36
|
+
`):[],r={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?r.align.push("right"):this.rules.other.tableAlignCenter.test(o)?r.align.push("center"):this.rules.other.tableAlignLeft.test(o)?r.align.push("left"):r.align.push(null);for(let o=0;o<n.length;o++)r.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:!0,align:r.align[o]});for(let o of i)r.rows.push(Y(o,r.header.length).map((a,c)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:r.align[c]})));return r}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
|
|
37
|
+
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let r=A(n.slice(0,-1),"\\");if((n.length-r.length)%2===0)return}else{let r=de(t[2],"()");if(r===-2)return;if(r>-1){let a=(t[0].indexOf("!")===0?5:4)+t[1].length+r;t[2]=t[2].substring(0,r),t[0]=t[0].substring(0,a).trim(),t[3]=""}}let s=t[2],i="";if(this.options.pedantic){let r=this.rules.other.pedanticHrefTitle.exec(s);r&&(s=r[1],i=r[3])}else i=t[3]?t[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),me(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let s=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[s.toLowerCase()];if(!i){let r=n[0].charAt(0);return{type:"text",raw:r,text:r}}return me(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s||s[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(s[1]||s[2]||"")||!n||this.rules.inline.punctuation.exec(n)){let r=[...s[0]].length-1,o,a,c=r,p=0,u=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+r);(s=u.exec(t))!=null;){if(o=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!o)continue;if(a=[...o].length,s[3]||s[4]){c+=a;continue}else if((s[5]||s[6])&&r%3&&!((r+a)%3)){p+=a;continue}if(c-=a,c>0)continue;a=Math.min(a,a+c+p);let d=[...s[0]][0].length,g=e.slice(0,r+s.index+d+a);if(Math.min(r,a)%2){let f=g.slice(1,-1);return{type:"em",raw:g,text:f,tokens:this.lexer.inlineTokens(f)}}let T=g.slice(2,-2);return{type:"strong",raw:g,text:T,tokens:this.lexer.inlineTokens(T)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return s&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,s;return t[2]==="@"?(n=t[1],s="mailto:"+n):(n=t[1],s=n),{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,s;if(t[2]==="@")n=t[0],s="mailto:"+n;else{let i;do i=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(i!==t[0]);n=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}};var x=class l{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||w,this.options.tokenizer=this.options.tokenizer||new S,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:m,block:B.normal,inline:P.normal};this.options.pedantic?(t.block=B.pedantic,t.inline=P.pedantic):this.options.gfm&&(t.block=B.gfm,this.options.breaks?t.inline=P.breaks:t.inline=P.gfm),this.tokenizer.rules=t}static get rules(){return{block:B,inline:P}}static lex(e,t){return new l(t).lex(e)}static lexInline(e,t){return new l(t).inlineTokens(e)}lex(e){e=e.replace(m.carriageReturn,`
|
|
38
|
+
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(m.tabCharGlobal," ").replace(m.spaceLine,""));e;){let s;if(this.options.extensions?.block?.some(r=>(s=r.call({lexer:this},e,t))?(e=e.substring(s.raw.length),t.push(s),!0):!1))continue;if(s=this.tokenizer.space(e)){e=e.substring(s.raw.length);let r=t.at(-1);s.raw.length===1&&r!==void 0?r.raw+=`
|
|
39
|
+
`:t.push(s);continue}if(s=this.tokenizer.code(e)){e=e.substring(s.raw.length);let r=t.at(-1);r?.type==="paragraph"||r?.type==="text"?(r.raw+=`
|
|
40
|
+
`+s.raw,r.text+=`
|
|
41
|
+
`+s.text,this.inlineQueue.at(-1).src=r.text):t.push(s);continue}if(s=this.tokenizer.fences(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.heading(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.hr(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.blockquote(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.list(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.html(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.def(e)){e=e.substring(s.raw.length);let r=t.at(-1);r?.type==="paragraph"||r?.type==="text"?(r.raw+=`
|
|
42
|
+
`+s.raw,r.text+=`
|
|
43
|
+
`+s.raw,this.inlineQueue.at(-1).src=r.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title});continue}if(s=this.tokenizer.table(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.lheading(e)){e=e.substring(s.raw.length),t.push(s);continue}let i=e;if(this.options.extensions?.startBlock){let r=1/0,o=e.slice(1),a;this.options.extensions.startBlock.forEach(c=>{a=c.call({lexer:this},o),typeof a=="number"&&a>=0&&(r=Math.min(r,a))}),r<1/0&&r>=0&&(i=e.substring(0,r+1))}if(this.state.top&&(s=this.tokenizer.paragraph(i))){let r=t.at(-1);n&&r?.type==="paragraph"?(r.raw+=`
|
|
44
|
+
`+s.raw,r.text+=`
|
|
45
|
+
`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(s),n=i.length!==e.length,e=e.substring(s.raw.length);continue}if(s=this.tokenizer.text(e)){e=e.substring(s.raw.length);let r=t.at(-1);r?.type==="text"?(r.raw+=`
|
|
46
|
+
`+s.raw,r.text+=`
|
|
47
|
+
`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(s);continue}if(e){let r="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(r);break}else throw new Error(r)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,s=null;if(this.tokens.links){let o=Object.keys(this.tokens.links);if(o.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)o.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,s.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(s=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=!1,r="";for(;e;){i||(r=""),i=!1;let o;if(this.options.extensions?.inline?.some(c=>(o=c.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let c=t.at(-1);o.type==="text"&&c?.type==="text"?(c.raw+=o.raw,c.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,r)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let a=e;if(this.options.extensions?.startInline){let c=1/0,p=e.slice(1),u;this.options.extensions.startInline.forEach(d=>{u=d.call({lexer:this},p),typeof u=="number"&&u>=0&&(c=Math.min(c,u))}),c<1/0&&c>=0&&(a=e.substring(0,c+1))}if(o=this.tokenizer.inlineText(a)){e=e.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(r=o.raw.slice(-1)),i=!0;let c=t.at(-1);c?.type==="text"?(c.raw+=o.raw,c.text+=o.text):t.push(o);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return t}};var $=class{options;parser;constructor(e){this.options=e||w}space(e){return""}code({text:e,lang:t,escaped:n}){let s=(t||"").match(m.notSpaceStart)?.[0],i=e.replace(m.endingNewline,"")+`
|
|
48
|
+
`;return s?'<pre><code class="language-'+R(s)+'">'+(n?i:R(i,!0))+`</code></pre>
|
|
49
|
+
`:"<pre><code>"+(n?i:R(i,!0))+`</code></pre>
|
|
50
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
51
|
+
${this.parser.parse(e)}</blockquote>
|
|
52
|
+
`}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
53
|
+
`}hr(e){return`<hr>
|
|
54
|
+
`}list(e){let t=e.ordered,n=e.start,s="";for(let o=0;o<e.items.length;o++){let a=e.items[o];s+=this.listitem(a)}let i=t?"ol":"ul",r=t&&n!==1?' start="'+n+'"':"";return"<"+i+r+`>
|
|
55
|
+
`+s+"</"+i+`>
|
|
56
|
+
`}listitem(e){let t="";if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type==="paragraph"?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=n+" "+R(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):t+=n+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
|
|
57
|
+
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
58
|
+
`}table(e){let t="",n="";for(let i=0;i<e.header.length;i++)n+=this.tablecell(e.header[i]);t+=this.tablerow({text:n});let s="";for(let i=0;i<e.rows.length;i++){let r=e.rows[i];n="";for(let o=0;o<r.length;o++)n+=this.tablecell(r[o]);s+=this.tablerow({text:n})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
|
|
59
|
+
<thead>
|
|
60
|
+
`+t+`</thead>
|
|
61
|
+
`+s+`</table>
|
|
62
|
+
`}tablerow({text:e}){return`<tr>
|
|
63
|
+
${e}</tr>
|
|
64
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
65
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${R(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let s=this.parser.parseInline(n),i=V(e);if(i===null)return s;e=i;let r='<a href="'+e+'"';return t&&(r+=' title="'+R(t)+'"'),r+=">"+s+"</a>",r}image({href:e,title:t,text:n,tokens:s}){s&&(n=this.parser.parseInline(s,this.parser.textRenderer));let i=V(e);if(i===null)return R(n);e=i;let r=`<img src="${e}" alt="${n}"`;return t&&(r+=` title="${R(t)}"`),r+=">",r}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:R(e.text)}};var _=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}};var b=class l{options;renderer;textRenderer;constructor(e){this.options=e||w,this.options.renderer=this.options.renderer||new $,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new _}static parse(e,t){return new l(t).parse(e)}static parseInline(e,t){return new l(t).parseInline(e)}parse(e,t=!0){let n="";for(let s=0;s<e.length;s++){let i=e[s];if(this.options.extensions?.renderers?.[i.type]){let o=i,a=this.options.extensions.renderers[o.type].call({parser:this},o);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(o.type)){n+=a||"";continue}}let r=i;switch(r.type){case"space":{n+=this.renderer.space(r);continue}case"hr":{n+=this.renderer.hr(r);continue}case"heading":{n+=this.renderer.heading(r);continue}case"code":{n+=this.renderer.code(r);continue}case"table":{n+=this.renderer.table(r);continue}case"blockquote":{n+=this.renderer.blockquote(r);continue}case"list":{n+=this.renderer.list(r);continue}case"html":{n+=this.renderer.html(r);continue}case"paragraph":{n+=this.renderer.paragraph(r);continue}case"text":{let o=r,a=this.renderer.text(o);for(;s+1<e.length&&e[s+1].type==="text";)o=e[++s],a+=`
|
|
66
|
+
`+this.renderer.text(o);t?n+=this.renderer.paragraph({type:"paragraph",raw:a,text:a,tokens:[{type:"text",raw:a,text:a,escaped:!0}]}):n+=a;continue}default:{let o='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}parseInline(e,t=this.renderer){let n="";for(let s=0;s<e.length;s++){let i=e[s];if(this.options.extensions?.renderers?.[i.type]){let o=this.options.extensions.renderers[i.type].call({parser:this},i);if(o!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=o||"";continue}}let r=i;switch(r.type){case"escape":{n+=t.text(r);break}case"html":{n+=t.html(r);break}case"link":{n+=t.link(r);break}case"image":{n+=t.image(r);break}case"strong":{n+=t.strong(r);break}case"em":{n+=t.em(r);break}case"codespan":{n+=t.codespan(r);break}case"br":{n+=t.br(r);break}case"del":{n+=t.del(r);break}case"text":{n+=t.text(r);break}default:{let o='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}};var L=class{options;block;constructor(e){this.options=e||w}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?x.lex:x.lexInline}provideParser(){return this.block?b.parse:b.parseInline}};var E=class{defaults=z();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=b;Renderer=$;TextRenderer=_;Lexer=x;Tokenizer=S;Hooks=L;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let s of e)switch(n=n.concat(t.call(this,s)),s.type){case"table":{let i=s;for(let r of i.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of i.rows)for(let o of r)n=n.concat(this.walkTokens(o.tokens,t));break}case"list":{let i=s;n=n.concat(this.walkTokens(i.items,t));break}default:{let i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(r=>{let o=i[r].flat(1/0);n=n.concat(this.walkTokens(o,t))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let r=t.renderers[i.name];r?t.renderers[i.name]=function(...o){let a=i.renderer.apply(this,o);return a===!1&&(a=r.apply(this,o)),a}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let r=t[i.level];r?r.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),s.extensions=t),n.renderer){let i=this.defaults.renderer||new $(this.defaults);for(let r in n.renderer){if(!(r in i))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;let o=r,a=n.renderer[o],c=i[o];i[o]=(...p)=>{let u=a.apply(i,p);return u===!1&&(u=c.apply(i,p)),u||""}}s.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new S(this.defaults);for(let r in n.tokenizer){if(!(r in i))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;let o=r,a=n.tokenizer[o],c=i[o];i[o]=(...p)=>{let u=a.apply(i,p);return u===!1&&(u=c.apply(i,p)),u}}s.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new L;for(let r in n.hooks){if(!(r in i))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;let o=r,a=n.hooks[o],c=i[o];L.passThroughHooks.has(r)?i[o]=p=>{if(this.defaults.async)return Promise.resolve(a.call(i,p)).then(d=>c.call(i,d));let u=a.call(i,p);return c.call(i,u)}:i[o]=(...p)=>{let u=a.apply(i,p);return u===!1&&(u=c.apply(i,p)),u}}s.hooks=i}if(n.walkTokens){let i=this.defaults.walkTokens,r=n.walkTokens;s.walkTokens=function(o){let a=[];return a.push(r.call(this,o)),i&&(a=a.concat(i.call(this,o))),a}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return x.lex(e,t??this.defaults)}parser(e,t){return b.parse(e,t??this.defaults)}parseMarkdown(e){return(n,s)=>{let i={...s},r={...this.defaults,...i},o=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&i.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));r.hooks&&(r.hooks.options=r,r.hooks.block=e);let a=r.hooks?r.hooks.provideLexer():e?x.lex:x.lexInline,c=r.hooks?r.hooks.provideParser():e?b.parse:b.parseInline;if(r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(n):n).then(p=>a(p,r)).then(p=>r.hooks?r.hooks.processAllTokens(p):p).then(p=>r.walkTokens?Promise.all(this.walkTokens(p,r.walkTokens)).then(()=>p):p).then(p=>c(p,r)).then(p=>r.hooks?r.hooks.postprocess(p):p).catch(o);try{r.hooks&&(n=r.hooks.preprocess(n));let p=a(n,r);r.hooks&&(p=r.hooks.processAllTokens(p)),r.walkTokens&&this.walkTokens(p,r.walkTokens);let u=c(p,r);return r.hooks&&(u=r.hooks.postprocess(u)),u}catch(p){return o(p)}}}onError(e,t){return n=>{if(n.message+=`
|
|
67
|
+
Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+R(n.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}};var M=new E;function k(l,e){return M.parse(l,e)}k.options=k.setOptions=function(l){return M.setOptions(l),k.defaults=M.defaults,N(k.defaults),k};k.getDefaults=z;k.defaults=w;k.use=function(...l){return M.use(...l),k.defaults=M.defaults,N(k.defaults),k};k.walkTokens=function(l,e){return M.walkTokens(l,e)};k.parseInline=M.parseInline;k.Parser=b;k.parser=b.parse;k.Renderer=$;k.TextRenderer=_;k.Lexer=x;k.lexer=x.lex;k.Tokenizer=S;k.Hooks=L;k.parse=k;var it=k.options,ot=k.setOptions,lt=k.use,at=k.walkTokens,ct=k.parseInline,pt=k,ut=b.parse,ht=x.lex;
|
|
68
|
+
|
|
69
|
+
if(__exports != exports)module.exports = exports;return module.exports}));
|