@tempots/beatui 0.30.2 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/2019-BY_FFnZU.cjs +1 -0
- package/dist/{2019-Cd9nHhvg.js → 2019-C660mMK6.js} +9 -10
- package/dist/{2020-CyKJpuK6.js → 2020-C3P-aGet.js} +30 -31
- package/dist/2020-Cyyhc8pv.cjs +1 -0
- package/dist/{ar-Dz8Mg5la.js → ar-BUxQ3yNv.js} +30 -15
- package/dist/ar-DcFl4tkv.cjs +1 -0
- package/dist/auth/index.cjs.js +1 -1
- package/dist/auth/index.es.js +85 -84
- package/dist/beatui.css +32 -6
- package/dist/beatui.tailwind.css +32 -6
- package/dist/{de-ToWTQGEo.js → de-CKKQr2-K.js} +27 -12
- package/dist/de-DEUS3n0J.cjs +1 -0
- package/dist/{es-CruxS0Tz.js → es-C5VUn_X1.js} +27 -12
- package/dist/es-CIeoDpkc.cjs +1 -0
- package/dist/{fa-Cf0NZLWA.js → fa-Cs2LZsfr.js} +30 -15
- package/dist/fa-gXa9Xdjn.cjs +1 -0
- package/dist/fr-6SpJ-gVV.cjs +1 -0
- package/dist/{fr-YKXmqMGr.js → fr-Dlw8mKFp.js} +20 -5
- package/dist/{he-D8ZOduPw.js → he-Cm4NxsyE.js} +30 -15
- package/dist/he-D9cwxZOb.cjs +1 -0
- package/dist/hi-CNRHnMsQ.cjs +1 -0
- package/dist/{hi-CIamzVEf.js → hi-Cjz1aQX2.js} +30 -15
- package/dist/index-BI5w0jSz.js +2707 -0
- package/dist/index-Bv2gn_kV.cjs +4 -0
- package/dist/index-C-FUCwXi.js +14275 -0
- package/dist/index-CKyH3jwP.cjs +1 -0
- package/dist/index-CXY0yKJD.cjs +34 -0
- package/dist/{index-O9BwR_8P.cjs → index-CYY_JLSN.cjs} +1 -1
- package/dist/index-DKy2mZws.cjs +1 -0
- package/dist/{index-B2079wM-.js → index-DjShJtXp.js} +15 -15
- package/dist/index-DwyUOY3r.js +68 -0
- package/dist/{index-DDpjzV7E.js → index-Jd2O_Iux.js} +304 -307
- package/dist/{index-DFJed4ks.js → index-_Kh76-c2.js} +1 -1
- package/dist/index-klVI8k8O.cjs +8 -0
- package/dist/index.cjs.js +4 -4
- package/dist/index.es.js +1123 -1229
- package/dist/it-DvBJ31Ls.cjs +1 -0
- package/dist/{it-Bn7tG_KC.js → it-iuFeIEsO.js} +29 -14
- package/dist/{ja-i1ULXeiu.js → ja-D6Dd96v-.js} +25 -10
- package/dist/ja-FKJGj5My.cjs +1 -0
- package/dist/json-schema/index.cjs.js +1 -1
- package/dist/json-schema/index.es.js +1 -1
- package/dist/{ko-BpKDmtvY.js → ko-C8GOsfIU.js} +30 -15
- package/dist/ko-PqVOGPUi.cjs +1 -0
- package/dist/markdown/index.cjs.js +1 -2
- package/dist/markdown/index.es.js +4 -420
- package/dist/{modal-DvGSDVSv.js → modal-CuhK7DqK.js} +14 -13
- package/dist/modal-RQtwnFy9.cjs +1 -0
- package/dist/{nl-Cs4PDWCJ.js → nl-Ct2cyWWi.js} +31 -16
- package/dist/nl-DAhT0vfu.cjs +1 -0
- package/dist/notice-BnX2sRrK.cjs +2 -0
- package/dist/notice-Dz_BJg8D.js +1467 -0
- package/dist/{pl-BFLNf991.js → pl-DewgRE-k.js} +31 -16
- package/dist/pl-JgD0mCRa.cjs +1 -0
- package/dist/prosemirror/index.cjs.js +1 -0
- package/dist/prosemirror/index.es.js +6 -0
- package/dist/prosemirror.css +294 -0
- package/dist/pt-BkoMl_PC.cjs +1 -0
- package/dist/{pt-BRZeOkcE.js → pt-CNyp2zeW.js} +31 -16
- package/dist/ru-9OW0HQFS.cjs +1 -0
- package/dist/{ru-KI7Gowz-.js → ru-U6PdSzha.js} +35 -20
- package/dist/styles-url-CF_019NX.js +4 -0
- package/dist/styles-url-DhmSan6u.cjs +1 -0
- package/dist/toolbar-D7fDCmUn.cjs +1 -0
- package/dist/toolbar-DTh9Ouhs.js +118 -0
- package/dist/{tr-CYk8Fua5.js → tr-CQVvooxi.js} +28 -13
- package/dist/tr-DsOaoQqh.cjs +1 -0
- package/dist/translations-BDRano6u.cjs +1 -0
- package/dist/{translations-DdNHXAWr.js → translations-Cic51rHH.js} +1 -1
- package/dist/translations-D4PjDB1t.js +831 -0
- package/dist/translations-DDFTHcX3.cjs +1 -0
- package/dist/types/beatui-i18n/default.d.ts +14 -0
- package/dist/types/beatui-i18n/locales/en.d.ts +14 -0
- package/dist/types/beatui-i18n/translations.d.ts +14 -0
- package/dist/types/components/form/input/input-container.d.ts +3 -1
- package/dist/types/components/form/input/input-options.d.ts +6 -0
- package/dist/types/components/prosemirror/etoolbar-button.d.ts +11 -0
- package/dist/types/components/prosemirror/etoolbar-group.d.ts +4 -0
- package/dist/types/components/prosemirror/link-control.d.ts +12 -0
- package/dist/types/components/prosemirror/prosemirror-markdown-input.d.ts +76 -0
- package/dist/types/components/prosemirror/prosemirror-toolbar.d.ts +18 -0
- package/dist/types/components/prosemirror/utils.d.ts +12 -0
- package/dist/types/prosemirror/index.d.ts +2 -0
- package/dist/{ur-BIcZGLWt.js → ur-C3LypxEh.js} +30 -15
- package/dist/ur-C8v4y2tI.cjs +1 -0
- package/dist/utils-D8WljbbZ.cjs +1 -0
- package/dist/{utils-D1op9R8_.js → utils-DY9kZecl.js} +74 -73
- package/dist/vi-DzLo7qhK.cjs +1 -0
- package/dist/{vi-BeK62QeB.js → vi-M5ObJg3d.js} +19 -4
- package/dist/zh-BXk4IZBo.cjs +1 -0
- package/dist/{zh-Dt6yWDu2.js → zh-DGA8R46s.js} +32 -17
- package/package.json +20 -13
- package/dist/2019-Bl1mhxeM.cjs +0 -1
- package/dist/2020-BKqFJLj6.cjs +0 -1
- package/dist/_commonjsHelpers-C6fGbg64.js +0 -6
- package/dist/_commonjsHelpers-DwGv2jUC.cjs +0 -1
- package/dist/apl-B2DGVGxc.js +0 -76
- package/dist/apl-M-DNMvvR.cjs +0 -1
- package/dist/ar-CbsALGhG.cjs +0 -1
- package/dist/asciiarmor-2LVJmxlE.js +0 -34
- package/dist/asciiarmor-BMx3XVjX.cjs +0 -1
- package/dist/asn1-OOsVM4yU.cjs +0 -1
- package/dist/asn1-jKiBa2Ya.js +0 -95
- package/dist/asterisk-B1QUaW1C.cjs +0 -1
- package/dist/asterisk-DS281yxp.js +0 -271
- package/dist/brainfuck-BjUlYKdF.cjs +0 -1
- package/dist/brainfuck-C_p9pTT8.js +0 -34
- package/dist/clike-BEMIzMUI.cjs +0 -1
- package/dist/clike-DGTaUp48.js +0 -620
- package/dist/clojure-Ap_IXD2I.cjs +0 -1
- package/dist/clojure-CCKyeQKf.js +0 -800
- package/dist/cmake-C4D5_VmS.cjs +0 -1
- package/dist/cmake-CuaCgAKt.js +0 -28
- package/dist/cobol-BlTKFDRj.js +0 -72
- package/dist/cobol-Du-cT2hr.cjs +0 -1
- package/dist/coffeescript-BVCvwO8I.js +0 -179
- package/dist/coffeescript-DDFAj2ea.cjs +0 -1
- package/dist/commonlisp-CXBBRCTx.cjs +0 -1
- package/dist/commonlisp-D_kxz07b.js +0 -75
- package/dist/crystal-D309uH6_.js +0 -217
- package/dist/crystal-DAFWRDbh.cjs +0 -1
- package/dist/css-BkF-NPzE.js +0 -1553
- package/dist/css-DzFJyRJ8.cjs +0 -1
- package/dist/cypher-BMq4Fwjl.js +0 -68
- package/dist/cypher-BN0-oCze.cjs +0 -1
- package/dist/d-BHsqGcfm.cjs +0 -1
- package/dist/d-BZcgY6La.js +0 -127
- package/dist/de-MO-u5hoD.cjs +0 -1
- package/dist/diff-CemTHKfk.cjs +0 -1
- package/dist/diff-Cg9d_RX2.js +0 -18
- package/dist/dockerfile-BBTH3voH.cjs +0 -1
- package/dist/dockerfile-DIy8NleC.js +0 -194
- package/dist/dtd-ChoVQPwv.cjs +0 -1
- package/dist/dtd-CtLokQ-U.js +0 -84
- package/dist/dylan-QYeExnWK.js +0 -234
- package/dist/dylan-apTQIgUA.cjs +0 -1
- package/dist/ebnf-DUPDuY4r.js +0 -78
- package/dist/ebnf-LYmLy17h.cjs +0 -1
- package/dist/ecl-C7WNQq7-.cjs +0 -1
- package/dist/ecl-CiXN-g_D.js +0 -121
- package/dist/eiffel-BJThA8RG.cjs +0 -1
- package/dist/eiffel-yQhjl4T1.js +0 -110
- package/dist/elm-CNT9vbN0.js +0 -108
- package/dist/elm-CcXP9T36.cjs +0 -1
- package/dist/erlang-B6mpcObI.cjs +0 -1
- package/dist/erlang-CFOYdy9e.js +0 -487
- package/dist/es-CqkWVfis.cjs +0 -1
- package/dist/fa-DR8j7v-l.cjs +0 -1
- package/dist/factor-B-tsx9yW.cjs +0 -1
- package/dist/factor-DDOC7X6P.js +0 -65
- package/dist/fcl-BzAKklXo.cjs +0 -1
- package/dist/fcl-CPC2WYrI.js +0 -103
- package/dist/forth-BmxRyE9S.js +0 -60
- package/dist/forth-CPAzyZ_n.cjs +0 -1
- package/dist/fortran-9bvPyrOW.js +0 -442
- package/dist/fortran-DHiTlGV1.cjs +0 -1
- package/dist/fr-ClK0mWTO.cjs +0 -1
- package/dist/gas-BiPtGF2E.cjs +0 -1
- package/dist/gas-cpmYfFX2.js +0 -183
- package/dist/gherkin-CJuwpceU.js +0 -34
- package/dist/gherkin-Djo7Y51D.cjs +0 -1
- package/dist/groovy-BMVITiCm.cjs +0 -1
- package/dist/groovy-DZeT_VM-.js +0 -146
- package/dist/haskell-Bvt3Qq1t.js +0 -375
- package/dist/haskell-CngODaW-.cjs +0 -1
- package/dist/haxe-70NVW1pR.js +0 -359
- package/dist/haxe-Dyk-piTh.cjs +0 -1
- package/dist/he-DeJMBRTP.cjs +0 -1
- package/dist/hi-C9Anq8Ae.cjs +0 -1
- package/dist/http-BkLifcnL.cjs +0 -1
- package/dist/http-D9LttvKF.js +0 -44
- package/dist/idl-B6TRFYjl.js +0 -947
- package/dist/idl-FmHDmsE-.cjs +0 -1
- package/dist/index-0dpJGQbC.js +0 -94
- package/dist/index-52kzSRNb.cjs +0 -1
- package/dist/index-5a6_6F3Z.cjs +0 -6
- package/dist/index-BGHGZg_7.js +0 -552
- package/dist/index-BMn-7Ble.js +0 -1307
- package/dist/index-BR0F2BVZ.cjs +0 -1
- package/dist/index-BlCmv2EJ.cjs +0 -1
- package/dist/index-BlamLFdS.js +0 -76
- package/dist/index-By8a3eg5.cjs +0 -1
- package/dist/index-C0sjoDdy.js +0 -309
- package/dist/index-C9RMQY3t.cjs +0 -1
- package/dist/index-CDBeAhhM.js +0 -289
- package/dist/index-CH2HgQJF.cjs +0 -1
- package/dist/index-CT9YDHSn.js +0 -74
- package/dist/index-CUZnWZnQ.cjs +0 -3
- package/dist/index-CVNvgkJN.js +0 -342
- package/dist/index-C_NT6gCL.cjs +0 -1
- package/dist/index-CafCsH0Z.cjs +0 -1
- package/dist/index-Cei6J0b_.cjs +0 -8
- package/dist/index-CmcOKNW2.js +0 -302
- package/dist/index-CvpdOKX2.js +0 -136
- package/dist/index-CxE1PN5L.cjs +0 -1
- package/dist/index-D2BpI4Zz.cjs +0 -2
- package/dist/index-D40RPDMJ.cjs +0 -1
- package/dist/index-D5iq4kyE.cjs +0 -1
- package/dist/index-DFzKuRY8.cjs +0 -1
- package/dist/index-DIO9qaw5.cjs +0 -1
- package/dist/index-DIR2rO5B.cjs +0 -1
- package/dist/index-DPnQDm6f.js +0 -138
- package/dist/index-DU0jpFGR.cjs +0 -1
- package/dist/index-DUvVsNDG.cjs +0 -13
- package/dist/index-DVZnPL32.js +0 -953
- package/dist/index-DiYfLAVQ.js +0 -554
- package/dist/index-DnIheaHS.js +0 -251
- package/dist/index-Dp2K8q6O.cjs +0 -7
- package/dist/index-DrlNzz-e.js +0 -59
- package/dist/index-Dx9UDsJi.cjs +0 -1
- package/dist/index-DxY-AOQA.js +0 -157
- package/dist/index-Mmd0YHPJ.js +0 -960
- package/dist/index-NyiYUSW3.js +0 -101
- package/dist/index-alBMysbQ.js +0 -1874
- package/dist/index-lEkIbMCl.js +0 -612
- package/dist/index-qwDdlmIi.js +0 -270
- package/dist/index-x3mhc_C_.cjs +0 -1
- package/dist/it-5n3LuTHe.cjs +0 -1
- package/dist/ja-Bdp4_B8-.cjs +0 -1
- package/dist/javascript-C2yteZeJ.js +0 -691
- package/dist/javascript-DngSGg_0.cjs +0 -1
- package/dist/jinja2-DnB6dQmV.js +0 -154
- package/dist/jinja2-wbVbDTNi.cjs +0 -1
- package/dist/julia-DA67Qw9E.cjs +0 -1
- package/dist/julia-DpvXAuO6.js +0 -241
- package/dist/ko-B5SwKB-j.cjs +0 -1
- package/dist/livescript-Bg3URadp.cjs +0 -1
- package/dist/livescript-CanGTf8u.js +0 -272
- package/dist/lua-CIsxjGwi.cjs +0 -1
- package/dist/lua-XplVlWi_.js +0 -217
- package/dist/mathematica-BG089QIc.cjs +0 -1
- package/dist/mathematica-jaRHnSxC.js +0 -35
- package/dist/mbox-BctzC1hL.js +0 -76
- package/dist/mbox-CySolFFZ.cjs +0 -1
- package/dist/milkdown/index.cjs.js +0 -1
- package/dist/milkdown/index.es.js +0 -4
- package/dist/milkdown-input-Bkgdi-Bv.cjs +0 -944
- package/dist/milkdown-input-CciSI_a5.js +0 -63967
- package/dist/milkdown-url-D99P-nA-.js +0 -4
- package/dist/milkdown-url-DqoUZH3u.cjs +0 -1
- package/dist/milkdown.css +0 -1914
- package/dist/mirc-BfqEffzk.cjs +0 -1
- package/dist/mirc-CFBPAOaF.js +0 -72
- package/dist/mllike-BSnXJBGA.js +0 -272
- package/dist/mllike-QUjwI6zq.cjs +0 -1
- package/dist/modal-CAKAT7wv.cjs +0 -1
- package/dist/modelica-B6Zhcb-M.cjs +0 -1
- package/dist/modelica-vUgVs--1.js +0 -93
- package/dist/mscgen-BToym4Bs.cjs +0 -1
- package/dist/mscgen-Cpl0NYLN.js +0 -104
- package/dist/mumps-CQoS1kWX.js +0 -25
- package/dist/mumps-wfyQdxSu.cjs +0 -1
- package/dist/nginx-CwqyBUfA.cjs +0 -1
- package/dist/nginx-zDPm3Z74.js +0 -89
- package/dist/nl-Cenl4nr6.cjs +0 -1
- package/dist/notice-DBME6bFw.cjs +0 -2
- package/dist/notice-DVEacWKt.js +0 -2275
- package/dist/nsis-DPj2fUaP.cjs +0 -1
- package/dist/nsis-fePjrhq7.js +0 -62
- package/dist/ntriples-CsNjv2QF.js +0 -79
- package/dist/ntriples-DgwJmozm.cjs +0 -1
- package/dist/octave-1pkKrgAA.cjs +0 -1
- package/dist/octave-C8PmmSRH.js +0 -143
- package/dist/oz-BXOZCt0U.cjs +0 -1
- package/dist/oz-Ce8aN8oE.js +0 -151
- package/dist/pascal-De0D6mP7.js +0 -77
- package/dist/pascal-DtY2LEkJ.cjs +0 -1
- package/dist/perl-B4bSCe1C.js +0 -915
- package/dist/perl-CVDWbEju.cjs +0 -1
- package/dist/pig-D24Z8EXi.js +0 -54
- package/dist/pig-DMByOrnr.cjs +0 -1
- package/dist/pl-7xYNCk-v.cjs +0 -1
- package/dist/powershell-BaoYaFvj.cjs +0 -1
- package/dist/powershell-DkYVfTzP.js +0 -249
- package/dist/preprocess-CvkqwVNt.cjs +0 -3
- package/dist/preprocess-D898zxsP.js +0 -2295
- package/dist/properties-DXHJZ3WE.cjs +0 -1
- package/dist/properties-Dn9wna3M.js +0 -26
- package/dist/protobuf-BKhXdfH6.cjs +0 -1
- package/dist/protobuf-BPIjwpzm.js +0 -49
- package/dist/pt-DOLL0Jpj.cjs +0 -1
- package/dist/pug-CwAQJzGR.js +0 -248
- package/dist/pug-kEfRDOiF.cjs +0 -1
- package/dist/puppet-8mAyuMbW.cjs +0 -1
- package/dist/puppet-nyd4dhjf.js +0 -45
- package/dist/python-BkR3uSy8.js +0 -313
- package/dist/python-D-iU6WXz.cjs +0 -1
- package/dist/q-BPQ45Nxu.cjs +0 -1
- package/dist/q-DXjKs-tC.js +0 -83
- package/dist/r-LKEuhEGI.js +0 -104
- package/dist/r-r2_EZsON.cjs +0 -1
- package/dist/rpm-IznJm2Xc.js +0 -57
- package/dist/rpm-YK81m3qU.cjs +0 -1
- package/dist/ru-DoS9XuqG.cjs +0 -1
- package/dist/ruby-CcYfvIk6.js +0 -228
- package/dist/ruby-Cn1sFkZF.cjs +0 -1
- package/dist/sas-7E8yHoCW.js +0 -105
- package/dist/sas-DAGcJy94.cjs +0 -1
- package/dist/scheme-B0ZrbojV.cjs +0 -1
- package/dist/scheme-DjibxsNh.js +0 -124
- package/dist/shell-BMYo43V6.cjs +0 -1
- package/dist/shell-C0C2sNA_.js +0 -182
- package/dist/sieve-Bwz7vjP5.js +0 -72
- package/dist/sieve-CIYW-b_H.cjs +0 -1
- package/dist/simple-mode-B0dvCdAA.js +0 -89
- package/dist/simple-mode-BIKNPBes.cjs +0 -1
- package/dist/smalltalk-Bhddl2pB.js +0 -48
- package/dist/smalltalk-CSslY-3i.cjs +0 -1
- package/dist/solr-A1kSnAwJ.cjs +0 -1
- package/dist/solr-BNlsLglM.js +0 -41
- package/dist/sparql-DnHMBLLY.cjs +0 -1
- package/dist/sparql-FarWu_Gb.js +0 -197
- package/dist/spreadsheet-B7_BK8hB.cjs +0 -1
- package/dist/spreadsheet-C-cy4P5N.js +0 -49
- package/dist/sql-9VmIWHrZ.cjs +0 -1
- package/dist/sql-CfG5lQ3l.js +0 -282
- package/dist/stex-B4wyjEnp.cjs +0 -1
- package/dist/stex-Du4h4KAU.js +0 -129
- package/dist/stylus-CAdqWld3.js +0 -250
- package/dist/stylus-D6GYOT3Z.cjs +0 -1
- package/dist/swift-DGw6Cgu8.cjs +0 -1
- package/dist/swift-DSxqR9R6.js +0 -230
- package/dist/tcl-ByLXbQFo.cjs +0 -1
- package/dist/tcl-xfoLljhY.js +0 -81
- package/dist/textile-D1AWE-pc.js +0 -295
- package/dist/textile-iryw-lTw.cjs +0 -1
- package/dist/tiddlywiki-5wqsXtSk.js +0 -155
- package/dist/tiddlywiki-D8IJz1k7.cjs +0 -1
- package/dist/tiki-C5p5KSQK.cjs +0 -1
- package/dist/tiki-__Kn3CeS.js +0 -181
- package/dist/toml-3ZsH_4Qa.cjs +0 -1
- package/dist/toml-BHiuTcfn.js +0 -49
- package/dist/tr-BVmoz40w.cjs +0 -1
- package/dist/translations-Dv56lQia.cjs +0 -1
- package/dist/troff-D-3QCOYN.cjs +0 -1
- package/dist/troff-D2UO-fKf.js +0 -35
- package/dist/ttcn-Bsa4sfRm.js +0 -123
- package/dist/ttcn-C2MXAqcM.cjs +0 -1
- package/dist/ttcn-cfg-BYqcMRxC.cjs +0 -1
- package/dist/ttcn-cfg-Bac_acMi.js +0 -88
- package/dist/turtle-DSJNatSv.cjs +0 -1
- package/dist/turtle-xwJUxoPV.js +0 -80
- package/dist/types/components/milkdown/milkdown-input.d.ts +0 -15
- package/dist/types/milkdown/index.d.ts +0 -1
- package/dist/ur-orNTOdMP.cjs +0 -1
- package/dist/utils-Dobqjl2y.cjs +0 -1
- package/dist/vb-c2kQGd6-.js +0 -74
- package/dist/vb-qzHzzvyB.cjs +0 -1
- package/dist/vbscript-1f_Dhg5H.js +0 -324
- package/dist/vbscript-CWm8v9tE.cjs +0 -1
- package/dist/velocity-D3_yAIp3.cjs +0 -1
- package/dist/velocity-DJd0pTTC.js +0 -96
- package/dist/verilog-BOhLNmQo.cjs +0 -1
- package/dist/verilog-CiS1jyi5.js +0 -262
- package/dist/vhdl-CMFbi8Im.cjs +0 -1
- package/dist/vhdl-T9HkrbI2.js +0 -106
- package/dist/vi-BWyUDP07.cjs +0 -1
- package/dist/webidl-CWb_flNk.cjs +0 -1
- package/dist/webidl-CjfDENEo.js +0 -155
- package/dist/xquery-BUQdORAS.js +0 -422
- package/dist/xquery-Cjw5fRnG.cjs +0 -1
- package/dist/yacas-C0absKBh.js +0 -73
- package/dist/yacas-urx_N5C8.cjs +0 -1
- package/dist/z80-CsG3CM6M.cjs +0 -1
- package/dist/z80-Pki2zAjW.js +0 -61
- package/dist/zh-RVJj1NQq.cjs +0 -1
- /package/dist/types/{components/milkdown/milkdown-url.d.ts → prosemirror/styles-url.d.ts} +0 -0
- /package/dist/types/{milkdown → prosemirror}/styles.d.ts +0 -0
package/dist/index-alBMysbQ.js
DELETED
|
@@ -1,1874 +0,0 @@
|
|
|
1
|
-
import { P as nt, g as j, h as v, v as st, N as Ae, s as Be, p as it, t as c, T as E, w as ot, L as le, x as at, y as lt, z as ht, u as ft, e as _, k as P, A as T, B as ut, f as Ie, i as dt, C as pt, F as ct, G as mt, H as he, J as gt } from "./milkdown-input-CciSI_a5.js";
|
|
2
|
-
import { html as kt, htmlCompletionSource as Lt } from "./index-DVZnPL32.js";
|
|
3
|
-
class $ {
|
|
4
|
-
static create(e, r, n, s, i) {
|
|
5
|
-
let o = s + (s << 8) + e + (r << 4) | 0;
|
|
6
|
-
return new $(e, r, n, o, i, [], []);
|
|
7
|
-
}
|
|
8
|
-
constructor(e, r, n, s, i, o, a) {
|
|
9
|
-
this.type = e, this.value = r, this.from = n, this.hash = s, this.end = i, this.children = o, this.positions = a, this.hashProp = [[v.contextHash, s]];
|
|
10
|
-
}
|
|
11
|
-
addChild(e, r) {
|
|
12
|
-
e.prop(v.contextHash) != this.hash && (e = new E(e.type, e.children, e.positions, e.length, this.hashProp)), this.children.push(e), this.positions.push(r);
|
|
13
|
-
}
|
|
14
|
-
toTree(e, r = this.end) {
|
|
15
|
-
let n = this.children.length - 1;
|
|
16
|
-
return n >= 0 && (r = Math.max(r, this.positions[n] + this.children[n].length + this.from)), new E(e.types[this.type], this.children, this.positions, r - this.from).balance({
|
|
17
|
-
makeTree: (s, i, o) => new E(j.none, s, i, o, this.hashProp)
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
var u;
|
|
22
|
-
(function(t) {
|
|
23
|
-
t[t.Document = 1] = "Document", t[t.CodeBlock = 2] = "CodeBlock", t[t.FencedCode = 3] = "FencedCode", t[t.Blockquote = 4] = "Blockquote", t[t.HorizontalRule = 5] = "HorizontalRule", t[t.BulletList = 6] = "BulletList", t[t.OrderedList = 7] = "OrderedList", t[t.ListItem = 8] = "ListItem", t[t.ATXHeading1 = 9] = "ATXHeading1", t[t.ATXHeading2 = 10] = "ATXHeading2", t[t.ATXHeading3 = 11] = "ATXHeading3", t[t.ATXHeading4 = 12] = "ATXHeading4", t[t.ATXHeading5 = 13] = "ATXHeading5", t[t.ATXHeading6 = 14] = "ATXHeading6", t[t.SetextHeading1 = 15] = "SetextHeading1", t[t.SetextHeading2 = 16] = "SetextHeading2", t[t.HTMLBlock = 17] = "HTMLBlock", t[t.LinkReference = 18] = "LinkReference", t[t.Paragraph = 19] = "Paragraph", t[t.CommentBlock = 20] = "CommentBlock", t[t.ProcessingInstructionBlock = 21] = "ProcessingInstructionBlock", t[t.Escape = 22] = "Escape", t[t.Entity = 23] = "Entity", t[t.HardBreak = 24] = "HardBreak", t[t.Emphasis = 25] = "Emphasis", t[t.StrongEmphasis = 26] = "StrongEmphasis", t[t.Link = 27] = "Link", t[t.Image = 28] = "Image", t[t.InlineCode = 29] = "InlineCode", t[t.HTMLTag = 30] = "HTMLTag", t[t.Comment = 31] = "Comment", t[t.ProcessingInstruction = 32] = "ProcessingInstruction", t[t.Autolink = 33] = "Autolink", t[t.HeaderMark = 34] = "HeaderMark", t[t.QuoteMark = 35] = "QuoteMark", t[t.ListMark = 36] = "ListMark", t[t.LinkMark = 37] = "LinkMark", t[t.EmphasisMark = 38] = "EmphasisMark", t[t.CodeMark = 39] = "CodeMark", t[t.CodeText = 40] = "CodeText", t[t.CodeInfo = 41] = "CodeInfo", t[t.LinkTitle = 42] = "LinkTitle", t[t.LinkLabel = 43] = "LinkLabel", t[t.URL = 44] = "URL";
|
|
24
|
-
})(u || (u = {}));
|
|
25
|
-
class bt {
|
|
26
|
-
/**
|
|
27
|
-
@internal
|
|
28
|
-
*/
|
|
29
|
-
constructor(e, r) {
|
|
30
|
-
this.start = e, this.content = r, this.marks = [], this.parsers = [];
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
class wt {
|
|
34
|
-
constructor() {
|
|
35
|
-
this.text = "", this.baseIndent = 0, this.basePos = 0, this.depth = 0, this.markers = [], this.pos = 0, this.indent = 0, this.next = -1;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
@internal
|
|
39
|
-
*/
|
|
40
|
-
forward() {
|
|
41
|
-
this.basePos > this.pos && this.forwardInner();
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
@internal
|
|
45
|
-
*/
|
|
46
|
-
forwardInner() {
|
|
47
|
-
let e = this.skipSpace(this.basePos);
|
|
48
|
-
this.indent = this.countIndent(e, this.pos, this.indent), this.pos = e, this.next = e == this.text.length ? -1 : this.text.charCodeAt(e);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
Skip whitespace after the given position, return the position of
|
|
52
|
-
the next non-space character or the end of the line if there's
|
|
53
|
-
only space after `from`.
|
|
54
|
-
*/
|
|
55
|
-
skipSpace(e) {
|
|
56
|
-
return O(this.text, e);
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
@internal
|
|
60
|
-
*/
|
|
61
|
-
reset(e) {
|
|
62
|
-
for (this.text = e, this.baseIndent = this.basePos = this.pos = this.indent = 0, this.forwardInner(), this.depth = 1; this.markers.length; )
|
|
63
|
-
this.markers.pop();
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
Move the line's base position forward to the given position.
|
|
67
|
-
This should only be called by composite [block
|
|
68
|
-
parsers](#BlockParser.parse) or [markup skipping
|
|
69
|
-
functions](#NodeSpec.composite).
|
|
70
|
-
*/
|
|
71
|
-
moveBase(e) {
|
|
72
|
-
this.basePos = e, this.baseIndent = this.countIndent(e, this.pos, this.indent);
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
Move the line's base position forward to the given _column_.
|
|
76
|
-
*/
|
|
77
|
-
moveBaseColumn(e) {
|
|
78
|
-
this.baseIndent = e, this.basePos = this.findColumn(e);
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
Store a composite-block-level marker. Should be called from
|
|
82
|
-
[markup skipping functions](#NodeSpec.composite) when they
|
|
83
|
-
consume any non-whitespace characters.
|
|
84
|
-
*/
|
|
85
|
-
addMarker(e) {
|
|
86
|
-
this.markers.push(e);
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
Find the column position at `to`, optionally starting at a given
|
|
90
|
-
position and column.
|
|
91
|
-
*/
|
|
92
|
-
countIndent(e, r = 0, n = 0) {
|
|
93
|
-
for (let s = r; s < e; s++)
|
|
94
|
-
n += this.text.charCodeAt(s) == 9 ? 4 - n % 4 : 1;
|
|
95
|
-
return n;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
Find the position corresponding to the given column.
|
|
99
|
-
*/
|
|
100
|
-
findColumn(e) {
|
|
101
|
-
let r = 0;
|
|
102
|
-
for (let n = 0; r < this.text.length && n < e; r++)
|
|
103
|
-
n += this.text.charCodeAt(r) == 9 ? 4 - n % 4 : 1;
|
|
104
|
-
return r;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
@internal
|
|
108
|
-
*/
|
|
109
|
-
scrub() {
|
|
110
|
-
if (!this.baseIndent)
|
|
111
|
-
return this.text;
|
|
112
|
-
let e = "";
|
|
113
|
-
for (let r = 0; r < this.basePos; r++)
|
|
114
|
-
e += " ";
|
|
115
|
-
return e + this.text.slice(this.basePos);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
function fe(t, e, r) {
|
|
119
|
-
if (r.pos == r.text.length || t != e.block && r.indent >= e.stack[r.depth + 1].value + r.baseIndent)
|
|
120
|
-
return !0;
|
|
121
|
-
if (r.indent >= r.baseIndent + 4)
|
|
122
|
-
return !1;
|
|
123
|
-
let n = (t.type == u.OrderedList ? ie : se)(r, e, !1);
|
|
124
|
-
return n > 0 && (t.type != u.BulletList || ne(r, e, !1) < 0) && r.text.charCodeAt(r.pos + n - 1) == t.value;
|
|
125
|
-
}
|
|
126
|
-
const Ee = {
|
|
127
|
-
[u.Blockquote](t, e, r) {
|
|
128
|
-
return r.next != 62 ? !1 : (r.markers.push(g(u.QuoteMark, e.lineStart + r.pos, e.lineStart + r.pos + 1)), r.moveBase(r.pos + (x(r.text.charCodeAt(r.pos + 1)) ? 2 : 1)), t.end = e.lineStart + r.text.length, !0);
|
|
129
|
-
},
|
|
130
|
-
[u.ListItem](t, e, r) {
|
|
131
|
-
return r.indent < r.baseIndent + t.value && r.next > -1 ? !1 : (r.moveBaseColumn(r.baseIndent + t.value), !0);
|
|
132
|
-
},
|
|
133
|
-
[u.OrderedList]: fe,
|
|
134
|
-
[u.BulletList]: fe,
|
|
135
|
-
[u.Document]() {
|
|
136
|
-
return !0;
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
function x(t) {
|
|
140
|
-
return t == 32 || t == 9 || t == 10 || t == 13;
|
|
141
|
-
}
|
|
142
|
-
function O(t, e = 0) {
|
|
143
|
-
for (; e < t.length && x(t.charCodeAt(e)); )
|
|
144
|
-
e++;
|
|
145
|
-
return e;
|
|
146
|
-
}
|
|
147
|
-
function ue(t, e, r) {
|
|
148
|
-
for (; e > r && x(t.charCodeAt(e - 1)); )
|
|
149
|
-
e--;
|
|
150
|
-
return e;
|
|
151
|
-
}
|
|
152
|
-
function Me(t) {
|
|
153
|
-
if (t.next != 96 && t.next != 126)
|
|
154
|
-
return -1;
|
|
155
|
-
let e = t.pos + 1;
|
|
156
|
-
for (; e < t.text.length && t.text.charCodeAt(e) == t.next; )
|
|
157
|
-
e++;
|
|
158
|
-
if (e < t.pos + 3)
|
|
159
|
-
return -1;
|
|
160
|
-
if (t.next == 96) {
|
|
161
|
-
for (let r = e; r < t.text.length; r++)
|
|
162
|
-
if (t.text.charCodeAt(r) == 96)
|
|
163
|
-
return -1;
|
|
164
|
-
}
|
|
165
|
-
return e;
|
|
166
|
-
}
|
|
167
|
-
function He(t) {
|
|
168
|
-
return t.next != 62 ? -1 : t.text.charCodeAt(t.pos + 1) == 32 ? 2 : 1;
|
|
169
|
-
}
|
|
170
|
-
function ne(t, e, r) {
|
|
171
|
-
if (t.next != 42 && t.next != 45 && t.next != 95)
|
|
172
|
-
return -1;
|
|
173
|
-
let n = 1;
|
|
174
|
-
for (let s = t.pos + 1; s < t.text.length; s++) {
|
|
175
|
-
let i = t.text.charCodeAt(s);
|
|
176
|
-
if (i == t.next)
|
|
177
|
-
n++;
|
|
178
|
-
else if (!x(i))
|
|
179
|
-
return -1;
|
|
180
|
-
}
|
|
181
|
-
return r && t.next == 45 && Ne(t) > -1 && t.depth == e.stack.length && e.parser.leafBlockParsers.indexOf(Te.SetextHeading) > -1 || n < 3 ? -1 : 1;
|
|
182
|
-
}
|
|
183
|
-
function Pe(t, e) {
|
|
184
|
-
for (let r = t.stack.length - 1; r >= 0; r--)
|
|
185
|
-
if (t.stack[r].type == e)
|
|
186
|
-
return !0;
|
|
187
|
-
return !1;
|
|
188
|
-
}
|
|
189
|
-
function se(t, e, r) {
|
|
190
|
-
return (t.next == 45 || t.next == 43 || t.next == 42) && (t.pos == t.text.length - 1 || x(t.text.charCodeAt(t.pos + 1))) && (!r || Pe(e, u.BulletList) || t.skipSpace(t.pos + 2) < t.text.length) ? 1 : -1;
|
|
191
|
-
}
|
|
192
|
-
function ie(t, e, r) {
|
|
193
|
-
let n = t.pos, s = t.next;
|
|
194
|
-
for (; s >= 48 && s <= 57; ) {
|
|
195
|
-
n++;
|
|
196
|
-
if (n == t.text.length)
|
|
197
|
-
return -1;
|
|
198
|
-
s = t.text.charCodeAt(n);
|
|
199
|
-
}
|
|
200
|
-
return n == t.pos || n > t.pos + 9 || s != 46 && s != 41 || n < t.text.length - 1 && !x(t.text.charCodeAt(n + 1)) || r && !Pe(e, u.OrderedList) && (t.skipSpace(n + 1) == t.text.length || n > t.pos + 1 || t.next != 49) ? -1 : n + 1 - t.pos;
|
|
201
|
-
}
|
|
202
|
-
function ve(t) {
|
|
203
|
-
if (t.next != 35)
|
|
204
|
-
return -1;
|
|
205
|
-
let e = t.pos + 1;
|
|
206
|
-
for (; e < t.text.length && t.text.charCodeAt(e) == 35; )
|
|
207
|
-
e++;
|
|
208
|
-
if (e < t.text.length && t.text.charCodeAt(e) != 32)
|
|
209
|
-
return -1;
|
|
210
|
-
let r = e - t.pos;
|
|
211
|
-
return r > 6 ? -1 : r;
|
|
212
|
-
}
|
|
213
|
-
function Ne(t) {
|
|
214
|
-
if (t.next != 45 && t.next != 61 || t.indent >= t.baseIndent + 4)
|
|
215
|
-
return -1;
|
|
216
|
-
let e = t.pos + 1;
|
|
217
|
-
for (; e < t.text.length && t.text.charCodeAt(e) == t.next; )
|
|
218
|
-
e++;
|
|
219
|
-
let r = e;
|
|
220
|
-
for (; e < t.text.length && x(t.text.charCodeAt(e)); )
|
|
221
|
-
e++;
|
|
222
|
-
return e == t.text.length ? r : -1;
|
|
223
|
-
}
|
|
224
|
-
const K = /^[ \t]*$/, ye = /-->/, Oe = /\?>/, J = [
|
|
225
|
-
[/^<(?:script|pre|style)(?:\s|>|$)/i, /<\/(?:script|pre|style)>/i],
|
|
226
|
-
[/^\s*<!--/, ye],
|
|
227
|
-
[/^\s*<\?/, Oe],
|
|
228
|
-
[/^\s*<![A-Z]/, />/],
|
|
229
|
-
[/^\s*<!\[CDATA\[/, /\]\]>/],
|
|
230
|
-
[/^\s*<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i, K],
|
|
231
|
-
[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i, K]
|
|
232
|
-
];
|
|
233
|
-
function Re(t, e, r) {
|
|
234
|
-
if (t.next != 60)
|
|
235
|
-
return -1;
|
|
236
|
-
let n = t.text.slice(t.pos);
|
|
237
|
-
for (let s = 0, i = J.length - (r ? 1 : 0); s < i; s++)
|
|
238
|
-
if (J[s][0].test(n))
|
|
239
|
-
return s;
|
|
240
|
-
return -1;
|
|
241
|
-
}
|
|
242
|
-
function de(t, e) {
|
|
243
|
-
let r = t.countIndent(e, t.pos, t.indent), n = t.countIndent(t.skipSpace(e), e, r);
|
|
244
|
-
return n >= r + 5 ? r + 1 : n;
|
|
245
|
-
}
|
|
246
|
-
function I(t, e, r) {
|
|
247
|
-
let n = t.length - 1;
|
|
248
|
-
n >= 0 && t[n].to == e && t[n].type == u.CodeText ? t[n].to = r : t.push(g(u.CodeText, e, r));
|
|
249
|
-
}
|
|
250
|
-
const F = {
|
|
251
|
-
LinkReference: void 0,
|
|
252
|
-
IndentedCode(t, e) {
|
|
253
|
-
let r = e.baseIndent + 4;
|
|
254
|
-
if (e.indent < r)
|
|
255
|
-
return !1;
|
|
256
|
-
let n = e.findColumn(r), s = t.lineStart + n, i = t.lineStart + e.text.length, o = [], a = [];
|
|
257
|
-
for (I(o, s, i); t.nextLine() && e.depth >= t.stack.length; )
|
|
258
|
-
if (e.pos == e.text.length) {
|
|
259
|
-
I(a, t.lineStart - 1, t.lineStart);
|
|
260
|
-
for (let l of e.markers)
|
|
261
|
-
a.push(l);
|
|
262
|
-
} else {
|
|
263
|
-
if (e.indent < r)
|
|
264
|
-
break;
|
|
265
|
-
{
|
|
266
|
-
if (a.length) {
|
|
267
|
-
for (let f of a)
|
|
268
|
-
f.type == u.CodeText ? I(o, f.from, f.to) : o.push(f);
|
|
269
|
-
a = [];
|
|
270
|
-
}
|
|
271
|
-
I(o, t.lineStart - 1, t.lineStart);
|
|
272
|
-
for (let f of e.markers)
|
|
273
|
-
o.push(f);
|
|
274
|
-
i = t.lineStart + e.text.length;
|
|
275
|
-
let l = t.lineStart + e.findColumn(e.baseIndent + 4);
|
|
276
|
-
l < i && I(o, l, i);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
return a.length && (a = a.filter((l) => l.type != u.CodeText), a.length && (e.markers = a.concat(e.markers))), t.addNode(t.buffer.writeElements(o, -s).finish(u.CodeBlock, i - s), s), !0;
|
|
280
|
-
},
|
|
281
|
-
FencedCode(t, e) {
|
|
282
|
-
let r = Me(e);
|
|
283
|
-
if (r < 0)
|
|
284
|
-
return !1;
|
|
285
|
-
let n = t.lineStart + e.pos, s = e.next, i = r - e.pos, o = e.skipSpace(r), a = ue(e.text, e.text.length, o), l = [g(u.CodeMark, n, n + i)];
|
|
286
|
-
o < a && l.push(g(u.CodeInfo, t.lineStart + o, t.lineStart + a));
|
|
287
|
-
for (let f = !0; t.nextLine() && e.depth >= t.stack.length; f = !1) {
|
|
288
|
-
let h = e.pos;
|
|
289
|
-
if (e.indent - e.baseIndent < 4)
|
|
290
|
-
for (; h < e.text.length && e.text.charCodeAt(h) == s; )
|
|
291
|
-
h++;
|
|
292
|
-
if (h - e.pos >= i && e.skipSpace(h) == e.text.length) {
|
|
293
|
-
for (let p of e.markers)
|
|
294
|
-
l.push(p);
|
|
295
|
-
l.push(g(u.CodeMark, t.lineStart + e.pos, t.lineStart + h)), t.nextLine();
|
|
296
|
-
break;
|
|
297
|
-
} else {
|
|
298
|
-
f || I(l, t.lineStart - 1, t.lineStart);
|
|
299
|
-
for (let m of e.markers)
|
|
300
|
-
l.push(m);
|
|
301
|
-
let p = t.lineStart + e.basePos, d = t.lineStart + e.text.length;
|
|
302
|
-
p < d && I(l, p, d);
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
return t.addNode(t.buffer.writeElements(l, -n).finish(u.FencedCode, t.prevLineEnd() - n), n), !0;
|
|
306
|
-
},
|
|
307
|
-
Blockquote(t, e) {
|
|
308
|
-
let r = He(e);
|
|
309
|
-
return r < 0 ? !1 : (t.startContext(u.Blockquote, e.pos), t.addNode(u.QuoteMark, t.lineStart + e.pos, t.lineStart + e.pos + 1), e.moveBase(e.pos + r), null);
|
|
310
|
-
},
|
|
311
|
-
HorizontalRule(t, e) {
|
|
312
|
-
if (ne(e, t, !1) < 0)
|
|
313
|
-
return !1;
|
|
314
|
-
let r = t.lineStart + e.pos;
|
|
315
|
-
return t.nextLine(), t.addNode(u.HorizontalRule, r), !0;
|
|
316
|
-
},
|
|
317
|
-
BulletList(t, e) {
|
|
318
|
-
let r = se(e, t, !1);
|
|
319
|
-
if (r < 0)
|
|
320
|
-
return !1;
|
|
321
|
-
t.block.type != u.BulletList && t.startContext(u.BulletList, e.basePos, e.next);
|
|
322
|
-
let n = de(e, e.pos + 1);
|
|
323
|
-
return t.startContext(u.ListItem, e.basePos, n - e.baseIndent), t.addNode(u.ListMark, t.lineStart + e.pos, t.lineStart + e.pos + r), e.moveBaseColumn(n), null;
|
|
324
|
-
},
|
|
325
|
-
OrderedList(t, e) {
|
|
326
|
-
let r = ie(e, t, !1);
|
|
327
|
-
if (r < 0)
|
|
328
|
-
return !1;
|
|
329
|
-
t.block.type != u.OrderedList && t.startContext(u.OrderedList, e.basePos, e.text.charCodeAt(e.pos + r - 1));
|
|
330
|
-
let n = de(e, e.pos + r);
|
|
331
|
-
return t.startContext(u.ListItem, e.basePos, n - e.baseIndent), t.addNode(u.ListMark, t.lineStart + e.pos, t.lineStart + e.pos + r), e.moveBaseColumn(n), null;
|
|
332
|
-
},
|
|
333
|
-
ATXHeading(t, e) {
|
|
334
|
-
let r = ve(e);
|
|
335
|
-
if (r < 0)
|
|
336
|
-
return !1;
|
|
337
|
-
let n = e.pos, s = t.lineStart + n, i = ue(e.text, e.text.length, n), o = i;
|
|
338
|
-
for (; o > n && e.text.charCodeAt(o - 1) == e.next; )
|
|
339
|
-
o--;
|
|
340
|
-
(o == i || o == n || !x(e.text.charCodeAt(o - 1))) && (o = e.text.length);
|
|
341
|
-
let a = t.buffer.write(u.HeaderMark, 0, r).writeElements(t.parser.parseInline(e.text.slice(n + r + 1, o), s + r + 1), -s);
|
|
342
|
-
o < e.text.length && a.write(u.HeaderMark, o - n, i - n);
|
|
343
|
-
let l = a.finish(u.ATXHeading1 - 1 + r, e.text.length - n);
|
|
344
|
-
return t.nextLine(), t.addNode(l, s), !0;
|
|
345
|
-
},
|
|
346
|
-
HTMLBlock(t, e) {
|
|
347
|
-
let r = Re(e, t, !1);
|
|
348
|
-
if (r < 0)
|
|
349
|
-
return !1;
|
|
350
|
-
let n = t.lineStart + e.pos, s = J[r][1], i = [], o = s != K;
|
|
351
|
-
for (; !s.test(e.text) && t.nextLine(); ) {
|
|
352
|
-
if (e.depth < t.stack.length) {
|
|
353
|
-
o = !1;
|
|
354
|
-
break;
|
|
355
|
-
}
|
|
356
|
-
for (let f of e.markers)
|
|
357
|
-
i.push(f);
|
|
358
|
-
}
|
|
359
|
-
o && t.nextLine();
|
|
360
|
-
let a = s == ye ? u.CommentBlock : s == Oe ? u.ProcessingInstructionBlock : u.HTMLBlock, l = t.prevLineEnd();
|
|
361
|
-
return t.addNode(t.buffer.writeElements(i, -n).finish(a, l - n), n), !0;
|
|
362
|
-
},
|
|
363
|
-
SetextHeading: void 0
|
|
364
|
-
// Specifies relative precedence for block-continue function
|
|
365
|
-
};
|
|
366
|
-
class St {
|
|
367
|
-
constructor(e) {
|
|
368
|
-
this.stage = 0, this.elts = [], this.pos = 0, this.start = e.start, this.advance(e.content);
|
|
369
|
-
}
|
|
370
|
-
nextLine(e, r, n) {
|
|
371
|
-
if (this.stage == -1)
|
|
372
|
-
return !1;
|
|
373
|
-
let s = n.content + `
|
|
374
|
-
` + r.scrub(), i = this.advance(s);
|
|
375
|
-
return i > -1 && i < s.length ? this.complete(e, n, i) : !1;
|
|
376
|
-
}
|
|
377
|
-
finish(e, r) {
|
|
378
|
-
return (this.stage == 2 || this.stage == 3) && O(r.content, this.pos) == r.content.length ? this.complete(e, r, r.content.length) : !1;
|
|
379
|
-
}
|
|
380
|
-
complete(e, r, n) {
|
|
381
|
-
return e.addLeafElement(r, g(u.LinkReference, this.start, this.start + n, this.elts)), !0;
|
|
382
|
-
}
|
|
383
|
-
nextStage(e) {
|
|
384
|
-
return e ? (this.pos = e.to - this.start, this.elts.push(e), this.stage++, !0) : (e === !1 && (this.stage = -1), !1);
|
|
385
|
-
}
|
|
386
|
-
advance(e) {
|
|
387
|
-
for (; ; ) {
|
|
388
|
-
if (this.stage == -1)
|
|
389
|
-
return -1;
|
|
390
|
-
if (this.stage == 0) {
|
|
391
|
-
if (!this.nextStage(qe(e, this.pos, this.start, !0)))
|
|
392
|
-
return -1;
|
|
393
|
-
if (e.charCodeAt(this.pos) != 58)
|
|
394
|
-
return this.stage = -1;
|
|
395
|
-
this.elts.push(g(u.LinkMark, this.pos + this.start, this.pos + this.start + 1)), this.pos++;
|
|
396
|
-
} else if (this.stage == 1) {
|
|
397
|
-
if (!this.nextStage(_e(e, O(e, this.pos), this.start)))
|
|
398
|
-
return -1;
|
|
399
|
-
} else if (this.stage == 2) {
|
|
400
|
-
let r = O(e, this.pos), n = 0;
|
|
401
|
-
if (r > this.pos) {
|
|
402
|
-
let s = Ue(e, r, this.start);
|
|
403
|
-
if (s) {
|
|
404
|
-
let i = q(e, s.to - this.start);
|
|
405
|
-
i > 0 && (this.nextStage(s), n = i);
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
return n || (n = q(e, this.pos)), n > 0 && n < e.length ? n : -1;
|
|
409
|
-
} else
|
|
410
|
-
return q(e, this.pos);
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
function q(t, e) {
|
|
415
|
-
for (; e < t.length; e++) {
|
|
416
|
-
let r = t.charCodeAt(e);
|
|
417
|
-
if (r == 10)
|
|
418
|
-
break;
|
|
419
|
-
if (!x(r))
|
|
420
|
-
return -1;
|
|
421
|
-
}
|
|
422
|
-
return e;
|
|
423
|
-
}
|
|
424
|
-
class Ct {
|
|
425
|
-
nextLine(e, r, n) {
|
|
426
|
-
let s = r.depth < e.stack.length ? -1 : Ne(r), i = r.next;
|
|
427
|
-
if (s < 0)
|
|
428
|
-
return !1;
|
|
429
|
-
let o = g(u.HeaderMark, e.lineStart + r.pos, e.lineStart + s);
|
|
430
|
-
return e.nextLine(), e.addLeafElement(n, g(i == 61 ? u.SetextHeading1 : u.SetextHeading2, n.start, e.prevLineEnd(), [
|
|
431
|
-
...e.parser.parseInline(n.content, n.start),
|
|
432
|
-
o
|
|
433
|
-
])), !0;
|
|
434
|
-
}
|
|
435
|
-
finish() {
|
|
436
|
-
return !1;
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
const Te = {
|
|
440
|
-
LinkReference(t, e) {
|
|
441
|
-
return e.content.charCodeAt(0) == 91 ? new St(e) : null;
|
|
442
|
-
},
|
|
443
|
-
SetextHeading() {
|
|
444
|
-
return new Ct();
|
|
445
|
-
}
|
|
446
|
-
}, xt = [
|
|
447
|
-
(t, e) => ve(e) >= 0,
|
|
448
|
-
(t, e) => Me(e) >= 0,
|
|
449
|
-
(t, e) => He(e) >= 0,
|
|
450
|
-
(t, e) => se(e, t, !0) >= 0,
|
|
451
|
-
(t, e) => ie(e, t, !0) >= 0,
|
|
452
|
-
(t, e) => ne(e, t, !0) >= 0,
|
|
453
|
-
(t, e) => Re(e, t, !0) >= 0
|
|
454
|
-
], At = { text: "", end: 0 };
|
|
455
|
-
class Bt {
|
|
456
|
-
/**
|
|
457
|
-
@internal
|
|
458
|
-
*/
|
|
459
|
-
constructor(e, r, n, s) {
|
|
460
|
-
this.parser = e, this.input = r, this.ranges = s, this.line = new wt(), this.atEnd = !1, this.reusePlaceholders = /* @__PURE__ */ new Map(), this.stoppedAt = null, this.rangeI = 0, this.to = s[s.length - 1].to, this.lineStart = this.absoluteLineStart = this.absoluteLineEnd = s[0].from, this.block = $.create(u.Document, 0, this.lineStart, 0, 0), this.stack = [this.block], this.fragments = n.length ? new Ht(n, r) : null, this.readLine();
|
|
461
|
-
}
|
|
462
|
-
get parsedPos() {
|
|
463
|
-
return this.absoluteLineStart;
|
|
464
|
-
}
|
|
465
|
-
advance() {
|
|
466
|
-
if (this.stoppedAt != null && this.absoluteLineStart > this.stoppedAt)
|
|
467
|
-
return this.finish();
|
|
468
|
-
let { line: e } = this;
|
|
469
|
-
for (; ; ) {
|
|
470
|
-
for (let n = 0; ; ) {
|
|
471
|
-
let s = e.depth < this.stack.length ? this.stack[this.stack.length - 1] : null;
|
|
472
|
-
for (; n < e.markers.length && (!s || e.markers[n].from < s.end); ) {
|
|
473
|
-
let i = e.markers[n++];
|
|
474
|
-
this.addNode(i.type, i.from, i.to);
|
|
475
|
-
}
|
|
476
|
-
if (!s)
|
|
477
|
-
break;
|
|
478
|
-
this.finishContext();
|
|
479
|
-
}
|
|
480
|
-
if (e.pos < e.text.length)
|
|
481
|
-
break;
|
|
482
|
-
if (!this.nextLine())
|
|
483
|
-
return this.finish();
|
|
484
|
-
}
|
|
485
|
-
if (this.fragments && this.reuseFragment(e.basePos))
|
|
486
|
-
return null;
|
|
487
|
-
e: for (; ; ) {
|
|
488
|
-
for (let n of this.parser.blockParsers)
|
|
489
|
-
if (n) {
|
|
490
|
-
let s = n(this, e);
|
|
491
|
-
if (s != !1) {
|
|
492
|
-
if (s == !0)
|
|
493
|
-
return null;
|
|
494
|
-
e.forward();
|
|
495
|
-
continue e;
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
break;
|
|
499
|
-
}
|
|
500
|
-
let r = new bt(this.lineStart + e.pos, e.text.slice(e.pos));
|
|
501
|
-
for (let n of this.parser.leafBlockParsers)
|
|
502
|
-
if (n) {
|
|
503
|
-
let s = n(this, r);
|
|
504
|
-
s && r.parsers.push(s);
|
|
505
|
-
}
|
|
506
|
-
e: for (; this.nextLine() && e.pos != e.text.length; ) {
|
|
507
|
-
if (e.indent < e.baseIndent + 4) {
|
|
508
|
-
for (let n of this.parser.endLeafBlock)
|
|
509
|
-
if (n(this, e, r))
|
|
510
|
-
break e;
|
|
511
|
-
}
|
|
512
|
-
for (let n of r.parsers)
|
|
513
|
-
if (n.nextLine(this, e, r))
|
|
514
|
-
return null;
|
|
515
|
-
r.content += `
|
|
516
|
-
` + e.scrub();
|
|
517
|
-
for (let n of e.markers)
|
|
518
|
-
r.marks.push(n);
|
|
519
|
-
}
|
|
520
|
-
return this.finishLeaf(r), null;
|
|
521
|
-
}
|
|
522
|
-
stopAt(e) {
|
|
523
|
-
if (this.stoppedAt != null && this.stoppedAt < e)
|
|
524
|
-
throw new RangeError("Can't move stoppedAt forward");
|
|
525
|
-
this.stoppedAt = e;
|
|
526
|
-
}
|
|
527
|
-
reuseFragment(e) {
|
|
528
|
-
if (!this.fragments.moveTo(this.absoluteLineStart + e, this.absoluteLineStart) || !this.fragments.matches(this.block.hash))
|
|
529
|
-
return !1;
|
|
530
|
-
let r = this.fragments.takeNodes(this);
|
|
531
|
-
return r ? (this.absoluteLineStart += r, this.lineStart = Qe(this.absoluteLineStart, this.ranges), this.moveRangeI(), this.absoluteLineStart < this.to ? (this.lineStart++, this.absoluteLineStart++, this.readLine()) : (this.atEnd = !0, this.readLine()), !0) : !1;
|
|
532
|
-
}
|
|
533
|
-
/**
|
|
534
|
-
The number of parent blocks surrounding the current block.
|
|
535
|
-
*/
|
|
536
|
-
get depth() {
|
|
537
|
-
return this.stack.length;
|
|
538
|
-
}
|
|
539
|
-
/**
|
|
540
|
-
Get the type of the parent block at the given depth. When no
|
|
541
|
-
depth is passed, return the type of the innermost parent.
|
|
542
|
-
*/
|
|
543
|
-
parentType(e = this.depth - 1) {
|
|
544
|
-
return this.parser.nodeSet.types[this.stack[e].type];
|
|
545
|
-
}
|
|
546
|
-
/**
|
|
547
|
-
Move to the next input line. This should only be called by
|
|
548
|
-
(non-composite) [block parsers](#BlockParser.parse) that consume
|
|
549
|
-
the line directly, or leaf block parser
|
|
550
|
-
[`nextLine`](#LeafBlockParser.nextLine) methods when they
|
|
551
|
-
consume the current line (and return true).
|
|
552
|
-
*/
|
|
553
|
-
nextLine() {
|
|
554
|
-
return this.lineStart += this.line.text.length, this.absoluteLineEnd >= this.to ? (this.absoluteLineStart = this.absoluteLineEnd, this.atEnd = !0, this.readLine(), !1) : (this.lineStart++, this.absoluteLineStart = this.absoluteLineEnd + 1, this.moveRangeI(), this.readLine(), !0);
|
|
555
|
-
}
|
|
556
|
-
/**
|
|
557
|
-
Retrieve the text of the line after the current one, without
|
|
558
|
-
actually moving the context's current line forward.
|
|
559
|
-
*/
|
|
560
|
-
peekLine() {
|
|
561
|
-
return this.scanLine(this.absoluteLineEnd + 1).text;
|
|
562
|
-
}
|
|
563
|
-
moveRangeI() {
|
|
564
|
-
for (; this.rangeI < this.ranges.length - 1 && this.absoluteLineStart >= this.ranges[this.rangeI].to; )
|
|
565
|
-
this.rangeI++, this.absoluteLineStart = Math.max(this.absoluteLineStart, this.ranges[this.rangeI].from);
|
|
566
|
-
}
|
|
567
|
-
/**
|
|
568
|
-
@internal
|
|
569
|
-
Collect the text for the next line.
|
|
570
|
-
*/
|
|
571
|
-
scanLine(e) {
|
|
572
|
-
let r = At;
|
|
573
|
-
if (r.end = e, e >= this.to)
|
|
574
|
-
r.text = "";
|
|
575
|
-
else if (r.text = this.lineChunkAt(e), r.end += r.text.length, this.ranges.length > 1) {
|
|
576
|
-
let n = this.absoluteLineStart, s = this.rangeI;
|
|
577
|
-
for (; this.ranges[s].to < r.end; ) {
|
|
578
|
-
s++;
|
|
579
|
-
let i = this.ranges[s].from, o = this.lineChunkAt(i);
|
|
580
|
-
r.end = i + o.length, r.text = r.text.slice(0, this.ranges[s - 1].to - n) + o, n = r.end - r.text.length;
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
return r;
|
|
584
|
-
}
|
|
585
|
-
/**
|
|
586
|
-
@internal
|
|
587
|
-
Populate this.line with the content of the next line. Skip
|
|
588
|
-
leading characters covered by composite blocks.
|
|
589
|
-
*/
|
|
590
|
-
readLine() {
|
|
591
|
-
let { line: e } = this, { text: r, end: n } = this.scanLine(this.absoluteLineStart);
|
|
592
|
-
for (this.absoluteLineEnd = n, e.reset(r); e.depth < this.stack.length; e.depth++) {
|
|
593
|
-
let s = this.stack[e.depth], i = this.parser.skipContextMarkup[s.type];
|
|
594
|
-
if (!i)
|
|
595
|
-
throw new Error("Unhandled block context " + u[s.type]);
|
|
596
|
-
if (!i(s, this, e))
|
|
597
|
-
break;
|
|
598
|
-
e.forward();
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
lineChunkAt(e) {
|
|
602
|
-
let r = this.input.chunk(e), n;
|
|
603
|
-
if (this.input.lineChunks)
|
|
604
|
-
n = r == `
|
|
605
|
-
` ? "" : r;
|
|
606
|
-
else {
|
|
607
|
-
let s = r.indexOf(`
|
|
608
|
-
`);
|
|
609
|
-
n = s < 0 ? r : r.slice(0, s);
|
|
610
|
-
}
|
|
611
|
-
return e + n.length > this.to ? n.slice(0, this.to - e) : n;
|
|
612
|
-
}
|
|
613
|
-
/**
|
|
614
|
-
The end position of the previous line.
|
|
615
|
-
*/
|
|
616
|
-
prevLineEnd() {
|
|
617
|
-
return this.atEnd ? this.lineStart : this.lineStart - 1;
|
|
618
|
-
}
|
|
619
|
-
/**
|
|
620
|
-
@internal
|
|
621
|
-
*/
|
|
622
|
-
startContext(e, r, n = 0) {
|
|
623
|
-
this.block = $.create(e, n, this.lineStart + r, this.block.hash, this.lineStart + this.line.text.length), this.stack.push(this.block);
|
|
624
|
-
}
|
|
625
|
-
/**
|
|
626
|
-
Start a composite block. Should only be called from [block
|
|
627
|
-
parser functions](#BlockParser.parse) that return null.
|
|
628
|
-
*/
|
|
629
|
-
startComposite(e, r, n = 0) {
|
|
630
|
-
this.startContext(this.parser.getNodeType(e), r, n);
|
|
631
|
-
}
|
|
632
|
-
/**
|
|
633
|
-
@internal
|
|
634
|
-
*/
|
|
635
|
-
addNode(e, r, n) {
|
|
636
|
-
typeof e == "number" && (e = new E(this.parser.nodeSet.types[e], N, N, (n ?? this.prevLineEnd()) - r)), this.block.addChild(e, r - this.block.from);
|
|
637
|
-
}
|
|
638
|
-
/**
|
|
639
|
-
Add a block element. Can be called by [block
|
|
640
|
-
parsers](#BlockParser.parse).
|
|
641
|
-
*/
|
|
642
|
-
addElement(e) {
|
|
643
|
-
this.block.addChild(e.toTree(this.parser.nodeSet), e.from - this.block.from);
|
|
644
|
-
}
|
|
645
|
-
/**
|
|
646
|
-
Add a block element from a [leaf parser](#LeafBlockParser). This
|
|
647
|
-
makes sure any extra composite block markup (such as blockquote
|
|
648
|
-
markers) inside the block are also added to the syntax tree.
|
|
649
|
-
*/
|
|
650
|
-
addLeafElement(e, r) {
|
|
651
|
-
this.addNode(this.buffer.writeElements(ee(r.children, e.marks), -r.from).finish(r.type, r.to - r.from), r.from);
|
|
652
|
-
}
|
|
653
|
-
/**
|
|
654
|
-
@internal
|
|
655
|
-
*/
|
|
656
|
-
finishContext() {
|
|
657
|
-
let e = this.stack.pop(), r = this.stack[this.stack.length - 1];
|
|
658
|
-
r.addChild(e.toTree(this.parser.nodeSet), e.from - r.from), this.block = r;
|
|
659
|
-
}
|
|
660
|
-
finish() {
|
|
661
|
-
for (; this.stack.length > 1; )
|
|
662
|
-
this.finishContext();
|
|
663
|
-
return this.addGaps(this.block.toTree(this.parser.nodeSet, this.lineStart));
|
|
664
|
-
}
|
|
665
|
-
addGaps(e) {
|
|
666
|
-
return this.ranges.length > 1 ? ze(this.ranges, 0, e.topNode, this.ranges[0].from, this.reusePlaceholders) : e;
|
|
667
|
-
}
|
|
668
|
-
/**
|
|
669
|
-
@internal
|
|
670
|
-
*/
|
|
671
|
-
finishLeaf(e) {
|
|
672
|
-
for (let n of e.parsers)
|
|
673
|
-
if (n.finish(this, e))
|
|
674
|
-
return;
|
|
675
|
-
let r = ee(this.parser.parseInline(e.content, e.start), e.marks);
|
|
676
|
-
this.addNode(this.buffer.writeElements(r, -e.start).finish(u.Paragraph, e.content.length), e.start);
|
|
677
|
-
}
|
|
678
|
-
elt(e, r, n, s) {
|
|
679
|
-
return typeof e == "string" ? g(this.parser.getNodeType(e), r, n, s) : new Xe(e, r);
|
|
680
|
-
}
|
|
681
|
-
/**
|
|
682
|
-
@internal
|
|
683
|
-
*/
|
|
684
|
-
get buffer() {
|
|
685
|
-
return new Fe(this.parser.nodeSet);
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
function ze(t, e, r, n, s) {
|
|
689
|
-
let i = t[e].to, o = [], a = [], l = r.from + n;
|
|
690
|
-
function f(h, p) {
|
|
691
|
-
for (; p ? h >= i : h > i; ) {
|
|
692
|
-
let d = t[e + 1].from - i;
|
|
693
|
-
n += d, h += d, e++, i = t[e].to;
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
for (let h = r.firstChild; h; h = h.nextSibling) {
|
|
697
|
-
f(h.from + n, !0);
|
|
698
|
-
let p = h.from + n, d, m = s.get(h.tree);
|
|
699
|
-
m ? d = m : h.to + n > i ? (d = ze(t, e, h, n, s), f(h.to + n, !1)) : d = h.toTree(), o.push(d), a.push(p - l);
|
|
700
|
-
}
|
|
701
|
-
return f(r.to + n, !1), new E(r.type, o, a, r.to + n - l, r.tree ? r.tree.propValues : void 0);
|
|
702
|
-
}
|
|
703
|
-
class U extends nt {
|
|
704
|
-
/**
|
|
705
|
-
@internal
|
|
706
|
-
*/
|
|
707
|
-
constructor(e, r, n, s, i, o, a, l, f) {
|
|
708
|
-
super(), this.nodeSet = e, this.blockParsers = r, this.leafBlockParsers = n, this.blockNames = s, this.endLeafBlock = i, this.skipContextMarkup = o, this.inlineParsers = a, this.inlineNames = l, this.wrappers = f, this.nodeTypes = /* @__PURE__ */ Object.create(null);
|
|
709
|
-
for (let h of e.types)
|
|
710
|
-
this.nodeTypes[h.name] = h.id;
|
|
711
|
-
}
|
|
712
|
-
createParse(e, r, n) {
|
|
713
|
-
let s = new Bt(this, e, r, n);
|
|
714
|
-
for (let i of this.wrappers)
|
|
715
|
-
s = i(s, e, r, n);
|
|
716
|
-
return s;
|
|
717
|
-
}
|
|
718
|
-
/**
|
|
719
|
-
Reconfigure the parser.
|
|
720
|
-
*/
|
|
721
|
-
configure(e) {
|
|
722
|
-
let r = Y(e);
|
|
723
|
-
if (!r)
|
|
724
|
-
return this;
|
|
725
|
-
let { nodeSet: n, skipContextMarkup: s } = this, i = this.blockParsers.slice(), o = this.leafBlockParsers.slice(), a = this.blockNames.slice(), l = this.inlineParsers.slice(), f = this.inlineNames.slice(), h = this.endLeafBlock.slice(), p = this.wrappers;
|
|
726
|
-
if (y(r.defineNodes)) {
|
|
727
|
-
s = Object.assign({}, s);
|
|
728
|
-
let d = n.types.slice(), m;
|
|
729
|
-
for (let L of r.defineNodes) {
|
|
730
|
-
let { name: k, block: w, composite: S, style: b } = typeof L == "string" ? { name: L } : L;
|
|
731
|
-
if (d.some((B) => B.name == k))
|
|
732
|
-
continue;
|
|
733
|
-
S && (s[d.length] = (B, tt, rt) => S(tt, rt, B.value));
|
|
734
|
-
let A = d.length, M = S ? ["Block", "BlockContext"] : w ? A >= u.ATXHeading1 && A <= u.SetextHeading2 ? ["Block", "LeafBlock", "Heading"] : ["Block", "LeafBlock"] : void 0;
|
|
735
|
-
d.push(j.define({
|
|
736
|
-
id: A,
|
|
737
|
-
name: k,
|
|
738
|
-
props: M && [[v.group, M]]
|
|
739
|
-
})), b && (m || (m = {}), Array.isArray(b) || b instanceof st ? m[k] = b : Object.assign(m, b));
|
|
740
|
-
}
|
|
741
|
-
n = new Ae(d), m && (n = n.extend(Be(m)));
|
|
742
|
-
}
|
|
743
|
-
if (y(r.props) && (n = n.extend(...r.props)), y(r.remove))
|
|
744
|
-
for (let d of r.remove) {
|
|
745
|
-
let m = this.blockNames.indexOf(d), L = this.inlineNames.indexOf(d);
|
|
746
|
-
m > -1 && (i[m] = o[m] = void 0), L > -1 && (l[L] = void 0);
|
|
747
|
-
}
|
|
748
|
-
if (y(r.parseBlock))
|
|
749
|
-
for (let d of r.parseBlock) {
|
|
750
|
-
let m = a.indexOf(d.name);
|
|
751
|
-
if (m > -1)
|
|
752
|
-
i[m] = d.parse, o[m] = d.leaf;
|
|
753
|
-
else {
|
|
754
|
-
let L = d.before ? X(a, d.before) : d.after ? X(a, d.after) + 1 : a.length - 1;
|
|
755
|
-
i.splice(L, 0, d.parse), o.splice(L, 0, d.leaf), a.splice(L, 0, d.name);
|
|
756
|
-
}
|
|
757
|
-
d.endLeaf && h.push(d.endLeaf);
|
|
758
|
-
}
|
|
759
|
-
if (y(r.parseInline))
|
|
760
|
-
for (let d of r.parseInline) {
|
|
761
|
-
let m = f.indexOf(d.name);
|
|
762
|
-
if (m > -1)
|
|
763
|
-
l[m] = d.parse;
|
|
764
|
-
else {
|
|
765
|
-
let L = d.before ? X(f, d.before) : d.after ? X(f, d.after) + 1 : f.length - 1;
|
|
766
|
-
l.splice(L, 0, d.parse), f.splice(L, 0, d.name);
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
return r.wrap && (p = p.concat(r.wrap)), new U(n, i, o, a, h, s, l, f, p);
|
|
770
|
-
}
|
|
771
|
-
/**
|
|
772
|
-
@internal
|
|
773
|
-
*/
|
|
774
|
-
getNodeType(e) {
|
|
775
|
-
let r = this.nodeTypes[e];
|
|
776
|
-
if (r == null)
|
|
777
|
-
throw new RangeError(`Unknown node type '${e}'`);
|
|
778
|
-
return r;
|
|
779
|
-
}
|
|
780
|
-
/**
|
|
781
|
-
Parse the given piece of inline text at the given offset,
|
|
782
|
-
returning an array of [`Element`](#Element) objects representing
|
|
783
|
-
the inline content.
|
|
784
|
-
*/
|
|
785
|
-
parseInline(e, r) {
|
|
786
|
-
let n = new Et(this, e, r);
|
|
787
|
-
e: for (let s = r; s < n.end; ) {
|
|
788
|
-
let i = n.char(s);
|
|
789
|
-
for (let o of this.inlineParsers)
|
|
790
|
-
if (o) {
|
|
791
|
-
let a = o(n, i, s);
|
|
792
|
-
if (a >= 0) {
|
|
793
|
-
s = a;
|
|
794
|
-
continue e;
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
s++;
|
|
798
|
-
}
|
|
799
|
-
return n.resolveMarkers(0);
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
function y(t) {
|
|
803
|
-
return t != null && t.length > 0;
|
|
804
|
-
}
|
|
805
|
-
function Y(t) {
|
|
806
|
-
if (!Array.isArray(t))
|
|
807
|
-
return t;
|
|
808
|
-
if (t.length == 0)
|
|
809
|
-
return null;
|
|
810
|
-
let e = Y(t[0]);
|
|
811
|
-
if (t.length == 1)
|
|
812
|
-
return e;
|
|
813
|
-
let r = Y(t.slice(1));
|
|
814
|
-
if (!r || !e)
|
|
815
|
-
return e || r;
|
|
816
|
-
let n = (o, a) => (o || N).concat(a || N), s = e.wrap, i = r.wrap;
|
|
817
|
-
return {
|
|
818
|
-
props: n(e.props, r.props),
|
|
819
|
-
defineNodes: n(e.defineNodes, r.defineNodes),
|
|
820
|
-
parseBlock: n(e.parseBlock, r.parseBlock),
|
|
821
|
-
parseInline: n(e.parseInline, r.parseInline),
|
|
822
|
-
remove: n(e.remove, r.remove),
|
|
823
|
-
wrap: s ? i ? (o, a, l, f) => s(i(o, a, l, f), a, l, f) : s : i
|
|
824
|
-
};
|
|
825
|
-
}
|
|
826
|
-
function X(t, e) {
|
|
827
|
-
let r = t.indexOf(e);
|
|
828
|
-
if (r < 0)
|
|
829
|
-
throw new RangeError(`Position specified relative to unknown parser ${e}`);
|
|
830
|
-
return r;
|
|
831
|
-
}
|
|
832
|
-
let De = [j.none];
|
|
833
|
-
for (let t = 1, e; e = u[t]; t++)
|
|
834
|
-
De[t] = j.define({
|
|
835
|
-
id: t,
|
|
836
|
-
name: e,
|
|
837
|
-
props: t >= u.Escape ? [] : [[v.group, t in Ee ? ["Block", "BlockContext"] : ["Block", "LeafBlock"]]],
|
|
838
|
-
top: e == "Document"
|
|
839
|
-
});
|
|
840
|
-
const N = [];
|
|
841
|
-
class Fe {
|
|
842
|
-
constructor(e) {
|
|
843
|
-
this.nodeSet = e, this.content = [], this.nodes = [];
|
|
844
|
-
}
|
|
845
|
-
write(e, r, n, s = 0) {
|
|
846
|
-
return this.content.push(e, r, n, 4 + s * 4), this;
|
|
847
|
-
}
|
|
848
|
-
writeElements(e, r = 0) {
|
|
849
|
-
for (let n of e)
|
|
850
|
-
n.writeTo(this, r);
|
|
851
|
-
return this;
|
|
852
|
-
}
|
|
853
|
-
finish(e, r) {
|
|
854
|
-
return E.build({
|
|
855
|
-
buffer: this.content,
|
|
856
|
-
nodeSet: this.nodeSet,
|
|
857
|
-
reused: this.nodes,
|
|
858
|
-
topID: e,
|
|
859
|
-
length: r
|
|
860
|
-
});
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
class z {
|
|
864
|
-
/**
|
|
865
|
-
@internal
|
|
866
|
-
*/
|
|
867
|
-
constructor(e, r, n, s = N) {
|
|
868
|
-
this.type = e, this.from = r, this.to = n, this.children = s;
|
|
869
|
-
}
|
|
870
|
-
/**
|
|
871
|
-
@internal
|
|
872
|
-
*/
|
|
873
|
-
writeTo(e, r) {
|
|
874
|
-
let n = e.content.length;
|
|
875
|
-
e.writeElements(this.children, r), e.content.push(this.type, this.from + r, this.to + r, e.content.length + 4 - n);
|
|
876
|
-
}
|
|
877
|
-
/**
|
|
878
|
-
@internal
|
|
879
|
-
*/
|
|
880
|
-
toTree(e) {
|
|
881
|
-
return new Fe(e).writeElements(this.children, -this.from).finish(this.type, this.to - this.from);
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
class Xe {
|
|
885
|
-
constructor(e, r) {
|
|
886
|
-
this.tree = e, this.from = r;
|
|
887
|
-
}
|
|
888
|
-
get to() {
|
|
889
|
-
return this.from + this.tree.length;
|
|
890
|
-
}
|
|
891
|
-
get type() {
|
|
892
|
-
return this.tree.type.id;
|
|
893
|
-
}
|
|
894
|
-
get children() {
|
|
895
|
-
return N;
|
|
896
|
-
}
|
|
897
|
-
writeTo(e, r) {
|
|
898
|
-
e.nodes.push(this.tree), e.content.push(e.nodes.length - 1, this.from + r, this.to + r, -1);
|
|
899
|
-
}
|
|
900
|
-
toTree() {
|
|
901
|
-
return this.tree;
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
function g(t, e, r, n) {
|
|
905
|
-
return new z(t, e, r, n);
|
|
906
|
-
}
|
|
907
|
-
const $e = { resolve: "Emphasis", mark: "EmphasisMark" }, je = { resolve: "Emphasis", mark: "EmphasisMark" }, H = {}, W = {};
|
|
908
|
-
class C {
|
|
909
|
-
constructor(e, r, n, s) {
|
|
910
|
-
this.type = e, this.from = r, this.to = n, this.side = s;
|
|
911
|
-
}
|
|
912
|
-
}
|
|
913
|
-
const pe = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
|
|
914
|
-
let D = /[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;
|
|
915
|
-
try {
|
|
916
|
-
D = new RegExp("[\\p{S}|\\p{P}]", "u");
|
|
917
|
-
} catch {
|
|
918
|
-
}
|
|
919
|
-
const Q = {
|
|
920
|
-
Escape(t, e, r) {
|
|
921
|
-
if (e != 92 || r == t.end - 1)
|
|
922
|
-
return -1;
|
|
923
|
-
let n = t.char(r + 1);
|
|
924
|
-
for (let s = 0; s < pe.length; s++)
|
|
925
|
-
if (pe.charCodeAt(s) == n)
|
|
926
|
-
return t.append(g(u.Escape, r, r + 2));
|
|
927
|
-
return -1;
|
|
928
|
-
},
|
|
929
|
-
Entity(t, e, r) {
|
|
930
|
-
if (e != 38)
|
|
931
|
-
return -1;
|
|
932
|
-
let n = /^(?:#\d+|#x[a-f\d]+|\w+);/i.exec(t.slice(r + 1, r + 31));
|
|
933
|
-
return n ? t.append(g(u.Entity, r, r + 1 + n[0].length)) : -1;
|
|
934
|
-
},
|
|
935
|
-
InlineCode(t, e, r) {
|
|
936
|
-
if (e != 96 || r && t.char(r - 1) == 96)
|
|
937
|
-
return -1;
|
|
938
|
-
let n = r + 1;
|
|
939
|
-
for (; n < t.end && t.char(n) == 96; )
|
|
940
|
-
n++;
|
|
941
|
-
let s = n - r, i = 0;
|
|
942
|
-
for (; n < t.end; n++)
|
|
943
|
-
if (t.char(n) == 96) {
|
|
944
|
-
if (i++, i == s && t.char(n + 1) != 96)
|
|
945
|
-
return t.append(g(u.InlineCode, r, n + 1, [
|
|
946
|
-
g(u.CodeMark, r, r + s),
|
|
947
|
-
g(u.CodeMark, n + 1 - s, n + 1)
|
|
948
|
-
]));
|
|
949
|
-
} else
|
|
950
|
-
i = 0;
|
|
951
|
-
return -1;
|
|
952
|
-
},
|
|
953
|
-
HTMLTag(t, e, r) {
|
|
954
|
-
if (e != 60 || r == t.end - 1)
|
|
955
|
-
return -1;
|
|
956
|
-
let n = t.slice(r + 1, t.end), s = /^(?:[a-z][-\w+.]+:[^\s>]+|[a-z\d.!#$%&'*+/=?^_`{|}~-]+@[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*)>/i.exec(n);
|
|
957
|
-
if (s)
|
|
958
|
-
return t.append(g(u.Autolink, r, r + 1 + s[0].length, [
|
|
959
|
-
g(u.LinkMark, r, r + 1),
|
|
960
|
-
// url[0] includes the closing bracket, so exclude it from this slice
|
|
961
|
-
g(u.URL, r + 1, r + s[0].length),
|
|
962
|
-
g(u.LinkMark, r + s[0].length, r + 1 + s[0].length)
|
|
963
|
-
]));
|
|
964
|
-
let i = /^!--[^>](?:-[^-]|[^-])*?-->/i.exec(n);
|
|
965
|
-
if (i)
|
|
966
|
-
return t.append(g(u.Comment, r, r + 1 + i[0].length));
|
|
967
|
-
let o = /^\?[^]*?\?>/.exec(n);
|
|
968
|
-
if (o)
|
|
969
|
-
return t.append(g(u.ProcessingInstruction, r, r + 1 + o[0].length));
|
|
970
|
-
let a = /^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(n);
|
|
971
|
-
return a ? t.append(g(u.HTMLTag, r, r + 1 + a[0].length)) : -1;
|
|
972
|
-
},
|
|
973
|
-
Emphasis(t, e, r) {
|
|
974
|
-
if (e != 95 && e != 42)
|
|
975
|
-
return -1;
|
|
976
|
-
let n = r + 1;
|
|
977
|
-
for (; t.char(n) == e; )
|
|
978
|
-
n++;
|
|
979
|
-
let s = t.slice(r - 1, r), i = t.slice(n, n + 1), o = D.test(s), a = D.test(i), l = /\s|^$/.test(s), f = /\s|^$/.test(i), h = !f && (!a || l || o), p = !l && (!o || f || a), d = h && (e == 42 || !p || o), m = p && (e == 42 || !h || a);
|
|
980
|
-
return t.append(new C(e == 95 ? $e : je, r, n, (d ? 1 : 0) | (m ? 2 : 0)));
|
|
981
|
-
},
|
|
982
|
-
HardBreak(t, e, r) {
|
|
983
|
-
if (e == 92 && t.char(r + 1) == 10)
|
|
984
|
-
return t.append(g(u.HardBreak, r, r + 2));
|
|
985
|
-
if (e == 32) {
|
|
986
|
-
let n = r + 1;
|
|
987
|
-
for (; t.char(n) == 32; )
|
|
988
|
-
n++;
|
|
989
|
-
if (t.char(n) == 10 && n >= r + 2)
|
|
990
|
-
return t.append(g(u.HardBreak, r, n + 1));
|
|
991
|
-
}
|
|
992
|
-
return -1;
|
|
993
|
-
},
|
|
994
|
-
Link(t, e, r) {
|
|
995
|
-
return e == 91 ? t.append(new C(
|
|
996
|
-
H,
|
|
997
|
-
r,
|
|
998
|
-
r + 1,
|
|
999
|
-
1
|
|
1000
|
-
/* Mark.Open */
|
|
1001
|
-
)) : -1;
|
|
1002
|
-
},
|
|
1003
|
-
Image(t, e, r) {
|
|
1004
|
-
return e == 33 && t.char(r + 1) == 91 ? t.append(new C(
|
|
1005
|
-
W,
|
|
1006
|
-
r,
|
|
1007
|
-
r + 2,
|
|
1008
|
-
1
|
|
1009
|
-
/* Mark.Open */
|
|
1010
|
-
)) : -1;
|
|
1011
|
-
},
|
|
1012
|
-
LinkEnd(t, e, r) {
|
|
1013
|
-
if (e != 93)
|
|
1014
|
-
return -1;
|
|
1015
|
-
for (let n = t.parts.length - 1; n >= 0; n--) {
|
|
1016
|
-
let s = t.parts[n];
|
|
1017
|
-
if (s instanceof C && (s.type == H || s.type == W)) {
|
|
1018
|
-
if (!s.side || t.skipSpace(s.to) == r && !/[(\[]/.test(t.slice(r + 1, r + 2)))
|
|
1019
|
-
return t.parts[n] = null, -1;
|
|
1020
|
-
let i = t.takeContent(n), o = t.parts[n] = It(t, i, s.type == H ? u.Link : u.Image, s.from, r + 1);
|
|
1021
|
-
if (s.type == H)
|
|
1022
|
-
for (let a = 0; a < n; a++) {
|
|
1023
|
-
let l = t.parts[a];
|
|
1024
|
-
l instanceof C && l.type == H && (l.side = 0);
|
|
1025
|
-
}
|
|
1026
|
-
return o.to;
|
|
1027
|
-
}
|
|
1028
|
-
}
|
|
1029
|
-
return -1;
|
|
1030
|
-
}
|
|
1031
|
-
};
|
|
1032
|
-
function It(t, e, r, n, s) {
|
|
1033
|
-
let { text: i } = t, o = t.char(s), a = s;
|
|
1034
|
-
if (e.unshift(g(u.LinkMark, n, n + (r == u.Image ? 2 : 1))), e.push(g(u.LinkMark, s - 1, s)), o == 40) {
|
|
1035
|
-
let l = t.skipSpace(s + 1), f = _e(i, l - t.offset, t.offset), h;
|
|
1036
|
-
f && (l = t.skipSpace(f.to), l != f.to && (h = Ue(i, l - t.offset, t.offset), h && (l = t.skipSpace(h.to)))), t.char(l) == 41 && (e.push(g(u.LinkMark, s, s + 1)), a = l + 1, f && e.push(f), h && e.push(h), e.push(g(u.LinkMark, l, a)));
|
|
1037
|
-
} else if (o == 91) {
|
|
1038
|
-
let l = qe(i, s - t.offset, t.offset, !1);
|
|
1039
|
-
l && (e.push(l), a = l.to);
|
|
1040
|
-
}
|
|
1041
|
-
return g(r, n, a, e);
|
|
1042
|
-
}
|
|
1043
|
-
function _e(t, e, r) {
|
|
1044
|
-
if (t.charCodeAt(e) == 60) {
|
|
1045
|
-
for (let s = e + 1; s < t.length; s++) {
|
|
1046
|
-
let i = t.charCodeAt(s);
|
|
1047
|
-
if (i == 62)
|
|
1048
|
-
return g(u.URL, e + r, s + 1 + r);
|
|
1049
|
-
if (i == 60 || i == 10)
|
|
1050
|
-
return !1;
|
|
1051
|
-
}
|
|
1052
|
-
return null;
|
|
1053
|
-
} else {
|
|
1054
|
-
let s = 0, i = e;
|
|
1055
|
-
for (let o = !1; i < t.length; i++) {
|
|
1056
|
-
let a = t.charCodeAt(i);
|
|
1057
|
-
if (x(a))
|
|
1058
|
-
break;
|
|
1059
|
-
if (o)
|
|
1060
|
-
o = !1;
|
|
1061
|
-
else if (a == 40)
|
|
1062
|
-
s++;
|
|
1063
|
-
else if (a == 41) {
|
|
1064
|
-
if (!s)
|
|
1065
|
-
break;
|
|
1066
|
-
s--;
|
|
1067
|
-
} else a == 92 && (o = !0);
|
|
1068
|
-
}
|
|
1069
|
-
return i > e ? g(u.URL, e + r, i + r) : i == t.length ? null : !1;
|
|
1070
|
-
}
|
|
1071
|
-
}
|
|
1072
|
-
function Ue(t, e, r) {
|
|
1073
|
-
let n = t.charCodeAt(e);
|
|
1074
|
-
if (n != 39 && n != 34 && n != 40)
|
|
1075
|
-
return !1;
|
|
1076
|
-
let s = n == 40 ? 41 : n;
|
|
1077
|
-
for (let i = e + 1, o = !1; i < t.length; i++) {
|
|
1078
|
-
let a = t.charCodeAt(i);
|
|
1079
|
-
if (o)
|
|
1080
|
-
o = !1;
|
|
1081
|
-
else {
|
|
1082
|
-
if (a == s)
|
|
1083
|
-
return g(u.LinkTitle, e + r, i + 1 + r);
|
|
1084
|
-
a == 92 && (o = !0);
|
|
1085
|
-
}
|
|
1086
|
-
}
|
|
1087
|
-
return null;
|
|
1088
|
-
}
|
|
1089
|
-
function qe(t, e, r, n) {
|
|
1090
|
-
for (let s = !1, i = e + 1, o = Math.min(t.length, i + 999); i < o; i++) {
|
|
1091
|
-
let a = t.charCodeAt(i);
|
|
1092
|
-
if (s)
|
|
1093
|
-
s = !1;
|
|
1094
|
-
else {
|
|
1095
|
-
if (a == 93)
|
|
1096
|
-
return n ? !1 : g(u.LinkLabel, e + r, i + 1 + r);
|
|
1097
|
-
if (n && !x(a) && (n = !1), a == 91)
|
|
1098
|
-
return !1;
|
|
1099
|
-
a == 92 && (s = !0);
|
|
1100
|
-
}
|
|
1101
|
-
}
|
|
1102
|
-
return null;
|
|
1103
|
-
}
|
|
1104
|
-
class Et {
|
|
1105
|
-
/**
|
|
1106
|
-
@internal
|
|
1107
|
-
*/
|
|
1108
|
-
constructor(e, r, n) {
|
|
1109
|
-
this.parser = e, this.text = r, this.offset = n, this.parts = [];
|
|
1110
|
-
}
|
|
1111
|
-
/**
|
|
1112
|
-
Get the character code at the given (document-relative)
|
|
1113
|
-
position.
|
|
1114
|
-
*/
|
|
1115
|
-
char(e) {
|
|
1116
|
-
return e >= this.end ? -1 : this.text.charCodeAt(e - this.offset);
|
|
1117
|
-
}
|
|
1118
|
-
/**
|
|
1119
|
-
The position of the end of this inline section.
|
|
1120
|
-
*/
|
|
1121
|
-
get end() {
|
|
1122
|
-
return this.offset + this.text.length;
|
|
1123
|
-
}
|
|
1124
|
-
/**
|
|
1125
|
-
Get a substring of this inline section. Again uses
|
|
1126
|
-
document-relative positions.
|
|
1127
|
-
*/
|
|
1128
|
-
slice(e, r) {
|
|
1129
|
-
return this.text.slice(e - this.offset, r - this.offset);
|
|
1130
|
-
}
|
|
1131
|
-
/**
|
|
1132
|
-
@internal
|
|
1133
|
-
*/
|
|
1134
|
-
append(e) {
|
|
1135
|
-
return this.parts.push(e), e.to;
|
|
1136
|
-
}
|
|
1137
|
-
/**
|
|
1138
|
-
Add a [delimiter](#DelimiterType) at this given position. `open`
|
|
1139
|
-
and `close` indicate whether this delimiter is opening, closing,
|
|
1140
|
-
or both. Returns the end of the delimiter, for convenient
|
|
1141
|
-
returning from [parse functions](#InlineParser.parse).
|
|
1142
|
-
*/
|
|
1143
|
-
addDelimiter(e, r, n, s, i) {
|
|
1144
|
-
return this.append(new C(e, r, n, (s ? 1 : 0) | (i ? 2 : 0)));
|
|
1145
|
-
}
|
|
1146
|
-
/**
|
|
1147
|
-
Returns true when there is an unmatched link or image opening
|
|
1148
|
-
token before the current position.
|
|
1149
|
-
*/
|
|
1150
|
-
get hasOpenLink() {
|
|
1151
|
-
for (let e = this.parts.length - 1; e >= 0; e--) {
|
|
1152
|
-
let r = this.parts[e];
|
|
1153
|
-
if (r instanceof C && (r.type == H || r.type == W))
|
|
1154
|
-
return !0;
|
|
1155
|
-
}
|
|
1156
|
-
return !1;
|
|
1157
|
-
}
|
|
1158
|
-
/**
|
|
1159
|
-
Add an inline element. Returns the end of the element.
|
|
1160
|
-
*/
|
|
1161
|
-
addElement(e) {
|
|
1162
|
-
return this.append(e);
|
|
1163
|
-
}
|
|
1164
|
-
/**
|
|
1165
|
-
Resolve markers between this.parts.length and from, wrapping matched markers in the
|
|
1166
|
-
appropriate node and updating the content of this.parts. @internal
|
|
1167
|
-
*/
|
|
1168
|
-
resolveMarkers(e) {
|
|
1169
|
-
for (let n = e; n < this.parts.length; n++) {
|
|
1170
|
-
let s = this.parts[n];
|
|
1171
|
-
if (!(s instanceof C && s.type.resolve && s.side & 2))
|
|
1172
|
-
continue;
|
|
1173
|
-
let i = s.type == $e || s.type == je, o = s.to - s.from, a, l = n - 1;
|
|
1174
|
-
for (; l >= e; l--) {
|
|
1175
|
-
let k = this.parts[l];
|
|
1176
|
-
if (k instanceof C && k.side & 1 && k.type == s.type && // Ignore emphasis delimiters where the character count doesn't match
|
|
1177
|
-
!(i && (s.side & 1 || k.side & 2) && (k.to - k.from + o) % 3 == 0 && ((k.to - k.from) % 3 || o % 3))) {
|
|
1178
|
-
a = k;
|
|
1179
|
-
break;
|
|
1180
|
-
}
|
|
1181
|
-
}
|
|
1182
|
-
if (!a)
|
|
1183
|
-
continue;
|
|
1184
|
-
let f = s.type.resolve, h = [], p = a.from, d = s.to;
|
|
1185
|
-
if (i) {
|
|
1186
|
-
let k = Math.min(2, a.to - a.from, o);
|
|
1187
|
-
p = a.to - k, d = s.from + k, f = k == 1 ? "Emphasis" : "StrongEmphasis";
|
|
1188
|
-
}
|
|
1189
|
-
a.type.mark && h.push(this.elt(a.type.mark, p, a.to));
|
|
1190
|
-
for (let k = l + 1; k < n; k++)
|
|
1191
|
-
this.parts[k] instanceof z && h.push(this.parts[k]), this.parts[k] = null;
|
|
1192
|
-
s.type.mark && h.push(this.elt(s.type.mark, s.from, d));
|
|
1193
|
-
let m = this.elt(f, p, d, h);
|
|
1194
|
-
this.parts[l] = i && a.from != p ? new C(a.type, a.from, p, a.side) : null, (this.parts[n] = i && s.to != d ? new C(s.type, d, s.to, s.side) : null) ? this.parts.splice(n, 0, m) : this.parts[n] = m;
|
|
1195
|
-
}
|
|
1196
|
-
let r = [];
|
|
1197
|
-
for (let n = e; n < this.parts.length; n++) {
|
|
1198
|
-
let s = this.parts[n];
|
|
1199
|
-
s instanceof z && r.push(s);
|
|
1200
|
-
}
|
|
1201
|
-
return r;
|
|
1202
|
-
}
|
|
1203
|
-
/**
|
|
1204
|
-
Find an opening delimiter of the given type. Returns `null` if
|
|
1205
|
-
no delimiter is found, or an index that can be passed to
|
|
1206
|
-
[`takeContent`](#InlineContext.takeContent) otherwise.
|
|
1207
|
-
*/
|
|
1208
|
-
findOpeningDelimiter(e) {
|
|
1209
|
-
for (let r = this.parts.length - 1; r >= 0; r--) {
|
|
1210
|
-
let n = this.parts[r];
|
|
1211
|
-
if (n instanceof C && n.type == e)
|
|
1212
|
-
return r;
|
|
1213
|
-
}
|
|
1214
|
-
return null;
|
|
1215
|
-
}
|
|
1216
|
-
/**
|
|
1217
|
-
Remove all inline elements and delimiters starting from the
|
|
1218
|
-
given index (which you should get from
|
|
1219
|
-
[`findOpeningDelimiter`](#InlineContext.findOpeningDelimiter),
|
|
1220
|
-
resolve delimiters inside of them, and return them as an array
|
|
1221
|
-
of elements.
|
|
1222
|
-
*/
|
|
1223
|
-
takeContent(e) {
|
|
1224
|
-
let r = this.resolveMarkers(e);
|
|
1225
|
-
return this.parts.length = e, r;
|
|
1226
|
-
}
|
|
1227
|
-
/**
|
|
1228
|
-
Skip space after the given (document) position, returning either
|
|
1229
|
-
the position of the next non-space character or the end of the
|
|
1230
|
-
section.
|
|
1231
|
-
*/
|
|
1232
|
-
skipSpace(e) {
|
|
1233
|
-
return O(this.text, e - this.offset) + this.offset;
|
|
1234
|
-
}
|
|
1235
|
-
elt(e, r, n, s) {
|
|
1236
|
-
return typeof e == "string" ? g(this.parser.getNodeType(e), r, n, s) : new Xe(e, r);
|
|
1237
|
-
}
|
|
1238
|
-
}
|
|
1239
|
-
function ee(t, e) {
|
|
1240
|
-
if (!e.length)
|
|
1241
|
-
return t;
|
|
1242
|
-
if (!t.length)
|
|
1243
|
-
return e;
|
|
1244
|
-
let r = t.slice(), n = 0;
|
|
1245
|
-
for (let s of e) {
|
|
1246
|
-
for (; n < r.length && r[n].to < s.to; )
|
|
1247
|
-
n++;
|
|
1248
|
-
if (n < r.length && r[n].from < s.from) {
|
|
1249
|
-
let i = r[n];
|
|
1250
|
-
i instanceof z && (r[n] = new z(i.type, i.from, i.to, ee(i.children, [s])));
|
|
1251
|
-
} else
|
|
1252
|
-
r.splice(n++, 0, s);
|
|
1253
|
-
}
|
|
1254
|
-
return r;
|
|
1255
|
-
}
|
|
1256
|
-
const Mt = [u.CodeBlock, u.ListItem, u.OrderedList, u.BulletList];
|
|
1257
|
-
class Ht {
|
|
1258
|
-
constructor(e, r) {
|
|
1259
|
-
this.fragments = e, this.input = r, this.i = 0, this.fragment = null, this.fragmentEnd = -1, this.cursor = null, e.length && (this.fragment = e[this.i++]);
|
|
1260
|
-
}
|
|
1261
|
-
nextFragment() {
|
|
1262
|
-
this.fragment = this.i < this.fragments.length ? this.fragments[this.i++] : null, this.cursor = null, this.fragmentEnd = -1;
|
|
1263
|
-
}
|
|
1264
|
-
moveTo(e, r) {
|
|
1265
|
-
for (; this.fragment && this.fragment.to <= e; )
|
|
1266
|
-
this.nextFragment();
|
|
1267
|
-
if (!this.fragment || this.fragment.from > (e ? e - 1 : 0))
|
|
1268
|
-
return !1;
|
|
1269
|
-
if (this.fragmentEnd < 0) {
|
|
1270
|
-
let i = this.fragment.to;
|
|
1271
|
-
for (; i > 0 && this.input.read(i - 1, i) != `
|
|
1272
|
-
`; )
|
|
1273
|
-
i--;
|
|
1274
|
-
this.fragmentEnd = i ? i - 1 : 0;
|
|
1275
|
-
}
|
|
1276
|
-
let n = this.cursor;
|
|
1277
|
-
n || (n = this.cursor = this.fragment.tree.cursor(), n.firstChild());
|
|
1278
|
-
let s = e + this.fragment.offset;
|
|
1279
|
-
for (; n.to <= s; )
|
|
1280
|
-
if (!n.parent())
|
|
1281
|
-
return !1;
|
|
1282
|
-
for (; ; ) {
|
|
1283
|
-
if (n.from >= s)
|
|
1284
|
-
return this.fragment.from <= r;
|
|
1285
|
-
if (!n.childAfter(s))
|
|
1286
|
-
return !1;
|
|
1287
|
-
}
|
|
1288
|
-
}
|
|
1289
|
-
matches(e) {
|
|
1290
|
-
let r = this.cursor.tree;
|
|
1291
|
-
return r && r.prop(v.contextHash) == e;
|
|
1292
|
-
}
|
|
1293
|
-
takeNodes(e) {
|
|
1294
|
-
let r = this.cursor, n = this.fragment.offset, s = this.fragmentEnd - (this.fragment.openEnd ? 1 : 0), i = e.absoluteLineStart, o = i, a = e.block.children.length, l = o, f = a;
|
|
1295
|
-
for (; ; ) {
|
|
1296
|
-
if (r.to - n > s) {
|
|
1297
|
-
if (r.type.isAnonymous && r.firstChild())
|
|
1298
|
-
continue;
|
|
1299
|
-
break;
|
|
1300
|
-
}
|
|
1301
|
-
let h = Qe(r.from - n, e.ranges);
|
|
1302
|
-
if (r.to - n <= e.ranges[e.rangeI].to)
|
|
1303
|
-
e.addNode(r.tree, h);
|
|
1304
|
-
else {
|
|
1305
|
-
let p = new E(e.parser.nodeSet.types[u.Paragraph], [], [], 0, e.block.hashProp);
|
|
1306
|
-
e.reusePlaceholders.set(p, r.tree), e.addNode(p, h);
|
|
1307
|
-
}
|
|
1308
|
-
if (r.type.is("Block") && (Mt.indexOf(r.type.id) < 0 ? (o = r.to - n, a = e.block.children.length) : (o = l, a = f, l = r.to - n, f = e.block.children.length)), !r.nextSibling())
|
|
1309
|
-
break;
|
|
1310
|
-
}
|
|
1311
|
-
for (; e.block.children.length > a; )
|
|
1312
|
-
e.block.children.pop(), e.block.positions.pop();
|
|
1313
|
-
return o - i;
|
|
1314
|
-
}
|
|
1315
|
-
}
|
|
1316
|
-
function Qe(t, e) {
|
|
1317
|
-
let r = t;
|
|
1318
|
-
for (let n = 1; n < e.length; n++) {
|
|
1319
|
-
let s = e[n - 1].to, i = e[n].from;
|
|
1320
|
-
s < t && (r -= i - s);
|
|
1321
|
-
}
|
|
1322
|
-
return r;
|
|
1323
|
-
}
|
|
1324
|
-
const Pt = Be({
|
|
1325
|
-
"Blockquote/...": c.quote,
|
|
1326
|
-
HorizontalRule: c.contentSeparator,
|
|
1327
|
-
"ATXHeading1/... SetextHeading1/...": c.heading1,
|
|
1328
|
-
"ATXHeading2/... SetextHeading2/...": c.heading2,
|
|
1329
|
-
"ATXHeading3/...": c.heading3,
|
|
1330
|
-
"ATXHeading4/...": c.heading4,
|
|
1331
|
-
"ATXHeading5/...": c.heading5,
|
|
1332
|
-
"ATXHeading6/...": c.heading6,
|
|
1333
|
-
"Comment CommentBlock": c.comment,
|
|
1334
|
-
Escape: c.escape,
|
|
1335
|
-
Entity: c.character,
|
|
1336
|
-
"Emphasis/...": c.emphasis,
|
|
1337
|
-
"StrongEmphasis/...": c.strong,
|
|
1338
|
-
"Link/... Image/...": c.link,
|
|
1339
|
-
"OrderedList/... BulletList/...": c.list,
|
|
1340
|
-
"BlockQuote/...": c.quote,
|
|
1341
|
-
"InlineCode CodeText": c.monospace,
|
|
1342
|
-
"URL Autolink": c.url,
|
|
1343
|
-
"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark": c.processingInstruction,
|
|
1344
|
-
"CodeInfo LinkLabel": c.labelName,
|
|
1345
|
-
LinkTitle: c.string,
|
|
1346
|
-
Paragraph: c.content
|
|
1347
|
-
}), vt = new U(new Ae(De).extend(Pt), Object.keys(F).map((t) => F[t]), Object.keys(F).map((t) => Te[t]), Object.keys(F), xt, Ee, Object.keys(Q).map((t) => Q[t]), Object.keys(Q), []);
|
|
1348
|
-
function Nt(t, e, r) {
|
|
1349
|
-
let n = [];
|
|
1350
|
-
for (let s = t.firstChild, i = e; ; s = s.nextSibling) {
|
|
1351
|
-
let o = s ? s.from : r;
|
|
1352
|
-
if (o > i && n.push({ from: i, to: o }), !s)
|
|
1353
|
-
break;
|
|
1354
|
-
i = s.to;
|
|
1355
|
-
}
|
|
1356
|
-
return n;
|
|
1357
|
-
}
|
|
1358
|
-
function yt(t) {
|
|
1359
|
-
let { codeParser: e, htmlParser: r } = t;
|
|
1360
|
-
return { wrap: it((s, i) => {
|
|
1361
|
-
let o = s.type.id;
|
|
1362
|
-
if (e && (o == u.CodeBlock || o == u.FencedCode)) {
|
|
1363
|
-
let a = "";
|
|
1364
|
-
if (o == u.FencedCode) {
|
|
1365
|
-
let f = s.node.getChild(u.CodeInfo);
|
|
1366
|
-
f && (a = i.read(f.from, f.to));
|
|
1367
|
-
}
|
|
1368
|
-
let l = e(a);
|
|
1369
|
-
if (l)
|
|
1370
|
-
return { parser: l, overlay: (f) => f.type.id == u.CodeText };
|
|
1371
|
-
} else if (r && (o == u.HTMLBlock || o == u.HTMLTag || o == u.CommentBlock))
|
|
1372
|
-
return { parser: r, overlay: Nt(s.node, s.from, s.to) };
|
|
1373
|
-
return null;
|
|
1374
|
-
}) };
|
|
1375
|
-
}
|
|
1376
|
-
const Ot = { resolve: "Strikethrough", mark: "StrikethroughMark" }, Rt = {
|
|
1377
|
-
defineNodes: [{
|
|
1378
|
-
name: "Strikethrough",
|
|
1379
|
-
style: { "Strikethrough/...": c.strikethrough }
|
|
1380
|
-
}, {
|
|
1381
|
-
name: "StrikethroughMark",
|
|
1382
|
-
style: c.processingInstruction
|
|
1383
|
-
}],
|
|
1384
|
-
parseInline: [{
|
|
1385
|
-
name: "Strikethrough",
|
|
1386
|
-
parse(t, e, r) {
|
|
1387
|
-
if (e != 126 || t.char(r + 1) != 126 || t.char(r + 2) == 126)
|
|
1388
|
-
return -1;
|
|
1389
|
-
let n = t.slice(r - 1, r), s = t.slice(r + 2, r + 3), i = /\s|^$/.test(n), o = /\s|^$/.test(s), a = D.test(n), l = D.test(s);
|
|
1390
|
-
return t.addDelimiter(Ot, r, r + 2, !o && (!l || i || a), !i && (!a || o || l));
|
|
1391
|
-
},
|
|
1392
|
-
after: "Emphasis"
|
|
1393
|
-
}]
|
|
1394
|
-
};
|
|
1395
|
-
function R(t, e, r = 0, n, s = 0) {
|
|
1396
|
-
let i = 0, o = !0, a = -1, l = -1, f = !1, h = () => {
|
|
1397
|
-
n.push(t.elt("TableCell", s + a, s + l, t.parser.parseInline(e.slice(a, l), s + a)));
|
|
1398
|
-
};
|
|
1399
|
-
for (let p = r; p < e.length; p++) {
|
|
1400
|
-
let d = e.charCodeAt(p);
|
|
1401
|
-
d == 124 && !f ? ((!o || a > -1) && i++, o = !1, n && (a > -1 && h(), n.push(t.elt("TableDelimiter", p + s, p + s + 1))), a = l = -1) : (f || d != 32 && d != 9) && (a < 0 && (a = p), l = p + 1), f = !f && d == 92;
|
|
1402
|
-
}
|
|
1403
|
-
return a > -1 && (i++, n && h()), i;
|
|
1404
|
-
}
|
|
1405
|
-
function ce(t, e) {
|
|
1406
|
-
for (let r = e; r < t.length; r++) {
|
|
1407
|
-
let n = t.charCodeAt(r);
|
|
1408
|
-
if (n == 124)
|
|
1409
|
-
return !0;
|
|
1410
|
-
n == 92 && r++;
|
|
1411
|
-
}
|
|
1412
|
-
return !1;
|
|
1413
|
-
}
|
|
1414
|
-
const Ze = /^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;
|
|
1415
|
-
class me {
|
|
1416
|
-
constructor() {
|
|
1417
|
-
this.rows = null;
|
|
1418
|
-
}
|
|
1419
|
-
nextLine(e, r, n) {
|
|
1420
|
-
if (this.rows == null) {
|
|
1421
|
-
this.rows = !1;
|
|
1422
|
-
let s;
|
|
1423
|
-
if ((r.next == 45 || r.next == 58 || r.next == 124) && Ze.test(s = r.text.slice(r.pos))) {
|
|
1424
|
-
let i = [];
|
|
1425
|
-
R(e, n.content, 0, i, n.start) == R(e, s, r.pos) && (this.rows = [
|
|
1426
|
-
e.elt("TableHeader", n.start, n.start + n.content.length, i),
|
|
1427
|
-
e.elt("TableDelimiter", e.lineStart + r.pos, e.lineStart + r.text.length)
|
|
1428
|
-
]);
|
|
1429
|
-
}
|
|
1430
|
-
} else if (this.rows) {
|
|
1431
|
-
let s = [];
|
|
1432
|
-
R(e, r.text, r.pos, s, e.lineStart), this.rows.push(e.elt("TableRow", e.lineStart + r.pos, e.lineStart + r.text.length, s));
|
|
1433
|
-
}
|
|
1434
|
-
return !1;
|
|
1435
|
-
}
|
|
1436
|
-
finish(e, r) {
|
|
1437
|
-
return this.rows ? (e.addLeafElement(r, e.elt("Table", r.start, r.start + r.content.length, this.rows)), !0) : !1;
|
|
1438
|
-
}
|
|
1439
|
-
}
|
|
1440
|
-
const Tt = {
|
|
1441
|
-
defineNodes: [
|
|
1442
|
-
{ name: "Table", block: !0 },
|
|
1443
|
-
{ name: "TableHeader", style: { "TableHeader/...": c.heading } },
|
|
1444
|
-
"TableRow",
|
|
1445
|
-
{ name: "TableCell", style: c.content },
|
|
1446
|
-
{ name: "TableDelimiter", style: c.processingInstruction }
|
|
1447
|
-
],
|
|
1448
|
-
parseBlock: [{
|
|
1449
|
-
name: "Table",
|
|
1450
|
-
leaf(t, e) {
|
|
1451
|
-
return ce(e.content, 0) ? new me() : null;
|
|
1452
|
-
},
|
|
1453
|
-
endLeaf(t, e, r) {
|
|
1454
|
-
if (r.parsers.some((s) => s instanceof me) || !ce(e.text, e.basePos))
|
|
1455
|
-
return !1;
|
|
1456
|
-
let n = t.peekLine();
|
|
1457
|
-
return Ze.test(n) && R(t, e.text, e.basePos) == R(t, n, e.basePos);
|
|
1458
|
-
},
|
|
1459
|
-
before: "SetextHeading"
|
|
1460
|
-
}]
|
|
1461
|
-
};
|
|
1462
|
-
class zt {
|
|
1463
|
-
nextLine() {
|
|
1464
|
-
return !1;
|
|
1465
|
-
}
|
|
1466
|
-
finish(e, r) {
|
|
1467
|
-
return e.addLeafElement(r, e.elt("Task", r.start, r.start + r.content.length, [
|
|
1468
|
-
e.elt("TaskMarker", r.start, r.start + 3),
|
|
1469
|
-
...e.parser.parseInline(r.content.slice(3), r.start + 3)
|
|
1470
|
-
])), !0;
|
|
1471
|
-
}
|
|
1472
|
-
}
|
|
1473
|
-
const Dt = {
|
|
1474
|
-
defineNodes: [
|
|
1475
|
-
{ name: "Task", block: !0, style: c.list },
|
|
1476
|
-
{ name: "TaskMarker", style: c.atom }
|
|
1477
|
-
],
|
|
1478
|
-
parseBlock: [{
|
|
1479
|
-
name: "TaskList",
|
|
1480
|
-
leaf(t, e) {
|
|
1481
|
-
return /^\[[ xX]\][ \t]/.test(e.content) && t.parentType().name == "ListItem" ? new zt() : null;
|
|
1482
|
-
},
|
|
1483
|
-
after: "SetextHeading"
|
|
1484
|
-
}]
|
|
1485
|
-
}, ge = /(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy, ke = /[\w-]+(\.[\w-]+)+(\/[^\s<]*)?/gy, Ft = /[\w-]+\.[\w-]+($|\/)/, Le = /[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy, be = /\/[a-zA-Z\d@.]+/gy;
|
|
1486
|
-
function we(t, e, r, n) {
|
|
1487
|
-
let s = 0;
|
|
1488
|
-
for (let i = e; i < r; i++)
|
|
1489
|
-
t[i] == n && s++;
|
|
1490
|
-
return s;
|
|
1491
|
-
}
|
|
1492
|
-
function Xt(t, e) {
|
|
1493
|
-
ke.lastIndex = e;
|
|
1494
|
-
let r = ke.exec(t);
|
|
1495
|
-
if (!r || Ft.exec(r[0])[0].indexOf("_") > -1)
|
|
1496
|
-
return -1;
|
|
1497
|
-
let n = e + r[0].length;
|
|
1498
|
-
for (; ; ) {
|
|
1499
|
-
let s = t[n - 1], i;
|
|
1500
|
-
if (/[?!.,:*_~]/.test(s) || s == ")" && we(t, e, n, ")") > we(t, e, n, "("))
|
|
1501
|
-
n--;
|
|
1502
|
-
else if (s == ";" && (i = /&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(t.slice(e, n))))
|
|
1503
|
-
n = e + i.index;
|
|
1504
|
-
else
|
|
1505
|
-
break;
|
|
1506
|
-
}
|
|
1507
|
-
return n;
|
|
1508
|
-
}
|
|
1509
|
-
function Se(t, e) {
|
|
1510
|
-
Le.lastIndex = e;
|
|
1511
|
-
let r = Le.exec(t);
|
|
1512
|
-
if (!r)
|
|
1513
|
-
return -1;
|
|
1514
|
-
let n = r[0][r[0].length - 1];
|
|
1515
|
-
return n == "_" || n == "-" ? -1 : e + r[0].length - (n == "." ? 1 : 0);
|
|
1516
|
-
}
|
|
1517
|
-
const $t = {
|
|
1518
|
-
parseInline: [{
|
|
1519
|
-
name: "Autolink",
|
|
1520
|
-
parse(t, e, r) {
|
|
1521
|
-
let n = r - t.offset;
|
|
1522
|
-
if (n && /\w/.test(t.text[n - 1]))
|
|
1523
|
-
return -1;
|
|
1524
|
-
ge.lastIndex = n;
|
|
1525
|
-
let s = ge.exec(t.text), i = -1;
|
|
1526
|
-
if (!s)
|
|
1527
|
-
return -1;
|
|
1528
|
-
if (s[1] || s[2]) {
|
|
1529
|
-
if (i = Xt(t.text, n + s[0].length), i > -1 && t.hasOpenLink) {
|
|
1530
|
-
let o = /([^\[\]]|\[[^\]]*\])*/.exec(t.text.slice(n, i));
|
|
1531
|
-
i = n + o[0].length;
|
|
1532
|
-
}
|
|
1533
|
-
} else s[3] ? i = Se(t.text, n) : (i = Se(t.text, n + s[0].length), i > -1 && s[0] == "xmpp:" && (be.lastIndex = i, s = be.exec(t.text), s && (i = s.index + s[0].length)));
|
|
1534
|
-
return i < 0 ? -1 : (t.addElement(t.elt("URL", r, i + t.offset)), i + t.offset);
|
|
1535
|
-
}
|
|
1536
|
-
}]
|
|
1537
|
-
}, jt = [Tt, Dt, Rt, $t];
|
|
1538
|
-
function Ge(t, e, r) {
|
|
1539
|
-
return (n, s, i) => {
|
|
1540
|
-
if (s != t || n.char(i + 1) == t)
|
|
1541
|
-
return -1;
|
|
1542
|
-
let o = [n.elt(r, i, i + 1)];
|
|
1543
|
-
for (let a = i + 1; a < n.end; a++) {
|
|
1544
|
-
let l = n.char(a);
|
|
1545
|
-
if (l == t)
|
|
1546
|
-
return n.addElement(n.elt(e, i, a + 1, o.concat(n.elt(r, a, a + 1))));
|
|
1547
|
-
if (l == 92 && o.push(n.elt("Escape", a, a++ + 2)), x(l))
|
|
1548
|
-
break;
|
|
1549
|
-
}
|
|
1550
|
-
return -1;
|
|
1551
|
-
};
|
|
1552
|
-
}
|
|
1553
|
-
const _t = {
|
|
1554
|
-
defineNodes: [
|
|
1555
|
-
{ name: "Superscript", style: c.special(c.content) },
|
|
1556
|
-
{ name: "SuperscriptMark", style: c.processingInstruction }
|
|
1557
|
-
],
|
|
1558
|
-
parseInline: [{
|
|
1559
|
-
name: "Superscript",
|
|
1560
|
-
parse: Ge(94, "Superscript", "SuperscriptMark")
|
|
1561
|
-
}]
|
|
1562
|
-
}, Ut = {
|
|
1563
|
-
defineNodes: [
|
|
1564
|
-
{ name: "Subscript", style: c.special(c.content) },
|
|
1565
|
-
{ name: "SubscriptMark", style: c.processingInstruction }
|
|
1566
|
-
],
|
|
1567
|
-
parseInline: [{
|
|
1568
|
-
name: "Subscript",
|
|
1569
|
-
parse: Ge(126, "Subscript", "SubscriptMark")
|
|
1570
|
-
}]
|
|
1571
|
-
}, qt = {
|
|
1572
|
-
defineNodes: [{ name: "Emoji", style: c.character }],
|
|
1573
|
-
parseInline: [{
|
|
1574
|
-
name: "Emoji",
|
|
1575
|
-
parse(t, e, r) {
|
|
1576
|
-
let n;
|
|
1577
|
-
return e != 58 || !(n = /^[a-zA-Z_0-9]+:/.exec(t.slice(r + 1, t.end))) ? -1 : t.addElement(t.elt("Emoji", r, r + 1 + n[0].length));
|
|
1578
|
-
}
|
|
1579
|
-
}]
|
|
1580
|
-
}, Ve = /* @__PURE__ */ ft({ commentTokens: { block: { open: "<!--", close: "-->" } } }), Ke = /* @__PURE__ */ new v(), Je = /* @__PURE__ */ vt.configure({
|
|
1581
|
-
props: [
|
|
1582
|
-
/* @__PURE__ */ Ie.add((t) => !t.is("Block") || t.is("Document") || te(t) != null || Qt(t) ? void 0 : (e, r) => ({ from: r.doc.lineAt(e.from).to, to: e.to })),
|
|
1583
|
-
/* @__PURE__ */ Ke.add(te),
|
|
1584
|
-
/* @__PURE__ */ dt.add({
|
|
1585
|
-
Document: () => null
|
|
1586
|
-
}),
|
|
1587
|
-
/* @__PURE__ */ pt.add({
|
|
1588
|
-
Document: Ve
|
|
1589
|
-
})
|
|
1590
|
-
]
|
|
1591
|
-
});
|
|
1592
|
-
function te(t) {
|
|
1593
|
-
let e = /^(?:ATX|Setext)Heading(\d)$/.exec(t.name);
|
|
1594
|
-
return e ? +e[1] : void 0;
|
|
1595
|
-
}
|
|
1596
|
-
function Qt(t) {
|
|
1597
|
-
return t.name == "OrderedList" || t.name == "BulletList";
|
|
1598
|
-
}
|
|
1599
|
-
function Zt(t, e) {
|
|
1600
|
-
let r = t;
|
|
1601
|
-
for (; ; ) {
|
|
1602
|
-
let n = r.nextSibling, s;
|
|
1603
|
-
if (!n || (s = te(n.type)) != null && s <= e)
|
|
1604
|
-
break;
|
|
1605
|
-
r = n;
|
|
1606
|
-
}
|
|
1607
|
-
return r.to;
|
|
1608
|
-
}
|
|
1609
|
-
const Gt = /* @__PURE__ */ ot.of((t, e, r) => {
|
|
1610
|
-
for (let n = _(t).resolveInner(r, -1); n && !(n.from < e); n = n.parent) {
|
|
1611
|
-
let s = n.type.prop(Ke);
|
|
1612
|
-
if (s == null)
|
|
1613
|
-
continue;
|
|
1614
|
-
let i = Zt(n, s);
|
|
1615
|
-
if (i > r)
|
|
1616
|
-
return { from: r, to: i };
|
|
1617
|
-
}
|
|
1618
|
-
return null;
|
|
1619
|
-
});
|
|
1620
|
-
function oe(t) {
|
|
1621
|
-
return new ht(Ve, t, [], "markdown");
|
|
1622
|
-
}
|
|
1623
|
-
const Vt = /* @__PURE__ */ oe(Je), Kt = /* @__PURE__ */ Je.configure([jt, Ut, _t, qt, {
|
|
1624
|
-
props: [
|
|
1625
|
-
/* @__PURE__ */ Ie.add({
|
|
1626
|
-
Table: (t, e) => ({ from: e.doc.lineAt(t.from).to, to: t.to })
|
|
1627
|
-
})
|
|
1628
|
-
]
|
|
1629
|
-
}]), re = /* @__PURE__ */ oe(Kt);
|
|
1630
|
-
function Jt(t, e) {
|
|
1631
|
-
return (r) => {
|
|
1632
|
-
if (r && t) {
|
|
1633
|
-
let n = null;
|
|
1634
|
-
if (r = /\S*/.exec(r)[0], typeof t == "function" ? n = t(r) : n = he.matchLanguageName(t, r, !0), n instanceof he)
|
|
1635
|
-
return n.support ? n.support.language.parser : gt.getSkippingParser(n.load());
|
|
1636
|
-
if (n)
|
|
1637
|
-
return n.parser;
|
|
1638
|
-
}
|
|
1639
|
-
return e ? e.parser : null;
|
|
1640
|
-
};
|
|
1641
|
-
}
|
|
1642
|
-
class Z {
|
|
1643
|
-
constructor(e, r, n, s, i, o, a) {
|
|
1644
|
-
this.node = e, this.from = r, this.to = n, this.spaceBefore = s, this.spaceAfter = i, this.type = o, this.item = a;
|
|
1645
|
-
}
|
|
1646
|
-
blank(e, r = !0) {
|
|
1647
|
-
let n = this.spaceBefore + (this.node.name == "Blockquote" ? ">" : "");
|
|
1648
|
-
if (e != null) {
|
|
1649
|
-
for (; n.length < e; )
|
|
1650
|
-
n += " ";
|
|
1651
|
-
return n;
|
|
1652
|
-
} else {
|
|
1653
|
-
for (let s = this.to - this.from - n.length - this.spaceAfter.length; s > 0; s--)
|
|
1654
|
-
n += " ";
|
|
1655
|
-
return n + (r ? this.spaceAfter : "");
|
|
1656
|
-
}
|
|
1657
|
-
}
|
|
1658
|
-
marker(e, r) {
|
|
1659
|
-
let n = this.node.name == "OrderedList" ? String(+We(this.item, e)[2] + r) : "";
|
|
1660
|
-
return this.spaceBefore + n + this.type + this.spaceAfter;
|
|
1661
|
-
}
|
|
1662
|
-
}
|
|
1663
|
-
function Ye(t, e) {
|
|
1664
|
-
let r = [], n = [];
|
|
1665
|
-
for (let s = t; s; s = s.parent) {
|
|
1666
|
-
if (s.name == "FencedCode")
|
|
1667
|
-
return n;
|
|
1668
|
-
(s.name == "ListItem" || s.name == "Blockquote") && r.push(s);
|
|
1669
|
-
}
|
|
1670
|
-
for (let s = r.length - 1; s >= 0; s--) {
|
|
1671
|
-
let i = r[s], o, a = e.lineAt(i.from), l = i.from - a.from;
|
|
1672
|
-
if (i.name == "Blockquote" && (o = /^ *>( ?)/.exec(a.text.slice(l))))
|
|
1673
|
-
n.push(new Z(i, l, l + o[0].length, "", o[1], ">", null));
|
|
1674
|
-
else if (i.name == "ListItem" && i.parent.name == "OrderedList" && (o = /^( *)\d+([.)])( *)/.exec(a.text.slice(l)))) {
|
|
1675
|
-
let f = o[3], h = o[0].length;
|
|
1676
|
-
f.length >= 4 && (f = f.slice(0, f.length - 4), h -= 4), n.push(new Z(i.parent, l, l + h, o[1], f, o[2], i));
|
|
1677
|
-
} else if (i.name == "ListItem" && i.parent.name == "BulletList" && (o = /^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(a.text.slice(l)))) {
|
|
1678
|
-
let f = o[4], h = o[0].length;
|
|
1679
|
-
f.length > 4 && (f = f.slice(0, f.length - 4), h -= 4);
|
|
1680
|
-
let p = o[2];
|
|
1681
|
-
o[3] && (p += o[3].replace(/[xX]/, " ")), n.push(new Z(i.parent, l, l + h, o[1], f, p, i));
|
|
1682
|
-
}
|
|
1683
|
-
}
|
|
1684
|
-
return n;
|
|
1685
|
-
}
|
|
1686
|
-
function We(t, e) {
|
|
1687
|
-
return /^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from, t.from + 10));
|
|
1688
|
-
}
|
|
1689
|
-
function G(t, e, r, n = 0) {
|
|
1690
|
-
for (let s = -1, i = t; ; ) {
|
|
1691
|
-
if (i.name == "ListItem") {
|
|
1692
|
-
let a = We(i, e), l = +a[2];
|
|
1693
|
-
if (s >= 0) {
|
|
1694
|
-
if (l != s + 1)
|
|
1695
|
-
return;
|
|
1696
|
-
r.push({ from: i.from + a[1].length, to: i.from + a[0].length, insert: String(s + 2 + n) });
|
|
1697
|
-
}
|
|
1698
|
-
s = l;
|
|
1699
|
-
}
|
|
1700
|
-
let o = i.nextSibling;
|
|
1701
|
-
if (!o)
|
|
1702
|
-
break;
|
|
1703
|
-
i = o;
|
|
1704
|
-
}
|
|
1705
|
-
}
|
|
1706
|
-
function ae(t, e) {
|
|
1707
|
-
let r = /^[ \t]*/.exec(t)[0].length;
|
|
1708
|
-
if (!r || e.facet(ut) != " ")
|
|
1709
|
-
return t;
|
|
1710
|
-
let n = T(t, 4, r), s = "";
|
|
1711
|
-
for (let i = n; i > 0; )
|
|
1712
|
-
i >= 4 ? (s += " ", i -= 4) : (s += " ", i--);
|
|
1713
|
-
return s + t.slice(r);
|
|
1714
|
-
}
|
|
1715
|
-
const Yt = ({ state: t, dispatch: e }) => {
|
|
1716
|
-
let r = _(t), { doc: n } = t, s = null, i = t.changeByRange((o) => {
|
|
1717
|
-
if (!o.empty || !re.isActiveAt(t, o.from, -1) && !re.isActiveAt(t, o.from, 1))
|
|
1718
|
-
return s = { range: o };
|
|
1719
|
-
let a = o.from, l = n.lineAt(a), f = Ye(r.resolveInner(a, -1), n);
|
|
1720
|
-
for (; f.length && f[f.length - 1].from > a - l.from; )
|
|
1721
|
-
f.pop();
|
|
1722
|
-
if (!f.length)
|
|
1723
|
-
return s = { range: o };
|
|
1724
|
-
let h = f[f.length - 1];
|
|
1725
|
-
if (h.to - h.spaceAfter.length > a - l.from)
|
|
1726
|
-
return s = { range: o };
|
|
1727
|
-
let p = a >= h.to - h.spaceAfter.length && !/\S/.test(l.text.slice(h.to));
|
|
1728
|
-
if (h.item && p) {
|
|
1729
|
-
let w = h.node.firstChild, S = h.node.getChild("ListItem", "ListItem");
|
|
1730
|
-
if (w.to >= a || S && S.to < a || l.from > 0 && !/[^\s>]/.test(n.lineAt(l.from - 1).text)) {
|
|
1731
|
-
let b = f.length > 1 ? f[f.length - 2] : null, A, M = "";
|
|
1732
|
-
b && b.item ? (A = l.from + b.from, M = b.marker(n, 1)) : A = l.from + (b ? b.to : 0);
|
|
1733
|
-
let B = [{ from: A, to: a, insert: M }];
|
|
1734
|
-
return h.node.name == "OrderedList" && G(h.item, n, B, -2), b && b.node.name == "OrderedList" && G(b.item, n, B), { range: P.cursor(A + M.length), changes: B };
|
|
1735
|
-
} else {
|
|
1736
|
-
let b = xe(f, t, l);
|
|
1737
|
-
return {
|
|
1738
|
-
range: P.cursor(a + b.length + 1),
|
|
1739
|
-
changes: { from: l.from, insert: b + t.lineBreak }
|
|
1740
|
-
};
|
|
1741
|
-
}
|
|
1742
|
-
}
|
|
1743
|
-
if (h.node.name == "Blockquote" && p && l.from) {
|
|
1744
|
-
let w = n.lineAt(l.from - 1), S = />\s*$/.exec(w.text);
|
|
1745
|
-
if (S && S.index == h.from) {
|
|
1746
|
-
let b = t.changes([
|
|
1747
|
-
{ from: w.from + S.index, to: w.to },
|
|
1748
|
-
{ from: l.from + h.from, to: l.to }
|
|
1749
|
-
]);
|
|
1750
|
-
return { range: o.map(b), changes: b };
|
|
1751
|
-
}
|
|
1752
|
-
}
|
|
1753
|
-
let d = [];
|
|
1754
|
-
h.node.name == "OrderedList" && G(h.item, n, d);
|
|
1755
|
-
let m = h.item && h.item.from < l.from, L = "";
|
|
1756
|
-
if (!m || /^[\s\d.)\-+*>]*/.exec(l.text)[0].length >= h.to)
|
|
1757
|
-
for (let w = 0, S = f.length - 1; w <= S; w++)
|
|
1758
|
-
L += w == S && !m ? f[w].marker(n, 1) : f[w].blank(w < S ? T(l.text, 4, f[w + 1].from) - L.length : null);
|
|
1759
|
-
let k = a;
|
|
1760
|
-
for (; k > l.from && /\s/.test(l.text.charAt(k - l.from - 1)); )
|
|
1761
|
-
k--;
|
|
1762
|
-
return L = ae(L, t), Wt(h.node, t.doc) && (L = xe(f, t, l) + t.lineBreak + L), d.push({ from: k, to: a, insert: t.lineBreak + L }), { range: P.cursor(k + L.length + 1), changes: d };
|
|
1763
|
-
});
|
|
1764
|
-
return s ? !1 : (e(t.update(i, { scrollIntoView: !0, userEvent: "input" })), !0);
|
|
1765
|
-
};
|
|
1766
|
-
function Ce(t) {
|
|
1767
|
-
return t.name == "QuoteMark" || t.name == "ListMark";
|
|
1768
|
-
}
|
|
1769
|
-
function Wt(t, e) {
|
|
1770
|
-
if (t.name != "OrderedList" && t.name != "BulletList")
|
|
1771
|
-
return !1;
|
|
1772
|
-
let r = t.firstChild, n = t.getChild("ListItem", "ListItem");
|
|
1773
|
-
if (!n)
|
|
1774
|
-
return !1;
|
|
1775
|
-
let s = e.lineAt(r.to), i = e.lineAt(n.from), o = /^[\s>]*$/.test(s.text);
|
|
1776
|
-
return s.number + (o ? 0 : 1) < i.number;
|
|
1777
|
-
}
|
|
1778
|
-
function xe(t, e, r) {
|
|
1779
|
-
let n = "";
|
|
1780
|
-
for (let s = 0, i = t.length - 2; s <= i; s++)
|
|
1781
|
-
n += t[s].blank(s < i ? T(r.text, 4, t[s + 1].from) - n.length : null, s < i);
|
|
1782
|
-
return ae(n, e);
|
|
1783
|
-
}
|
|
1784
|
-
function er(t, e) {
|
|
1785
|
-
let r = t.resolveInner(e, -1), n = e;
|
|
1786
|
-
Ce(r) && (n = r.from, r = r.parent);
|
|
1787
|
-
for (let s; s = r.childBefore(n); )
|
|
1788
|
-
if (Ce(s))
|
|
1789
|
-
n = s.from;
|
|
1790
|
-
else if (s.name == "OrderedList" || s.name == "BulletList")
|
|
1791
|
-
r = s.lastChild, n = r.to;
|
|
1792
|
-
else
|
|
1793
|
-
break;
|
|
1794
|
-
return r;
|
|
1795
|
-
}
|
|
1796
|
-
const tr = ({ state: t, dispatch: e }) => {
|
|
1797
|
-
let r = _(t), n = null, s = t.changeByRange((i) => {
|
|
1798
|
-
let o = i.from, { doc: a } = t;
|
|
1799
|
-
if (i.empty && re.isActiveAt(t, i.from)) {
|
|
1800
|
-
let l = a.lineAt(o), f = Ye(er(r, o), a);
|
|
1801
|
-
if (f.length) {
|
|
1802
|
-
let h = f[f.length - 1], p = h.to - h.spaceAfter.length + (h.spaceAfter ? 1 : 0);
|
|
1803
|
-
if (o - l.from > p && !/\S/.test(l.text.slice(p, o - l.from)))
|
|
1804
|
-
return {
|
|
1805
|
-
range: P.cursor(l.from + p),
|
|
1806
|
-
changes: { from: l.from + p, to: o }
|
|
1807
|
-
};
|
|
1808
|
-
if (o - l.from == p && // Only apply this if we're on the line that has the
|
|
1809
|
-
// construct's syntax, or there's only indentation in the
|
|
1810
|
-
// target range
|
|
1811
|
-
(!h.item || l.from <= h.item.from || !/\S/.test(l.text.slice(0, h.to)))) {
|
|
1812
|
-
let d = l.from + h.from;
|
|
1813
|
-
if (h.item && h.node.from < h.item.from && /\S/.test(l.text.slice(h.from, h.to))) {
|
|
1814
|
-
let m = h.blank(T(l.text, 4, h.to) - T(l.text, 4, h.from));
|
|
1815
|
-
return d == l.from && (m = ae(m, t)), {
|
|
1816
|
-
range: P.cursor(d + m.length),
|
|
1817
|
-
changes: { from: d, to: l.from + h.to, insert: m }
|
|
1818
|
-
};
|
|
1819
|
-
}
|
|
1820
|
-
if (d < o)
|
|
1821
|
-
return { range: P.cursor(d), changes: { from: d, to: o } };
|
|
1822
|
-
}
|
|
1823
|
-
}
|
|
1824
|
-
}
|
|
1825
|
-
return n = { range: i };
|
|
1826
|
-
});
|
|
1827
|
-
return n ? !1 : (e(t.update(s, { scrollIntoView: !0, userEvent: "delete" })), !0);
|
|
1828
|
-
}, rr = [
|
|
1829
|
-
{ key: "Enter", run: Yt },
|
|
1830
|
-
{ key: "Backspace", run: tr }
|
|
1831
|
-
], et = /* @__PURE__ */ kt({ matchClosingTags: !1 });
|
|
1832
|
-
function ar(t = {}) {
|
|
1833
|
-
let { codeLanguages: e, defaultCodeLanguage: r, addKeymap: n = !0, base: { parser: s } = Vt, completeHTMLTags: i = !0, htmlTagLanguage: o = et } = t;
|
|
1834
|
-
if (!(s instanceof U))
|
|
1835
|
-
throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");
|
|
1836
|
-
let a = t.extensions ? [t.extensions] : [], l = [o.support, Gt], f;
|
|
1837
|
-
r instanceof le ? (l.push(r.support), f = r.language) : r && (f = r);
|
|
1838
|
-
let h = e || f ? Jt(e, f) : void 0;
|
|
1839
|
-
a.push(yt({ codeParser: h, htmlParser: o.language.parser })), n && l.push(at.high(lt.of(rr)));
|
|
1840
|
-
let p = oe(s.configure(a));
|
|
1841
|
-
return i && l.push(p.data.of({ autocomplete: nr })), new le(p, l);
|
|
1842
|
-
}
|
|
1843
|
-
function nr(t) {
|
|
1844
|
-
let { state: e, pos: r } = t, n = /<[:\-\.\w\u00b7-\uffff]*$/.exec(e.sliceDoc(r - 25, r));
|
|
1845
|
-
if (!n)
|
|
1846
|
-
return null;
|
|
1847
|
-
let s = _(e).resolveInner(r, -1);
|
|
1848
|
-
for (; s && !s.type.isTop; ) {
|
|
1849
|
-
if (s.name == "CodeBlock" || s.name == "FencedCode" || s.name == "ProcessingInstructionBlock" || s.name == "CommentBlock" || s.name == "Link" || s.name == "Image")
|
|
1850
|
-
return null;
|
|
1851
|
-
s = s.parent;
|
|
1852
|
-
}
|
|
1853
|
-
return {
|
|
1854
|
-
from: r - n[0].length,
|
|
1855
|
-
to: r,
|
|
1856
|
-
options: sr(),
|
|
1857
|
-
validFor: /^<[:\-\.\w\u00b7-\uffff]*$/
|
|
1858
|
-
};
|
|
1859
|
-
}
|
|
1860
|
-
let V = null;
|
|
1861
|
-
function sr() {
|
|
1862
|
-
if (V)
|
|
1863
|
-
return V;
|
|
1864
|
-
let t = Lt(new ct(mt.create({ extensions: et }), 0, !0));
|
|
1865
|
-
return V = t ? t.options : [];
|
|
1866
|
-
}
|
|
1867
|
-
export {
|
|
1868
|
-
Vt as commonmarkLanguage,
|
|
1869
|
-
tr as deleteMarkupBackward,
|
|
1870
|
-
Yt as insertNewlineContinueMarkup,
|
|
1871
|
-
ar as markdown,
|
|
1872
|
-
rr as markdownKeymap,
|
|
1873
|
-
re as markdownLanguage
|
|
1874
|
-
};
|