zt-react-milkdown 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{dist-Cxaq2crg.js → commands-BJpevWrH.js} +123 -123
- package/dist/commands-BmZHd6RL.js +2 -0
- package/dist/{dist-CPVooDwj.cjs → commands-CM7IuhpT.cjs} +2 -2
- package/dist/commands-f4yOm8DQ.cjs +1 -0
- package/dist/{debounce-Bqj_3iJs.cjs → debounce-C_TNzOFT.cjs} +1 -1
- package/dist/{dist-DaM7GJv6.js → dist-CLTsQjPD.js} +319 -318
- package/dist/{dist-CxZn1qUo.js → dist-CZTw9GLV.js} +198 -198
- package/dist/dist-DQnWlYyo.cjs +5 -0
- package/dist/dist-ZPtYoqTI.cjs +1 -0
- package/dist/floating-ui.dom-CV-TLBRq.cjs +1 -0
- package/dist/floating-ui.dom-CoOubeUs.js +762 -0
- package/dist/index.cjs +25 -149
- package/dist/index.mjs +6235 -15737
- package/dist/{lib-C8xOD1Bp.cjs → lib-5pUyY-Tl.cjs} +1 -1
- package/dist/{lib-DkE7Uq2b.js → lib-Bhr5EVOu.js} +110 -112
- package/dist/lib-BmAQCwSQ.cjs +1 -0
- package/dist/{lib-wmHesNI0.js → lib-C1A-pN4b.js} +574 -575
- package/dist/lib-CVebEyb8.cjs +4 -0
- package/dist/lib-ChwoE6v5.js +331 -0
- package/dist/lib-DIx8C5AZ.cjs +1 -0
- package/dist/lib-DVE2k9i1.js +387 -0
- package/dist/{lib-DzK_kn7a.js → lib-D_0WAhKU.js} +3 -3
- package/dist/{lib-m8lKZKxK.js → lib-Dd20rlmV.js} +28 -28
- package/dist/lib-De0djIEV.cjs +5 -0
- package/dist/{lib-D4HMdvmK.cjs → lib-DgEwQN1U.cjs} +1 -1
- package/dist/{dist-Dhukmh4L.js → lib-DmD940Fq.js} +2849 -1735
- package/dist/lib-Dplx6t-N.cjs +3 -0
- package/dist/lib-DzY83R_P.cjs +39 -0
- package/dist/lib-F08NY8fk.cjs +1 -0
- package/dist/{lib-B0rHJ9lJ.js → lib-_NDReOAt.js} +3 -3
- package/dist/{lib-CK9MEMX-.js → lib-bsXGz3fj.js} +28 -27
- package/dist/schema-list-D9Q6QKgo.cjs +1 -0
- package/dist/schema-list-DooYP5HM.js +110 -0
- package/dist/src/core/createEditor.d.ts.map +1 -1
- package/dist/src/local/en-US.d.ts.map +1 -1
- package/dist/src/local/zh-CN.d.ts.map +1 -1
- package/dist/src/plugins/custom/block-transform/block-transform.d.ts +15 -0
- package/dist/src/plugins/custom/block-transform/block-transform.d.ts.map +1 -0
- package/dist/src/plugins/custom/block-transform/index.d.ts +2 -0
- package/dist/src/plugins/custom/block-transform/index.d.ts.map +1 -0
- package/dist/src/plugins/custom/math/index.d.ts +6 -0
- package/dist/src/plugins/custom/math/index.d.ts.map +1 -1
- package/dist/src/plugins/custom/math/math-block-editable.d.ts.map +1 -1
- package/dist/src/plugins/custom/math/math-inline-arrow-navigation.d.ts +5 -0
- package/dist/src/plugins/custom/math/math-inline-arrow-navigation.d.ts.map +1 -0
- package/dist/src/plugins/custom/math/math-inline-edit-plugin.d.ts +29 -0
- package/dist/src/plugins/custom/math/math-inline-edit-plugin.d.ts.map +1 -0
- package/dist/src/plugins/custom/math/math-inline-editable.d.ts +7 -0
- package/dist/src/plugins/custom/math/math-inline-editable.d.ts.map +1 -0
- package/dist/src/plugins/custom/math/math-plugin.d.ts.map +1 -1
- package/dist/src/plugins/custom/selection-tooltip/constants.d.ts +5 -1
- package/dist/src/plugins/custom/selection-tooltip/constants.d.ts.map +1 -1
- package/dist/src/plugins/custom/selection-tooltip/index.d.ts.map +1 -1
- package/dist/src/plugins/custom/selection-tooltip/tooltip-view.d.ts +34 -3
- package/dist/src/plugins/custom/selection-tooltip/tooltip-view.d.ts.map +1 -1
- package/dist/src/plugins/custom/selection-tooltip/types.d.ts +16 -1
- package/dist/src/plugins/custom/selection-tooltip/types.d.ts.map +1 -1
- package/dist/src/plugins/custom/slash-menu/slash-menu-commands.d.ts.map +1 -1
- package/dist/src/plugins/custom/slash-menu/slash-menu-logic.d.ts +4 -0
- package/dist/src/plugins/custom/slash-menu/slash-menu-logic.d.ts.map +1 -1
- package/dist/src/plugins/custom/slash-menu/slash-menu-view.d.ts.map +1 -1
- package/dist/src/plugins/custom/slash-menu/slash-menu.d.ts.map +1 -1
- package/dist/src/plugins/preset-common.d.ts +6 -0
- package/dist/src/plugins/preset-common.d.ts.map +1 -1
- package/dist/src/react/hooks/useMilkdownEditor.d.ts +2 -2
- package/dist/src/react/hooks/useMilkdownEditor.d.ts.map +1 -1
- package/dist/src/types/editor.d.ts +35 -5
- package/dist/src/types/editor.d.ts.map +1 -1
- package/dist/state-BC1dqWPQ.cjs +1 -0
- package/dist/state-BvRk9kiK.cjs +0 -0
- package/dist/state-BvRk9kiK.js +0 -0
- package/dist/state-rTW_1XVf.js +3 -0
- package/dist/style.css +2 -2
- package/package.json +1 -1
- package/dist/commands-CDrea4WB.cjs +0 -1
- package/dist/commands-DoqeX5uJ.js +0 -36
- package/dist/dist-BCCSKc3M.cjs +0 -5
- package/dist/dist-C0PSMrs7.cjs +0 -37
- package/dist/dist-mOpTMw1E.cjs +0 -1
- package/dist/floating-ui.dom-CKbcbmJV.js +0 -883
- package/dist/floating-ui.dom-VaZZ2gzS.cjs +0 -1
- package/dist/index.browser-5LtNN9G9.cjs +0 -1
- package/dist/index.browser-D2DmEB8o.js +0 -26
- package/dist/lib-38nxOnTd.cjs +0 -4
- package/dist/lib-8Tr6mAln.cjs +0 -1
- package/dist/lib-BJgvZywM.cjs +0 -3
- package/dist/lib-BNOSyYeU.cjs +0 -3
- package/dist/lib-C5AzmhNY.cjs +0 -5
- package/dist/lib-CCUU16r8.js +0 -1081
- package/dist/lib-DWZA8C0h.cjs +0 -1
- package/dist/lib-Dbe-cVjv.js +0 -367
- package/dist/lib-IahjxPWM.cjs +0 -3
- package/dist/lib-r5eNG0sa.js +0 -754
- package/dist/rolldown-runtime-CerMd-t8.cjs +0 -1
- package/dist/rolldown-runtime-DnwLefa7.js +0 -23
- package/dist/schema-list-DSdBEAWW.js +0 -171
- package/dist/schema-list-bL8FNes5.cjs +0 -1
- package/dist/state-CHAiIqOA.cjs +0 -1
- package/dist/state-DNxqltZl.js +0 -16
- /package/dist/{debounce-Cuk3VGPr.js → debounce-Z8-khnlZ.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=[`top`,`right`,`bottom`,`left`],t=Math.min,n=Math.max,r=Math.round,i=Math.floor,a=e=>({x:e,y:e}),o={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function s(e,r,i){return n(e,t(r,i))}function c(e,t){return typeof e==`function`?e(t):e}function l(e){return e.split(`-`)[0]}function u(e){return e.split(`-`)[1]}function d(e){return e===`x`?`y`:`x`}function f(e){return e===`y`?`height`:`width`}function p(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function m(e){return d(p(e))}function h(e,t,n){n===void 0&&(n=!1);let r=u(e),i=m(e),a=f(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=w(o)),[o,w(o)]}function g(e){let t=w(e);return[_(e),t,_(t)]}function _(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var v=[`left`,`right`],y=[`right`,`left`],b=[`top`,`bottom`],x=[`bottom`,`top`];function S(e,t,n){switch(e){case`top`:case`bottom`:return n?t?y:v:t?v:y;case`left`:case`right`:return t?b:x;default:return[]}}function C(e,t,n,r){let i=u(e),a=S(l(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(_)))),a}function w(e){let t=l(e);return o[t]+e.slice(t.length)}function T(e){return{top:0,right:0,bottom:0,left:0,...e}}function E(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:T(e)}function D(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function O(e,t,n){let{reference:r,floating:i}=e,a=p(t),o=m(t),s=f(o),c=l(t),d=a===`y`,h=r.x+r.width/2-i.width/2,g=r.y+r.height/2-i.height/2,_=r[s]/2-i[s]/2,v;switch(c){case`top`:v={x:h,y:r.y-i.height};break;case`bottom`:v={x:h,y:r.y+r.height};break;case`right`:v={x:r.x+r.width,y:g};break;case`left`:v={x:r.x-i.width,y:g};break;default:v={x:r.x,y:r.y}}switch(u(t)){case`start`:v[o]-=_*(n&&d?-1:1);break;case`end`:v[o]+=_*(n&&d?-1:1);break}return v}async function k(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:l=`clippingAncestors`,rootBoundary:u=`viewport`,elementContext:d=`floating`,altBoundary:f=!1,padding:p=0}=c(t,e),m=E(p),h=o[f?d===`floating`?`reference`:`floating`:d],g=D(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(h))??!0?h:h.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:l,rootBoundary:u,strategy:s})),_=d===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,v=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),y=await(i.isElement==null?void 0:i.isElement(v))&&await(i.getScale==null?void 0:i.getScale(v))||{x:1,y:1},b=D(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:_,offsetParent:v,strategy:s}):_);return{top:(g.top-b.top+m.top)/y.y,bottom:(b.bottom-g.bottom+m.bottom)/y.y,left:(g.left-b.left+m.left)/y.x,right:(b.right-g.right+m.right)/y.x}}var A=50,j=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:k},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=O(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<A&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=O(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},M=e=>({name:`arrow`,options:e,async fn(n){let{x:r,y:i,placement:a,rects:o,platform:l,elements:d,middlewareData:p}=n,{element:h,padding:g=0}=c(e,n)||{};if(h==null)return{};let _=E(g),v={x:r,y:i},y=m(a),b=f(y),x=await l.getDimensions(h),S=y===`y`,C=S?`top`:`left`,w=S?`bottom`:`right`,T=S?`clientHeight`:`clientWidth`,D=o.reference[b]+o.reference[y]-v[y]-o.floating[b],O=v[y]-o.reference[y],k=await(l.getOffsetParent==null?void 0:l.getOffsetParent(h)),A=k?k[T]:0;(!A||!await(l.isElement==null?void 0:l.isElement(k)))&&(A=d.floating[T]||o.floating[b]);let j=D/2-O/2,M=A/2-x[b]/2-1,ee=t(_[C],M),N=t(_[w],M),P=ee,te=A-x[b]-N,F=A/2-x[b]/2+j,I=s(P,F,te),L=!p.arrow&&u(a)!=null&&F!==I&&o.reference[b]/2-(F<P?ee:N)-x[b]/2<0,R=L?F<P?F-P:F-te:0;return{[y]:v[y]+R,data:{[y]:I,centerOffset:F-I-R,...L&&{alignmentOffset:R}},reset:L}}}),ee=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:_=`bestFit`,fallbackAxisSideDirection:v=`none`,flipAlignment:y=!0,...b}=c(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let x=l(r),S=p(o),T=l(o)===o,E=await(s.isRTL==null?void 0:s.isRTL(u.floating)),D=m||(T||!y?[w(o)]:g(o)),O=v!==`none`;!m&&O&&D.push(...C(o,y,v,E));let k=[o,...D],A=await s.detectOverflow(t,b),j=[],M=i.flip?.overflows||[];if(d&&j.push(A[x]),f){let e=h(r,a,E);j.push(A[e[0]],A[e[1]])}if(M=[...M,{placement:r,overflows:j}],!j.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=k[e];if(t&&(!(f===`alignment`&&S!==p(t))||M.every(e=>p(e.placement)===S?e.overflows[0]>0:!0)))return{data:{index:e,overflows:M},reset:{placement:t}};let n=M.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(_){case`bestFit`:{let e=M.filter(e=>{if(O){let t=p(e.placement);return t===S||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function N(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function P(t){return e.some(e=>t[e]>=0)}var te=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=c(e,t);switch(i){case`referenceHidden`:{let e=N(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:P(e)}}}case`escaped`:{let e=N(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:P(e)}}}default:return{}}}}},F=new Set([`left`,`top`]);async function I(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=l(n),s=u(n),d=p(n)===`y`,f=F.has(o)?-1:1,m=a&&d?-1:1,h=c(t,e),{mainAxis:g,crossAxis:_,alignmentAxis:v}=typeof h==`number`?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return s&&typeof v==`number`&&(_=s===`end`?v*-1:v),d?{x:_*m,y:g*f}:{x:g*f,y:_*m}}var L=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await I(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},R=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:u=!1,limiter:f={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...m}=c(e,t),h={x:n,y:r},g=await a.detectOverflow(t,m),_=p(l(i)),v=d(_),y=h[v],b=h[_];if(o){let e=v===`y`?`top`:`left`,t=v===`y`?`bottom`:`right`,n=y+g[e],r=y-g[t];y=s(n,y,r)}if(u){let e=_===`y`?`top`:`left`,t=_===`y`?`bottom`:`right`,n=b+g[e],r=b-g[t];b=s(n,b,r)}let x=f.fn({...t,[v]:y,[_]:b});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[v]:o,[_]:u}}}}}},ne=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:u=!0,crossAxis:f=!0}=c(e,t),m={x:n,y:r},h=p(i),g=d(h),_=m[g],v=m[h],y=c(s,t),b=typeof y==`number`?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(u){let e=g===`y`?`height`:`width`,t=a.reference[g]-a.floating[e]+b.mainAxis,n=a.reference[g]+a.reference[e]-b.mainAxis;_<t?_=t:_>n&&(_=n)}if(f){let e=g===`y`?`width`:`height`,t=F.has(l(i)),n=a.reference[h]-a.floating[e]+(t&&o.offset?.[h]||0)+(t?0:b.crossAxis),r=a.reference[h]+a.reference[e]+(t?0:o.offset?.[h]||0)-(t?b.crossAxis:0);v<n?v=n:v>r&&(v=r)}return{[g]:_,[h]:v}}}},re=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(r){var i,a;let{placement:o,rects:s,platform:d,elements:f}=r,{apply:m=()=>{},...h}=c(e,r),g=await d.detectOverflow(r,h),_=l(o),v=u(o),y=p(o)===`y`,{width:b,height:x}=s.floating,S,C;_===`top`||_===`bottom`?(S=_,C=v===(await(d.isRTL==null?void 0:d.isRTL(f.floating))?`start`:`end`)?`left`:`right`):(C=_,S=v===`end`?`top`:`bottom`);let w=x-g.top-g.bottom,T=b-g.left-g.right,E=t(x-g[S],w),D=t(b-g[C],T),O=!r.middlewareData.shift,k=E,A=D;if((i=r.middlewareData.shift)!=null&&i.enabled.x&&(A=T),(a=r.middlewareData.shift)!=null&&a.enabled.y&&(k=w),O&&!v){let e=n(g.left,0),t=n(g.right,0),r=n(g.top,0),i=n(g.bottom,0);y?A=b-2*(e!==0||t!==0?e+t:n(g.left,g.right)):k=x-2*(r!==0||i!==0?r+i:n(g.top,g.bottom))}await m({...r,availableWidth:A,availableHeight:k});let j=await d.getDimensions(f.floating);return b!==j.width||x!==j.height?{reset:{rects:!0}}:{}}}};function z(){return typeof window<`u`}function B(e){return ie(e)?(e.nodeName||``).toLowerCase():`#document`}function V(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function H(e){return((ie(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function ie(e){return z()?e instanceof Node||e instanceof V(e).Node:!1}function U(e){return z()?e instanceof Element||e instanceof V(e).Element:!1}function W(e){return z()?e instanceof HTMLElement||e instanceof V(e).HTMLElement:!1}function ae(e){return!z()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof V(e).ShadowRoot}function G(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Y(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function oe(e){return/^(table|td|th)$/.test(B(e))}function K(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var se=/transform|translate|scale|rotate|perspective|filter/,ce=/paint|layout|strict|content/,q=e=>!!e&&e!==`none`,le;function ue(e){let t=U(e)?Y(e):e;return q(t.transform)||q(t.translate)||q(t.scale)||q(t.rotate)||q(t.perspective)||!fe()&&(q(t.backdropFilter)||q(t.filter))||se.test(t.willChange||``)||ce.test(t.contain||``)}function de(e){let t=X(e);for(;W(t)&&!J(t);){if(ue(t))return t;if(K(t))return null;t=X(t)}return null}function fe(){return le??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),le}function J(e){return/^(html|body|#document)$/.test(B(e))}function Y(e){return V(e).getComputedStyle(e)}function pe(e){return U(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function X(e){if(B(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ae(e)&&e.host||H(e);return ae(t)?t.host:t}function me(e){let t=X(e);return J(t)?e.ownerDocument?e.ownerDocument.body:e.body:W(t)&&G(t)?t:me(t)}function Z(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=me(e),i=r===e.ownerDocument?.body,a=V(r);if(i){let e=he(a);return t.concat(a,a.visualViewport||[],G(r)?r:[],e&&n?Z(e):[])}else return t.concat(r,Z(r,[],n))}function he(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ge(e){let t=Y(e),n=parseFloat(t.width)||0,i=parseFloat(t.height)||0,a=W(e),o=a?e.offsetWidth:n,s=a?e.offsetHeight:i,c=r(n)!==o||r(i)!==s;return c&&(n=o,i=s),{width:n,height:i,$:c}}function _e(e){return U(e)?e:e.contextElement}function Q(e){let t=_e(e);if(!W(t))return a(1);let n=t.getBoundingClientRect(),{width:i,height:o,$:s}=ge(t),c=(s?r(n.width):n.width)/i,l=(s?r(n.height):n.height)/o;return(!c||!Number.isFinite(c))&&(c=1),(!l||!Number.isFinite(l))&&(l=1),{x:c,y:l}}var ve=a(0);function ye(e){let t=V(e);return!fe()||!t.visualViewport?ve:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function be(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==V(e)?!1:t}function $(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),o=_e(e),s=a(1);t&&(r?U(r)&&(s=Q(r)):s=Q(e));let c=be(o,n,r)?ye(o):a(0),l=(i.left+c.x)/s.x,u=(i.top+c.y)/s.y,d=i.width/s.x,f=i.height/s.y;if(o){let e=V(o),t=r&&U(r)?V(r):r,n=e,i=he(n);for(;i&&r&&t!==n;){let e=Q(i),t=i.getBoundingClientRect(),r=Y(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,u*=e.y,d*=e.x,f*=e.y,l+=a,u+=o,n=V(i),i=he(n)}}return D({width:d,height:f,x:l,y:u})}function xe(e,t){let n=pe(e).scrollLeft;return t?t.left+n:$(H(e)).left+n}function Se(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-xe(e,n),y:n.top+t.scrollTop}}function Ce(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,o=i===`fixed`,s=H(r),c=t?K(t.floating):!1;if(r===s||c&&o)return n;let l={scrollLeft:0,scrollTop:0},u=a(1),d=a(0),f=W(r);if((f||!f&&!o)&&((B(r)!==`body`||G(s))&&(l=pe(r)),f)){let e=$(r);u=Q(r),d.x=e.x+r.clientLeft,d.y=e.y+r.clientTop}let p=s&&!f&&!o?Se(s,l):a(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x+p.x,y:n.y*u.y-l.scrollTop*u.y+d.y+p.y}}function we(e){return Array.from(e.getClientRects())}function Te(e){let t=H(e),r=pe(e),i=e.ownerDocument.body,a=n(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),o=n(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight),s=-r.scrollLeft+xe(e),c=-r.scrollTop;return Y(i).direction===`rtl`&&(s+=n(t.clientWidth,i.clientWidth)-a),{width:a,height:o,x:s,y:c}}var Ee=25;function De(e,t){let n=V(e),r=H(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=fe();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=xe(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=Ee&&(a-=o)}else l<=Ee&&(a+=l);return{width:a,height:o,x:s,y:c}}function Oe(e,t){let n=$(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=W(e)?Q(e):a(1);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:i*o.x,y:r*o.y}}function ke(e,t,n){let r;if(t===`viewport`)r=De(e,n);else if(t===`document`)r=Te(H(e));else if(U(t))r=Oe(t,n);else{let n=ye(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return D(r)}function Ae(e,t){let n=X(e);return n===t||!U(n)||J(n)?!1:Y(n).position===`fixed`||Ae(n,t)}function je(e,t){let n=t.get(e);if(n)return n;let r=Z(e,[],!1).filter(e=>U(e)&&B(e)!==`body`),i=null,a=Y(e).position===`fixed`,o=a?X(e):e;for(;U(o)&&!J(o);){let t=Y(o),n=ue(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||G(o)&&!n&&Ae(e,o))?r=r.filter(e=>e!==o):i=t,o=X(o)}return t.set(e,r),r}function Me(e){let{element:r,boundary:i,rootBoundary:a,strategy:o}=e,s=[...i===`clippingAncestors`?K(r)?[]:je(r,this._c):[].concat(i),a],c=ke(r,s[0],o),l=c.top,u=c.right,d=c.bottom,f=c.left;for(let e=1;e<s.length;e++){let i=ke(r,s[e],o);l=n(i.top,l),u=t(i.right,u),d=t(i.bottom,d),f=n(i.left,f)}return{width:u-f,height:d-l,x:f,y:l}}function Ne(e){let{width:t,height:n}=ge(e);return{width:t,height:n}}function Pe(e,t,n){let r=W(t),i=H(t),o=n===`fixed`,s=$(e,!0,o,t),c={scrollLeft:0,scrollTop:0},l=a(0);function u(){l.x=xe(i)}if(r||!r&&!o)if((B(t)!==`body`||G(i))&&(c=pe(t)),r){let e=$(t,!0,o,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else i&&u();o&&!r&&i&&u();let d=i&&!r&&!o?Se(i,c):a(0);return{x:s.left+c.scrollLeft-l.x-d.x,y:s.top+c.scrollTop-l.y-d.y,width:s.width,height:s.height}}function Fe(e){return Y(e).position===`static`}function Ie(e,t){if(!W(e)||Y(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return H(e)===n&&(n=n.ownerDocument.body),n}function Le(e,t){let n=V(e);if(K(e))return n;if(!W(e)){let t=X(e);for(;t&&!J(t);){if(U(t)&&!Fe(t))return t;t=X(t)}return n}let r=Ie(e,t);for(;r&&oe(r)&&Fe(r);)r=Ie(r,t);return r&&J(r)&&Fe(r)&&!ue(r)?n:r||de(e)||n}var Re=async function(e){let t=this.getOffsetParent||Le,n=this.getDimensions,r=await n(e.floating);return{reference:Pe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function ze(e){return Y(e).direction===`rtl`}var Be={convertOffsetParentRelativeRectToViewportRelativeRect:Ce,getDocumentElement:H,getClippingRect:Me,getOffsetParent:Le,getElementRects:Re,getClientRects:we,getDimensions:Ne,getScale:Q,isElement:U,isRTL:ze};function Ve(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function He(e,r){let a=null,o,s=H(e);function c(){var e;clearTimeout(o),(e=a)==null||e.disconnect(),a=null}function l(u,d){u===void 0&&(u=!1),d===void 0&&(d=1),c();let f=e.getBoundingClientRect(),{left:p,top:m,width:h,height:g}=f;if(u||r(),!h||!g)return;let _=i(m),v=i(s.clientWidth-(p+h)),y=i(s.clientHeight-(m+g)),b=i(p),x={rootMargin:-_+`px `+-v+`px `+-y+`px `+-b+`px`,threshold:n(0,t(1,d))||1},S=!0;function C(t){let n=t[0].intersectionRatio;if(n!==d){if(!S)return l();n?l(!1,n):o=setTimeout(()=>{l(!1,1e-7)},1e3)}n===1&&!Ve(f,e.getBoundingClientRect())&&l(),S=!1}try{a=new IntersectionObserver(C,{...x,root:s.ownerDocument})}catch{a=new IntersectionObserver(C,x)}a.observe(e)}return l(!0),c}function Ue(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=_e(e),u=i||a?[...l?Z(l):[],...t?Z(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?He(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?$(e):null;c&&g();function g(){let t=$(e);h&&!Ve(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var We=L,Ge=R,Ke=ee,qe=re,Je=te,Ye=M,Xe=ne,Ze=(e,t,n)=>{let r=new Map,i={platform:Be,...n},a={...i.platform,_c:r};return j(e,t,{...i,platform:a})};Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return Je}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return qe}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return Ue}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return Xe}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return We}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return Ye}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=e=>crypto.getRandomValues(new Uint8Array(e)),t=(e,t,n)=>{let r=256-256%e.length;if(r===256){let r=e.length-1;return(i=t)=>{if(!i)return``;let a=``;for(;;){let t=n(i),o=i;for(;o--;)if(a+=e[t[o]&r],a.length>=i)return a}}}let i=Math.ceil(1.6*256*t/r);return(a=t)=>{if(!a)return``;let o=``;for(;;){let t=n(i),s=i;for(;s--;)if(t[s]<r&&(o+=e[t[s]%e.length],o.length>=a))return o}}},n=(n,r=21)=>t(n,r|0,e);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return n}});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
//#region node_modules/.pnpm/nanoid@5.1.9/node_modules/nanoid/index.browser.js
|
|
2
|
-
var e = (e) => crypto.getRandomValues(new Uint8Array(e)), t = (e, t, n) => {
|
|
3
|
-
let r = 256 - 256 % e.length;
|
|
4
|
-
if (r === 256) {
|
|
5
|
-
let r = e.length - 1;
|
|
6
|
-
return (i = t) => {
|
|
7
|
-
if (!i) return "";
|
|
8
|
-
let a = "";
|
|
9
|
-
for (;;) {
|
|
10
|
-
let t = n(i), o = i;
|
|
11
|
-
for (; o--;) if (a += e[t[o] & r], a.length >= i) return a;
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
let i = Math.ceil(1.6 * 256 * t / r);
|
|
16
|
-
return (a = t) => {
|
|
17
|
-
if (!a) return "";
|
|
18
|
-
let o = "";
|
|
19
|
-
for (;;) {
|
|
20
|
-
let t = n(i), s = i;
|
|
21
|
-
for (; s--;) if (t[s] < r && (o += e[t[s] % e.length], o.length >= a)) return o;
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
}, n = (n, r = 21) => t(n, r | 0, e);
|
|
25
|
-
//#endregion
|
|
26
|
-
export { n as t };
|
package/dist/lib-38nxOnTd.cjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
const e=require(`./dist-BCCSKc3M.cjs`),t=require(`./lib-BJgvZywM.cjs`);function n(e){if(!e)return!1;if(Array.isArray(e))return e.length>1?!1:n(e[0]);let t=e.content;return t?n(t):e.type===`text`}function r(e,t){return Object.assign(e,{meta:{package:`@milkdown/plugin-clipboard`,...t}}),e}function i(e,n){let r=t.l(n);if(r)return e.dispatch(e.state.tr.replaceSelectionWith(r,!0)),!0;try{return e.dispatch(e.state.tr.replaceSelection(n)),!0}catch{return!1}}var a=t.n(r=>{let a=r.get(t.o);return r.update(t.i,e=>({...e,editable:e.editable??(()=>!0),transformPastedHTML:(t,n)=>{let r=e.transformPastedHTML;return r&&(t=r(t,n)),t.includes(`docs-internal-guid`)&&(t=t.replace(/<b[^>]*id="docs-internal-guid[^"]*"[^>]*>([\s\S]*)<\/b>/,`$1`),t=t.replace(/<div[^>]*>(<table[\s\S]*?<\/table>)<\/div>/g,`$1`)),t}})),new e.i({key:new e.a(`MILKDOWN_CLIPBOARD`),props:{handlePaste:(n,o,s)=>{let c=r.get(t.a),l=n.props.editable?.(n.state),{clipboardData:u}=o;if(!l||!u||n.state.selection.$from.node().type.spec.code)return!1;let d=u.getData(`text/plain`),f=u.getData(`vscode-editor-data`);if(f){let r=JSON.parse(f)?.mode;if(d&&r){let{tr:i}=n.state,o=t.c(`code_block`,a);return i.replaceSelectionWith(o.create({language:r})).setSelection(e.c.near(i.doc.resolve(Math.max(0,i.selection.from-2)))).insertText(d.replace(/\r\n?/g,`
|
|
2
|
-
`)),n.dispatch(i),!0}}let p=u.getData(`text/html`);if(p.length===0&&d.length===0)return!1;if(p.length>0&&s)return i(n,s);let m=e.x.fromSchema(a),h;if(p.length===0){let t=c(d);if(!t||typeof t==`string`)return!1;h=e.S.fromSchema(a).serializeFragment(t.content)}else{let e=document.createElement(`template`);e.innerHTML=p,h=e.content.cloneNode(!0),e.remove()}return i(n,m.parseSlice(h))},clipboardTextSerializer:e=>{let i=r.get(t.s);if(n(e.content.toJSON()))return e.content.textBetween(0,e.content.size,`
|
|
3
|
-
|
|
4
|
-
`);let o=a.topNodeType.createAndFill(void 0,e.content);return o?i(o):``}}})});r(a,{displayName:`Prose<clipboard>`}),exports.clipboard=a;
|
package/dist/lib-8Tr6mAln.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./dist-BCCSKc3M.cjs`),t=require(`./lib-IahjxPWM.cjs`),n=require(`./debounce-Bqj_3iJs.cjs`);var r=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}},i=t.z(new r,`listener`),a=new e.a(`MILKDOWN_LISTENER`),o=o=>(o.inject(i,new r),async()=>{await o.wait(t.r);let{listeners:r}=o.get(i);r.beforeMount.forEach(e=>e(o)),await o.wait(t.o);let s=o.get(t.k),c=null,l=null,u=null,d=null,f=n.t(()=>{if(!d)return;let{doc:e}=d;if(r.updated.length>0&&c&&!c.eq(e)&&r.updated.forEach(t=>{t(o,e,c)}),r.markdownUpdated.length>0&&c&&!c.eq(e)){let t=s(e);r.markdownUpdated.forEach(e=>{e(o,t,l)}),l=t}c=e,d=null},200),p=new e.i({key:a,view:()=>({destroy:()=>{r.destroy.forEach(e=>e(o))}}),props:{handleDOMEvents:{focus:()=>(r.focus.forEach(e=>e(o)),!1),blur:()=>(r.blur.forEach(e=>e(o)),!1)}},state:{init:(e,t)=>{c=t.doc,l=s(t.doc)},apply:e=>{let t=e.selection;(!u&&t||u&&!t.eq(u))&&(r.selectionUpdated.forEach(e=>{e(o,t,u)}),u=t),!(!(e.docChanged||e.storedMarksSet)||e.getMeta(`addToHistory`)===!1)&&(d=e,f())}}});o.update(t.w,e=>e.concat(p)),await o.wait(t.n),r.mounted.forEach(e=>e(o))});o.meta={package:`@milkdown/plugin-listener`,displayName:`Listener`},exports.ListenerManager=r,exports.key=a,exports.listener=o,exports.listenerCtx=i;
|
package/dist/lib-BJgvZywM.cjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const e=require(`./dist-BCCSKc3M.cjs`),t=require(`./dist-C0PSMrs7.cjs`),n=require(`./dist-CPVooDwj.cjs`),r=require(`./index.browser-5LtNN9G9.cjs`);var i=function(e){return e.docTypeError=`docTypeError`,e.contextNotFound=`contextNotFound`,e.timerNotFound=`timerNotFound`,e.ctxCallOutOfScope=`ctxCallOutOfScope`,e.createNodeInParserFail=`createNodeInParserFail`,e.stackOverFlow=`stackOverFlow`,e.parserMatchError=`parserMatchError`,e.serializerMatchError=`serializerMatchError`,e.getAtomFromSchemaFail=`getAtomFromSchemaFail`,e.expectDomTypeError=`expectDomTypeError`,e.callCommandBeforeEditorView=`callCommandBeforeEditorView`,e.missingRootElement=`missingRootElement`,e.missingNodeInSchema=`missingNodeInSchema`,e.missingMarkInSchema=`missingMarkInSchema`,e.ctxNotBind=`ctxNotBind`,e.missingYjsDoc=`missingYjsDoc`,e.aiProviderError=`aiProviderError`,e.aiBuildContextError=`aiBuildContextError`,e}({}),a=class extends Error{constructor(e,t,n){super(t,n),this.name=`MilkdownError`,this.code=e,n?.cause!==void 0&&(this.cause=n.cause)}},o=(e,t)=>typeof t==`function`?`[Function]`:t,s=e=>JSON.stringify(e,o);function c(e){return new a(i.docTypeError,`Doc type error, unsupported type: ${s(e)}`)}function l(e){return new a(i.contextNotFound,`Context "${e}" not found, do you forget to inject it?`)}function u(){return new a(i.ctxCallOutOfScope,`Should not call a context out of the plugin.`)}function d(e,t,n){let r=`Cannot create node for ${`name`in e?e.name:e}`,o=e=>{if(e==null)return`null`;if(Array.isArray(e))return`[${e.map(o).join(`, `)}]`;if(typeof e==`object`)return`toJSON`in e&&typeof e.toJSON==`function`?JSON.stringify(e.toJSON()):`spec`in e?JSON.stringify(e.spec):JSON.stringify(e);if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return JSON.stringify(e);if(typeof e==`function`)return`[Function: ${e.name||`anonymous`}]`;try{return String(e)}catch{return`[Unserializable]`}},s=[[`[Description]`,r],[`[Attributes]`,t],[`[Content]`,(n??[]).map(e=>e?typeof e==`object`&&`type`in e?`${e}`:o(e):`null`)]].reduce((e,[t,n])=>{let r=`${t}: ${o(n)}.`;return e.concat(r)},[]);return new a(i.createNodeInParserFail,s.join(`
|
|
2
|
-
`))}function f(){return new a(i.stackOverFlow,`Stack over flow, cannot pop on an empty stack.`)}function ee(e){return new a(i.parserMatchError,`Cannot match target parser for node: ${s(e)}.`)}function te(e){return new a(i.serializerMatchError,`Cannot match target serializer for node: ${s(e)}.`)}function ne(e,t){return new a(i.getAtomFromSchemaFail,`Cannot get ${e}: ${t} from schema.`)}function p(){return new a(i.callCommandBeforeEditorView,`You're trying to call a command before editor view initialized, make sure to get commandManager from ctx after editor view has been initialized`)}var m=typeof navigator<`u`?navigator:null,re=typeof document<`u`?document:null,h=m&&m.userAgent||``,g=/Edge\/(\d+)/.exec(h),ie=/MSIE \d/.exec(h),_=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(h),v=!!(ie||_||g);ie?document.documentMode:_?+_[1]:g&&+g[1],!v&&/gecko\/(\d+)/i.test(h)&&+(/Firefox\/(\d+)/.exec(h)||[0,0])[1];var y=!v&&/Chrome\/(\d+)/.exec(h),ae=!!y;y&&+y[1],!v&&m&&/Apple Computer/.test(m.vendor)&&(/Mobile\/\w+/.test(h)||m&&m.maxTouchPoints>2)||m&&/Mac/.test(m.platform);var oe=/Android \d/.test(h);re&&`webkitFontSmoothing`in re.documentElement.style&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];function b(e,t,n,r,i,a){if(e.composing)return!1;let o=e.state,s=o.doc.resolve(t);if(s.parent.type.spec.code)return!1;let c=s.parent.textBetween(Math.max(0,s.parentOffset-500),s.parentOffset,void 0,``)+r;for(let s of i){let i=s,l=i.match.exec(c),u=l&&l[0]&&i.handler(o,l,t-(l[0].length-r.length),n);if(u)return i.undoable!==!1&&u.setMeta(a,{transform:u,from:t,to:n,text:r}),e.dispatch(u),!0}return!1}var se=new e.a(`MILKDOWN_CUSTOM_INPUTRULES`);function ce({rules:t}){let n=new e.i({key:se,isInputRules:!0,state:{init(){return null},apply(e,t){return e.getMeta(this)||(e.selectionSet||e.docChanged?null:t)}},props:{handleTextInput(e,r,i,a){return b(e,r,i,a,t,n)},handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:r}=e.state.selection;r&&b(e,r.pos,r.pos,``,t,n)}),!1),keydown:(e,t)=>!(oe&&ae&&t.key===`Enter`)||e.composing?!1:e.someProp(`handleKeyDown`,n=>n(e,t))?(t.preventDefault(),!0):!1},handleKeyDown(e,r){if(r.key!==`Enter`)return!1;let{$cursor:i}=e.state.selection;return i?b(e,i.pos,i.pos,`
|
|
3
|
-
`,t,n):!1}}});return n}var le=Object.defineProperty,ue=Object.defineProperties,de=Object.getOwnPropertyDescriptors,fe=Object.getOwnPropertySymbols,pe=Object.prototype.hasOwnProperty,me=Object.prototype.propertyIsEnumerable,he=(e,t,n)=>t in e?le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ge=(e,t)=>{for(var n in t||={})pe.call(t,n)&&he(e,n,t[n]);if(fe)for(var n of fe(t))me.call(t,n)&&he(e,n,t[n]);return e},_e=(e,t)=>ue(e,de(t));function ve(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function ye(e,t,n){let r=e.state.doc.content.size,i=ve(t,0,r),a=ve(n,0,r),o=e.coordsAtPos(i),s=e.coordsAtPos(a,-1),c=Math.min(o.top,s.top),l=Math.max(o.bottom,s.bottom),u=Math.min(o.left,s.left),d=Math.max(o.right,s.right),f={top:c,bottom:l,left:u,right:d,width:d-u,height:l-c,x:u,y:c};return _e(ge({},f),{toJSON:()=>f})}function be(e){if(e.content.childCount===1){let t=e.content.firstChild;if(t?.type.name===`text`&&t.marks.length===0)return t;if(t?.type.name===`paragraph`&&t.childCount===1){let e=t.firstChild;if(e?.type.name===`text`&&e.marks.length===0)return e}}return!1}function xe(e,t){let n=t.nodes[e];if(!n)throw ne(`node`,e);return n}var Se=class{constructor(){this.sliceMap=new Map,this.get=e=>{let t=typeof e==`string`?[...this.sliceMap.values()].find(t=>t.type.name===e):this.sliceMap.get(e.id);if(!t)throw l(typeof e==`string`?e:e.name);return t},this.remove=e=>{let t=typeof e==`string`?[...this.sliceMap.values()].find(t=>t.type.name===e):this.sliceMap.get(e.id);t&&this.sliceMap.delete(t.type.id)},this.has=e=>typeof e==`string`?[...this.sliceMap.values()].some(t=>t.type.name===e):this.sliceMap.has(e.id)}},Ce=class{#e;#t;#n;constructor(e,t,n){this.#e=[],this.#n=()=>{this.#e.forEach(e=>e(this.#t))},this.set=e=>{this.#t=e,this.#n()},this.get=()=>this.#t,this.update=e=>{this.#t=e(this.#t),this.#n()},this.type=n,this.#t=t,e.set(n.id,this)}on(e){return this.#e.push(e),()=>{this.#e=this.#e.filter(t=>t!==e)}}once(e){let t=this.on(n=>{e(n),t()});return t}off(e){this.#e=this.#e.filter(t=>t!==e)}offAll(){this.#e=[]}},we=class{constructor(e,t){this.id=Symbol(`Context-${t}`),this.name=t,this._defaultValue=e,this._typeInfo=()=>{throw u()}}create(e,t=this._defaultValue){return new Ce(e,t,this)}},x=(e,t)=>new we(e,t),Te=class{#e;#t;#n;#r;constructor(e,t){this.#e=null,this.#t=null,this.#r=`pending`,this.start=()=>(this.#e??=new Promise((e,t)=>{this.#t=t=>{t instanceof CustomEvent&&t.detail.id===this.#n&&(this.#r=`resolved`,this.#i(),t.stopImmediatePropagation(),e())},this.#a(()=>{this.#r===`pending`&&(this.#r=`rejected`),this.#i(),t(Error(`Timing ${this.type.name} timeout.`))}),this.#r=`pending`,addEventListener(this.type.name,this.#t)}),this.#e),this.done=()=>{let e=new CustomEvent(this.type.name,{detail:{id:this.#n}});dispatchEvent(e)},this.#i=()=>{this.#t&&removeEventListener(this.type.name,this.#t)},this.#a=e=>{setTimeout(()=>{e()},this.type.timeout)},this.#n=Symbol(t.name),this.type=t,e.set(t.id,this)}get status(){return this.#r}#i;#a},Ee=class{constructor(e,t=3e3){this.create=e=>new Te(e,this),this.id=Symbol(`Timer-${e}`),this.name=e,this.timeout=t}},S=(e,t=3e3)=>new Ee(e,t),De=class{},Oe=class{constructor(){this.elements=[],this.size=()=>this.elements.length,this.top=()=>this.elements.at(-1),this.push=e=>{this.top()?.push(e)},this.open=e=>{this.elements.push(e)},this.close=()=>{let e=this.elements.pop();if(!e)throw f();return e}}},ke=class e extends De{constructor(e,t,n){super(),this.type=e,this.content=t,this.attrs=n}push(e,...t){this.content.push(e,...t)}pop(){return this.content.pop()}static create(t,n,r){return new e(t,n,r)}},Ae=class extends Oe{#e;static{this.create=(e,t)=>{let n=new this(e);return e=>(n.run(t,e),n.toDoc())}}constructor(t){super(),this.#e=e.w.none,this.#t=e=>e.isText,this.#n=(t,n)=>{if(this.#t(t)&&this.#t(n)&&e.w.sameSet(t.marks,n.marks))return this.schema.text(t.text+n.text,t.marks)},this.#r=e=>{let t=Object.values({...this.schema.nodes,...this.schema.marks}).find(t=>t.spec.parseMarkdown.match(e));if(!t)throw ee(e);return t},this.#i=e=>{let t=this.#r(e);t.spec.parseMarkdown.runner(this,e,t)},this.injectRoot=(e,t,n)=>(this.openNode(t,n),this.next(e.children),this),this.openNode=(e,t)=>(this.open(ke.create(e,[],t)),this),this.#a=()=>{this.#e=e.w.none;let t=this.close();return this.#o(t.type,t.attrs,t.content)},this.closeNode=()=>{try{this.#a()}catch(e){console.error(e)}return this},this.#o=(e,t,n)=>{let r=e.createAndFill(t,n,this.#e);if(!r)throw d(e,t,n);return this.push(r),r},this.addNode=(e,t,n)=>{try{this.#o(e,t,n)}catch(e){console.error(e)}return this},this.openMark=(e,t)=>{let n=e.create(t);return this.#e=n.addToSet(this.#e),this},this.closeMark=e=>(this.#e=e.removeFromSet(this.#e),this),this.addText=e=>{try{let t=this.top();if(!t)throw f();let n=t.pop(),r=this.schema.text(e,this.#e);if(!n)return t.push(r),this;let i=this.#n(n,r);return i?(t.push(i),this):(t.push(n,r),this)}catch(e){return console.error(e),this}},this.build=()=>{let e;do e=this.#a();while(this.size());return e},this.next=(e=[])=>([e].flat().forEach(e=>this.#i(e)),this),this.toDoc=()=>this.build(),this.run=(e,t)=>{let n=e.runSync(e.parse(t),t);return this.next(n),this},this.schema=t}#t;#n;#r;#i;#a;#o},je=class e extends De{constructor(e,t,n,r={}){super(),this.type=e,this.children=t,this.value=n,this.props=r,this.push=(e,...t)=>{this.children||=[],this.children.push(e,...t)},this.pop=()=>this.children?.pop()}static{this.create=(t,n,r,i={})=>new e(t,n,r,i)}},Me=e=>Object.prototype.hasOwnProperty.call(e,`size`),Ne=class extends Oe{#e;static{this.create=(e,t)=>{let n=new this(e);return e=>(n.run(e),n.toString(t))}}constructor(t){super(),this.#e=e.w.none,this.#t=e=>{let t=Object.values({...this.schema.nodes,...this.schema.marks}).find(t=>t.spec.toMarkdown.match(e));if(!t)throw te(e.type);return t},this.#n=e=>this.#t(e).spec.toMarkdown.runner(this,e),this.#r=(e,t)=>this.#t(e).spec.toMarkdown.runner(this,e,t),this.#i=e=>{let{marks:t}=e,n=e=>e.type.spec.priority??50;[...t].sort((e,t)=>n(e)-n(t)).every(t=>!this.#r(t,e))&&this.#n(e),t.forEach(e=>this.#f(e))},this.#a=(e,t)=>{if(e.type===t||e.children?.length!==1)return e;let n=e=>{if(e.type===t)return e.value==null?e:null;if(e.children?.length!==1)return null;let[r]=e.children;return r?n(r):null},r=n(e);if(!r)return e;let i=r.children?[...r.children]:void 0,a={...e,children:i};return a.children=i,r.children=[a],r},this.#o=e=>{let{children:t}=e;return t&&(e.children=t.reduce((e,t,n)=>{if(n===0)return[t];let r=e.at(-1);if(r&&r.isMark&&t.isMark){t=this.#a(t,r.type);let{children:n,...i}=t,{children:a,...o}=r;if(t.type===r.type&&n&&a&&JSON.stringify(i)===JSON.stringify(o)){let t={...o,children:[...a,...n]};return e.slice(0,-1).concat(this.#o(t))}}return e.concat(t)},[])),e},this.#s=e=>{let t={...e.props,type:e.type};return e.children&&(t.children=e.children),e.value&&(t.value=e.value),t},this.openNode=(e,t,n)=>(this.open(je.create(e,void 0,t,n)),this),this.#c=(e,t)=>{let n=``,r=``,i=e.children,a=-1,o=-1,s=e=>{e&&e.forEach((e,t)=>{e.type===`text`&&e.value&&(a<0&&(a=t),o=t)})};if(i){s(i);let e=i?.[o],t=i?.[a];if(e&&e.value.endsWith(` `)){let t=e.value,n=t.trimEnd();r=t.slice(n.length),e.value=n}if(t&&t.value.startsWith(` `)){let e=t.value,r=e.trimStart();n=e.slice(0,e.length-r.length),t.value=r}}n.length&&this.#u(`text`,void 0,n);let c=t();return r.length&&this.#u(`text`,void 0,r),c},this.#l=(e=!1)=>{let t=this.close(),n=()=>this.#u(t.type,t.children,t.value,t.props);return e?this.#c(t,n):n()},this.closeNode=()=>(this.#l(),this),this.#u=(e,t,n,r)=>{let i=je.create(e,t,n,r),a=this.#o(this.#s(i));return this.push(a),a},this.addNode=(e,t,n,r)=>(this.#u(e,t,n,r),this),this.#d=(e,t,n,r)=>e.isInSet(this.#e)?this:(this.#e=e.addToSet(this.#e),this.openNode(t,n,{...r,isMark:!0})),this.#f=e=>{e.isInSet(this.#e)&&(this.#e=e.type.removeFromSet(this.#e),this.#l(!0))},this.withMark=(e,t,n,r)=>(this.#d(e,t,n,r),this),this.closeMark=e=>(this.#f(e),this),this.build=()=>{let e=null;do e=this.#l();while(this.size());return e},this.next=e=>Me(e)?(e.forEach(e=>{this.#i(e)}),this):(this.#i(e),this),this.toString=e=>e.stringify(this.build()),this.run=e=>(this.next(e),this),this.schema=t}#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f};function C(e,t){return e.meta={package:`@milkdown/core`,group:`System`,...t},e}var Pe={text:(e,t,n,r)=>{let i=e.value;return/^[^*_\\]*\s+$/.test(i)?i:n.safe(i,{...r,encode:[]})},strong:(e,t,n,r)=>{let i=e.marker||n.options.strong||`*`,a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i);return s+=o.move(n.containerPhrasing(e,{before:s,after:i,...o.current()})),s+=o.move(i+i),a(),s},emphasis:(e,t,n,r)=>{let i=e.marker||n.options.emphasis||`*`,a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i);return s+=o.move(n.containerPhrasing(e,{before:s,after:i,...o.current()})),s+=o.move(i),a(),s}},w=x({},`editorView`),T=x({},`editorState`);x([],`initTimer`),x({},`editor`);var Fe=x([],`inputRules`),E=x([],`prosePlugins`),Ie=x([],`remarkPlugins`),Le=x([],`nodeView`),Re=x([],`markView`),D=x(t.u().use(t.y).use(t.f),`remark`);x({handlers:Pe,encode:[]},`remarkStringifyOptions`),S(`ConfigReady`);var ze=S(`InitReady`),O=S(`SchemaReady`),k=x([],`schemaTimer`),A=x({},`schema`),j=x([],`nodes`),M=x([],`marks`);function Be(e){return{...e,parseDOM:e.parseDOM?.map(t=>({priority:e.priority,...t}))}}C(t=>(t.inject(A,{}).inject(j,[]).inject(M,[]).inject(k,[ze]).record(O),async()=>{await t.waitTimers(k);let n=t.get(D),r=t.get(Ie).reduce((e,t)=>e.use(t.plugin,t.options),n);t.set(D,r);let i=new e.O({nodes:Object.fromEntries(t.get(j).map(([e,t])=>[e,Be(t)])),marks:Object.fromEntries(t.get(M).map(([e,t])=>[e,Be(t)]))});return t.set(A,i),t.done(O),()=>{t.remove(A).remove(j).remove(M).remove(k).clearTimer(O)}}),{displayName:`Schema`});var Ve=class{constructor(){this.#e=new Se,this.#t=null,this.setCtx=e=>{this.#t=e},this.chain=()=>{if(this.#t==null)throw p();let e=this.#t,t=[],r=this.get.bind(this),i={run:()=>{let r=n.r(...t),i=e.get(w);return r(i.state,i.dispatch,i)},inline:e=>(t.push(e),i),pipe:a.bind(this)};function a(e,n){let a=r(e);return t.push(a(n)),i}return i}}#e;#t;get ctx(){return this.#t}create(e,t){let n=e.create(this.#e.sliceMap);return n.set(t),n}get(e){return this.#e.get(e).get()}remove(e){return this.#e.remove(e)}call(e,t){if(this.#t==null)throw p();let n=this.get(e)(t),r=this.#t.get(w);return n(r.state,r.dispatch,r)}inline(e){if(this.#t==null)throw p();let t=this.#t.get(w);return e(t.state,t.dispatch,t)}},He=x(new Ve,`commands`),N=x([O],`commandsTimer`),P=S(`CommandsReady`);C(e=>{let t=new Ve;return t.setCtx(e),e.inject(He,t).inject(N,[O]).record(P),async()=>(await e.waitTimers(N),e.done(P),()=>{e.remove(He).remove(N).clearTimer(P)})},{displayName:`Commands`});function Ue(e){return e.Backspace=n.r(t.c,n.a,n.u,n.y),e}var We=x(new class{constructor(){this.#e=null,this.#t=[],this.setCtx=e=>{this.#e=e},this.add=e=>(this.#t.push(e),()=>{this.#t=this.#t.filter(t=>t!==e)}),this.addObjectKeymap=e=>{let t=[];return Object.entries(e).forEach(([e,n])=>{if(typeof n==`function`){let r={key:e,onRun:()=>n};this.#t.push(r),t.push(()=>{this.#t=this.#t.filter(e=>e!==r)})}else this.#t.push(n),t.push(()=>{this.#t=this.#t.filter(e=>e!==n)})}),()=>{t.forEach(e=>e())}},this.addBaseKeymap=()=>{let e=Ue(n.n);return this.addObjectKeymap(e)},this.build=()=>{let e={};return this.#t.forEach(t=>{e[t.key]=[...e[t.key]||[],t]}),Object.fromEntries(Object.entries(e).map(([e,t])=>{let r=t.sort((e,t)=>(t.priority??50)-(e.priority??50));return[e,(e,t,i)=>{let a=this.#e;if(a==null)throw u();return n.r(...r.map(e=>e.onRun(a)))(e,t,i)}]}))}}#e;#t;get ctx(){return this.#e}},`keymap`);x([O],`keymapTimer`);var Ge=S(`KeymapReady`),F=S(`ParserReady`),Ke=(()=>{throw u()}),I=x(Ke,`parser`),L=x([],`parserTimer`);C(e=>(e.inject(I,Ke).inject(L,[O]).record(F),async()=>{await e.waitTimers(L);let t=e.get(D),n=e.get(A);return e.set(I,Ae.create(n,t)),e.done(F),()=>{e.remove(I).remove(L).clearTimer(F)}}),{displayName:`Parser`});var R=S(`SerializerReady`),z=x([],`serializerTimer`),qe=(()=>{throw u()}),B=x(qe,`serializer`);C(e=>(e.inject(B,qe).inject(z,[O]).record(R),async()=>{await e.waitTimers(z);let t=e.get(D),n=e.get(A);return e.set(B,Ne.create(n,t)),e.done(R),()=>{e.remove(B).remove(z).clearTimer(R)}}),{displayName:`Serializer`});var V=x(``,`defaultValue`),H=x(e=>e,`stateOptions`),U=x([],`editorStateTimer`),W=S(`EditorStateReady`);function Je(t,n,r){if(typeof t==`string`)return n(t);if(t.type===`html`)return e.x.fromSchema(r).parse(t.dom);if(t.type===`json`)return e.T.fromJSON(r,t.value);throw c(t)}var Ye=new e.a(`MILKDOWN_STATE_TRACKER`);C(n=>(n.inject(V,``).inject(T,{}).inject(H,e=>e).inject(U,[F,R,P,Ge]).record(W),async()=>{await n.waitTimers(U);let r=n.get(A),i=n.get(I),a=n.get(Fe),o=n.get(H),s=n.get(E),c=Je(n.get(V),i,r),l=n.get(We),u=l.addBaseKeymap(),d=[...s,new e.i({key:Ye,state:{init:()=>{},apply:(e,t,r,i)=>{n.set(T,i)}}}),ce({rules:a}),t.a(l.build())];n.set(E,d);let f=o({schema:r,doc:c,plugins:d}),ee=e.n.create(f);return n.set(T,ee),n.done(W),()=>{u(),n.remove(V).remove(T).remove(H).remove(U).clearTimer(W)}}),{displayName:`EditorState`});var G=x([],`pasteRule`),K=x([O],`pasteRuleTimer`),q=S(`PasteRuleReady`);C(e=>(e.inject(G,[]).inject(K,[O]).record(q),async()=>(await e.waitTimers(K),e.done(q),()=>{e.remove(G).remove(K).clearTimer(q)})),{displayName:`PasteRule`});var J=S(`EditorViewReady`),Y=x([],`editorViewTimer`),X=x({},`editorViewOptions`),Z=x(null,`root`),Q=x(null,`rootDOM`),$=x({},`rootAttrs`);function Xe(e,t){let n=document.createElement(`div`);n.className=`milkdown`,e.appendChild(n),t.set(Q,n);let r=t.get($);return Object.entries(r).forEach(([e,t])=>n.setAttribute(e,t)),n}function Ze(e){e.classList.add(`editor`),e.setAttribute(`role`,`textbox`)}var Qe=new e.a(`MILKDOWN_VIEW_CLEAR`);C(n=>(n.inject(Z,document.body).inject(w,{}).inject(X,{}).inject(Q,null).inject($,{}).inject(Y,[W,q]).record(J),async()=>{await n.wait(ze);let r=n.get(Z)||document.body,i=typeof r==`string`?document.querySelector(r):r;n.update(E,t=>[new e.i({key:Qe,view:e=>{let t=i?Xe(i,n):void 0;return(()=>{if(t&&i){let n=e.dom;i.replaceChild(t,n),t.appendChild(n)}})(),{destroy:()=>{t?.parentNode&&t?.parentNode.replaceChild(e.dom,t),t?.remove()}}}}),...t]),await n.waitTimers(Y);let a=n.get(T),o=n.get(X),s=new t.r(i,{state:a,nodeViews:Object.fromEntries(n.get(Le)),markViews:Object.fromEntries(n.get(Re)),transformPasted:(e,t,r)=>(n.get(G).sort((e,t)=>(t.priority??50)-(e.priority??50)).map(e=>e.run).forEach(n=>{e=n(e,t,r)}),e),...o});return Ze(s.dom),n.set(w,s),n.done(J),()=>{s?.destroy(),n.remove(Z).remove(w).remove(X).remove(Q).remove($).remove(Y).clearTimer(J)}}),{displayName:`EditorView`}),r.t(`abcedfghicklmn`,10);function $e(e){let t,n=n=>async()=>(await n.wait(O),t=e(n),n.update(E,e=>[...e,t]),()=>{n.update(E,e=>e.filter(e=>e!==t))});return n.plugin=()=>t,n.key=()=>t.spec.key,n}function et(e){let t=n=>async()=>{await n.wait(Ge);let r=n.get(We),i=e(n),a=r.addObjectKeymap(i);return t.keymap=i,()=>{a()}};return t}function tt(e,t){let n=x(e,t),r=e=>(e.inject(n),()=>()=>{e.remove(n)});return r.key=n,r}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return xe}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return be}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return $e}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return et}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return tt}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return ye}});
|
package/dist/lib-BNOSyYeU.cjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const e=require(`./rolldown-runtime-CerMd-t8.cjs`),t=require(`./dist-BCCSKc3M.cjs`),n=require(`./lib-IahjxPWM.cjs`),r=require(`./dist-C0PSMrs7.cjs`),i=require(`./dist-CPVooDwj.cjs`),a=require(`./lib-DWZA8C0h.cjs`),o=require(`./schema-list-bL8FNes5.cjs`);function s(e){let t=new Map;if(!e||!e.type)throw Error(`mdast-util-definitions expected node`);return r.m(e,`definition`,function(e){let n=c(e.identifier);n&&!t.get(n)&&t.set(n,e)}),n;function n(e){let n=c(e);return t.get(n)}}function c(e){return String(e||``).toUpperCase()}function l(){return function(e){let t=s(e);r.m(e,function(e,n,i){if(e.type===`definition`&&i!==void 0&&typeof n==`number`)return i.children.splice(n,1),[r.h,n];if(e.type===`imageReference`||e.type===`linkReference`){let a=t(e.identifier);if(a&&i&&typeof n==`number`)return i.children[n]=e.type===`imageReference`?{type:`image`,url:a.url,title:a.title,alt:e.alt}:{type:`link`,url:a.url,title:a.title,children:e.children},[r.h,n]}})}}var u=e.n({addBlockTypeCommand:()=>Xe,blockquoteAttr:()=>I,blockquoteKeymap:()=>z,blockquoteSchema:()=>L,bulletListAttr:()=>we,bulletListKeymap:()=>De,bulletListSchema:()=>X,clearTextInCurrentBlockCommand:()=>qe,codeBlockAttr:()=>B,codeBlockKeymap:()=>U,codeBlockSchema:()=>V,commands:()=>Qe,commonmark:()=>ht,createCodeBlockCommand:()=>H,createCodeBlockInputRule:()=>he,docSchema:()=>ce,downgradeHeadingCommand:()=>P,emphasisAttr:()=>p,emphasisKeymap:()=>g,emphasisSchema:()=>m,emphasisStarInputRule:()=>ee,emphasisUnderscoreInputRule:()=>te,hardbreakAttr:()=>K,hardbreakClearMarkPlugin:()=>ut,hardbreakFilterNodes:()=>$,hardbreakFilterPlugin:()=>dt,hardbreakKeymap:()=>be,hardbreakSchema:()=>q,headingAttr:()=>j,headingIdGenerator:()=>A,headingKeymap:()=>F,headingSchema:()=>M,hrAttr:()=>xe,hrSchema:()=>Y,htmlAttr:()=>Be,htmlSchema:()=>Ve,imageAttr:()=>W,imageSchema:()=>G,inlineCodeAttr:()=>b,inlineCodeInputRule:()=>ie,inlineCodeKeymap:()=>C,inlineCodeSchema:()=>x,inlineNodesCursorPlugin:()=>lt,inputRules:()=>Ue,insertHardbreakCommand:()=>J,insertHrCommand:()=>Ce,insertHrInputRule:()=>Se,insertImageCommand:()=>_e,insertImageInputRule:()=>ye,isMarkSelectedCommand:()=>Ge,isNodeSelectedCommand:()=>Ke,keymap:()=>$e,liftFirstListItemCommand:()=>Le,liftListItemCommand:()=>Pe,linkAttr:()=>ae,linkSchema:()=>w,listItemAttr:()=>Me,listItemKeymap:()=>Re,listItemSchema:()=>Q,markInputRules:()=>We,orderedListAttr:()=>Oe,orderedListKeymap:()=>je,orderedListSchema:()=>Z,paragraphAttr:()=>E,paragraphKeymap:()=>k,paragraphSchema:()=>D,plugins:()=>mt,remarkAddOrderInListPlugin:()=>et,remarkHtmlTransformer:()=>st,remarkInlineLinkPlugin:()=>nt,remarkLineBreak:()=>tt,remarkMarker:()=>ct,remarkPreserveEmptyLinePlugin:()=>T,schema:()=>He,selectTextNearPosCommand:()=>Ze,setBlockTypeCommand:()=>Je,sinkListItemCommand:()=>Ne,splitListItemCommand:()=>Fe,strongAttr:()=>ne,strongInputRule:()=>re,strongKeymap:()=>y,strongSchema:()=>_,syncHeadingIdPlugin:()=>ft,syncListOrderPlugin:()=>pt,textSchema:()=>ze,toggleEmphasisCommand:()=>h,toggleInlineCodeCommand:()=>S,toggleLinkCommand:()=>oe,toggleStrongCommand:()=>v,turnIntoTextCommand:()=>O,updateCodeBlockLanguageCommand:()=>ge,updateImageCommand:()=>ve,updateLinkCommand:()=>se,wrapInBlockTypeCommand:()=>Ye,wrapInBlockquoteCommand:()=>R,wrapInBlockquoteInputRule:()=>me,wrapInBulletListCommand:()=>Ee,wrapInBulletListInputRule:()=>Te,wrapInHeadingCommand:()=>N,wrapInHeadingInputRule:()=>pe,wrapInOrderedListCommand:()=>Ae,wrapInOrderedListInputRule:()=>ke});function d(e,n){if(!(n.childCount>=1&&n.lastChild?.type.name===`hardbreak`)){e.next(n.content);return}let r=[];n.content.forEach((e,t,i)=>{i!==n.childCount-1&&r.push(e)}),e.next(t.C.fromArray(r))}function f(e,t){return Object.assign(e,{meta:{package:`@milkdown/preset-commonmark`,...t}}),e}var p=a.i(`emphasis`);f(p,{displayName:`Attr<emphasis>`,group:`Emphasis`});var m=a.a(`emphasis`,e=>({attrs:{marker:{default:e.get(n.E).emphasis||`*`,validate:`string`}},parseDOM:[{tag:`i`},{tag:`em`},{style:`font-style`,getAttrs:e=>e===`italic`}],toDOM:t=>[`em`,e.get(p.key)(t)],parseMarkdown:{match:e=>e.type===`emphasis`,runner:(e,t,n)=>{e.openMark(n,{marker:t.marker}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>e.type.name===`emphasis`,runner:(e,t)=>{e.withMark(t,`emphasis`,void 0,{marker:t.attrs.marker})}}}));f(m.mark,{displayName:`MarkSchema<emphasis>`,group:`Emphasis`}),f(m.ctx,{displayName:`MarkSchemaCtx<emphasis>`,group:`Emphasis`});var h=a.t(`ToggleEmphasis`,e=>()=>i.O(m.type(e)));f(h,{displayName:`Command<toggleEmphasisCommand>`,group:`Emphasis`});var ee=a.r(e=>n.L(/(?:^|[^*])\*([^*]+)\*$/,m.type(e),{getAttr:()=>({marker:`*`}),updateCaptured:({fullMatch:e,start:t})=>e.startsWith(`*`)?{}:{fullMatch:e.slice(1),start:t+1}}));f(ee,{displayName:`InputRule<emphasis>|Star`,group:`Emphasis`});var te=a.r(e=>n.L(/\b_(?![_\s])(.*?[^_\s])_\b/,m.type(e),{getAttr:()=>({marker:`_`}),updateCaptured:({fullMatch:e,start:t})=>e.startsWith(`_`)?{}:{fullMatch:e.slice(1),start:t+1}}));f(te,{displayName:`InputRule<emphasis>|Underscore`,group:`Emphasis`});var g=a.f(`emphasisKeymap`,{ToggleEmphasis:{shortcuts:`Mod-i`,command:e=>{let t=e.get(n.s);return()=>t.call(h.key)}}});f(g.ctx,{displayName:`KeymapCtx<emphasis>`,group:`Emphasis`}),f(g.shortcuts,{displayName:`Keymap<emphasis>`,group:`Emphasis`});var ne=a.i(`strong`);f(ne,{displayName:`Attr<strong>`,group:`Strong`});var _=a.a(`strong`,e=>({attrs:{marker:{default:e.get(n.E).strong||`*`,validate:`string`}},parseDOM:[{tag:`b`,getAttrs:e=>e.style.fontWeight!=`normal`&&null},{tag:`strong`},{style:`font-style`,getAttrs:e=>e===`bold`},{style:`font-weight=400`,clearMark:e=>e.type.name==`strong`},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],toDOM:t=>[`strong`,e.get(ne.key)(t)],parseMarkdown:{match:e=>e.type===`strong`,runner:(e,t,n)=>{e.openMark(n,{marker:t.marker}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>e.type.name===`strong`,runner:(e,t)=>{e.withMark(t,`strong`,void 0,{marker:t.attrs.marker})}}}));f(_.mark,{displayName:`MarkSchema<strong>`,group:`Strong`}),f(_.ctx,{displayName:`MarkSchemaCtx<strong>`,group:`Strong`});var v=a.t(`ToggleStrong`,e=>()=>i.O(_.type(e)));f(v,{displayName:`Command<toggleStrongCommand>`,group:`Strong`});var re=a.r(e=>n.L(/(?<![\w:/])(?:\*\*|__)([^*_]+?)(?:\*\*|__)(?![\w/])$/,_.type(e),{getAttr:e=>({marker:e[0].startsWith(`*`)?`*`:`_`})}));f(re,{displayName:`InputRule<strong>`,group:`Strong`});var y=a.f(`strongKeymap`,{ToggleBold:{shortcuts:[`Mod-b`],command:e=>{let t=e.get(n.s);return()=>t.call(v.key)}}});f(y.ctx,{displayName:`KeymapCtx<strong>`,group:`Strong`}),f(y.shortcuts,{displayName:`Keymap<strong>`,group:`Strong`});var b=a.i(`inlineCode`);f(b,{displayName:`Attr<inlineCode>`,group:`InlineCode`});var x=a.a(`inlineCode`,e=>({priority:100,code:!0,parseDOM:[{tag:`code`}],toDOM:t=>[`code`,e.get(b.key)(t)],parseMarkdown:{match:e=>e.type===`inlineCode`,runner:(e,t,n)=>{e.openMark(n),e.addText(t.value),e.closeMark(n)}},toMarkdown:{match:e=>e.type.name===`inlineCode`,runner:(e,t,n)=>(e.withMark(t,`inlineCode`,n.text||``),!0)}}));f(x.mark,{displayName:`MarkSchema<inlineCode>`,group:`InlineCode`}),f(x.ctx,{displayName:`MarkSchemaCtx<inlineCode>`,group:`InlineCode`});var S=a.t(`ToggleInlineCode`,e=>()=>(t,n)=>{let{selection:r,tr:i}=t;if(r.empty)return!1;let{from:a,to:o}=r;return t.doc.rangeHasMark(a,o,x.type(e))?(n?.(i.removeMark(a,o,x.type(e))),!0):(Object.keys(t.schema.marks).filter(e=>e!==x.type.name).map(e=>t.schema.marks[e]).forEach(e=>{i.removeMark(a,o,e)}),n?.(i.addMark(a,o,x.type(e).create())),!0)});f(S,{displayName:`Command<toggleInlineCodeCommand>`,group:`InlineCode`});var ie=a.r(e=>n.L(/(?:`)([^`]+)(?:`)$/,x.type(e)));f(ie,{displayName:`InputRule<inlineCodeInputRule>`,group:`InlineCode`});var C=a.f(`inlineCodeKeymap`,{ToggleInlineCode:{shortcuts:`Mod-e`,command:e=>{let t=e.get(n.s);return()=>t.call(S.key)}}});f(C.ctx,{displayName:`KeymapCtx<inlineCode>`,group:`InlineCode`}),f(C.shortcuts,{displayName:`Keymap<inlineCode>`,group:`InlineCode`});var ae=a.i(`link`);f(ae,{displayName:`Attr<link>`,group:`Link`});var w=a.a(`link`,e=>({attrs:{href:{validate:`string`},title:{default:null,validate:`string|null`}},parseDOM:[{tag:`a[href]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw n.V(e);return{href:e.getAttribute(`href`),title:e.getAttribute(`title`)}}}],toDOM:t=>[`a`,{...e.get(ae.key)(t),...t.attrs}],parseMarkdown:{match:e=>e.type===`link`,runner:(e,t,n)=>{let r=t.url,i=t.title;e.openMark(n,{href:r,title:i}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>e.type.name===`link`,runner:(e,t)=>{e.withMark(t,`link`,void 0,{title:t.attrs.title,url:t.attrs.href})}}}));f(w.mark,{displayName:`MarkSchema<link>`,group:`Link`});var oe=a.t(`ToggleLink`,e=>(t={})=>i.O(w.type(e),t));f(oe,{displayName:`Command<toggleLinkCommand>`,group:`Link`});var se=a.t(`UpdateLink`,e=>(n={})=>(r,i)=>{if(!i)return!1;let a,o=-1,{selection:s}=r,{from:c,to:l}=s;if(r.doc.nodesBetween(c,c===l?l+1:l,(t,n)=>{if(w.type(e).isInSet(t.marks))return a=t,o=n,!1}),!a)return!1;let u=a.marks.find(({type:t})=>t===w.type(e));if(!u)return!1;let d=o,f=o+a.nodeSize,{tr:p}=r,m=w.type(e).create({...u.attrs,...n});return m?(i(p.removeMark(d,f,u).addMark(d,f,m).setSelection(new t.c(p.selection.$anchor)).scrollIntoView()),!0):!1});f(se,{displayName:`Command<updateLinkCommand>`,group:`Link`});var ce=a.o(`doc`,()=>({content:`block+`,parseMarkdown:{match:({type:e})=>e===`root`,runner:(e,t,n)=>{e.injectRoot(t,n)}},toMarkdown:{match:e=>e.type.name===`doc`,runner:(e,t)=>{e.openNode(`root`),e.next(t.content)}}}));f(ce,{displayName:`NodeSchema<doc>`,group:`Doc`});function le(e){return r.g(e,e=>e.type===`html`&&[`<br />`,`<br>`,`<br >`,`<br/>`].includes(e.value?.trim()),(e,t)=>{if(!t.length)return;let n=t[t.length-1];if(!n)return;let r=n.children.indexOf(e);r!==-1&&n.children.splice(r,1)},!0)}var T=a.d(`remark-preserve-empty-line`,()=>()=>le);f(T.plugin,{displayName:`Remark<remarkPreserveEmptyLine>`,group:`Remark`}),f(T.options,{displayName:`RemarkConfig<remarkPreserveEmptyLine>`,group:`Remark`});var E=a.s(`paragraph`);f(E,{displayName:`Attr<paragraph>`,group:`Paragraph`});var D=a.c(`paragraph`,e=>({content:`inline*`,group:`block`,parseDOM:[{tag:`p`}],toDOM:t=>[`p`,e.get(E.key)(t),0],parseMarkdown:{match:e=>e.type===`paragraph`,runner:(e,t,n)=>{e.openNode(n),t.children?e.next(t.children):e.addText(t.value||``),e.closeNode()}},toMarkdown:{match:e=>e.type.name===`paragraph`,runner:(t,r)=>{let i=e.get(n.f).state?.doc.lastChild;t.openNode(`paragraph`),(!r.content||r.content.size===0)&&r!==i&&ue(e)?t.addNode(`html`,void 0,`<br />`):d(t,r),t.closeNode()}}}));function ue(e){let t=!1;try{e.get(T.id),t=!0}catch{t=!1}return t}f(D.node,{displayName:`NodeSchema<paragraph>`,group:`Paragraph`}),f(D.ctx,{displayName:`NodeSchemaCtx<paragraph>`,group:`Paragraph`});var O=a.t(`TurnIntoText`,e=>()=>i.w(D.type(e)));f(O,{displayName:`Command<turnIntoTextCommand>`,group:`Paragraph`});var k=a.f(`paragraphKeymap`,{TurnIntoText:{shortcuts:`Mod-Alt-0`,command:e=>{let t=e.get(n.s);return()=>t.call(O.key)}}});f(k.ctx,{displayName:`KeymapCtx<paragraph>`,group:`Paragraph`}),f(k.shortcuts,{displayName:`Keymap<paragraph>`,group:`Paragraph`});var de=[,,,,,,].fill(0).map((e,t)=>t+1);function fe(e){return e.textContent.toLowerCase().trim().replace(/\s+/g,`-`)}var A=a.n(fe,`headingIdGenerator`);f(A,{displayName:`Ctx<HeadingIdGenerator>`,group:`Heading`});var j=a.s(`heading`);f(j,{displayName:`Attr<heading>`,group:`Heading`});var M=a.c(`heading`,e=>{let t=e.get(A.key);return{content:`inline*`,group:`block`,defining:!0,attrs:{id:{default:``,validate:`string`},level:{default:1,validate:`number`}},parseDOM:de.map(e=>({tag:`h${e}`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw n.V(t);return{level:e,id:t.id}}})),toDOM:n=>[`h${n.attrs.level}`,{...e.get(j.key)(n),id:n.attrs.id||t(n)},0],parseMarkdown:{match:({type:e})=>e===`heading`,runner:(e,t,n)=>{let r=t.depth;e.openNode(n,{level:r}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>e.type.name===`heading`,runner:(e,t)=>{e.openNode(`heading`,void 0,{depth:t.attrs.level}),d(e,t),e.closeNode()}}}});f(M.node,{displayName:`NodeSchema<heading>`,group:`Heading`}),f(M.ctx,{displayName:`NodeSchemaCtx<heading>`,group:`Heading`});var pe=a.r(e=>r.s(/^(?<hashes>#+)\s$/,M.type(e),t=>{let r=t.groups?.hashes?.length||0,{$from:i}=e.get(n.f).state.selection,a=i.node();if(a.type.name===`heading`){let e=Number(a.attrs.level)+Number(r);return e>6&&(e=6),{level:e}}return{level:r}}));f(pe,{displayName:`InputRule<wrapInHeadingInputRule>`,group:`Heading`});var N=a.t(`WrapInHeading`,e=>t=>(t??=1,t<1?i.w(D.type(e)):i.w(M.type(e),{level:t})));f(N,{displayName:`Command<wrapInHeadingCommand>`,group:`Heading`});var P=a.t(`DowngradeHeading`,e=>()=>(t,n,r)=>{let{$from:a}=t.selection,o=a.node();if(o.type!==M.type(e)||!t.selection.empty||a.parentOffset!==0)return!1;let s=o.attrs.level-1;return s?(n?.(t.tr.setNodeMarkup(t.selection.$from.before(),void 0,{...o.attrs,level:s})),!0):i.w(D.type(e))(t,n,r)});f(P,{displayName:`Command<downgradeHeadingCommand>`,group:`Heading`});var F=a.f(`headingKeymap`,{TurnIntoH1:{shortcuts:`Mod-Alt-1`,command:e=>{let t=e.get(n.s);return()=>t.call(N.key,1)}},TurnIntoH2:{shortcuts:`Mod-Alt-2`,command:e=>{let t=e.get(n.s);return()=>t.call(N.key,2)}},TurnIntoH3:{shortcuts:`Mod-Alt-3`,command:e=>{let t=e.get(n.s);return()=>t.call(N.key,3)}},TurnIntoH4:{shortcuts:`Mod-Alt-4`,command:e=>{let t=e.get(n.s);return()=>t.call(N.key,4)}},TurnIntoH5:{shortcuts:`Mod-Alt-5`,command:e=>{let t=e.get(n.s);return()=>t.call(N.key,5)}},TurnIntoH6:{shortcuts:`Mod-Alt-6`,command:e=>{let t=e.get(n.s);return()=>t.call(N.key,6)}},DowngradeHeading:{shortcuts:[`Delete`,`Backspace`],command:e=>{let t=e.get(n.s);return()=>t.call(P.key)}}});f(F.ctx,{displayName:`KeymapCtx<heading>`,group:`Heading`}),f(F.shortcuts,{displayName:`Keymap<heading>`,group:`Heading`});var I=a.s(`blockquote`);f(I,{displayName:`Attr<blockquote>`,group:`Blockquote`});var L=a.c(`blockquote`,e=>({content:`block+`,group:`block`,defining:!0,parseDOM:[{tag:`blockquote`}],toDOM:t=>[`blockquote`,e.get(I.key)(t),0],parseMarkdown:{match:({type:e})=>e===`blockquote`,runner:(e,t,n)=>{e.openNode(n).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name===`blockquote`,runner:(e,t)=>{e.openNode(`blockquote`).next(t.content).closeNode()}}}));f(L.node,{displayName:`NodeSchema<blockquote>`,group:`Blockquote`}),f(L.ctx,{displayName:`NodeSchemaCtx<blockquote>`,group:`Blockquote`});var me=a.r(e=>r.l(/^\s*>\s$/,L.type(e)));f(me,{displayName:`InputRule<wrapInBlockquoteInputRule>`,group:`Blockquote`});var R=a.t(`WrapInBlockquote`,e=>()=>i.k(L.type(e)));f(R,{displayName:`Command<wrapInBlockquoteCommand>`,group:`Blockquote`});var z=a.f(`blockquoteKeymap`,{WrapInBlockquote:{shortcuts:`Mod-Shift-b`,command:e=>{let t=e.get(n.s);return()=>t.call(R.key)}}});f(z.ctx,{displayName:`KeymapCtx<blockquote>`,group:`Blockquote`}),f(z.shortcuts,{displayName:`Keymap<blockquote>`,group:`Blockquote`});var B=a.s(`codeBlock`,()=>({pre:{},code:{}}));f(B,{displayName:`Attr<codeBlock>`,group:`CodeBlock`});var V=a.c(`code_block`,e=>({content:`text*`,group:`block`,marks:``,defining:!0,code:!0,attrs:{language:{default:``,validate:`string`}},parseDOM:[{tag:`pre`,preserveWhitespace:`full`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw n.V(e);return{language:e.dataset.language}}}],toDOM:t=>{let n=e.get(B.key)(t),r=t.attrs.language,i=r&&r.length>0?{"data-language":r}:void 0;return[`pre`,{...n.pre,...i},[`code`,n.code,0]]},parseMarkdown:{match:({type:e})=>e===`code`,runner:(e,t,n)=>{let r=t.lang??``,i=t.value;e.openNode(n,{language:r}),i&&e.addText(i),e.closeNode()}},toMarkdown:{match:e=>e.type.name===`code_block`,runner:(e,t)=>{e.addNode(`code`,void 0,t.content.firstChild?.text||``,{lang:t.attrs.language})}}}));f(V.node,{displayName:`NodeSchema<codeBlock>`,group:`CodeBlock`}),f(V.ctx,{displayName:`NodeSchemaCtx<codeBlock>`,group:`CodeBlock`});var he=a.r(e=>r.s(/^```(?<language>[a-z]*)?[\s\n]$/,V.type(e),e=>({language:e.groups?.language??``})));f(he,{displayName:`InputRule<createCodeBlockInputRule>`,group:`CodeBlock`});var H=a.t(`CreateCodeBlock`,e=>(t=``)=>i.w(V.type(e),{language:t}));f(H,{displayName:`Command<createCodeBlockCommand>`,group:`CodeBlock`});var ge=a.t(`UpdateCodeBlockLanguage`,()=>({pos:e,language:t}={pos:-1,language:``})=>(n,r)=>e>=0?(r?.(n.tr.setNodeAttribute(e,`language`,t)),!0):!1);f(ge,{displayName:`Command<updateCodeBlockLanguageCommand>`,group:`CodeBlock`});var U=a.f(`codeBlockKeymap`,{CreateCodeBlock:{shortcuts:`Mod-Alt-c`,command:e=>{let t=e.get(n.s);return()=>t.call(H.key)}}});f(U.ctx,{displayName:`KeymapCtx<codeBlock>`,group:`CodeBlock`}),f(U.shortcuts,{displayName:`Keymap<codeBlock>`,group:`CodeBlock`});var W=a.s(`image`);f(W,{displayName:`Attr<image>`,group:`Image`});var G=a.c(`image`,e=>({inline:!0,group:`inline`,selectable:!0,draggable:!0,marks:``,atom:!0,defining:!0,isolating:!0,attrs:{src:{default:``,validate:`string`},alt:{default:``,validate:`string`},title:{default:``,validate:`string`}},parseDOM:[{tag:`img[src]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw n.V(e);return{src:e.getAttribute(`src`)||``,alt:e.getAttribute(`alt`)||``,title:e.getAttribute(`title`)||e.getAttribute(`alt`)||``}}}],toDOM:t=>[`img`,{...e.get(W.key)(t),...t.attrs}],parseMarkdown:{match:({type:e})=>e===`image`,runner:(e,t,n)=>{let r=t.url,i=t.alt,a=t.title;e.addNode(n,{src:r,alt:i,title:a})}},toMarkdown:{match:e=>e.type.name===`image`,runner:(e,t)=>{e.addNode(`image`,void 0,void 0,{title:t.attrs.title,url:t.attrs.src,alt:t.attrs.alt})}}}));f(G.node,{displayName:`NodeSchema<image>`,group:`Image`}),f(G.ctx,{displayName:`NodeSchemaCtx<image>`,group:`Image`});var _e=a.t(`InsertImage`,e=>(t={})=>(n,r)=>{if(!r)return!0;let{src:i=``,alt:a=``,title:o=``}=t,s=G.type(e).create({src:i,alt:a,title:o});return s&&r(n.tr.replaceSelectionWith(s).scrollIntoView()),!0});f(_e,{displayName:`Command<insertImageCommand>`,group:`Image`});var ve=a.t(`UpdateImage`,e=>(t={})=>(r,i)=>{let a=n.F(r.selection,G.type(e));if(!a)return!1;let{node:o,pos:s}=a,c={...o.attrs},{src:l,alt:u,title:d}=t;return l!==void 0&&(c.src=l),u!==void 0&&(c.alt=u),d!==void 0&&(c.title=d),i?.(r.tr.setNodeMarkup(s,void 0,c).scrollIntoView()),!0});f(ve,{displayName:`Command<updateImageCommand>`,group:`Image`});var ye=a.r(e=>new r.o(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,(t,n,r,i)=>{let[a,o,s=``,c]=n;return a?t.tr.replaceWith(r,i,G.type(e).create({src:s,alt:o,title:c})):null}));f(ye,{displayName:`InputRule<insertImageInputRule>`,group:`Image`});var K=a.s(`hardbreak`,e=>({"data-type":`hardbreak`,"data-is-inline":e.attrs.isInline}));f(K,{displayName:`Attr<hardbreak>`,group:`Hardbreak`});var q=a.c(`hardbreak`,e=>({inline:!0,group:`inline`,attrs:{isInline:{default:!1,validate:`boolean`}},selectable:!1,parseDOM:[{tag:`br`},{tag:`span[data-type="hardbreak"]`,getAttrs:()=>({isInline:!0})}],toDOM:t=>t.attrs.isInline?[`span`,e.get(K.key)(t),` `]:[`br`,e.get(K.key)(t)],parseMarkdown:{match:({type:e})=>e===`break`,runner:(e,t,n)=>{e.addNode(n,{isInline:!!t.data?.isInline})}},leafText:()=>`
|
|
2
|
-
`,toMarkdown:{match:e=>e.type.name===`hardbreak`,runner:(e,t)=>{t.attrs.isInline?e.addNode(`text`,void 0,`
|
|
3
|
-
`):e.addNode(`break`)}}}));f(q.node,{displayName:`NodeSchema<hardbreak>`,group:`Hardbreak`}),f(q.ctx,{displayName:`NodeSchemaCtx<hardbreak>`,group:`Hardbreak`});var J=a.t(`InsertHardbreak`,e=>()=>(n,r)=>{let{selection:i,tr:a}=n;if(!(i instanceof t.c))return!1;if(i.empty){let e=i.$from.node();if(e.childCount>0&&e.lastChild?.type.name===`hardbreak`)return r?.(a.replaceRangeWith(i.to-1,i.to,n.schema.node(`paragraph`)).setSelection(t.o.near(a.doc.resolve(i.to))).scrollIntoView()),!0}return r?.(a.setMeta(`hardbreak`,!0).replaceSelectionWith(q.type(e).create()).scrollIntoView()),!0});f(J,{displayName:`Command<insertHardbreakCommand>`,group:`Hardbreak`});var be=a.f(`hardbreakKeymap`,{InsertHardbreak:{shortcuts:`Shift-Enter`,command:e=>{let t=e.get(n.s);return()=>t.call(J.key)}}});f(be.ctx,{displayName:`KeymapCtx<hardbreak>`,group:`Hardbreak`}),f(be.shortcuts,{displayName:`Keymap<hardbreak>`,group:`Hardbreak`});var xe=a.s(`hr`);f(xe,{displayName:`Attr<hr>`,group:`Hr`});var Y=a.c(`hr`,e=>({group:`block`,parseDOM:[{tag:`hr`}],toDOM:t=>[`hr`,e.get(xe.key)(t)],parseMarkdown:{match:({type:e})=>e===`thematicBreak`,runner:(e,t,n)=>{e.addNode(n)}},toMarkdown:{match:e=>e.type.name===`hr`,runner:e=>{e.addNode(`thematicBreak`)}}}));f(Y.node,{displayName:`NodeSchema<hr>`,group:`Hr`}),f(Y.ctx,{displayName:`NodeSchemaCtx<hr>`,group:`Hr`});var Se=a.r(e=>new r.o(/^(?:---|___\s|\*\*\*\s)$/,(t,n,r,i)=>{let{tr:a}=t;return n[0]&&a.replaceWith(r-1,i,Y.type(e).create()),a}));f(Se,{displayName:`InputRule<insertHrInputRule>`,group:`Hr`});var Ce=a.t(`InsertHr`,e=>()=>(n,r)=>{if(!r)return!0;let i=D.node.type(e).create(),{tr:a,selection:o}=n,{from:s}=o,c=Y.type(e).create();if(!c)return!0;let l=a.replaceSelectionWith(c).insert(s,i),u=t.o.findFrom(l.doc.resolve(s),1,!0);return u&&r(l.setSelection(u).scrollIntoView()),!0});f(Ce,{displayName:`Command<insertHrCommand>`,group:`Hr`});var we=a.s(`bulletList`);f(we,{displayName:`Attr<bulletList>`,group:`BulletList`});var X=a.c(`bullet_list`,e=>({content:`listItem+`,group:`block`,attrs:{spread:{default:!1,validate:`boolean`}},parseDOM:[{tag:`ul`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw n.V(e);return{spread:e.dataset.spread===`true`}}}],toDOM:t=>[`ul`,{...e.get(we.key)(t),"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>e===`list`&&!t,runner:(e,t,n)=>{let r=t.spread==null?`false`:`${t.spread}`;e.openNode(n,{spread:r}).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name===`bullet_list`,runner:(e,t)=>{e.openNode(`list`,void 0,{ordered:!1,spread:t.attrs.spread}).next(t.content).closeNode()}}}));f(X.node,{displayName:`NodeSchema<bulletList>`,group:`BulletList`}),f(X.ctx,{displayName:`NodeSchemaCtx<bulletList>`,group:`BulletList`});var Te=a.r(e=>r.l(/^\s*([-+*])\s$/,X.type(e)));f(Te,{displayName:`InputRule<wrapInBulletListInputRule>`,group:`BulletList`});var Ee=a.t(`WrapInBulletList`,e=>()=>i.k(X.type(e)));f(Ee,{displayName:`Command<wrapInBulletListCommand>`,group:`BulletList`});var De=a.f(`bulletListKeymap`,{WrapInBulletList:{shortcuts:`Mod-Alt-8`,command:e=>{let t=e.get(n.s);return()=>t.call(Ee.key)}}});f(De.ctx,{displayName:`KeymapCtx<bulletListKeymap>`,group:`BulletList`}),f(De.shortcuts,{displayName:`Keymap<bulletListKeymap>`,group:`BulletList`});var Oe=a.s(`orderedList`);f(Oe,{displayName:`Attr<orderedList>`,group:`OrderedList`});var Z=a.c(`ordered_list`,e=>({content:`listItem+`,group:`block`,attrs:{order:{default:1,validate:`number`},spread:{default:!1,validate:`boolean`}},parseDOM:[{tag:`ol`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw n.V(e);return{spread:e.dataset.spread,order:e.hasAttribute(`start`)?Number(e.getAttribute(`start`)):1}}}],toDOM:t=>[`ol`,{...e.get(Oe.key)(t),...t.attrs.order===1?{}:{start:t.attrs.order},"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>e===`list`&&!!t,runner:(e,t,n)=>{let r=t.spread==null?`true`:`${t.spread}`;e.openNode(n,{spread:r,order:t.start??1}).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name===`ordered_list`,runner:(e,t)=>{e.openNode(`list`,void 0,{ordered:!0,start:t.attrs.order??1,spread:t.attrs.spread===`true`}),e.next(t.content),e.closeNode()}}}));f(Z.node,{displayName:`NodeSchema<orderedList>`,group:`OrderedList`}),f(Z.ctx,{displayName:`NodeSchemaCtx<orderedList>`,group:`OrderedList`});var ke=a.r(e=>r.l(/^\s*(\d+)\.\s$/,Z.type(e),e=>({order:Number(e[1])}),(e,t)=>t.childCount+t.attrs.order===Number(e[1])));f(ke,{displayName:`InputRule<wrapInOrderedListInputRule>`,group:`OrderedList`});var Ae=a.t(`WrapInOrderedList`,e=>()=>i.k(Z.type(e)));f(Ae,{displayName:`Command<wrapInOrderedListCommand>`,group:`OrderedList`});var je=a.f(`orderedListKeymap`,{WrapInOrderedList:{shortcuts:`Mod-Alt-7`,command:e=>{let t=e.get(n.s);return()=>t.call(Ae.key)}}});f(je.ctx,{displayName:`KeymapCtx<orderedList>`,group:`OrderedList`}),f(je.shortcuts,{displayName:`Keymap<orderedList>`,group:`OrderedList`});var Me=a.s(`listItem`);f(Me,{displayName:`Attr<listItem>`,group:`ListItem`});var Q=a.c(`list_item`,e=>({group:`listItem`,content:`paragraph block*`,attrs:{label:{default:`•`,validate:`string`},listType:{default:`bullet`,validate:`string`},spread:{default:!0,validate:`boolean`}},defining:!0,parseDOM:[{tag:`li`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw n.V(e);return{label:e.dataset.label,listType:e.dataset.listType,spread:e.dataset.spread===`true`}}}],toDOM:t=>[`li`,{...e.get(Me.key)(t),"data-label":t.attrs.label,"data-list-type":t.attrs.listType,"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e})=>e===`listItem`,runner:(e,t,n)=>{let r=t.label==null?`•`:`${t.label}.`,i=t.label==null?`bullet`:`ordered`,a=t.spread==null?`true`:`${t.spread}`;e.openNode(n,{label:r,listType:i,spread:a}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>e.type.name===`list_item`,runner:(e,t)=>{e.openNode(`listItem`,void 0,{spread:t.attrs.spread}),e.next(t.content),e.closeNode()}}}));f(Q.node,{displayName:`NodeSchema<listItem>`,group:`ListItem`}),f(Q.ctx,{displayName:`NodeSchemaCtx<listItem>`,group:`ListItem`});var Ne=a.t(`SinkListItem`,e=>()=>o.r(Q.type(e)));f(Ne,{displayName:`Command<sinkListItemCommand>`,group:`ListItem`});var Pe=a.t(`LiftListItem`,e=>()=>o.n(Q.type(e)));f(Pe,{displayName:`Command<liftListItemCommand>`,group:`ListItem`});var Fe=a.t(`SplitListItem`,e=>()=>o.i(Q.type(e)));f(Fe,{displayName:`Command<splitListItemCommand>`,group:`ListItem`});function Ie(e){return(n,r,a)=>{let{selection:o}=n;if(!(o instanceof t.c))return!1;let{empty:s,$from:c}=o;return!s||c.parentOffset!==0||c.node(-1).type!==Q.type(e)?!1:i.s(n,r,a)}}var Le=a.t(`LiftFirstListItem`,e=>()=>Ie(e));f(Le,{displayName:`Command<liftFirstListItemCommand>`,group:`ListItem`});var Re=a.f(`listItemKeymap`,{NextListItem:{shortcuts:`Enter`,command:e=>{let t=e.get(n.s);return()=>t.call(Fe.key)}},SinkListItem:{shortcuts:[`Tab`,`Mod-]`],command:e=>{let t=e.get(n.s);return()=>t.call(Ne.key)}},LiftListItem:{shortcuts:[`Shift-Tab`,`Mod-[`],command:e=>{let t=e.get(n.s);return()=>t.call(Pe.key)}},LiftFirstListItem:{shortcuts:[`Backspace`,`Delete`],command:e=>{let t=e.get(n.s);return()=>t.call(Le.key)}}});f(Re.ctx,{displayName:`KeymapCtx<listItem>`,group:`ListItem`}),f(Re.shortcuts,{displayName:`Keymap<listItem>`,group:`ListItem`});var ze=a.o(`text`,()=>({group:`inline`,parseMarkdown:{match:({type:e})=>e===`text`,runner:(e,t)=>{e.addText(t.value)}},toMarkdown:{match:e=>e.type.name===`text`,runner:(e,t)=>{e.addNode(`text`,void 0,t.text)}}}));f(ze,{displayName:`NodeSchema<text>`,group:`Text`});var Be=a.s(`html`);f(Be,{displayName:`Attr<html>`,group:`Html`});var Ve=a.c(`html`,e=>({atom:!0,group:`inline`,inline:!0,attrs:{value:{default:``,validate:`string`}},toDOM:t=>{let n=document.createElement(`span`),r={...e.get(Be.key)(t),"data-value":t.attrs.value,"data-type":`html`};return n.textContent=t.attrs.value,[`span`,r,t.attrs.value]},parseDOM:[{tag:`span[data-type="html"]`,getAttrs:e=>({value:e.dataset.value??``})}],parseMarkdown:{match:({type:e})=>e===`html`,runner:(e,t,n)=>{e.addNode(n,{value:t.value})}},toMarkdown:{match:e=>e.type.name===`html`,runner:(e,t)=>{e.addNode(`html`,void 0,t.attrs.value)}}}));f(Ve.node,{displayName:`NodeSchema<html>`,group:`Html`}),f(Ve.ctx,{displayName:`NodeSchemaCtx<html>`,group:`Html`});var He=[ce,E,D,A,j,M,K,q,I,L,B,V,xe,Y,W,G,we,X,Oe,Z,Me,Q,p,m,ne,_,b,x,ae,w,Be,Ve,ze].flat(),Ue=[me,Te,ke,he,Se,pe].flat(),We=[ee,te,ie,re],Ge=a.t(`IsMarkSelected`,()=>e=>t=>{if(!e)return!1;let{doc:n,selection:r}=t;return n.rangeHasMark(r.from,r.to,e)}),Ke=a.t(`IsNoteSelected`,()=>e=>t=>e?n.M(t,e).hasNode:!1),qe=a.t(`ClearTextInCurrentBlock`,()=>()=>(e,t)=>{let n=e.tr,{$from:r,$to:i}=n.selection,{pos:a}=r,{pos:o}=i,s=a-r.node().content.size;return s<0?!1:(n=n.deleteRange(s,o),t?.(n),!0)}),Je=a.t(`SetBlockType`,()=>e=>(t,n)=>{let{nodeType:r,attrs:i=null}=e??{};if(!r)return!1;let a=t.tr,{from:o,to:s}=a.selection;try{a.setBlockType(o,s,r,i)}catch{return!1}return n?.(a),!0}),Ye=a.t(`WrapInBlockType`,()=>e=>(n,r)=>{let{nodeType:i,attrs:a=null}=e??{};if(!i)return!1;let o=n.tr;try{let{$from:e,$to:n}=o.selection,r=e.blockRange(n),s=r&&t._(r,i,a);if(!s)return!1;o=o.wrap(r,s)}catch{return!1}return r?.(o),!0}),Xe=a.t(`AddBlockType`,()=>e=>(n,r)=>{let{nodeType:i,attrs:a=null}=e??{};if(!i)return!1;let o=n.tr;try{let e=i instanceof t.T?i:i.createAndFill(a);if(!e)return!1;o.replaceSelectionWith(e)}catch{return!1}return r?.(o),!0}),Ze=a.t(`SelectTextNearPos`,()=>e=>(n,r)=>{let{pos:i}=e??{};if(i==null)return!1;let a=(e,t,n)=>Math.min(Math.max(e,t),n),o=n.tr;try{let e=n.doc.resolve(a(i,0,n.doc.content.size));o.setSelection(t.c.near(e))}catch{return!1}return r?.(o.scrollIntoView()),!0}),Qe=[O,R,N,P,H,J,Ce,_e,ve,Ae,Ee,Ne,Fe,Pe,Le,h,S,v,oe,se,Ge,Ke,qe,Je,Ye,Xe,Ze],$e=[z,U,be,F,Re,je,De,k,g,C,y].flat(),et=a.d(`remarkAddOrderInList`,()=>()=>e=>{r.m(e,`list`,e=>{if(e.ordered){let t=e.start??1;e.children.forEach((e,n)=>{e.label=n+t})}})});f(et.plugin,{displayName:`Remark<remarkAddOrderInListPlugin>`,group:`Remark`}),f(et.options,{displayName:`RemarkConfig<remarkAddOrderInListPlugin>`,group:`Remark`});var tt=a.d(`remarkLineBreak`,()=>()=>e=>{let t=/[\t ]*(?:\r?\n|\r)/g;r.m(e,`text`,(e,n,r)=>{if(!e.value||typeof e.value!=`string`)return;let i=[],a=0;t.lastIndex=0;let o=t.exec(e.value);for(;o;){let n=o.index;a!==n&&i.push({type:`text`,value:e.value.slice(a,n)}),i.push({type:`break`,data:{isInline:!0}}),a=n+o[0].length,o=t.exec(e.value)}if(i.length>0&&r&&typeof n==`number`)return a<e.value.length&&i.push({type:`text`,value:e.value.slice(a)}),r.children.splice(n,1,...i),n+i.length})});f(tt.plugin,{displayName:`Remark<remarkLineBreak>`,group:`Remark`}),f(tt.options,{displayName:`RemarkConfig<remarkLineBreak>`,group:`Remark`});var nt=a.d(`remarkInlineLink`,()=>l);f(nt.plugin,{displayName:`Remark<remarkInlineLinkPlugin>`,group:`Remark`}),f(nt.options,{displayName:`RemarkConfig<remarkInlineLinkPlugin>`,group:`Remark`});var rt=e=>!!e.children,it=e=>e.type===`html`;function at(e,t){return n(e,0,null)[0];function n(e,r,i){if(rt(e)){let t=[];for(let r=0,i=e.children.length;r<i;r++){let i=e.children[r];if(i){let a=n(i,r,e);if(a)for(let e=0,n=a.length;e<n;e++){let n=a[e];n&&t.push(n)}}}e.children=t}return t(e,r,i)}}var ot=[`root`,`blockquote`,`listItem`],st=a.d(`remarkHTMLTransformer`,()=>()=>e=>{at(e,(e,t,n)=>(it(e)&&n&&ot.includes(n.type)&&(e.children=[{...e}],delete e.value,e.type=`paragraph`),[e]))});f(st.plugin,{displayName:`Remark<remarkHtmlTransformer>`,group:`Remark`}),f(st.options,{displayName:`RemarkConfig<remarkHtmlTransformer>`,group:`Remark`});var ct=a.d(`remarkMarker`,()=>()=>(e,t)=>{let n=e=>t.value.charAt(e.position.start.offset);r.m(e,e=>[`strong`,`emphasis`].includes(e.type),e=>{e.marker=n(e)})});f(ct.plugin,{displayName:`Remark<remarkMarker>`,group:`Remark`}),f(ct.options,{displayName:`RemarkConfig<remarkMarker>`,group:`Remark`});var lt=a.u(()=>{let e=!1,n=new t.i({key:new t.a(`MILKDOWN_INLINE_NODES_CURSOR`),state:{init(){return!1},apply(e){if(!e.selection.empty)return!1;let t=e.selection.$from,n=t.nodeBefore,r=t.nodeAfter;return!!(n&&r&&n.isInline&&!n.isText&&r.isInline&&!r.isText)}},props:{handleDOMEvents:{compositionend:(t,r)=>e?(e=!1,requestAnimationFrame(()=>{if(n.getState(t.state)){let e=t.state.selection.from;r.preventDefault(),t.dispatch(t.state.tr.insertText(r.data||``,e))}}),!0):!1,compositionstart:t=>(n.getState(t.state)&&(e=!0),!1),beforeinput:(t,r)=>{if(n.getState(t.state)&&r instanceof InputEvent&&r.data&&!e){let e=t.state.selection.from;return r.preventDefault(),t.dispatch(t.state.tr.insertText(r.data||``,e)),!0}return!1}},decorations(e){if(n.getState(e)){let t=e.selection.$from.pos,n=document.createElement(`span`),i=r.t.widget(t,n,{side:-1}),a=document.createElement(`span`),o=r.t.widget(t,a);return setTimeout(()=>{n.contentEditable=`true`,a.contentEditable=`true`}),r.n.create(e.doc,[i,o])}return r.n.empty}}});return n});f(lt,{displayName:`Prose<inlineNodesCursorPlugin>`,group:`Prose`});var ut=a.u(e=>new t.i({key:new t.a(`MILKDOWN_HARDBREAK_MARKS`),appendTransaction:(n,r,i)=>{if(!n.length)return;let[a]=n;if(!a)return;let[o]=a.steps;if(a.getMeta(`hardbreak`)){if(!(o instanceof t.f))return;let{from:n}=o;return i.tr.setNodeMarkup(n,q.type(e),void 0,[])}if(o instanceof t.u){let t=i.tr,{from:n,to:r}=o;return i.doc.nodesBetween(n,r,(n,r)=>{n.type===q.type(e)&&(t=t.setNodeMarkup(r,q.type(e),void 0,[]))}),t}}}));f(ut,{displayName:`Prose<hardbreakClearMarkPlugin>`,group:`Prose`});var $=a.n([`table`,`code_block`],`hardbreakFilterNodes`);f($,{displayName:`Ctx<hardbreakFilterNodes>`,group:`Prose`});var dt=a.u(e=>{let n=e.get($.key);return new t.i({key:new t.a(`MILKDOWN_HARDBREAK_FILTER`),filterTransaction:(e,t)=>{let r=e.getMeta(`hardbreak`),[i]=e.steps;if(r&&i){let{from:e}=i,r=t.doc.resolve(e),a=r.depth,o=!0;for(;a>0;)n.includes(r.node(a).type.name)&&(o=!1),a--;return o}return!0}})});f(dt,{displayName:`Prose<hardbreakFilterPlugin>`,group:`Prose`});var ft=a.u(e=>{let n=new t.a(`MILKDOWN_HEADING_ID`),r=t=>{if(t.composing)return;let r=e.get(A.key),i=t.state.tr.setMeta(`addToHistory`,!1),a=!1,o={};t.state.doc.descendants((t,s)=>{if(t.type===M.type(e)){if(t.textContent.trim().length===0)return;let e=t.attrs,c=r(t);o[c]?(o[c]+=1,c+=`-#${o[c]}`):o[c]=1,e.id!==c&&(a=!0,i.setMeta(n,!0).setNodeMarkup(s,void 0,{...e,id:c}))}}),a&&t.dispatch(i)};return new t.i({key:n,view:e=>(r(e),{update:(e,t)=>{e.state.doc.eq(t.doc)||r(e)}})})});f(ft,{displayName:`Prose<syncHeadingIdPlugin>`,group:`Prose`});var pt=a.u(e=>new t.i({key:new t.a(`MILKDOWN_KEEP_LIST_ORDER`),appendTransaction:(t,n,r)=>{if(!r.selection||t.some(e=>e.getMeta(`addToHistory`)===!1||!e.isGeneric))return null;let i=Z.type(e),a=X.type(e),o=Q.type(e),s=(e,t,n=1)=>{let r=!1,i=`${t+n}.`;return e.label!==i&&(e.label=i,r=!0),r},c=r.tr,l=!1;return r.doc.descendants((e,t,n,r)=>{if(e.type===a){let n=e.maybeChild(0);n?.type===o&&n.attrs.listType===`ordered`&&(l=!0,c.setNodeMarkup(t,i,{spread:`true`}),e.descendants((e,t,n,r)=>{if(e.type===o){let n={...e.attrs};s(n,r)&&(c=c.setNodeMarkup(t,void 0,n))}return!1}))}else if(e.type===o&&n?.type===i){let i={...e.attrs},a=!1;i.listType!==`ordered`&&(i.listType=`ordered`,a=!0),n?.maybeChild(0)&&(a=s(i,r,n?.attrs.order??1)),a&&(c=c.setNodeMarkup(t,void 0,i),l=!0)}}),l?c.setMeta(`addToHistory`,!1):null}}));f(pt,{displayName:`Prose<syncListOrderPlugin>`,group:`Prose`});var mt=[ut,$,dt,lt,et,nt,tt,st,ct,T,ft,pt].flat(),ht=[He,Ue,We,Qe,$e,mt].flat();Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return G}});
|
package/dist/lib-C5AzmhNY.cjs
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
const e=require(`./dist-BCCSKc3M.cjs`),t=require(`./lib-IahjxPWM.cjs`),n=require(`./dist-C0PSMrs7.cjs`),r=require(`./dist-CPVooDwj.cjs`),i=require(`./lib-DWZA8C0h.cjs`),a=require(`./lib-BNOSyYeU.cjs`),o=require(`./dist-mOpTMw1E.cjs`);var s=typeof navigator<`u`?navigator:null,c=s&&s.userAgent||``,l=/Edge\/(\d+)/.exec(c),u=/MSIE \d/.exec(c),d=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(c),f=!(u||d||l)&&!!s&&/Apple Computer/.test(s.vendor),p=new e.a(`safari-ime-span`),m=!1,h={key:p,props:{decorations:ee,handleDOMEvents:{compositionstart:()=>{m=!0},compositionend:()=>{m=!1}}}};function ee(e){let{$from:t,$to:r,to:i}=e.selection;if(m&&t.sameParent(r)){let t=n.t.widget(i,g,{ignoreSelection:!0,key:`safari-ime-span`});return n.n.create(e.doc,[t])}}function g(e){let t=e.dom.ownerDocument.createElement(`span`);return t.className=`ProseMirror-safari-ime-span`,t}var te=new e.i(f?h:{key:p});function _(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function v(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function y(e,t,r){let i=n._((r||{}).ignore||[]),a=b(t),o=-1;for(;++o<a.length;)n.g(e,`text`,s);function s(e,t){let n=-1,r;for(;++n<t.length;){let e=t[n],a=r?r.children:void 0;if(i(e,a?a.indexOf(e):void 0,r))return;r=e}if(r)return c(e,t)}function c(e,t){let n=t[t.length-1],r=a[o][0],i=a[o][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,a={index:d.index,input:d.input,stack:[...t,e]},o=i(...d,a);if(typeof o==`string`&&(o=o.length>0?{type:`text`,value:o}:void 0),o===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(o)?u.push(...o):o&&u.push(o),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function b(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([ne(e[0]),x(e[1])])}return t}function ne(e){return typeof e==`string`?new RegExp(v(e),`g`):e}function x(e){return typeof e==`function`?e:function(){return e}}var S=`phrasing`,C=[`autolink`,`link`,`image`,`label`];function re(){return{transforms:[ue],enter:{literalAutolink:ae,literalAutolinkEmail:w,literalAutolinkHttp:w,literalAutolinkWww:w},exit:{literalAutolink:le,literalAutolinkEmail:ce,literalAutolinkHttp:oe,literalAutolinkWww:se}}}function ie(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:S,notInConstruct:C},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:S,notInConstruct:C},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:S,notInConstruct:C}]}}function ae(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function w(e){this.config.enter.autolinkProtocol.call(this,e)}function oe(e){this.config.exit.autolinkProtocol.call(this,e)}function se(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 ce(e){this.config.exit.autolinkEmail.call(this,e)}function le(e){this.exit(e)}function ue(e){y(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,de],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,fe]],{ignore:[`link`,`linkReference`]})}function de(e,t,n,r,i){let a=``;if(!he(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!pe(n)))return!1;let o=me(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function fe(e,t,n,r){return!he(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function pe(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 me(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=_(e,`(`),a=_(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function he(e,t){let r=e.input.charCodeAt(e.index-1);return(e.index===0||n.j(r)||n.A(r))&&(!t||r!==47)}Te.peek=we;function ge(){this.buffer()}function _e(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function ve(){this.buffer()}function ye(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function be(e){let t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=n.M(this.sliceSerialize(e)).toLowerCase(),r.label=t}function xe(e){this.exit(e)}function Se(e){let t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=n.M(this.sliceSerialize(e)).toLowerCase(),r.label=t}function Ce(e){this.exit(e)}function we(){return`[`}function Te(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function Ee(){return{enter:{gfmFootnoteCallString:ge,gfmFootnoteCall:_e,gfmFootnoteDefinitionLabelString:ve,gfmFootnoteDefinition:ye},exit:{gfmFootnoteCallString:be,gfmFootnoteCall:xe,gfmFootnoteDefinitionLabelString:Se,gfmFootnoteDefinition:Ce}}}function De(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Te},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
|
|
2
|
-
`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?ke:Oe))),s(),o}}function Oe(e,t,n){return t===0?e:ke(e,t,n)}function ke(e,t,n){return(n?``:` `)+e}var Ae=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];Fe.peek=Ie;function je(){return{canContainEols:[`delete`],enter:{strikethrough:Ne},exit:{strikethrough:Pe}}}function Me(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:Ae}],handlers:{delete:Fe}}}function Ne(e){this.enter({type:`delete`,children:[]},e)}function Pe(e){this.exit(e)}function Fe(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function Ie(){return`~`}function Le(e){return e.length}function Re(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Le,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=ze(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=Be(r[d]);else{let e=Be(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&!(n.alignDelimiters===!1&&i===``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
|
|
3
|
-
`)}function ze(e){return e==null?``:String(e)}function Be(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 Ve(){return{enter:{table:He,tableData:Ge,tableHeader:Ge,tableRow:We},exit:{codeText:Ke,table:Ue,tableData:T,tableHeader:T,tableRow:T}}}function He(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function Ue(e){this.exit(e),this.data.inTable=void 0}function We(e){this.enter({type:`tableRow`,children:[]},e)}function T(e){this.exit(e)}function Ge(e){this.enter({type:`tableCell`,children:[]},e)}function Ke(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,qe));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function qe(e,t){return t===`|`?t:e}function Je(e){let t=e||{},r=t.tableCellPadding,i=t.tablePipeAlign,a=t.stringLength,o=r?` `:`|`;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:s,tableCell:l,tableRow:c}};function s(e,t,n,r){return u(d(e,n,r),e.align)}function c(e,t,n,r){let i=u([f(e,n,r)]);return i.slice(0,i.indexOf(`
|
|
5
|
-
`))}function l(e,t,n,r){let i=n.enter(`tableCell`),a=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:o,after:o});return a(),i(),s}function u(e,t){return Re(e,{align:t,alignDelimiters:i,padding:r,stringLength:a})}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=f(r[i],t,n);return o(),a}function f(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=l(r[i],e,t,n);return o(),a}function p(e,t,r){let i=n.p.inlineCode(e,t,r);return r.stack.includes(`tableCell`)&&(i=i.replace(/\|/g,`\\$&`)),i}}function Ye(){return{exit:{taskListCheckValueChecked:Ze,taskListCheckValueUnchecked:Ze,paragraph:Qe}}}function Xe(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:$e}}}function Ze(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function Qe(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function $e(e,t,r,i){let a=e.children[0],o=typeof e.checked==`boolean`&&a&&a.type===`paragraph`,s=`[`+(e.checked?`x`:` `)+`] `,c=r.createTracker(i);o&&c.move(s);let l=n.p.listItem(e,t,r,{...i,...c.current()});return o&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),l;function u(e){return e+s}}function et(){return[re(),Ee(),je(),Ve(),Ye()]}function tt(e){return{extensions:[ie(),De(e),Me(),Je(e),Xe()]}}var nt={tokenize:pt,partial:!0},rt={tokenize:mt,partial:!0},it={tokenize:ht,partial:!0},at={tokenize:gt,partial:!0},ot={tokenize:_t,partial:!0},st={name:`wwwAutolink`,tokenize:dt,previous:vt},ct={name:`protocolAutolink`,tokenize:ft,previous:yt},E={name:`emailAutolink`,tokenize:ut,previous:bt},D={};function lt(){return{text:D}}for(var O=48;O<123;)D[O]=E,O++,O===58?O=65:O===91&&(O=97);D[43]=E,D[45]=E,D[46]=E,D[95]=E,D[72]=[E,ct],D[104]=[E,ct],D[87]=[E,st],D[119]=[E,st];function ut(e,t,r){let i=this,a,o;return s;function s(t){return!xt(t)||!bt.call(i,i.previous)||St(i.events)?r(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),c(t))}function c(t){return xt(t)?(e.consume(t),c):t===64?(e.consume(t),l):r(t)}function l(t){return t===46?e.check(ot,d,u)(t):t===45||t===95||n.T(t)?(o=!0,e.consume(t),l):d(t)}function u(t){return e.consume(t),a=!0,l}function d(s){return o&&a&&n.w(i.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(s)):r(s)}}function dt(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!vt.call(r,r.previous)||St(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(nt,e.attempt(rt,e.attempt(it,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function ft(e,t,r){let i=this,a=``,o=!1;return s;function s(t){return(t===72||t===104)&&yt.call(i,i.previous)&&!St(i.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),a+=String.fromCodePoint(t),e.consume(t),c):r(t)}function c(t){if(n.w(t)&&a.length<5)return a+=String.fromCodePoint(t),e.consume(t),c;if(t===58){let n=a.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),l}return r(t)}function l(t){return t===47?(e.consume(t),o?u:(o=!0,l)):r(t)}function u(t){return t===null||n.E(t)||n.O(t)||n.j(t)||n.A(t)?r(t):e.attempt(rt,e.attempt(it,d),r)(t)}function d(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function pt(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function mt(e,t,r){let i,a,o;return s;function s(t){return t===46||t===95?e.check(at,l,c)(t):t===null||n.O(t)||n.j(t)||t!==45&&n.A(t)?l(t):(o=!0,e.consume(t),s)}function c(t){return t===95?i=!0:(a=i,i=void 0),e.consume(t),s}function l(e){return a||i||!o?r(e):t(e)}}function ht(e,t){let r=0,i=0;return a;function a(s){return s===40?(r++,e.consume(s),a):s===41&&i<r?o(s):s===33||s===34||s===38||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===60||s===63||s===93||s===95||s===126?e.check(at,t,o)(s):s===null||n.O(s)||n.j(s)?t(s):(e.consume(s),a)}function o(t){return t===41&&i++,e.consume(t),a}}function gt(e,t,r){return i;function i(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),i):s===38?(e.consume(s),o):s===93?(e.consume(s),a):s===60||s===null||n.O(s)||n.j(s)?t(s):r(s)}function a(e){return e===null||e===40||e===91||n.O(e)||n.j(e)?t(e):i(e)}function o(e){return n.w(e)?s(e):r(e)}function s(t){return t===59?(e.consume(t),i):n.w(t)?(e.consume(t),s):r(t)}}function _t(e,t,r){return i;function i(t){return e.consume(t),a}function a(e){return n.T(e)?r(e):t(e)}}function vt(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||n.O(e)}function yt(e){return!n.w(e)}function bt(e){return!(e===47||xt(e))}function xt(e){return e===43||e===45||e===46||e===95||n.T(e)}function St(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var Ct={tokenize:jt,partial:!0};function wt(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:Ot,continuation:{tokenize:kt},exit:At}},text:{91:{name:`gfmFootnoteCall`,tokenize:Dt},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:Tt,resolveTo:Et}}}}function Tt(e,t,r){let i=this,a=i.events.length,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]),s;for(;a--;){let e=i.events[a][1];if(e.type===`labelImage`){s=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return c;function c(a){if(!s||!s._balanced)return r(a);let c=n.M(i.sliceSerialize({start:s.end,end:i.now()}));return c.codePointAt(0)!==94||!o.includes(c.slice(1))?r(a):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(a),e.exit(`gfmFootnoteCallLabelMarker`),t(a))}}function Et(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){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 a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function Dt(e,t,r){let i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]),o=0,s;return c;function c(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,u):r(t)}function u(c){if(o>999||c===93&&!s||c===null||c===91||n.O(c))return r(c);if(c===93){e.exit(`chunkString`);let o=e.exit(`gfmFootnoteCallString`);return a.includes(n.M(i.sliceSerialize(o)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(c),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):r(c)}return n.O(c)||(s=!0),o++,e.consume(c),c===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}}function Ot(e,t,r){let i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]),o,s=0,c;return l;function l(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),u}function u(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,d):r(t)}function d(t){if(s>999||t===93&&!c||t===null||t===91||n.O(t))return r(t);if(t===93){e.exit(`chunkString`);let r=e.exit(`gfmFootnoteDefinitionLabelString`);return o=n.M(i.sliceSerialize(r)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),p}return n.O(t)||(c=!0),s++,e.consume(t),t===92?f:d}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}function p(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),a.includes(o)||a.push(o),n.C(e,m,`gfmFootnoteDefinitionWhitespace`)):r(t)}function m(e){return t(e)}}function kt(e,t,r){return e.check(n.b,t,e.attempt(Ct,t,r))}function At(e){e.exit(`gfmFootnoteDefinition`)}function jt(e,t,r){let i=this;return n.C(e,a,`gfmFootnoteDefinitionIndent`,5);function a(e){let n=i.events[i.events.length-1];return n&&n[1].type===`gfmFootnoteDefinitionIndent`&&n[2].sliceSerialize(n[1],!0).length===4?t(e):r(e)}}function Mt(e){let t=(e||{}).singleTilde,r={name:`strikethrough`,tokenize:a,resolveAll:i};return t??=!0,{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(e,t){let r=-1;for(;++r<e.length;)if(e[r][0]===`enter`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._close){let i=r;for(;i--;)if(e[i][0]===`exit`&&e[i][1].type===`strikethroughSequenceTemporary`&&e[i][1]._open&&e[r][1].end.offset-e[r][1].start.offset===e[i][1].end.offset-e[i][1].start.offset){e[r][1].type=`strikethroughSequence`,e[i][1].type=`strikethroughSequence`;let a={type:`strikethrough`,start:Object.assign({},e[i][1].start),end:Object.assign({},e[r][1].end)},o={type:`strikethroughText`,start:Object.assign({},e[i][1].end),end:Object.assign({},e[r][1].start)},s=[[`enter`,a,t],[`enter`,e[i][1],t],[`exit`,e[i][1],t],[`enter`,o,t]],c=t.parser.constructs.insideSpan.null;c&&n.P(s,s.length,0,n.x(c,e.slice(i+1,r),t)),n.P(s,s.length,0,[[`exit`,o,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`exit`,a,t]]),n.P(e,i-1,r-i+3,s),r=i+s.length-2;break}}for(r=-1;++r<e.length;)e[r][1].type===`strikethroughSequenceTemporary`&&(e[r][1].type=`data`);return e}function a(e,r,i){let a=this.previous,o=this.events,s=0;return c;function c(t){return a===126&&o[o.length-1][1].type!==`characterEscape`?i(t):(e.enter(`strikethroughSequenceTemporary`),l(t))}function l(o){let c=n.S(a);if(o===126)return s>1?i(o):(e.consume(o),s++,l);if(s<2&&!t)return i(o);let u=e.exit(`strikethroughSequenceTemporary`),d=n.S(o);return u._open=!d||d===2&&!!c,u._close=!c||c===2&&!!d,r(o)}}}var Nt=class{constructor(){this.map=[]}add(e,t,n){Pt(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function Pt(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function Ft(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function It(){return{flow:{null:{name:`table`,tokenize:Lt,resolveAll:Rt}}}}function Lt(e,t,r){let i=this,a=0,o=0,s;return c;function c(e){let t=i.events.length-1;for(;t>-1;){let e=i.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let n=t>-1?i.events[t][1].type:null,a=n===`tableHead`||n===`tableRow`?ne:l;return a===ne&&i.parser.lazy[i.now().line]?r(e):a(e)}function l(t){return e.enter(`tableHead`),e.enter(`tableRow`),u(t)}function u(e){return e===124?d(e):(s=!0,o+=1,d(e))}function d(t){return t===null?r(t):n.D(t)?o>1?(o=0,i.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),m):r(t):n.k(t)?n.C(e,d,`whitespace`)(t):(o+=1,s&&(s=!1,a+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),s=!0,d):(e.enter(`data`),f(t)))}function f(t){return t===null||t===124||n.O(t)?(e.exit(`data`),d(t)):(e.consume(t),t===92?p:f)}function p(t){return t===92||t===124?(e.consume(t),f):f(t)}function m(t){return i.interrupt=!1,i.parser.lazy[i.now().line]?r(t):(e.enter(`tableDelimiterRow`),s=!1,n.k(t)?n.C(e,h,`linePrefix`,i.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):h(t))}function h(t){return t===45||t===58?g(t):t===124?(s=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),ee):b(t)}function ee(t){return n.k(t)?n.C(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(o+=1,s=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),te):t===45?(o+=1,te(t)):t===null||n.D(t)?y(t):b(t)}function te(t){return t===45?(e.enter(`tableDelimiterFiller`),_(t)):b(t)}function _(t){return t===45?(e.consume(t),_):t===58?(s=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),v):(e.exit(`tableDelimiterFiller`),v(t))}function v(t){return n.k(t)?n.C(e,y,`whitespace`)(t):y(t)}function y(r){return r===124?h(r):r===null||n.D(r)?!s||a!==o?b(r):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(r)):b(r)}function b(e){return r(e)}function ne(t){return e.enter(`tableRow`),x(t)}function x(r){return r===124?(e.enter(`tableCellDivider`),e.consume(r),e.exit(`tableCellDivider`),x):r===null||n.D(r)?(e.exit(`tableRow`),t(r)):n.k(r)?n.C(e,x,`whitespace`)(r):(e.enter(`data`),S(r))}function S(t){return t===null||t===124||n.O(t)?(e.exit(`data`),x(t)):(e.consume(t),t===92?C:S)}function C(t){return t===92||t===124?(e.consume(t),S):S(t)}}function Rt(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new Nt;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(zt(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=k(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=k(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=k(f,t,o,i,n,d)):(o[0]=o[1],d=k(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&zt(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=Ft(t.events,n))}return e}function k(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},A(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=A(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=A(t.events,n[2]),a=A(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},A(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function zt(e,t,n,r,i){let a=[],o=A(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function A(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var Bt={name:`tasklistCheck`,tokenize:Ht};function Vt(){return{text:{91:Bt}}}function Ht(e,t,r){let i=this;return a;function a(t){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?r(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),o)}function o(t){return n.O(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),s):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),s):r(t)}function s(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),c):r(t)}function c(i){return n.D(i)?t(i):n.k(i)?e.check({tokenize:Ut},t,r)(i):r(i)}}function Ut(e,t,r){return n.C(e,i,`whitespace`);function i(e){return e===null?r(e):t(e)}}function Wt(e){return n.N([lt(),wt(),Mt(e),It(),Vt()])}var Gt={};function Kt(e){let t=this,n=e||Gt,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(Wt(n)),a.push(et()),o.push(tt(n))}function j(e,t){return Object.assign(e,{meta:{package:`@milkdown/preset-gfm`,...t}}),e}var M=i.i(`strike_through`);j(M,{displayName:`Attr<strikethrough>`,group:`Strikethrough`});var N=i.a(`strike_through`,e=>({parseDOM:[{tag:`del`},{style:`text-decoration`,getAttrs:e=>e===`line-through`}],toDOM:t=>[`del`,e.get(M.key)(t)],parseMarkdown:{match:e=>e.type===`delete`,runner:(e,t,n)=>{e.openMark(n),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>e.type.name===`strike_through`,runner:(e,t)=>{e.withMark(t,`delete`)}}}));j(N.mark,{displayName:`MarkSchema<strikethrough>`,group:`Strikethrough`}),j(N.ctx,{displayName:`MarkSchemaCtx<strikethrough>`,group:`Strikethrough`});var P=i.t(`ToggleStrikeThrough`,e=>()=>r.O(N.type(e)));j(P,{displayName:`Command<ToggleStrikethrough>`,group:`Strikethrough`});var qt=i.r(e=>t.L(/(?<![\w:/])(~{1,2})(.+?)\1(?!\w|\/)/,N.type(e)));j(qt,{displayName:`InputRule<strikethrough>`,group:`Strikethrough`});var F=i.f(`strikeThroughKeymap`,{ToggleStrikethrough:{shortcuts:`Mod-Alt-x`,command:e=>{let n=e.get(t.s);return()=>n.call(P.key)}}});j(F.ctx,{displayName:`KeymapCtx<strikethrough>`,group:`Strikethrough`}),j(F.shortcuts,{displayName:`Keymap<strikethrough>`,group:`Strikethrough`});var I=o.y({tableGroup:`block`,cellContent:`paragraph`,cellAttributes:{alignment:{default:`left`,getFromDOM:e=>e.style.textAlign||`left`,setDOMAttr:(e,t)=>{t.style=`text-align: ${e||`left`}`}}}}),L=i.c(`table`,()=>({...I.table,content:`table_header_row table_row+`,disableDropCursor:!0,parseMarkdown:{match:e=>e.type===`table`,runner:(e,t,n)=>{let r=t.align,i=t.children.map((e,t)=>({...e,align:r,isHeader:t===0}));e.openNode(n),e.next(i),e.closeNode()}},toMarkdown:{match:e=>e.type.name===`table`,runner:(e,t)=>{let n=t.content.firstChild?.content;if(!n)return;let r=[];n.forEach(e=>{r.push(e.attrs.alignment)}),e.openNode(`table`,void 0,{align:r}),e.next(t.content),e.closeNode()}}}));j(L.node,{displayName:`NodeSchema<table>`,group:`Table`}),j(L.ctx,{displayName:`NodeSchemaCtx<table>`,group:`Table`});var R=i.c(`table_header_row`,()=>({...I.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 r=t.align,i=t.children.map((e,n)=>({...e,align:r[n],isHeader:t.isHeader}));e.openNode(n),e.next(i),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())}}}));j(R.node,{displayName:`NodeSchema<tableHeaderRow>`,group:`Table`}),j(R.ctx,{displayName:`NodeSchemaCtx<tableHeaderRow>`,group:`Table`});var z=i.c(`table_row`,()=>({...I.table_row,disableDropCursor:!0,content:`(table_cell)*`,parseMarkdown:{match:e=>e.type===`tableRow`,runner:(e,t,n)=>{let r=t.align,i=t.children.map((e,t)=>({...e,align:r[t]}));e.openNode(n),e.next(i),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())}}}));j(z.node,{displayName:`NodeSchema<tableRow>`,group:`Table`}),j(z.ctx,{displayName:`NodeSchemaCtx<tableRow>`,group:`Table`});var B=i.c(`table_cell`,()=>({...I.table_cell,disableDropCursor:!0,parseMarkdown:{match:e=>e.type===`tableCell`&&!e.isHeader,runner:(e,t,n)=>{let r=t.align;e.openNode(n,{alignment:r}).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()}}}));j(B.node,{displayName:`NodeSchema<tableCell>`,group:`Table`}),j(B.ctx,{displayName:`NodeSchemaCtx<tableCell>`,group:`Table`});var V=i.c(`table_header`,()=>({...I.table_header,disableDropCursor:!0,parseMarkdown:{match:e=>e.type===`tableCell`&&!!e.isHeader,runner:(e,t,n)=>{let r=t.align;e.openNode(n,{alignment:r}),e.openNode(e.schema.nodes.paragraph),e.next(t.children),e.closeNode(),e.closeNode()}},toMarkdown:{match:e=>e.type.name===`table_header`,runner:(e,t)=>{e.openNode(`tableCell`),e.next(t.content),e.closeNode()}}}));j(V.node,{displayName:`NodeSchema<tableHeader>`,group:`Table`}),j(V.ctx,{displayName:`NodeSchemaCtx<tableHeader>`,group:`Table`});function Jt(e,t=3,n=3){let r=Array(n).fill(0).map(()=>B.type(e).createAndFill()),i=Array(n).fill(0).map(()=>V.type(e).createAndFill()),a=Array(t).fill(0).map((t,n)=>n===0?R.type(e).create(null,i):z.type(e).create(null,r));return L.type(e).create(null,a)}function Yt(e,t){let n=o.d(t.$from);if(!n)return;let r=o.n.get(n.node);return(Array.isArray(e)?e:[e]).filter(e=>e>=0&&e<=r.width-1).flatMap(e=>r.cellsInRect({left:e,right:e+1,top:0,bottom:r.height}).map(e=>{let t=n.node.nodeAt(e),r=e+n.start;return{pos:r,start:r+1,node:t,depth:n.depth+2}}))}function Xt(e,t){let n=o.d(t.$from);if(!n)return;let r=o.n.get(n.node);return(Array.isArray(e)?e:[e]).filter(e=>e>=0&&e<=r.height-1).flatMap(e=>r.cellsInRect({left:0,right:r.width,top:e,bottom:e+1}).map(e=>{let t=n.node.nodeAt(e),r=e+n.start;return{pos:r,start:r+1,node:t,depth:n.depth+2}}))}function H(e){return(n,r)=>i=>{r??=i.selection.from;let a=i.doc.resolve(r),s=t.N(e=>e.type.name===`table`)(a),c=s?{node:s.node,from:s.start}:void 0,l=e===`row`;if(c){let e=o.n.get(c.node);if(n>=0&&n<(l?e.height:e.width)){let r=e.positionAt(l?n:e.height-1,l?e.width-1:n,c.node),a=i.doc.resolve(c.from+r),s=l?o.t.rowSelection:o.t.colSelection,u=e.positionAt(l?n:0,l?0:n,c.node),d=i.doc.resolve(c.from+u);return t.A(i.setSelection(s(a,d)))}}return i}}var Zt=H(`row`),Qt=H(`col`);function U(e,t,{map:n,tableStart:r,table:i},a){let o=Array(a).fill(0).reduce((e,t,n)=>e+i.child(n).nodeSize,r),s=Array(n.width).fill(0).map((t,r)=>{let a=i.nodeAt(n.map[r]);return B.type(e).createAndFill({alignment:a?.attrs.alignment})});return t.insert(o,z.type(e).create(null,s)),t}function $t(e){let t=o.d(e.$from);if(!t)return;let n=o.n.get(t.node);return n.cellsInRect({left:0,right:n.width,top:0,bottom:n.height}).map(e=>{let n=t.node.nodeAt(e),r=e+t.start;return{pos:r,start:r+1,node:n}})}function en(e){let n=$t(e.selection);if(n&&n[0]){let r=e.doc.resolve(n[0].pos),i=n[n.length-1];if(i){let n=e.doc.resolve(i.pos);return t.A(e.setSelection(new o.t(n,r)))}}return e}var W=i.t(`GoToPrevTableCell`,()=>()=>o.f(-1));j(W,{displayName:`Command<goToPrevTableCellCommand>`,group:`Table`});var G=i.t(`GoToNextTableCell`,()=>()=>o.f(1));j(G,{displayName:`Command<goToNextTableCellCommand>`,group:`Table`});var K=i.t(`ExitTable`,n=>()=>(r,i)=>{if(!o.p(r))return!1;let{$head:s}=r.selection,c=t.P(s,L.type(n));if(!c)return!1;let{to:l}=c,u=r.tr.replaceWith(l,l,a.i.type(n).createAndFill());return u.setSelection(e.o.near(u.doc.resolve(l),1)).scrollIntoView(),i?.(u),!0});j(K,{displayName:`Command<breakTableCommand>`,group:`Table`});var q=i.t(`InsertTable`,t=>({row:n,col:r}={})=>(i,a)=>{let{selection:o,tr:s}=i,{from:c}=o,l=Jt(t,n,r),u=s.replaceSelectionWith(l),d=e.o.findFrom(u.doc.resolve(c),1,!0);return d&&u.setSelection(d),a?.(u),!0});j(q,{displayName:`Command<insertTableCommand>`,group:`Table`});var J=i.t(`MoveRow`,()=>({from:e,to:t,pos:n}={})=>o.h({from:e??0,to:t??0,pos:n}));j(J,{displayName:`Command<moveRowCommand>`,group:`Table`});var tn=i.t(`MoveCol`,()=>({from:e,to:t,pos:n}={})=>o.m({from:e??0,to:t??0,pos:n}));j(tn,{displayName:`Command<moveColCommand>`,group:`Table`});var nn=i.t(`SelectRow`,()=>(e={index:0})=>(t,n)=>{let{tr:r}=t;return!!n?.(Zt(e.index,e.pos)(r))});j(nn,{displayName:`Command<selectRowCommand>`,group:`Table`});var rn=i.t(`SelectCol`,()=>(e={index:0})=>(t,n)=>{let{tr:r}=t;return!!n?.(Qt(e.index,e.pos)(r))});j(rn,{displayName:`Command<selectColCommand>`,group:`Table`});var an=i.t(`SelectTable`,()=>()=>(e,t)=>{let{tr:n}=e;return!!t?.(en(n))});j(an,{displayName:`Command<selectTableCommand>`,group:`Table`});var on=i.t(`DeleteSelectedCells`,()=>()=>(e,t)=>{let{selection:n}=e;if(!(n instanceof o.t))return!1;let r=n.isRowSelection(),i=n.isColSelection();return r&&i?o.u(e,t):i?o.c(e,t):o.l(e,t)});j(on,{displayName:`Command<deleteSelectedCellsCommand>`,group:`Table`});var sn=i.t(`AddColBefore`,()=>()=>o.i);j(sn,{displayName:`Command<addColBeforeCommand>`,group:`Table`});var cn=i.t(`AddColAfter`,()=>()=>o.r);j(cn,{displayName:`Command<addColAfterCommand>`,group:`Table`});var ln=i.t(`AddRowBefore`,e=>()=>(t,n)=>{if(!o.p(t))return!1;if(n){let r=o.g(t);n(U(e,t.tr,r,r.top))}return!0});j(ln,{displayName:`Command<addRowBeforeCommand>`,group:`Table`});var un=i.t(`AddRowAfter`,e=>()=>(t,n)=>{if(!o.p(t))return!1;if(n){let r=o.g(t);n(U(e,t.tr,r,r.bottom))}return!0});j(un,{displayName:`Command<addRowAfterCommand>`,group:`Table`});var dn=i.t(`SetAlign`,()=>(e=`left`)=>o._(`alignment`,e));j(dn,{displayName:`Command<setAlignCommand>`,group:`Table`});var fn=i.r(t=>new n.o(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,(n,r,i,a)=>{let o=n.doc.resolve(i);if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),L.type(t)))return null;let s=Jt(t,Math.max(Number(r.groups?.row??0),2),Number(r.groups?.col)),c=n.tr.replaceRangeWith(i,a,s);return c.setSelection(e.c.create(c.doc,i+3)).scrollIntoView()}));j(fn,{displayName:`InputRule<insertTableInputRule>`,group:`Table`});var pn=i.l(t=>({run:(n,r,i)=>{if(i)return n;function o(n){let r=n.childCount,i=n.lastChild?.childCount??0;if(r===0||i===0)return a.i.type(t).create();let o=n.firstChild;if(!(i>0&&o&&o.childCount===0))return n;if(r>=3){let e=n.child(1),i=[];for(let n=0;n<e.childCount;n++){let r=e.child(n);i.push(V.type(t).create(r.attrs,r.content,r.marks))}let a=o.type.create(o.attrs,i),s=[];for(let e=2;e<r;e++)s.push(n.child(e));return n.type.create(n.attrs,[a,...s])}let s=Array(i).fill(0).map(()=>V.type(t).createAndFill()),c=new e.k(e.C.from(s),0,0),l=o.replace(0,0,c);return n.replace(0,o.nodeSize,new e.k(e.C.from(l),0,0))}function s(n){let r=z.type(t),i=[],a=[],s=!1;function c(){if(a.length===0)return;let e=R.type(t).createAndFill(),n=L.type(t).create(null,[e,...a]);i.push(o(n)),a=[]}return n.forEach(e=>{e.type===r?(s=!0,a.push(e)):(c(),i.push(e))}),c(),s?e.C.from(i):n}function c(n){let r=s(n),i=r!==n,a=[];return r.forEach(e=>{if(e.type===L.type(t)){let t=o(e);t!==e&&(i=!0),a.push(t)}else if(e.childCount>0){let t=c(e.content);t===e.content?a.push(e):(i=!0,a.push(e.copy(t)))}else a.push(e)}),i?e.C.from(a):n}function l(n){let r=[],i=[];n.forEach(e=>i.push(e));for(let e=0;e<i.length;e++){let n=i[e],o=i[e+1];n.type===a.i.type(t)&&n.content.size===0&&o&&o.type===L.type(t)||r.push(n)}return r.length<i.length?e.C.from(r):n}let u=c(n.content);return u=l(u),new e.k(e.C.from(u),n.openStart,n.openEnd)}}));j(pn,{displayName:`PasteRule<table>`,group:`Table`});var Y=i.f(`tableKeymap`,{NextCell:{priority:100,shortcuts:[`Mod-]`,`Tab`],command:e=>{let n=e.get(t.s);return()=>n.call(G.key)}},PrevCell:{shortcuts:[`Mod-[`,`Shift-Tab`],command:e=>{let n=e.get(t.s);return()=>n.call(W.key)}},ExitTable:{shortcuts:[`Mod-Enter`,`Enter`],command:e=>{let n=e.get(t.s);return()=>n.call(K.key)}}});j(Y.ctx,{displayName:`KeymapCtx<table>`,group:`Table`}),j(Y.shortcuts,{displayName:`Keymap<table>`,group:`Table`});var mn=`footnote_definition`,hn=`footnoteDefinition`,X=i.c(`footnote_definition`,()=>({group:`block`,content:`block+`,defining:!0,attrs:{label:{default:``,validate:`string`}},parseDOM:[{tag:`dl[data-type="${mn}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw t.V(e);return{label:e.dataset.label}},contentElement:`dd`}],toDOM:e=>{let t=e.attrs.label;return[`dl`,{"data-label":t,"data-type":mn},[`dt`,t],[`dd`,0]]},parseMarkdown:{match:({type:e})=>e===hn,runner:(e,t,n)=>{e.openNode(n,{label:t.label}).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name===mn,runner:(e,t)=>{e.openNode(hn,void 0,{label:t.attrs.label,identifier:t.attrs.label}).next(t.content).closeNode()}}}));j(X.ctx,{displayName:`NodeSchemaCtx<footnodeDef>`,group:`footnote`}),j(X.node,{displayName:`NodeSchema<footnodeDef>`,group:`footnote`});var gn=`footnote_reference`,Z=i.c(`footnote_reference`,()=>({group:`inline`,inline:!0,atom:!0,attrs:{label:{default:``,validate:`string`}},parseDOM:[{tag:`sup[data-type="${gn}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw t.V(e);return{label:e.dataset.label}}}],toDOM:e=>{let t=e.attrs.label;return[`sup`,{"data-label":t,"data-type":gn},t]},parseMarkdown:{match:({type:e})=>e===`footnoteReference`,runner:(e,t,n)=>{e.addNode(n,{label:t.label})}},toMarkdown:{match:e=>e.type.name===gn,runner:(e,t)=>{e.addNode(`footnoteReference`,void 0,void 0,{label:t.attrs.label,identifier:t.attrs.label})}}}));j(Z.ctx,{displayName:`NodeSchemaCtx<footnodeRef>`,group:`footnote`}),j(Z.node,{displayName:`NodeSchema<footnodeRef>`,group:`footnote`});var Q=a.r.extendSchema(e=>n=>{let r=e(n);return{...r,attrs:{...r.attrs,checked:{default:null,validate:`boolean|null`}},parseDOM:[{tag:`li[data-item-type="task"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw t.V(e);return{label:e.dataset.label,listType:e.dataset.listType,spread:e.dataset.spread,checked:e.dataset.checked?e.dataset.checked===`true`:null}}},...r?.parseDOM||[]],toDOM:e=>r.toDOM&&e.attrs.checked==null?r.toDOM(e):[`li`,{"data-item-type":`task`,"data-label":e.attrs.label,"data-list-type":e.attrs.listType,"data-spread":e.attrs.spread,"data-checked":e.attrs.checked},0],parseMarkdown:{match:({type:e})=>e===`listItem`,runner:(e,t,n)=>{if(t.checked==null){r.parseMarkdown.runner(e,t,n);return}let i=t.label==null?`•`:`${t.label}.`,a=t.checked==null?null:!!t.checked,o=t.label==null?`bullet`:`ordered`,s=t.spread==null?`true`:`${t.spread}`;e.openNode(n,{label:i,listType:o,spread:s,checked:a}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>e.type.name===`list_item`,runner:(e,t)=>{if(t.attrs.checked==null){r.toMarkdown.runner(e,t);return}let n=t.attrs.label,i=t.attrs.listType,a=t.attrs.spread===`true`,o=t.attrs.checked;e.openNode(`listItem`,void 0,{label:n,listType:i,spread:a,checked:o}),e.next(t.content),e.closeNode()}}}});j(Q.node,{displayName:`NodeSchema<taskListItem>`,group:`ListItem`}),j(Q.ctx,{displayName:`NodeSchemaCtx<taskListItem>`,group:`ListItem`});var _n=i.r(()=>new n.o(/^\[(?<checked>\s|x)\]\s$/,(e,t,n,r)=>{let i=e.doc.resolve(n),a=0,o=i.node(a);for(;o&&o.type.name!==`list_item`;)a--,o=i.node(a);if(!o||o.attrs.checked!=null)return null;let s=t.groups?.checked===`x`,c=i.before(a),l=e.tr;return l.deleteRange(n,r).setNodeMarkup(c,void 0,{...o.attrs,checked:s}),l}));j(_n,{displayName:`InputRule<wrapInTaskListInputRule>`,group:`ListItem`});var vn=[F,Y].flat(),yn=[fn,_n],bn=[qt],xn=[pn],Sn=i.u(()=>te);j(Sn,{displayName:`Prose<autoInsertSpanPlugin>`,group:`Prose`});var Cn=i.u(()=>o.s({}));j(Cn,{displayName:`Prose<columnResizingPlugin>`,group:`Prose`});var wn=i.u(()=>o.v({allowTableNodeSelection:!0}));j(wn,{displayName:`Prose<tableEditingPlugin>`,group:`Prose`});var $=i.d(`remarkGFM`,()=>Kt);j($.plugin,{displayName:`Remark<remarkGFMPlugin>`,group:`Remark`}),j($.options,{displayName:`RemarkConfig<remarkGFMPlugin>`,group:`Remark`});var Tn=new e.a(`MILKDOWN_KEEP_TABLE_ALIGN_PLUGIN`);function En(e,t){let n=0;return t.forEach((t,r,i)=>{t===e&&(n=i)}),n}var Dn=i.u(()=>new e.i({key:Tn,appendTransaction:(e,t,n)=>{let r;return t.doc!==n.doc&&n.doc.descendants((e,t)=>{if(r||=n.tr,e.type.name!==`table_cell`)return;let i=n.doc.resolve(t),a=i.node(i.depth),o=i.node(i.depth-1).firstChild;if(!o)return;let s=En(e,a),c=o.maybeChild(s);if(!c)return;let l=c.attrs.alignment;l!==e.attrs.alignment&&r.setNodeMarkup(t,void 0,{...e.attrs,alignment:l})}),r}}));j(Dn,{displayName:`Prose<keepTableAlignPlugin>`,group:`Prose`});var On=[Dn,Sn,$,wn].flat(),kn=[Q,L,R,z,V,B,X,Z,M,N].flat(),An=[G,W,K,q,J,tn,nn,rn,an,on,ln,un,sn,cn,dn,P],jn=[kn,yn,xn,bn,vn,An,On].flat();exports.addColAfterCommand=cn,exports.addColBeforeCommand=sn,exports.addRowAfterCommand=un,exports.addRowBeforeCommand=ln,exports.addRowWithAlignment=U,exports.autoInsertSpanPlugin=Sn,exports.columnResizingPlugin=Cn,exports.commands=An,exports.createTable=Jt,exports.deleteSelectedCellsCommand=on,exports.exitTable=K,exports.extendListItemSchemaForTask=Q,exports.footnoteDefinitionSchema=X,exports.footnoteReferenceSchema=Z,exports.getAllCellsInTable=$t,exports.getCellsInCol=Yt,exports.getCellsInRow=Xt,exports.gfm=jn,exports.goToNextTableCellCommand=G,exports.goToPrevTableCellCommand=W,exports.inputRules=yn,exports.insertTableCommand=q,exports.insertTableInputRule=fn,exports.keepTableAlignPlugin=Dn,exports.keymap=vn,exports.markInputRules=bn,exports.moveColCommand=tn,exports.moveRowCommand=J,exports.pasteRules=xn,exports.plugins=On,exports.remarkGFMPlugin=$,exports.schema=kn,exports.selectCol=Qt,exports.selectColCommand=rn,exports.selectLine=H,exports.selectRow=Zt,exports.selectRowCommand=nn,exports.selectTable=en,exports.selectTableCommand=an,exports.setAlignCommand=dn,exports.strikethroughAttr=M,exports.strikethroughInputRule=qt,exports.strikethroughKeymap=F,exports.strikethroughSchema=N,exports.tableCellSchema=B,exports.tableEditingPlugin=wn,exports.tableHeaderRowSchema=R,exports.tableHeaderSchema=V,exports.tableKeymap=Y,exports.tablePasteRule=pn,exports.tableRowSchema=z,exports.tableSchema=L,exports.toggleStrikethroughCommand=P,exports.wrapInTaskListInputRule=_n;
|