@kinetis/vector-ui 0.12.0 → 0.12.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/CHANGELOG.md +20 -0
- package/app/components/Vx/Resource/Table.vue +7 -7
- package/dist/static/200.html +1 -1
- package/dist/static/404.html +1 -1
- package/dist/static/_nuxt/{BDwgkdzs.js → 0XFHFyLE.js} +1 -1
- package/dist/static/_nuxt/{BTI9wOw3.js → 1EmobxKy.js} +1 -1
- package/dist/static/_nuxt/{BnlaqUIK.js → 3K0uatjA.js} +1 -1
- package/dist/static/_nuxt/{Br-v6nfV.js → 5CKHNnhD.js} +1 -1
- package/dist/static/_nuxt/{DBgKGXIj.js → 9t6l-Rdt.js} +1 -1
- package/dist/static/_nuxt/{ZVCqzuKT.js → B-N_9F8Y.js} +1 -1
- package/dist/static/_nuxt/{CSzw4ySZ.js → B-nBg1Xv.js} +1 -1
- package/dist/static/_nuxt/{CxlUCc9r.js → B0qYsC7W.js} +1 -1
- package/dist/static/_nuxt/{mtQhqX_4.js → B6J1_h6c.js} +1 -1
- package/dist/static/_nuxt/{go_nGSOr.js → B6NDob-m.js} +1 -1
- package/dist/static/_nuxt/{tm30M8Ch.js → B75h9tWi.js} +1 -1
- package/dist/static/_nuxt/{E-mWtnN5.js → B8WJAiam.js} +1 -1
- package/dist/static/_nuxt/{Dg_tXu9P.js → B8a3XTZQ.js} +1 -1
- package/dist/static/_nuxt/{DhECW-Pr.js → BAn4QhRh.js} +1 -1
- package/dist/static/_nuxt/BEX0oVSL.js +2 -0
- package/dist/static/_nuxt/{BFZ46Edz.js → BEu939QZ.js} +1 -1
- package/dist/static/_nuxt/{Bm_wsdTH.js → BKZYsdTJ.js} +1 -1
- package/dist/static/_nuxt/{DVIiT5EL.js → BRGCMXsj.js} +1 -1
- package/dist/static/_nuxt/BSF5tOpn.js +1 -0
- package/dist/static/_nuxt/{-CLe6vUm.js → BSIqtL7L.js} +1 -1
- package/dist/static/_nuxt/{Bi_p8utQ.js → BZ0cNjPG.js} +1 -1
- package/dist/static/_nuxt/{C_2GgX80.js → BZmn1C4S.js} +1 -1
- package/dist/static/_nuxt/{BzY34lc1.js → B_OlDMFe.js} +1 -1
- package/dist/static/_nuxt/{B4joN-Do.js → BaIA0jZn.js} +1 -1
- package/dist/static/_nuxt/BbYIy4ys.js +1 -0
- package/dist/static/_nuxt/{DhiDhXgK.js → Bcf6gY0Y.js} +2 -2
- package/dist/static/_nuxt/{ORpfF6Nb.js → BdKsdwRT.js} +1 -1
- package/dist/static/_nuxt/{csgWgQhm.js → Bh0FXlPY.js} +1 -1
- package/dist/static/_nuxt/{BZKBoSZy.js → BkB5nLdi.js} +1 -1
- package/dist/static/_nuxt/{BzKz2oL1.js → Bn6DafZm.js} +1 -1
- package/dist/static/_nuxt/{BDLoIbc4.js → BoY5utW-.js} +1 -1
- package/dist/static/_nuxt/{DSIjvNuw.js → BotEmkbt.js} +2 -2
- package/dist/static/_nuxt/{51OWHj8c.js → Bp1wYuAu.js} +2 -2
- package/dist/static/_nuxt/{D1nKViyT.js → BwhGwxq9.js} +1 -1
- package/dist/static/_nuxt/C-V_d0r7.js +1 -0
- package/dist/static/_nuxt/{JjWUotQr.js → C1djf5sc.js} +1 -1
- package/dist/static/_nuxt/{BWrwqNAK.js → C2HOErH-.js} +1 -1
- package/dist/static/_nuxt/{2c1vZ90H.js → C2fOtOCd.js} +1 -1
- package/dist/static/_nuxt/{DssSpQf8.js → C3TdYgzW.js} +1 -1
- package/dist/static/_nuxt/{CPAF2hi7.js → C61G2Eu2.js} +1 -1
- package/dist/static/_nuxt/{BIv9Nyve.js → C70Zokea.js} +1 -1
- package/dist/static/_nuxt/{CRQyQuGt.js → C8NyX5Od.js} +1 -1
- package/dist/static/_nuxt/{DvnG2kZK.js → C8oWNQAK.js} +1 -1
- package/dist/static/_nuxt/{BSYV8YR9.js → CB1cLF6K.js} +1 -1
- package/dist/static/_nuxt/{B0GD7QJy.js → CBIdPVBN.js} +1 -1
- package/dist/static/_nuxt/{9MD1hlLT.js → CCqTpTgf.js} +1 -1
- package/dist/static/_nuxt/{DayrADeq.js → CD2Xc7nX.js} +1 -1
- package/dist/static/_nuxt/{DkQpAs16.js → CDkdr3K3.js} +1 -1
- package/dist/static/_nuxt/{DFsV0Sjv.js → CDkz_RCC.js} +1 -1
- package/dist/static/_nuxt/{BtSHpy4S.js → CGKri8xI.js} +1 -1
- package/dist/static/_nuxt/{CCr9dqOM.js → CGZHPyLq.js} +1 -1
- package/dist/static/_nuxt/{CNKBVevI.js → CL8kR7Jl.js} +1 -1
- package/dist/static/_nuxt/{rVO8WoV9.js → CUJwdJWW.js} +1 -1
- package/dist/static/_nuxt/CUY7TizY.js +1 -0
- package/dist/static/_nuxt/{D8QRJNA1.js → CYzzubwX.js} +1 -1
- package/dist/static/_nuxt/{qzTYEKJ1.js → CZHYqwMP.js} +2 -2
- package/dist/static/_nuxt/{D7as59Fa.js → C_cmzTu7.js} +1 -1
- package/dist/static/_nuxt/CbfDRhKQ.js +105 -0
- package/dist/static/_nuxt/{DqjZ16aB.js → Cbh8yz3r.js} +1 -1
- package/dist/static/_nuxt/{BMS510w1.js → CcKa2LhX.js} +1 -1
- package/dist/static/_nuxt/{CTHeqfU5.js → Cg_0SbPD.js} +1 -1
- package/dist/static/_nuxt/{xd2mj56f.js → CmoDOC5e.js} +1 -1
- package/dist/static/_nuxt/{bmIlMXFn.js → Cn-sEHrF.js} +1 -1
- package/dist/static/_nuxt/{CQQ-wIWC.js → CoQkOgbz.js} +1 -1
- package/dist/static/_nuxt/CpCuvz_Q.js +1 -0
- package/dist/static/_nuxt/{BqBjYl5i.js → CpWrs6ST.js} +1 -1
- package/dist/static/_nuxt/{RChVezE9.js → CrB-cqMb.js} +1 -1
- package/dist/static/_nuxt/{DQ1z3A04.js → CrBE96Tf.js} +1 -1
- package/dist/static/_nuxt/{BBBFJ6ov.js → CsakM5cG.js} +1 -1
- package/dist/static/_nuxt/{A_YrkIh-.js → Cv0_BbF0.js} +1 -1
- package/dist/static/_nuxt/{rSy2G_Qb.js → Cy7TtUfa.js} +1 -1
- package/dist/static/_nuxt/{vmqqxV_Q.js → D0B2-Xub.js} +1 -1
- package/dist/static/_nuxt/{ChHm6L68.js → D0Kpcb6p.js} +1 -1
- package/dist/static/_nuxt/{DR4qylKa.js → D30ymUqz.js} +1 -1
- package/dist/static/_nuxt/{D9BNw4XE.js → D3cKZbMy.js} +1 -1
- package/dist/static/_nuxt/{cDe9iywT.js → D5s6wS_k.js} +1 -1
- package/dist/static/_nuxt/{Cc0_Jvm0.js → D66f0-yE.js} +1 -1
- package/dist/static/_nuxt/D7G2EIjv.js +1 -0
- package/dist/static/_nuxt/{BHcm7bNA.js → D7JW3pi_.js} +1 -1
- package/dist/static/_nuxt/{BWmtnGCr.js → DASRsVgm.js} +1 -1
- package/dist/static/_nuxt/{BnRGraEc.js → DCHrRSav.js} +1 -1
- package/dist/static/_nuxt/{MAzsrRZz.js → DLFK-0gp.js} +1 -1
- package/dist/static/_nuxt/{BFcl4Vn9.js → DOTAOcMp.js} +1 -1
- package/dist/static/_nuxt/{C_g8bZuk.js → DOUu5tHk.js} +1 -1
- package/dist/static/_nuxt/{BkHt6U4C.js → DP89I2lN.js} +1 -1
- package/dist/static/_nuxt/{42EY5Fp0.js → DPDZkh6Z.js} +1 -1
- package/dist/static/_nuxt/{vab0LrNP.js → DQ5dE1NN.js} +3 -3
- package/dist/static/_nuxt/{DLzA6Iec.js → DT1zmKvw.js} +1 -1
- package/dist/static/_nuxt/{mbGIOAkp.js → DTEaW96E.js} +1 -1
- package/dist/static/_nuxt/{rkb3Oe3x.js → DTOFzxyP.js} +1 -1
- package/dist/static/_nuxt/{D1Z538bJ.js → DUovJbJx.js} +1 -1
- package/dist/static/_nuxt/{OMRlJR6k.js → DY9S-h7t.js} +1 -1
- package/dist/static/_nuxt/{Ge5l3uM8.js → DZ7x7tlF.js} +1 -1
- package/dist/static/_nuxt/{BFBN0MCm.js → DaZyI3p0.js} +1 -1
- package/dist/static/_nuxt/{BsCAElgq.js → Davl1XHT.js} +1 -1
- package/dist/static/_nuxt/{BC4n0Ghf.js → Di2hybyn.js} +1 -1
- package/dist/static/_nuxt/{Dialog.al_QQir4.css → Dialog.CJ4wujfH.css} +1 -1
- package/dist/static/_nuxt/{DB9Px0Zg.js → Djb5b_0H.js} +1 -1
- package/dist/static/_nuxt/{iEEDTq6e.js → Dkxjrt9t.js} +1 -1
- package/dist/static/_nuxt/{Lj7y5-JX.js → Dl6oOLmA.js} +1 -1
- package/dist/static/_nuxt/{DVRz0uUW.js → DnQDxK91.js} +1 -1
- package/dist/static/_nuxt/{CmQyigb3.js → Dnl_Q9LX.js} +1 -1
- package/dist/static/_nuxt/{Ci1-hOA9.js → DoNlTJTo.js} +1 -1
- package/dist/static/_nuxt/{BtRqSK7K.js → DqGsRZgz.js} +1 -1
- package/dist/static/_nuxt/{C6P-usW8.js → DsA1BqV6.js} +1 -1
- package/dist/static/_nuxt/Dtqzfvmq.js +1 -0
- package/dist/static/_nuxt/{1aNtrH5X.js → DuadUyNo.js} +1 -1
- package/dist/static/_nuxt/{B_DG2saj.js → DwhplmWw.js} +1 -1
- package/dist/static/_nuxt/{BhY1yzIk.js → ICANwqNf.js} +1 -1
- package/dist/static/_nuxt/{BVjSh6vC.js → ID6cAcVb.js} +1 -1
- package/dist/static/_nuxt/{DJsVN_9p.js → IKCPinSU.js} +1 -1
- package/dist/static/_nuxt/{C-MpSlvO.js → IxXqqY2k.js} +1 -1
- package/dist/static/_nuxt/{DjPCgCyJ.js → JXGS-gjL.js} +1 -1
- package/dist/static/_nuxt/{BQH4NHkG.js → LsI3KdxJ.js} +1 -1
- package/dist/static/_nuxt/{Bt_KgVrY.js → NBM3ZNPF.js} +1 -1
- package/dist/static/_nuxt/{CEAJldjl.js → NTQyXsYJ.js} +1 -1
- package/dist/static/_nuxt/{CvqfGMjv.js → Oyo1wAk3.js} +1 -1
- package/dist/static/_nuxt/QTRQ5bvA.js +1 -0
- package/dist/static/_nuxt/{B9psIVnP.js → QlhtReDg.js} +1 -1
- package/dist/static/_nuxt/UoJt16Vw.js +1 -0
- package/dist/static/_nuxt/{BQnpCLjt.js → Y7__Wzb8.js} +1 -1
- package/dist/static/_nuxt/_resource_.CZ-hvn3L.css +1 -0
- package/dist/static/_nuxt/{MEvklnEE.js → a8loK67W.js} +1 -1
- package/dist/static/_nuxt/{B_fQu_h2.js → a_AKbjEN.js} +1 -1
- package/dist/static/_nuxt/builds/latest.json +1 -1
- package/dist/static/_nuxt/builds/meta/f00875e4-0856-4fd9-9b96-3f56d139bba8.json +1 -0
- package/dist/static/_nuxt/error-404.B8s8Efz5.css +1 -0
- package/dist/static/_nuxt/error-500.l3XjU95N.css +1 -0
- package/dist/static/_nuxt/{COHV16dX.js → fUvCMzVL.js} +1 -1
- package/dist/static/_nuxt/{D-rB2fWZ.js → gMjfE5Hg.js} +1 -1
- package/dist/static/_nuxt/{9mpX2szp.js → jeoKFN9R.js} +1 -1
- package/dist/static/_nuxt/{rSRjHK_a.js → lbsTXfnT.js} +1 -1
- package/dist/static/_nuxt/{D7DEE4gN.js → ln4PDumd.js} +1 -1
- package/dist/static/_nuxt/{CdjG3WTk.js → pnYgYDY5.js} +1 -1
- package/dist/static/_nuxt/{Dnv1kjao.js → rp1h1m4f.js} +1 -1
- package/dist/static/_nuxt/wlpNGAAZ.js +3 -0
- package/dist/static/_nuxt/yC35w56h.js +1 -0
- package/dist/static/_nuxt/{Dm7hGi3P.js → yO0LqdZ2.js} +1 -1
- package/dist/static/index.html +1 -1
- package/dist/static/jobs/index.html +1 -1
- package/dist/static/login/index.html +1 -1
- package/dist/static/queues/index.html +1 -1
- package/dist/static/settings/index.html +1 -1
- package/dist/static/vector-bundle.json +147 -147
- package/package.json +19 -19
- package/dist/static/_nuxt/B0taRzJN.js +0 -1
- package/dist/static/_nuxt/BKpxsGPP.js +0 -1
- package/dist/static/_nuxt/BiIirvgR.js +0 -2
- package/dist/static/_nuxt/C64NUw_T.js +0 -1
- package/dist/static/_nuxt/C6FXj6mJ.js +0 -1
- package/dist/static/_nuxt/CCev1aKa.js +0 -1
- package/dist/static/_nuxt/CHyInEhw.js +0 -1
- package/dist/static/_nuxt/CIQLz04l.js +0 -1
- package/dist/static/_nuxt/CgxSerDc.js +0 -1
- package/dist/static/_nuxt/CuG-8Z4K.js +0 -105
- package/dist/static/_nuxt/DI2U4Yky.js +0 -1
- package/dist/static/_nuxt/DZo3dYLJ.js +0 -3
- package/dist/static/_nuxt/R0rf_l_C.js +0 -1
- package/dist/static/_nuxt/_resource_.C0QgZA88.css +0 -1
- package/dist/static/_nuxt/builds/meta/f5ce5132-6b99-4f7d-9c7c-6cef19f59d51.json +0 -1
- package/dist/static/_nuxt/error-404.B9sBsxLH.css +0 -1
- package/dist/static/_nuxt/error-500.Dy1PcAYT.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Yt as e}from"./
|
|
1
|
+
import{Yt as e}from"./C61G2Eu2.js";import{$ as t,A as n,At as r,B as i,Bt as a,Ct as o,Dt as s,Et as c,Ft as l,G as u,I as d,It as f,J as p,L as m,Lt as h,M as g,Mt as _,N as v,Nt as y,Ot as b,P as x,Pt as S,Q as C,R as ee,Rt as te,St as ne,Tt as w,U as re,Vt as T,W as ie,X as ae,Y as oe,Z as se,_t as ce,at as le,bt as ue,ct as de,dt as fe,et as pe,ft as me,gt as he,ht as E,j as ge,jt as D,k as _e,kt as ve,lt as ye,mt as O,nt as be,ot as xe,q as Se,rt as k,st as Ce,tt as A,ut as we,wt as Te,xt as Ee,yt as De,zt as j}from"#entry";var Oe=new WeakSet,ke=new WeakSet;function Ae(e){let t=e;return Oe.add(t),t}function je(e){return Array.isArray(e)&&Oe.has(e)}function Me(e){return e.flatMap(e=>e==null?[]:Array.isArray(e)&&ke.has(e)&&!je(e)?Me(e):[e])}function Ne(e,t){if(e===`slot`)return 0;if(e instanceof Function){let n=e(t);return Array.isArray(n)&&!je(n)&&!ke.has(n)?Ae(n):n}let{children:n,...r}=t??{};if(e===`svg`)throw Error(`SVG elements are not supported in the JSX syntax, use the array syntax instead`);if(Array.isArray(n)){if(je(n))return Ae([e,r,n]);if(n.length===0)return Ae([e,r]);let t=Me(n);return t.length===0?Ae([e,r]):Ae([e,r,...t])}return Ae(n==null?[e,r]:[e,r,n])}var Pe=(e,t)=>Ne(e,t),Fe=(e,t)=>{let{state:n}=e,{selection:r}=n;if(!r.empty)return!1;let{$from:i}=r;if(i.parentOffset!==0)return!1;let a=i.depth-1;if(a<0)return!1;let o=i.node(a),s=i.index(a);if(s===0)return!1;if(o.type===t)return e.commands.lift(t.name);let c=o.child(s-1);if(c.type!==t||!c.lastChild?.isTextblock)return!1;let u=i.before()-1-1;return e.commands.command(({tr:e,dispatch:t})=>{if(!t)return!0;let n=i.parent.content,r=new T(n,0,0);return e.replace(u,i.after(),r),e.setSelection(l.create(e.doc,u+n.size)),e.scrollIntoView(),t(e),!0})},Ie=/^\s*>\s$/,Le=g.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return Pe(`blockquote`,{...O(this.options.HTMLAttributes,e),children:Pe(`slot`,{})})},parseMarkdown:(e,t)=>{let n=t.parseBlockChildren??t.parseChildren;return t.createNode(`blockquote`,void 0,n(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return``;let n=[];return e.content.forEach((e,r)=>{let i=(t.renderChild?.call(t,e,r)??t.renderChildren([e])).split(`
|
|
2
2
|
`).map(e=>e.trim()===``?`>`:`> ${e}`);n.push(i.join(`
|
|
3
3
|
`))}),n.join(`
|
|
4
4
|
>
|
|
@@ -25,7 +25,7 @@ import{Yt as e}from"./CPAF2hi7.js";import{$ as t,A as n,At as r,B as i,Bt as a,C
|
|
|
25
25
|
`,kn=`️`,An=``,jn=``,Mn=null,Nn=null;function Pn(e=[]){let t={};N.groups=t;let n=new N;Mn??=Rn(ot),Nn??=Rn(st),I(n,`'`,Jt),I(n,`{`,Mt),I(n,`}`,Nt),I(n,`[`,Pt),I(n,`]`,Ft),I(n,`(`,It),I(n,`)`,Lt),I(n,`<`,Rt),I(n,`>`,zt),I(n,`(`,Bt),I(n,`)`,Vt),I(n,`「`,Ht),I(n,`」`,R),I(n,`『`,Ut),I(n,`』`,Wt),I(n,`<`,Gt),I(n,`>`,Kt),I(n,`&`,qt),I(n,`*`,Yt),I(n,`@`,Xt),I(n,"`",Qt),I(n,`^`,$t),I(n,`:`,en),I(n,`,`,tn),I(n,`$`,nn),I(n,`.`,rn),I(n,`=`,an),I(n,`!`,on),I(n,`-`,sn),I(n,`%`,cn),I(n,`|`,ln),I(n,`+`,un),I(n,`#`,dn),I(n,`?`,fn),I(n,`"`,pn),I(n,`/`,gn),I(n,`;`,hn),I(n,`~`,_n),I(n,`_`,vn),I(n,`\\`,Zt),I(n,`・`,mn);let r=F(n,Tn,kt,{[ct]:!0});F(r,Tn,r);let i=F(r,Sn,St,{[dt]:!0}),a=F(r,Cn,Ct,{[ft]:!0}),o=F(n,Sn,L,{[lt]:!0});F(o,Tn,i),F(o,Sn,o),F(i,Tn,i),F(i,Sn,i);let s=F(n,Cn,xt,{[ut]:!0});F(s,Sn),F(s,Tn,a),F(s,Cn,s),F(a,Tn,a),F(a,Sn),F(a,Cn,a);let c=I(n,On,jt,{[gt]:!0}),l=I(n,Dn,At,{[gt]:!0}),u=F(n,En,At,{[gt]:!0});I(n,jn,u),I(l,On,c),I(l,jn,u),F(l,En,u),I(u,Dn),I(u,On),F(u,En,u),I(u,jn,u);let d=F(n,wn,yn,{[mt]:!0});I(d,`#`),F(d,wn,d),I(d,kn,d);let f=I(d,An);I(f,`#`),F(f,wn,d);let p=[[Sn,o],[Tn,i]],m=[[Sn,null],[Cn,s],[Tn,a]];for(let e=0;e<Mn.length;e++)Ln(n,Mn[e],Tt,L,p);for(let e=0;e<Nn.length;e++)Ln(n,Nn[e],Et,xt,m);vt(Tt,{tld:!0,ascii:!0},t),vt(Et,{utld:!0,alpha:!0},t),Ln(n,`file`,Dt,L,p),Ln(n,`mailto`,Dt,L,p),Ln(n,`http`,Ot,L,p),Ln(n,`https`,Ot,L,p),Ln(n,`ftp`,Ot,L,p),Ln(n,`ftps`,Ot,L,p),vt(Dt,{scheme:!0,ascii:!0},t),vt(Ot,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){let r=e[t][0],i=e[t][1]?{[M]:!0}:{[ht]:!0};r.indexOf(`-`)>=0?i[pt]=!0:Sn.test(r)?Tn.test(r)?i[dt]=!0:i[lt]=!0:i[ct]=!0,bt(n,r,r,i)}return bt(n,`localhost`,wt,{ascii:!0}),n.jd=new N(bn),{start:n,tokens:Object.assign({groups:t},xn)}}function Fn(e,t){let n=In(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],a=0,o=0;for(;o<r;){let s=e,c=null,l=0,u=null,d=-1,f=-1;for(;o<r&&(c=s.go(n[o]));)s=c,s.accepts()?(d=0,f=0,u=s):d>=0&&(d+=n[o].length,f++),l+=n[o].length,a+=n[o].length,o++;a-=d,o-=f,l-=d,i.push({t:u.t,v:t.slice(a-l,a),s:a-l,e:a})}return i}function In(e){let t=[],n=e.length,r=0;for(;r<n;){let i=e.charCodeAt(r),a,o=i<55296||i>56319||r+1===n||(a=e.charCodeAt(r+1))<56320||a>57343?e[r]:e.slice(r,r+2);t.push(o),r+=o.length}return t}function Ln(e,t,n,r,i){let a,o=t.length;for(let n=0;n<o-1;n++){let o=t[n];e.j[o]?a=e.j[o]:(a=new N(r),a.jr=i.slice(),e.j[o]=a),e=a}return a=new N(n),a.jr=i.slice(),e.j[t[o-1]]=a,a}function Rn(e){let t=[],n=[],r=0;for(;r<e.length;){let i=0;for(;`0123456789`.indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(``));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}var zn={defaultProtocol:`http`,events:null,format:Vn,formatHref:Vn,nl2br:!1,tagName:`a`,target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],ignoreClasses:[],render:null};function Bn(e,t=null){let n=Object.assign({},zn);e&&(n=Object.assign(n,e instanceof Bn?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e<r.length;e++)i.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i,this.ignoreClasses=n.ignoreClasses.slice()}Bn.prototype={o:zn,ignoreTags:[],ignoreClasses:[],isIgnoredClass(e){if(typeof e!=`string`||this.ignoreClasses.length===0)return!1;let t=e.split(/\s+/);for(let e=0;e<t.length;e++)if(this.ignoreClasses.indexOf(t[e])>=0)return!0;return!1},defaultRender(e){return e},check(e){return this.get(`validate`,e.toString(),e)},get(e,t,n){let r=t!=null,i=this.o[e];return i&&(typeof i==`object`?(i=n.t in i?i[n.t]:zn[e],typeof i==`function`&&r&&(i=i(t,n))):typeof i==`function`&&r&&(i=i(t,n.t,n)),i)},getObj(e,t,n){let r=this.o[e];return typeof r==`function`&&t!=null&&(r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get(`render`,null,e)||this.defaultRender)(t,e.t,e)}};function Vn(e){return e}function Hn(e,t){this.t=`token`,this.v=e,this.tk=t}Hn.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get(`truncate`,t,this),r=e.get(`format`,t,this);return n&&r.length>n?r.substring(0,n)+`…`:r},toFormattedHref(e){return e.get(`formatHref`,this.toHref(e.get(`defaultProtocol`)),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=zn.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get(`validate`,this.toString(),this)},render(e){let t=this,n=this.toHref(e.get(`defaultProtocol`)),r=e.get(`formatHref`,n,this),i=e.get(`tagName`,n,t),a=this.toFormattedString(e),o={},s=e.get(`className`,n,t),c=e.get(`target`,n,t),l=e.get(`rel`,n,t),u=e.getObj(`attributes`,n,t),d=e.getObj(`events`,n,t);return o.href=r,s&&(o.class=s),c&&(o.target=c),l&&(o.rel=l),u&&Object.assign(o,u),{tagName:i,attributes:o,content:a,eventListeners:d}}};function Un(e,t){class n extends Hn{constructor(t,n){super(t,n),this.t=e}}for(let e in t)n.prototype[e]=t[e];return n.t=e,n}var Wn=Un(`email`,{isLink:!0,toHref(){return`mailto:`+this.toString()}}),Gn=Un(`text`),Kn=Un(`nl`),qn=Un(`url`,{isLink:!0,toHref(e=zn.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==wt&&e[1].t===en}}),Jn=e=>new N(e);function Yn({groups:e}){let t=e.domain.concat([qt,Yt,Xt,Zt,Qt,$t,nn,an,sn,kt,cn,ln,un,dn,gn,bn,_n,vn]),n=[Jt,en,tn,rn,on,cn,fn,pn,hn,Rt,zt,Mt,Nt,Ft,Pt,It,Lt,Bt,Vt,Ht,R,Ut,Wt,Gt,Kt],r=[qt,Jt,Yt,Zt,Qt,$t,nn,an,sn,Mt,Nt,cn,ln,un,dn,fn,gn,bn,_n,vn],i=Jn(),a=I(i,_n);P(a,r,a),P(a,e.domain,a);let o=Jn(),s=Jn(),c=Jn();P(i,e.domain,o),P(i,e.scheme,s),P(i,e.slashscheme,c),P(o,r,a),P(o,e.domain,o);let l=I(o,Xt);I(a,Xt,l),I(s,Xt,l),I(c,Xt,l);let u=I(a,rn);P(u,r,a),P(u,e.domain,a);let d=Jn();P(l,e.domain,d),P(d,e.domain,d);let f=I(d,rn);P(f,e.domain,d);let p=Jn(Wn);P(f,e.tld,p),P(f,e.utld,p),I(l,wt,p);let m=I(d,sn);I(m,sn,m),P(m,e.domain,d),P(p,e.domain,d),I(p,rn,f),I(p,sn,m);let h=I(o,sn),g=I(o,rn);I(h,sn,h),P(h,e.domain,o),P(g,r,a),P(g,e.domain,o);let _=Jn(qn);P(g,e.tld,_),P(g,e.utld,_),P(_,e.domain,o),P(_,r,a),I(_,rn,g),I(_,sn,h),I(_,Xt,l);let v=I(_,en),y=Jn(qn);P(v,e.numeric,y);let b=Jn(qn),x=Jn();P(b,t,b),P(b,n,x),P(x,t,b),P(x,n,x),I(_,gn,b),I(y,gn,b),I(_,fn,x),I(_,dn,b),I(y,fn,x),I(y,dn,b);let S=I(s,en),C=I(I(I(c,en),gn),gn);P(s,e.domain,o),I(s,rn,g),I(s,sn,h),P(c,e.domain,o),I(c,rn,g),I(c,sn,h),P(S,e.domain,b),I(S,gn,b),I(S,fn,b),P(C,e.domain,b),P(C,t,b),I(C,gn,b);let ee=[[Mt,Nt],[Pt,Ft],[It,Lt],[Rt,zt],[Bt,Vt],[Ht,R],[Ut,Wt],[Gt,Kt]];for(let e=0;e<ee.length;e++){let[r,i]=ee[e],a=I(b,r);I(x,r,a);let o=Jn(qn);P(a,t,o);let s=Jn();P(a,n,s),I(a,i,b),P(o,t,o),P(o,n,s),P(s,t,o),P(s,n,s),I(o,i,b),I(s,i,b)}return I(i,wt,_),I(i,jt,Kn),{start:i,tokens:xn}}function Xn(e,t,n){let r=n.length,i=0,a=[],o=[],s=[];for(;i<r;){let c=e,l=null,u=null,d=0,f=null,p=-1,m=[];for(;i<r&&!(l=c.go(n[i].t));)o.push(n[i++]);for(;i<r&&(u=l||c.go(n[i].t));)if(l=null,c=u,i++,d++,c.accepts())p=0,f=c,m=[];else if(p>=0&&p++,m.push(c),s[i]&&s[i].has(c))break;for(let e=0,t=i-m.length+1;e<m.length;e++,t++)(s[t]||(s[t]=new Set)).add(m[e]);if(p<0)i-=d,i<r&&(o.push(n[i]),i++);else{o.length>0&&(a.push(Zn(Gn,t,o)),o=[]),i-=p,d-=p;let e=f.t,r=n.slice(i-d,i);a.push(Zn(e,t,r))}}return o.length>0&&a.push(Zn(Gn,t,o)),a}function Zn(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}var Qn=typeof console<`u`&&console&&console.warn||(()=>{}),$n=`until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`,z={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function er(){return N.groups={},z.scanner=null,z.parser=null,z.tokenQueue=[],z.pluginQueue=[],z.customSchemes=[],z.initialized=!1,z}function tr(e,t=!1){if(z.initialized&&Qn(`linkifyjs: already initialized - will not register custom scheme "${e}" ${$n}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format.
|
|
26
26
|
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
27
27
|
2. Cannot start or end with "-"
|
|
28
|
-
3. "-" cannot repeat`);z.customSchemes.push([e,t])}function nr(){z.scanner=Pn(z.customSchemes);for(let e=0;e<z.tokenQueue.length;e++)z.tokenQueue[e][1]({scanner:z.scanner});z.parser=Yn(z.scanner.tokens);for(let e=0;e<z.pluginQueue.length;e++)z.pluginQueue[e][1]({scanner:z.scanner,parser:z.parser});return z.initialized=!0,z}function rr(e){return z.initialized||nr(),Xn(z.parser.start,e,Fn(z.scanner.start,e))}rr.scan=Fn;function ir(e,t=null,n=null){if(t&&typeof t==`object`){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new Bn(n),i=rr(e),a=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&a.push(n.toFormattedObject(r))}return a}var ar=`[\0- \xA0 -\u2029 ]`,or=new RegExp(ar),sr=RegExp(`${ar}$`),cr=RegExp(`${ar}+$`),lr=new RegExp(ar,`g`);function ur(e,n,r){let i=e.doc.resolve(n.to);if(!i.nodeBefore?.isText)return;let a=e.doc.textBetween(n.from,n.to,``,``).match(cr)?.[0];if(!a)return;let o=n.to-a.length,s=t(o,n.to,e.doc).filter(e=>e.mark.type===r);if(!s.length)return;let{nodeAfter:c}=i;if(c&&s.some(e=>e.mark.isInSet(c.marks)))return;let l=e.storedMarks;e.removeMark(o,n.to,r),e.setStoredMarks(l),e.selection.empty&&e.selection.from===n.to&&e.removeStoredMark(r)}function dr(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function fr(e){return new D({key:new _(`autolink`),appendTransaction:(n,r,i)=>{let a=n.some(e=>e.docChanged)&&!r.doc.eq(i.doc),o=n.some(e=>e.getMeta(`preventAutolink`));if(!a||o)return;let{tr:s}=i,c=ee(r.doc,[...n]);if(!n.some(ne)){let t=[];c.steps.forEach((e,n)=>{if(!(e instanceof f)||!e.slice.size)return;let r=c.mapping.slice(n+1),i=r.map(e.from,1),a=r.map(e.from+e.slice.size,-1);i<a&&t.push({from:i,to:a})}),t.sort((e,t)=>t.to-e.to),t.forEach(t=>ur(s,t,e.type))}if(se(c).forEach(({newRange:n})=>{let r=ie(i.doc,n,e=>e.isTextblock),a,o;if(r.length>1)a=r[0],o=i.doc.textBetween(a.pos,a.pos+a.node.nodeSize,void 0,` `);else if(r.length){let e=i.doc.textBetween(n.from,n.to,` `,` `);if(!sr.test(e))return;a=r[0],o=i.doc.textBetween(a.pos,n.to,void 0,` `)}if(a&&o){let n=o.split(or).filter(Boolean);if(n.length<=0)return!1;let r=n[n.length-1],c=a.pos+o.lastIndexOf(r);if(!r)return!1;let l=rr(r).map(t=>t.toObject(e.defaultProtocol));if(!dr(l))return!1;l.filter(e=>e.isLink).map(e=>({...e,from:c+e.start+1,to:c+e.end+1})).filter(e=>!i.schema.marks.code||!i.doc.rangeHasMark(e.from,e.to,i.schema.marks.code)).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(n=>{t(n.from,n.to,i.doc).some(t=>t.mark.type===e.type)||s.addMark(n.from,n.to,e.type.create({href:n.href}))})}}),s.steps.length)return s}})}function pr(e){return new D({key:new _(`handleClickLink`),props:{handleClick:(t,n,r)=>{if(r.button!==0||!t.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let t=r.target;if(!t)return!1;let n=e.editor.view.dom;i=t.closest(`a`),i&&!n.contains(i)&&(i=null)}if(!i)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){let n=ae(t.state,e.type.name),r=i.href??n.href,o=i.target??n.target;r&&(window.open(r,o),a=!0)}return a}}})}var mr=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,hr=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function gr(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;--r)n+=1;return n%2==1}function _r(e,t){let n=0,r=0;for(;r<t;){if(e[r]!=="`"||n===0&&gr(e,r)){r+=1;continue}let i=0;for(;r<t&&e[r]==="`";)i+=1,r+=1;n===0?n=i:i===n&&(n=0)}return n>0}function vr(e,t,n){let[,r,i]=t;return(t.index?e[t.index-1]:void 0)===`!`||gr(e,t.index??0)||_r(e,t.index??0)?!1:!!r.trim()&&n(i)}function yr(e){let[t,n,r,,i,a,o]=e,s=i??a??o;return{index:e.index??0,text:t,replaceWith:n,data:{href:r,title:s||null,markdown:!0}}}function br(e,t){return e.index<t.index+t.text.length&&t.index<e.index+e.text.length}function xr(e){return{href:e.data?.href,title:e.data?.title??null}}function Sr(e){let t=fe({find:t=>{let n=mr.exec(t);return!n||!vr(t,n,e.isAllowedHref)?null:yr(n)},type:e.type,getAttributes:xr});return new n({find:t.find,handler:e=>{let n=t.handler(e);return n!==null&&e.state.tr.steps.length&&e.state.tr.setMeta(`preventAutolink`,!0),n}})}function Cr(e){let t=me({find:t=>{let n=[];for(let r of t.matchAll(hr))vr(t,r,e.isAllowedHref)&&n.push(yr(r));let r=(e.findPlainUrls?.call(e,t)??[]).filter(e=>!n.some(t=>br(t,e)));return[...n,...r]},type:e.type,getAttributes:xr});return new v({find:t.find,handler:e=>{let n=t.handler(e);return n!==null&&e.state.tr.steps.length&&e.match.data?.markdown&&e.state.tr.setMeta(`preventAutolink`,!0),n}})}function wr(e){return new D({key:new _(`handlePasteLink`),props:{handlePaste:(t,n,r)=>{let{shouldAutoLink:i}=e,{state:a}=t,{selection:o}=a,{empty:s}=o;if(s)return!1;let c=``;r.content.forEach(e=>{c+=e.textContent});let l=ir(c,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===c);return!c||!l||i!==void 0&&!i(l.value)?!1:e.editor.commands.setMark(e.type,{href:l.href})}}})}function Tr(e,t){let n=[`http`,`https`,`ftp`,`ftps`,`mailto`,`tel`,`callto`,`sms`,`cid`,`xmpp`];return t&&t.forEach(e=>{let t=typeof e==`string`?e:e.scheme;t&&n.push(t)}),!e||e.replace(lr,``).match(RegExp(`^(?:(?:${n.map(e=>e.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`)).join(`|`)}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,`i`))}var Er=ge.create({name:`link`,priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{typeof e==`string`?tr(e):tr(e.scheme,e.optionalSlashes)})},onDestroy(){er()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,markdownLinks:!1,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer nofollow`,class:null},isAllowedUri:(e,t)=>!!Tr(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes(`@`))return!0;let r=(e.includes(`@`)?e.split(`@`).pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute(`href`)}},target:{default:this.options.HTMLAttributes.target??null},rel:{default:this.options.HTMLAttributes.rel??null},class:{default:this.options.HTMLAttributes.class??null},title:{default:null}}},parseHTML(){return[{tag:`a[href]`,getAttrs:e=>{let t=e.getAttribute(`href`);return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!Tr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!Tr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?[`a`,O(this.options.HTMLAttributes,e),0]:[`a`,O(this.options.HTMLAttributes,{...e,href:``}),0]},markdownTokenName:`link`,parseMarkdown:(e,t)=>t.applyMark(`link`,t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{let n=e.attrs?.href??``,r=e.attrs?.title??``,i=t.renderChildren(e);return r?`[${i}](${n} "${r}")`:`[${i}](${n})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:e=>!!Tr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta(`preventAutolink`,!0).run():!1},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!Tr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()}},addInputRules(){return this.options.markdownLinks?[Sr({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!Tr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})})]:[]},addPasteRules(){let e=e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options;ir(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!Tr(e,n),protocols:n,defaultProtocol:r})).forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t};return this.options.markdownLinks?[Cr({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!Tr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:e})]:[me({find:e,type:this.type,getAttributes:e=>({href:e.data?.href})})]},addProseMirrorPlugins(){let e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(fr({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!Tr(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(pr({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick===`whenNotEditable`||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(wr({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),Dr=`listItem`,Or=`textStyle`,kr=/^\s*([-+*])\s$/,Ar=g.create({name:`bulletList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul`}]},renderHTML({HTMLAttributes:e}){return[`ul`,O(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>e.type!==`list`||e.ordered?[]:{type:`bulletList`,content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
28
|
+
3. "-" cannot repeat`);z.customSchemes.push([e,t])}function nr(){z.scanner=Pn(z.customSchemes);for(let e=0;e<z.tokenQueue.length;e++)z.tokenQueue[e][1]({scanner:z.scanner});z.parser=Yn(z.scanner.tokens);for(let e=0;e<z.pluginQueue.length;e++)z.pluginQueue[e][1]({scanner:z.scanner,parser:z.parser});return z.initialized=!0,z}function rr(e){return z.initialized||nr(),Xn(z.parser.start,e,Fn(z.scanner.start,e))}rr.scan=Fn;function ir(e,t=null,n=null){if(t&&typeof t==`object`){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new Bn(n),i=rr(e),a=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&a.push(n.toFormattedObject(r))}return a}var ar=`[\0- \xA0 -\u2029 ]`,or=new RegExp(ar),sr=RegExp(`${ar}$`),cr=RegExp(`${ar}+$`),lr=new RegExp(ar,`g`);function ur(e,n,r){let i=e.doc.resolve(n.to);if(!i.nodeBefore?.isText)return;let a=e.doc.textBetween(n.from,n.to,``,``).match(cr)?.[0];if(!a)return;let o=n.to-a.length,s=t(o,n.to,e.doc).filter(e=>e.mark.type===r);if(!s.length)return;let{nodeAfter:c}=i;if(c&&s.some(e=>e.mark.isInSet(c.marks)))return;let l=e.storedMarks;e.removeMark(o,n.to,r),e.setStoredMarks(l),e.selection.empty&&e.selection.from===n.to&&e.removeStoredMark(r)}function dr(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function fr(e){return new D({key:new _(`autolink`),appendTransaction:(n,r,i)=>{let a=n.some(e=>e.docChanged)&&!r.doc.eq(i.doc),o=n.some(e=>e.getMeta(`preventAutolink`));if(!a||o)return;let{tr:s}=i,c=ee(r.doc,[...n]);if(!n.some(ne)){let t=[];c.steps.forEach((e,n)=>{if(!(e instanceof f)||!e.slice.size)return;let r=c.mapping.slice(n+1),i=r.map(e.from,1),a=r.map(e.from+e.slice.size,-1);i<a&&t.push({from:i,to:a})}),t.sort((e,t)=>t.to-e.to),t.forEach(t=>ur(s,t,e.type))}if(se(c).forEach(({newRange:n})=>{let r=ie(i.doc,n,e=>e.isTextblock),a,o;if(r.length>1)a=r[0],o=i.doc.textBetween(a.pos,a.pos+a.node.nodeSize,void 0,` `);else if(r.length){let e=i.doc.textBetween(n.from,n.to,` `,` `);if(!sr.test(e))return;a=r[0],o=i.doc.textBetween(a.pos,n.to,void 0,` `)}if(a&&o){let n=o.split(or).filter(Boolean);if(n.length<=0)return!1;let r=n[n.length-1],c=a.pos+o.lastIndexOf(r);if(!r)return!1;let l=rr(r).map(t=>t.toObject(e.defaultProtocol));if(!dr(l))return!1;l.filter(e=>e.isLink).map(e=>({...e,from:c+e.start+1,to:c+e.end+1})).filter(e=>!i.schema.marks.code||!i.doc.rangeHasMark(e.from,e.to,i.schema.marks.code)).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(n=>{t(n.from,n.to,i.doc).some(t=>t.mark.type===e.type)||s.addMark(n.from,n.to,e.type.create({href:n.href}))})}}),s.steps.length)return s}})}function pr(e){return new D({key:new _(`handleClickLink`),props:{handleClick:(t,n,r)=>{if(r.button!==0||!t.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let t=r.target;if(!t)return!1;let n=e.editor.view.dom;i=t.closest(`a`),i&&!n.contains(i)&&(i=null)}if(!i)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){let n=ae(t.state,e.type.name),r=i.href??n.href,o=i.target??n.target;r&&(window.open(r,o),a=!0)}return a}}})}var mr=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,hr=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function gr(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;--r)n+=1;return n%2==1}function _r(e,t){let n=0,r=0;for(;r<t;){if(e[r]!=="`"||n===0&&gr(e,r)){r+=1;continue}let i=0;for(;r<t&&e[r]==="`";)i+=1,r+=1;n===0?n=i:i===n&&(n=0)}return n>0}function vr(e,t,n){let[,r,i]=t;return(t.index?e[t.index-1]:void 0)===`!`||gr(e,t.index??0)||_r(e,t.index??0)?!1:!!r.trim()&&n(i)}function yr(e){let[t,n,r,,i,a,o]=e,s=i??a??o;return{index:e.index??0,text:t,replaceWith:n,data:{href:r,title:s||null,markdown:!0}}}function br(e,t){return e.index<t.index+t.text.length&&t.index<e.index+e.text.length}function xr(e){return{href:e.data?.href,title:e.data?.title??null}}function Sr(e){let t=fe({find:t=>{let n=mr.exec(t);return!n||!vr(t,n,e.isAllowedHref)?null:yr(n)},type:e.type,getAttributes:xr});return new n({find:t.find,handler:e=>{let n=t.handler(e);return n!==null&&e.state.tr.steps.length&&e.state.tr.setMeta(`preventAutolink`,!0),n}})}function Cr(e){let t=me({find:t=>{let n=[];for(let r of t.matchAll(hr))vr(t,r,e.isAllowedHref)&&n.push(yr(r));let r=(e.findPlainUrls?.call(e,t)??[]).filter(e=>!n.some(t=>br(t,e)));return[...n,...r]},type:e.type,getAttributes:xr});return new v({find:t.find,handler:e=>{let n=t.handler(e);return n!==null&&e.state.tr.steps.length&&e.match.data?.markdown&&e.state.tr.setMeta(`preventAutolink`,!0),n}})}function wr(e){return new D({key:new _(`handlePasteLink`),props:{handlePaste:(t,n,r)=>{let{shouldAutoLink:i}=e,{state:a}=t,{selection:o}=a,{empty:s}=o;if(s)return!1;let c=``;r.content.forEach(e=>{c+=e.textContent});let l=ir(c,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===c);return!c||!l||i!==void 0&&!i(l.value)?!1:e.editor.commands.setMark(e.type,{href:l.href})}}})}function Tr(e,t){let n=[`http`,`https`,`ftp`,`ftps`,`mailto`,`tel`,`callto`,`sms`,`cid`,`xmpp`];return t&&t.forEach(e=>{let t=typeof e==`string`?e:e.scheme;t&&n.push(t)}),!e||e.replace(lr,``).match(RegExp(`^(?:(?:${n.map(e=>e.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`)).join(`|`)}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,`i`))}var Er=ge.create({name:`link`,priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{typeof e==`string`?tr(e):tr(e.scheme,e.optionalSlashes)})},onDestroy(){er()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,markdownLinks:!1,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer nofollow`,class:null},isAllowedUri:(e,t)=>!!Tr(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes(`@`))return!0;let r=(e.includes(`@`)?e.split(`@`).pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute(`href`)}},target:{default:this.options.HTMLAttributes.target??null},rel:{default:this.options.HTMLAttributes.rel??null},class:{default:this.options.HTMLAttributes.class??null},title:{default:null}}},parseHTML(){return[{tag:`a[href]`,getAttrs:e=>{let t=e.getAttribute(`href`);return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!Tr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!Tr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?[`a`,O(this.options.HTMLAttributes,e),0]:[`a`,O(this.options.HTMLAttributes,{...e,href:``}),0]},markdownTokenName:`link`,parseMarkdown:(e,t)=>t.applyMark(`link`,t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{let n=e.attrs?.href??``,r=e.attrs?.title??``,i=t.renderChildren(e);return r?`[${i}](${n} "${r}")`:`[${i}](${n})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:e=>!!Tr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta(`preventAutolink`,!0).run():!1},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!Tr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()}},addInputRules(){return this.options.markdownLinks?[Sr({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!Tr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})})]:[]},addPasteRules(){let e=e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options;ir(e,{defaultProtocol:r}).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!Tr(e,n),protocols:n,defaultProtocol:r})).forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t};return this.options.markdownLinks?[Cr({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!Tr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:e})]:[me({find:e,type:this.type,getAttributes:e=>({href:e.data?.href})})]},addProseMirrorPlugins(){let e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(fr({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!Tr(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(pr({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick===`whenNotEditable`||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(wr({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),Dr=`listItem`,Or=`textStyle`,kr=/^\s*([-+*])\s$/,Ar=g.create({name:`bulletList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul`}]},renderHTML({HTMLAttributes:e}){return[`ul`,O(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>e.type!==`list`||e.ordered?[]:{type:`bulletList`,content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
29
29
|
`):``,markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Dr,this.editor.getAttributes(Or)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=ue({find:kr,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=ue({find:kr,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Or),editor:this.editor})),[e]}}),jr=(e,t,n)=>{let{selection:r}=e;if(!r.empty)return null;let{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let a=-1;for(let e=i.depth;e>0;--e)if(i.node(e).type.name===t){a=e;break}if(a<0)return null;let o=i.node(a),s=i.index(a);if(s+1>=o.childCount)return null;let c=o.child(s+1);if(!n.includes(c.type.name))return null;let l=e.schema.nodes[t],u=!1;if(c.forEach(e=>{e.type===l&&e.childCount>1&&(u=!0)}),!u)return null;let d=e.doc.resolve(i.after()).nodeAfter;if(!d||!n.includes(d.type.name))return null;let f=[];return d.forEach(e=>{f.push(e)}),f.length===0?null:{listItemDepth:a,nestedList:d,nestedListPos:i.after(),insertPos:i.after(a),items:f}},Mr=(e,t,n,r)=>{let i=jr(e,n,r);if(!i)return!1;let{selection:a}=e,{nestedList:o,nestedListPos:s,insertPos:c,items:l}=i,u=e.tr;u.delete(s,s+o.nodeSize);let d=u.mapping.map(c);return u.insert(d,j.from(l)),u.setSelection(a.map(u.doc,u.mapping)),t&&t(u),!0},Nr=(e,t,n)=>Mr(e.state,e.view.dispatch,t,n),Pr=(e,t)=>_e.create({name:`${e}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){let n=()=>Nr(this.editor,e,t);return{Delete:n,"Mod-Delete":n}}}),Fr=[[1e3,`m`],[900,`cm`],[500,`d`],[400,`cd`],[100,`c`],[90,`xc`],[50,`l`],[40,`xl`],[10,`x`],[9,`ix`],[5,`v`],[4,`iv`],[1,`i`]],Ir=`abcdefghijklmnopqrstuvwxyz`,Lr=String.raw`\d+|[ivxlcdmIVXLCDM]+|${`[a-zA-Z]{1,2}`}`;function Rr(e){let t=e,n=``;for(let[e,r]of Fr)for(;t>=e;)n+=r,t-=e;return n}function zr(e){return Rr(e).toUpperCase()}function Br(e){let t=e.toLowerCase(),n=0,r=0;for(;n<t.length;){let e=!1;for(let[i,a]of Fr)if(t.startsWith(a,n)){r+=i,n+=a.length,e=!0;break}if(!e)return 0}return r}function Vr(e){if(!/^[ivxlcdmIVXLCDM]+$/.test(e))return!1;let t=Br(e);return t<=0?!1:(e===e.toLowerCase()?Rr(t):zr(t))===e}function Hr(e){let t=e.toLowerCase();if(t.length===1)return t.charCodeAt(0)-97+1;if(t.length===2){let e=t.charCodeAt(0)-97,n=t.charCodeAt(1)-97;return(e+1)*26+n+1}return 0}function Ur(e){if(e<=26)return Ir[e-1];let t=Math.floor((e-1)/26)-1,n=(e-1)%26;return t<0?Ir[n]:Ir[t]+Ir[n]}function Wr(e){if(e&&!/^\d+$/.test(e)){if(Vr(e))return e===e.toLowerCase()?`i`:`I`;if(/^[a-z]{1,2}$/.test(e))return`a`;if(/^[A-Z]{1,2}$/.test(e))return`A`}}function Gr(e){if(/^\d+$/.test(e))return parseInt(e,10);let t=Wr(e);if(t===`i`||t===`I`)return Br(e);if(t===`a`||t===`A`){let t=Hr(e);return t>0?t:1}let n=parseInt(e,10);return Number.isNaN(n)?1:n}function Kr(e,t){if(e===`numeric`)return String(t);switch(e){case`a`:return Ur(t);case`A`:return Ur(t).toUpperCase();case`i`:return Rr(t);case`I`:return zr(t);default:return String(t)}}function qr(e){if(e.length===0)return!1;let t=Wr(e[0])??`numeric`,n=Gr(e[0]);if(n<1)return!1;for(let r=0;r<e.length;r++){let i=Kr(t,n+r);if(e[r]!==i)return!1}return!0}function Jr(e){return{type:Wr(e),start:Gr(e)}}function Yr(e){let{type:t,start:n}=Jr(e),r={};return t&&(r.type=t),n!==1&&(r.start=n),r}function Xr(e,t,n=`. `){let r=t+1;if(!e||e===`1`)return`${r}${n}`;switch(e){case`a`:return`${Ur(r)}${n}`;case`A`:return`${Ur(r).toUpperCase()}${n}`;case`i`:return`${Rr(r)}${n}`;case`I`:return`${zr(r)}${n}`;default:return`${r}${n}`}}function Zr(e){return!e[0]||e[0].type===`paragraph`?e:[{type:`paragraph`,content:[]},...e]}function Qr(e){let t=e.content?.[0];return t?.type===`paragraph`&&!t.content?.length}var $r=` `,ei=1,ti=e=>(e?.level??ei)>ei;function ni(e){let t=e.tokens?.[0];return!!(e.text&&e.tokens?.length===1&&t?.type===`list`&&t.ordered&&t.raw===e.text)}function ri(e,t){return t.tokenizeInline?t.parseInline(t.tokenizeInline(e)):t.parseInline([{type:`text`,raw:e,text:e}])}var ii=g.create({name:`listItem`,addOptions(){return{HTMLAttributes:{},bulletListTypeName:`bulletList`,orderedListTypeName:`orderedList`}},content:`paragraph block*`,defining:!0,parseHTML(){return[{tag:`li`}]},renderHTML({HTMLAttributes:e}){return[`li`,O(this.options.HTMLAttributes,e),0]},markdownTokenName:`list_item`,parseMarkdown:(e,t)=>{if(e.type!==`list_item`)return[];let n=t.parseBlockChildren??t.parseChildren,r=[];if(e.tokens&&e.tokens.length>0){if(ni(e))return{type:`listItem`,content:[{type:`paragraph`,content:ri(e.text||``,t)}]};let[i,...a]=e.tokens;if(i.type===`heading`)return{type:`listItem`,content:[{type:`paragraph`,content:t.parseInline(i.tokens??[])},...a.length>0?n(a):[]]};if(e.tokens.some(e=>e.type===`paragraph`))r=n(e.tokens);else if(i.type===`text`&&i.tokens&&i.tokens.length>0){if(r=[{type:`paragraph`,content:t.parseInline(i.tokens)}],e.tokens.length>1){let t=n(e.tokens.slice(1));r.push(...t)}}else r=n(e.tokens)}return r.length===0&&(r=[{type:`paragraph`,content:[]}]),{type:`listItem`,content:Zr(r)}},renderMarkdown:(e,t,n)=>{let r=e=>{if(e.parentType===`bulletList`)return`- `;if(e.parentType===`orderedList`){var t,n;let r=((t=e.meta)==null||(t=t.parentAttrs)==null?void 0:t.start)||1;return Xr((n=e.meta)==null||(n=n.parentAttrs)==null?void 0:n.type,r-1+(e.index||0),`. `)}return`- `},i=ce(e,t,r,n,{alignNestedToPrefix:n?.parentType===`orderedList`});if(!Qr(e)||!ti(n))return i;let a=r(n);return`${a}${$r}${i.slice(a.length)}`},addExtensions(){return[Pr(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),ai=(e,t)=>{let{$from:n}=t.selection,r=A(e,t.schema),i=null,a=n.depth,o=n.pos,s=null;for(;a>0&&s===null;)i=n.node(a),i.type===r?s=a:(--a,--o);return s===null?null:{$pos:t.doc.resolve(o),depth:s}},oi=(e,t)=>{let n=ai(e,t);if(!n)return!1;let[,r]=pe(t,e,n.$pos.pos+4);return r},si=(e,t,n)=>{let{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),a=e.doc.resolve(i).node();return!(!a||!n.includes(a.type.name))},ci=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!Ce(e.state,t)&&si(e.state,t,n)){let{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),i=[];r.node().descendants((e,n)=>{e.type.name===t&&i.push({node:e,pos:n})});let a=i.at(-1);if(!a)return!1;let o=e.state.doc.resolve(r.start()+a.pos+1);return e.chain().command(({tr:e})=>{let t=o.end();return e.delete(n.before(),n.after()).insert(t,n.parent),e.setSelection(l.create(e.doc,t+1)),!0}).command(({state:e,dispatch:t})=>(b(e,t),!0)).run()}if(!Ce(e.state,t)||!xe(e.state))return!1;let{$from:r}=e.state.selection,i=r.depth-1;return r.node(i).type!==e.schema.nodes[t]||r.index(i)!==0?!1:e.chain().liftListItem(t).run()},li=(e,t)=>{let n=oi(e,t),r=ai(e,t);return!r||!n?!1:n>r.depth},ui=(e,t)=>{let n=oi(e,t),r=ai(e,t);return!r||!n?!1:n<r.depth},di=(e,t)=>!Ce(e.state,t)||!le(e.state,t)||!e.state.selection.empty?!1:li(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():ui(t,e.state)?e.commands.command(({state:e,dispatch:t})=>ve(e,t)):e.commands.joinItemForward(),fi=(e,t,n)=>{let{state:r}=e,{selection:i}=r;if(!i.empty)return!1;let{$from:a}=i;if(a.parentOffset!==0||!a.parent.isTextblock||Ce(r,t))return!1;let o=be(a);if(!o||!n.includes(o.type.name))return!1;let s=o.lastChild;if(!s||s.type.name!==t)return!1;let c=a.parent;if(!s.canReplace(s.childCount,s.childCount,j.from(c)))return!1;let u=a.before(),d=a.after(),f=u-2;return e.commands.command(({tr:e,dispatch:t})=>(t&&(e.delete(u,d).insert(f,j.from(c)),e.setSelection(l.create(e.doc,f+1)),e.scrollIntoView()),!0))},pi=_e.create({name:`listKeymap`,addOptions(){return{listTypes:[{itemName:`listItem`,wrapperNames:[`bulletList`,`orderedList`]},{itemName:`taskItem`,wrapperNames:[`taskList`]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&di(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&di(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&ci(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&ci(e,n,r)&&(t=!0)}),t},Tab:({editor:e})=>{for(let{itemName:t,wrapperNames:n}of this.options.listTypes)if(e.state.schema.nodes[t]!==void 0&&fi(e,t,n))return!0;return!1}}}}),mi=RegExp(`^(\\s*)(${Lr})([.)])\\s+(.*)$`),hi=/^\s/,gi={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,blockMath:/^\$\$/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function _i(e){return mi.test(e.trimStart())}function vi(e){let t=e.trimStart();return gi.bulletItem.test(t)||_i(t)||gi.heading.test(t)||gi.thematicBreak.test(t)&&!t.startsWith(`-`)||/^>\s?/.test(t)||gi.codeFence.test(t)||gi.blockMath.test(t)}function yi(e){return Object.values(gi).some(t=>t.test(e))}function bi(e){let t=[],n=[],r=!1;return e.forEach(e=>{r?n.push(e):e.trim()===``||t.length>0&&vi(e)?(r=!0,n.push(e)):t.push(e)}),{paragraphLines:t,blockLines:n}}function xi(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n],a=i.match(mi);if(!a)break;let[,o,s,c,l]=a,u=o.length,d=parseInt(s,10),f=isNaN(d)?Wr(s):void 0,p=isNaN(d)?Gr(s):d,m=[l],h=n+1,g=[i],_=!1;for(;h<e.length;){let t=e[h];if(t.match(mi))break;if(t.trim()===``)g.push(t),m.push(``),_=!0,h+=1;else if(t.match(hi)){let e=t.length-t.trimStart().length,n=u+s.length+1;g.push(t),m.push(t.slice(Math.min(e,n))),h+=1}else{if(_||yi(t))break;g.push(t),m.push(t),h+=1}}t.push({indent:u,number:p,type:f,content:m.join(`
|
|
30
30
|
`).trim(),contentLines:m,raw:g.join(`
|
|
31
31
|
`)}),r=h,n=h}return[t,r]}var Si=RegExp(`^(${Lr})([.)])\\s+(.+)$`);function Ci(e){let t=e.split(`
|
|
@@ -37,7 +37,7 @@ import{Yt as e}from"./CPAF2hi7.js";import{$ as t,A as n,At as r,B as i,Bt as a,C
|
|
|
37
37
|
`),n=t===-1?e:e.slice(0,t);if(!mi.test(n))return[[],0,[]];let r=Ei,i=Di(e,r),a=xi(i);for(;a[1]===i.length&&i.length===r;)r*=2,i=Di(e,r),a=xi(i);return[a[0],a[1],i]}var ki=`listItem`,Ai=`textStyle`,ji=/^(\d+)\.\s$/;function Mi(e){let t=e.match(/list-style-type\s*:\s*([^;]+)/i);if(!t)return null;switch(t[1].trim().toLowerCase()){case`upper-roman`:return`I`;case`lower-roman`:return`i`;case`upper-alpha`:case`upper-latin`:return`A`;case`lower-alpha`:case`lower-latin`:return`a`;default:return null}}var Ni=g.create({name:`orderedList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute(`start`)?parseInt(e.getAttribute(`start`)||``,10):1},type:{default:null,parseHTML:e=>{let t=e.getAttribute(`type`);if(t)return t;let n=e.getAttribute(`style`);if(n){let e=Mi(n);if(e)return e}let r=e.querySelector(`li`);if(r){let e=r.getAttribute(`style`);if(e){let t=Mi(e);if(t)return t}}return null}}}},parseHTML(){return[{tag:`ol`}]},renderHTML({HTMLAttributes:e}){let{start:t,type:n,...r}=e,i=O(this.options.HTMLAttributes,r);return t!==1&&(i.start=t),n&&n!==`1`&&(i.type=n),[`ol`,i,0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>{if(e.type!==`list`||!e.ordered)return[];let n=e.start||1,r=e.typeMarker,i=e.items?Ti(e.items,t):[],a={};return n!==1&&(a.start=n),r&&(a.type=r),Object.keys(a).length>0?{type:`orderedList`,attrs:a,content:i}:{type:`orderedList`,content:i}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
38
38
|
`):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:()=>-1,tokenize:(e,t,n)=>{let[r,i,a]=Oi(e);if(r.length===0)return;let o=wi(r,r[0].indent,n);if(o.length!==0)return{type:`list`,ordered:!0,start:r[0]?.number||1,typeMarker:r[0]?.type,items:o,raw:a.slice(0,i).join(`
|
|
39
39
|
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(ki,this.editor.getAttributes(Ai)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new D({props:{handlePaste:(e,t)=>{if((t.clipboardData?.getData(`text/html`))?.trim())return!1;let n=t.clipboardData?.getData(`text/plain`);if(!n)return!1;let r=Ci(n);if(!r)return!1;try{let t=e.state.schema.nodeFromJSON(r),n=e.state.tr.replaceSelectionWith(t);return e.dispatch(n),!0}catch{return!1}}}})]},addInputRules(){let e=(e,t)=>(!t.attrs.type||t.attrs.type===`1`)&&t.childCount+t.attrs.start===+e[1],t=ue({find:ji,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:e});return(this.options.keepMarks||this.options.keepAttributes)&&(t=ue({find:ji,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Ai)}),joinPredicate:e,editor:this.editor})),[t]}}),Pi=/^\s*(\[([( |x])?\])\s$/,Fi=`position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0`,Ii=(e,t,n)=>{var r;return(n==null||(r=n.checkboxLabel)==null?void 0:r.call(n,e,t))||`Task item checkbox for ${e.textContent||`empty task item`}`},Li=g.create({name:`taskItem`,addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:`taskList`,a11y:void 0}},content(){return this.options.nested?`paragraph block*`:`paragraph+`},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51,contentElement:e=>e.querySelector(`div`)??e}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,O(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>{let n=`- [${e.attrs?.checked?`x`:` `}] `;return ce(e,t,n,void 0,{indentMainContent:!0})},addExtensions(){return this.options.nested?[Pr(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`);o.style.cssText=Fi;let l=e=>{let t=Ii(e,e.attrs.checked,this.options.a11y);s.setAttribute(`aria-label`,t),o.textContent=t};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=k(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[ue({find:Pi,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),Ri=g.create({name:`taskList`,addOptions(){return{itemTypeName:`taskItem`,HTMLAttributes:{}}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return[`ul`,O(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
40
|
-
`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=he(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(t){let r={type:`taskList`,raw:t.raw,items:t.items},i=e.slice(t.raw.length);return i.trim()?[r,...n.blockTokens(i)]:[r]}return n.blockTokens(e)},i=he(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});_e.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(Ar.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(ii.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(pi.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(Ni.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(Li.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(Ri.configure(this.options.taskList)),e}});var zi=` `,Bi=`\xA0`,Vi=g.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,O(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===zi||n[0].text===zi||n[0].raw===Bi||n[0].text===Bi)&&r.length===1&&r[0].type===`text`&&(r[0].text===zi||r[0].text===Bi)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){var i,a;let e=Array.isArray(n==null||(i=n.previousNode)==null?void 0:i.content)?n.previousNode.content:[];return(n==null||(a=n.previousNode)==null?void 0:a.type)===`paragraph`&&e.length===0?zi:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Hi=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Ui=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Wi=ge.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,O(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[fe({find:Hi,type:this.type})]},addPasteRules(){return[me({find:Ui,type:this.type})]}}),Gi=g.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),Ki=ge.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,O(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`<u>${t.renderChildren(e)}</u>`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.toLowerCase().indexOf(`<u>`)},tokenize(e,t,n){if(!/^<u>/i.test(e))return;let r=/\\[\s\S]|`+|<\/u>/gi;r.lastIndex=3;let i=r.exec(e);for(;i;){if(i[0].startsWith("`")){let t=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/.exec(e.slice(i.index));t&&(r.lastIndex=i.index+t[0].length)}else if(!i[0].startsWith(`\\`)){let t=e.slice(3,i.index);return t?{type:`underline`,raw:e.slice(0,r.lastIndex),text:t,tokens:n.inlineTokens(t)}:void 0}i=r.exec(e)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function qi(e={}){return new D({view(t){return new Ji(t,e)}})}var Ji=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.setCursor(null),this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(this.cursorPos!=null&&t.doc!=e.state.doc){if(this.lastDragEvent){let e=this.computeTarget(this.lastDragEvent);e==this.cursorPos?this.updateOverlay():this.setCursor(e)}else this.updateOverlay()}}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(!t||i)return null;let a=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=te(this.editorView.state.doc,a,this.editorView.dragging.slice);e!=null&&(a=e)}return a}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);t!=null&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},B=class e extends y{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):y.near(r)}content(){return T.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new Yi(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!Zi(e)||!Qi(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,i=!1){search:for(;;){if(!i&&e.valid(t))return t;let a=t.pos,o=null;for(let r=t.depth;;r--){let i=t.node(r);if(n>0?t.indexAfter(r)<i.childCount:t.index(r)>0){o=i.child(n>0?t.indexAfter(r):t.index(r)-1);break}if(r==0)return null;a+=n;let s=t.doc.resolve(a);if(e.valid(s))return s}for(;;){let s=n>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!r.isSelectable(o)){t=t.doc.resolve(a+o.nodeSize*n),i=!1;continue search}break}o=s,a+=n;let c=t.doc.resolve(a);if(e.valid(c))return c}return null}}};B.prototype.visible=!1,B.findFrom=B.findGapCursorFrom,y.jsonID(`gapcursor`,B);var Yi=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return B.valid(t)?new B(t):y.near(t)}};function Xi(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function Zi(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0}else for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||Xi(e.type))return!0;if(e.inlineContent)return!1}}return!0}function Qi(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0}else for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||Xi(e.type))return!0;if(e.inlineContent)return!1}}return!0}function $i(){return new D({props:{decorations:ia,createSelectionBetween(e,t,n){return t.pos==n.pos&&B.valid(n)?new B(n):null},handleClick:na,handleKeyDown:ea,handleDOMEvents:{beforeinput:ra}}})}var ea=w({ArrowLeft:ta(`horiz`,-1),ArrowRight:ta(`horiz`,1),ArrowUp:ta(`vert`,-1),ArrowDown:ta(`vert`,1)});function ta(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof l){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=B.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new B(c))),!0):!1}}function na(e,t,n){if(!e||!e.editable)return!1;let i=e.state.doc.resolve(t);if(!B.valid(i))return!1;let a=e.posAtCoords({left:n.clientX,top:n.clientY});return a&&a.inside>-1&&r.isSelectable(e.state.doc.nodeAt(a.inside))?!1:(e.dispatch(e.state.tr.setSelection(new B(i))),!0)}function ra(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof B))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=j.empty;for(let e=r.length-1;e>=0;e--)i=j.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new T(i,0,0));return a.setSelection(l.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function ia(e){if(!(e.selection instanceof B))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,s.create(e.doc,[c.widget(e.selection.head,t,{key:`gapcursor`})])}_e.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new D({key:new _(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var aa=_e.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[qi(this.options)]}});_e.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new D({key:new _(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return s.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let l=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(l+=1,this.options.mode===`deepest`&&o-l>0||this.options.mode===`shallowest`&&l>1)return this.options.mode===`deepest`;a.push(c.node(t,t+e.nodeSize,{class:this.options.className}))}),s.create(e,a)}}})]}});var oa=_e.create({name:`gapCursor`,addProseMirrorPlugins(){return[$i()]},extendNodeSchema(e){let t={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:d(C(e,`allowGapCursor`,t))??null}}}),sa=`placeholder`,ca=new _(`tiptap__placeholder`);function la(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:a,isEmptyDoc:o,hasAnchor:s,classes:{emptyNode:l,emptyEditor:u}}=e,d=[l];return o&&d.push(u),c.node(i,i+a.nodeSize,{class:d.join(` `),[r]:typeof n==`function`?n({editor:t,node:a,pos:i,hasAnchor:s}):n})}function ua(e,t){return typeof e==`function`?e(t):e}function da({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:a,to:o}){let{anchor:s}=i,c=[],l=e.isEmpty;return r.nodesBetween(a,o,(r,i)=>{let a=s>=i&&s<=i+r.nodeSize,o=!r.isLeaf&&de(r);return r.type.isTextblock&&(a||!t.showOnlyCurrent)&&o&&c.push(la({editor:e,isEmptyDoc:l,dataAttribute:n,hasAnchor:a,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:ua(t.emptyNodeClass,{editor:e,node:r,pos:i,hasAnchor:a})},node:r,pos:i})),t.includeChildren}),c}function fa({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!e.isEditable&&t.showOnlyWhenEditable)return null;let{anchor:a}=i,o=[],c=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),s=i.depth>0?i.node(1):i.nodeAfter,l=i.depth>0?i.before(1):a;if(s&&s.type.isTextblock&&de(s)){let r=a>=l&&a<=l+s.nodeSize;o.push(la({editor:e,isEmptyDoc:c,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:ua(t.emptyNodeClass,{editor:e,node:s,pos:l,hasAnchor:r})},node:s,pos:l}))}}else o.push(...da({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return s.create(r,o)}function pa(e,t){let n=e.resolve(t);if(n.depth===0){let e=n.nodeAfter??n.nodeBefore;if(!e)return{from:t,to:t};let r=n.nodeAfter?t:t-e.nodeSize;return{from:r,to:r+e.nodeSize}}let r=n.before(1);return{from:r,to:r+n.node(1).nodeSize}}function ma(e,t){return{from:Math.max(0,t.from-1),to:Math.min(e.content.size,t.to-1)}}function ha(e,t,n){let r=[];return e.forEach((e,i)=>{let a=i,o=a+e.nodeSize,s=a+1,c=o+1;s<n&&c>t&&r.push({from:a,to:o})}),r}function ga(e){if(e.length===0)return[];let t=[...e].sort((e,t)=>e.from-t.from),n=[{...t[0]}];for(let e=1;e<t.length;e+=1){let r=n[n.length-1],i=t[e];i.from<=r.to?r.to=Math.max(r.to,i.to):n.push({...i})}return n}function _a(e,t){let n=ha(e,t.from,t.to);return n.push(ma(e,pa(e,t.from))),t.to>t.from?n.push(ma(e,pa(e,Math.min(t.to,e.content.size+1)-1))):t.from<e.content.size+1&&n.push(ma(e,pa(e,Math.min(t.from+1,e.content.size)))),n}function va(e,t,n){let r=[];if(e.docChanged){let t=se(e);for(let e of t)r.push(..._a(n.doc,e.newRange))}return e.selectionSet&&(r.push(ma(n.doc,pa(n.doc,e.mapping.map(t.selection.anchor)))),r.push(ma(n.doc,pa(n.doc,n.selection.anchor)))),ga(r)}function ya(e,t,n){let r=Math.max(0,Math.min(e,n.content.size));return{from:r,to:Math.max(r,Math.min(t,n.content.size))}}function ba({decorations:e,ranges:t,editor:n,options:r,dataAttribute:i,doc:a,selection:o}){let s=e;for(let e of t){let{from:t,to:c}=ya(e.from,e.to,a),l=s.find(t,c).filter(e=>e.from>=t&&e.to<=c);l.length&&(s=s.remove(l));let u=da({editor:n,options:r,dataAttribute:i,doc:a,selection:o,from:t,to:c});u.length&&(s=s.add(a,u))}return s}function xa({editor:e,options:t,dataAttribute:n}){return{init(r,i){return fa({editor:e,options:t,dataAttribute:n,doc:i.doc,selection:i.selection})??s.empty},apply(r,i,a,o){return!r.docChanged&&!r.selectionSet?i:ba({decorations:i.map(r.mapping,r.doc),ranges:va(r,a,o),editor:e,options:t,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function Sa(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}function Ca({editor:e,options:t}){let n=t.dataAttribute?`data-${Sa(t.dataAttribute)}`:`data-${sa}`,r=t.showOnlyCurrent&&!t.includeChildren;return new D({key:ca,...r?{}:{state:xa({editor:e,options:t,dataAttribute:n})},props:{decorations:r?({doc:r,selection:i})=>fa({editor:e,options:t,dataAttribute:n,doc:r,selection:i}):n=>t.showOnlyWhenEditable&&!e.isEditable?s.empty:ca.getState(n)??s.empty}})}var wa=_e.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:sa,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[Ca({editor:this.editor,options:this.options})]}});function Ta(e,t){return!e.selection.empty&&!ye(e.selection)&&t.isEditable}function Ea(e,t){return Ta(e,t)&&!t.isFocused&&!t.view.dragging}function Da(){var e;(e=window.getSelection())==null||e.removeAllRanges()}function Oa(e){e.focus()}_e.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new D({key:new _(`selection`),props:{decorations(n){return Ea(n,e)?s.create(n.doc,[c.inline(n.selection.from,n.selection.to,{class:t.className})]):null},handleDOMEvents:{blur(t){return Ta(t.state,e)&&Da(),!1},focus(t){return Ta(t.state,e)&&requestAnimationFrame(()=>{!e.isDestroyed&&t.hasFocus()&&Oa(t)}),!1}}}})]}});function ka({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var Aa=_e.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new _(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new D({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!ka({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!ka({node:r,types:n})}}})]}}),ja=_e.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>Te(e,t),redo:()=>({state:e,dispatch:t})=>o(e,t)}},addProseMirrorPlugins(){return[Ee(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Ma=_e.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(He.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(Le.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(Ar.configure(this.options.bulletList)),this.options.code!==!1&&e.push(Ke.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(Xe.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(Ze.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(aa.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(oa.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(Qe.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push($e.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(ja.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(et.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(at.configure(this.options.italic)),this.options.listItem!==!1&&e.push(ii.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(pi.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(Er.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(Ni.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(Vi.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(Wi.configure(this.options.strike)),this.options.text!==!1&&e.push(Gi.configure(this.options.text)),this.options.underline!==!1&&e.push(Ki.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(Aa.configure(this.options?.trailingNode)),e}}),Na,Pa;if(typeof WeakMap<`u`){let e=new WeakMap;Na=t=>e.get(t),Pa=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;Na=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},Pa=(n,r)=>(t==10&&(t=0),e[t++]=n,e[t++]=r)}var V=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,a=r+1,o=i+1;for(let e=1;a<this.width&&this.map[t+e]==n;e++)a++;for(let e=1;o<this.height&&this.map[t+this.width*e]==n;e++)o++;return{left:r,top:i,right:a,bottom:o}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:a,bottom:o}=this.findCell(e);return t==`horiz`?(n<0?r==0:i==this.width)?null:this.map[a*this.width+(n<0?r-1:i)]:(n<0?a==0:o==this.height)?null:this.map[r+this.width*(n<0?a-1:o)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:a}=this.findCell(e),{left:o,right:s,top:c,bottom:l}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(i,c),right:Math.max(r,s),bottom:Math.max(a,l)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let a=r*this.width+i,o=this.map[a];n[o]||(n[o]=!0,!(i==e.left&&i&&this.map[a-1]==o||r==e.top&&r&&this.map[a-this.width]==o)&&t.push(o))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let a=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?a-1:this.map[n]}i=a}}static get(e){return Na(e)||Pa(e,Fa(e))}};function Fa(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=Ia(e),n=e.childCount,r=[],i=0,a=null,o=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let s=0,c=0;s<n;s++){let l=e.child(s);c++;for(let e=0;;e++){for(;i<r.length&&r[i]!=0;)i++;if(e==l.childCount)break;let u=l.child(e),{colspan:d,rowspan:f,colwidth:p}=u.attrs;for(let e=0;e<f;e++){if(e+s>=n){(a||=[]).push({type:`overlong_rowspan`,pos:c,n:f-e});break}let l=i+e*t;for(let e=0;e<d;e++){r[l+e]==0?r[l+e]=c:(a||=[]).push({type:`collision`,row:s,pos:c,n:d-e});let n=p&&p[e];if(n){let r=(l+e)%t*2,i=o[r];i==null||i!=n&&o[r+1]==1?(o[r]=n,o[r+1]=1):i==n&&o[r+1]++}}}i+=d,c+=u.nodeSize}let u=(s+1)*t,d=0;for(;i<u;)r[i++]==0&&d++;d&&(a||=[]).push({type:`missing`,row:s,n:d}),c++}(t===0||n===0)&&(a||=[]).push({type:`zero_sized`});let s=new V(t,n,r,a),c=!1;for(let e=0;!c&&e<o.length;e+=2)o[e]!=null&&o[e+1]<n&&(c=!0);return c&&La(s,o,e),s}function Ia(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),a=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(a+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);a+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function La(e,t,n){e.problems||=[];let r={};for(let i=0;i<e.map.length;i++){let a=e.map[i];if(r[a])continue;r[a]=!0;let o=n.nodeAt(a);if(!o)throw RangeError(`No cell with offset ${a} found`);let s=null,c=o.attrs;for(let n=0;n<c.colspan;n++){let r=t[(i+n)%e.width*2];r==null||c.colwidth&&c.colwidth[n]==r||((s||=Ra(c))[n]=r)}s&&e.problems.unshift({type:`colwidth mismatch`,pos:a,colwidth:s})}}function Ra(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function H(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}var za=new _(`selectingCells`);function Ba(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function Va(e){for(let t=e.depth;t>0;t--){let n=e.node(t).type.spec.tableRole;if(n===`cell`||n===`header_cell`)return e.node(t)}return null}function Ha(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function Ua(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let n=Ba(t.$head)||Wa(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function Wa(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n-t.nodeSize)}}function Ga(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function Ka(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function qa(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function Ja(e,t,n){let r=e.node(-1),i=V.get(r),a=e.start(-1),o=i.nextCell(e.pos-a,t,n);return o==null?null:e.node(0).resolve(a+o)}function Ya(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function Xa(e,t,n=1){let r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}function Za(e,t,n){let r=H(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0}var U=class e extends y{constructor(e,t=e){let n=e.node(-1),r=V.get(n),i=e.start(-1),a=r.rectBetween(e.pos-i,t.pos-i),o=e.node(0),s=r.cellsInRect(a).filter(e=>e!=t.pos-i);s.unshift(t.pos-i);let c=s.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new S(o.resolve(r),o.resolve(r+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(Ga(r)&&Ga(i)&&qa(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return l.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=V.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},a=[];for(let n=r.top;n<r.bottom;n++){let o=[];for(let a=n*t.width+r.left,s=r.left;s<r.right;s++,a++){let n=t.map[a];if(i[n])continue;i[n]=!0;let s=t.findCell(n),c=e.nodeAt(n);if(!c)throw RangeError(`No cell with offset ${n} found`);let l=r.left-s.left,u=s.right-r.right;if(l>0||u>0){let e=c.attrs;if(l>0&&(e=Ya(e,0,l)),u>0&&(e=Ya(e,e.colspan-u,u)),s.left<r.left){if(c=c.type.createAndFill(e),!c)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else c=c.type.create(e,c.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...c.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};c=s.top<r.top?c.type.createAndFill(e):c.type.create(e,c.content)}o.push(c)}a.push(e.child(n).copy(j.from(o)))}let o=this.isColSelection()&&this.isRowSelection()?e:a;return new T(j.from(o),1,1)}replace(e,t=T.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n);e.replace(s.map(a.pos),s.map(o.pos),i?T.empty:t)}let i=y.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new T(j.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=V.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=V.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.top<=s.top?(o.top>0&&(t=c.resolve(a+i.map[o.left])),s.bottom<i.height&&(n=c.resolve(a+i.map[i.width*(i.height-1)+s.right-1]))):(s.top>0&&(n=c.resolve(a+i.map[s.left])),o.bottom<i.height&&(t=c.resolve(a+i.map[i.width*(i.height-1)+o.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=V.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;let a=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,o)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=V.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.left<=s.left?(o.left>0&&(t=c.resolve(a+i.map[o.top*i.width])),s.right<i.width&&(n=c.resolve(a+i.map[i.width*(s.top+1)-1]))):(s.left>0&&(n=c.resolve(a+i.map[s.top*i.width])),o.right<i.width&&(t=c.resolve(a+i.map[i.width*(o.top+1)-1]))),new e(t,n)}toJSON(){return{type:`cell`,anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new Qa(this.$anchorCell.pos,this.$headCell.pos)}};U.prototype.visible=!1,y.jsonID(`cell`,U);var Qa=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole==`row`&&n.parent.type.spec.tableRole==`row`&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&qa(t,n)?new U(t,n):y.near(n,1)}};function $a(e){if(!(e.selection instanceof U))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(c.node(n,n+e.nodeSize,{class:`selectedCell`}))}),s.create(e.doc,t)}function eo({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}function to({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){let r=e.node(t);if(r.type.spec.tableRole===`cell`||r.type.spec.tableRole===`header_cell`){n=r;break}}for(let e=t.depth;e>0;e--){let n=t.node(e);if(n.type.spec.tableRole===`cell`||n.type.spec.tableRole===`header_cell`){r=n;break}}return n!==r&&t.parentOffset===0}function no(e,t,n){let i=(t||e).selection,a=(t||e).doc,o,s;if(i instanceof r&&(s=i.node.type.spec.tableRole)){if(s==`cell`||s==`header_cell`)o=U.create(a,i.from);else if(s==`row`){let e=a.resolve(i.from+1);o=U.rowSelection(e,e)}else if(!n){let e=V.get(i.node),t=i.from+1,n=t+e.map[e.width*e.height-1];o=U.create(a,t+1,n)}}else i instanceof l&&eo(i)?o=l.create(a,i.from):i instanceof l&&to(i)&&(o=l.create(a,i.$from.start(),i.$from.end()));return o&&(t||=e.tr).setSelection(o),t}var ro=new _(`fix-tables`);function io(e,t,n,r){let i=e.childCount,a=t.childCount;outer:for(let o=0,s=0;o<a;o++){let a=t.child(o);for(let t=s,r=Math.min(i,o+3);t<r;t++)if(e.child(t)==a){s=t+1,n+=a.nodeSize;continue outer}r(a,n),s<i&&e.child(s).sameMarkup(a)?io(e.child(s),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function ao(e,t){let n,r=(t,r)=>{t.type.spec.tableRole==`table`&&(n=oo(e,t,r,n))};return t?t.doc!=e.doc&&io(t.doc,e.doc,0,r):e.doc.descendants(r),n}function oo(e,t,n,r){let i=V.get(t);if(!i.problems)return r;r||=e.tr;let a=[];for(let e=0;e<i.height;e++)a.push(0);for(let e=0;e<i.problems.length;e++){let o=i.problems[e];if(o.type==`collision`){let e=t.nodeAt(o.pos);if(!e)continue;let i=e.attrs;for(let e=0;e<i.rowspan;e++)a[o.row+e]+=o.n;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,Ya(i,i.colspan-o.n,o.n))}else if(o.type==`missing`)a[o.row]+=o.n;else if(o.type==`overlong_rowspan`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-o.n})}else if(o.type==`colwidth mismatch`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,colwidth:o.colwidth})}else if(o.type==`zero_sized`){let e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}let o,s;for(let e=0;e<a.length;e++)a[e]&&(o??=e,s=e);for(let c=0,l=n+1;c<i.height;c++){let n=t.child(c),i=l+n.nodeSize,u=a[c];if(u>0){let t=`cell`;n.firstChild&&(t=n.firstChild.type.spec.tableRole);let a=[];for(let n=0;n<u;n++){let n=H(e.schema)[t].createAndFill();n&&a.push(n)}let d=(c==0||o==c-1)&&s==c?l+1:i-1;r.insert(r.mapping.map(d),a)}l=i}return r.setMeta(ro,{fixTables:!0})}function so(e){let t=e.selection,n=Ua(e),r=n.node(-1),i=n.start(-1),a=V.get(r);return{...t instanceof U?a.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):a.findCell(n.pos-i),tableStart:i,map:a,table:r}}function co(e,{map:t,tableStart:n,table:r},i){let a=i>0?-1:0;Za(t,r,i+a)&&(a=i==0||i==t.width?null:0);for(let o=0;o<t.height;o++){let s=o*t.width+i;if(i>0&&i<t.width&&t.map[s-1]==t.map[s]){let a=t.map[s],c=r.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,Xa(c.attrs,i-t.colCount(a))),o+=c.attrs.rowspan-1}else{let c=a==null?H(r.type.schema).cell:r.nodeAt(t.map[s+a]).type,l=t.positionAt(o,i,r);e.insert(e.mapping.map(n+l),c.createAndFill())}}return e}function lo(e,t){if(!Ha(e))return!1;if(t){let n=so(e);t(co(e.tr,n,n.left))}return!0}function uo(e,t){if(!Ha(e))return!1;if(t){let n=so(e);t(co(e.tr,n,n.right))}return!0}function fo(e,{map:t,table:n,tableStart:r},i){let a=e.mapping.maps.length;for(let o=0;o<t.height;){let s=o*t.width+i,c=t.map[s],l=n.nodeAt(c),u=l.attrs;if(i>0&&t.map[s-1]==c||i<t.width-1&&t.map[s+1]==c)e.setNodeMarkup(e.mapping.slice(a).map(r+c),null,Ya(u,i-t.colCount(c)));else{let t=e.mapping.slice(a).map(r+c);e.delete(t,t+l.nodeSize)}o+=u.rowspan}}function po(e,t){if(!Ha(e))return!1;if(t){let n=so(e),r=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let e=n.right-1;fo(r,n,e),e!=n.left;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=V.get(e)}t(r)}return!0}function mo(e,t,n){let r=H(t.type.schema).header_cell;for(let i=0;i<e.width;i++)if(t.nodeAt(e.map[i+n*e.width])?.type!=r)return!1;return!0}function ho(e,{map:t,tableStart:n,table:r},i){let a=n;for(let e=0;e<i;e++)a+=r.child(e).nodeSize;let o=[],s=i>0?-1:0;mo(t,r,i+s)&&(s=i==0||i==t.height?null:0);for(let a=0,c=t.width*i;a<t.width;a++,c++)if(i>0&&i<t.height&&t.map[c]==t.map[c-t.width]){let i=t.map[c],o=r.nodeAt(i).attrs;e.setNodeMarkup(n+i,null,{...o,rowspan:o.rowspan+1}),a+=o.colspan-1}else{let e=(s==null?H(r.type.schema).cell:r.nodeAt(t.map[c+s*t.width])?.type)?.createAndFill();e&&o.push(e)}return e.insert(a,H(r.type.schema).row.create(null,o)),e}function go(e,t){if(!Ha(e))return!1;if(t){let n=so(e);t(ho(e.tr,n,n.top))}return!0}function _o(e,t){if(!Ha(e))return!1;if(t){let n=so(e);t(ho(e.tr,n,n.bottom))}return!0}function vo(e,{map:t,table:n,tableStart:r},i){let a=0;for(let e=0;e<i;e++)a+=n.child(e).nodeSize;let o=a+n.child(i).nodeSize,s=e.mapping.maps.length;e.delete(a+r,o+r);let c=new Set;for(let a=0,o=i*t.width;a<t.width;a++,o++){let l=t.map[o];if(!c.has(l)){if(c.add(l),i>0&&l==t.map[o-t.width]){let t=n.nodeAt(l).attrs;e.setNodeMarkup(e.mapping.slice(s).map(l+r),null,{...t,rowspan:t.rowspan-1}),a+=t.colspan-1}else if(i<t.height&&l==t.map[o+t.width]){let o=n.nodeAt(l),c=o.attrs,u=o.type.create({...c,rowspan:o.attrs.rowspan-1},o.content),d=t.positionAt(i+1,a,n);e.insert(e.mapping.slice(s).map(r+d),u),a+=c.colspan-1}}}}function yo(e,t){if(!Ha(e))return!1;if(t){let n=so(e),r=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;vo(r,n,e),e!=n.top;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=V.get(n.table)}t(r)}return!0}function bo(e){let t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function xo({width:e,height:t,map:n},r){let i=r.top*e+r.left,a=i,o=(r.bottom-1)*e+r.left,s=i+(r.right-r.left-1);for(let t=r.top;t<r.bottom;t++){if(r.left>0&&n[a]==n[a-1]||r.right<e&&n[s]==n[s+1])return!0;a+=e,s+=e}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[i]==n[i-e]||r.bottom<t&&n[o]==n[o+e])return!0;i++,o++}return!1}function So(e,t){let n=e.selection;if(!(n instanceof U)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=so(e),{map:i}=r;if(xo(i,r))return!1;if(t){let n=e.tr,a={},o=j.empty,s,c;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){let l=i.map[e*i.width+t],u=r.table.nodeAt(l);if(!a[l]&&u){if(a[l]=!0,s==null)s=l,c=u;else{bo(u)||(o=o.append(u.content));let e=n.mapping.map(l+r.tableStart);n.delete(e,e+u.nodeSize)}}}if(s==null||c==null)return!0;if(n.setNodeMarkup(s+r.tableStart,null,{...Xa(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),o.size>0){let e=s+1+c.content.size,t=bo(c)?s+1:e;n.replaceWith(t+r.tableStart,e+r.tableStart,o)}n.setSelection(new U(n.doc.resolve(s+r.tableStart))),t(n)}return!0}function Co(e,t){let n=H(e.schema);return wo(({node:e})=>n[e.type.spec.tableRole])(e,t)}function wo(e){return(t,n)=>{let r=t.selection,i,a;if(r instanceof U){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,a=r.$anchorCell.pos}else{if(i=Va(r.$from),!i)return!1;a=Ba(r.$from)?.pos}if(i==null||a==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let o=i.attrs,s=[],c=o.colwidth;o.rowspan>1&&(o={...o,rowspan:1}),o.colspan>1&&(o={...o,colspan:1});let l=so(t),u=t.tr;for(let e=0;e<l.right-l.left;e++)s.push(c?{...o,colwidth:c&&c[e]?[c[e]]:null}:o);let d;for(let t=l.top;t<l.bottom;t++){let n=l.map.positionAt(t,l.left,l.table);t==l.top&&(n+=i.nodeSize);for(let r=l.left,a=0;r<l.right;r++,a++)(r!=l.left||t!=l.top)&&u.insert(d=u.mapping.map(n+l.tableStart,1),e({node:i,row:t,col:r}).createAndFill(s[a]))}u.setNodeMarkup(a,e({node:i,row:l.top,col:l.left}),s[0]),r instanceof U&&u.setSelection(new U(u.doc.resolve(r.$anchorCell.pos),d?u.doc.resolve(d):void 0)),n(u)}return!0}}function To(e,t){return function(n,r){if(!Ha(n))return!1;let i=Ua(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){let a=n.tr;n.selection instanceof U?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&a.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):a.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(a)}return!0}}function Eo(e){return function(t,n){if(!Ha(t))return!1;if(n){let r=H(t.schema),i=so(t),a=t.tr,o=i.map.cellsInRect(e==`column`?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e==`row`?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),s=o.map(e=>i.table.nodeAt(e));for(let e=0;e<o.length;e++)s[e].type==r.header_cell&&a.setNodeMarkup(i.tableStart+o[e],r.cell,s[e].attrs);if(a.steps.length===0)for(let e=0;e<o.length;e++)a.setNodeMarkup(i.tableStart+o[e],r.header_cell,s[e].attrs);n(a)}return!0}}function Do(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:e==`row`?t.map.width:1,bottom:e==`column`?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function Oo(e,t){return t||={useDeprecatedLogic:!1},t.useDeprecatedLogic?Eo(e):function(t,n){if(!Ha(t))return!1;if(n){let r=H(t.schema),i=so(t),a=t.tr,o=Do(`row`,i,r),s=Do(`column`,i,r),c=(e===`column`?o:e===`row`&&s)?1:0,l=e==`column`?{left:0,top:c,right:1,bottom:i.map.height}:e==`row`?{left:c,top:0,right:i.map.width,bottom:1}:i,u=e==`column`?s?r.cell:r.header_cell:e==`row`?o?r.cell:r.header_cell:r.cell;i.map.cellsInRect(l).forEach(e=>{let t=e+i.tableStart,n=a.doc.nodeAt(t);n&&a.setNodeMarkup(t,u,n.attrs)}),n(a)}return!0}}Oo(`row`,{useDeprecatedLogic:!0}),Oo(`column`,{useDeprecatedLogic:!0});var ko=Oo(`cell`,{useDeprecatedLogic:!0});function Ao(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){let r=e.node(-1).child(t),i=r.lastChild;if(i)return n-1-i.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){let e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}function jo(e){return function(t,n){if(!Ha(t))return!1;let r=Ao(Ua(t),e);if(r==null)return!1;if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(l.between(e,Ka(e))).scrollIntoView())}return!0}}function Mo(e,t){let n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole==`table`)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function No(e,t){let n=e.selection;if(!(n instanceof U))return!1;if(t){let r=e.tr,i=H(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new T(i,0,0))}),r.docChanged&&t(r)}return!0}function Po(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:r}=e;for(;t.childCount==1&&(n>0&&r>0||t.child(0).type.spec.tableRole==`table`);)n--,r--,t=t.child(0).content;let i=t.child(0),a=i.type.spec.tableRole,o=i.type.schema,s=[];if(a==`row`)for(let e=0;e<t.childCount;e++){let i=t.child(e).content,a=e?0:Math.max(0,n-1),c=e<t.childCount-1?0:Math.max(0,r-1);(a||c)&&(i=Io(H(o).row,new T(i,a,c)).content),s.push(i)}else if(a==`cell`||a==`header_cell`)s.push(n||r?Io(H(o).row,new T(t,n,r)).content:t);else return null;return Fo(o,s)}function Fo(e,t){let n=[];for(let e=0;e<t.length;e++){let r=t[e];for(let t=r.childCount-1;t>=0;t--){let{rowspan:i,colspan:a}=r.child(t).attrs;for(let t=e;t<e+i;t++)n[t]=(n[t]||0)+a}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(j.empty),n[i]<r){let a=H(e).cell.createAndFill(),o=[];for(let e=n[i];e<r;e++)o.push(a);t[i]=t[i].append(j.from(o))}return{height:t.length,width:r,rows:t}}function Io(e,t){let n=e.createAndFill();return new h(n).replace(0,n.content.size,t).doc}function Lo({width:e,height:t,rows:n},r,i){if(e!=r){let t=[],i=[];for(let e=0;e<n.length;e++){let a=n[e],o=[];for(let n=t[e]||0,i=0;n<r;i++){let s=a.child(i%a.childCount);n+s.attrs.colspan>r&&(s=s.type.createChecked(Ya(s.attrs,s.attrs.colspan,n+s.attrs.colspan-r),s.content)),o.push(s),n+=s.attrs.colspan;for(let n=1;n<s.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+s.attrs.colspan}i.push(j.from(o))}n=i,e=r}if(t!=i){let e=[];for(let r=0,a=0;r<i;r++,a++){let o=[],s=n[a%t];for(let e=0;e<s.childCount;e++){let t=s.child(e);r+t.attrs.rowspan>i&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,i-t.attrs.rowspan)},t.content)),o.push(t)}e.push(j.from(o))}n=e,t=i}return{width:e,height:t,rows:n}}function Ro(e,t,n,r,i,a,o){let s=e.doc.type.schema,c=H(s),l,u;if(i>t.width)for(let a=0,s=0;a<t.height;a++){let d=n.child(a);s+=d.nodeSize;let f=[],p;p=d.lastChild==null||d.lastChild.type==c.cell?l||=c.cell.createAndFill():u||=c.header_cell.createAndFill();for(let e=t.width;e<i;e++)f.push(p);e.insert(e.mapping.slice(o).map(s-1+r),f)}if(a>t.height){let s=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,i);e++){let i=e>=t.width?!1:n.nodeAt(t.map[r+e]).type==c.header_cell;s.push(i?u||=c.header_cell.createAndFill():l||=c.cell.createAndFill())}let d=c.row.create(null,j.from(s)),f=[];for(let e=t.height;e<a;e++)f.push(d);e.insert(e.mapping.slice(o).map(r+n.nodeSize-2),f)}return!!(l||u)}function zo(e,t,n,r,i,a,o,s){if(o==0||o==t.height)return!1;let c=!1;for(let l=i;l<a;l++){let i=o*t.width+l,a=t.map[i];if(t.map[i-t.width]==a){c=!0;let i=n.nodeAt(a),{top:u,left:d}=t.findCell(a);e.setNodeMarkup(e.mapping.slice(s).map(a+r),null,{...i.attrs,rowspan:o-u}),e.insert(e.mapping.slice(s).map(t.positionAt(o,d,n)),i.type.createAndFill({...i.attrs,rowspan:u+i.attrs.rowspan-o})),l+=i.attrs.colspan-1}}return c}function Bo(e,t,n,r,i,a,o,s){if(o==0||o==t.width)return!1;let c=!1;for(let l=i;l<a;l++){let i=l*t.width+o,a=t.map[i];if(t.map[i-1]==a){c=!0;let i=n.nodeAt(a),u=t.colCount(a),d=e.mapping.slice(s).map(a+r);e.setNodeMarkup(d,null,Ya(i.attrs,o-u,i.attrs.colspan-(o-u))),e.insert(d+i.nodeSize,i.type.createAndFill(Ya(i.attrs,0,o-u))),l+=i.attrs.rowspan-1}}return c}function Vo(e,t,n,r,i){let a=n?e.doc.nodeAt(n-1):e.doc;if(!a)throw Error(`No table found`);let o=V.get(a),{top:s,left:c}=r,l=c+i.width,u=s+i.height,d=e.tr,f=0;function p(){if(a=n?d.doc.nodeAt(n-1):d.doc,!a)throw Error(`No table found`);o=V.get(a),f=d.mapping.maps.length}Ro(d,o,a,n,l,u,f)&&p(),zo(d,o,a,n,c,l,s,f)&&p(),zo(d,o,a,n,c,l,u,f)&&p(),Bo(d,o,a,n,s,u,c,f)&&p(),Bo(d,o,a,n,s,u,l,f)&&p();for(let e=s;e<u;e++){let t=o.positionAt(e,c,a),r=o.positionAt(e,l,a);d.replace(d.mapping.slice(f).map(t+n),d.mapping.slice(f).map(r+n),new T(i.rows[e-s],0,0))}p(),d.setSelection(new U(d.doc.resolve(n+o.positionAt(s,c,a)),d.doc.resolve(n+o.positionAt(u-1,l-1,a)))),t(d)}var Ho=w({ArrowLeft:Wo(`horiz`,-1),ArrowRight:Wo(`horiz`,1),ArrowUp:Wo(`vert`,-1),ArrowDown:Wo(`vert`,1),"Shift-ArrowLeft":Go(`horiz`,-1),"Shift-ArrowRight":Go(`horiz`,1),"Shift-ArrowUp":Go(`vert`,-1),"Shift-ArrowDown":Go(`vert`,1),Backspace:No,"Mod-Backspace":No,Delete:No,"Mod-Delete":No});function Uo(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function Wo(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection;if(a instanceof U)return Uo(n,r,y.near(a.$headCell,t));if(e!=`horiz`&&!a.empty)return!1;let o=Yo(i,e,t);if(o==null)return!1;if(e==`horiz`)return Uo(n,r,y.near(n.doc.resolve(a.head+t),t));{let i=n.doc.resolve(o),a=Ja(i,e,t),s;return s=a?y.near(a,1):t<0?y.near(n.doc.resolve(i.before(-1)),-1):y.near(n.doc.resolve(i.after(-1)),1),Uo(n,r,s)}}}function Go(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection,o;if(a instanceof U)o=a;else{let r=Yo(i,e,t);if(r==null)return!1;o=new U(n.doc.resolve(r))}let s=Ja(o.$headCell,e,t);return s?Uo(n,r,new U(o.$anchorCell,s)):!1}}function Ko(e,t){let n=e.state.doc,r=Ba(n.resolve(t));return r?(e.dispatch(e.state.tr.setSelection(new U(r))),!0):!1}function qo(e,t,n){if(!Ha(e.state))return!1;let r=Po(n),i=e.state.selection;if(i instanceof U){r||={width:1,height:1,rows:[j.from(Io(H(e.state.schema).cell,n))]};let t=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),o=V.get(t).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=Lo(r,o.right-o.left,o.bottom-o.top),Vo(e.state,e.dispatch,a,o,r),!0}if(r){let t=Ua(e.state),n=t.start(-1);return Vo(e.state,e.dispatch,n,V.get(t.node(-1)).findCell(t.pos-n),r),!0}return!1}function Jo(e,t){if(t.button!=0||t.ctrlKey||t.metaKey)return;let n=Xo(e,t.target),r;if(t.shiftKey&&e.state.selection instanceof U)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&n&&(r=Ba(e.state.selection.$anchor))!=null&&Zo(e,t)?.pos!=r.pos)i(r,t),t.preventDefault();else if(!n)return;function i(t,n){let r=Zo(e,n),i=za.getState(e.state)==null;if(!r||!qa(t,r)){if(i)r=t;else return}let a=new U(t,r);if(i||!e.state.selection.eq(a)){let n=e.state.tr.setSelection(a);i&&n.setMeta(za,t.pos),e.dispatch(n)}}function a(){e.root.removeEventListener(`mouseup`,a),e.root.removeEventListener(`dragstart`,a),e.root.removeEventListener(`mousemove`,o),za.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(za,-1))}function o(r){let o=r,s=za.getState(e.state),c;if(s!=null)c=e.state.doc.resolve(s);else if(Xo(e,o.target)!=n&&(c=Zo(e,t),!c))return a();c&&i(c,o)}e.root.addEventListener(`mouseup`,a),e.root.addEventListener(`dragstart`,a),e.root.addEventListener(`mousemove`,o)}function Yo(e,t,n){if(!(e.state.selection instanceof l))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole==`cell`||a.type.spec.tableRole==`header_cell`){let a=r.before(i),o=t==`vert`?n>0?`down`:`up`:n>0?`right`:`left`;return e.endOfTextblock(o)?a:null}}return null}function Xo(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName==`TD`||t.nodeName==`TH`)return t;return null}function Zo(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&Ba(e.state.doc.resolve(r))||Ba(e.state.doc.resolve(i))}var Qo=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`)),this.table.style.setProperty(`--default-cell-min-width`,`${t}px`),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),$o(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type==this.node.type&&(this.node=e,$o(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type==`attributes`&&(e.target==this.table||this.colgroup.contains(e.target))}};function $o(e,t,n,r,i,a){let o=0,s=!0,c=t.firstChild,l=e.firstChild;if(l){for(let e=0,n=0;e<l.childCount;e++){let{colspan:u,colwidth:d}=l.child(e).attrs;for(let e=0;e<u;e++,n++){let l=i==n?a:d&&d[e],u=l?l+`px`:``;if(o+=l||r,l||(s=!1),c)c.style.width!=u&&(c.style.width=u),c=c.nextSibling;else{let e=document.createElement(`col`);e.style.width=u,t.appendChild(e)}}}for(;c;){var u;let e=c.nextSibling;(u=c.parentNode)==null||u.removeChild(c),c=e}s?(n.style.width=o+`px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=o+`px`)}}var es=new _(`tableColumnResizing`);function ts({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=Qo,lastColumnResizable:i=!0}={}){let a=new D({key:es,state:{init(e,t){var i;let o=(i=a.spec)==null||(i=i.props)==null?void 0:i.nodeViews,s=H(t.schema).table.name;return r&&o&&(o[s]=(e,t)=>new r(e,n,t)),new ns(-1,!1)},apply(e,t){return t.apply(e)}},props:{attributes:e=>{let t=es.getState(e);return t&&t.activeHandle>-1?{class:`resize-cursor`}:{}},handleDOMEvents:{mousemove:(t,n)=>{rs(t,n,e,i)},mouseleave:e=>{is(e)},mousedown:(e,r)=>{as(e,r,t,n)}},decorations:e=>{let t=es.getState(e);if(t&&t.activeHandle>-1)return ms(e,t.activeHandle)},nodeViews:{}}});return a}var ns=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let n=this,r=t.getMeta(es);if(r&&r.setHandle!=null)return new e(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new e(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return Ga(t.doc.resolve(r))||(r=-1),new e(r,n.dragging)}return n}};function rs(e,t,n,r){if(!e.editable)return;let i=es.getState(e.state);if(i&&!i.dragging){let a=ss(t.target),o=-1;if(a){let{left:r,right:i}=a.getBoundingClientRect();t.clientX-r<=n?o=cs(e,t,`left`,n):i-t.clientX<=n&&(o=cs(e,t,`right`,n))}if(o!=i.activeHandle){if(!r&&o!==-1){let t=e.state.doc.resolve(o),n=t.node(-1),r=V.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}us(e,o)}}}function is(e){if(!e.editable)return;let t=es.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&us(e,-1)}function as(e,t,n,r){if(!e.editable)return!1;let i=e.dom.ownerDocument.defaultView??window,a=es.getState(e.state);if(!a||a.activeHandle==-1||a.dragging)return!1;let o=e.state.doc.nodeAt(a.activeHandle),s=os(e,a.activeHandle,o.attrs);e.dispatch(e.state.tr.setMeta(es,{setDragging:{startX:t.clientX,startWidth:s}}));function c(t){i.removeEventListener(`mouseup`,c),i.removeEventListener(`mousemove`,l);let r=es.getState(e.state);r?.dragging&&(ds(e,r.activeHandle,ls(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(es,{setDragging:null})))}function l(t){if(!t.which)return c(t);let i=es.getState(e.state);if(i&&i.dragging){let a=ls(i.dragging,t,n);fs(e,i.activeHandle,a,r)}}return fs(e,a.activeHandle,s,r),i.addEventListener(`mouseup`,c),i.addEventListener(`mousemove`,l),t.preventDefault(),!0}function os(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let a=e.domAtPos(t),o=a.node.childNodes[a.offset].offsetWidth,s=n;if(r)for(let e=0;e<n;e++)r[e]&&(o-=r[e],s--);return o/s}function ss(e){for(;e&&e.nodeName!=`TD`&&e.nodeName!=`TH`;)e=e.classList&&e.classList.contains(`ProseMirror`)?null:e.parentNode;return e}function cs(e,t,n,r){let i=n==`right`?-r:r,a=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!a)return-1;let{pos:o}=a,s=Ba(e.state.doc.resolve(o));if(!s)return-1;if(n==`right`)return s.pos;let c=V.get(s.node(-1)),l=s.start(-1),u=c.map.indexOf(s.pos-l);return u%c.width==0?-1:l+c.map[u-1]}function ls(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function us(e,t){e.dispatch(e.state.tr.setMeta(es,{setHandle:t}))}function ds(e,t,n){let r=e.state.doc.resolve(t),i=r.node(-1),a=V.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,c=e.state.tr;for(let e=0;e<a.height;e++){let t=e*a.width+s;if(e&&a.map[t]==a.map[t-a.width])continue;let r=a.map[t],l=i.nodeAt(r).attrs,u=l.colspan==1?0:s-a.colCount(r);if(l.colwidth&&l.colwidth[u]==n)continue;let d=l.colwidth?l.colwidth.slice():ps(l.colspan);d[u]=n,c.setNodeMarkup(o+r,null,{...l,colwidth:d})}c.docChanged&&e.dispatch(c)}function fs(e,t,n,r){let i=e.state.doc.resolve(t),a=i.node(-1),o=i.start(-1),s=V.get(a).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1,c=e.domAtPos(i.start(-1)).node;for(;c&&c.nodeName!=`TABLE`;)c=c.parentNode;c&&$o(a,c.firstChild,c,r,s,n)}function ps(e){return Array(e).fill(0)}function ms(e,t){let n=[],r=e.doc.resolve(t),i=r.node(-1);if(!i)return s.empty;let a=V.get(i),o=r.start(-1),l=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let t=0;t<a.height;t++){let r=l+t*a.width;if((l==a.width-1||a.map[r]!=a.map[r+1])&&(t==0||a.map[r]!=a.map[r-a.width])){let t=a.map[r],s=o+t+i.nodeAt(t).nodeSize-1,l=document.createElement(`div`);l.className=`column-resize-handle`,es.getState(e)?.dragging&&n.push(c.node(o+t,o+t+i.nodeAt(t).nodeSize,{class:`column-resize-dragging`})),n.push(c.widget(s,l))}}return s.create(e.doc,n)}function hs({allowTableNodeSelection:e=!1}={}){return new D({key:za,state:{init(){return null},apply(e,t){let n=e.getMeta(za);if(n!=null)return n==-1?null:n;if(t==null||!e.docChanged)return t;let{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:$a,handleDOMEvents:{mousedown:Jo},createSelectionBetween(e){return za.getState(e.state)==null?null:e.state.selection},handleTripleClick:Ko,handleKeyDown:Ho,handlePaste:qo},appendTransaction(t,n,r){return no(r,ao(r,n),e)}})}function gs(e){return e===`left`||e===`right`||e===`center`?e:null}function _s(e){let t=(e.style.textAlign||``).trim().toLowerCase(),n=(e.getAttribute(`align`)||``).trim().toLowerCase();return gs(t||n)}function vs(e){return gs(e?.align)}function ys(){return{default:null,parseHTML:e=>_s(e),renderHTML:e=>{let t=gs(e.align);return we(t)?{style:`text-align: ${t}`}:{}}}}function bs(e){let t=e.parentElement,n=e.closest(`table`);if(!t||!n)return null;let r=Array.from(t.children).indexOf(e),i=n.querySelectorAll(`colgroup > col`)[r]?.getAttribute(`width`);return i?[parseInt(i,10)]:null}function xs(e){let t=e.getAttribute(`colwidth`);return t?t.split(`,`).map(e=>parseInt(e,10)):bs(e)}var Ss=/[ \t\r\n\f]+/g;function Cs(e){return e.children.length>0?!1:(e.textContent??``).replace(Ss,``)===``}function ws(e){let t=e.createAndFill();if(!t)throw Error(`[tiptap error]: "${e.name}" has no default content to backfill.`);return t.content}function Ts(e,t,n){if(!(n in t))return;let r=t[n];(r===1||r===`1`||r==null)&&delete e[n]}var Es=g.create({name:`tableCell`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:xs},align:ys()}},tableRole:`cell`,isolating:!0,parseHTML(){return[{tag:`td`,getAttrs:e=>Cs(e)?{}:!1,getContent:(e,t)=>ws(t.nodes[this.name])},{tag:`td`}]},renderHTML({HTMLAttributes:e}){let t=O(this.options.HTMLAttributes,e);return Ts(t,e,`colspan`),Ts(t,e,`rowspan`),[`td`,t,0]}}),Ds=g.create({name:`tableHeader`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:xs},align:ys()}},tableRole:`header_cell`,isolating:!0,parseHTML(){return[{tag:`th`,getAttrs:e=>Cs(e)?{}:!1,getContent:(e,t)=>ws(t.nodes[this.name])},{tag:`th`}]},renderHTML({HTMLAttributes:e}){let t=O(this.options.HTMLAttributes,e);return Ts(t,e,`colspan`),Ts(t,e,`rowspan`),[`th`,t,0]}}),Os=g.create({name:`tableRow`,addOptions(){return{HTMLAttributes:{}}},content:`(tableCell | tableHeader)*`,tableRole:`row`,parseHTML(){return[{tag:`tr`}]},renderHTML({HTMLAttributes:e}){return[`tr`,O(this.options.HTMLAttributes,e),0]}});function ks(e,t){return t?[`width`,`${Math.max(t,e)}px`]:[`min-width`,`${e}px`]}function As(e,t,n,r,i,a){let o=0,s=!0,c=t.firstChild,l=e.firstChild;if(l!==null)for(let e=0,n=0;e<l.childCount;e+=1){let{colspan:u,colwidth:d}=l.child(e).attrs;for(let e=0;e<u;e+=1,n+=1){let l=i===n?a:d&&d[e],u=l?`${l}px`:``;if(o+=l||r,l||(s=!1),c){if(c.style.width!==u){let[e,t]=ks(r,l);c.style.setProperty(e,t)}c=c.nextSibling}else{let e=document.createElement(`col`),[n,i]=ks(r,l);e.style.setProperty(n,i),t.appendChild(e)}}}for(;c;){var u;let e=c.nextSibling;(u=c.parentNode)==null||u.removeChild(c),c=e}let d=e.attrs.style&&typeof e.attrs.style==`string`&&/\bwidth\s*:/i.test(e.attrs.style);s&&!d?(n.style.width=`${o}px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=`${o}px`)}var js=class{constructor(e,t,n,r={}){this.node=e,this.cellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`));for(let[e,t]of Object.entries(r))t!=null&&(e===`style`?this.table.style.cssText=String(t):this.table.setAttribute(e,String(t)));e.attrs.style&&(this.table.style.cssText=e.attrs.style),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),As(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.sameMarkup(this.node)?(this.node=e,As(e,this.colgroup,this.table,this.cellMinWidth),!0):!1}ignoreMutation(e){let t=e.target,n=this.dom.contains(t),r=this.contentDOM.contains(t);return!(!n||r||e.type!==`attributes`&&e.type!==`childList`&&e.type!==`characterData`)}};function Ms(e,t,n,r){let i=0,a=!0,o=[],s=e.firstChild;if(!s)return{};for(let e=0,c=0;e<s.childCount;e+=1){let{colspan:l,colwidth:u}=s.child(e).attrs;for(let e=0;e<l;e+=1,c+=1){let s=n===c?r:u&&u[e];i+=s||t,s||(a=!1);let[l,d]=ks(t,s);o.push([`col`,{style:`${l}: ${d}`}])}}let c=a?`${i}px`:``,l=a?``:`${i}px`;return{colgroup:[`colgroup`,{},...o],tableWidth:c,tableMinWidth:l}}function Ns(e,t){return t?e.createChecked(null,t):e.createAndFill()}function Ps(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;let t={};return Object.keys(e.nodes).forEach(n=>{let r=e.nodes[n];r.spec.tableRole&&(t[r.spec.tableRole]=r)}),e.cached.tableNodeTypes=t,t}function Fs(e,t,n,r,i){let a=Ps(e),o=[],s=[];for(let e=0;e<n;e+=1){let e=Ns(a.cell,i);if(e&&s.push(e),r){let e=Ns(a.header_cell,i);e&&o.push(e)}}let c=[];for(let e=0;e<t;e+=1)c.push(a.row.createChecked(null,r&&e===0?o:s));return a.table.createChecked(null,c)}function Is(e){return e instanceof U}var Ls=({editor:e})=>{let{selection:t}=e.state;if(!Is(t))return!1;let n=0;return u(t.ranges[0].$from,e=>e.type.name===`table`)?.node.descendants(e=>{if(e.type.name===`table`)return!1;[`tableCell`,`tableHeader`].includes(e.type.name)&&(n+=1)}),n===t.ranges.length&&(e.commands.deleteTable(),!0)};function Rs(e,t){let n=e.mapping.map(t);if(u(e.selection.$from,e=>e.type.name===`table`)?.pos===n)return;let r=e.doc.nodeAt(n);if(!r)return;let i=n+r.nodeSize-1;e.setSelection(l.near(e.doc.resolve(i),-1))}function zs(e){let t=``,n=0;for(;n<e.length;){if(e[n]===`\\`&&n+1<e.length){t+=e[n]+e[n+1],n+=2;continue}if(e[n]!=="`"){t+=e[n++];continue}let r=0;for(;n+r<e.length&&e[n+r]==="`";)r+=1;let i=n+r,a=!1;for(;i<e.length;){if(e[i]!=="`"){i+=1;continue}let o=0;for(;i+o<e.length&&e[i+o]==="`";)o+=1;if(o===r){let o=e.slice(n+r,i);t+=e.slice(n,n+r)+o.replace(/\\\||\|/g,e=>e===`|`?`\\|`:e)+e.slice(i,i+r),n=i+r,a=!0;break}i+=o}a||(t+=e.slice(n,n+r),n+=r)}return t}function Bs(e){return e.split(`
|
|
40
|
+
`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=he(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(t){let r={type:`taskList`,raw:t.raw,items:t.items},i=e.slice(t.raw.length);return i.trim()?[r,...n.blockTokens(i)]:[r]}return n.blockTokens(e)},i=he(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});_e.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(Ar.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(ii.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(pi.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(Ni.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(Li.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(Ri.configure(this.options.taskList)),e}});var zi=` `,Bi=`\xA0`,Vi=g.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,O(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===zi||n[0].text===zi||n[0].raw===Bi||n[0].text===Bi)&&r.length===1&&r[0].type===`text`&&(r[0].text===zi||r[0].text===Bi)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){var i,a;let e=Array.isArray(n==null||(i=n.previousNode)==null?void 0:i.content)?n.previousNode.content:[];return(n==null||(a=n.previousNode)==null?void 0:a.type)===`paragraph`&&e.length===0?zi:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Hi=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Ui=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Wi=ge.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,O(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[fe({find:Hi,type:this.type})]},addPasteRules(){return[me({find:Ui,type:this.type})]}}),Gi=g.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),Ki=ge.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,O(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`<u>${t.renderChildren(e)}</u>`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.toLowerCase().indexOf(`<u>`)},tokenize(e,t,n){if(!/^<u>/i.test(e))return;let r=/\\[\s\S]|`+|<\/u>/gi;r.lastIndex=3;let i=r.exec(e);for(;i;){if(i[0].startsWith("`")){let t=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/.exec(e.slice(i.index));t&&(r.lastIndex=i.index+t[0].length)}else if(!i[0].startsWith(`\\`)){let t=e.slice(3,i.index);return t?{type:`underline`,raw:e.slice(0,r.lastIndex),text:t,tokens:n.inlineTokens(t)}:void 0}i=r.exec(e)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function qi(e={}){return new D({view(t){return new Ji(t,e)}})}var Ji=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.setCursor(null),this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(this.cursorPos!=null&&t.doc!=e.state.doc){if(this.lastDragEvent){let e=this.computeTarget(this.lastDragEvent);e==this.cursorPos?this.updateOverlay():this.setCursor(e)}else this.updateOverlay()}}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(!t||i)return null;let a=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=te(this.editorView.state.doc,a,this.editorView.dragging.slice);e!=null&&(a=e)}return a}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);t!=null&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},B=class e extends y{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):y.near(r)}content(){return T.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new Yi(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!Zi(e)||!Qi(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,i=!1){search:for(;;){if(!i&&e.valid(t))return t;let a=t.pos,o=null;for(let r=t.depth;;r--){let i=t.node(r);if(n>0?t.indexAfter(r)<i.childCount:t.index(r)>0){o=i.child(n>0?t.indexAfter(r):t.index(r)-1);break}if(r==0)return null;a+=n;let s=t.doc.resolve(a);if(e.valid(s))return s}for(;;){let s=n>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!r.isSelectable(o)){t=t.doc.resolve(a+o.nodeSize*n),i=!1;continue search}break}o=s,a+=n;let c=t.doc.resolve(a);if(e.valid(c))return c}return null}}};B.prototype.visible=!1,B.findFrom=B.findGapCursorFrom,y.jsonID(`gapcursor`,B);var Yi=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return B.valid(t)?new B(t):y.near(t)}};function Xi(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function Zi(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0}else for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||Xi(e.type))return!0;if(e.inlineContent)return!1}}return!0}function Qi(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0}else for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||Xi(e.type))return!0;if(e.inlineContent)return!1}}return!0}function $i(){return new D({props:{decorations:ia,createSelectionBetween(e,t,n){return t.pos==n.pos&&B.valid(n)?new B(n):null},handleClick:na,handleKeyDown:ea,handleDOMEvents:{beforeinput:ra}}})}var ea=w({ArrowLeft:ta(`horiz`,-1),ArrowRight:ta(`horiz`,1),ArrowUp:ta(`vert`,-1),ArrowDown:ta(`vert`,1)});function ta(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof l){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=B.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new B(c))),!0):!1}}function na(e,t,n){if(!e||!e.editable)return!1;let i=e.state.doc.resolve(t);if(!B.valid(i))return!1;let a=e.posAtCoords({left:n.clientX,top:n.clientY});return a&&a.inside>-1&&r.isSelectable(e.state.doc.nodeAt(a.inside))?!1:(e.dispatch(e.state.tr.setSelection(new B(i))),!0)}function ra(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof B))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=j.empty;for(let e=r.length-1;e>=0;e--)i=j.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new T(i,0,0));return a.setSelection(l.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function ia(e){if(!(e.selection instanceof B))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,s.create(e.doc,[c.widget(e.selection.head,t,{key:`gapcursor`})])}_e.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new D({key:new _(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var aa=_e.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[qi(this.options)]}});_e.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new D({key:new _(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return s.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let l=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(l+=1,this.options.mode===`deepest`&&o-l>0||this.options.mode===`shallowest`&&l>1)return this.options.mode===`deepest`;a.push(c.node(t,t+e.nodeSize,{class:this.options.className}))}),s.create(e,a)}}})]}});var oa=_e.create({name:`gapCursor`,addProseMirrorPlugins(){return[$i()]},extendNodeSchema(e){let t={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:d(C(e,`allowGapCursor`,t))??null}}}),sa=`placeholder`,ca=new _(`tiptap__placeholder`);function la(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:a,isEmptyDoc:o,hasAnchor:s,classes:{emptyNode:l,emptyEditor:u}}=e,d=[l];return o&&d.push(u),c.node(i,i+a.nodeSize,{class:d.join(` `),[r]:typeof n==`function`?n({editor:t,node:a,pos:i,hasAnchor:s}):n})}function ua(e,t){return typeof e==`function`?e(t):e}function da({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:a,to:o}){let{anchor:s}=i,c=[],l=e.isEmpty;return r.nodesBetween(a,o,(r,i)=>{let a=s>=i&&s<=i+r.nodeSize,o=!r.isLeaf&&de(r);return r.type.isTextblock&&(a||!t.showOnlyCurrent)&&o&&c.push(la({editor:e,isEmptyDoc:l,dataAttribute:n,hasAnchor:a,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:ua(t.emptyNodeClass,{editor:e,node:r,pos:i,hasAnchor:a})},node:r,pos:i})),t.includeChildren}),c}function fa({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!e.isEditable&&t.showOnlyWhenEditable)return null;let{anchor:a}=i,o=[],c=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),s=i.depth>0?i.node(1):i.nodeAfter,l=i.depth>0?i.before(1):a;if(s&&s.type.isTextblock&&de(s)){let r=a>=l&&a<=l+s.nodeSize;o.push(la({editor:e,isEmptyDoc:c,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:ua(t.emptyNodeClass,{editor:e,node:s,pos:l,hasAnchor:r})},node:s,pos:l}))}}else o.push(...da({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return s.create(r,o)}function pa(e,t){let n=e.resolve(t);if(n.depth===0){let e=n.nodeAfter??n.nodeBefore;if(!e)return{from:t,to:t};let r=n.nodeAfter?t:t-e.nodeSize;return{from:r,to:r+e.nodeSize}}let r=n.before(1);return{from:r,to:r+n.node(1).nodeSize}}function ma(e,t){return{from:Math.max(0,t.from),to:Math.min(e.content.size,t.to)}}function ha(e,t,n){let r=[];return e.forEach((e,i)=>{let a=i,o=a+e.nodeSize,s=a+1,c=o+1;s<n&&c>t&&r.push({from:a,to:o})}),r}function ga(e){if(e.length===0)return[];let t=[...e].sort((e,t)=>e.from-t.from),n=[{...t[0]}];for(let e=1;e<t.length;e+=1){let r=n[n.length-1],i=t[e];i.from<=r.to?r.to=Math.max(r.to,i.to):n.push({...i})}return n}function _a(e,t){let n=ha(e,t.from,t.to);return n.push(ma(e,pa(e,t.from))),t.to>t.from?n.push(ma(e,pa(e,Math.min(t.to,e.content.size+1)-1))):t.from<e.content.size+1&&n.push(ma(e,pa(e,Math.min(t.from+1,e.content.size)))),n}function va(e,t,n){let r=[];if(e.docChanged){let t=se(e);for(let e of t)r.push(..._a(n.doc,e.newRange))}return e.selectionSet&&(r.push(ma(n.doc,pa(n.doc,e.mapping.map(t.selection.anchor)))),r.push(ma(n.doc,pa(n.doc,n.selection.anchor)))),ga(r)}function ya(e,t,n){let r=Math.max(0,Math.min(e,n.content.size));return{from:r,to:Math.max(r,Math.min(t,n.content.size))}}function ba({decorations:e,ranges:t,editor:n,options:r,dataAttribute:i,doc:a,selection:o}){let s=e;for(let e of t){let{from:t,to:c}=ya(e.from,e.to,a),l=s.find(t,c).filter(e=>e.from>=t&&e.to<=c);l.length&&(s=s.remove(l));let u=da({editor:n,options:r,dataAttribute:i,doc:a,selection:o,from:t,to:c});u.length&&(s=s.add(a,u))}return s}function xa({editor:e,options:t,dataAttribute:n}){return{init(r,i){return fa({editor:e,options:t,dataAttribute:n,doc:i.doc,selection:i.selection})??s.empty},apply(r,i,a,o){return!r.docChanged&&!r.selectionSet?i:ba({decorations:i.map(r.mapping,r.doc),ranges:va(r,a,o),editor:e,options:t,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function Sa(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}function Ca({editor:e,options:t}){let n=t.dataAttribute?`data-${Sa(t.dataAttribute)}`:`data-${sa}`,r=t.showOnlyCurrent&&!t.includeChildren;return new D({key:ca,...r?{}:{state:xa({editor:e,options:t,dataAttribute:n})},props:{decorations:r?({doc:r,selection:i})=>fa({editor:e,options:t,dataAttribute:n,doc:r,selection:i}):n=>t.showOnlyWhenEditable&&!e.isEditable?s.empty:ca.getState(n)??s.empty}})}var wa=_e.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:sa,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[Ca({editor:this.editor,options:this.options})]}});function Ta(e,t){return!e.selection.empty&&!ye(e.selection)&&t.isEditable}function Ea(e,t){return Ta(e,t)&&!t.isFocused&&!t.view.dragging}function Da(){var e;(e=window.getSelection())==null||e.removeAllRanges()}function Oa(e){e.focus()}_e.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new D({key:new _(`selection`),props:{decorations(n){return Ea(n,e)?s.create(n.doc,[c.inline(n.selection.from,n.selection.to,{class:t.className})]):null},handleDOMEvents:{blur(t){return Ta(t.state,e)&&Da(),!1},focus(t){return Ta(t.state,e)&&requestAnimationFrame(()=>{!e.isDestroyed&&t.hasFocus()&&Oa(t)}),!1}}}})]}});function ka({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var Aa=_e.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new _(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new D({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!ka({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!ka({node:r,types:n})}}})]}}),ja=_e.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>Te(e,t),redo:()=>({state:e,dispatch:t})=>o(e,t)}},addProseMirrorPlugins(){return[Ee(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Ma=_e.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(He.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(Le.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(Ar.configure(this.options.bulletList)),this.options.code!==!1&&e.push(Ke.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(Xe.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(Ze.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(aa.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(oa.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(Qe.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push($e.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(ja.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(et.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(at.configure(this.options.italic)),this.options.listItem!==!1&&e.push(ii.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(pi.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(Er.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(Ni.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(Vi.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(Wi.configure(this.options.strike)),this.options.text!==!1&&e.push(Gi.configure(this.options.text)),this.options.underline!==!1&&e.push(Ki.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(Aa.configure(this.options?.trailingNode)),e}}),Na,Pa;if(typeof WeakMap<`u`){let e=new WeakMap;Na=t=>e.get(t),Pa=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;Na=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},Pa=(n,r)=>(t==10&&(t=0),e[t++]=n,e[t++]=r)}var V=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,a=r+1,o=i+1;for(let e=1;a<this.width&&this.map[t+e]==n;e++)a++;for(let e=1;o<this.height&&this.map[t+this.width*e]==n;e++)o++;return{left:r,top:i,right:a,bottom:o}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:a,bottom:o}=this.findCell(e);return t==`horiz`?(n<0?r==0:i==this.width)?null:this.map[a*this.width+(n<0?r-1:i)]:(n<0?a==0:o==this.height)?null:this.map[r+this.width*(n<0?a-1:o)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:a}=this.findCell(e),{left:o,right:s,top:c,bottom:l}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(i,c),right:Math.max(r,s),bottom:Math.max(a,l)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let a=r*this.width+i,o=this.map[a];n[o]||(n[o]=!0,!(i==e.left&&i&&this.map[a-1]==o||r==e.top&&r&&this.map[a-this.width]==o)&&t.push(o))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let a=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?a-1:this.map[n]}i=a}}static get(e){return Na(e)||Pa(e,Fa(e))}};function Fa(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=Ia(e),n=e.childCount,r=[],i=0,a=null,o=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let s=0,c=0;s<n;s++){let l=e.child(s);c++;for(let e=0;;e++){for(;i<r.length&&r[i]!=0;)i++;if(e==l.childCount)break;let u=l.child(e),{colspan:d,rowspan:f,colwidth:p}=u.attrs;for(let e=0;e<f;e++){if(e+s>=n){(a||=[]).push({type:`overlong_rowspan`,pos:c,n:f-e});break}let l=i+e*t;for(let e=0;e<d;e++){r[l+e]==0?r[l+e]=c:(a||=[]).push({type:`collision`,row:s,pos:c,n:d-e});let n=p&&p[e];if(n){let r=(l+e)%t*2,i=o[r];i==null||i!=n&&o[r+1]==1?(o[r]=n,o[r+1]=1):i==n&&o[r+1]++}}}i+=d,c+=u.nodeSize}let u=(s+1)*t,d=0;for(;i<u;)r[i++]==0&&d++;d&&(a||=[]).push({type:`missing`,row:s,n:d}),c++}(t===0||n===0)&&(a||=[]).push({type:`zero_sized`});let s=new V(t,n,r,a),c=!1;for(let e=0;!c&&e<o.length;e+=2)o[e]!=null&&o[e+1]<n&&(c=!0);return c&&La(s,o,e),s}function Ia(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),a=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(a+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);a+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function La(e,t,n){e.problems||=[];let r={};for(let i=0;i<e.map.length;i++){let a=e.map[i];if(r[a])continue;r[a]=!0;let o=n.nodeAt(a);if(!o)throw RangeError(`No cell with offset ${a} found`);let s=null,c=o.attrs;for(let n=0;n<c.colspan;n++){let r=t[(i+n)%e.width*2];r==null||c.colwidth&&c.colwidth[n]==r||((s||=Ra(c))[n]=r)}s&&e.problems.unshift({type:`colwidth mismatch`,pos:a,colwidth:s})}}function Ra(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function H(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}var za=new _(`selectingCells`);function Ba(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function Va(e){for(let t=e.depth;t>0;t--){let n=e.node(t).type.spec.tableRole;if(n===`cell`||n===`header_cell`)return e.node(t)}return null}function Ha(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function Ua(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let n=Ba(t.$head)||Wa(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function Wa(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n-t.nodeSize)}}function Ga(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function Ka(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function qa(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function Ja(e,t,n){let r=e.node(-1),i=V.get(r),a=e.start(-1),o=i.nextCell(e.pos-a,t,n);return o==null?null:e.node(0).resolve(a+o)}function Ya(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function Xa(e,t,n=1){let r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}function Za(e,t,n){let r=H(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0}var U=class e extends y{constructor(e,t=e){let n=e.node(-1),r=V.get(n),i=e.start(-1),a=r.rectBetween(e.pos-i,t.pos-i),o=e.node(0),s=r.cellsInRect(a).filter(e=>e!=t.pos-i);s.unshift(t.pos-i);let c=s.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new S(o.resolve(r),o.resolve(r+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(Ga(r)&&Ga(i)&&qa(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return l.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=V.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},a=[];for(let n=r.top;n<r.bottom;n++){let o=[];for(let a=n*t.width+r.left,s=r.left;s<r.right;s++,a++){let n=t.map[a];if(i[n])continue;i[n]=!0;let s=t.findCell(n),c=e.nodeAt(n);if(!c)throw RangeError(`No cell with offset ${n} found`);let l=r.left-s.left,u=s.right-r.right;if(l>0||u>0){let e=c.attrs;if(l>0&&(e=Ya(e,0,l)),u>0&&(e=Ya(e,e.colspan-u,u)),s.left<r.left){if(c=c.type.createAndFill(e),!c)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else c=c.type.create(e,c.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...c.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};c=s.top<r.top?c.type.createAndFill(e):c.type.create(e,c.content)}o.push(c)}a.push(e.child(n).copy(j.from(o)))}let o=this.isColSelection()&&this.isRowSelection()?e:a;return new T(j.from(o),1,1)}replace(e,t=T.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n);e.replace(s.map(a.pos),s.map(o.pos),i?T.empty:t)}let i=y.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new T(j.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=V.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=V.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.top<=s.top?(o.top>0&&(t=c.resolve(a+i.map[o.left])),s.bottom<i.height&&(n=c.resolve(a+i.map[i.width*(i.height-1)+s.right-1]))):(s.top>0&&(n=c.resolve(a+i.map[s.left])),o.bottom<i.height&&(t=c.resolve(a+i.map[i.width*(i.height-1)+o.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=V.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;let a=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,o)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=V.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.left<=s.left?(o.left>0&&(t=c.resolve(a+i.map[o.top*i.width])),s.right<i.width&&(n=c.resolve(a+i.map[i.width*(s.top+1)-1]))):(s.left>0&&(n=c.resolve(a+i.map[s.top*i.width])),o.right<i.width&&(t=c.resolve(a+i.map[i.width*(o.top+1)-1]))),new e(t,n)}toJSON(){return{type:`cell`,anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new Qa(this.$anchorCell.pos,this.$headCell.pos)}};U.prototype.visible=!1,y.jsonID(`cell`,U);var Qa=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole==`row`&&n.parent.type.spec.tableRole==`row`&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&qa(t,n)?new U(t,n):y.near(n,1)}};function $a(e){if(!(e.selection instanceof U))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(c.node(n,n+e.nodeSize,{class:`selectedCell`}))}),s.create(e.doc,t)}function eo({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}function to({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){let r=e.node(t);if(r.type.spec.tableRole===`cell`||r.type.spec.tableRole===`header_cell`){n=r;break}}for(let e=t.depth;e>0;e--){let n=t.node(e);if(n.type.spec.tableRole===`cell`||n.type.spec.tableRole===`header_cell`){r=n;break}}return n!==r&&t.parentOffset===0}function no(e,t,n){let i=(t||e).selection,a=(t||e).doc,o,s;if(i instanceof r&&(s=i.node.type.spec.tableRole)){if(s==`cell`||s==`header_cell`)o=U.create(a,i.from);else if(s==`row`){let e=a.resolve(i.from+1);o=U.rowSelection(e,e)}else if(!n){let e=V.get(i.node),t=i.from+1,n=t+e.map[e.width*e.height-1];o=U.create(a,t+1,n)}}else i instanceof l&&eo(i)?o=l.create(a,i.from):i instanceof l&&to(i)&&(o=l.create(a,i.$from.start(),i.$from.end()));return o&&(t||=e.tr).setSelection(o),t}var ro=new _(`fix-tables`);function io(e,t,n,r){let i=e.childCount,a=t.childCount;outer:for(let o=0,s=0;o<a;o++){let a=t.child(o);for(let t=s,r=Math.min(i,o+3);t<r;t++)if(e.child(t)==a){s=t+1,n+=a.nodeSize;continue outer}r(a,n),s<i&&e.child(s).sameMarkup(a)?io(e.child(s),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function ao(e,t){let n,r=(t,r)=>{t.type.spec.tableRole==`table`&&(n=oo(e,t,r,n))};return t?t.doc!=e.doc&&io(t.doc,e.doc,0,r):e.doc.descendants(r),n}function oo(e,t,n,r){let i=V.get(t);if(!i.problems)return r;r||=e.tr;let a=[];for(let e=0;e<i.height;e++)a.push(0);for(let e=0;e<i.problems.length;e++){let o=i.problems[e];if(o.type==`collision`){let e=t.nodeAt(o.pos);if(!e)continue;let i=e.attrs;for(let e=0;e<i.rowspan;e++)a[o.row+e]+=o.n;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,Ya(i,i.colspan-o.n,o.n))}else if(o.type==`missing`)a[o.row]+=o.n;else if(o.type==`overlong_rowspan`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-o.n})}else if(o.type==`colwidth mismatch`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,colwidth:o.colwidth})}else if(o.type==`zero_sized`){let e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}let o,s;for(let e=0;e<a.length;e++)a[e]&&(o??=e,s=e);for(let c=0,l=n+1;c<i.height;c++){let n=t.child(c),i=l+n.nodeSize,u=a[c];if(u>0){let t=`cell`;n.firstChild&&(t=n.firstChild.type.spec.tableRole);let a=[];for(let n=0;n<u;n++){let n=H(e.schema)[t].createAndFill();n&&a.push(n)}let d=(c==0||o==c-1)&&s==c?l+1:i-1;r.insert(r.mapping.map(d),a)}l=i}return r.setMeta(ro,{fixTables:!0})}function so(e){let t=e.selection,n=Ua(e),r=n.node(-1),i=n.start(-1),a=V.get(r);return{...t instanceof U?a.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):a.findCell(n.pos-i),tableStart:i,map:a,table:r}}function co(e,{map:t,tableStart:n,table:r},i){let a=i>0?-1:0;Za(t,r,i+a)&&(a=i==0||i==t.width?null:0);for(let o=0;o<t.height;o++){let s=o*t.width+i;if(i>0&&i<t.width&&t.map[s-1]==t.map[s]){let a=t.map[s],c=r.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,Xa(c.attrs,i-t.colCount(a))),o+=c.attrs.rowspan-1}else{let c=a==null?H(r.type.schema).cell:r.nodeAt(t.map[s+a]).type,l=t.positionAt(o,i,r);e.insert(e.mapping.map(n+l),c.createAndFill())}}return e}function lo(e,t){if(!Ha(e))return!1;if(t){let n=so(e);t(co(e.tr,n,n.left))}return!0}function uo(e,t){if(!Ha(e))return!1;if(t){let n=so(e);t(co(e.tr,n,n.right))}return!0}function fo(e,{map:t,table:n,tableStart:r},i){let a=e.mapping.maps.length;for(let o=0;o<t.height;){let s=o*t.width+i,c=t.map[s],l=n.nodeAt(c),u=l.attrs;if(i>0&&t.map[s-1]==c||i<t.width-1&&t.map[s+1]==c)e.setNodeMarkup(e.mapping.slice(a).map(r+c),null,Ya(u,i-t.colCount(c)));else{let t=e.mapping.slice(a).map(r+c);e.delete(t,t+l.nodeSize)}o+=u.rowspan}}function po(e,t){if(!Ha(e))return!1;if(t){let n=so(e),r=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let e=n.right-1;fo(r,n,e),e!=n.left;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=V.get(e)}t(r)}return!0}function mo(e,t,n){let r=H(t.type.schema).header_cell;for(let i=0;i<e.width;i++)if(t.nodeAt(e.map[i+n*e.width])?.type!=r)return!1;return!0}function ho(e,{map:t,tableStart:n,table:r},i){let a=n;for(let e=0;e<i;e++)a+=r.child(e).nodeSize;let o=[],s=i>0?-1:0;mo(t,r,i+s)&&(s=i==0||i==t.height?null:0);for(let a=0,c=t.width*i;a<t.width;a++,c++)if(i>0&&i<t.height&&t.map[c]==t.map[c-t.width]){let i=t.map[c],o=r.nodeAt(i).attrs;e.setNodeMarkup(n+i,null,{...o,rowspan:o.rowspan+1}),a+=o.colspan-1}else{let e=(s==null?H(r.type.schema).cell:r.nodeAt(t.map[c+s*t.width])?.type)?.createAndFill();e&&o.push(e)}return e.insert(a,H(r.type.schema).row.create(null,o)),e}function go(e,t){if(!Ha(e))return!1;if(t){let n=so(e);t(ho(e.tr,n,n.top))}return!0}function _o(e,t){if(!Ha(e))return!1;if(t){let n=so(e);t(ho(e.tr,n,n.bottom))}return!0}function vo(e,{map:t,table:n,tableStart:r},i){let a=0;for(let e=0;e<i;e++)a+=n.child(e).nodeSize;let o=a+n.child(i).nodeSize,s=e.mapping.maps.length;e.delete(a+r,o+r);let c=new Set;for(let a=0,o=i*t.width;a<t.width;a++,o++){let l=t.map[o];if(!c.has(l)){if(c.add(l),i>0&&l==t.map[o-t.width]){let t=n.nodeAt(l).attrs;e.setNodeMarkup(e.mapping.slice(s).map(l+r),null,{...t,rowspan:t.rowspan-1}),a+=t.colspan-1}else if(i<t.height&&l==t.map[o+t.width]){let o=n.nodeAt(l),c=o.attrs,u=o.type.create({...c,rowspan:o.attrs.rowspan-1},o.content),d=t.positionAt(i+1,a,n);e.insert(e.mapping.slice(s).map(r+d),u),a+=c.colspan-1}}}}function yo(e,t){if(!Ha(e))return!1;if(t){let n=so(e),r=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;vo(r,n,e),e!=n.top;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=V.get(n.table)}t(r)}return!0}function bo(e){let t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function xo({width:e,height:t,map:n},r){let i=r.top*e+r.left,a=i,o=(r.bottom-1)*e+r.left,s=i+(r.right-r.left-1);for(let t=r.top;t<r.bottom;t++){if(r.left>0&&n[a]==n[a-1]||r.right<e&&n[s]==n[s+1])return!0;a+=e,s+=e}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[i]==n[i-e]||r.bottom<t&&n[o]==n[o+e])return!0;i++,o++}return!1}function So(e,t){let n=e.selection;if(!(n instanceof U)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=so(e),{map:i}=r;if(xo(i,r))return!1;if(t){let n=e.tr,a={},o=j.empty,s,c;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){let l=i.map[e*i.width+t],u=r.table.nodeAt(l);if(!a[l]&&u){if(a[l]=!0,s==null)s=l,c=u;else{bo(u)||(o=o.append(u.content));let e=n.mapping.map(l+r.tableStart);n.delete(e,e+u.nodeSize)}}}if(s==null||c==null)return!0;if(n.setNodeMarkup(s+r.tableStart,null,{...Xa(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),o.size>0){let e=s+1+c.content.size,t=bo(c)?s+1:e;n.replaceWith(t+r.tableStart,e+r.tableStart,o)}n.setSelection(new U(n.doc.resolve(s+r.tableStart))),t(n)}return!0}function Co(e,t){let n=H(e.schema);return wo(({node:e})=>n[e.type.spec.tableRole])(e,t)}function wo(e){return(t,n)=>{let r=t.selection,i,a;if(r instanceof U){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,a=r.$anchorCell.pos}else{if(i=Va(r.$from),!i)return!1;a=Ba(r.$from)?.pos}if(i==null||a==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let o=i.attrs,s=[],c=o.colwidth;o.rowspan>1&&(o={...o,rowspan:1}),o.colspan>1&&(o={...o,colspan:1});let l=so(t),u=t.tr;for(let e=0;e<l.right-l.left;e++)s.push(c?{...o,colwidth:c&&c[e]?[c[e]]:null}:o);let d;for(let t=l.top;t<l.bottom;t++){let n=l.map.positionAt(t,l.left,l.table);t==l.top&&(n+=i.nodeSize);for(let r=l.left,a=0;r<l.right;r++,a++)(r!=l.left||t!=l.top)&&u.insert(d=u.mapping.map(n+l.tableStart,1),e({node:i,row:t,col:r}).createAndFill(s[a]))}u.setNodeMarkup(a,e({node:i,row:l.top,col:l.left}),s[0]),r instanceof U&&u.setSelection(new U(u.doc.resolve(r.$anchorCell.pos),d?u.doc.resolve(d):void 0)),n(u)}return!0}}function To(e,t){return function(n,r){if(!Ha(n))return!1;let i=Ua(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){let a=n.tr;n.selection instanceof U?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&a.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):a.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(a)}return!0}}function Eo(e){return function(t,n){if(!Ha(t))return!1;if(n){let r=H(t.schema),i=so(t),a=t.tr,o=i.map.cellsInRect(e==`column`?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e==`row`?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),s=o.map(e=>i.table.nodeAt(e));for(let e=0;e<o.length;e++)s[e].type==r.header_cell&&a.setNodeMarkup(i.tableStart+o[e],r.cell,s[e].attrs);if(a.steps.length===0)for(let e=0;e<o.length;e++)a.setNodeMarkup(i.tableStart+o[e],r.header_cell,s[e].attrs);n(a)}return!0}}function Do(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:e==`row`?t.map.width:1,bottom:e==`column`?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function Oo(e,t){return t||={useDeprecatedLogic:!1},t.useDeprecatedLogic?Eo(e):function(t,n){if(!Ha(t))return!1;if(n){let r=H(t.schema),i=so(t),a=t.tr,o=Do(`row`,i,r),s=Do(`column`,i,r),c=(e===`column`?o:e===`row`&&s)?1:0,l=e==`column`?{left:0,top:c,right:1,bottom:i.map.height}:e==`row`?{left:c,top:0,right:i.map.width,bottom:1}:i,u=e==`column`?s?r.cell:r.header_cell:e==`row`?o?r.cell:r.header_cell:r.cell;i.map.cellsInRect(l).forEach(e=>{let t=e+i.tableStart,n=a.doc.nodeAt(t);n&&a.setNodeMarkup(t,u,n.attrs)}),n(a)}return!0}}Oo(`row`,{useDeprecatedLogic:!0}),Oo(`column`,{useDeprecatedLogic:!0});var ko=Oo(`cell`,{useDeprecatedLogic:!0});function Ao(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){let r=e.node(-1).child(t),i=r.lastChild;if(i)return n-1-i.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){let e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}function jo(e){return function(t,n){if(!Ha(t))return!1;let r=Ao(Ua(t),e);if(r==null)return!1;if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(l.between(e,Ka(e))).scrollIntoView())}return!0}}function Mo(e,t){let n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole==`table`)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function No(e,t){let n=e.selection;if(!(n instanceof U))return!1;if(t){let r=e.tr,i=H(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new T(i,0,0))}),r.docChanged&&t(r)}return!0}function Po(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:r}=e;for(;t.childCount==1&&(n>0&&r>0||t.child(0).type.spec.tableRole==`table`);)n--,r--,t=t.child(0).content;let i=t.child(0),a=i.type.spec.tableRole,o=i.type.schema,s=[];if(a==`row`)for(let e=0;e<t.childCount;e++){let i=t.child(e).content,a=e?0:Math.max(0,n-1),c=e<t.childCount-1?0:Math.max(0,r-1);(a||c)&&(i=Io(H(o).row,new T(i,a,c)).content),s.push(i)}else if(a==`cell`||a==`header_cell`)s.push(n||r?Io(H(o).row,new T(t,n,r)).content:t);else return null;return Fo(o,s)}function Fo(e,t){let n=[];for(let e=0;e<t.length;e++){let r=t[e];for(let t=r.childCount-1;t>=0;t--){let{rowspan:i,colspan:a}=r.child(t).attrs;for(let t=e;t<e+i;t++)n[t]=(n[t]||0)+a}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(j.empty),n[i]<r){let a=H(e).cell.createAndFill(),o=[];for(let e=n[i];e<r;e++)o.push(a);t[i]=t[i].append(j.from(o))}return{height:t.length,width:r,rows:t}}function Io(e,t){let n=e.createAndFill();return new h(n).replace(0,n.content.size,t).doc}function Lo({width:e,height:t,rows:n},r,i){if(e!=r){let t=[],i=[];for(let e=0;e<n.length;e++){let a=n[e],o=[];for(let n=t[e]||0,i=0;n<r;i++){let s=a.child(i%a.childCount);n+s.attrs.colspan>r&&(s=s.type.createChecked(Ya(s.attrs,s.attrs.colspan,n+s.attrs.colspan-r),s.content)),o.push(s),n+=s.attrs.colspan;for(let n=1;n<s.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+s.attrs.colspan}i.push(j.from(o))}n=i,e=r}if(t!=i){let e=[];for(let r=0,a=0;r<i;r++,a++){let o=[],s=n[a%t];for(let e=0;e<s.childCount;e++){let t=s.child(e);r+t.attrs.rowspan>i&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,i-t.attrs.rowspan)},t.content)),o.push(t)}e.push(j.from(o))}n=e,t=i}return{width:e,height:t,rows:n}}function Ro(e,t,n,r,i,a,o){let s=e.doc.type.schema,c=H(s),l,u;if(i>t.width)for(let a=0,s=0;a<t.height;a++){let d=n.child(a);s+=d.nodeSize;let f=[],p;p=d.lastChild==null||d.lastChild.type==c.cell?l||=c.cell.createAndFill():u||=c.header_cell.createAndFill();for(let e=t.width;e<i;e++)f.push(p);e.insert(e.mapping.slice(o).map(s-1+r),f)}if(a>t.height){let s=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,i);e++){let i=e>=t.width?!1:n.nodeAt(t.map[r+e]).type==c.header_cell;s.push(i?u||=c.header_cell.createAndFill():l||=c.cell.createAndFill())}let d=c.row.create(null,j.from(s)),f=[];for(let e=t.height;e<a;e++)f.push(d);e.insert(e.mapping.slice(o).map(r+n.nodeSize-2),f)}return!!(l||u)}function zo(e,t,n,r,i,a,o,s){if(o==0||o==t.height)return!1;let c=!1;for(let l=i;l<a;l++){let i=o*t.width+l,a=t.map[i];if(t.map[i-t.width]==a){c=!0;let i=n.nodeAt(a),{top:u,left:d}=t.findCell(a);e.setNodeMarkup(e.mapping.slice(s).map(a+r),null,{...i.attrs,rowspan:o-u}),e.insert(e.mapping.slice(s).map(t.positionAt(o,d,n)),i.type.createAndFill({...i.attrs,rowspan:u+i.attrs.rowspan-o})),l+=i.attrs.colspan-1}}return c}function Bo(e,t,n,r,i,a,o,s){if(o==0||o==t.width)return!1;let c=!1;for(let l=i;l<a;l++){let i=l*t.width+o,a=t.map[i];if(t.map[i-1]==a){c=!0;let i=n.nodeAt(a),u=t.colCount(a),d=e.mapping.slice(s).map(a+r);e.setNodeMarkup(d,null,Ya(i.attrs,o-u,i.attrs.colspan-(o-u))),e.insert(d+i.nodeSize,i.type.createAndFill(Ya(i.attrs,0,o-u))),l+=i.attrs.rowspan-1}}return c}function Vo(e,t,n,r,i){let a=n?e.doc.nodeAt(n-1):e.doc;if(!a)throw Error(`No table found`);let o=V.get(a),{top:s,left:c}=r,l=c+i.width,u=s+i.height,d=e.tr,f=0;function p(){if(a=n?d.doc.nodeAt(n-1):d.doc,!a)throw Error(`No table found`);o=V.get(a),f=d.mapping.maps.length}Ro(d,o,a,n,l,u,f)&&p(),zo(d,o,a,n,c,l,s,f)&&p(),zo(d,o,a,n,c,l,u,f)&&p(),Bo(d,o,a,n,s,u,c,f)&&p(),Bo(d,o,a,n,s,u,l,f)&&p();for(let e=s;e<u;e++){let t=o.positionAt(e,c,a),r=o.positionAt(e,l,a);d.replace(d.mapping.slice(f).map(t+n),d.mapping.slice(f).map(r+n),new T(i.rows[e-s],0,0))}p(),d.setSelection(new U(d.doc.resolve(n+o.positionAt(s,c,a)),d.doc.resolve(n+o.positionAt(u-1,l-1,a)))),t(d)}var Ho=w({ArrowLeft:Wo(`horiz`,-1),ArrowRight:Wo(`horiz`,1),ArrowUp:Wo(`vert`,-1),ArrowDown:Wo(`vert`,1),"Shift-ArrowLeft":Go(`horiz`,-1),"Shift-ArrowRight":Go(`horiz`,1),"Shift-ArrowUp":Go(`vert`,-1),"Shift-ArrowDown":Go(`vert`,1),Backspace:No,"Mod-Backspace":No,Delete:No,"Mod-Delete":No});function Uo(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function Wo(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection;if(a instanceof U)return Uo(n,r,y.near(a.$headCell,t));if(e!=`horiz`&&!a.empty)return!1;let o=Yo(i,e,t);if(o==null)return!1;if(e==`horiz`)return Uo(n,r,y.near(n.doc.resolve(a.head+t),t));{let i=n.doc.resolve(o),a=Ja(i,e,t),s;return s=a?y.near(a,1):t<0?y.near(n.doc.resolve(i.before(-1)),-1):y.near(n.doc.resolve(i.after(-1)),1),Uo(n,r,s)}}}function Go(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection,o;if(a instanceof U)o=a;else{let r=Yo(i,e,t);if(r==null)return!1;o=new U(n.doc.resolve(r))}let s=Ja(o.$headCell,e,t);return s?Uo(n,r,new U(o.$anchorCell,s)):!1}}function Ko(e,t){let n=e.state.doc,r=Ba(n.resolve(t));return r?(e.dispatch(e.state.tr.setSelection(new U(r))),!0):!1}function qo(e,t,n){if(!Ha(e.state))return!1;let r=Po(n),i=e.state.selection;if(i instanceof U){r||={width:1,height:1,rows:[j.from(Io(H(e.state.schema).cell,n))]};let t=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),o=V.get(t).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=Lo(r,o.right-o.left,o.bottom-o.top),Vo(e.state,e.dispatch,a,o,r),!0}if(r){let t=Ua(e.state),n=t.start(-1);return Vo(e.state,e.dispatch,n,V.get(t.node(-1)).findCell(t.pos-n),r),!0}return!1}function Jo(e,t){if(t.button!=0||t.ctrlKey||t.metaKey)return;let n=Xo(e,t.target),r;if(t.shiftKey&&e.state.selection instanceof U)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&n&&(r=Ba(e.state.selection.$anchor))!=null&&Zo(e,t)?.pos!=r.pos)i(r,t),t.preventDefault();else if(!n)return;function i(t,n){let r=Zo(e,n),i=za.getState(e.state)==null;if(!r||!qa(t,r)){if(i)r=t;else return}let a=new U(t,r);if(i||!e.state.selection.eq(a)){let n=e.state.tr.setSelection(a);i&&n.setMeta(za,t.pos),e.dispatch(n)}}function a(){e.root.removeEventListener(`mouseup`,a),e.root.removeEventListener(`dragstart`,a),e.root.removeEventListener(`mousemove`,o),za.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(za,-1))}function o(r){let o=r,s=za.getState(e.state),c;if(s!=null)c=e.state.doc.resolve(s);else if(Xo(e,o.target)!=n&&(c=Zo(e,t),!c))return a();c&&i(c,o)}e.root.addEventListener(`mouseup`,a),e.root.addEventListener(`dragstart`,a),e.root.addEventListener(`mousemove`,o)}function Yo(e,t,n){if(!(e.state.selection instanceof l))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole==`cell`||a.type.spec.tableRole==`header_cell`){let a=r.before(i),o=t==`vert`?n>0?`down`:`up`:n>0?`right`:`left`;return e.endOfTextblock(o)?a:null}}return null}function Xo(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName==`TD`||t.nodeName==`TH`)return t;return null}function Zo(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&Ba(e.state.doc.resolve(r))||Ba(e.state.doc.resolve(i))}var Qo=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`)),this.table.style.setProperty(`--default-cell-min-width`,`${t}px`),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),$o(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type==this.node.type&&(this.node=e,$o(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type==`attributes`&&(e.target==this.table||this.colgroup.contains(e.target))}};function $o(e,t,n,r,i,a){let o=0,s=!0,c=t.firstChild,l=e.firstChild;if(l){for(let e=0,n=0;e<l.childCount;e++){let{colspan:u,colwidth:d}=l.child(e).attrs;for(let e=0;e<u;e++,n++){let l=i==n?a:d&&d[e],u=l?l+`px`:``;if(o+=l||r,l||(s=!1),c)c.style.width!=u&&(c.style.width=u),c=c.nextSibling;else{let e=document.createElement(`col`);e.style.width=u,t.appendChild(e)}}}for(;c;){var u;let e=c.nextSibling;(u=c.parentNode)==null||u.removeChild(c),c=e}s?(n.style.width=o+`px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=o+`px`)}}var es=new _(`tableColumnResizing`);function ts({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=Qo,lastColumnResizable:i=!0}={}){let a=new D({key:es,state:{init(e,t){var i;let o=(i=a.spec)==null||(i=i.props)==null?void 0:i.nodeViews,s=H(t.schema).table.name;return r&&o&&(o[s]=(e,t)=>new r(e,n,t)),new ns(-1,!1)},apply(e,t){return t.apply(e)}},props:{attributes:e=>{let t=es.getState(e);return t&&t.activeHandle>-1?{class:`resize-cursor`}:{}},handleDOMEvents:{mousemove:(t,n)=>{rs(t,n,e,i)},mouseleave:e=>{is(e)},mousedown:(e,r)=>{as(e,r,t,n)}},decorations:e=>{let t=es.getState(e);if(t&&t.activeHandle>-1)return ms(e,t.activeHandle)},nodeViews:{}}});return a}var ns=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let n=this,r=t.getMeta(es);if(r&&r.setHandle!=null)return new e(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new e(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return Ga(t.doc.resolve(r))||(r=-1),new e(r,n.dragging)}return n}};function rs(e,t,n,r){if(!e.editable)return;let i=es.getState(e.state);if(i&&!i.dragging){let a=ss(t.target),o=-1;if(a){let{left:r,right:i}=a.getBoundingClientRect();t.clientX-r<=n?o=cs(e,t,`left`,n):i-t.clientX<=n&&(o=cs(e,t,`right`,n))}if(o!=i.activeHandle){if(!r&&o!==-1){let t=e.state.doc.resolve(o),n=t.node(-1),r=V.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}us(e,o)}}}function is(e){if(!e.editable)return;let t=es.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&us(e,-1)}function as(e,t,n,r){if(!e.editable)return!1;let i=e.dom.ownerDocument.defaultView??window,a=es.getState(e.state);if(!a||a.activeHandle==-1||a.dragging)return!1;let o=e.state.doc.nodeAt(a.activeHandle),s=os(e,a.activeHandle,o.attrs);e.dispatch(e.state.tr.setMeta(es,{setDragging:{startX:t.clientX,startWidth:s}}));function c(t){i.removeEventListener(`mouseup`,c),i.removeEventListener(`mousemove`,l);let r=es.getState(e.state);r?.dragging&&(ds(e,r.activeHandle,ls(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(es,{setDragging:null})))}function l(t){if(!t.which)return c(t);let i=es.getState(e.state);if(i&&i.dragging){let a=ls(i.dragging,t,n);fs(e,i.activeHandle,a,r)}}return fs(e,a.activeHandle,s,r),i.addEventListener(`mouseup`,c),i.addEventListener(`mousemove`,l),t.preventDefault(),!0}function os(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let a=e.domAtPos(t),o=a.node.childNodes[a.offset].offsetWidth,s=n;if(r)for(let e=0;e<n;e++)r[e]&&(o-=r[e],s--);return o/s}function ss(e){for(;e&&e.nodeName!=`TD`&&e.nodeName!=`TH`;)e=e.classList&&e.classList.contains(`ProseMirror`)?null:e.parentNode;return e}function cs(e,t,n,r){let i=n==`right`?-r:r,a=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!a)return-1;let{pos:o}=a,s=Ba(e.state.doc.resolve(o));if(!s)return-1;if(n==`right`)return s.pos;let c=V.get(s.node(-1)),l=s.start(-1),u=c.map.indexOf(s.pos-l);return u%c.width==0?-1:l+c.map[u-1]}function ls(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function us(e,t){e.dispatch(e.state.tr.setMeta(es,{setHandle:t}))}function ds(e,t,n){let r=e.state.doc.resolve(t),i=r.node(-1),a=V.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,c=e.state.tr;for(let e=0;e<a.height;e++){let t=e*a.width+s;if(e&&a.map[t]==a.map[t-a.width])continue;let r=a.map[t],l=i.nodeAt(r).attrs,u=l.colspan==1?0:s-a.colCount(r);if(l.colwidth&&l.colwidth[u]==n)continue;let d=l.colwidth?l.colwidth.slice():ps(l.colspan);d[u]=n,c.setNodeMarkup(o+r,null,{...l,colwidth:d})}c.docChanged&&e.dispatch(c)}function fs(e,t,n,r){let i=e.state.doc.resolve(t),a=i.node(-1),o=i.start(-1),s=V.get(a).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1,c=e.domAtPos(i.start(-1)).node;for(;c&&c.nodeName!=`TABLE`;)c=c.parentNode;c&&$o(a,c.firstChild,c,r,s,n)}function ps(e){return Array(e).fill(0)}function ms(e,t){let n=[],r=e.doc.resolve(t),i=r.node(-1);if(!i)return s.empty;let a=V.get(i),o=r.start(-1),l=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let t=0;t<a.height;t++){let r=l+t*a.width;if((l==a.width-1||a.map[r]!=a.map[r+1])&&(t==0||a.map[r]!=a.map[r-a.width])){let t=a.map[r],s=o+t+i.nodeAt(t).nodeSize-1,l=document.createElement(`div`);l.className=`column-resize-handle`,es.getState(e)?.dragging&&n.push(c.node(o+t,o+t+i.nodeAt(t).nodeSize,{class:`column-resize-dragging`})),n.push(c.widget(s,l))}}return s.create(e.doc,n)}function hs({allowTableNodeSelection:e=!1}={}){return new D({key:za,state:{init(){return null},apply(e,t){let n=e.getMeta(za);if(n!=null)return n==-1?null:n;if(t==null||!e.docChanged)return t;let{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:$a,handleDOMEvents:{mousedown:Jo},createSelectionBetween(e){return za.getState(e.state)==null?null:e.state.selection},handleTripleClick:Ko,handleKeyDown:Ho,handlePaste:qo},appendTransaction(t,n,r){return no(r,ao(r,n),e)}})}function gs(e){return e===`left`||e===`right`||e===`center`?e:null}function _s(e){let t=(e.style.textAlign||``).trim().toLowerCase(),n=(e.getAttribute(`align`)||``).trim().toLowerCase();return gs(t||n)}function vs(e){return gs(e?.align)}function ys(){return{default:null,parseHTML:e=>_s(e),renderHTML:e=>{let t=gs(e.align);return we(t)?{style:`text-align: ${t}`}:{}}}}function bs(e){let t=e.parentElement,n=e.closest(`table`);if(!t||!n)return null;let r=Array.from(t.children).indexOf(e),i=n.querySelectorAll(`colgroup > col`)[r]?.getAttribute(`width`);return i?[parseInt(i,10)]:null}function xs(e){let t=e.getAttribute(`colwidth`);return t?t.split(`,`).map(e=>parseInt(e,10)):bs(e)}var Ss=/[ \t\r\n\f]+/g;function Cs(e){return e.children.length>0?!1:(e.textContent??``).replace(Ss,``)===``}function ws(e){let t=e.createAndFill();if(!t)throw Error(`[tiptap error]: "${e.name}" has no default content to backfill.`);return t.content}function Ts(e,t,n){if(!(n in t))return;let r=t[n];(r===1||r===`1`||r==null)&&delete e[n]}var Es=g.create({name:`tableCell`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:xs},align:ys()}},tableRole:`cell`,isolating:!0,parseHTML(){return[{tag:`td`,getAttrs:e=>Cs(e)?{}:!1,getContent:(e,t)=>ws(t.nodes[this.name])},{tag:`td`}]},renderHTML({HTMLAttributes:e}){let t=O(this.options.HTMLAttributes,e);return Ts(t,e,`colspan`),Ts(t,e,`rowspan`),[`td`,t,0]}}),Ds=g.create({name:`tableHeader`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:xs},align:ys()}},tableRole:`header_cell`,isolating:!0,parseHTML(){return[{tag:`th`,getAttrs:e=>Cs(e)?{}:!1,getContent:(e,t)=>ws(t.nodes[this.name])},{tag:`th`}]},renderHTML({HTMLAttributes:e}){let t=O(this.options.HTMLAttributes,e);return Ts(t,e,`colspan`),Ts(t,e,`rowspan`),[`th`,t,0]}}),Os=g.create({name:`tableRow`,addOptions(){return{HTMLAttributes:{}}},content:`(tableCell | tableHeader)*`,tableRole:`row`,parseHTML(){return[{tag:`tr`}]},renderHTML({HTMLAttributes:e}){return[`tr`,O(this.options.HTMLAttributes,e),0]}});function ks(e,t){return t?[`width`,`${Math.max(t,e)}px`]:[`min-width`,`${e}px`]}function As(e,t,n,r,i,a){let o=0,s=!0,c=t.firstChild,l=e.firstChild;if(l!==null)for(let e=0,n=0;e<l.childCount;e+=1){let{colspan:u,colwidth:d}=l.child(e).attrs;for(let e=0;e<u;e+=1,n+=1){let l=i===n?a:d&&d[e],u=l?`${l}px`:``;if(o+=l||r,l||(s=!1),c){if(c.style.width!==u){let[e,t]=ks(r,l);c.style.setProperty(e,t)}c=c.nextSibling}else{let e=document.createElement(`col`),[n,i]=ks(r,l);e.style.setProperty(n,i),t.appendChild(e)}}}for(;c;){var u;let e=c.nextSibling;(u=c.parentNode)==null||u.removeChild(c),c=e}let d=e.attrs.style&&typeof e.attrs.style==`string`&&/\bwidth\s*:/i.test(e.attrs.style);s&&!d?(n.style.width=`${o}px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=`${o}px`)}var js=class{constructor(e,t,n,r={}){this.node=e,this.cellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`));for(let[e,t]of Object.entries(r))t!=null&&(e===`style`?this.table.style.cssText=String(t):this.table.setAttribute(e,String(t)));e.attrs.style&&(this.table.style.cssText=e.attrs.style),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),As(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.sameMarkup(this.node)?(this.node=e,As(e,this.colgroup,this.table,this.cellMinWidth),!0):!1}ignoreMutation(e){let t=e.target,n=this.dom.contains(t),r=this.contentDOM.contains(t);return!(!n||r||e.type!==`attributes`&&e.type!==`childList`&&e.type!==`characterData`)}};function Ms(e,t,n,r){let i=0,a=!0,o=[],s=e.firstChild;if(!s)return{};for(let e=0,c=0;e<s.childCount;e+=1){let{colspan:l,colwidth:u}=s.child(e).attrs;for(let e=0;e<l;e+=1,c+=1){let s=n===c?r:u&&u[e];i+=s||t,s||(a=!1);let[l,d]=ks(t,s);o.push([`col`,{style:`${l}: ${d}`}])}}let c=a?`${i}px`:``,l=a?``:`${i}px`;return{colgroup:[`colgroup`,{},...o],tableWidth:c,tableMinWidth:l}}function Ns(e,t){return t?e.createChecked(null,t):e.createAndFill()}function Ps(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;let t={};return Object.keys(e.nodes).forEach(n=>{let r=e.nodes[n];r.spec.tableRole&&(t[r.spec.tableRole]=r)}),e.cached.tableNodeTypes=t,t}function Fs(e,t,n,r,i){let a=Ps(e),o=[],s=[];for(let e=0;e<n;e+=1){let e=Ns(a.cell,i);if(e&&s.push(e),r){let e=Ns(a.header_cell,i);e&&o.push(e)}}let c=[];for(let e=0;e<t;e+=1)c.push(a.row.createChecked(null,r&&e===0?o:s));return a.table.createChecked(null,c)}function Is(e){return e instanceof U}var Ls=({editor:e})=>{let{selection:t}=e.state;if(!Is(t))return!1;let n=0;return u(t.ranges[0].$from,e=>e.type.name===`table`)?.node.descendants(e=>{if(e.type.name===`table`)return!1;[`tableCell`,`tableHeader`].includes(e.type.name)&&(n+=1)}),n===t.ranges.length&&(e.commands.deleteTable(),!0)};function Rs(e,t){let n=e.mapping.map(t);if(u(e.selection.$from,e=>e.type.name===`table`)?.pos===n)return;let r=e.doc.nodeAt(n);if(!r)return;let i=n+r.nodeSize-1;e.setSelection(l.near(e.doc.resolve(i),-1))}function zs(e){let t=``,n=0;for(;n<e.length;){if(e[n]===`\\`&&n+1<e.length){t+=e[n]+e[n+1],n+=2;continue}if(e[n]!=="`"){t+=e[n++];continue}let r=0;for(;n+r<e.length&&e[n+r]==="`";)r+=1;let i=n+r,a=!1;for(;i<e.length;){if(e[i]!=="`"){i+=1;continue}let o=0;for(;i+o<e.length&&e[i+o]==="`";)o+=1;if(o===r){let o=e.slice(n+r,i);t+=e.slice(n,n+r)+o.replace(/\\\||\|/g,e=>e===`|`?`\\|`:e)+e.slice(i,i+r),n=i+r,a=!0;break}i+=o}a||(t+=e.slice(n,n+r),n+=r)}return t}function Bs(e){return e.split(`
|
|
41
41
|
`).map(e=>!e.includes(`|`)||!e.includes("`")?e:zs(e)).join(`
|
|
42
42
|
`)}function Vs(e){return(e||``).replaceAll(``,` `).replace(/\s+/g,` `).trim()}function Hs(e,t){return t?e.split(t).join(`
|
|
43
43
|
`):e}function Us(e){return e.replace(/\\.|\|/g,e=>e===`|`?`\\|`:e)}function Ws(e,t,n={}){if(!e||!e.content||e.content.length===0)return``;let r=[];e.content.forEach(e=>{let i=[];e.content&&e.content.forEach(e=>{let r=``;r=e.content&&Array.isArray(e.content)&&e.content.length>1?e.content.map(e=>Hs(t.renderChildren(e),n.cellLineSeparator)).join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,s as t}from"./
|
|
1
|
+
import{r as e,s as t}from"./CsakM5cG.js";import{gn as n}from"./wlpNGAAZ.js";import{n as r}from"./BW3xJdEx.js";var i=e({vector:{brand:{title:`Vector`},basePath:``,fields:{},inputs:{},commandPalette:!0,widgets:{},usersResource:null,locale:`en`,idleMinutes:30,messages:{},pages:{}}}),a=r(i,{nuxt:{}});function o(){let e=t();return e._appConfig||=n(a),e._appConfig}export{o as t};
|