@orangelogic/design-system 2.161.0 → 2.163.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/library/chunks/{AxisLabelRadial.lE2gKah-.js → AxisLabelRadial.fe7zjixN.js} +1 -1
- package/library/chunks/{BaseColumnSeries.B57B3iHh.js → BaseColumnSeries.8Mpxz385.js} +1 -1
- package/library/chunks/{CandlestickSeries.CmmI426l.js → CandlestickSeries.DuadaOTa.js} +19 -19
- package/library/chunks/{Circle.DAhHYhrc.js → Circle.6LomW0ej.js} +1 -1
- package/library/chunks/{ColumnSeries.DBgXk-b4.js → ColumnSeries.D1NLfRh5.js} +2 -2
- package/library/chunks/{EditableAxisLabel.C6H99qiS.js → EditableAxisLabel.Bi9vxLDV.js} +2 -2
- package/library/chunks/{EditableLabel.B7HB7Cu4.js → EditableLabel.CMR3O9E-.js} +1 -1
- package/library/chunks/{Gradient.DHhBnhFd.js → Gradient.CquE8_a4.js} +1 -1
- package/library/chunks/{LinearGradient.CGx00O8B.js → LinearGradient.CVN1VJp-.js} +9 -9
- package/library/chunks/{Picture.DYltTVSo.js → Picture.BYTZ_I8g.js} +1 -1
- package/library/chunks/{Polygon.BCrxKagx.js → Polygon.CU2sMltE.js} +1 -1
- package/library/chunks/{ProgressPie.CXksPJFv.js → ProgressPie.Dd74dbmm.js} +6 -6
- package/library/chunks/{RadialLabel.BYH69FGU.js → RadialLabel.7ka6ND-t.js} +1 -1
- package/library/chunks/{Scrollbar.DEv50o4R.js → Scrollbar.DqUnZReo.js} +1 -1
- package/library/chunks/Slice.BVI8rfHI.js +34 -0
- package/library/chunks/{Slider.BX8g2iGv.js → Slider.DtjYaJOw.js} +1 -1
- package/library/chunks/{SpriteResizer.CfIBMSp3.js → SpriteResizer.Ci2Wt2YJ.js} +11 -11
- package/library/chunks/{Triangle.CNY8-QfL.js → Triangle.C75emy3D.js} +1 -1
- package/library/chunks/{ZoomTools.6jZrzA7x.js → ZoomTools.CA9mtHI8.js} +2 -2
- package/library/chunks/_arrayEach.DU4X1H_a.js +8 -0
- package/library/chunks/_baseClone.BHNjfIdS.js +215 -0
- package/library/chunks/_baseEach.DQk0As2f.js +32 -0
- package/library/chunks/{_baseIteratee.BdKyHJ5i.js → _baseIteratee.sC2wLi2m.js} +3 -2
- package/library/chunks/{_baseUniq.je-HWbb3.js → _baseUniq.lwMgmtt2.js} +16 -15
- package/library/chunks/_baseXor.DixEm6JQ.js +35 -0
- package/library/chunks/_flatRest.D3ZVApI5.js +30 -0
- package/library/chunks/abnfDiagram-VRR7QNED.DKqYa5p7.js +89 -0
- package/library/chunks/{am-chart.CqdmTS0P.js → am-chart.Cr-vMjcY.js} +1577 -1727
- package/library/chunks/{animation.S74lUDDc.js → animation.BD-1xugN.js} +1 -1
- package/library/chunks/arc.xqNd6x9S.js +84 -0
- package/library/chunks/architectureDiagram-ZJ3FMSHR.CBIOk9Kp.js +4757 -0
- package/library/chunks/{asset-link-format.CUPqX8XL.js → asset-link-format.BdB6fQA_.js} +194 -194
- package/library/chunks/blockDiagram-677ZJIJ3.CeQxLPwj.js +2428 -0
- package/library/chunks/{button.8syoJXYs.js → button.DGyqdBou.js} +2 -2
- package/library/chunks/c4Diagram-LMCZKHZV.B73xdpNh.js +1580 -0
- package/library/chunks/{capitalize.BTYI3NfM.js → capitalize.CIBKBL10.js} +1 -1
- package/library/chunks/{cardinal.BCA_LB0u.js → cardinal.BXTAeOLk.js} +1 -0
- package/library/chunks/cardinalClosed.Mdce1x5M.js +59 -0
- package/library/chunks/channel.s_XjcUYI.js +5 -0
- package/library/chunks/chunk-2Q5K7J3B.Dy1Z-bMH.js +15 -0
- package/library/chunks/chunk-32BRIVSS.BbIrVi3j.js +71 -0
- package/library/chunks/chunk-5VM5RSS4.D0-lddDM.js +19 -0
- package/library/chunks/chunk-EX3LRPZG.L693y8d4.js +1412 -0
- package/library/chunks/chunk-JWPE2WC7.BV0i4LDu.js +8 -0
- package/library/chunks/chunk-MOJQB5TN.BZstBMYC.js +664 -0
- package/library/chunks/chunk-RYQCIY6F.BMsuG7ya.js +314 -0
- package/library/chunks/chunk-V7JOEXUC.DcJlyQO0.js +1537 -0
- package/library/chunks/chunk-VR4S4FIN.BpryBs7q.js +19 -0
- package/library/chunks/chunk-XXDRQBXY.CSOjab1V.js +11 -0
- package/library/chunks/classDiagram-OUVF2IWQ.Dvz7CNwe.js +18 -0
- package/library/chunks/classDiagram-v2-EOCWNBFH.Dvz7CNwe.js +18 -0
- package/library/chunks/cloneDeep.B-5z5SI3.js +51 -0
- package/library/chunks/{color-swatch-group.Dg5avknJ.js → color-swatch-group.w5DMzNco.js} +2433 -2647
- package/library/chunks/{color-swatch.DsWP2fd-.js → color-swatch.QsHoy_K1.js} +1 -1
- package/library/chunks/{colorPicker.GYgA76kc.js → colorPicker.Cg6Zxf8f.js} +5 -5
- package/library/chunks/{confirm-popover.C-eHPJaU.js → confirm-popover.D8mdy6KG.js} +2 -2
- package/library/chunks/constant.BQ4UJ-kW.js +12 -0
- package/library/chunks/{content-builder.BU8X7I6V.js → content-builder.BX4pHujE.js} +1 -1
- package/library/chunks/cose-bilkent-JH36ORCC.cfzS2XsK.js +2612 -0
- package/library/chunks/cynefin-VYW2F7L2.c7H5z9nQ.js +23790 -0
- package/library/chunks/cynefinDiagram-TSTJHNR4.C8SgNXWI.js +299 -0
- package/library/chunks/cytoscape.esm.Cbrwqewp.js +18786 -0
- package/library/chunks/dagre-VKFMJZFB.D5B1cAri.js +343 -0
- package/library/chunks/debounce.Bv1rtE8D.js +55 -0
- package/library/chunks/defaultLocale.CPy_WVtp.js +171 -0
- package/library/chunks/descending.AD5n-tFs.js +10 -0
- package/library/chunks/diagram-FQU43EPY.DJukDcLl.js +466 -0
- package/library/chunks/diagram-G47NLZAW.BBOvcbcR.js +316 -0
- package/library/chunks/diagram-NH7WQ7WH.DOpRwmC2.js +142 -0
- package/library/chunks/diagram-OA4YK3LP.Dm5WJs91.js +350 -0
- package/library/chunks/diagram-WEI45ONY.COuzdmSR.js +217 -0
- package/library/chunks/{dialog.Bzf4-IgH.js → dialog.05FgdLBZ.js} +2 -2
- package/library/chunks/{document-viewer.CGyOG1yw.js → document-viewer.gyH0NGM5.js} +7 -7
- package/library/chunks/{dot-pagination.BdZc-K0r.js → dot-pagination.Pg9O0nIh.js} +1 -1
- package/library/chunks/ebnfDiagram-CCIWWBDH.Dz-QBH6Y.js +111 -0
- package/library/chunks/erDiagram-Q63AITRT.sSw_w-2B.js +913 -0
- package/library/chunks/{exporting.DQhKH1BX.js → exporting.Djsoh75g.js} +11 -11
- package/library/chunks/flow.aZRVH3p1.js +1304 -0
- package/library/chunks/flowDiagram-23GEKE2U.CMMbuUHf.js +1642 -0
- package/library/chunks/{folder-select.BKAuh4GE.js → folder-select.Dh4SX0eU.js} +5 -5
- package/library/chunks/{gantt.tu-w6fQ5.js → gantt.Bv6_3H9y.js} +22 -22
- package/library/chunks/ganttDiagram-NO4QXBWP.DZdwd0O4.js +2715 -0
- package/library/chunks/gitGraphDiagram-IHSO6WYX.F6mwS3uS.js +818 -0
- package/library/chunks/graph.XHMI5hta.js +653 -0
- package/library/chunks/{header.e1FLwywx.js → header.DDI0MfJA.js} +1 -1
- package/library/chunks/{hierarchy.CTnBzzmQ.js → hierarchy.C4LxmFxx.js} +836 -904
- package/library/chunks/{hub-connection.CA_wS_wh.js → hub-connection.BtevPWYb.js} +1 -1
- package/library/chunks/{icon-button.DbVIFgu7.js → icon-button.BwmMJ0bI.js} +1 -1
- package/library/chunks/{icon.mxNZ85k0.js → icon.D5iM9wXS.js} +1 -1
- package/library/chunks/{iframe.DcHjOcLG.js → iframe.Cc-xZIm_.js} +1 -1
- package/library/chunks/{image.5mhGPvMN.js → image.BgODrAzQ.js} +2 -2
- package/library/chunks/{image.QVlPFadX.js → image.Y5c_hFx8.js} +1 -1
- package/library/chunks/{index.BVDhdCk-.js → index.2SOQHTpX.js} +23 -23
- package/library/chunks/index.BDn1QW8J.js +167 -0
- package/library/chunks/{index.DcjJFMlq.js → index.CrhRU5m8.js} +284 -273
- package/library/chunks/index.thKLME8E.js +77 -0
- package/library/chunks/infoDiagram-FWYZ7A6U.BnktKL7i.js +24 -0
- package/library/chunks/init.DjUOC4st.js +16 -0
- package/library/chunks/{input.BcyLZUmv.js → input.DOorVTYZ.js} +2 -2
- package/library/chunks/isArrayLikeObject.D7afXo-f.js +86 -0
- package/library/chunks/isEmpty.DtTJTUcf.js +27 -0
- package/library/chunks/ishikawaDiagram-FXEZZL3T.CFp-9Kes.js +621 -0
- package/library/chunks/journeyDiagram-5HDEW3XC.BxO1aPu_.js +837 -0
- package/library/chunks/{json.D7WeFaJm.js → json.Dz5QFEi5.js} +3 -3
- package/library/chunks/kanban-definition-HUTT4EX6.Bk8vmLFK.js +724 -0
- package/library/chunks/katex.DoRnZ_sp.js +11682 -0
- package/library/chunks/layout.DZcMFKol.js +1446 -0
- package/library/chunks/line.DP-iSN_J.js +157 -0
- package/library/chunks/linear.TNHhsH1m.js +215 -0
- package/library/chunks/{map.BjtxEozr.js → map.CBcV0WVq.js} +100 -105
- package/library/chunks/map.DJnohTgl.js +18 -0
- package/library/chunks/markdown.I1AJG75v.js +4180 -0
- package/library/chunks/math.D2lKC7md.js +22 -0
- package/library/chunks/mermaid.core.Dspbw7Ig.js +13598 -0
- package/library/chunks/mindmap-definition-LN4V7U3C.DuCBBYwE.js +808 -0
- package/library/chunks/{number.CtCaI0T_.js → number.Cx2ncfJJ.js} +2 -2
- package/library/chunks/{option.qN3aaqVI.js → option.DyNR1vzy.js} +2 -2
- package/library/chunks/ordinal.bqVaUip-.js +61 -0
- package/library/chunks/{pagination.Cupa46TN.js → pagination.qFmncShC.js} +5 -5
- package/library/chunks/pegDiagram-2B236MQR.DQrkEdJr.js +97 -0
- package/library/chunks/{percent.D_CkaRGb.js → percent.D8mkiJ2G.js} +17 -17
- package/library/chunks/pieDiagram-ENE6RG2P.B6nPW8Pj.js +212 -0
- package/library/chunks/quadrantDiagram-ABIIQ3AL.BFy9moxz.js +1026 -0
- package/library/chunks/{radar.BMKaNvJH.js → radar.B3p5bRix.js} +78 -129
- package/library/chunks/railroadDiagram-RFXS5EU6.CSao8YZX.js +79 -0
- package/library/chunks/range.DdOGybNB.js +9 -0
- package/library/chunks/requirementDiagram-TGXJPOKE.CjpliZnF.js +882 -0
- package/library/chunks/sankey.BR94A-8L.js +294 -0
- package/library/chunks/sankeyDiagram-HTMAVEWB.D8aAxVGe.js +564 -0
- package/library/chunks/select.C6_sM3Pr.js +7 -0
- package/library/chunks/sequenceDiagram-DBY2YBRQ.Cu9MV3h-.js +2891 -0
- package/library/chunks/sizeCapture-X5ZJPWSS.BDByEFcW.js +46 -0
- package/library/chunks/{sliceGrouper.C-t5ZRrz.js → sliceGrouper.CcRqQhZX.js} +1 -1
- package/library/chunks/stateDiagram-2N3HPSRC.DvrAW9Ck.js +267 -0
- package/library/chunks/stateDiagram-v2-6OUMAXLB.CFfuaFM1.js +18 -0
- package/library/chunks/step.almIqwJ6.js +51 -0
- package/library/chunks/{stock.vF_pji1F.js → stock.CQbn6zW4.js} +9 -9
- package/library/chunks/swimlanes-5IMT3BWC.AtMD47q7.js +5332 -0
- package/library/chunks/swimlanesDiagram-G3AALYLV.26A1eX7s.js +15 -0
- package/library/chunks/{tab-group.kSg5_10g.js → tab-group.1Y71_aN8.js} +3 -3
- package/library/chunks/{time.DWfbnPnM.js → time.DYWuX2id.js} +1 -1
- package/library/chunks/timeline-definition-FHXFAJF6.CYSh6xl5.js +1058 -0
- package/library/chunks/{timeline.gWu0up6r.js → timeline.Czz_uBEd.js} +33 -32
- package/library/chunks/toNumber.MuDz8DgU.js +31 -0
- package/library/chunks/{toString.Dcbz5jVT.js → toString.B1zKIiZc.js} +1 -1
- package/library/chunks/{toast.TDU3wVhq.js → toast.C5Ir5yKA.js} +1 -1
- package/library/chunks/transformation.D1alV_s4.js +189 -0
- package/library/chunks/{tree.C2dPd6gt.js → tree.Dvnw_4vz.js} +3 -3
- package/library/chunks/value.BXEGBVFV.js +44 -0
- package/library/chunks/{venn.BVBe-JXs.js → venn.B5Jl-c4i.js} +2 -2
- package/library/chunks/vennDiagram-L72KCM5P.CSk1WWlu.js +1581 -0
- package/library/chunks/wardleyDiagram-EHGQE667.C7UzXYG7.js +675 -0
- package/library/chunks/{watch.DOt4Mabe.js → watch.DJF5K-8U.js} +27 -27
- package/library/chunks/{wc.DTNpfIc1.js → wc.B2THb2Kk.js} +18 -18
- package/library/chunks/xy.BO6U5QrZ.js +294 -0
- package/library/chunks/xychartDiagram-FW5EYKEG.idiZWvYS.js +1383 -0
- package/library/components/alert.js +2 -2
- package/library/components/am-chart.js +3 -3
- package/library/components/animated-image.js +2 -2
- package/library/components/animation.js +2 -2
- package/library/components/array-line-clamp.js +1 -1
- package/library/components/asset-link-format.js +5 -5
- package/library/components/atoms.js +29 -29
- package/library/components/audio.js +3 -3
- package/library/components/avatar.js +2 -2
- package/library/components/border-input-group.js +1 -1
- package/library/components/breadcrumb-item.js +1 -1
- package/library/components/breadcrumb.js +1 -1
- package/library/components/button.js +3 -3
- package/library/components/checkbox.js +195 -18
- package/library/components/color-picker.js +4 -4
- package/library/components/color-swatch-group.js +5 -5
- package/library/components/color-swatch.js +2 -2
- package/library/components/confirm-popover.js +3 -3
- package/library/components/copy-button.js +2 -2
- package/library/components/corner-position-input-group.js +2 -2
- package/library/components/cropper.js +3 -3
- package/library/components/date-calendar.js +1 -1
- package/library/components/details.js +2 -2
- package/library/components/dialog.js +3 -3
- package/library/components/diff.js +1 -1
- package/library/components/divider.js +1 -1
- package/library/components/document-viewer.js +3 -3
- package/library/components/dot-pagination.js +2 -2
- package/library/components/drawer.js +3 -3
- package/library/components/dropdown.js +2 -2
- package/library/components/dynamic-select.js +6 -6
- package/library/components/e-chart.js +1 -1
- package/library/components/element-clamp.js +2 -2
- package/library/components/file-on-demand.js +350 -374
- package/library/components/folder-select.js +5 -5
- package/library/components/format-time.js +2 -2
- package/library/components/grid-item.js +1 -1
- package/library/components/header.js +2 -2
- package/library/components/hub-connection.js +2 -2
- package/library/components/icon-button.js +2 -2
- package/library/components/icon.js +2 -2
- package/library/components/iframe.js +2 -2
- package/library/components/image-comparer.js +2 -2
- package/library/components/image.js +3 -3
- package/library/components/include.js +1 -1
- package/library/components/input.js +3 -3
- package/library/components/line-clamp.js +1 -1
- package/library/components/markdown.js +11 -2704
- package/library/components/masonry.js +3 -3
- package/library/components/menu-item.js +2 -2
- package/library/components/molecules.js +3 -3
- package/library/components/mutation-observer.js +1 -1
- package/library/components/option.js +3 -3
- package/library/components/organisms.js +2 -2
- package/library/components/padding-input-group.js +1 -1
- package/library/components/pagination.js +6 -6
- package/library/components/qr-code.js +1 -1
- package/library/components/radio-button.js +1 -1
- package/library/components/radio-card.js +1 -1
- package/library/components/radio-group.js +1 -1
- package/library/components/radio.js +2 -2
- package/library/components/range.js +1 -1
- package/library/components/rating.js +2 -2
- package/library/components/resize-observer.js +1 -1
- package/library/components/select.js +3 -3
- package/library/components/shadow-input-group.js +1 -1
- package/library/components/share-option-list.js +2 -2
- package/library/components/sidebar.js +3 -3
- package/library/components/size-input-group.js +3 -3
- package/library/components/split-panel.js +1 -1
- package/library/components/step.js +1 -1
- package/library/components/stepper-wizard.js +1 -1
- package/library/components/stepper.js +1 -1
- package/library/components/switch.js +1 -1
- package/library/components/tab-group.js +4 -4
- package/library/components/tab-panel.js +1 -1
- package/library/components/tab.js +2 -2
- package/library/components/tag.js +1 -1
- package/library/components/textarea.js +1 -1
- package/library/components/timecode.js +1 -1
- package/library/components/tooltip.js +1 -1
- package/library/components/tree-item.js +4 -4
- package/library/components/tree.js +2 -2
- package/library/components/typeface.js +2 -2
- package/library/components/types.js +122526 -120875
- package/library/components/video.js +2 -2
- package/library/package.json +2 -1
- package/library/packages/atoms/src/components/markdown/markdown.d.ts +41 -1
- package/library/packages/atoms/src/components/markdown/parser.d.ts +18 -3
- package/library/packages/atoms/src/components/markdown/styles.d.ts +17 -0
- package/library/packages/hybrid/table-core/src/tabulator-tables/modules/Page/Page.d.ts +6 -0
- package/library/packages/hybrid/table-core/src/tabulator-tables/modules/Validate/Validate.d.ts +6 -0
- package/library/packages/molecules/src/index.d.ts +1 -0
- package/library/packages/molecules/src/markdown-viewer/markdown-viewer.d.ts +124 -0
- package/library/packages/molecules/src/markdown-viewer/markdown-viewer.styles.d.ts +6 -0
- package/library/packages/molecules/src/pdf-viewer-toolbar/pdf-viewer-toolbar.d.ts +1 -0
- package/library/packages/tools/src/tiptap/utils/md/editor-controller.d.ts +57 -0
- package/library/packages/tools/src/tiptap/utils/md/from-markdown.d.ts +11 -0
- package/library/packages/tools/src/tiptap/utils/md/input-rules.d.ts +15 -0
- package/library/packages/tools/src/tiptap/utils/md/schema.d.ts +13 -0
- package/library/packages/tools/src/tiptap/utils/md/to-markdown.d.ts +14 -0
- package/library/packages/types/src/markdown-viewer.d.ts +12 -0
- package/library/packages/types/src/pdf-viewer-toolbar.d.ts +4 -3
- package/library/packages/utils/src/transformation/transformation.d.ts +8 -0
- package/library/react-web-component.d.ts +72 -6
- package/library/utils.js +9 -8
- package/package.json +2 -1
- package/library/chunks/Slice.C5lVu2g_.js +0 -120
- package/library/chunks/_baseXor.VohG8cOH.js +0 -116
- package/library/chunks/checkbox.3i2j3PHc.js +0 -198
- package/library/chunks/debounce.C_J-9zJi.js +0 -82
- package/library/chunks/flow.hz0UDjCb.js +0 -1594
- package/library/chunks/index.DU0XUO4k.js +0 -176
- package/library/chunks/transformation.BDmd3kER.js +0 -163
- package/library/chunks/xy.BNgyrwGD.js +0 -333
|
@@ -1,2706 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
createRenderRoot() {
|
|
13
|
-
return this;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* LitElement applies the styles of a component to the Shadow DOM.
|
|
17
|
-
* CortexLightElement applies the styles of a component to the Light DOM.
|
|
18
|
-
*/
|
|
19
|
-
#e() {
|
|
20
|
-
if (!lt(this.constructor))
|
|
21
|
-
return;
|
|
22
|
-
const n = `${this.constructor.name}-styles`;
|
|
23
|
-
if (!document.getElementById(n)) {
|
|
24
|
-
const e = document.createElement("style");
|
|
25
|
-
e.id = n, e.textContent = this.constructor.styles, e.textContent = e.textContent.replace(
|
|
26
|
-
/:host/g,
|
|
27
|
-
`${this.tagName.toLowerCase()}`
|
|
28
|
-
), document.head.appendChild(e);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
function lt(u) {
|
|
33
|
-
return u.styles !== void 0;
|
|
34
|
-
}
|
|
35
|
-
function me() {
|
|
36
|
-
return {
|
|
37
|
-
async: !1,
|
|
38
|
-
breaks: !1,
|
|
39
|
-
extensions: null,
|
|
40
|
-
gfm: !0,
|
|
41
|
-
hooks: null,
|
|
42
|
-
pedantic: !1,
|
|
43
|
-
renderer: null,
|
|
44
|
-
silent: !1,
|
|
45
|
-
tokenizer: null,
|
|
46
|
-
walkTokens: null
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
let D = me();
|
|
50
|
-
function Oe(u) {
|
|
51
|
-
D = u;
|
|
52
|
-
}
|
|
53
|
-
const Ze = /[&<>"']/, ot = new RegExp(Ze.source, "g"), Be = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, ct = new RegExp(Be.source, "g"), ut = {
|
|
54
|
-
"&": "&",
|
|
55
|
-
"<": "<",
|
|
56
|
-
">": ">",
|
|
57
|
-
'"': """,
|
|
58
|
-
"'": "'"
|
|
59
|
-
}, Ee = (u) => ut[u];
|
|
60
|
-
function R(u, n) {
|
|
61
|
-
if (n) {
|
|
62
|
-
if (Ze.test(u))
|
|
63
|
-
return u.replace(ot, Ee);
|
|
64
|
-
} else if (Be.test(u))
|
|
65
|
-
return u.replace(ct, Ee);
|
|
66
|
-
return u;
|
|
67
|
-
}
|
|
68
|
-
const pt = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
|
|
69
|
-
function ht(u) {
|
|
70
|
-
return u.replace(pt, (n, e) => (e = e.toLowerCase(), e === "colon" ? ":" : e.charAt(0) === "#" ? e.charAt(1) === "x" ? String.fromCharCode(parseInt(e.substring(2), 16)) : String.fromCharCode(+e.substring(1)) : ""));
|
|
71
|
-
}
|
|
72
|
-
const gt = /(^|[^\[])\^/g;
|
|
73
|
-
function T(u, n) {
|
|
74
|
-
let e = typeof u == "string" ? u : u.source;
|
|
75
|
-
n = n || "";
|
|
76
|
-
const t = {
|
|
77
|
-
replace: (s, i) => {
|
|
78
|
-
let r = typeof i == "string" ? i : i.source;
|
|
79
|
-
return r = r.replace(gt, "$1"), e = e.replace(s, r), t;
|
|
80
|
-
},
|
|
81
|
-
getRegex: () => new RegExp(e, n)
|
|
82
|
-
};
|
|
83
|
-
return t;
|
|
84
|
-
}
|
|
85
|
-
function Re(u) {
|
|
86
|
-
try {
|
|
87
|
-
u = encodeURI(u).replace(/%25/g, "%");
|
|
88
|
-
} catch {
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
return u;
|
|
92
|
-
}
|
|
93
|
-
const W = { exec: () => null };
|
|
94
|
-
function Ce(u, n) {
|
|
95
|
-
const e = u.replace(/\|/g, (i, r, a) => {
|
|
96
|
-
let c = !1, x = r;
|
|
97
|
-
for (; --x >= 0 && a[x] === "\\"; )
|
|
98
|
-
c = !c;
|
|
99
|
-
return c ? "|" : " |";
|
|
100
|
-
}), t = e.split(/ \|/);
|
|
101
|
-
let s = 0;
|
|
102
|
-
if (t[0].trim() || t.shift(), t.length > 0 && !t[t.length - 1].trim() && t.pop(), n)
|
|
103
|
-
if (t.length > n)
|
|
104
|
-
t.splice(n);
|
|
105
|
-
else
|
|
106
|
-
for (; t.length < n; )
|
|
107
|
-
t.push("");
|
|
108
|
-
for (; s < t.length; s++)
|
|
109
|
-
t[s] = t[s].trim().replace(/\\\|/g, "|");
|
|
110
|
-
return t;
|
|
111
|
-
}
|
|
112
|
-
function ee(u, n, e) {
|
|
113
|
-
const t = u.length;
|
|
114
|
-
if (t === 0)
|
|
115
|
-
return "";
|
|
116
|
-
let s = 0;
|
|
117
|
-
for (; s < t && u.charAt(t - s - 1) === n; )
|
|
118
|
-
s++;
|
|
119
|
-
return u.slice(0, t - s);
|
|
120
|
-
}
|
|
121
|
-
function ft(u, n) {
|
|
122
|
-
if (u.indexOf(n[1]) === -1)
|
|
123
|
-
return -1;
|
|
124
|
-
let e = 0;
|
|
125
|
-
for (let t = 0; t < u.length; t++)
|
|
126
|
-
if (u[t] === "\\")
|
|
127
|
-
t++;
|
|
128
|
-
else if (u[t] === n[0])
|
|
129
|
-
e++;
|
|
130
|
-
else if (u[t] === n[1] && (e--, e < 0))
|
|
131
|
-
return t;
|
|
132
|
-
return -1;
|
|
133
|
-
}
|
|
134
|
-
function Ie(u, n, e, t) {
|
|
135
|
-
const s = n.href, i = n.title ? R(n.title) : null, r = u[1].replace(/\\([\[\]])/g, "$1");
|
|
136
|
-
if (u[0].charAt(0) !== "!") {
|
|
137
|
-
t.state.inLink = !0;
|
|
138
|
-
const a = {
|
|
139
|
-
type: "link",
|
|
140
|
-
raw: e,
|
|
141
|
-
href: s,
|
|
142
|
-
title: i,
|
|
143
|
-
text: r,
|
|
144
|
-
tokens: t.inlineTokens(r)
|
|
145
|
-
};
|
|
146
|
-
return t.state.inLink = !1, a;
|
|
147
|
-
}
|
|
148
|
-
return {
|
|
149
|
-
type: "image",
|
|
150
|
-
raw: e,
|
|
151
|
-
href: s,
|
|
152
|
-
title: i,
|
|
153
|
-
text: R(r)
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
function dt(u, n) {
|
|
157
|
-
const e = u.match(/^(\s+)(?:```)/);
|
|
158
|
-
if (e === null)
|
|
159
|
-
return n;
|
|
160
|
-
const t = e[1];
|
|
161
|
-
return n.split(`
|
|
162
|
-
`).map((s) => {
|
|
163
|
-
const i = s.match(/^\s+/);
|
|
164
|
-
if (i === null)
|
|
165
|
-
return s;
|
|
166
|
-
const [r] = i;
|
|
167
|
-
return r.length >= t.length ? s.slice(t.length) : s;
|
|
168
|
-
}).join(`
|
|
169
|
-
`);
|
|
170
|
-
}
|
|
171
|
-
class se {
|
|
172
|
-
options;
|
|
173
|
-
rules;
|
|
174
|
-
// set by the lexer
|
|
175
|
-
lexer;
|
|
176
|
-
// set by the lexer
|
|
177
|
-
constructor(n) {
|
|
178
|
-
this.options = n || D;
|
|
179
|
-
}
|
|
180
|
-
space(n) {
|
|
181
|
-
const e = this.rules.block.newline.exec(n);
|
|
182
|
-
if (e && e[0].length > 0)
|
|
183
|
-
return {
|
|
184
|
-
type: "space",
|
|
185
|
-
raw: e[0]
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
code(n) {
|
|
189
|
-
const e = this.rules.block.code.exec(n);
|
|
190
|
-
if (e) {
|
|
191
|
-
const t = e[0].replace(/^ {1,4}/gm, "");
|
|
192
|
-
return {
|
|
193
|
-
type: "code",
|
|
194
|
-
raw: e[0],
|
|
195
|
-
codeBlockStyle: "indented",
|
|
196
|
-
text: this.options.pedantic ? t : ee(t, `
|
|
197
|
-
`)
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
fences(n) {
|
|
202
|
-
const e = this.rules.block.fences.exec(n);
|
|
203
|
-
if (e) {
|
|
204
|
-
const t = e[0], s = dt(t, e[3] || "");
|
|
205
|
-
return {
|
|
206
|
-
type: "code",
|
|
207
|
-
raw: t,
|
|
208
|
-
lang: e[2] ? e[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : e[2],
|
|
209
|
-
text: s
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
heading(n) {
|
|
214
|
-
const e = this.rules.block.heading.exec(n);
|
|
215
|
-
if (e) {
|
|
216
|
-
let t = e[2].trim();
|
|
217
|
-
if (/#$/.test(t)) {
|
|
218
|
-
const s = ee(t, "#");
|
|
219
|
-
(this.options.pedantic || !s || / $/.test(s)) && (t = s.trim());
|
|
220
|
-
}
|
|
221
|
-
return {
|
|
222
|
-
type: "heading",
|
|
223
|
-
raw: e[0],
|
|
224
|
-
depth: e[1].length,
|
|
225
|
-
text: t,
|
|
226
|
-
tokens: this.lexer.inline(t)
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
hr(n) {
|
|
231
|
-
const e = this.rules.block.hr.exec(n);
|
|
232
|
-
if (e)
|
|
233
|
-
return {
|
|
234
|
-
type: "hr",
|
|
235
|
-
raw: e[0]
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
blockquote(n) {
|
|
239
|
-
const e = this.rules.block.blockquote.exec(n);
|
|
240
|
-
if (e) {
|
|
241
|
-
const t = ee(e[0].replace(/^ *>[ \t]?/gm, ""), `
|
|
242
|
-
`), s = this.lexer.state.top;
|
|
243
|
-
this.lexer.state.top = !0;
|
|
244
|
-
const i = this.lexer.blockTokens(t);
|
|
245
|
-
return this.lexer.state.top = s, {
|
|
246
|
-
type: "blockquote",
|
|
247
|
-
raw: e[0],
|
|
248
|
-
tokens: i,
|
|
249
|
-
text: t
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
list(n) {
|
|
254
|
-
let e = this.rules.block.list.exec(n);
|
|
255
|
-
if (e) {
|
|
256
|
-
let t = e[1].trim();
|
|
257
|
-
const s = t.length > 1, i = {
|
|
258
|
-
type: "list",
|
|
259
|
-
raw: "",
|
|
260
|
-
ordered: s,
|
|
261
|
-
start: s ? +t.slice(0, -1) : "",
|
|
262
|
-
loose: !1,
|
|
263
|
-
items: []
|
|
264
|
-
};
|
|
265
|
-
t = s ? `\\d{1,9}\\${t.slice(-1)}` : `\\${t}`, this.options.pedantic && (t = s ? t : "[*+-]");
|
|
266
|
-
const r = new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`);
|
|
267
|
-
let a = "", c = "", x = !1;
|
|
268
|
-
for (; n; ) {
|
|
269
|
-
let f = !1;
|
|
270
|
-
if (!(e = r.exec(n)) || this.rules.block.hr.test(n))
|
|
271
|
-
break;
|
|
272
|
-
a = e[0], n = n.substring(a.length);
|
|
273
|
-
let b = e[2].split(`
|
|
274
|
-
`, 1)[0].replace(/^\t+/, (S) => " ".repeat(3 * S.length)), d = n.split(`
|
|
275
|
-
`, 1)[0], v = 0;
|
|
276
|
-
this.options.pedantic ? (v = 2, c = b.trimStart()) : (v = e[2].search(/[^ ]/), v = v > 4 ? 1 : v, c = b.slice(v), v += e[1].length);
|
|
277
|
-
let E = !1;
|
|
278
|
-
if (!b && /^ *$/.test(d) && (a += d + `
|
|
279
|
-
`, n = n.substring(d.length + 1), f = !0), !f) {
|
|
280
|
-
const S = new RegExp(`^ {0,${Math.min(3, v - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), o = new RegExp(`^ {0,${Math.min(3, v - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), l = new RegExp(`^ {0,${Math.min(3, v - 1)}}(?:\`\`\`|~~~)`), p = new RegExp(`^ {0,${Math.min(3, v - 1)}}#`);
|
|
281
|
-
for (; n; ) {
|
|
282
|
-
const h = n.split(`
|
|
283
|
-
`, 1)[0];
|
|
284
|
-
if (d = h, this.options.pedantic && (d = d.replace(/^ {1,4}(?=( {4})*[^ ])/g, " ")), l.test(d) || p.test(d) || S.test(d) || o.test(n))
|
|
285
|
-
break;
|
|
286
|
-
if (d.search(/[^ ]/) >= v || !d.trim())
|
|
287
|
-
c += `
|
|
288
|
-
` + d.slice(v);
|
|
289
|
-
else {
|
|
290
|
-
if (E || b.search(/[^ ]/) >= 4 || l.test(b) || p.test(b) || o.test(b))
|
|
291
|
-
break;
|
|
292
|
-
c += `
|
|
293
|
-
` + d;
|
|
294
|
-
}
|
|
295
|
-
!E && !d.trim() && (E = !0), a += h + `
|
|
296
|
-
`, n = n.substring(h.length + 1), b = d.slice(v);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
i.loose || (x ? i.loose = !0 : /\n *\n *$/.test(a) && (x = !0));
|
|
300
|
-
let $ = null, w;
|
|
301
|
-
this.options.gfm && ($ = /^\[[ xX]\] /.exec(c), $ && (w = $[0] !== "[ ] ", c = c.replace(/^\[[ xX]\] +/, ""))), i.items.push({
|
|
302
|
-
type: "list_item",
|
|
303
|
-
raw: a,
|
|
304
|
-
task: !!$,
|
|
305
|
-
checked: w,
|
|
306
|
-
loose: !1,
|
|
307
|
-
text: c,
|
|
308
|
-
tokens: []
|
|
309
|
-
}), i.raw += a;
|
|
310
|
-
}
|
|
311
|
-
i.items[i.items.length - 1].raw = a.trimEnd(), i.items[i.items.length - 1].text = c.trimEnd(), i.raw = i.raw.trimEnd();
|
|
312
|
-
for (let f = 0; f < i.items.length; f++)
|
|
313
|
-
if (this.lexer.state.top = !1, i.items[f].tokens = this.lexer.blockTokens(i.items[f].text, []), !i.loose) {
|
|
314
|
-
const b = i.items[f].tokens.filter((v) => v.type === "space"), d = b.length > 0 && b.some((v) => /\n.*\n/.test(v.raw));
|
|
315
|
-
i.loose = d;
|
|
316
|
-
}
|
|
317
|
-
if (i.loose)
|
|
318
|
-
for (let f = 0; f < i.items.length; f++)
|
|
319
|
-
i.items[f].loose = !0;
|
|
320
|
-
return i;
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
html(n) {
|
|
324
|
-
const e = this.rules.block.html.exec(n);
|
|
325
|
-
if (e)
|
|
326
|
-
return {
|
|
327
|
-
type: "html",
|
|
328
|
-
block: !0,
|
|
329
|
-
raw: e[0],
|
|
330
|
-
pre: e[1] === "pre" || e[1] === "script" || e[1] === "style",
|
|
331
|
-
text: e[0]
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
def(n) {
|
|
335
|
-
const e = this.rules.block.def.exec(n);
|
|
336
|
-
if (e) {
|
|
337
|
-
const t = e[1].toLowerCase().replace(/\s+/g, " "), s = e[2] ? e[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", i = e[3] ? e[3].substring(1, e[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : e[3];
|
|
338
|
-
return {
|
|
339
|
-
type: "def",
|
|
340
|
-
tag: t,
|
|
341
|
-
raw: e[0],
|
|
342
|
-
href: s,
|
|
343
|
-
title: i
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
table(n) {
|
|
348
|
-
const e = this.rules.block.table.exec(n);
|
|
349
|
-
if (!e || !/[:|]/.test(e[2]))
|
|
350
|
-
return;
|
|
351
|
-
const t = Ce(e[1]), s = e[2].replace(/^\||\| *$/g, "").split("|"), i = e[3] && e[3].trim() ? e[3].replace(/\n[ \t]*$/, "").split(`
|
|
352
|
-
`) : [], r = {
|
|
353
|
-
type: "table",
|
|
354
|
-
raw: e[0],
|
|
355
|
-
header: [],
|
|
356
|
-
align: [],
|
|
357
|
-
rows: []
|
|
358
|
-
};
|
|
359
|
-
if (t.length === s.length) {
|
|
360
|
-
for (const a of s)
|
|
361
|
-
/^ *-+: *$/.test(a) ? r.align.push("right") : /^ *:-+: *$/.test(a) ? r.align.push("center") : /^ *:-+ *$/.test(a) ? r.align.push("left") : r.align.push(null);
|
|
362
|
-
for (const a of t)
|
|
363
|
-
r.header.push({
|
|
364
|
-
text: a,
|
|
365
|
-
tokens: this.lexer.inline(a)
|
|
366
|
-
});
|
|
367
|
-
for (const a of i)
|
|
368
|
-
r.rows.push(Ce(a, r.header.length).map((c) => ({
|
|
369
|
-
text: c,
|
|
370
|
-
tokens: this.lexer.inline(c)
|
|
371
|
-
})));
|
|
372
|
-
return r;
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
lheading(n) {
|
|
376
|
-
const e = this.rules.block.lheading.exec(n);
|
|
377
|
-
if (e)
|
|
378
|
-
return {
|
|
379
|
-
type: "heading",
|
|
380
|
-
raw: e[0],
|
|
381
|
-
depth: e[2].charAt(0) === "=" ? 1 : 2,
|
|
382
|
-
text: e[1],
|
|
383
|
-
tokens: this.lexer.inline(e[1])
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
|
-
paragraph(n) {
|
|
387
|
-
const e = this.rules.block.paragraph.exec(n);
|
|
388
|
-
if (e) {
|
|
389
|
-
const t = e[1].charAt(e[1].length - 1) === `
|
|
390
|
-
` ? e[1].slice(0, -1) : e[1];
|
|
391
|
-
return {
|
|
392
|
-
type: "paragraph",
|
|
393
|
-
raw: e[0],
|
|
394
|
-
text: t,
|
|
395
|
-
tokens: this.lexer.inline(t)
|
|
396
|
-
};
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
text(n) {
|
|
400
|
-
const e = this.rules.block.text.exec(n);
|
|
401
|
-
if (e)
|
|
402
|
-
return {
|
|
403
|
-
type: "text",
|
|
404
|
-
raw: e[0],
|
|
405
|
-
text: e[0],
|
|
406
|
-
tokens: this.lexer.inline(e[0])
|
|
407
|
-
};
|
|
408
|
-
}
|
|
409
|
-
escape(n) {
|
|
410
|
-
const e = this.rules.inline.escape.exec(n);
|
|
411
|
-
if (e)
|
|
412
|
-
return {
|
|
413
|
-
type: "escape",
|
|
414
|
-
raw: e[0],
|
|
415
|
-
text: R(e[1])
|
|
416
|
-
};
|
|
417
|
-
}
|
|
418
|
-
tag(n) {
|
|
419
|
-
const e = this.rules.inline.tag.exec(n);
|
|
420
|
-
if (e)
|
|
421
|
-
return !this.lexer.state.inLink && /^<a /i.test(e[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && /^<\/a>/i.test(e[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(e[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(e[0]) && (this.lexer.state.inRawBlock = !1), {
|
|
422
|
-
type: "html",
|
|
423
|
-
raw: e[0],
|
|
424
|
-
inLink: this.lexer.state.inLink,
|
|
425
|
-
inRawBlock: this.lexer.state.inRawBlock,
|
|
426
|
-
block: !1,
|
|
427
|
-
text: e[0]
|
|
428
|
-
};
|
|
429
|
-
}
|
|
430
|
-
link(n) {
|
|
431
|
-
const e = this.rules.inline.link.exec(n);
|
|
432
|
-
if (e) {
|
|
433
|
-
const t = e[2].trim();
|
|
434
|
-
if (!this.options.pedantic && /^</.test(t)) {
|
|
435
|
-
if (!/>$/.test(t))
|
|
436
|
-
return;
|
|
437
|
-
const r = ee(t.slice(0, -1), "\\");
|
|
438
|
-
if ((t.length - r.length) % 2 === 0)
|
|
439
|
-
return;
|
|
440
|
-
} else {
|
|
441
|
-
const r = ft(e[2], "()");
|
|
442
|
-
if (r > -1) {
|
|
443
|
-
const c = (e[0].indexOf("!") === 0 ? 5 : 4) + e[1].length + r;
|
|
444
|
-
e[2] = e[2].substring(0, r), e[0] = e[0].substring(0, c).trim(), e[3] = "";
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
let s = e[2], i = "";
|
|
448
|
-
if (this.options.pedantic) {
|
|
449
|
-
const r = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(s);
|
|
450
|
-
r && (s = r[1], i = r[3]);
|
|
451
|
-
} else
|
|
452
|
-
i = e[3] ? e[3].slice(1, -1) : "";
|
|
453
|
-
return s = s.trim(), /^</.test(s) && (this.options.pedantic && !/>$/.test(t) ? s = s.slice(1) : s = s.slice(1, -1)), Ie(e, {
|
|
454
|
-
href: s && s.replace(this.rules.inline.anyPunctuation, "$1"),
|
|
455
|
-
title: i && i.replace(this.rules.inline.anyPunctuation, "$1")
|
|
456
|
-
}, e[0], this.lexer);
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
reflink(n, e) {
|
|
460
|
-
let t;
|
|
461
|
-
if ((t = this.rules.inline.reflink.exec(n)) || (t = this.rules.inline.nolink.exec(n))) {
|
|
462
|
-
const s = (t[2] || t[1]).replace(/\s+/g, " "), i = e[s.toLowerCase()];
|
|
463
|
-
if (!i) {
|
|
464
|
-
const r = t[0].charAt(0);
|
|
465
|
-
return {
|
|
466
|
-
type: "text",
|
|
467
|
-
raw: r,
|
|
468
|
-
text: r
|
|
469
|
-
};
|
|
470
|
-
}
|
|
471
|
-
return Ie(t, i, t[0], this.lexer);
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
emStrong(n, e, t = "") {
|
|
475
|
-
let s = this.rules.inline.emStrongLDelim.exec(n);
|
|
476
|
-
if (!s || s[3] && t.match(/[\p{L}\p{N}]/u))
|
|
477
|
-
return;
|
|
478
|
-
if (!(s[1] || s[2] || "") || !t || this.rules.inline.punctuation.exec(t)) {
|
|
479
|
-
const r = [...s[0]].length - 1;
|
|
480
|
-
let a, c, x = r, f = 0;
|
|
481
|
-
const b = s[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
482
|
-
for (b.lastIndex = 0, e = e.slice(-1 * n.length + r); (s = b.exec(e)) != null; ) {
|
|
483
|
-
if (a = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !a)
|
|
484
|
-
continue;
|
|
485
|
-
if (c = [...a].length, s[3] || s[4]) {
|
|
486
|
-
x += c;
|
|
487
|
-
continue;
|
|
488
|
-
} else if ((s[5] || s[6]) && r % 3 && !((r + c) % 3)) {
|
|
489
|
-
f += c;
|
|
490
|
-
continue;
|
|
491
|
-
}
|
|
492
|
-
if (x -= c, x > 0)
|
|
493
|
-
continue;
|
|
494
|
-
c = Math.min(c, c + x + f);
|
|
495
|
-
const d = [...s[0]][0].length, v = n.slice(0, r + s.index + d + c);
|
|
496
|
-
if (Math.min(r, c) % 2) {
|
|
497
|
-
const $ = v.slice(1, -1);
|
|
498
|
-
return {
|
|
499
|
-
type: "em",
|
|
500
|
-
raw: v,
|
|
501
|
-
text: $,
|
|
502
|
-
tokens: this.lexer.inlineTokens($)
|
|
503
|
-
};
|
|
504
|
-
}
|
|
505
|
-
const E = v.slice(2, -2);
|
|
506
|
-
return {
|
|
507
|
-
type: "strong",
|
|
508
|
-
raw: v,
|
|
509
|
-
text: E,
|
|
510
|
-
tokens: this.lexer.inlineTokens(E)
|
|
511
|
-
};
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
codespan(n) {
|
|
516
|
-
const e = this.rules.inline.code.exec(n);
|
|
517
|
-
if (e) {
|
|
518
|
-
let t = e[2].replace(/\n/g, " ");
|
|
519
|
-
const s = /[^ ]/.test(t), i = /^ /.test(t) && / $/.test(t);
|
|
520
|
-
return s && i && (t = t.substring(1, t.length - 1)), t = R(t, !0), {
|
|
521
|
-
type: "codespan",
|
|
522
|
-
raw: e[0],
|
|
523
|
-
text: t
|
|
524
|
-
};
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
br(n) {
|
|
528
|
-
const e = this.rules.inline.br.exec(n);
|
|
529
|
-
if (e)
|
|
530
|
-
return {
|
|
531
|
-
type: "br",
|
|
532
|
-
raw: e[0]
|
|
533
|
-
};
|
|
534
|
-
}
|
|
535
|
-
del(n) {
|
|
536
|
-
const e = this.rules.inline.del.exec(n);
|
|
537
|
-
if (e)
|
|
538
|
-
return {
|
|
539
|
-
type: "del",
|
|
540
|
-
raw: e[0],
|
|
541
|
-
text: e[2],
|
|
542
|
-
tokens: this.lexer.inlineTokens(e[2])
|
|
543
|
-
};
|
|
544
|
-
}
|
|
545
|
-
autolink(n) {
|
|
546
|
-
const e = this.rules.inline.autolink.exec(n);
|
|
547
|
-
if (e) {
|
|
548
|
-
let t, s;
|
|
549
|
-
return e[2] === "@" ? (t = R(e[1]), s = "mailto:" + t) : (t = R(e[1]), s = t), {
|
|
550
|
-
type: "link",
|
|
551
|
-
raw: e[0],
|
|
552
|
-
text: t,
|
|
553
|
-
href: s,
|
|
554
|
-
tokens: [
|
|
555
|
-
{
|
|
556
|
-
type: "text",
|
|
557
|
-
raw: t,
|
|
558
|
-
text: t
|
|
559
|
-
}
|
|
560
|
-
]
|
|
561
|
-
};
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
url(n) {
|
|
565
|
-
let e;
|
|
566
|
-
if (e = this.rules.inline.url.exec(n)) {
|
|
567
|
-
let t, s;
|
|
568
|
-
if (e[2] === "@")
|
|
569
|
-
t = R(e[0]), s = "mailto:" + t;
|
|
570
|
-
else {
|
|
571
|
-
let i;
|
|
572
|
-
do
|
|
573
|
-
i = e[0], e[0] = this.rules.inline._backpedal.exec(e[0])?.[0] ?? "";
|
|
574
|
-
while (i !== e[0]);
|
|
575
|
-
t = R(e[0]), e[1] === "www." ? s = "http://" + e[0] : s = e[0];
|
|
576
|
-
}
|
|
577
|
-
return {
|
|
578
|
-
type: "link",
|
|
579
|
-
raw: e[0],
|
|
580
|
-
text: t,
|
|
581
|
-
href: s,
|
|
582
|
-
tokens: [
|
|
583
|
-
{
|
|
584
|
-
type: "text",
|
|
585
|
-
raw: t,
|
|
586
|
-
text: t
|
|
587
|
-
}
|
|
588
|
-
]
|
|
589
|
-
};
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
inlineText(n) {
|
|
593
|
-
const e = this.rules.inline.text.exec(n);
|
|
594
|
-
if (e) {
|
|
595
|
-
let t;
|
|
596
|
-
return this.lexer.state.inRawBlock ? t = e[0] : t = R(e[0]), {
|
|
597
|
-
type: "text",
|
|
598
|
-
raw: e[0],
|
|
599
|
-
text: t
|
|
600
|
-
};
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
const kt = /^(?: *(?:\n|$))+/, mt = /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/, xt = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, N = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, bt = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, De = /(?:[*+-]|\d{1,9}[.)])/, je = T(/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, De).getRegex(), xe = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, wt = /^[^\n]+/, be = /(?!\s*\])(?:\\.|[^\[\]\\])+/, yt = T(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label", be).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), vt = T(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, De).getRegex(), le = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", we = /<!--(?!-?>)[\s\S]*?(?:-->|$)/, $t = T("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))", "i").replace("comment", we).replace("tag", le).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), He = T(xe).replace("hr", N).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", le).getRegex(), At = T(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", He).getRegex(), ye = {
|
|
605
|
-
blockquote: At,
|
|
606
|
-
code: mt,
|
|
607
|
-
def: yt,
|
|
608
|
-
fences: xt,
|
|
609
|
-
heading: bt,
|
|
610
|
-
hr: N,
|
|
611
|
-
html: $t,
|
|
612
|
-
lheading: je,
|
|
613
|
-
list: vt,
|
|
614
|
-
newline: kt,
|
|
615
|
-
paragraph: He,
|
|
616
|
-
table: W,
|
|
617
|
-
text: wt
|
|
618
|
-
}, Le = T("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", N).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", le).getRegex(), Tt = {
|
|
619
|
-
...ye,
|
|
620
|
-
table: Le,
|
|
621
|
-
paragraph: T(xe).replace("hr", N).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", Le).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", le).getRegex()
|
|
622
|
-
}, St = {
|
|
623
|
-
...ye,
|
|
624
|
-
html: T(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", we).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
|
|
625
|
-
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
626
|
-
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
627
|
-
fences: W,
|
|
628
|
-
// fences not supported
|
|
629
|
-
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
630
|
-
paragraph: T(xe).replace("hr", N).replace("heading", ` *#{1,6} *[^
|
|
631
|
-
]`).replace("lheading", je).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
632
|
-
}, Ue = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Ft = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, Qe = /^( {2,}|\\)\n(?!\s*$)/, _t = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, X = "\\p{P}$+<=>`^|~", zt = T(/^((?![*_])[\spunctuation])/, "u").replace(/punctuation/g, X).getRegex(), Et = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g, Rt = T(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, "u").replace(/punct/g, X).getRegex(), Ct = T("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])", "gu").replace(/punct/g, X).getRegex(), It = T("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])", "gu").replace(/punct/g, X).getRegex(), Lt = T(/\\([punct])/, "gu").replace(/punct/g, X).getRegex(), Pt = T(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Mt = T(we).replace("(?:-->|$)", "-->").getRegex(), qt = T("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Mt).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), ie = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, Ot = T(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label", ie).replace("href", /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), We = T(/^!?\[(label)\]\[(ref)\]/).replace("label", ie).replace("ref", be).getRegex(), Ge = T(/^!?\[(ref)\](?:\[\])?/).replace("ref", be).getRegex(), Zt = T("reflink|nolink(?!\\()", "g").replace("reflink", We).replace("nolink", Ge).getRegex(), ve = {
|
|
633
|
-
_backpedal: W,
|
|
634
|
-
// only used for GFM url
|
|
635
|
-
anyPunctuation: Lt,
|
|
636
|
-
autolink: Pt,
|
|
637
|
-
blockSkip: Et,
|
|
638
|
-
br: Qe,
|
|
639
|
-
code: Ft,
|
|
640
|
-
del: W,
|
|
641
|
-
emStrongLDelim: Rt,
|
|
642
|
-
emStrongRDelimAst: Ct,
|
|
643
|
-
emStrongRDelimUnd: It,
|
|
644
|
-
escape: Ue,
|
|
645
|
-
link: Ot,
|
|
646
|
-
nolink: Ge,
|
|
647
|
-
punctuation: zt,
|
|
648
|
-
reflink: We,
|
|
649
|
-
reflinkSearch: Zt,
|
|
650
|
-
tag: qt,
|
|
651
|
-
text: _t,
|
|
652
|
-
url: W
|
|
653
|
-
}, Bt = {
|
|
654
|
-
...ve,
|
|
655
|
-
link: T(/^!?\[(label)\]\((.*?)\)/).replace("label", ie).getRegex(),
|
|
656
|
-
reflink: T(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", ie).getRegex()
|
|
657
|
-
}, fe = {
|
|
658
|
-
...ve,
|
|
659
|
-
escape: T(Ue).replace("])", "~|])").getRegex(),
|
|
660
|
-
url: T(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
661
|
-
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
662
|
-
del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
|
|
663
|
-
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
|
|
664
|
-
}, Dt = {
|
|
665
|
-
...fe,
|
|
666
|
-
br: T(Qe).replace("{2,}", "*").getRegex(),
|
|
667
|
-
text: T(fe.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
668
|
-
}, te = {
|
|
669
|
-
normal: ye,
|
|
670
|
-
gfm: Tt,
|
|
671
|
-
pedantic: St
|
|
672
|
-
}, Q = {
|
|
673
|
-
normal: ve,
|
|
674
|
-
gfm: fe,
|
|
675
|
-
breaks: Dt,
|
|
676
|
-
pedantic: Bt
|
|
677
|
-
};
|
|
678
|
-
class L {
|
|
679
|
-
tokens;
|
|
680
|
-
options;
|
|
681
|
-
state;
|
|
682
|
-
tokenizer;
|
|
683
|
-
inlineQueue;
|
|
684
|
-
constructor(n) {
|
|
685
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = n || D, this.options.tokenizer = this.options.tokenizer || new se(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
|
|
686
|
-
inLink: !1,
|
|
687
|
-
inRawBlock: !1,
|
|
688
|
-
top: !0
|
|
689
|
-
};
|
|
690
|
-
const e = {
|
|
691
|
-
block: te.normal,
|
|
692
|
-
inline: Q.normal
|
|
693
|
-
};
|
|
694
|
-
this.options.pedantic ? (e.block = te.pedantic, e.inline = Q.pedantic) : this.options.gfm && (e.block = te.gfm, this.options.breaks ? e.inline = Q.breaks : e.inline = Q.gfm), this.tokenizer.rules = e;
|
|
695
|
-
}
|
|
696
|
-
/**
|
|
697
|
-
* Expose Rules
|
|
698
|
-
*/
|
|
699
|
-
static get rules() {
|
|
700
|
-
return {
|
|
701
|
-
block: te,
|
|
702
|
-
inline: Q
|
|
703
|
-
};
|
|
704
|
-
}
|
|
705
|
-
/**
|
|
706
|
-
* Static Lex Method
|
|
707
|
-
*/
|
|
708
|
-
static lex(n, e) {
|
|
709
|
-
return new L(e).lex(n);
|
|
710
|
-
}
|
|
711
|
-
/**
|
|
712
|
-
* Static Lex Inline Method
|
|
713
|
-
*/
|
|
714
|
-
static lexInline(n, e) {
|
|
715
|
-
return new L(e).inlineTokens(n);
|
|
716
|
-
}
|
|
717
|
-
/**
|
|
718
|
-
* Preprocessing
|
|
719
|
-
*/
|
|
720
|
-
lex(n) {
|
|
721
|
-
n = n.replace(/\r\n|\r/g, `
|
|
722
|
-
`), this.blockTokens(n, this.tokens);
|
|
723
|
-
for (let e = 0; e < this.inlineQueue.length; e++) {
|
|
724
|
-
const t = this.inlineQueue[e];
|
|
725
|
-
this.inlineTokens(t.src, t.tokens);
|
|
726
|
-
}
|
|
727
|
-
return this.inlineQueue = [], this.tokens;
|
|
728
|
-
}
|
|
729
|
-
blockTokens(n, e = []) {
|
|
730
|
-
this.options.pedantic ? n = n.replace(/\t/g, " ").replace(/^ +$/gm, "") : n = n.replace(/^( *)(\t+)/gm, (a, c, x) => c + " ".repeat(x.length));
|
|
731
|
-
let t, s, i, r;
|
|
732
|
-
for (; n; )
|
|
733
|
-
if (!(this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((a) => (t = a.call({ lexer: this }, n, e)) ? (n = n.substring(t.raw.length), e.push(t), !0) : !1))) {
|
|
734
|
-
if (t = this.tokenizer.space(n)) {
|
|
735
|
-
n = n.substring(t.raw.length), t.raw.length === 1 && e.length > 0 ? e[e.length - 1].raw += `
|
|
736
|
-
` : e.push(t);
|
|
737
|
-
continue;
|
|
738
|
-
}
|
|
739
|
-
if (t = this.tokenizer.code(n)) {
|
|
740
|
-
n = n.substring(t.raw.length), s = e[e.length - 1], s && (s.type === "paragraph" || s.type === "text") ? (s.raw += `
|
|
741
|
-
` + t.raw, s.text += `
|
|
742
|
-
` + t.text, this.inlineQueue[this.inlineQueue.length - 1].src = s.text) : e.push(t);
|
|
743
|
-
continue;
|
|
744
|
-
}
|
|
745
|
-
if (t = this.tokenizer.fences(n)) {
|
|
746
|
-
n = n.substring(t.raw.length), e.push(t);
|
|
747
|
-
continue;
|
|
748
|
-
}
|
|
749
|
-
if (t = this.tokenizer.heading(n)) {
|
|
750
|
-
n = n.substring(t.raw.length), e.push(t);
|
|
751
|
-
continue;
|
|
752
|
-
}
|
|
753
|
-
if (t = this.tokenizer.hr(n)) {
|
|
754
|
-
n = n.substring(t.raw.length), e.push(t);
|
|
755
|
-
continue;
|
|
756
|
-
}
|
|
757
|
-
if (t = this.tokenizer.blockquote(n)) {
|
|
758
|
-
n = n.substring(t.raw.length), e.push(t);
|
|
759
|
-
continue;
|
|
760
|
-
}
|
|
761
|
-
if (t = this.tokenizer.list(n)) {
|
|
762
|
-
n = n.substring(t.raw.length), e.push(t);
|
|
763
|
-
continue;
|
|
764
|
-
}
|
|
765
|
-
if (t = this.tokenizer.html(n)) {
|
|
766
|
-
n = n.substring(t.raw.length), e.push(t);
|
|
767
|
-
continue;
|
|
768
|
-
}
|
|
769
|
-
if (t = this.tokenizer.def(n)) {
|
|
770
|
-
n = n.substring(t.raw.length), s = e[e.length - 1], s && (s.type === "paragraph" || s.type === "text") ? (s.raw += `
|
|
771
|
-
` + t.raw, s.text += `
|
|
772
|
-
` + t.raw, this.inlineQueue[this.inlineQueue.length - 1].src = s.text) : this.tokens.links[t.tag] || (this.tokens.links[t.tag] = {
|
|
773
|
-
href: t.href,
|
|
774
|
-
title: t.title
|
|
775
|
-
});
|
|
776
|
-
continue;
|
|
777
|
-
}
|
|
778
|
-
if (t = this.tokenizer.table(n)) {
|
|
779
|
-
n = n.substring(t.raw.length), e.push(t);
|
|
780
|
-
continue;
|
|
781
|
-
}
|
|
782
|
-
if (t = this.tokenizer.lheading(n)) {
|
|
783
|
-
n = n.substring(t.raw.length), e.push(t);
|
|
784
|
-
continue;
|
|
785
|
-
}
|
|
786
|
-
if (i = n, this.options.extensions && this.options.extensions.startBlock) {
|
|
787
|
-
let a = 1 / 0;
|
|
788
|
-
const c = n.slice(1);
|
|
789
|
-
let x;
|
|
790
|
-
this.options.extensions.startBlock.forEach((f) => {
|
|
791
|
-
x = f.call({ lexer: this }, c), typeof x == "number" && x >= 0 && (a = Math.min(a, x));
|
|
792
|
-
}), a < 1 / 0 && a >= 0 && (i = n.substring(0, a + 1));
|
|
793
|
-
}
|
|
794
|
-
if (this.state.top && (t = this.tokenizer.paragraph(i))) {
|
|
795
|
-
s = e[e.length - 1], r && s.type === "paragraph" ? (s.raw += `
|
|
796
|
-
` + t.raw, s.text += `
|
|
797
|
-
` + t.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = s.text) : e.push(t), r = i.length !== n.length, n = n.substring(t.raw.length);
|
|
798
|
-
continue;
|
|
799
|
-
}
|
|
800
|
-
if (t = this.tokenizer.text(n)) {
|
|
801
|
-
n = n.substring(t.raw.length), s = e[e.length - 1], s && s.type === "text" ? (s.raw += `
|
|
802
|
-
` + t.raw, s.text += `
|
|
803
|
-
` + t.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = s.text) : e.push(t);
|
|
804
|
-
continue;
|
|
805
|
-
}
|
|
806
|
-
if (n) {
|
|
807
|
-
const a = "Infinite loop on byte: " + n.charCodeAt(0);
|
|
808
|
-
if (this.options.silent) {
|
|
809
|
-
console.error(a);
|
|
810
|
-
break;
|
|
811
|
-
} else
|
|
812
|
-
throw new Error(a);
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
return this.state.top = !0, e;
|
|
816
|
-
}
|
|
817
|
-
inline(n, e = []) {
|
|
818
|
-
return this.inlineQueue.push({ src: n, tokens: e }), e;
|
|
819
|
-
}
|
|
820
|
-
/**
|
|
821
|
-
* Lexing/Compiling
|
|
822
|
-
*/
|
|
823
|
-
inlineTokens(n, e = []) {
|
|
824
|
-
let t, s, i, r = n, a, c, x;
|
|
825
|
-
if (this.tokens.links) {
|
|
826
|
-
const f = Object.keys(this.tokens.links);
|
|
827
|
-
if (f.length > 0)
|
|
828
|
-
for (; (a = this.tokenizer.rules.inline.reflinkSearch.exec(r)) != null; )
|
|
829
|
-
f.includes(a[0].slice(a[0].lastIndexOf("[") + 1, -1)) && (r = r.slice(0, a.index) + "[" + "a".repeat(a[0].length - 2) + "]" + r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
830
|
-
}
|
|
831
|
-
for (; (a = this.tokenizer.rules.inline.blockSkip.exec(r)) != null; )
|
|
832
|
-
r = r.slice(0, a.index) + "[" + "a".repeat(a[0].length - 2) + "]" + r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
833
|
-
for (; (a = this.tokenizer.rules.inline.anyPunctuation.exec(r)) != null; )
|
|
834
|
-
r = r.slice(0, a.index) + "++" + r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
835
|
-
for (; n; )
|
|
836
|
-
if (c || (x = ""), c = !1, !(this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((f) => (t = f.call({ lexer: this }, n, e)) ? (n = n.substring(t.raw.length), e.push(t), !0) : !1))) {
|
|
837
|
-
if (t = this.tokenizer.escape(n)) {
|
|
838
|
-
n = n.substring(t.raw.length), e.push(t);
|
|
839
|
-
continue;
|
|
840
|
-
}
|
|
841
|
-
if (t = this.tokenizer.tag(n)) {
|
|
842
|
-
n = n.substring(t.raw.length), s = e[e.length - 1], s && t.type === "text" && s.type === "text" ? (s.raw += t.raw, s.text += t.text) : e.push(t);
|
|
843
|
-
continue;
|
|
844
|
-
}
|
|
845
|
-
if (t = this.tokenizer.link(n)) {
|
|
846
|
-
n = n.substring(t.raw.length), e.push(t);
|
|
847
|
-
continue;
|
|
848
|
-
}
|
|
849
|
-
if (t = this.tokenizer.reflink(n, this.tokens.links)) {
|
|
850
|
-
n = n.substring(t.raw.length), s = e[e.length - 1], s && t.type === "text" && s.type === "text" ? (s.raw += t.raw, s.text += t.text) : e.push(t);
|
|
851
|
-
continue;
|
|
852
|
-
}
|
|
853
|
-
if (t = this.tokenizer.emStrong(n, r, x)) {
|
|
854
|
-
n = n.substring(t.raw.length), e.push(t);
|
|
855
|
-
continue;
|
|
856
|
-
}
|
|
857
|
-
if (t = this.tokenizer.codespan(n)) {
|
|
858
|
-
n = n.substring(t.raw.length), e.push(t);
|
|
859
|
-
continue;
|
|
860
|
-
}
|
|
861
|
-
if (t = this.tokenizer.br(n)) {
|
|
862
|
-
n = n.substring(t.raw.length), e.push(t);
|
|
863
|
-
continue;
|
|
864
|
-
}
|
|
865
|
-
if (t = this.tokenizer.del(n)) {
|
|
866
|
-
n = n.substring(t.raw.length), e.push(t);
|
|
867
|
-
continue;
|
|
868
|
-
}
|
|
869
|
-
if (t = this.tokenizer.autolink(n)) {
|
|
870
|
-
n = n.substring(t.raw.length), e.push(t);
|
|
871
|
-
continue;
|
|
872
|
-
}
|
|
873
|
-
if (!this.state.inLink && (t = this.tokenizer.url(n))) {
|
|
874
|
-
n = n.substring(t.raw.length), e.push(t);
|
|
875
|
-
continue;
|
|
876
|
-
}
|
|
877
|
-
if (i = n, this.options.extensions && this.options.extensions.startInline) {
|
|
878
|
-
let f = 1 / 0;
|
|
879
|
-
const b = n.slice(1);
|
|
880
|
-
let d;
|
|
881
|
-
this.options.extensions.startInline.forEach((v) => {
|
|
882
|
-
d = v.call({ lexer: this }, b), typeof d == "number" && d >= 0 && (f = Math.min(f, d));
|
|
883
|
-
}), f < 1 / 0 && f >= 0 && (i = n.substring(0, f + 1));
|
|
884
|
-
}
|
|
885
|
-
if (t = this.tokenizer.inlineText(i)) {
|
|
886
|
-
n = n.substring(t.raw.length), t.raw.slice(-1) !== "_" && (x = t.raw.slice(-1)), c = !0, s = e[e.length - 1], s && s.type === "text" ? (s.raw += t.raw, s.text += t.text) : e.push(t);
|
|
887
|
-
continue;
|
|
888
|
-
}
|
|
889
|
-
if (n) {
|
|
890
|
-
const f = "Infinite loop on byte: " + n.charCodeAt(0);
|
|
891
|
-
if (this.options.silent) {
|
|
892
|
-
console.error(f);
|
|
893
|
-
break;
|
|
894
|
-
} else
|
|
895
|
-
throw new Error(f);
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
return e;
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
class ae {
|
|
902
|
-
options;
|
|
903
|
-
constructor(n) {
|
|
904
|
-
this.options = n || D;
|
|
905
|
-
}
|
|
906
|
-
code(n, e, t) {
|
|
907
|
-
const s = (e || "").match(/^\S*/)?.[0];
|
|
908
|
-
return n = n.replace(/\n$/, "") + `
|
|
909
|
-
`, s ? '<pre><code class="language-' + R(s) + '">' + (t ? n : R(n, !0)) + `</code></pre>
|
|
910
|
-
` : "<pre><code>" + (t ? n : R(n, !0)) + `</code></pre>
|
|
911
|
-
`;
|
|
912
|
-
}
|
|
913
|
-
blockquote(n) {
|
|
914
|
-
return `<blockquote>
|
|
915
|
-
${n}</blockquote>
|
|
916
|
-
`;
|
|
917
|
-
}
|
|
918
|
-
html(n, e) {
|
|
919
|
-
return n;
|
|
920
|
-
}
|
|
921
|
-
heading(n, e, t) {
|
|
922
|
-
return `<h${e}>${n}</h${e}>
|
|
923
|
-
`;
|
|
924
|
-
}
|
|
925
|
-
hr() {
|
|
926
|
-
return `<hr>
|
|
927
|
-
`;
|
|
928
|
-
}
|
|
929
|
-
list(n, e, t) {
|
|
930
|
-
const s = e ? "ol" : "ul", i = e && t !== 1 ? ' start="' + t + '"' : "";
|
|
931
|
-
return "<" + s + i + `>
|
|
932
|
-
` + n + "</" + s + `>
|
|
933
|
-
`;
|
|
934
|
-
}
|
|
935
|
-
listitem(n, e, t) {
|
|
936
|
-
return `<li>${n}</li>
|
|
937
|
-
`;
|
|
938
|
-
}
|
|
939
|
-
checkbox(n) {
|
|
940
|
-
return "<input " + (n ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
|
|
941
|
-
}
|
|
942
|
-
paragraph(n) {
|
|
943
|
-
return `<p>${n}</p>
|
|
944
|
-
`;
|
|
945
|
-
}
|
|
946
|
-
table(n, e) {
|
|
947
|
-
return e && (e = `<tbody>${e}</tbody>`), `<table>
|
|
948
|
-
<thead>
|
|
949
|
-
` + n + `</thead>
|
|
950
|
-
` + e + `</table>
|
|
951
|
-
`;
|
|
952
|
-
}
|
|
953
|
-
tablerow(n) {
|
|
954
|
-
return `<tr>
|
|
955
|
-
${n}</tr>
|
|
956
|
-
`;
|
|
957
|
-
}
|
|
958
|
-
tablecell(n, e) {
|
|
959
|
-
const t = e.header ? "th" : "td";
|
|
960
|
-
return (e.align ? `<${t} align="${e.align}">` : `<${t}>`) + n + `</${t}>
|
|
961
|
-
`;
|
|
962
|
-
}
|
|
963
|
-
/**
|
|
964
|
-
* span level renderer
|
|
965
|
-
*/
|
|
966
|
-
strong(n) {
|
|
967
|
-
return `<strong>${n}</strong>`;
|
|
968
|
-
}
|
|
969
|
-
em(n) {
|
|
970
|
-
return `<em>${n}</em>`;
|
|
971
|
-
}
|
|
972
|
-
codespan(n) {
|
|
973
|
-
return `<code>${n}</code>`;
|
|
974
|
-
}
|
|
975
|
-
br() {
|
|
976
|
-
return "<br>";
|
|
977
|
-
}
|
|
978
|
-
del(n) {
|
|
979
|
-
return `<del>${n}</del>`;
|
|
980
|
-
}
|
|
981
|
-
link(n, e, t) {
|
|
982
|
-
const s = Re(n);
|
|
983
|
-
if (s === null)
|
|
984
|
-
return t;
|
|
985
|
-
n = s;
|
|
986
|
-
let i = '<a href="' + n + '"';
|
|
987
|
-
return e && (i += ' title="' + e + '"'), i += ">" + t + "</a>", i;
|
|
988
|
-
}
|
|
989
|
-
image(n, e, t) {
|
|
990
|
-
const s = Re(n);
|
|
991
|
-
if (s === null)
|
|
992
|
-
return t;
|
|
993
|
-
n = s;
|
|
994
|
-
let i = `<img src="${n}" alt="${t}"`;
|
|
995
|
-
return e && (i += ` title="${e}"`), i += ">", i;
|
|
996
|
-
}
|
|
997
|
-
text(n) {
|
|
998
|
-
return n;
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
class $e {
|
|
1002
|
-
// no need for block level renderers
|
|
1003
|
-
strong(n) {
|
|
1004
|
-
return n;
|
|
1005
|
-
}
|
|
1006
|
-
em(n) {
|
|
1007
|
-
return n;
|
|
1008
|
-
}
|
|
1009
|
-
codespan(n) {
|
|
1010
|
-
return n;
|
|
1011
|
-
}
|
|
1012
|
-
del(n) {
|
|
1013
|
-
return n;
|
|
1014
|
-
}
|
|
1015
|
-
html(n) {
|
|
1016
|
-
return n;
|
|
1017
|
-
}
|
|
1018
|
-
text(n) {
|
|
1019
|
-
return n;
|
|
1020
|
-
}
|
|
1021
|
-
link(n, e, t) {
|
|
1022
|
-
return "" + t;
|
|
1023
|
-
}
|
|
1024
|
-
image(n, e, t) {
|
|
1025
|
-
return "" + t;
|
|
1026
|
-
}
|
|
1027
|
-
br() {
|
|
1028
|
-
return "";
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
class P {
|
|
1032
|
-
options;
|
|
1033
|
-
renderer;
|
|
1034
|
-
textRenderer;
|
|
1035
|
-
constructor(n) {
|
|
1036
|
-
this.options = n || D, this.options.renderer = this.options.renderer || new ae(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.textRenderer = new $e();
|
|
1037
|
-
}
|
|
1038
|
-
/**
|
|
1039
|
-
* Static Parse Method
|
|
1040
|
-
*/
|
|
1041
|
-
static parse(n, e) {
|
|
1042
|
-
return new P(e).parse(n);
|
|
1043
|
-
}
|
|
1044
|
-
/**
|
|
1045
|
-
* Static Parse Inline Method
|
|
1046
|
-
*/
|
|
1047
|
-
static parseInline(n, e) {
|
|
1048
|
-
return new P(e).parseInline(n);
|
|
1049
|
-
}
|
|
1050
|
-
/**
|
|
1051
|
-
* Parse Loop
|
|
1052
|
-
*/
|
|
1053
|
-
parse(n, e = !0) {
|
|
1054
|
-
let t = "";
|
|
1055
|
-
for (let s = 0; s < n.length; s++) {
|
|
1056
|
-
const i = n[s];
|
|
1057
|
-
if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[i.type]) {
|
|
1058
|
-
const r = i, a = this.options.extensions.renderers[r.type].call({ parser: this }, r);
|
|
1059
|
-
if (a !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(r.type)) {
|
|
1060
|
-
t += a || "";
|
|
1061
|
-
continue;
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
switch (i.type) {
|
|
1065
|
-
case "space":
|
|
1066
|
-
continue;
|
|
1067
|
-
case "hr": {
|
|
1068
|
-
t += this.renderer.hr();
|
|
1069
|
-
continue;
|
|
1070
|
-
}
|
|
1071
|
-
case "heading": {
|
|
1072
|
-
const r = i;
|
|
1073
|
-
t += this.renderer.heading(this.parseInline(r.tokens), r.depth, ht(this.parseInline(r.tokens, this.textRenderer)));
|
|
1074
|
-
continue;
|
|
1075
|
-
}
|
|
1076
|
-
case "code": {
|
|
1077
|
-
const r = i;
|
|
1078
|
-
t += this.renderer.code(r.text, r.lang, !!r.escaped);
|
|
1079
|
-
continue;
|
|
1080
|
-
}
|
|
1081
|
-
case "table": {
|
|
1082
|
-
const r = i;
|
|
1083
|
-
let a = "", c = "";
|
|
1084
|
-
for (let f = 0; f < r.header.length; f++)
|
|
1085
|
-
c += this.renderer.tablecell(this.parseInline(r.header[f].tokens), { header: !0, align: r.align[f] });
|
|
1086
|
-
a += this.renderer.tablerow(c);
|
|
1087
|
-
let x = "";
|
|
1088
|
-
for (let f = 0; f < r.rows.length; f++) {
|
|
1089
|
-
const b = r.rows[f];
|
|
1090
|
-
c = "";
|
|
1091
|
-
for (let d = 0; d < b.length; d++)
|
|
1092
|
-
c += this.renderer.tablecell(this.parseInline(b[d].tokens), { header: !1, align: r.align[d] });
|
|
1093
|
-
x += this.renderer.tablerow(c);
|
|
1094
|
-
}
|
|
1095
|
-
t += this.renderer.table(a, x);
|
|
1096
|
-
continue;
|
|
1097
|
-
}
|
|
1098
|
-
case "blockquote": {
|
|
1099
|
-
const r = i, a = this.parse(r.tokens);
|
|
1100
|
-
t += this.renderer.blockquote(a);
|
|
1101
|
-
continue;
|
|
1102
|
-
}
|
|
1103
|
-
case "list": {
|
|
1104
|
-
const r = i, a = r.ordered, c = r.start, x = r.loose;
|
|
1105
|
-
let f = "";
|
|
1106
|
-
for (let b = 0; b < r.items.length; b++) {
|
|
1107
|
-
const d = r.items[b], v = d.checked, E = d.task;
|
|
1108
|
-
let $ = "";
|
|
1109
|
-
if (d.task) {
|
|
1110
|
-
const w = this.renderer.checkbox(!!v);
|
|
1111
|
-
x ? d.tokens.length > 0 && d.tokens[0].type === "paragraph" ? (d.tokens[0].text = w + " " + d.tokens[0].text, d.tokens[0].tokens && d.tokens[0].tokens.length > 0 && d.tokens[0].tokens[0].type === "text" && (d.tokens[0].tokens[0].text = w + " " + d.tokens[0].tokens[0].text)) : d.tokens.unshift({
|
|
1112
|
-
type: "text",
|
|
1113
|
-
text: w + " "
|
|
1114
|
-
}) : $ += w + " ";
|
|
1115
|
-
}
|
|
1116
|
-
$ += this.parse(d.tokens, x), f += this.renderer.listitem($, E, !!v);
|
|
1117
|
-
}
|
|
1118
|
-
t += this.renderer.list(f, a, c);
|
|
1119
|
-
continue;
|
|
1120
|
-
}
|
|
1121
|
-
case "html": {
|
|
1122
|
-
const r = i;
|
|
1123
|
-
t += this.renderer.html(r.text, r.block);
|
|
1124
|
-
continue;
|
|
1125
|
-
}
|
|
1126
|
-
case "paragraph": {
|
|
1127
|
-
const r = i;
|
|
1128
|
-
t += this.renderer.paragraph(this.parseInline(r.tokens));
|
|
1129
|
-
continue;
|
|
1130
|
-
}
|
|
1131
|
-
case "text": {
|
|
1132
|
-
let r = i, a = r.tokens ? this.parseInline(r.tokens) : r.text;
|
|
1133
|
-
for (; s + 1 < n.length && n[s + 1].type === "text"; )
|
|
1134
|
-
r = n[++s], a += `
|
|
1135
|
-
` + (r.tokens ? this.parseInline(r.tokens) : r.text);
|
|
1136
|
-
t += e ? this.renderer.paragraph(a) : a;
|
|
1137
|
-
continue;
|
|
1138
|
-
}
|
|
1139
|
-
default: {
|
|
1140
|
-
const r = 'Token with "' + i.type + '" type was not found.';
|
|
1141
|
-
if (this.options.silent)
|
|
1142
|
-
return console.error(r), "";
|
|
1143
|
-
throw new Error(r);
|
|
1144
|
-
}
|
|
1145
|
-
}
|
|
1146
|
-
}
|
|
1147
|
-
return t;
|
|
1148
|
-
}
|
|
1149
|
-
/**
|
|
1150
|
-
* Parse Inline Tokens
|
|
1151
|
-
*/
|
|
1152
|
-
parseInline(n, e) {
|
|
1153
|
-
e = e || this.renderer;
|
|
1154
|
-
let t = "";
|
|
1155
|
-
for (let s = 0; s < n.length; s++) {
|
|
1156
|
-
const i = n[s];
|
|
1157
|
-
if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[i.type]) {
|
|
1158
|
-
const r = this.options.extensions.renderers[i.type].call({ parser: this }, i);
|
|
1159
|
-
if (r !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(i.type)) {
|
|
1160
|
-
t += r || "";
|
|
1161
|
-
continue;
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1164
|
-
switch (i.type) {
|
|
1165
|
-
case "escape": {
|
|
1166
|
-
const r = i;
|
|
1167
|
-
t += e.text(r.text);
|
|
1168
|
-
break;
|
|
1169
|
-
}
|
|
1170
|
-
case "html": {
|
|
1171
|
-
const r = i;
|
|
1172
|
-
t += e.html(r.text);
|
|
1173
|
-
break;
|
|
1174
|
-
}
|
|
1175
|
-
case "link": {
|
|
1176
|
-
const r = i;
|
|
1177
|
-
t += e.link(r.href, r.title, this.parseInline(r.tokens, e));
|
|
1178
|
-
break;
|
|
1179
|
-
}
|
|
1180
|
-
case "image": {
|
|
1181
|
-
const r = i;
|
|
1182
|
-
t += e.image(r.href, r.title, r.text);
|
|
1183
|
-
break;
|
|
1184
|
-
}
|
|
1185
|
-
case "strong": {
|
|
1186
|
-
const r = i;
|
|
1187
|
-
t += e.strong(this.parseInline(r.tokens, e));
|
|
1188
|
-
break;
|
|
1189
|
-
}
|
|
1190
|
-
case "em": {
|
|
1191
|
-
const r = i;
|
|
1192
|
-
t += e.em(this.parseInline(r.tokens, e));
|
|
1193
|
-
break;
|
|
1194
|
-
}
|
|
1195
|
-
case "codespan": {
|
|
1196
|
-
const r = i;
|
|
1197
|
-
t += e.codespan(r.text);
|
|
1198
|
-
break;
|
|
1199
|
-
}
|
|
1200
|
-
case "br": {
|
|
1201
|
-
t += e.br();
|
|
1202
|
-
break;
|
|
1203
|
-
}
|
|
1204
|
-
case "del": {
|
|
1205
|
-
const r = i;
|
|
1206
|
-
t += e.del(this.parseInline(r.tokens, e));
|
|
1207
|
-
break;
|
|
1208
|
-
}
|
|
1209
|
-
case "text": {
|
|
1210
|
-
const r = i;
|
|
1211
|
-
t += e.text(r.text);
|
|
1212
|
-
break;
|
|
1213
|
-
}
|
|
1214
|
-
default: {
|
|
1215
|
-
const r = 'Token with "' + i.type + '" type was not found.';
|
|
1216
|
-
if (this.options.silent)
|
|
1217
|
-
return console.error(r), "";
|
|
1218
|
-
throw new Error(r);
|
|
1219
|
-
}
|
|
1220
|
-
}
|
|
1221
|
-
}
|
|
1222
|
-
return t;
|
|
1223
|
-
}
|
|
1224
|
-
}
|
|
1225
|
-
class ne {
|
|
1226
|
-
options;
|
|
1227
|
-
constructor(n) {
|
|
1228
|
-
this.options = n || D;
|
|
1229
|
-
}
|
|
1230
|
-
static passThroughHooks = /* @__PURE__ */ new Set([
|
|
1231
|
-
"preprocess",
|
|
1232
|
-
"postprocess",
|
|
1233
|
-
"processAllTokens"
|
|
1234
|
-
]);
|
|
1235
|
-
/**
|
|
1236
|
-
* Process markdown before marked
|
|
1237
|
-
*/
|
|
1238
|
-
preprocess(n) {
|
|
1239
|
-
return n;
|
|
1240
|
-
}
|
|
1241
|
-
/**
|
|
1242
|
-
* Process HTML after marked is finished
|
|
1243
|
-
*/
|
|
1244
|
-
postprocess(n) {
|
|
1245
|
-
return n;
|
|
1246
|
-
}
|
|
1247
|
-
/**
|
|
1248
|
-
* Process all tokens before walk tokens
|
|
1249
|
-
*/
|
|
1250
|
-
processAllTokens(n) {
|
|
1251
|
-
return n;
|
|
1252
|
-
}
|
|
1253
|
-
}
|
|
1254
|
-
class Ne {
|
|
1255
|
-
defaults = me();
|
|
1256
|
-
options = this.setOptions;
|
|
1257
|
-
parse = this.#e(L.lex, P.parse);
|
|
1258
|
-
parseInline = this.#e(L.lexInline, P.parseInline);
|
|
1259
|
-
Parser = P;
|
|
1260
|
-
Renderer = ae;
|
|
1261
|
-
TextRenderer = $e;
|
|
1262
|
-
Lexer = L;
|
|
1263
|
-
Tokenizer = se;
|
|
1264
|
-
Hooks = ne;
|
|
1265
|
-
constructor(...n) {
|
|
1266
|
-
this.use(...n);
|
|
1267
|
-
}
|
|
1268
|
-
/**
|
|
1269
|
-
* Run callback for every token
|
|
1270
|
-
*/
|
|
1271
|
-
walkTokens(n, e) {
|
|
1272
|
-
let t = [];
|
|
1273
|
-
for (const s of n)
|
|
1274
|
-
switch (t = t.concat(e.call(this, s)), s.type) {
|
|
1275
|
-
case "table": {
|
|
1276
|
-
const i = s;
|
|
1277
|
-
for (const r of i.header)
|
|
1278
|
-
t = t.concat(this.walkTokens(r.tokens, e));
|
|
1279
|
-
for (const r of i.rows)
|
|
1280
|
-
for (const a of r)
|
|
1281
|
-
t = t.concat(this.walkTokens(a.tokens, e));
|
|
1282
|
-
break;
|
|
1283
|
-
}
|
|
1284
|
-
case "list": {
|
|
1285
|
-
const i = s;
|
|
1286
|
-
t = t.concat(this.walkTokens(i.items, e));
|
|
1287
|
-
break;
|
|
1288
|
-
}
|
|
1289
|
-
default: {
|
|
1290
|
-
const i = s;
|
|
1291
|
-
this.defaults.extensions?.childTokens?.[i.type] ? this.defaults.extensions.childTokens[i.type].forEach((r) => {
|
|
1292
|
-
const a = i[r].flat(1 / 0);
|
|
1293
|
-
t = t.concat(this.walkTokens(a, e));
|
|
1294
|
-
}) : i.tokens && (t = t.concat(this.walkTokens(i.tokens, e)));
|
|
1295
|
-
}
|
|
1296
|
-
}
|
|
1297
|
-
return t;
|
|
1298
|
-
}
|
|
1299
|
-
use(...n) {
|
|
1300
|
-
const e = this.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
1301
|
-
return n.forEach((t) => {
|
|
1302
|
-
const s = { ...t };
|
|
1303
|
-
if (s.async = this.defaults.async || s.async || !1, t.extensions && (t.extensions.forEach((i) => {
|
|
1304
|
-
if (!i.name)
|
|
1305
|
-
throw new Error("extension name required");
|
|
1306
|
-
if ("renderer" in i) {
|
|
1307
|
-
const r = e.renderers[i.name];
|
|
1308
|
-
r ? e.renderers[i.name] = function(...a) {
|
|
1309
|
-
let c = i.renderer.apply(this, a);
|
|
1310
|
-
return c === !1 && (c = r.apply(this, a)), c;
|
|
1311
|
-
} : e.renderers[i.name] = i.renderer;
|
|
1312
|
-
}
|
|
1313
|
-
if ("tokenizer" in i) {
|
|
1314
|
-
if (!i.level || i.level !== "block" && i.level !== "inline")
|
|
1315
|
-
throw new Error("extension level must be 'block' or 'inline'");
|
|
1316
|
-
const r = e[i.level];
|
|
1317
|
-
r ? r.unshift(i.tokenizer) : e[i.level] = [i.tokenizer], i.start && (i.level === "block" ? e.startBlock ? e.startBlock.push(i.start) : e.startBlock = [i.start] : i.level === "inline" && (e.startInline ? e.startInline.push(i.start) : e.startInline = [i.start]));
|
|
1318
|
-
}
|
|
1319
|
-
"childTokens" in i && i.childTokens && (e.childTokens[i.name] = i.childTokens);
|
|
1320
|
-
}), s.extensions = e), t.renderer) {
|
|
1321
|
-
const i = this.defaults.renderer || new ae(this.defaults);
|
|
1322
|
-
for (const r in t.renderer) {
|
|
1323
|
-
if (!(r in i))
|
|
1324
|
-
throw new Error(`renderer '${r}' does not exist`);
|
|
1325
|
-
if (r === "options")
|
|
1326
|
-
continue;
|
|
1327
|
-
const a = r, c = t.renderer[a], x = i[a];
|
|
1328
|
-
i[a] = (...f) => {
|
|
1329
|
-
let b = c.apply(i, f);
|
|
1330
|
-
return b === !1 && (b = x.apply(i, f)), b || "";
|
|
1331
|
-
};
|
|
1332
|
-
}
|
|
1333
|
-
s.renderer = i;
|
|
1334
|
-
}
|
|
1335
|
-
if (t.tokenizer) {
|
|
1336
|
-
const i = this.defaults.tokenizer || new se(this.defaults);
|
|
1337
|
-
for (const r in t.tokenizer) {
|
|
1338
|
-
if (!(r in i))
|
|
1339
|
-
throw new Error(`tokenizer '${r}' does not exist`);
|
|
1340
|
-
if (["options", "rules", "lexer"].includes(r))
|
|
1341
|
-
continue;
|
|
1342
|
-
const a = r, c = t.tokenizer[a], x = i[a];
|
|
1343
|
-
i[a] = (...f) => {
|
|
1344
|
-
let b = c.apply(i, f);
|
|
1345
|
-
return b === !1 && (b = x.apply(i, f)), b;
|
|
1346
|
-
};
|
|
1347
|
-
}
|
|
1348
|
-
s.tokenizer = i;
|
|
1349
|
-
}
|
|
1350
|
-
if (t.hooks) {
|
|
1351
|
-
const i = this.defaults.hooks || new ne();
|
|
1352
|
-
for (const r in t.hooks) {
|
|
1353
|
-
if (!(r in i))
|
|
1354
|
-
throw new Error(`hook '${r}' does not exist`);
|
|
1355
|
-
if (r === "options")
|
|
1356
|
-
continue;
|
|
1357
|
-
const a = r, c = t.hooks[a], x = i[a];
|
|
1358
|
-
ne.passThroughHooks.has(r) ? i[a] = (f) => {
|
|
1359
|
-
if (this.defaults.async)
|
|
1360
|
-
return Promise.resolve(c.call(i, f)).then((d) => x.call(i, d));
|
|
1361
|
-
const b = c.call(i, f);
|
|
1362
|
-
return x.call(i, b);
|
|
1363
|
-
} : i[a] = (...f) => {
|
|
1364
|
-
let b = c.apply(i, f);
|
|
1365
|
-
return b === !1 && (b = x.apply(i, f)), b;
|
|
1366
|
-
};
|
|
1367
|
-
}
|
|
1368
|
-
s.hooks = i;
|
|
1369
|
-
}
|
|
1370
|
-
if (t.walkTokens) {
|
|
1371
|
-
const i = this.defaults.walkTokens, r = t.walkTokens;
|
|
1372
|
-
s.walkTokens = function(a) {
|
|
1373
|
-
let c = [];
|
|
1374
|
-
return c.push(r.call(this, a)), i && (c = c.concat(i.call(this, a))), c;
|
|
1375
|
-
};
|
|
1376
|
-
}
|
|
1377
|
-
this.defaults = { ...this.defaults, ...s };
|
|
1378
|
-
}), this;
|
|
1379
|
-
}
|
|
1380
|
-
setOptions(n) {
|
|
1381
|
-
return this.defaults = { ...this.defaults, ...n }, this;
|
|
1382
|
-
}
|
|
1383
|
-
lexer(n, e) {
|
|
1384
|
-
return L.lex(n, e ?? this.defaults);
|
|
1385
|
-
}
|
|
1386
|
-
parser(n, e) {
|
|
1387
|
-
return P.parse(n, e ?? this.defaults);
|
|
1388
|
-
}
|
|
1389
|
-
#e(n, e) {
|
|
1390
|
-
return (t, s) => {
|
|
1391
|
-
const i = { ...s }, r = { ...this.defaults, ...i };
|
|
1392
|
-
this.defaults.async === !0 && i.async === !1 && (r.silent || console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."), r.async = !0);
|
|
1393
|
-
const a = this.#t(!!r.silent, !!r.async);
|
|
1394
|
-
if (typeof t > "u" || t === null)
|
|
1395
|
-
return a(new Error("marked(): input parameter is undefined or null"));
|
|
1396
|
-
if (typeof t != "string")
|
|
1397
|
-
return a(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(t) + ", string expected"));
|
|
1398
|
-
if (r.hooks && (r.hooks.options = r), r.async)
|
|
1399
|
-
return Promise.resolve(r.hooks ? r.hooks.preprocess(t) : t).then((c) => n(c, r)).then((c) => r.hooks ? r.hooks.processAllTokens(c) : c).then((c) => r.walkTokens ? Promise.all(this.walkTokens(c, r.walkTokens)).then(() => c) : c).then((c) => e(c, r)).then((c) => r.hooks ? r.hooks.postprocess(c) : c).catch(a);
|
|
1400
|
-
try {
|
|
1401
|
-
r.hooks && (t = r.hooks.preprocess(t));
|
|
1402
|
-
let c = n(t, r);
|
|
1403
|
-
r.hooks && (c = r.hooks.processAllTokens(c)), r.walkTokens && this.walkTokens(c, r.walkTokens);
|
|
1404
|
-
let x = e(c, r);
|
|
1405
|
-
return r.hooks && (x = r.hooks.postprocess(x)), x;
|
|
1406
|
-
} catch (c) {
|
|
1407
|
-
return a(c);
|
|
1408
|
-
}
|
|
1409
|
-
};
|
|
1410
|
-
}
|
|
1411
|
-
#t(n, e) {
|
|
1412
|
-
return (t) => {
|
|
1413
|
-
if (t.message += `
|
|
1414
|
-
Please report this to https://github.com/markedjs/marked.`, n) {
|
|
1415
|
-
const s = "<p>An error occurred:</p><pre>" + R(t.message + "", !0) + "</pre>";
|
|
1416
|
-
return e ? Promise.resolve(s) : s;
|
|
1417
|
-
}
|
|
1418
|
-
if (e)
|
|
1419
|
-
return Promise.reject(t);
|
|
1420
|
-
throw t;
|
|
1421
|
-
};
|
|
1422
|
-
}
|
|
1423
|
-
}
|
|
1424
|
-
const B = new Ne();
|
|
1425
|
-
function A(u, n) {
|
|
1426
|
-
return B.parse(u, n);
|
|
1427
|
-
}
|
|
1428
|
-
A.options = A.setOptions = function(u) {
|
|
1429
|
-
return B.setOptions(u), A.defaults = B.defaults, Oe(A.defaults), A;
|
|
1430
|
-
};
|
|
1431
|
-
A.getDefaults = me;
|
|
1432
|
-
A.defaults = D;
|
|
1433
|
-
A.use = function(...u) {
|
|
1434
|
-
return B.use(...u), A.defaults = B.defaults, Oe(A.defaults), A;
|
|
1435
|
-
};
|
|
1436
|
-
A.walkTokens = function(u, n) {
|
|
1437
|
-
return B.walkTokens(u, n);
|
|
1438
|
-
};
|
|
1439
|
-
A.parseInline = B.parseInline;
|
|
1440
|
-
A.Parser = P;
|
|
1441
|
-
A.parser = P.parse;
|
|
1442
|
-
A.Renderer = ae;
|
|
1443
|
-
A.TextRenderer = $e;
|
|
1444
|
-
A.Lexer = L;
|
|
1445
|
-
A.lexer = L.lex;
|
|
1446
|
-
A.Tokenizer = se;
|
|
1447
|
-
A.Hooks = ne;
|
|
1448
|
-
A.parse = A;
|
|
1449
|
-
A.options;
|
|
1450
|
-
A.setOptions;
|
|
1451
|
-
A.use;
|
|
1452
|
-
A.walkTokens;
|
|
1453
|
-
A.parseInline;
|
|
1454
|
-
P.parse;
|
|
1455
|
-
L.lex;
|
|
1456
|
-
var pe = { exports: {} }, Pe;
|
|
1457
|
-
function jt() {
|
|
1458
|
-
return Pe || (Pe = 1, function(u) {
|
|
1459
|
-
var n = typeof window < "u" ? window : typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? self : {};
|
|
1460
|
-
/**
|
|
1461
|
-
* Prism: Lightweight, robust, elegant syntax highlighting
|
|
1462
|
-
*
|
|
1463
|
-
* @license MIT <https://opensource.org/licenses/MIT>
|
|
1464
|
-
* @author Lea Verou <https://lea.verou.me>
|
|
1465
|
-
* @namespace
|
|
1466
|
-
* @public
|
|
1467
|
-
*/
|
|
1468
|
-
var e = function(t) {
|
|
1469
|
-
var s = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i, i = 0, r = {}, a = {
|
|
1470
|
-
/**
|
|
1471
|
-
* By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
|
|
1472
|
-
* current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
|
|
1473
|
-
* additional languages or plugins yourself.
|
|
1474
|
-
*
|
|
1475
|
-
* By setting this value to `true`, Prism will not automatically highlight all code elements on the page.
|
|
1476
|
-
*
|
|
1477
|
-
* You obviously have to change this value before the automatic highlighting started. To do this, you can add an
|
|
1478
|
-
* empty Prism object into the global scope before loading the Prism script like this:
|
|
1479
|
-
*
|
|
1480
|
-
* ```js
|
|
1481
|
-
* window.Prism = window.Prism || {};
|
|
1482
|
-
* Prism.manual = true;
|
|
1483
|
-
* // add a new <script> to load Prism's script
|
|
1484
|
-
* ```
|
|
1485
|
-
*
|
|
1486
|
-
* @default false
|
|
1487
|
-
* @type {boolean}
|
|
1488
|
-
* @memberof Prism
|
|
1489
|
-
* @public
|
|
1490
|
-
*/
|
|
1491
|
-
manual: t.Prism && t.Prism.manual,
|
|
1492
|
-
/**
|
|
1493
|
-
* By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
|
|
1494
|
-
* `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
|
|
1495
|
-
* own worker, you don't want it to do this.
|
|
1496
|
-
*
|
|
1497
|
-
* By setting this value to `true`, Prism will not add its own listeners to the worker.
|
|
1498
|
-
*
|
|
1499
|
-
* You obviously have to change this value before Prism executes. To do this, you can add an
|
|
1500
|
-
* empty Prism object into the global scope before loading the Prism script like this:
|
|
1501
|
-
*
|
|
1502
|
-
* ```js
|
|
1503
|
-
* window.Prism = window.Prism || {};
|
|
1504
|
-
* Prism.disableWorkerMessageHandler = true;
|
|
1505
|
-
* // Load Prism's script
|
|
1506
|
-
* ```
|
|
1507
|
-
*
|
|
1508
|
-
* @default false
|
|
1509
|
-
* @type {boolean}
|
|
1510
|
-
* @memberof Prism
|
|
1511
|
-
* @public
|
|
1512
|
-
*/
|
|
1513
|
-
disableWorkerMessageHandler: t.Prism && t.Prism.disableWorkerMessageHandler,
|
|
1514
|
-
/**
|
|
1515
|
-
* A namespace for utility methods.
|
|
1516
|
-
*
|
|
1517
|
-
* All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may
|
|
1518
|
-
* change or disappear at any time.
|
|
1519
|
-
*
|
|
1520
|
-
* @namespace
|
|
1521
|
-
* @memberof Prism
|
|
1522
|
-
*/
|
|
1523
|
-
util: {
|
|
1524
|
-
encode: function o(l) {
|
|
1525
|
-
return l instanceof c ? new c(l.type, o(l.content), l.alias) : Array.isArray(l) ? l.map(o) : l.replace(/&/g, "&").replace(/</g, "<").replace(/\u00a0/g, " ");
|
|
1526
|
-
},
|
|
1527
|
-
/**
|
|
1528
|
-
* Returns the name of the type of the given value.
|
|
1529
|
-
*
|
|
1530
|
-
* @param {any} o
|
|
1531
|
-
* @returns {string}
|
|
1532
|
-
* @example
|
|
1533
|
-
* type(null) === 'Null'
|
|
1534
|
-
* type(undefined) === 'Undefined'
|
|
1535
|
-
* type(123) === 'Number'
|
|
1536
|
-
* type('foo') === 'String'
|
|
1537
|
-
* type(true) === 'Boolean'
|
|
1538
|
-
* type([1, 2]) === 'Array'
|
|
1539
|
-
* type({}) === 'Object'
|
|
1540
|
-
* type(String) === 'Function'
|
|
1541
|
-
* type(/abc+/) === 'RegExp'
|
|
1542
|
-
*/
|
|
1543
|
-
type: function(o) {
|
|
1544
|
-
return Object.prototype.toString.call(o).slice(8, -1);
|
|
1545
|
-
},
|
|
1546
|
-
/**
|
|
1547
|
-
* Returns a unique number for the given object. Later calls will still return the same number.
|
|
1548
|
-
*
|
|
1549
|
-
* @param {Object} obj
|
|
1550
|
-
* @returns {number}
|
|
1551
|
-
*/
|
|
1552
|
-
objId: function(o) {
|
|
1553
|
-
return o.__id || Object.defineProperty(o, "__id", { value: ++i }), o.__id;
|
|
1554
|
-
},
|
|
1555
|
-
/**
|
|
1556
|
-
* Creates a deep clone of the given object.
|
|
1557
|
-
*
|
|
1558
|
-
* The main intended use of this function is to clone language definitions.
|
|
1559
|
-
*
|
|
1560
|
-
* @param {T} o
|
|
1561
|
-
* @param {Record<number, any>} [visited]
|
|
1562
|
-
* @returns {T}
|
|
1563
|
-
* @template T
|
|
1564
|
-
*/
|
|
1565
|
-
clone: function o(l, p) {
|
|
1566
|
-
p = p || {};
|
|
1567
|
-
var h, g;
|
|
1568
|
-
switch (a.util.type(l)) {
|
|
1569
|
-
case "Object":
|
|
1570
|
-
if (g = a.util.objId(l), p[g])
|
|
1571
|
-
return p[g];
|
|
1572
|
-
h = /** @type {Record<string, any>} */
|
|
1573
|
-
{}, p[g] = h;
|
|
1574
|
-
for (var m in l)
|
|
1575
|
-
l.hasOwnProperty(m) && (h[m] = o(l[m], p));
|
|
1576
|
-
return (
|
|
1577
|
-
/** @type {any} */
|
|
1578
|
-
h
|
|
1579
|
-
);
|
|
1580
|
-
case "Array":
|
|
1581
|
-
return g = a.util.objId(l), p[g] ? p[g] : (h = [], p[g] = h, /** @type {Array} */
|
|
1582
|
-
/** @type {any} */
|
|
1583
|
-
l.forEach(function(y, k) {
|
|
1584
|
-
h[k] = o(y, p);
|
|
1585
|
-
}), /** @type {any} */
|
|
1586
|
-
h);
|
|
1587
|
-
default:
|
|
1588
|
-
return l;
|
|
1589
|
-
}
|
|
1590
|
-
},
|
|
1591
|
-
/**
|
|
1592
|
-
* Returns the Prism language of the given element set by a `language-xxxx` or `lang-xxxx` class.
|
|
1593
|
-
*
|
|
1594
|
-
* If no language is set for the element or the element is `null` or `undefined`, `none` will be returned.
|
|
1595
|
-
*
|
|
1596
|
-
* @param {Element} element
|
|
1597
|
-
* @returns {string}
|
|
1598
|
-
*/
|
|
1599
|
-
getLanguage: function(o) {
|
|
1600
|
-
for (; o; ) {
|
|
1601
|
-
var l = s.exec(o.className);
|
|
1602
|
-
if (l)
|
|
1603
|
-
return l[1].toLowerCase();
|
|
1604
|
-
o = o.parentElement;
|
|
1605
|
-
}
|
|
1606
|
-
return "none";
|
|
1607
|
-
},
|
|
1608
|
-
/**
|
|
1609
|
-
* Sets the Prism `language-xxxx` class of the given element.
|
|
1610
|
-
*
|
|
1611
|
-
* @param {Element} element
|
|
1612
|
-
* @param {string} language
|
|
1613
|
-
* @returns {void}
|
|
1614
|
-
*/
|
|
1615
|
-
setLanguage: function(o, l) {
|
|
1616
|
-
o.className = o.className.replace(RegExp(s, "gi"), ""), o.classList.add("language-" + l);
|
|
1617
|
-
},
|
|
1618
|
-
/**
|
|
1619
|
-
* Returns the script element that is currently executing.
|
|
1620
|
-
*
|
|
1621
|
-
* This does __not__ work for line script element.
|
|
1622
|
-
*
|
|
1623
|
-
* @returns {HTMLScriptElement | null}
|
|
1624
|
-
*/
|
|
1625
|
-
currentScript: function() {
|
|
1626
|
-
if (typeof document > "u")
|
|
1627
|
-
return null;
|
|
1628
|
-
if (document.currentScript && document.currentScript.tagName === "SCRIPT")
|
|
1629
|
-
return (
|
|
1630
|
-
/** @type {any} */
|
|
1631
|
-
document.currentScript
|
|
1632
|
-
);
|
|
1633
|
-
try {
|
|
1634
|
-
throw new Error();
|
|
1635
|
-
} catch (h) {
|
|
1636
|
-
var o = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(h.stack) || [])[1];
|
|
1637
|
-
if (o) {
|
|
1638
|
-
var l = document.getElementsByTagName("script");
|
|
1639
|
-
for (var p in l)
|
|
1640
|
-
if (l[p].src == o)
|
|
1641
|
-
return l[p];
|
|
1642
|
-
}
|
|
1643
|
-
return null;
|
|
1644
|
-
}
|
|
1645
|
-
},
|
|
1646
|
-
/**
|
|
1647
|
-
* Returns whether a given class is active for `element`.
|
|
1648
|
-
*
|
|
1649
|
-
* The class can be activated if `element` or one of its ancestors has the given class and it can be deactivated
|
|
1650
|
-
* if `element` or one of its ancestors has the negated version of the given class. The _negated version_ of the
|
|
1651
|
-
* given class is just the given class with a `no-` prefix.
|
|
1652
|
-
*
|
|
1653
|
-
* Whether the class is active is determined by the closest ancestor of `element` (where `element` itself is
|
|
1654
|
-
* closest ancestor) that has the given class or the negated version of it. If neither `element` nor any of its
|
|
1655
|
-
* ancestors have the given class or the negated version of it, then the default activation will be returned.
|
|
1656
|
-
*
|
|
1657
|
-
* In the paradoxical situation where the closest ancestor contains __both__ the given class and the negated
|
|
1658
|
-
* version of it, the class is considered active.
|
|
1659
|
-
*
|
|
1660
|
-
* @param {Element} element
|
|
1661
|
-
* @param {string} className
|
|
1662
|
-
* @param {boolean} [defaultActivation=false]
|
|
1663
|
-
* @returns {boolean}
|
|
1664
|
-
*/
|
|
1665
|
-
isActive: function(o, l, p) {
|
|
1666
|
-
for (var h = "no-" + l; o; ) {
|
|
1667
|
-
var g = o.classList;
|
|
1668
|
-
if (g.contains(l))
|
|
1669
|
-
return !0;
|
|
1670
|
-
if (g.contains(h))
|
|
1671
|
-
return !1;
|
|
1672
|
-
o = o.parentElement;
|
|
1673
|
-
}
|
|
1674
|
-
return !!p;
|
|
1675
|
-
}
|
|
1676
|
-
},
|
|
1677
|
-
/**
|
|
1678
|
-
* This namespace contains all currently loaded languages and the some helper functions to create and modify languages.
|
|
1679
|
-
*
|
|
1680
|
-
* @namespace
|
|
1681
|
-
* @memberof Prism
|
|
1682
|
-
* @public
|
|
1683
|
-
*/
|
|
1684
|
-
languages: {
|
|
1685
|
-
/**
|
|
1686
|
-
* The grammar for plain, unformatted text.
|
|
1687
|
-
*/
|
|
1688
|
-
plain: r,
|
|
1689
|
-
plaintext: r,
|
|
1690
|
-
text: r,
|
|
1691
|
-
txt: r,
|
|
1692
|
-
/**
|
|
1693
|
-
* Creates a deep copy of the language with the given id and appends the given tokens.
|
|
1694
|
-
*
|
|
1695
|
-
* If a token in `redef` also appears in the copied language, then the existing token in the copied language
|
|
1696
|
-
* will be overwritten at its original position.
|
|
1697
|
-
*
|
|
1698
|
-
* ## Best practices
|
|
1699
|
-
*
|
|
1700
|
-
* Since the position of overwriting tokens (token in `redef` that overwrite tokens in the copied language)
|
|
1701
|
-
* doesn't matter, they can technically be in any order. However, this can be confusing to others that trying to
|
|
1702
|
-
* understand the language definition because, normally, the order of tokens matters in Prism grammars.
|
|
1703
|
-
*
|
|
1704
|
-
* Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
|
|
1705
|
-
* Furthermore, all non-overwriting tokens should be placed after the overwriting ones.
|
|
1706
|
-
*
|
|
1707
|
-
* @param {string} id The id of the language to extend. This has to be a key in `Prism.languages`.
|
|
1708
|
-
* @param {Grammar} redef The new tokens to append.
|
|
1709
|
-
* @returns {Grammar} The new language created.
|
|
1710
|
-
* @public
|
|
1711
|
-
* @example
|
|
1712
|
-
* Prism.languages['css-with-colors'] = Prism.languages.extend('css', {
|
|
1713
|
-
* // Prism.languages.css already has a 'comment' token, so this token will overwrite CSS' 'comment' token
|
|
1714
|
-
* // at its original position
|
|
1715
|
-
* 'comment': { ... },
|
|
1716
|
-
* // CSS doesn't have a 'color' token, so this token will be appended
|
|
1717
|
-
* 'color': /\b(?:red|green|blue)\b/
|
|
1718
|
-
* });
|
|
1719
|
-
*/
|
|
1720
|
-
extend: function(o, l) {
|
|
1721
|
-
var p = a.util.clone(a.languages[o]);
|
|
1722
|
-
for (var h in l)
|
|
1723
|
-
p[h] = l[h];
|
|
1724
|
-
return p;
|
|
1725
|
-
},
|
|
1726
|
-
/**
|
|
1727
|
-
* Inserts tokens _before_ another token in a language definition or any other grammar.
|
|
1728
|
-
*
|
|
1729
|
-
* ## Usage
|
|
1730
|
-
*
|
|
1731
|
-
* This helper method makes it easy to modify existing languages. For example, the CSS language definition
|
|
1732
|
-
* not only defines CSS highlighting for CSS documents, but also needs to define highlighting for CSS embedded
|
|
1733
|
-
* in HTML through `<style>` elements. To do this, it needs to modify `Prism.languages.markup` and add the
|
|
1734
|
-
* appropriate tokens. However, `Prism.languages.markup` is a regular JavaScript object literal, so if you do
|
|
1735
|
-
* this:
|
|
1736
|
-
*
|
|
1737
|
-
* ```js
|
|
1738
|
-
* Prism.languages.markup.style = {
|
|
1739
|
-
* // token
|
|
1740
|
-
* };
|
|
1741
|
-
* ```
|
|
1742
|
-
*
|
|
1743
|
-
* then the `style` token will be added (and processed) at the end. `insertBefore` allows you to insert tokens
|
|
1744
|
-
* before existing tokens. For the CSS example above, you would use it like this:
|
|
1745
|
-
*
|
|
1746
|
-
* ```js
|
|
1747
|
-
* Prism.languages.insertBefore('markup', 'cdata', {
|
|
1748
|
-
* 'style': {
|
|
1749
|
-
* // token
|
|
1750
|
-
* }
|
|
1751
|
-
* });
|
|
1752
|
-
* ```
|
|
1753
|
-
*
|
|
1754
|
-
* ## Special cases
|
|
1755
|
-
*
|
|
1756
|
-
* If the grammars of `inside` and `insert` have tokens with the same name, the tokens in `inside`'s grammar
|
|
1757
|
-
* will be ignored.
|
|
1758
|
-
*
|
|
1759
|
-
* This behavior can be used to insert tokens after `before`:
|
|
1760
|
-
*
|
|
1761
|
-
* ```js
|
|
1762
|
-
* Prism.languages.insertBefore('markup', 'comment', {
|
|
1763
|
-
* 'comment': Prism.languages.markup.comment,
|
|
1764
|
-
* // tokens after 'comment'
|
|
1765
|
-
* });
|
|
1766
|
-
* ```
|
|
1767
|
-
*
|
|
1768
|
-
* ## Limitations
|
|
1769
|
-
*
|
|
1770
|
-
* The main problem `insertBefore` has to solve is iteration order. Since ES2015, the iteration order for object
|
|
1771
|
-
* properties is guaranteed to be the insertion order (except for integer keys) but some browsers behave
|
|
1772
|
-
* differently when keys are deleted and re-inserted. So `insertBefore` can't be implemented by temporarily
|
|
1773
|
-
* deleting properties which is necessary to insert at arbitrary positions.
|
|
1774
|
-
*
|
|
1775
|
-
* To solve this problem, `insertBefore` doesn't actually insert the given tokens into the target object.
|
|
1776
|
-
* Instead, it will create a new object and replace all references to the target object with the new one. This
|
|
1777
|
-
* can be done without temporarily deleting properties, so the iteration order is well-defined.
|
|
1778
|
-
*
|
|
1779
|
-
* However, only references that can be reached from `Prism.languages` or `insert` will be replaced. I.e. if
|
|
1780
|
-
* you hold the target object in a variable, then the value of the variable will not change.
|
|
1781
|
-
*
|
|
1782
|
-
* ```js
|
|
1783
|
-
* var oldMarkup = Prism.languages.markup;
|
|
1784
|
-
* var newMarkup = Prism.languages.insertBefore('markup', 'comment', { ... });
|
|
1785
|
-
*
|
|
1786
|
-
* assert(oldMarkup !== Prism.languages.markup);
|
|
1787
|
-
* assert(newMarkup === Prism.languages.markup);
|
|
1788
|
-
* ```
|
|
1789
|
-
*
|
|
1790
|
-
* @param {string} inside The property of `root` (e.g. a language id in `Prism.languages`) that contains the
|
|
1791
|
-
* object to be modified.
|
|
1792
|
-
* @param {string} before The key to insert before.
|
|
1793
|
-
* @param {Grammar} insert An object containing the key-value pairs to be inserted.
|
|
1794
|
-
* @param {Object<string, any>} [root] The object containing `inside`, i.e. the object that contains the
|
|
1795
|
-
* object to be modified.
|
|
1796
|
-
*
|
|
1797
|
-
* Defaults to `Prism.languages`.
|
|
1798
|
-
* @returns {Grammar} The new grammar object.
|
|
1799
|
-
* @public
|
|
1800
|
-
*/
|
|
1801
|
-
insertBefore: function(o, l, p, h) {
|
|
1802
|
-
h = h || /** @type {any} */
|
|
1803
|
-
a.languages;
|
|
1804
|
-
var g = h[o], m = {};
|
|
1805
|
-
for (var y in g)
|
|
1806
|
-
if (g.hasOwnProperty(y)) {
|
|
1807
|
-
if (y == l)
|
|
1808
|
-
for (var k in p)
|
|
1809
|
-
p.hasOwnProperty(k) && (m[k] = p[k]);
|
|
1810
|
-
p.hasOwnProperty(y) || (m[y] = g[y]);
|
|
1811
|
-
}
|
|
1812
|
-
var F = h[o];
|
|
1813
|
-
return h[o] = m, a.languages.DFS(a.languages, function(_, O) {
|
|
1814
|
-
O === F && _ != o && (this[_] = m);
|
|
1815
|
-
}), m;
|
|
1816
|
-
},
|
|
1817
|
-
// Traverse a language definition with Depth First Search
|
|
1818
|
-
DFS: function o(l, p, h, g) {
|
|
1819
|
-
g = g || {};
|
|
1820
|
-
var m = a.util.objId;
|
|
1821
|
-
for (var y in l)
|
|
1822
|
-
if (l.hasOwnProperty(y)) {
|
|
1823
|
-
p.call(l, y, l[y], h || y);
|
|
1824
|
-
var k = l[y], F = a.util.type(k);
|
|
1825
|
-
F === "Object" && !g[m(k)] ? (g[m(k)] = !0, o(k, p, null, g)) : F === "Array" && !g[m(k)] && (g[m(k)] = !0, o(k, p, y, g));
|
|
1826
|
-
}
|
|
1827
|
-
}
|
|
1828
|
-
},
|
|
1829
|
-
plugins: {},
|
|
1830
|
-
/**
|
|
1831
|
-
* This is the most high-level function in Prism’s API.
|
|
1832
|
-
* It fetches all the elements that have a `.language-xxxx` class and then calls {@link Prism.highlightElement} on
|
|
1833
|
-
* each one of them.
|
|
1834
|
-
*
|
|
1835
|
-
* This is equivalent to `Prism.highlightAllUnder(document, async, callback)`.
|
|
1836
|
-
*
|
|
1837
|
-
* @param {boolean} [async=false] Same as in {@link Prism.highlightAllUnder}.
|
|
1838
|
-
* @param {HighlightCallback} [callback] Same as in {@link Prism.highlightAllUnder}.
|
|
1839
|
-
* @memberof Prism
|
|
1840
|
-
* @public
|
|
1841
|
-
*/
|
|
1842
|
-
highlightAll: function(o, l) {
|
|
1843
|
-
a.highlightAllUnder(document, o, l);
|
|
1844
|
-
},
|
|
1845
|
-
/**
|
|
1846
|
-
* Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
|
|
1847
|
-
* {@link Prism.highlightElement} on each one of them.
|
|
1848
|
-
*
|
|
1849
|
-
* The following hooks will be run:
|
|
1850
|
-
* 1. `before-highlightall`
|
|
1851
|
-
* 2. `before-all-elements-highlight`
|
|
1852
|
-
* 3. All hooks of {@link Prism.highlightElement} for each element.
|
|
1853
|
-
*
|
|
1854
|
-
* @param {ParentNode} container The root element, whose descendants that have a `.language-xxxx` class will be highlighted.
|
|
1855
|
-
* @param {boolean} [async=false] Whether each element is to be highlighted asynchronously using Web Workers.
|
|
1856
|
-
* @param {HighlightCallback} [callback] An optional callback to be invoked on each element after its highlighting is done.
|
|
1857
|
-
* @memberof Prism
|
|
1858
|
-
* @public
|
|
1859
|
-
*/
|
|
1860
|
-
highlightAllUnder: function(o, l, p) {
|
|
1861
|
-
var h = {
|
|
1862
|
-
callback: p,
|
|
1863
|
-
container: o,
|
|
1864
|
-
selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
|
|
1865
|
-
};
|
|
1866
|
-
a.hooks.run("before-highlightall", h), h.elements = Array.prototype.slice.apply(h.container.querySelectorAll(h.selector)), a.hooks.run("before-all-elements-highlight", h);
|
|
1867
|
-
for (var g = 0, m; m = h.elements[g++]; )
|
|
1868
|
-
a.highlightElement(m, l === !0, h.callback);
|
|
1869
|
-
},
|
|
1870
|
-
/**
|
|
1871
|
-
* Highlights the code inside a single element.
|
|
1872
|
-
*
|
|
1873
|
-
* The following hooks will be run:
|
|
1874
|
-
* 1. `before-sanity-check`
|
|
1875
|
-
* 2. `before-highlight`
|
|
1876
|
-
* 3. All hooks of {@link Prism.highlight}. These hooks will be run by an asynchronous worker if `async` is `true`.
|
|
1877
|
-
* 4. `before-insert`
|
|
1878
|
-
* 5. `after-highlight`
|
|
1879
|
-
* 6. `complete`
|
|
1880
|
-
*
|
|
1881
|
-
* Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
|
|
1882
|
-
* the element's language.
|
|
1883
|
-
*
|
|
1884
|
-
* @param {Element} element The element containing the code.
|
|
1885
|
-
* It must have a class of `language-xxxx` to be processed, where `xxxx` is a valid language identifier.
|
|
1886
|
-
* @param {boolean} [async=false] Whether the element is to be highlighted asynchronously using Web Workers
|
|
1887
|
-
* to improve performance and avoid blocking the UI when highlighting very large chunks of code. This option is
|
|
1888
|
-
* [disabled by default](https://prismjs.com/faq.html#why-is-asynchronous-highlighting-disabled-by-default).
|
|
1889
|
-
*
|
|
1890
|
-
* Note: All language definitions required to highlight the code must be included in the main `prism.js` file for
|
|
1891
|
-
* asynchronous highlighting to work. You can build your own bundle on the
|
|
1892
|
-
* [Download page](https://prismjs.com/download.html).
|
|
1893
|
-
* @param {HighlightCallback} [callback] An optional callback to be invoked after the highlighting is done.
|
|
1894
|
-
* Mostly useful when `async` is `true`, since in that case, the highlighting is done asynchronously.
|
|
1895
|
-
* @memberof Prism
|
|
1896
|
-
* @public
|
|
1897
|
-
*/
|
|
1898
|
-
highlightElement: function(o, l, p) {
|
|
1899
|
-
var h = a.util.getLanguage(o), g = a.languages[h];
|
|
1900
|
-
a.util.setLanguage(o, h);
|
|
1901
|
-
var m = o.parentElement;
|
|
1902
|
-
m && m.nodeName.toLowerCase() === "pre" && a.util.setLanguage(m, h);
|
|
1903
|
-
var y = o.textContent, k = {
|
|
1904
|
-
element: o,
|
|
1905
|
-
language: h,
|
|
1906
|
-
grammar: g,
|
|
1907
|
-
code: y
|
|
1908
|
-
};
|
|
1909
|
-
function F(O) {
|
|
1910
|
-
k.highlightedCode = O, a.hooks.run("before-insert", k), k.element.innerHTML = k.highlightedCode, a.hooks.run("after-highlight", k), a.hooks.run("complete", k), p && p.call(k.element);
|
|
1911
|
-
}
|
|
1912
|
-
if (a.hooks.run("before-sanity-check", k), m = k.element.parentElement, m && m.nodeName.toLowerCase() === "pre" && !m.hasAttribute("tabindex") && m.setAttribute("tabindex", "0"), !k.code) {
|
|
1913
|
-
a.hooks.run("complete", k), p && p.call(k.element);
|
|
1914
|
-
return;
|
|
1915
|
-
}
|
|
1916
|
-
if (a.hooks.run("before-highlight", k), !k.grammar) {
|
|
1917
|
-
F(a.util.encode(k.code));
|
|
1918
|
-
return;
|
|
1919
|
-
}
|
|
1920
|
-
if (l && t.Worker) {
|
|
1921
|
-
var _ = new Worker(a.filename);
|
|
1922
|
-
_.onmessage = function(O) {
|
|
1923
|
-
F(O.data);
|
|
1924
|
-
}, _.postMessage(JSON.stringify({
|
|
1925
|
-
language: k.language,
|
|
1926
|
-
code: k.code,
|
|
1927
|
-
immediateClose: !0
|
|
1928
|
-
}));
|
|
1929
|
-
} else
|
|
1930
|
-
F(a.highlight(k.code, k.grammar, k.language));
|
|
1931
|
-
},
|
|
1932
|
-
/**
|
|
1933
|
-
* Low-level function, only use if you know what you’re doing. It accepts a string of text as input
|
|
1934
|
-
* and the language definitions to use, and returns a string with the HTML produced.
|
|
1935
|
-
*
|
|
1936
|
-
* The following hooks will be run:
|
|
1937
|
-
* 1. `before-tokenize`
|
|
1938
|
-
* 2. `after-tokenize`
|
|
1939
|
-
* 3. `wrap`: On each {@link Token}.
|
|
1940
|
-
*
|
|
1941
|
-
* @param {string} text A string with the code to be highlighted.
|
|
1942
|
-
* @param {Grammar} grammar An object containing the tokens to use.
|
|
1943
|
-
*
|
|
1944
|
-
* Usually a language definition like `Prism.languages.markup`.
|
|
1945
|
-
* @param {string} language The name of the language definition passed to `grammar`.
|
|
1946
|
-
* @returns {string} The highlighted HTML.
|
|
1947
|
-
* @memberof Prism
|
|
1948
|
-
* @public
|
|
1949
|
-
* @example
|
|
1950
|
-
* Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
|
|
1951
|
-
*/
|
|
1952
|
-
highlight: function(o, l, p) {
|
|
1953
|
-
var h = {
|
|
1954
|
-
code: o,
|
|
1955
|
-
grammar: l,
|
|
1956
|
-
language: p
|
|
1957
|
-
};
|
|
1958
|
-
if (a.hooks.run("before-tokenize", h), !h.grammar)
|
|
1959
|
-
throw new Error('The language "' + h.language + '" has no grammar.');
|
|
1960
|
-
return h.tokens = a.tokenize(h.code, h.grammar), a.hooks.run("after-tokenize", h), c.stringify(a.util.encode(h.tokens), h.language);
|
|
1961
|
-
},
|
|
1962
|
-
/**
|
|
1963
|
-
* This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
|
|
1964
|
-
* and the language definitions to use, and returns an array with the tokenized code.
|
|
1965
|
-
*
|
|
1966
|
-
* When the language definition includes nested tokens, the function is called recursively on each of these tokens.
|
|
1967
|
-
*
|
|
1968
|
-
* This method could be useful in other contexts as well, as a very crude parser.
|
|
1969
|
-
*
|
|
1970
|
-
* @param {string} text A string with the code to be highlighted.
|
|
1971
|
-
* @param {Grammar} grammar An object containing the tokens to use.
|
|
1972
|
-
*
|
|
1973
|
-
* Usually a language definition like `Prism.languages.markup`.
|
|
1974
|
-
* @returns {TokenStream} An array of strings and tokens, a token stream.
|
|
1975
|
-
* @memberof Prism
|
|
1976
|
-
* @public
|
|
1977
|
-
* @example
|
|
1978
|
-
* let code = `var foo = 0;`;
|
|
1979
|
-
* let tokens = Prism.tokenize(code, Prism.languages.javascript);
|
|
1980
|
-
* tokens.forEach(token => {
|
|
1981
|
-
* if (token instanceof Prism.Token && token.type === 'number') {
|
|
1982
|
-
* console.log(`Found numeric literal: ${token.content}`);
|
|
1983
|
-
* }
|
|
1984
|
-
* });
|
|
1985
|
-
*/
|
|
1986
|
-
tokenize: function(o, l) {
|
|
1987
|
-
var p = l.rest;
|
|
1988
|
-
if (p) {
|
|
1989
|
-
for (var h in p)
|
|
1990
|
-
l[h] = p[h];
|
|
1991
|
-
delete l.rest;
|
|
1992
|
-
}
|
|
1993
|
-
var g = new b();
|
|
1994
|
-
return d(g, g.head, o), f(o, g, l, g.head, 0), E(g);
|
|
1995
|
-
},
|
|
1996
|
-
/**
|
|
1997
|
-
* @namespace
|
|
1998
|
-
* @memberof Prism
|
|
1999
|
-
* @public
|
|
2000
|
-
*/
|
|
2001
|
-
hooks: {
|
|
2002
|
-
all: {},
|
|
2003
|
-
/**
|
|
2004
|
-
* Adds the given callback to the list of callbacks for the given hook.
|
|
2005
|
-
*
|
|
2006
|
-
* The callback will be invoked when the hook it is registered for is run.
|
|
2007
|
-
* Hooks are usually directly run by a highlight function but you can also run hooks yourself.
|
|
2008
|
-
*
|
|
2009
|
-
* One callback function can be registered to multiple hooks and the same hook multiple times.
|
|
2010
|
-
*
|
|
2011
|
-
* @param {string} name The name of the hook.
|
|
2012
|
-
* @param {HookCallback} callback The callback function which is given environment variables.
|
|
2013
|
-
* @public
|
|
2014
|
-
*/
|
|
2015
|
-
add: function(o, l) {
|
|
2016
|
-
var p = a.hooks.all;
|
|
2017
|
-
p[o] = p[o] || [], p[o].push(l);
|
|
2018
|
-
},
|
|
2019
|
-
/**
|
|
2020
|
-
* Runs a hook invoking all registered callbacks with the given environment variables.
|
|
2021
|
-
*
|
|
2022
|
-
* Callbacks will be invoked synchronously and in the order in which they were registered.
|
|
2023
|
-
*
|
|
2024
|
-
* @param {string} name The name of the hook.
|
|
2025
|
-
* @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
|
|
2026
|
-
* @public
|
|
2027
|
-
*/
|
|
2028
|
-
run: function(o, l) {
|
|
2029
|
-
var p = a.hooks.all[o];
|
|
2030
|
-
if (!(!p || !p.length))
|
|
2031
|
-
for (var h = 0, g; g = p[h++]; )
|
|
2032
|
-
g(l);
|
|
2033
|
-
}
|
|
2034
|
-
},
|
|
2035
|
-
Token: c
|
|
2036
|
-
};
|
|
2037
|
-
t.Prism = a;
|
|
2038
|
-
function c(o, l, p, h) {
|
|
2039
|
-
this.type = o, this.content = l, this.alias = p, this.length = (h || "").length | 0;
|
|
2040
|
-
}
|
|
2041
|
-
c.stringify = function o(l, p) {
|
|
2042
|
-
if (typeof l == "string")
|
|
2043
|
-
return l;
|
|
2044
|
-
if (Array.isArray(l)) {
|
|
2045
|
-
var h = "";
|
|
2046
|
-
return l.forEach(function(F) {
|
|
2047
|
-
h += o(F, p);
|
|
2048
|
-
}), h;
|
|
2049
|
-
}
|
|
2050
|
-
var g = {
|
|
2051
|
-
type: l.type,
|
|
2052
|
-
content: o(l.content, p),
|
|
2053
|
-
tag: "span",
|
|
2054
|
-
classes: ["token", l.type],
|
|
2055
|
-
attributes: {},
|
|
2056
|
-
language: p
|
|
2057
|
-
}, m = l.alias;
|
|
2058
|
-
m && (Array.isArray(m) ? Array.prototype.push.apply(g.classes, m) : g.classes.push(m)), a.hooks.run("wrap", g);
|
|
2059
|
-
var y = "";
|
|
2060
|
-
for (var k in g.attributes)
|
|
2061
|
-
y += " " + k + '="' + (g.attributes[k] || "").replace(/"/g, """) + '"';
|
|
2062
|
-
return "<" + g.tag + ' class="' + g.classes.join(" ") + '"' + y + ">" + g.content + "</" + g.tag + ">";
|
|
2063
|
-
};
|
|
2064
|
-
function x(o, l, p, h) {
|
|
2065
|
-
o.lastIndex = l;
|
|
2066
|
-
var g = o.exec(p);
|
|
2067
|
-
if (g && h && g[1]) {
|
|
2068
|
-
var m = g[1].length;
|
|
2069
|
-
g.index += m, g[0] = g[0].slice(m);
|
|
2070
|
-
}
|
|
2071
|
-
return g;
|
|
2072
|
-
}
|
|
2073
|
-
function f(o, l, p, h, g, m) {
|
|
2074
|
-
for (var y in p)
|
|
2075
|
-
if (!(!p.hasOwnProperty(y) || !p[y])) {
|
|
2076
|
-
var k = p[y];
|
|
2077
|
-
k = Array.isArray(k) ? k : [k];
|
|
2078
|
-
for (var F = 0; F < k.length; ++F) {
|
|
2079
|
-
if (m && m.cause == y + "," + F)
|
|
2080
|
-
return;
|
|
2081
|
-
var _ = k[F], O = _.inside, Te = !!_.lookbehind, Se = !!_.greedy, Je = _.alias;
|
|
2082
|
-
if (Se && !_.pattern.global) {
|
|
2083
|
-
var Ke = _.pattern.toString().match(/[imsuy]*$/)[0];
|
|
2084
|
-
_.pattern = RegExp(_.pattern.source, Ke + "g");
|
|
2085
|
-
}
|
|
2086
|
-
for (var Fe = _.pattern || _, z = h.next, I = g; z !== l.tail && !(m && I >= m.reach); I += z.value.length, z = z.next) {
|
|
2087
|
-
var j = z.value;
|
|
2088
|
-
if (l.length > o.length)
|
|
2089
|
-
return;
|
|
2090
|
-
if (!(j instanceof c)) {
|
|
2091
|
-
var Y = 1, C;
|
|
2092
|
-
if (Se) {
|
|
2093
|
-
if (C = x(Fe, I, o, Te), !C || C.index >= o.length)
|
|
2094
|
-
break;
|
|
2095
|
-
var J = C.index, Ve = C.index + C[0].length, Z = I;
|
|
2096
|
-
for (Z += z.value.length; J >= Z; )
|
|
2097
|
-
z = z.next, Z += z.value.length;
|
|
2098
|
-
if (Z -= z.value.length, I = Z, z.value instanceof c)
|
|
2099
|
-
continue;
|
|
2100
|
-
for (var U = z; U !== l.tail && (Z < Ve || typeof U.value == "string"); U = U.next)
|
|
2101
|
-
Y++, Z += U.value.length;
|
|
2102
|
-
Y--, j = o.slice(I, Z), C.index -= I;
|
|
2103
|
-
} else if (C = x(Fe, 0, j, Te), !C)
|
|
2104
|
-
continue;
|
|
2105
|
-
var J = C.index, K = C[0], oe = j.slice(0, J), _e = j.slice(J + K.length), ce = I + j.length;
|
|
2106
|
-
m && ce > m.reach && (m.reach = ce);
|
|
2107
|
-
var V = z.prev;
|
|
2108
|
-
oe && (V = d(l, V, oe), I += oe.length), v(l, V, Y);
|
|
2109
|
-
var et = new c(y, O ? a.tokenize(K, O) : K, Je, K);
|
|
2110
|
-
if (z = d(l, V, et), _e && d(l, z, _e), Y > 1) {
|
|
2111
|
-
var ue = {
|
|
2112
|
-
cause: y + "," + F,
|
|
2113
|
-
reach: ce
|
|
2114
|
-
};
|
|
2115
|
-
f(o, l, p, z.prev, I, ue), m && ue.reach > m.reach && (m.reach = ue.reach);
|
|
2116
|
-
}
|
|
2117
|
-
}
|
|
2118
|
-
}
|
|
2119
|
-
}
|
|
2120
|
-
}
|
|
2121
|
-
}
|
|
2122
|
-
function b() {
|
|
2123
|
-
var o = { value: null, prev: null, next: null }, l = { value: null, prev: o, next: null };
|
|
2124
|
-
o.next = l, this.head = o, this.tail = l, this.length = 0;
|
|
2125
|
-
}
|
|
2126
|
-
function d(o, l, p) {
|
|
2127
|
-
var h = l.next, g = { value: p, prev: l, next: h };
|
|
2128
|
-
return l.next = g, h.prev = g, o.length++, g;
|
|
2129
|
-
}
|
|
2130
|
-
function v(o, l, p) {
|
|
2131
|
-
for (var h = l.next, g = 0; g < p && h !== o.tail; g++)
|
|
2132
|
-
h = h.next;
|
|
2133
|
-
l.next = h, h.prev = l, o.length -= g;
|
|
2134
|
-
}
|
|
2135
|
-
function E(o) {
|
|
2136
|
-
for (var l = [], p = o.head.next; p !== o.tail; )
|
|
2137
|
-
l.push(p.value), p = p.next;
|
|
2138
|
-
return l;
|
|
2139
|
-
}
|
|
2140
|
-
if (!t.document)
|
|
2141
|
-
return t.addEventListener && (a.disableWorkerMessageHandler || t.addEventListener("message", function(o) {
|
|
2142
|
-
var l = JSON.parse(o.data), p = l.language, h = l.code, g = l.immediateClose;
|
|
2143
|
-
t.postMessage(a.highlight(h, a.languages[p], p)), g && t.close();
|
|
2144
|
-
}, !1)), a;
|
|
2145
|
-
var $ = a.util.currentScript();
|
|
2146
|
-
$ && (a.filename = $.src, $.hasAttribute("data-manual") && (a.manual = !0));
|
|
2147
|
-
function w() {
|
|
2148
|
-
a.manual || a.highlightAll();
|
|
2149
|
-
}
|
|
2150
|
-
if (!a.manual) {
|
|
2151
|
-
var S = document.readyState;
|
|
2152
|
-
S === "loading" || S === "interactive" && $ && $.defer ? document.addEventListener("DOMContentLoaded", w) : window.requestAnimationFrame ? window.requestAnimationFrame(w) : window.setTimeout(w, 16);
|
|
2153
|
-
}
|
|
2154
|
-
return a;
|
|
2155
|
-
}(n);
|
|
2156
|
-
u.exports && (u.exports = e), typeof ze < "u" && (ze.Prism = e), e.languages.markup = {
|
|
2157
|
-
comment: {
|
|
2158
|
-
pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
|
|
2159
|
-
greedy: !0
|
|
2160
|
-
},
|
|
2161
|
-
prolog: {
|
|
2162
|
-
pattern: /<\?[\s\S]+?\?>/,
|
|
2163
|
-
greedy: !0
|
|
2164
|
-
},
|
|
2165
|
-
doctype: {
|
|
2166
|
-
// https://www.w3.org/TR/xml/#NT-doctypedecl
|
|
2167
|
-
pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
|
|
2168
|
-
greedy: !0,
|
|
2169
|
-
inside: {
|
|
2170
|
-
"internal-subset": {
|
|
2171
|
-
pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
|
|
2172
|
-
lookbehind: !0,
|
|
2173
|
-
greedy: !0,
|
|
2174
|
-
inside: null
|
|
2175
|
-
// see below
|
|
2176
|
-
},
|
|
2177
|
-
string: {
|
|
2178
|
-
pattern: /"[^"]*"|'[^']*'/,
|
|
2179
|
-
greedy: !0
|
|
2180
|
-
},
|
|
2181
|
-
punctuation: /^<!|>$|[[\]]/,
|
|
2182
|
-
"doctype-tag": /^DOCTYPE/i,
|
|
2183
|
-
name: /[^\s<>'"]+/
|
|
2184
|
-
}
|
|
2185
|
-
},
|
|
2186
|
-
cdata: {
|
|
2187
|
-
pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
|
|
2188
|
-
greedy: !0
|
|
2189
|
-
},
|
|
2190
|
-
tag: {
|
|
2191
|
-
pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
|
|
2192
|
-
greedy: !0,
|
|
2193
|
-
inside: {
|
|
2194
|
-
tag: {
|
|
2195
|
-
pattern: /^<\/?[^\s>\/]+/,
|
|
2196
|
-
inside: {
|
|
2197
|
-
punctuation: /^<\/?/,
|
|
2198
|
-
namespace: /^[^\s>\/:]+:/
|
|
2199
|
-
}
|
|
2200
|
-
},
|
|
2201
|
-
"special-attr": [],
|
|
2202
|
-
"attr-value": {
|
|
2203
|
-
pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
|
|
2204
|
-
inside: {
|
|
2205
|
-
punctuation: [
|
|
2206
|
-
{
|
|
2207
|
-
pattern: /^=/,
|
|
2208
|
-
alias: "attr-equals"
|
|
2209
|
-
},
|
|
2210
|
-
{
|
|
2211
|
-
pattern: /^(\s*)["']|["']$/,
|
|
2212
|
-
lookbehind: !0
|
|
2213
|
-
}
|
|
2214
|
-
]
|
|
2215
|
-
}
|
|
2216
|
-
},
|
|
2217
|
-
punctuation: /\/?>/,
|
|
2218
|
-
"attr-name": {
|
|
2219
|
-
pattern: /[^\s>\/]+/,
|
|
2220
|
-
inside: {
|
|
2221
|
-
namespace: /^[^\s>\/:]+:/
|
|
2222
|
-
}
|
|
2223
|
-
}
|
|
2224
|
-
}
|
|
2225
|
-
},
|
|
2226
|
-
entity: [
|
|
2227
|
-
{
|
|
2228
|
-
pattern: /&[\da-z]{1,8};/i,
|
|
2229
|
-
alias: "named-entity"
|
|
2230
|
-
},
|
|
2231
|
-
/&#x?[\da-f]{1,8};/i
|
|
2232
|
-
]
|
|
2233
|
-
}, e.languages.markup.tag.inside["attr-value"].inside.entity = e.languages.markup.entity, e.languages.markup.doctype.inside["internal-subset"].inside = e.languages.markup, e.hooks.add("wrap", function(t) {
|
|
2234
|
-
t.type === "entity" && (t.attributes.title = t.content.replace(/&/, "&"));
|
|
2235
|
-
}), Object.defineProperty(e.languages.markup.tag, "addInlined", {
|
|
2236
|
-
/**
|
|
2237
|
-
* Adds an inlined language to markup.
|
|
2238
|
-
*
|
|
2239
|
-
* An example of an inlined language is CSS with `<style>` tags.
|
|
2240
|
-
*
|
|
2241
|
-
* @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
|
|
2242
|
-
* case insensitive.
|
|
2243
|
-
* @param {string} lang The language key.
|
|
2244
|
-
* @example
|
|
2245
|
-
* addInlined('style', 'css');
|
|
2246
|
-
*/
|
|
2247
|
-
value: function(s, i) {
|
|
2248
|
-
var r = {};
|
|
2249
|
-
r["language-" + i] = {
|
|
2250
|
-
pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
|
|
2251
|
-
lookbehind: !0,
|
|
2252
|
-
inside: e.languages[i]
|
|
2253
|
-
}, r.cdata = /^<!\[CDATA\[|\]\]>$/i;
|
|
2254
|
-
var a = {
|
|
2255
|
-
"included-cdata": {
|
|
2256
|
-
pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
|
|
2257
|
-
inside: r
|
|
2258
|
-
}
|
|
2259
|
-
};
|
|
2260
|
-
a["language-" + i] = {
|
|
2261
|
-
pattern: /[\s\S]+/,
|
|
2262
|
-
inside: e.languages[i]
|
|
2263
|
-
};
|
|
2264
|
-
var c = {};
|
|
2265
|
-
c[s] = {
|
|
2266
|
-
pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function() {
|
|
2267
|
-
return s;
|
|
2268
|
-
}), "i"),
|
|
2269
|
-
lookbehind: !0,
|
|
2270
|
-
greedy: !0,
|
|
2271
|
-
inside: a
|
|
2272
|
-
}, e.languages.insertBefore("markup", "cdata", c);
|
|
2273
|
-
}
|
|
2274
|
-
}), Object.defineProperty(e.languages.markup.tag, "addAttribute", {
|
|
2275
|
-
/**
|
|
2276
|
-
* Adds an pattern to highlight languages embedded in HTML attributes.
|
|
2277
|
-
*
|
|
2278
|
-
* An example of an inlined language is CSS with `style` attributes.
|
|
2279
|
-
*
|
|
2280
|
-
* @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
|
|
2281
|
-
* case insensitive.
|
|
2282
|
-
* @param {string} lang The language key.
|
|
2283
|
-
* @example
|
|
2284
|
-
* addAttribute('style', 'css');
|
|
2285
|
-
*/
|
|
2286
|
-
value: function(t, s) {
|
|
2287
|
-
e.languages.markup.tag.inside["special-attr"].push({
|
|
2288
|
-
pattern: RegExp(
|
|
2289
|
-
/(^|["'\s])/.source + "(?:" + t + ")" + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
|
|
2290
|
-
"i"
|
|
2291
|
-
),
|
|
2292
|
-
lookbehind: !0,
|
|
2293
|
-
inside: {
|
|
2294
|
-
"attr-name": /^[^\s=]+/,
|
|
2295
|
-
"attr-value": {
|
|
2296
|
-
pattern: /=[\s\S]+/,
|
|
2297
|
-
inside: {
|
|
2298
|
-
value: {
|
|
2299
|
-
pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
|
|
2300
|
-
lookbehind: !0,
|
|
2301
|
-
alias: [s, "language-" + s],
|
|
2302
|
-
inside: e.languages[s]
|
|
2303
|
-
},
|
|
2304
|
-
punctuation: [
|
|
2305
|
-
{
|
|
2306
|
-
pattern: /^=/,
|
|
2307
|
-
alias: "attr-equals"
|
|
2308
|
-
},
|
|
2309
|
-
/"|'/
|
|
2310
|
-
]
|
|
2311
|
-
}
|
|
2312
|
-
}
|
|
2313
|
-
}
|
|
2314
|
-
});
|
|
2315
|
-
}
|
|
2316
|
-
}), e.languages.html = e.languages.markup, e.languages.mathml = e.languages.markup, e.languages.svg = e.languages.markup, e.languages.xml = e.languages.extend("markup", {}), e.languages.ssml = e.languages.xml, e.languages.atom = e.languages.xml, e.languages.rss = e.languages.xml, function(t) {
|
|
2317
|
-
var s = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
|
|
2318
|
-
t.languages.css = {
|
|
2319
|
-
comment: /\/\*[\s\S]*?\*\//,
|
|
2320
|
-
atrule: {
|
|
2321
|
-
pattern: RegExp("@[\\w-](?:" + /[^;{\s"']|\s+(?!\s)/.source + "|" + s.source + ")*?" + /(?:;|(?=\s*\{))/.source),
|
|
2322
|
-
inside: {
|
|
2323
|
-
rule: /^@[\w-]+/,
|
|
2324
|
-
"selector-function-argument": {
|
|
2325
|
-
pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
|
|
2326
|
-
lookbehind: !0,
|
|
2327
|
-
alias: "selector"
|
|
2328
|
-
},
|
|
2329
|
-
keyword: {
|
|
2330
|
-
pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
|
|
2331
|
-
lookbehind: !0
|
|
2332
|
-
}
|
|
2333
|
-
// See rest below
|
|
2334
|
-
}
|
|
2335
|
-
},
|
|
2336
|
-
url: {
|
|
2337
|
-
// https://drafts.csswg.org/css-values-3/#urls
|
|
2338
|
-
pattern: RegExp("\\burl\\((?:" + s.source + "|" + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ")\\)", "i"),
|
|
2339
|
-
greedy: !0,
|
|
2340
|
-
inside: {
|
|
2341
|
-
function: /^url/i,
|
|
2342
|
-
punctuation: /^\(|\)$/,
|
|
2343
|
-
string: {
|
|
2344
|
-
pattern: RegExp("^" + s.source + "$"),
|
|
2345
|
-
alias: "url"
|
|
2346
|
-
}
|
|
2347
|
-
}
|
|
2348
|
-
},
|
|
2349
|
-
selector: {
|
|
2350
|
-
pattern: RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|` + s.source + ")*(?=\\s*\\{)"),
|
|
2351
|
-
lookbehind: !0
|
|
2352
|
-
},
|
|
2353
|
-
string: {
|
|
2354
|
-
pattern: s,
|
|
2355
|
-
greedy: !0
|
|
2356
|
-
},
|
|
2357
|
-
property: {
|
|
2358
|
-
pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
|
|
2359
|
-
lookbehind: !0
|
|
2360
|
-
},
|
|
2361
|
-
important: /!important\b/i,
|
|
2362
|
-
function: {
|
|
2363
|
-
pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
|
|
2364
|
-
lookbehind: !0
|
|
2365
|
-
},
|
|
2366
|
-
punctuation: /[(){};:,]/
|
|
2367
|
-
}, t.languages.css.atrule.inside.rest = t.languages.css;
|
|
2368
|
-
var i = t.languages.markup;
|
|
2369
|
-
i && (i.tag.addInlined("style", "css"), i.tag.addAttribute("style", "css"));
|
|
2370
|
-
}(e), e.languages.clike = {
|
|
2371
|
-
comment: [
|
|
2372
|
-
{
|
|
2373
|
-
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
|
|
2374
|
-
lookbehind: !0,
|
|
2375
|
-
greedy: !0
|
|
2376
|
-
},
|
|
2377
|
-
{
|
|
2378
|
-
pattern: /(^|[^\\:])\/\/.*/,
|
|
2379
|
-
lookbehind: !0,
|
|
2380
|
-
greedy: !0
|
|
2381
|
-
}
|
|
2382
|
-
],
|
|
2383
|
-
string: {
|
|
2384
|
-
pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
|
|
2385
|
-
greedy: !0
|
|
2386
|
-
},
|
|
2387
|
-
"class-name": {
|
|
2388
|
-
pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
|
|
2389
|
-
lookbehind: !0,
|
|
2390
|
-
inside: {
|
|
2391
|
-
punctuation: /[.\\]/
|
|
2392
|
-
}
|
|
2393
|
-
},
|
|
2394
|
-
keyword: /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
|
|
2395
|
-
boolean: /\b(?:false|true)\b/,
|
|
2396
|
-
function: /\b\w+(?=\()/,
|
|
2397
|
-
number: /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
|
|
2398
|
-
operator: /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
|
|
2399
|
-
punctuation: /[{}[\];(),.:]/
|
|
2400
|
-
}, e.languages.javascript = e.languages.extend("clike", {
|
|
2401
|
-
"class-name": [
|
|
2402
|
-
e.languages.clike["class-name"],
|
|
2403
|
-
{
|
|
2404
|
-
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
|
|
2405
|
-
lookbehind: !0
|
|
2406
|
-
}
|
|
2407
|
-
],
|
|
2408
|
-
keyword: [
|
|
2409
|
-
{
|
|
2410
|
-
pattern: /((?:^|\})\s*)catch\b/,
|
|
2411
|
-
lookbehind: !0
|
|
2412
|
-
},
|
|
2413
|
-
{
|
|
2414
|
-
pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
|
|
2415
|
-
lookbehind: !0
|
|
2416
|
-
}
|
|
2417
|
-
],
|
|
2418
|
-
// Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
|
|
2419
|
-
function: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
|
|
2420
|
-
number: {
|
|
2421
|
-
pattern: RegExp(
|
|
2422
|
-
/(^|[^\w$])/.source + "(?:" + // constant
|
|
2423
|
-
(/NaN|Infinity/.source + "|" + // binary integer
|
|
2424
|
-
/0[bB][01]+(?:_[01]+)*n?/.source + "|" + // octal integer
|
|
2425
|
-
/0[oO][0-7]+(?:_[0-7]+)*n?/.source + "|" + // hexadecimal integer
|
|
2426
|
-
/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source + "|" + // decimal bigint
|
|
2427
|
-
/\d+(?:_\d+)*n/.source + "|" + // decimal number (integer or float) but no bigint
|
|
2428
|
-
/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source) + ")" + /(?![\w$])/.source
|
|
2429
|
-
),
|
|
2430
|
-
lookbehind: !0
|
|
2431
|
-
},
|
|
2432
|
-
operator: /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
|
|
2433
|
-
}), e.languages.javascript["class-name"][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/, e.languages.insertBefore("javascript", "keyword", {
|
|
2434
|
-
regex: {
|
|
2435
|
-
pattern: RegExp(
|
|
2436
|
-
// lookbehind
|
|
2437
|
-
// eslint-disable-next-line regexp/no-dupe-characters-character-class
|
|
2438
|
-
/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source + // Regex pattern:
|
|
2439
|
-
// There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
|
|
2440
|
-
// classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
|
|
2441
|
-
// with the only syntax, so we have to define 2 different regex patterns.
|
|
2442
|
-
/\//.source + "(?:" + /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source + "|" + // `v` flag syntax. This supports 3 levels of nested character classes.
|
|
2443
|
-
/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source + ")" + // lookahead
|
|
2444
|
-
/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
|
|
2445
|
-
),
|
|
2446
|
-
lookbehind: !0,
|
|
2447
|
-
greedy: !0,
|
|
2448
|
-
inside: {
|
|
2449
|
-
"regex-source": {
|
|
2450
|
-
pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
|
|
2451
|
-
lookbehind: !0,
|
|
2452
|
-
alias: "language-regex",
|
|
2453
|
-
inside: e.languages.regex
|
|
2454
|
-
},
|
|
2455
|
-
"regex-delimiter": /^\/|\/$/,
|
|
2456
|
-
"regex-flags": /^[a-z]+$/
|
|
2457
|
-
}
|
|
2458
|
-
},
|
|
2459
|
-
// This must be declared before keyword because we use "function" inside the look-forward
|
|
2460
|
-
"function-variable": {
|
|
2461
|
-
pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
|
|
2462
|
-
alias: "function"
|
|
2463
|
-
},
|
|
2464
|
-
parameter: [
|
|
2465
|
-
{
|
|
2466
|
-
pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
|
|
2467
|
-
lookbehind: !0,
|
|
2468
|
-
inside: e.languages.javascript
|
|
2469
|
-
},
|
|
2470
|
-
{
|
|
2471
|
-
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
|
|
2472
|
-
lookbehind: !0,
|
|
2473
|
-
inside: e.languages.javascript
|
|
2474
|
-
},
|
|
2475
|
-
{
|
|
2476
|
-
pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
|
|
2477
|
-
lookbehind: !0,
|
|
2478
|
-
inside: e.languages.javascript
|
|
2479
|
-
},
|
|
2480
|
-
{
|
|
2481
|
-
pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
|
|
2482
|
-
lookbehind: !0,
|
|
2483
|
-
inside: e.languages.javascript
|
|
2484
|
-
}
|
|
2485
|
-
],
|
|
2486
|
-
constant: /\b[A-Z](?:[A-Z_]|\dx?)*\b/
|
|
2487
|
-
}), e.languages.insertBefore("javascript", "string", {
|
|
2488
|
-
hashbang: {
|
|
2489
|
-
pattern: /^#!.*/,
|
|
2490
|
-
greedy: !0,
|
|
2491
|
-
alias: "comment"
|
|
2492
|
-
},
|
|
2493
|
-
"template-string": {
|
|
2494
|
-
pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
|
|
2495
|
-
greedy: !0,
|
|
2496
|
-
inside: {
|
|
2497
|
-
"template-punctuation": {
|
|
2498
|
-
pattern: /^`|`$/,
|
|
2499
|
-
alias: "string"
|
|
2500
|
-
},
|
|
2501
|
-
interpolation: {
|
|
2502
|
-
pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
|
|
2503
|
-
lookbehind: !0,
|
|
2504
|
-
inside: {
|
|
2505
|
-
"interpolation-punctuation": {
|
|
2506
|
-
pattern: /^\$\{|\}$/,
|
|
2507
|
-
alias: "punctuation"
|
|
2508
|
-
},
|
|
2509
|
-
rest: e.languages.javascript
|
|
2510
|
-
}
|
|
2511
|
-
},
|
|
2512
|
-
string: /[\s\S]+/
|
|
2513
|
-
}
|
|
2514
|
-
},
|
|
2515
|
-
"string-property": {
|
|
2516
|
-
pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
|
|
2517
|
-
lookbehind: !0,
|
|
2518
|
-
greedy: !0,
|
|
2519
|
-
alias: "property"
|
|
2520
|
-
}
|
|
2521
|
-
}), e.languages.insertBefore("javascript", "operator", {
|
|
2522
|
-
"literal-property": {
|
|
2523
|
-
pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
|
|
2524
|
-
lookbehind: !0,
|
|
2525
|
-
alias: "property"
|
|
2526
|
-
}
|
|
2527
|
-
}), e.languages.markup && (e.languages.markup.tag.addInlined("script", "javascript"), e.languages.markup.tag.addAttribute(
|
|
2528
|
-
/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,
|
|
2529
|
-
"javascript"
|
|
2530
|
-
)), e.languages.js = e.languages.javascript, function() {
|
|
2531
|
-
if (typeof e > "u" || typeof document > "u")
|
|
2532
|
-
return;
|
|
2533
|
-
Element.prototype.matches || (Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector);
|
|
2534
|
-
var t = "Loading…", s = function($, w) {
|
|
2535
|
-
return "✖ Error " + $ + " while fetching file: " + w;
|
|
2536
|
-
}, i = "✖ Error: File does not exist or is empty", r = {
|
|
2537
|
-
js: "javascript",
|
|
2538
|
-
py: "python",
|
|
2539
|
-
rb: "ruby",
|
|
2540
|
-
ps1: "powershell",
|
|
2541
|
-
psm1: "powershell",
|
|
2542
|
-
sh: "bash",
|
|
2543
|
-
bat: "batch",
|
|
2544
|
-
h: "c",
|
|
2545
|
-
tex: "latex"
|
|
2546
|
-
}, a = "data-src-status", c = "loading", x = "loaded", f = "failed", b = "pre[data-src]:not([" + a + '="' + x + '"]):not([' + a + '="' + c + '"])';
|
|
2547
|
-
function d($, w, S) {
|
|
2548
|
-
var o = new XMLHttpRequest();
|
|
2549
|
-
o.open("GET", $, !0), o.onreadystatechange = function() {
|
|
2550
|
-
o.readyState == 4 && (o.status < 400 && o.responseText ? w(o.responseText) : o.status >= 400 ? S(s(o.status, o.statusText)) : S(i));
|
|
2551
|
-
}, o.send(null);
|
|
2552
|
-
}
|
|
2553
|
-
function v($) {
|
|
2554
|
-
var w = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec($ || "");
|
|
2555
|
-
if (w) {
|
|
2556
|
-
var S = Number(w[1]), o = w[2], l = w[3];
|
|
2557
|
-
return o ? l ? [S, Number(l)] : [S, void 0] : [S, S];
|
|
2558
|
-
}
|
|
2559
|
-
}
|
|
2560
|
-
e.hooks.add("before-highlightall", function($) {
|
|
2561
|
-
$.selector += ", " + b;
|
|
2562
|
-
}), e.hooks.add("before-sanity-check", function($) {
|
|
2563
|
-
var w = (
|
|
2564
|
-
/** @type {HTMLPreElement} */
|
|
2565
|
-
$.element
|
|
2566
|
-
);
|
|
2567
|
-
if (w.matches(b)) {
|
|
2568
|
-
$.code = "", w.setAttribute(a, c);
|
|
2569
|
-
var S = w.appendChild(document.createElement("CODE"));
|
|
2570
|
-
S.textContent = t;
|
|
2571
|
-
var o = w.getAttribute("data-src"), l = $.language;
|
|
2572
|
-
if (l === "none") {
|
|
2573
|
-
var p = (/\.(\w+)$/.exec(o) || [, "none"])[1];
|
|
2574
|
-
l = r[p] || p;
|
|
2575
|
-
}
|
|
2576
|
-
e.util.setLanguage(S, l), e.util.setLanguage(w, l);
|
|
2577
|
-
var h = e.plugins.autoloader;
|
|
2578
|
-
h && h.loadLanguages(l), d(
|
|
2579
|
-
o,
|
|
2580
|
-
function(g) {
|
|
2581
|
-
w.setAttribute(a, x);
|
|
2582
|
-
var m = v(w.getAttribute("data-range"));
|
|
2583
|
-
if (m) {
|
|
2584
|
-
var y = g.split(/\r\n?|\n/g), k = m[0], F = m[1] == null ? y.length : m[1];
|
|
2585
|
-
k < 0 && (k += y.length), k = Math.max(0, Math.min(k - 1, y.length)), F < 0 && (F += y.length), F = Math.max(0, Math.min(F, y.length)), g = y.slice(k, F).join(`
|
|
2586
|
-
`), w.hasAttribute("data-start") || w.setAttribute("data-start", String(k + 1));
|
|
2587
|
-
}
|
|
2588
|
-
S.textContent = g, e.highlightElement(S);
|
|
2589
|
-
},
|
|
2590
|
-
function(g) {
|
|
2591
|
-
w.setAttribute(a, f), S.textContent = g;
|
|
2592
|
-
}
|
|
2593
|
-
);
|
|
2594
|
-
}
|
|
2595
|
-
}), e.plugins.fileHighlight = {
|
|
2596
|
-
/**
|
|
2597
|
-
* Executes the File Highlight plugin for all matching `pre` elements under the given container.
|
|
2598
|
-
*
|
|
2599
|
-
* Note: Elements which are already loaded or currently loading will not be touched by this method.
|
|
2600
|
-
*
|
|
2601
|
-
* @param {ParentNode} [container=document]
|
|
2602
|
-
*/
|
|
2603
|
-
highlight: function(w) {
|
|
2604
|
-
for (var S = (w || document).querySelectorAll(b), o = 0, l; l = S[o++]; )
|
|
2605
|
-
e.highlightElement(l);
|
|
2606
|
-
}
|
|
2607
|
-
};
|
|
2608
|
-
var E = !1;
|
|
2609
|
-
e.fileHighlight = function() {
|
|
2610
|
-
E || (console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."), E = !0), e.plugins.fileHighlight.highlight.apply(this, arguments);
|
|
2611
|
-
};
|
|
2612
|
-
}();
|
|
2613
|
-
}(pe)), pe.exports;
|
|
2614
|
-
}
|
|
2615
|
-
var he = jt();
|
|
2616
|
-
const Ht = {
|
|
2617
|
-
code(u, n) {
|
|
2618
|
-
const e = (n || "").match(/\S*/)?.[0]?.toLowerCase(), t = ["ts", "typescript", "js", "javascript"].includes(
|
|
2619
|
-
e ?? ""
|
|
2620
|
-
) ? "javascript" : e;
|
|
2621
|
-
if (!t || !he.languages[t])
|
|
2622
|
-
return `<pre class="language-"><code>${u.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'")}</code></pre>`;
|
|
2623
|
-
const s = he.highlight(u, he.languages[t], t);
|
|
2624
|
-
return `<pre class="language-${t}"><code>${s}</code></pre>`;
|
|
2625
|
-
}
|
|
2626
|
-
};
|
|
2627
|
-
function Xe() {
|
|
2628
|
-
const u = new Ne();
|
|
2629
|
-
return u.use({ renderer: Ht }), u;
|
|
2630
|
-
}
|
|
2631
|
-
var Ut = Object.defineProperty, Qt = Object.getOwnPropertyDescriptor, Ye = (u) => {
|
|
2632
|
-
throw TypeError(u);
|
|
2633
|
-
}, q = (u, n, e, t) => {
|
|
2634
|
-
for (var s = t > 1 ? void 0 : t ? Qt(n, e) : n, i = u.length - 1, r; i >= 0; i--)
|
|
2635
|
-
(r = u[i]) && (s = (t ? r(n, e, s) : r(s)) || s);
|
|
2636
|
-
return t && s && Ut(n, e, s), s;
|
|
2637
|
-
}, Ae = (u, n, e) => n.has(u) || Ye("Cannot " + e), de = (u, n, e) => (Ae(u, n, "read from private field"), e ? e.call(u) : n.get(u)), Me = (u, n, e) => n.has(u) ? Ye("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(u) : n.set(u, e), Wt = (u, n, e, t) => (Ae(u, n, "write to private field"), n.set(u, e), e), qe = (u, n, e) => (Ae(u, n, "access private method"), e), H, re, ke;
|
|
2638
|
-
let M = class extends at {
|
|
2639
|
-
constructor() {
|
|
2640
|
-
super(...arguments), Me(this, re), Me(this, H, Xe()), this.classname = "", this.liveScript = !1, this.renderer = {}, this.extensions = [];
|
|
2641
|
-
}
|
|
2642
|
-
connectedCallback() {
|
|
2643
|
-
super.connectedCallback(), qe(this, re, ke).call(this);
|
|
2644
|
-
}
|
|
2645
|
-
updateRendered() {
|
|
2646
|
-
this.rendered = de(this, H).parse(this.markdown);
|
|
2647
|
-
}
|
|
2648
|
-
handleRenderedWithNewMarkdown() {
|
|
2649
|
-
qe(this, re, ke).call(this), this.markdown && (this.rendered = de(this, H).parse(this.markdown));
|
|
2650
|
-
}
|
|
2651
|
-
render() {
|
|
2652
|
-
return rt`<div class=${this.classname}>${it(this.rendered)}</div>`;
|
|
2653
|
-
}
|
|
2654
|
-
updated() {
|
|
2655
|
-
this.liveScript && Gt(this), this.emit("cx-ready");
|
|
2656
|
-
}
|
|
2657
|
-
};
|
|
2658
|
-
H = /* @__PURE__ */ new WeakMap();
|
|
2659
|
-
re = /* @__PURE__ */ new WeakSet();
|
|
2660
|
-
ke = function() {
|
|
2661
|
-
Wt(this, H, Xe()), de(this, H).use({
|
|
2662
|
-
extensions: this.extensions,
|
|
2663
|
-
renderer: this.renderer
|
|
2664
|
-
});
|
|
2665
|
-
};
|
|
2666
|
-
q([
|
|
2667
|
-
G({ type: String })
|
|
2668
|
-
], M.prototype, "classname", 2);
|
|
2669
|
-
q([
|
|
2670
|
-
G({ attribute: "live-script", reflect: !0, type: Boolean })
|
|
2671
|
-
], M.prototype, "liveScript", 2);
|
|
2672
|
-
q([
|
|
2673
|
-
G({ type: String })
|
|
2674
|
-
], M.prototype, "markdown", 2);
|
|
2675
|
-
q([
|
|
2676
|
-
G({ type: Object })
|
|
2677
|
-
], M.prototype, "renderer", 2);
|
|
2678
|
-
q([
|
|
2679
|
-
G({ type: Object })
|
|
2680
|
-
], M.prototype, "extensions", 2);
|
|
2681
|
-
q([
|
|
2682
|
-
st()
|
|
2683
|
-
], M.prototype, "rendered", 2);
|
|
2684
|
-
q([
|
|
2685
|
-
ge("markdown")
|
|
2686
|
-
], M.prototype, "updateRendered", 1);
|
|
2687
|
-
q([
|
|
2688
|
-
ge("renderer", { waitUntilFirstUpdate: !0 }),
|
|
2689
|
-
ge("extensions", { waitUntilFirstUpdate: !0 })
|
|
2690
|
-
], M.prototype, "handleRenderedWithNewMarkdown", 1);
|
|
2691
|
-
M = q([
|
|
2692
|
-
nt("cx-markdown")
|
|
2693
|
-
], M);
|
|
2694
|
-
function Gt(u) {
|
|
2695
|
-
u.querySelectorAll("script").forEach((e) => {
|
|
2696
|
-
const t = document.createElement("script");
|
|
2697
|
-
e.src ? t.src = e.src : t.text = `(function() {
|
|
2698
|
-
${e.text}
|
|
2699
|
-
})();`, Array.from(e.attributes).forEach((s) => {
|
|
2700
|
-
s.name !== "src" && t.setAttribute(s.name, s.value);
|
|
2701
|
-
}), document.body.appendChild(t);
|
|
2702
|
-
});
|
|
2703
|
-
}
|
|
1
|
+
import "../chunks/icon-button.BwmMJ0bI.js";
|
|
2
|
+
import { C as s } from "../chunks/markdown.I1AJG75v.js";
|
|
3
|
+
import "../chunks/custom-element.L4WJXn1j.js";
|
|
4
|
+
import "../chunks/i18n.Bchq8v1d.js";
|
|
5
|
+
import "../chunks/watch.DJF5K-8U.js";
|
|
6
|
+
import "../chunks/string.BhJ0Zogu.js";
|
|
7
|
+
import "../chunks/lit-element.jLBm65_O.js";
|
|
8
|
+
import "../chunks/lib-cortex-element.CVMmyPMC.js";
|
|
9
|
+
import "../chunks/state.CSDxrqLd.js";
|
|
10
|
+
import "../chunks/unsafe-html.Dff7-rCx.js";
|
|
2704
11
|
export {
|
|
2705
|
-
|
|
12
|
+
s as default
|
|
2706
13
|
};
|