react-reason-editor 1.0.24 → 1.0.26
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/README.md +24 -0
- package/dist/{Attachment-DGzsbPZZ.js → Attachment-FN0H4pdR.js} +2 -2
- package/dist/Attachment.js +1 -1
- package/dist/BulletList.cjs +1 -1
- package/dist/{Callout-heY7R-Zu.js → Callout-C6kKHIbW.js} +2 -2
- package/dist/Callout.js +1 -1
- package/dist/{CodeBlock-B7Wklup8.js → CodeBlock-DLhI2Guf.js} +1 -1
- package/dist/{CodeBlock-D2OKvGCF.cjs → CodeBlock-zh4cX5EA.cjs} +1 -1
- package/dist/CodeBlock.cjs +1 -1
- package/dist/CodeBlock.js +1 -1
- package/dist/CodeView.cjs +1 -1
- package/dist/CodeView.js +1 -1
- package/dist/{Color-BxzxtvJH.cjs → Color-D5zLljFV.cjs} +1 -1
- package/dist/Color.cjs +1 -1
- package/dist/{Drawer-DxCO6TBr.cjs → Drawer-B0QvuSOf.cjs} +1 -1
- package/dist/{Drawer-Dunw22Q1.js → Drawer-bqo2XUCW.js} +12 -12
- package/dist/Drawer.cjs +1 -1
- package/dist/Drawer.js +1 -1
- package/dist/{Drawio-eqEGDkwW.js → Drawio-CIXM-WGy.js} +4 -4
- package/dist/Drawio.js +1 -1
- package/dist/{Emoji-BU-itkPp.js → Emoji-CTvSFbHz.js} +3 -3
- package/dist/Emoji.js +1 -1
- package/dist/FontFamily.js +2 -2
- package/dist/{Highlight-BeqLxfbY.cjs → Highlight-DQxtCrNN.cjs} +1 -1
- package/dist/Highlight.cjs +1 -1
- package/dist/{History-C6yBYB2w.js → History-PbMa-usl.js} +1 -1
- package/dist/History.js +1 -1
- package/dist/Image.js +1 -1
- package/dist/{ImageCropper-Dlz4nJQu.js → ImageCropper-CN_GzBBG.js} +5 -5
- package/dist/{ImageGif-D5Qw_Xf-.js → ImageGif-D9goI48J.js} +3 -3
- package/dist/ImageGif.js +1 -1
- package/dist/{ImportWord-BCcs3dYp.js → ImportWord-Bux3L57d.js} +1 -1
- package/dist/ImportWord.js +1 -1
- package/dist/{Indent-DpTPoZMk.js → Indent-fBwkYx_q.js} +1 -1
- package/dist/Indent.js +1 -1
- package/dist/{Katex-D_vF5gsD.cjs → Katex-B1xls7hE.cjs} +1 -1
- package/dist/{Katex-Bo_vfXrd.js → Katex-D2g86C-B.js} +3 -3
- package/dist/Katex.cjs +1 -1
- package/dist/Katex.js +1 -1
- package/dist/LineHeight.js +1 -1
- package/dist/{Link-C0cNnjXo.js → Link-Dpaom2jX.js} +1 -1
- package/dist/Link.js +1 -1
- package/dist/{Mention-DEkbeL04.js → Mention-D0HVk1SC.js} +1 -1
- package/dist/Mention.js +1 -1
- package/dist/{Mermaid-BB15qd24.cjs → Mermaid-3vSlkOlc.cjs} +1 -1
- package/dist/Mermaid-B3KGZMBo.js +5 -0
- package/dist/Mermaid.cjs +1 -1
- package/dist/Mermaid.js +1 -1
- package/dist/MoreMark.js +1 -1
- package/dist/OrderedList.cjs +1 -1
- package/dist/SearchAndReplace.cjs +1 -1
- package/dist/SearchAndReplace.js +1 -1
- package/dist/{SlashCommand-8LkH8bHy.js → SlashCommand-ZFZhrxKb.js} +1 -1
- package/dist/SlashCommand.js +1 -1
- package/dist/{Table-C9t-k9Qu.js → Table-6kM52sUH.js} +2 -2
- package/dist/Table.js +1 -1
- package/dist/TaskList.cjs +1 -1
- package/dist/{TextAlign-C75gn_OM.js → TextAlign-BKo82ocx.js} +1 -1
- package/dist/TextAlign.js +1 -1
- package/dist/TextDirection.js +1 -1
- package/dist/{Twitter-DyrQT0n4.cjs → Twitter-3yCP2UdP.cjs} +1 -1
- package/dist/{Twitter-D5UNfT-K.js → Twitter-D38giVew.js} +2 -2
- package/dist/Twitter.cjs +1 -1
- package/dist/Twitter.js +1 -1
- package/dist/{Video-_YlAC2R_.js → Video-DcfPDZLP.js} +3 -3
- package/dist/Video.js +1 -1
- package/dist/WordCount.js +1 -1
- package/dist/{bubble---c27x7L.js → bubble-4RecyKlX.js} +1 -1
- package/dist/bubble.cjs +1 -1
- package/dist/bubble.js +1 -1
- package/dist/editor-kit.cjs +1 -0
- package/dist/editor-kit.d.ts +13 -0
- package/dist/editor-kit.js +1 -0
- package/dist/editor-views/components/AlignToolbar.d.ts +4 -0
- package/dist/editor-views/components/BubbleMenus.d.ts +4 -0
- package/dist/editor-views/components/EditorContainer.d.ts +10 -0
- package/dist/editor-views/components/Header.d.ts +8 -0
- package/dist/editor-views/components/Toolbar.d.ts +26 -0
- package/dist/editor-views/components/constants.d.ts +14 -0
- package/dist/editor-views/components/extensions.d.ts +8 -0
- package/dist/editor-views/components/index.d.ts +9 -0
- package/dist/editor-views/config/baseKit.d.ts +7 -0
- package/dist/editor-views/config/editorConfig.d.ts +37 -0
- package/dist/editor-views/config/pluginRegistry.d.ts +43 -0
- package/dist/editorConfig-Cgs4P8O5.js +184 -0
- package/dist/editorConfig-CnzPmOCy.cjs +1 -0
- package/dist/html-to-docx.esm-DkztZsL5-BqrjWkoQ.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/reason-docs.cjs +1 -1
- package/dist/reason-docs.js +1 -1
- package/dist/{separator-BHN46aj5.cjs → separator-CXjMk9dM.cjs} +1 -1
- package/dist/src-73l1pSjp.js +463 -0
- package/dist/src-CF0U82SA.cjs +1 -0
- package/package.json +12 -2
- package/dist/Mermaid-DxpFRVu0.js +0 -5
- package/dist/html-to-docx.esm-DkztZsL5-DQYdhD3B.cjs +0 -1
- package/dist/src-C7k3RYxJ.js +0 -646
- package/dist/src-DYbBlAjR.cjs +0 -1
package/README.md
CHANGED
|
@@ -75,6 +75,30 @@ export function FullEditor() {
|
|
|
75
75
|
}
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
+
> The example above imports straight from `src/editor-views/*`, which only
|
|
79
|
+
> resolves inside this repo (that tree isn't part of the package's built
|
|
80
|
+
> `dist/` output). Consumers outside this monorepo — e.g.
|
|
81
|
+
> `apps/qwk-vscode-ext`'s custom editors — should import the same pieces
|
|
82
|
+
> (`RichTextToolbar`, `BubbleMenus`, `buildExtensions`, `createDefaultConfig`,
|
|
83
|
+
> `debounce`, `RichTextProvider`) from the dedicated, published
|
|
84
|
+
> `react-reason-editor/editor-kit` subpath instead:
|
|
85
|
+
>
|
|
86
|
+
> ```tsx
|
|
87
|
+
> import { useEditor, EditorContent } from '@tiptap/react'
|
|
88
|
+
> import {
|
|
89
|
+
> RichTextProvider,
|
|
90
|
+
> RichTextToolbar,
|
|
91
|
+
> BubbleMenus,
|
|
92
|
+
> buildExtensions,
|
|
93
|
+
> createDefaultConfig,
|
|
94
|
+
> } from 'react-reason-editor/editor-kit'
|
|
95
|
+
>
|
|
96
|
+
> const editor = useEditor({
|
|
97
|
+
> content: '<p>Start typing here…</p>',
|
|
98
|
+
> extensions: buildExtensions(createDefaultConfig()),
|
|
99
|
+
> })
|
|
100
|
+
> ```
|
|
101
|
+
|
|
78
102
|
### 3. Small toolbar — basics
|
|
79
103
|
|
|
80
104
|
A compact, hand-picked toolbar. Import only the `RichText*` control components you want and lay them out yourself; pair them with the bubble menus for selection formatting.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,r as t}from"./dist-CsCFCV4K.js";import{n as r}from"./toggle-BXl_NYYh.js";import{n as i}from"./locales-DfkG6-1b.js";import{c as a,l as n,t as o}from"./useButtonProps-DSIajp_B.js";import{a as l,i as s,n as c,r as d}from"./file-aBzFF1LO.js";import{t as h}from"./dom-dataset-D3Nz0h73.js";import{NodeViewWrapper as p,ReactNodeViewRenderer as u}from"@tiptap/react";import{useCallback as m,useEffect as v,useRef as f,useState as g}from"react";import w from"clsx";import{Fragment as x,jsx as y,jsxs as k}from"react/jsx-runtime";import{LucideAudioLines as M,LucideFile as H,LucideImage as T,LucideSheet as C,LucideTableProperties as L,LucideVideo as b}from"lucide-react";import{Node as j,mergeAttributes as A}from"@tiptap/core";var N={audio:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-audio-lines"><path d="M2 10v3"/><path d="M6 6v11"/><path d="M10 3v18"/><path d="M14 8v7"/><path d="M18 5v13"/><path d="M22 10v3"/></svg>',video:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-video"><path d="m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"/><rect x="2" y="6" width="14" height="12" rx="2"/></svg>',file:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/></svg>',image:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>',pdf:'<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 32 32">\n <path fill="currentColor" d="M30 18v-2h-6v10h2v-4h3v-2h-3v-2zm-11 8h-4V16h4a3.003 3.003 0 0 1 3 3v4a3.003 3.003 0 0 1-3 3m-2-2h2a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-2zm-6-8H6v10h2v-3h3a2.003 2.003 0 0 0 2-2v-3a2 2 0 0 0-2-2m-3 5v-3h3l.001 3z"></path>\n <path fill="currentColor" d="M22 14v-4a.91.91 0 0 0-.3-.7l-7-7A.9.9 0 0 0 14 2H4a2.006 2.006 0 0 0-2 2v24a2 2 0 0 0 2 2h16v-2H4V4h8v6a2.006 2.006 0 0 0 2 2h6v2Zm-8-4V4.4l5.6 5.6Z"></path>\n </svg>',word:'<svg\n xmlns="http://www.w3.org/2000/svg"\n width="1em"\n height="1em"\n className="icon"\n viewBox="0 0 1024 1024"\n >\n <path\n fill="currentColor"\n d="M679.253 402.364 618.77 561.015l-60.348-158.651a30.04 30.04 0 0 0-30.447-18.637 29.76 29.76 0 0 0-30.447 18.637l-60.416 158.651-60.416-158.651a30.515 30.515 0 0 0-38.843-17.272 28.945 28.945 0 0 0-17.954 37.547l88.815 233.267c4.369 11.469 15.7 19.115 28.398 19.115a30.31 30.31 0 0 0 28.468-19.115l62.395-163.908 62.396 163.84c4.437 11.605 15.701 19.183 28.4 19.183a30.31 30.31 0 0 0 28.466-19.115l88.747-233.267a28.945 28.945 0 0 0-17.886-37.547 30.447 30.447 0 0 0-38.912 17.272zm219.478 395.605-51.883-29.218c-28.672-16.18-52.224-3.072-52.224 29.082v.273H643.209a29.833 29.833 0 0 0-30.31 29.354c0 16.18 13.584 29.218 30.31 29.218h151.825c1.092 30.516 24.03 43.077 52.224 27.648l51.063-27.989c29.013-15.906 29.15-42.189.41-58.368"\n />\n <path\n fill="currentColor"\n d="m810.667 913.135-.478.068H201.796c-19.865 0-36.727-11.673-36.727-25.6v-618.36h154.965c51.268 0 92.911-39.39 92.911-87.858v-87.86H810.19c19.797 0 36.522 11.742 36.522 25.669V739.26h61.987V119.262c0-46.421-44.169-84.241-98.51-84.241H328.364l-225.28 194.56v658.09c0 46.285 44.236 84.105 98.713 84.105H810.19c43.759 0 80.554-24.713 93.32-58.573h-92.842zM350.89 94.89v86.562c0 16.11-13.858 29.286-30.925 29.286H216.815L350.959 94.891z"\n />\n </svg>',excel:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-sheet"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><line x1="3" x2="21" y1="9" y2="9"/><line x1="3" x2="21" y1="15" y2="15"/><line x1="9" x2="9" y1="9" y2="21"/><line x1="15" x2="15" y1="9" y2="21"/></svg>',ppt:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-table-properties"><path d="M15 3v18"/><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M21 9H3"/><path d="M21 15H3"/></svg>'};var z={audio:/* @__PURE__ */y(M,{}),video:/* @__PURE__ */y(b,{}),file:/* @__PURE__ */y(H,{}),image:/* @__PURE__ */y(T,{}),pdf:/* @__PURE__ */y(e,{}),word:/* @__PURE__ */y(t,{}),excel:/* @__PURE__ */y(C,{}),ppt:/* @__PURE__ */y(L,{})};function _(e,t=!1){const r=l(e),i=z[r]||/* @__PURE__ */y(x,{});return t?function(e){const t=N[e],r=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement,i=["svg",Array.from(r.attributes).reduce((e,t)=>(e[t.name]=t.value,e),{})];return Array.from(r.childNodes).forEach(e=>{if(1===e.nodeType){const t=[e.tagName.toLowerCase(),Array.from(e.attributes).reduce((e,t)=>(e[t.name]=t.value,e),{})];e.textContent&&t.push(e.textContent),i.push(t)}}),i}(r):i}var B="_wrap_15oj2_2";function V({editor:e,node:t,updateAttributes:a,deleteNode:o,extension:l}){const h=f(null),u=n(),{hasTrigger:M,fileName:H,fileSize:T,fileExt:C,fileType:L,url:b,error:j}=t.attrs,[A,N]=g(!1),{t:z}=i(),V=l?.options?.upload,E=m(()=>{u&&!b&&h.current.click()},[b,u]),
|
|
1
|
+
import{i as e,r as t}from"./dist-CsCFCV4K.js";import{n as r}from"./toggle-BXl_NYYh.js";import{n as i}from"./locales-DfkG6-1b.js";import{c as a,l as n,t as o}from"./useButtonProps-DSIajp_B.js";import{a as l,i as s,n as c,r as d}from"./file-aBzFF1LO.js";import{t as h}from"./dom-dataset-D3Nz0h73.js";import{NodeViewWrapper as p,ReactNodeViewRenderer as u}from"@tiptap/react";import{useCallback as m,useEffect as v,useRef as f,useState as g}from"react";import w from"clsx";import{Fragment as x,jsx as y,jsxs as k}from"react/jsx-runtime";import{LucideAudioLines as M,LucideFile as H,LucideImage as T,LucideSheet as C,LucideTableProperties as L,LucideVideo as b}from"lucide-react";import{Node as j,mergeAttributes as A}from"@tiptap/core";var N={audio:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-audio-lines"><path d="M2 10v3"/><path d="M6 6v11"/><path d="M10 3v18"/><path d="M14 8v7"/><path d="M18 5v13"/><path d="M22 10v3"/></svg>',video:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-video"><path d="m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"/><rect x="2" y="6" width="14" height="12" rx="2"/></svg>',file:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/></svg>',image:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>',pdf:'<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 32 32">\n <path fill="currentColor" d="M30 18v-2h-6v10h2v-4h3v-2h-3v-2zm-11 8h-4V16h4a3.003 3.003 0 0 1 3 3v4a3.003 3.003 0 0 1-3 3m-2-2h2a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-2zm-6-8H6v10h2v-3h3a2.003 2.003 0 0 0 2-2v-3a2 2 0 0 0-2-2m-3 5v-3h3l.001 3z"></path>\n <path fill="currentColor" d="M22 14v-4a.91.91 0 0 0-.3-.7l-7-7A.9.9 0 0 0 14 2H4a2.006 2.006 0 0 0-2 2v24a2 2 0 0 0 2 2h16v-2H4V4h8v6a2.006 2.006 0 0 0 2 2h6v2Zm-8-4V4.4l5.6 5.6Z"></path>\n </svg>',word:'<svg\n xmlns="http://www.w3.org/2000/svg"\n width="1em"\n height="1em"\n className="icon"\n viewBox="0 0 1024 1024"\n >\n <path\n fill="currentColor"\n d="M679.253 402.364 618.77 561.015l-60.348-158.651a30.04 30.04 0 0 0-30.447-18.637 29.76 29.76 0 0 0-30.447 18.637l-60.416 158.651-60.416-158.651a30.515 30.515 0 0 0-38.843-17.272 28.945 28.945 0 0 0-17.954 37.547l88.815 233.267c4.369 11.469 15.7 19.115 28.398 19.115a30.31 30.31 0 0 0 28.468-19.115l62.395-163.908 62.396 163.84c4.437 11.605 15.701 19.183 28.4 19.183a30.31 30.31 0 0 0 28.466-19.115l88.747-233.267a28.945 28.945 0 0 0-17.886-37.547 30.447 30.447 0 0 0-38.912 17.272zm219.478 395.605-51.883-29.218c-28.672-16.18-52.224-3.072-52.224 29.082v.273H643.209a29.833 29.833 0 0 0-30.31 29.354c0 16.18 13.584 29.218 30.31 29.218h151.825c1.092 30.516 24.03 43.077 52.224 27.648l51.063-27.989c29.013-15.906 29.15-42.189.41-58.368"\n />\n <path\n fill="currentColor"\n d="m810.667 913.135-.478.068H201.796c-19.865 0-36.727-11.673-36.727-25.6v-618.36h154.965c51.268 0 92.911-39.39 92.911-87.858v-87.86H810.19c19.797 0 36.522 11.742 36.522 25.669V739.26h61.987V119.262c0-46.421-44.169-84.241-98.51-84.241H328.364l-225.28 194.56v658.09c0 46.285 44.236 84.105 98.713 84.105H810.19c43.759 0 80.554-24.713 93.32-58.573h-92.842zM350.89 94.89v86.562c0 16.11-13.858 29.286-30.925 29.286H216.815L350.959 94.891z"\n />\n </svg>',excel:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-sheet"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><line x1="3" x2="21" y1="9" y2="9"/><line x1="3" x2="21" y1="15" y2="15"/><line x1="9" x2="9" y1="9" y2="21"/><line x1="15" x2="15" y1="9" y2="21"/></svg>',ppt:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-table-properties"><path d="M15 3v18"/><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M21 9H3"/><path d="M21 15H3"/></svg>'};var z={audio:/* @__PURE__ */y(M,{}),video:/* @__PURE__ */y(b,{}),file:/* @__PURE__ */y(H,{}),image:/* @__PURE__ */y(T,{}),pdf:/* @__PURE__ */y(e,{}),word:/* @__PURE__ */y(t,{}),excel:/* @__PURE__ */y(C,{}),ppt:/* @__PURE__ */y(L,{})};function _(e,t=!1){const r=l(e),i=z[r]||/* @__PURE__ */y(x,{});return t?function(e){const t=N[e],r=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement,i=["svg",Array.from(r.attributes).reduce((e,t)=>(e[t.name]=t.value,e),{})];return Array.from(r.childNodes).forEach(e=>{if(1===e.nodeType){const t=[e.tagName.toLowerCase(),Array.from(e.attributes).reduce((e,t)=>(e[t.name]=t.value,e),{})];e.textContent&&t.push(e.textContent),i.push(t)}}),i}(r):i}var B="_wrap_15oj2_2";function V({editor:e,node:t,updateAttributes:a,deleteNode:o,extension:l}){const h=f(null),u=n(),{hasTrigger:M,fileName:H,fileSize:T,fileExt:C,fileType:L,url:b,error:j}=t.attrs,[A,N]=g(!1),{t:z}=i(),V=l?.options?.upload,E=m(()=>{u&&!b&&h.current.click()},[b,u]),S=m(async e=>{const t=e.target.files&&e.target.files[0];if(!t)return;const r={fileName:d(t.name),fileSize:t.size,fileType:t.type,fileExt:c(t.name)};N(!0);try{const e=await V(t);a({...r,url:e}),N(!1)}catch(j){a({error:`File upload fail: ${j&&j.message}`}),N(!1),h.current.value=""}},[N,a]);v(()=>{b||M||(E(),a({hasTrigger:!0}))},[b,M,E,a]);const O=m(()=>o(),[e]);return u&&!b?/* @__PURE__ */y(p,{children:/* @__PURE__ */k("div",{className:w(B,"render-wrapper"),children:[/* @__PURE__ */y("p",{onClick:E,style:{cursor:"pointer"},children:/* @__PURE__ */y("span",A?{children:z("editor.attachment.uploading")}:{children:z("editor.attachment.please_upload")})}),/* @__PURE__ */y("input",{hidden:!0,onChange:S,ref:h,type:"file"})]})}):b?/* @__PURE__ */y(p,{children:/* @__PURE__ */k("div",{className:w(B,"render-wrapper"),onClick:E,children:[/* @__PURE__ */k("div",{className:"richtext-flex richtext-items-center richtext-gap-[4px]",children:[
|
|
2
2
|
/* @__PURE__ */y("span",{children:_(L)}),
|
|
3
3
|
/* @__PURE__ */k("span",{children:[H,".",C]}),
|
|
4
|
-
/* @__PURE__ */k("span",{children:["(",s(T),")"]})]}),/* @__PURE__ */y(r,{action:
|
|
4
|
+
/* @__PURE__ */k("span",{children:["(",s(T),")"]})]}),/* @__PURE__ */y(r,{action:O,icon:"Trash2",tooltip:z("editor.delete")})]})}):"null"!==j?/* @__PURE__ */y(p,{children:/* @__PURE__ */y("div",{className:w(B,"render-wrapper"),onClick:E,children:/* @__PURE__ */y("p",{children:j})})}):/* @__PURE__ */y(x,{})}function E(){const e=o(S.name),{icon:t,tooltip:i,shortcutKeys:n,tooltipOptions:l={},action:s,isActive:c}=e?.componentProps??{},{editorDisabled:d,update:h}=a(c);return e?/* @__PURE__ */y(r,{action:()=>{d||s&&(s(),h())},disabled:d,icon:t,shortcutKeys:n,tooltip:i,tooltipOptions:l}):/* @__PURE__ */y(x,{})}var S=j.create({name:"attachment",content:"",marks:"",group:"block",selectable:!0,atom:!0,draggable:!0,addOptions(){return{...this.parent?.(),HTMLAttributes:{class:"attachment"},button:({editor:e,t:t})=>({component:r,componentProps:{action:()=>e.chain().focus().setAttachment().run(),isActive:()=>!1,disabled:!1,icon:"Attachment",tooltip:t("editor.attachment.tooltip")}})}},parseHTML:()=>[{tag:"div[class=attachment]"}],renderHTML({HTMLAttributes:e}){const{url:t="",fileName:r="",fileSize:i="",fileType:a="",fileExt:n=""}=e||{};return["div",A(this.options.HTMLAttributes||{},e||{}),t?["a",{href:t||"#"},["span",{class:"attachment__icon"},_(a,!0)],["span",{class:"attachment__text"},`${r}.${n} (${s(i)})`]]:["div",{class:"attachment__placeholder"}]]},addAttributes:()=>({fileName:{default:null,parseHTML:h("filename")},fileSize:{default:null,parseHTML:h("filesize")},fileType:{default:null,parseHTML:h("filetype")},fileExt:{default:null,parseHTML:h("fileext")},url:{default:null,parseHTML:h("url")},hasTrigger:{default:!1,parseHTML:e=>"true"===h("hastrigger")(e)},error:{default:null,parseHTML:h("error")}}),addCommands(){return{setAttachment:(e={})=>({chain:t})=>t().insertContent({type:this.name,attrs:e}).run()}},addNodeView:()=>u(V)});export{E as n,S as t};
|
package/dist/Attachment.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as t,t as a}from"./Attachment-
|
|
1
|
+
import{n as t,t as a}from"./Attachment-FN0H4pdR.js";export{a as Attachment,t as RichTextAttachment};
|
package/dist/BulletList.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./rolldown-runtime-BeavJI0R.cjs");const t=require("./toggle-CRftKzl0.cjs"),e=require("./useButtonProps-D2Hd5DbR.cjs"),o=require("./dist-ICzvPVCE.cjs");let i=require("react/jsx-runtime");var s=o.BulletList.extend({addOptions(){return{...this.parent?.(),button:({editor:t,t:e,extension:o})=>({componentProps:{action:()=>t.commands.toggleBulletList(),isActive:()=>t.isActive("bulletList"),disabled:!1,shortcutKeys:o.options.shortcutKeys??["shift","mod","8"],icon:"List",tooltip:e("editor.bulletlist.tooltip")}})}}});exports.BulletList=s,exports.RichTextBulletList=function(){const o=e.useButtonProps(s.name),{icon:
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./rolldown-runtime-BeavJI0R.cjs");const t=require("./toggle-CRftKzl0.cjs"),e=require("./useButtonProps-D2Hd5DbR.cjs"),o=require("./dist-ICzvPVCE.cjs");let i=require("react/jsx-runtime");var s=o.BulletList.extend({addOptions(){return{...this.parent?.(),button:({editor:t,t:e,extension:o})=>({componentProps:{action:()=>t.commands.toggleBulletList(),isActive:()=>t.isActive("bulletList"),disabled:!1,shortcutKeys:o.options.shortcutKeys??["shift","mod","8"],icon:"List",tooltip:e("editor.bulletlist.tooltip")}})}}});exports.BulletList=s,exports.RichTextBulletList=function(){const o=e.useButtonProps(s.name),{icon:r,tooltip:n,shortcutKeys:l,tooltipOptions:u={},action:c,isActive:a}=o?.componentProps??{},{dataState:p,disabled:d,update:m}=e.useToggleActive(a);return o?(0,i.jsx)(t.ActionButton,{action:()=>{d||c&&(c(),m())},dataState:p,disabled:d,icon:r,shortcutKeys:l,tooltip:n,tooltipOptions:u}):(0,i.jsx)(i.Fragment,{})};
|
|
@@ -2,10 +2,10 @@ import{o as t}from"./dist-CsCFCV4K.js";import{n as e}from"./toggle-BXl_NYYh.js";
|
|
|
2
2
|
/* @__PURE__ */v(O,{}),
|
|
3
3
|
/* @__PURE__ */v(I.Viewport,{className:t("richtext-p-1","popper"===i&&"richtext-h-[var(--radix-select-trigger-height)] richtext-w-full richtext-min-w-[var(--radix-select-trigger-width)]"),children:r}),
|
|
4
4
|
/* @__PURE__ */v(P,{})]})}));V.displayName=I.Content.displayName,f.forwardRef(({className:e,...r},i)=>/* @__PURE__ */v(I.Label,{className:t("richtext-py-1.5 richtext-pl-8 richtext-pr-2 richtext-text-sm richtext-font-semibold",e),ref:i,...r})).displayName=I.Label.displayName;var D=f.forwardRef(({className:e,children:r,...i},a)=>/* @__PURE__ */N(I.Item,{ref:a,className:t("richtext-relative richtext-flex richtext-w-full richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-py-1.5 richtext-pl-8 richtext-pr-2 richtext-text-sm richtext-outline-none focus:richtext-bg-accent focus:richtext-text-accent-foreground data-[disabled]:richtext-pointer-events-none data-[disabled]:richtext-opacity-50",e),...i,children:[/* @__PURE__ */v("span",{className:"richtext-absolute richtext-left-2 richtext-flex richtext-size-3.5 richtext-items-center richtext-justify-center",children:/* @__PURE__ */v(I.ItemIndicator,{children:/* @__PURE__ */v(C,{className:"richtext-size-4"})})}),/* @__PURE__ */v(I.ItemText,{children:r})]}));D.displayName=I.Item.displayName,f.forwardRef(({className:e,...r},i)=>/* @__PURE__ */v(I.Separator,{className:t("richtext--mx-1 richtext-my-1 richtext-h-px richtext-bg-muted",e),ref:i,...r})).displayName=I.Separator.displayName;var K=[{value:"note",label:"Note",icon:A,color:"#1f6feb",background:"#1f6feb1f"},{value:"tip",label:"Tip",icon:L,color:"#238636",background:"#2386361f"},{value:"important",label:"Important",icon:w,color:"#ab7df8",background:"#ab7df81f"},{value:"warning",label:"Warning",icon:z,color:"#d29922",background:"#d299221f"},{value:"caution",label:"Caution",icon:k,color:"#f85149",background:"#f851491f"}];function U({node:t}){const{type:e="note",title:r="",body:i=""}=t.attrs,a=(K.find(t=>t.value===e)||K[0]).icon;/* @__PURE__ */
|
|
5
|
-
return v(m,{children:/* @__PURE__ */N("div",{className:g("richtext-relative richtext-my-4 richtext-rounded-lg richtext-border richtext-p-4",{"richtext-bg-[#1f6feb1f] richtext-border-[#1f6feb]":"note"===e,"richtext-bg-[#2386361f] richtext-border-[#238636]":"tip"===e,"richtext-bg-[#ab7df81f] richtext-border-[#ab7df8]":"important"===e,"richtext-bg-[#d299221f] richtext-border-[#d29922]":"warning"===e,"richtext-bg-[#f851491f] richtext-border-[#f85149]":"caution"===e}),children:[/* @__PURE__ */N("div",{className:g("richtext-mb-2 richtext-flex richtext-items-center richtext-gap-2",{"richtext-text-[#1f6feb]":"note"===e,"richtext-text-[#238636]":"tip"===e,"richtext-text-[#ab7df8]":"important"===e,"richtext-text-[#d29922]":"warning"===e,"richtext-text-[#f85149]":"caution"===e}),children:[/* @__PURE__ */v(a,{className:"richtext-size-5"}),/* @__PURE__ */v("span",{className:"richtext-font-semibold",children:r})]}),i&&/* @__PURE__ */v("p",{className:"richtext-pl-[28px]",children:i})]})})}var W=[{value:"note",label:"Note",icon:"Info"},{value:"tip",label:"Tip",icon:"Lightbulb"},{value:"important",label:"Important",icon:"AlertCircle"},{value:"warning",label:"Warning",icon:"TriangleAlert"},{value:"caution",label:"Caution",icon:"OctagonAlert"}];function
|
|
5
|
+
return v(m,{children:/* @__PURE__ */N("div",{className:g("richtext-relative richtext-my-4 richtext-rounded-lg richtext-border richtext-p-4",{"richtext-bg-[#1f6feb1f] richtext-border-[#1f6feb]":"note"===e,"richtext-bg-[#2386361f] richtext-border-[#238636]":"tip"===e,"richtext-bg-[#ab7df81f] richtext-border-[#ab7df8]":"important"===e,"richtext-bg-[#d299221f] richtext-border-[#d29922]":"warning"===e,"richtext-bg-[#f851491f] richtext-border-[#f85149]":"caution"===e}),children:[/* @__PURE__ */N("div",{className:g("richtext-mb-2 richtext-flex richtext-items-center richtext-gap-2",{"richtext-text-[#1f6feb]":"note"===e,"richtext-text-[#238636]":"tip"===e,"richtext-text-[#ab7df8]":"important"===e,"richtext-text-[#d29922]":"warning"===e,"richtext-text-[#f85149]":"caution"===e}),children:[/* @__PURE__ */v(a,{className:"richtext-size-5"}),/* @__PURE__ */v("span",{className:"richtext-font-semibold",children:r})]}),i&&/* @__PURE__ */v("p",{className:"richtext-pl-[28px]",children:i})]})})}var W=[{value:"note",label:"Note",icon:"Info"},{value:"tip",label:"Tip",icon:"Lightbulb"},{value:"important",label:"Important",icon:"AlertCircle"},{value:"warning",label:"Warning",icon:"TriangleAlert"},{value:"caution",label:"Caution",icon:"OctagonAlert"}];function F(){const{t:t}=r(),m=x(),u=p(q.name),[f,g]=b(!1),[w,C]=b("note"),[T,j]=b(""),[A,L]=b(""),{icon:k,tooltip:z,shortcutKeys:I,tooltipOptions:H={},isActive:M}=u?.componentProps??{},{dataState:O,disabled:P}=h(M);return u?/* @__PURE__ */N(n,{onOpenChange:g,open:f,children:[/* @__PURE__ */v(o,{asChild:!0,children:/* @__PURE__ */v(e,{action:()=>{P||g(!0)},dataState:O,disabled:P,icon:k,shortcutKeys:I,tooltip:z,tooltipOptions:H})}),/* @__PURE__ */N(c,{children:[
|
|
6
6
|
/* @__PURE__ */v(a,{children:t("editor.callout.dialog.title")}),
|
|
7
7
|
/* @__PURE__ */N("div",{className:"richtext-space-y-4 richtext-py-4",children:[
|
|
8
8
|
/* @__PURE__ */N("div",{className:"richtext-space-y-2",children:[/* @__PURE__ */v(d,{children:t("editor.callout.dialog.type")}),/* @__PURE__ */N(R,{onValueChange:C,value:w,children:[/* @__PURE__ */v(B,{children:/* @__PURE__ */v(S,{placeholder:t("editor.callout.dialog.type.placeholder")})}),/* @__PURE__ */v(V,{children:W.map(e=>/* @__PURE__ */v(D,{value:e.value,children:t(`editor.callout.type.${e.value}`)},e.value))})]})]}),
|
|
9
9
|
/* @__PURE__ */N("div",{className:"richtext-space-y-2",children:[/* @__PURE__ */v(d,{children:t("editor.callout.dialog.title.label")}),/* @__PURE__ */v(s,{onChange:t=>j(t.target.value),placeholder:t("editor.callout.dialog.title.placeholder"),value:T})]}),
|
|
10
10
|
/* @__PURE__ */N("div",{className:"richtext-space-y-2",children:[/* @__PURE__ */v(d,{children:t("editor.callout.dialog.body.label")}),/* @__PURE__ */v(s,{onChange:t=>L(t.target.value),placeholder:t("editor.callout.dialog.body.placeholder"),value:A})]})]}),
|
|
11
|
-
/* @__PURE__ */N(l,{children:[/* @__PURE__ */v(i,{onClick:()=>g(!1),variant:"outline",children:t("editor.callout.dialog.button.cancel")}),/* @__PURE__ */v(i,{onClick:()=>{m&&(m.chain().focus().setCallout({type:w,title:T,body:A}).run(),g(!1),C("note"),j(""),L(""))},children:t("editor.callout.dialog.button.apply")})]})]})]}):/* @__PURE__ */v(y,{})}function
|
|
11
|
+
/* @__PURE__ */N(l,{children:[/* @__PURE__ */v(i,{onClick:()=>g(!1),variant:"outline",children:t("editor.callout.dialog.button.cancel")}),/* @__PURE__ */v(i,{onClick:()=>{m&&(m.chain().focus().setCallout({type:w,title:T,body:A}).run(),g(!1),C("note"),j(""),L(""))},children:t("editor.callout.dialog.button.apply")})]})]})]}):/* @__PURE__ */v(y,{})}function $(t){return e=>e.getAttribute(t)}var q=H.create({name:"callout",group:"block",selectable:!0,atom:!0,draggable:!0,inline:!1,addOptions(){return{...this.parent?.(),HTMLAttributes:{class:"callout"},button:({editor:t,t:r})=>({component:e,componentProps:{action:()=>!0,isActive:()=>t.isActive("callout"),disabled:!1,icon:"Callout",tooltip:r("editor.callout.tooltip")}})}},parseHTML:()=>[{tag:"div.callout"}],renderHTML({HTMLAttributes:t}){return["div",M(this.options&&this.options.HTMLAttributes||{},t)]},addAttributes:()=>({type:{default:"",parseHTML:$("type")},title:{default:"",parseHTML:$("title")},body:{default:"",parseHTML:$("body")}}),addCommands(){return{setCallout:t=>({chain:e})=>e().insertContent({type:this.name,attrs:t}).run()}},addNodeView:()=>u(U)});export{D as a,V as i,F as n,B as o,R as r,S as s,q as t};
|
package/dist/Callout.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as o,t}from"./Callout-
|
|
1
|
+
import{n as o,t}from"./Callout-C6kKHIbW.js";export{t as Callout,o as RichTextCallout};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e,t}from"./rolldown-runtime-Drgf5FY8.js";import{n}from"./toggle-BXl_NYYh.js";import{c as i,t as o}from"./useButtonProps-DSIajp_B.js";import r from"react";import{Fragment as a,jsx as s}from"react/jsx-runtime";import{Node as l,findChildren as c,mergeAttributes as u,textblockTypeInputRule as d}from"@tiptap/core";import{Plugin as g,PluginKey as h,Selection as p,TextSelection as f}from"@tiptap/pm/state";import{Decoration as m,DecorationSet as b}from"@tiptap/pm/view";var x=/^```([a-z]+)?[\s\n]$/,w=/^~~~([a-z]+)?[\s\n]$/,y=l.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;const{languageClassPrefix:n}=this.options;if(!n)return null;const i=[...(null==(t=e.firstElementChild)?void 0:t.classList)||[]].filter(e=>e.startsWith(n)).map(e=>e.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:t}){return["pre",u(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(e,t)=>{var n,i;return!1===(null==(n=e.raw)?void 0:n.startsWith("```"))&&!1===(null==(i=e.raw)?void 0:i.startsWith("~~~"))&&"indented"!==e.codeBlockStyle?[]:t.createNode("codeBlock",{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[])},renderMarkdown:(e,t)=>{var n;let i="";const o=(null==(n=e.attrs)?void 0:n.language)||"";return i=e.content?[`\`\`\`${o}`,t.renderChildren(e.content),"```"].join("\n"):`\`\`\`${o}\n\n\`\`\``,i},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=1===t.pos;return!(!e||t.parent.type.name!==this.name)&&(!(!n&&t.parent.textContent.length)&&this.editor.commands.clearNodes())},Tab:({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=null!=(t=this.options.tabSize)?t:4,{state:i}=e,{selection:o}=i,{$from:r,empty:a}=o;if(r.parent.type!==this.type)return!1;const s=" ".repeat(n);return a?e.commands.insertContent(s):e.commands.command(({tr:e})=>{const{from:t,to:n}=o,r=i.doc.textBetween(t,n,"\n","\n").split("\n").map(e=>s+e).join("\n");return e.replaceWith(t,n,i.schema.text(r)),!0})},"Shift-Tab":({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=null!=(t=this.options.tabSize)?t:4,{state:i}=e,{selection:o}=i,{$from:r,empty:a}=o;return r.parent.type===this.type&&(a?e.commands.command(({tr:e})=>{var t;const{pos:o}=r,a=r.start(),s=r.end(),l=i.doc.textBetween(a,s,"\n","\n").split("\n");let c=0,u=0;const d=o-a;for(let n=0;n<l.length;n+=1){if(u+l[n].length>=d){c=n;break}u+=l[n].length+1}const g=(null==(t=l[c].match(/^ */))?void 0:t[0])||"",h=Math.min(g.length,n);if(0===h)return!0;let p=a;for(let n=0;n<c;n+=1)p+=l[n].length+1;return e.delete(p,p+h),o-p<=h&&e.setSelection(f.create(e.doc,p)),!0}):e.commands.command(({tr:e})=>{const{from:t,to:r}=o,a=i.doc.textBetween(t,r,"\n","\n").split("\n").map(e=>{var t;const i=(null==(t=e.match(/^ */))?void 0:t[0])||"",o=Math.min(i.length,n);return e.slice(o)}).join("\n");return e.replaceWith(t,r,i.schema.text(a)),!0}))},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:n}=t,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type)return!1;const r=i.parentOffset===i.parent.nodeSize-2,a=i.parent.textContent.endsWith("\n\n");return!(!r||!a)&&e.chain().command(({tr:e})=>(e.delete(i.pos-2,i.pos),!0)).exitCode().run()},ArrowUp:({editor:e})=>{if(!this.options.exitOnArrowUp)return!1;const{state:t}=e,{selection:n}=t,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type)return!1;if(0!==i.parentOffset)return!1;const r=i.before();return!(r>0)&&e.commands.insertDefaultBlock({pos:r})},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:i}=t,{$from:o,empty:r}=n;if(!r||o.parent.type!==this.type)return!1;if(o.parentOffset!==o.parent.nodeSize-2)return!1;const a=o.after();return void 0!==a&&(i.nodeAt(a)?e.commands.command(({tr:e})=>(e.setSelection(p.near(i.resolve(a))),!0)):e.commands.exitCode())}}},addInputRules(){return[d({find:x,type:this.type,getAttributes:e=>({language:e[1]})}),d({find:w,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new g({key:new h("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData)return!1;if(this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),i=t.clipboardData.getData("vscode-editor-data"),o=i?JSON.parse(i):void 0,r=null==o?void 0:o.mode;if(!n||!r)return!1;const{tr:a,schema:s}=e.state,l=s.text(n.replace(/\r\n?/g,"\n"));return a.replaceSelectionWith(this.type.create({language:r},l)),a.selection.$from.parent.type!==this.type&&a.setSelection(f.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta("paste",!0),e.dispatch(a),!0}}})]}}),E=/* @__PURE__ */e(/* @__PURE__ */t((e,t)=>{function n(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{const i=e[t],o=typeof i;"object"!==o&&"function"!==o||Object.isFrozen(i)||n(i)}),e}var i=class{constructor(e){void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function o(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function r(e,...t){const n=Object.create(null);for(const i in e)n[i]=e[i];return t.forEach(function(e){for(const t in e)n[t]=e[t]}),n}var a=e=>!!e.scope,s=class{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=o(e)}openNode(e){if(!a(e))return;const t=((e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const n=e.split(".");return[`${t}${n.shift()}`,...n.map((e,t)=>`${e}${"_".repeat(t+1)}`)].join(" ")}return`${t}${e}`})(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){a(e)&&(this.buffer+="</span>")}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}},l=(e={})=>{const t={children:[]};return Object.assign(t,e),t},c=class e{constructor(){this.rootNode=l(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const t=l({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return"string"==typeof t?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(t){"string"!=typeof t&&t.children&&(t.children.every(e=>"string"==typeof e)?t.children=[t.children.join("")]:t.children.forEach(t=>{e._collapse(t)}))}},u=class extends c{constructor(e){super(),this.options=e}addText(e){""!==e&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){const n=e.root;t&&(n.scope=`language:${t}`),this.add(n)}toHTML(){return new s(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function d(e){return e?"string"==typeof e?e:e.source:null}function g(e){return f("(?=",e,")")}function h(e){return f("(?:",e,")*")}function p(e){return f("(?:",e,")?")}function f(...e){return e.map(e=>d(e)).join("")}function m(...e){return"("+(function(e){const t=e[e.length-1];return"object"==typeof t&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}(e).capture?"":"?:")+e.map(e=>d(e)).join("|")+")"}function b(e){return new RegExp(e.toString()+"|").exec("").length-1}var x=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function w(e,{joinWith:t}){let n=0;return e.map(e=>{n+=1;const t=n;let i=d(e),o="";for(;i.length>0;){const e=x.exec(i);if(!e){o+=i;break}o+=i.substring(0,e.index),i=i.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?o+="\\"+String(Number(e[1])+t):(o+=e[0],"("===e[0]&&n++)}return o}).map(e=>`(${e})`).join(t)}var y="[a-zA-Z]\\w*",E="[a-zA-Z_]\\w*",v="\\b\\d+(\\.\\d+)?",_="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",O="\\b(0b[01]+)",S={begin:"\\\\[\\s\\S]",relevance:0},k={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[S]},M={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[S]},A=function(e,t,n={}){const i=r({scope:"comment",begin:e,end:t,contains:[]},n);i.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const o=m("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return i.contains.push({begin:f(/[ ]+/,"(",o,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),i},N=A("//","$"),T=A("/\\*","\\*/"),R=A("#","$"),L={scope:"number",begin:v,relevance:0},j={scope:"number",begin:_,relevance:0},I={scope:"number",begin:O,relevance:0},B={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[S,{begin:/\[/,end:/\]/,relevance:0,contains:[S]}]},C={scope:"title",begin:y,relevance:0},P={scope:"title",begin:E,relevance:0},D=/*#__PURE__*/Object.freeze({__proto__:null,APOS_STRING_MODE:k,BACKSLASH_ESCAPE:S,BINARY_NUMBER_MODE:I,BINARY_NUMBER_RE:O,COMMENT:A,C_BLOCK_COMMENT_MODE:T,C_LINE_COMMENT_MODE:N,C_NUMBER_MODE:j,C_NUMBER_RE:_,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:R,IDENT_RE:y,MATCH_NOTHING_RE:/\b\B/,METHOD_GUARD:{begin:"\\.\\s*[a-zA-Z_]\\w*",relevance:0},NUMBER_MODE:L,NUMBER_RE:v,PHRASAL_WORDS_MODE:{begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},QUOTE_STRING_MODE:M,REGEXP_MODE:B,RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",SHEBANG:(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=f(t,/.*\b/,e.binary,/\b.*/)),r({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{0!==e.index&&t.ignoreMatch()}},e)},TITLE_MODE:C,UNDERSCORE_IDENT_RE:E,UNDERSCORE_TITLE_MODE:P});function H(e,t){"."===e.input[e.index-1]&&t.ignoreMatch()}function $(e,t){void 0!==e.className&&(e.scope=e.className,delete e.className)}function z(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=H,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,void 0===e.relevance&&(e.relevance=0))}function U(e,t){Array.isArray(e.illegal)&&(e.illegal=m(...e.illegal))}function W(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function X(e,t){void 0===e.relevance&&(e.relevance=1)}var G=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},e);Object.keys(e).forEach(t=>{delete e[t]}),e.keywords=n.keywords,e.begin=f(n.beforeMatch,g(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},K=["of","and","for","in","not","or","if","then","parent","list","value"];function Z(e,t,n="keyword"){const i=Object.create(null);return"string"==typeof e?o(n,e.split(" ")):Array.isArray(e)?o(n,e):Object.keys(e).forEach(function(n){Object.assign(i,Z(e[n],t,n))}),i;function o(e,n){t&&(n=n.map(e=>e.toLowerCase())),n.forEach(function(t){const n=t.split("|");i[n[0]]=[e,F(n[0],n[1])]})}}function F(e,t){return t?Number(t):function(e){return K.includes(e.toLowerCase())}(e)?0:1}var V={},J=(e,t)=>{V[`${e}/${t}`]||(V[`${e}/${t}`]=!0)},q=/* @__PURE__ */new Error;function Y(e,t,{key:n}){let i=0;const o=e[n],r={},a={};for(let s=1;s<=t.length;s++)a[s+i]=o[s],r[s+i]=!0,i+=b(t[s-1]);e[n]=a,e[n]._emit=r,e[n]._multi=!0}function Q(e){!function(e){e.scope&&"object"==typeof e.scope&&null!==e.scope&&(e.beginScope=e.scope,delete e.scope)}(e),"string"==typeof e.beginScope&&(e.beginScope={_wrap:e.beginScope}),"string"==typeof e.endScope&&(e.endScope={_wrap:e.endScope}),function(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw q;if("object"!=typeof e.beginScope||null===e.beginScope)throw q;Y(e,e.begin,{key:"beginScope"}),e.begin=w(e.begin,{joinWith:""})}}(e),function(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw q;if("object"!=typeof e.endScope||null===e.endScope)throw q;Y(e,e.end,{key:"endScope"}),e.end=w(e.end,{joinWith:""})}}(e)}function ee(e){function t(t,n){return new RegExp(d(t),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(n?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=b(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null);const e=this.regexes.map(e=>e[1]);this.matcherRe=t(w(e,{joinWith:"|"}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;const t=this.matcherRe.exec(e);if(!t)return null;const n=t.findIndex((e,t)=>t>0&&void 0!==e),i=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,i)}}class i{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];const t=new n;return this.rules.slice(e).forEach(([e,n])=>t.addRule(e,n)),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),"begin"===t.type&&this.count++}exec(e){const t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition())if(n&&n.index===this.lastIndex);else{const t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=r(e.classNameAliases||{}),function n(o,a){const s=o;if(o.isCompiled)return s;[$,W,Q,G].forEach(e=>e(o,a)),e.compilerExtensions.forEach(e=>e(o,a)),o.__beforeBegin=null,[z,U,X].forEach(e=>e(o,a)),o.isCompiled=!0;let l=null;return"object"==typeof o.keywords&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),l=o.keywords.$pattern,delete o.keywords.$pattern),l=l||/\w+/,o.keywords&&(o.keywords=Z(o.keywords,e.case_insensitive)),s.keywordPatternRe=t(l,!0),a&&(o.begin||(o.begin=/\B|\b/),s.beginRe=t(s.begin),o.end||o.endsWithParent||(o.end=/\B|\b/),o.end&&(s.endRe=t(s.end)),s.terminatorEnd=d(s.end)||"",o.endsWithParent&&a.terminatorEnd&&(s.terminatorEnd+=(o.end?"|":"")+a.terminatorEnd)),o.illegal&&(s.illegalRe=t(o.illegal)),o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map(function(e){return function(e){e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return r(e,{variants:null},t)}));return e.cachedVariants?e.cachedVariants:te(e)?r(e,{starts:e.starts?r(e.starts):null}):Object.isFrozen(e)?r(e):e}("self"===e?o:e)})),o.contains.forEach(function(e){n(e,s)}),o.starts&&n(o.starts,a),s.matcher=function(e){const t=new i;return e.contains.forEach(e=>t.addRule(e.begin,{rule:e,type:"begin"})),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:"end"}),e.illegal&&t.addRule(e.illegal,{type:"illegal"}),t}(s),s}(e)}function te(e){return!!e&&(e.endsWithParent||te(e.starts))}var ne=class extends Error{constructor(e,t){super(e),this.name="HTMLInjectionError",this.html=t}},ie=o,oe=r,re=Symbol("nomatch"),ae=function(e){const t=Object.create(null),o=Object.create(null),r=[];let a=!0;const s="Could not find the language '{}', did you forget to load/include a language module?",l={disableAutodetect:!0,name:"Plain text",contains:[]};let c={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:u};function d(e){return c.noHighlightRe.test(e)}function b(e,t,n){let i="",o="";"object"==typeof t?(i=e,n=t.ignoreIllegals,o=t.language):(J("10.7.0","highlight(lang, code, ...args) has been deprecated."),J("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"),o=e,i=t),void 0===n&&(n=!0);const r={code:i,language:o};k("before:highlight",r);const a=r.result?r.result:x(r.language,r.code,n);return a.code=r.code,k("after:highlight",a),a}function x(e,n,o,r){const l=Object.create(null);function u(e,t){return e.keywords[t]}function d(){if(!M.keywords)return void N.addText(T);let e=0;M.keywordPatternRe.lastIndex=0;let t=M.keywordPatternRe.exec(T),n="";for(;t;){n+=T.substring(e,t.index);const i=O.case_insensitive?t[0].toLowerCase():t[0],o=u(M,i);if(o){const[e,r]=o;if(N.addText(n),n="",l[i]=(l[i]||0)+1,l[i]<=7&&(R+=r),e.startsWith("_"))n+=t[0];else{const n=O.classNameAliases[e]||e;h(t[0],n)}}else n+=t[0];e=M.keywordPatternRe.lastIndex,t=M.keywordPatternRe.exec(T)}n+=T.substring(e),N.addText(n)}function g(){null!=M.subLanguage?function(){if(""===T)return;let e=null;if("string"==typeof M.subLanguage){if(!t[M.subLanguage])return void N.addText(T);e=x(M.subLanguage,T,!0,A[M.subLanguage]),A[M.subLanguage]=e._top}else e=w(T,M.subLanguage.length?M.subLanguage:null);M.relevance>0&&(R+=e.relevance),N.__addSublanguage(e._emitter,e.language)}():d(),T=""}function h(e,t){""!==e&&(N.startScope(t),N.addText(e),N.endScope())}function p(e,t){let n=1;const i=t.length-1;for(;n<=i;){if(!e._emit[n]){n++;continue}const i=O.classNameAliases[e[n]]||e[n],o=t[n];i?h(o,i):(T=o,d(),T=""),n++}}function f(e,t){return e.scope&&"string"==typeof e.scope&&N.openNode(O.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(h(T,O.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),T=""):e.beginScope._multi&&(p(e.beginScope,t),T="")),M=Object.create(e,{parent:{value:M}}),M}function m(e,t,n){let o=function(e,t){const n=e&&e.exec(t);return n&&0===n.index}(e.endRe,n);if(o){if(e["on:end"]){const n=new i(e);e["on:end"](t,n),n.isMatchIgnored&&(o=!1)}if(o){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return m(e.parent,t,n)}function b(e){return 0===M.matcher.regexIndex?(T+=e[0],1):(I=!0,0)}function y(e){const t=e[0],i=n.substring(e.index),o=m(M,e,i);if(!o)return re;const r=M;M.endScope&&M.endScope._wrap?(g(),h(t,M.endScope._wrap)):M.endScope&&M.endScope._multi?(g(),p(M.endScope,e)):r.skip?T+=t:(r.returnEnd||r.excludeEnd||(T+=t),g(),r.excludeEnd&&(T=t));do{M.scope&&N.closeNode(),M.skip||M.subLanguage||(R+=M.relevance),M=M.parent}while(M!==o.parent);return o.starts&&f(o.starts,e),r.returnEnd?0:t.length}let E={};function v(t,r){const s=r&&r[0];if(T+=t,null==s)return g(),0;if("begin"===E.type&&"end"===r.type&&E.index===r.index&&""===s){if(T+=n.slice(r.index,r.index+1),!a){const t=/* @__PURE__ */new Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=E.rule,t}return 1}if(E=r,"begin"===r.type)return function(e){const t=e[0],n=e.rule,o=new i(n),r=[n.__beforeBegin,n["on:begin"]];for(const i of r)if(i&&(i(e,o),o.isMatchIgnored))return b(t);return n.skip?T+=t:(n.excludeBegin&&(T+=t),g(),n.returnBegin||n.excludeBegin||(T=t)),f(n,e),n.returnBegin?0:t.length}(r);if("illegal"===r.type&&!o){const e=/* @__PURE__ */new Error('Illegal lexeme "'+s+'" for mode "'+(M.scope||"<unnamed>")+'"');throw e.mode=M,e}if("end"===r.type){const e=y(r);if(e!==re)return e}if("illegal"===r.type&&""===s)return T+="\n",1;if(j>1e5&&j>3*r.index)/* @__PURE__ */throw new Error("potential infinite loop, way more iterations than matches");return T+=s,s.length}const O=_(e);if(!O)throw s.replace("{}",e),new Error('Unknown language: "'+e+'"');const S=ee(O);let k="",M=r||S;const A={},N=new c.__emitter(c);!function(){const e=[];for(let t=M;t!==O;t=t.parent)t.scope&&e.unshift(t.scope);e.forEach(e=>N.openNode(e))}();let T="",R=0,L=0,j=0,I=!1;try{if(O.__emitTokens)O.__emitTokens(n,N);else{for(M.matcher.considerAll();;){j++,I?I=!1:M.matcher.considerAll(),M.matcher.lastIndex=L;const e=M.matcher.exec(n);if(!e)break;const t=v(n.substring(L,e.index),e);L=e.index+t}v(n.substring(L))}return N.finalize(),k=N.toHTML(),{language:e,value:k,relevance:R,illegal:!1,_emitter:N,_top:M}}catch(B){if(B.message&&B.message.includes("Illegal"))return{language:e,value:ie(n),illegal:!0,relevance:0,_illegalBy:{message:B.message,index:L,context:n.slice(L-100,L+100),mode:B.mode,resultSoFar:k},_emitter:N};if(a)return{language:e,value:ie(n),illegal:!1,relevance:0,errorRaised:B,_emitter:N,_top:M};throw B}}function w(e,n){n=n||c.languages||Object.keys(t);const i=function(e){const t={value:ie(e),illegal:!1,relevance:0,_top:l,_emitter:new c.__emitter(c)};return t._emitter.addText(e),t}(e),o=n.filter(_).filter(S).map(t=>x(t,e,!1));o.unshift(i);const[r,a]=o.sort((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(_(e.language).supersetOf===t.language)return 1;if(_(t.language).supersetOf===e.language)return-1}return 0}),s=r;return s.secondBest=a,s}function y(e){let t=null;const n=function(e){let t=e.className+" ";t+=e.parentNode?e.parentNode.className:"";const n=c.languageDetectRe.exec(t);if(n){const e=_(n[1]);return e||s.replace("{}",n[1]),e?n[1]:"no-highlight"}return t.split(/\s+/).find(e=>d(e)||_(e))}(e);if(d(n))return;if(k("before:highlightElement",{el:e,language:n}),e.dataset.highlighted)return;if(e.children.length>0&&(c.ignoreUnescapedHTML,c.throwUnescapedHTML))throw new ne("One of your code blocks includes unescaped HTML.",e.innerHTML);t=e;const i=t.textContent,r=n?b(i,{language:n,ignoreIllegals:!0}):w(i);e.innerHTML=r.value,e.dataset.highlighted="yes",function(e,t,n){const i=t&&o[t]||n;e.classList.add("hljs"),e.classList.add(`language-${i}`)}(e,n,r.language),e.result={language:r.language,re:r.relevance,relevance:r.relevance},r.secondBest&&(e.secondBest={language:r.secondBest.language,relevance:r.secondBest.relevance}),k("after:highlightElement",{el:e,result:r,text:i})}let E=!1;function v(){if("loading"===document.readyState)return E||window.addEventListener("DOMContentLoaded",function(){v()},!1),void(E=!0);document.querySelectorAll(c.cssSelector).forEach(y)}function _(e){return e=(e||"").toLowerCase(),t[e]||t[o[e]]}function O(e,{languageName:t}){"string"==typeof e&&(e=[e]),e.forEach(e=>{o[e.toLowerCase()]=t})}function S(e){const t=_(e);return t&&!t.disableAutodetect}function k(e,t){const n=e;r.forEach(function(e){e[n]&&e[n](t)})}Object.assign(e,{highlight:b,highlightAuto:w,highlightAll:v,highlightElement:y,highlightBlock:function(e){return J("10.7.0","highlightBlock will be removed entirely in v12.0"),J("10.7.0","Please use highlightElement now."),y(e)},configure:function(e){c=oe(c,e)},initHighlighting:()=>{v(),J("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")},initHighlightingOnLoad:function(){v(),J("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")},registerLanguage:function(n,i){let o=null;try{o=i(e)}catch(r){if("Language definition for '{}' could not be registered.".replace("{}",n),!a)throw r;o=l}o.name||(o.name=n),t[n]=o,o.rawDefinition=i.bind(null,e),o.aliases&&O(o.aliases,{languageName:n})},unregisterLanguage:function(e){delete t[e];for(const t of Object.keys(o))o[t]===e&&delete o[t]},listLanguages:function(){return Object.keys(t)},getLanguage:_,registerAliases:O,autoDetection:S,inherit:oe,addPlugin:function(e){!function(e){e["before:highlightBlock"]&&!e["before:highlightElement"]&&(e["before:highlightElement"]=t=>{e["before:highlightBlock"](Object.assign({block:t.el},t))}),e["after:highlightBlock"]&&!e["after:highlightElement"]&&(e["after:highlightElement"]=t=>{e["after:highlightBlock"](Object.assign({block:t.el},t))})}(e),r.push(e)},removePlugin:function(e){const t=r.indexOf(e);-1!==t&&r.splice(t,1)}}),e.debugMode=function(){a=!1},e.safeMode=function(){a=!0},e.versionString="11.11.1",e.regex={concat:f,lookahead:g,either:m,optional:p,anyNumberOfTimes:h};for(const i in D)"object"==typeof D[i]&&n(D[i]);return Object.assign(e,D),e},se=ae({});se.newInstance=()=>ae({}),t.exports=se,se.HighlightJS=se,se.default=se})()).default;function v(e,t=[]){return e.flatMap(e=>{const n=[...t,...e.properties?e.properties.className:[]];return e.children?v(e.children,n):{text:e.value,classes:n}})}function _(e){return e.value||e.children||[]}function O({doc:e,name:t,lowlight:n,defaultLanguage:i}){const o=[];return c(e,e=>e.type.name===t).forEach(e=>{var t;let r=e.pos+1;const a=e.node.attrs.language||i,s=n.listLanguages();var l;v(a&&(s.includes(a)||(l=a,Boolean(E.getLanguage(l)))||(null==(t=n.registered)?void 0:t.call(n,a)))?_(n.highlight(a,e.node.textContent)):_(n.highlightAuto(e.node.textContent))).forEach(e=>{const t=r+e.text.length;if(e.classes.length){const n=m.inline(r,t,{class:e.classes.join(" ")});o.push(n)}r=t})}),b.create(e,o)}function S({name:e,lowlight:t,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(e=>"function"==typeof t[e]))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const i=new g({key:new h("lowlight"),state:{init:(i,{doc:o})=>O({doc:o,name:e,lowlight:t,defaultLanguage:n}),apply:(i,o,r,a)=>{const s=r.selection.$head.parent.type.name,l=a.selection.$head.parent.type.name,u=c(r.doc,t=>t.type.name===e),d=c(a.doc,t=>t.type.name===e);return i.docChanged&&([s,l].includes(e)||d.length!==u.length||i.steps.some(e=>void 0!==e.from&&void 0!==e.to&&u.some(t=>t.pos>=e.from&&t.pos+t.node.nodeSize<=e.to)))?O({doc:i.doc,name:e,lowlight:t,defaultLanguage:n}):o.map(i.mapping,i.doc)}},props:{decorations:e=>i.getState(e)}});return i}function k(){const e=o(M.name),{icon:t,tooltip:r,tooltipOptions:l={},action:c,isActive:u}=e?.componentProps??{},{dataState:d,disabled:g,update:h}=i(u);return e?/* @__PURE__ */s(n,{action:()=>{g||c&&(c(),h())},dataState:d,disabled:g,icon:t,tooltip:r,tooltipOptions:l}):/* @__PURE__ */s(a,{})}var M=y.extend({addOptions(){var e;return{...null==(e=this.parent)?void 0:e.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},addProseMirrorPlugins(){var e;return[...(null==(e=this.parent)?void 0:e.call(this))||[],S({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}}).extend({addOptions(){return{...this.parent?.(),button:({editor:e,t:t})=>({componentProps:{action:()=>e.chain().focus().setCodeBlock({language:"plaintext"}).run(),isActive:()=>e.isActive("codeBlock"),disabled:!1,icon:"Code2",tooltip:t("editor.codeblock.tooltip")}})}}});export{k as n,M as t};
|
|
1
|
+
import{o as e,t}from"./rolldown-runtime-Drgf5FY8.js";import{n}from"./toggle-BXl_NYYh.js";import{c as i,t as o}from"./useButtonProps-DSIajp_B.js";import r from"react";import{Fragment as a,jsx as s}from"react/jsx-runtime";import{Node as l,findChildren as c,mergeAttributes as u,textblockTypeInputRule as d}from"@tiptap/core";import{Plugin as g,PluginKey as h,Selection as p,TextSelection as f}from"@tiptap/pm/state";import{Decoration as m,DecorationSet as b}from"@tiptap/pm/view";var x=/^```([a-z]+)?[\s\n]$/,w=/^~~~([a-z]+)?[\s\n]$/,y=l.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;const{languageClassPrefix:n}=this.options;if(!n)return null;const i=[...(null==(t=e.firstElementChild)?void 0:t.classList)||[]].filter(e=>e.startsWith(n)).map(e=>e.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:t}){return["pre",u(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(e,t)=>{var n,i;return!1===(null==(n=e.raw)?void 0:n.startsWith("```"))&&!1===(null==(i=e.raw)?void 0:i.startsWith("~~~"))&&"indented"!==e.codeBlockStyle?[]:t.createNode("codeBlock",{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[])},renderMarkdown:(e,t)=>{var n;let i="";const o=(null==(n=e.attrs)?void 0:n.language)||"";return i=e.content?[`\`\`\`${o}`,t.renderChildren(e.content),"```"].join("\n"):`\`\`\`${o}\n\n\`\`\``,i},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=1===t.pos;return!(!e||t.parent.type.name!==this.name)&&(!(!n&&t.parent.textContent.length)&&this.editor.commands.clearNodes())},Tab:({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=null!=(t=this.options.tabSize)?t:4,{state:i}=e,{selection:o}=i,{$from:r,empty:a}=o;if(r.parent.type!==this.type)return!1;const s=" ".repeat(n);return a?e.commands.insertContent(s):e.commands.command(({tr:e})=>{const{from:t,to:n}=o,r=i.doc.textBetween(t,n,"\n","\n").split("\n").map(e=>s+e).join("\n");return e.replaceWith(t,n,i.schema.text(r)),!0})},"Shift-Tab":({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=null!=(t=this.options.tabSize)?t:4,{state:i}=e,{selection:o}=i,{$from:r,empty:a}=o;return r.parent.type===this.type&&(a?e.commands.command(({tr:e})=>{var t;const{pos:o}=r,a=r.start(),s=r.end(),l=i.doc.textBetween(a,s,"\n","\n").split("\n");let c=0,u=0;const d=o-a;for(let n=0;n<l.length;n+=1){if(u+l[n].length>=d){c=n;break}u+=l[n].length+1}const g=(null==(t=l[c].match(/^ */))?void 0:t[0])||"",h=Math.min(g.length,n);if(0===h)return!0;let p=a;for(let n=0;n<c;n+=1)p+=l[n].length+1;return e.delete(p,p+h),o-p<=h&&e.setSelection(f.create(e.doc,p)),!0}):e.commands.command(({tr:e})=>{const{from:t,to:r}=o,a=i.doc.textBetween(t,r,"\n","\n").split("\n").map(e=>{var t;const i=(null==(t=e.match(/^ */))?void 0:t[0])||"",o=Math.min(i.length,n);return e.slice(o)}).join("\n");return e.replaceWith(t,r,i.schema.text(a)),!0}))},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:n}=t,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type)return!1;const r=i.parentOffset===i.parent.nodeSize-2,a=i.parent.textContent.endsWith("\n\n");return!(!r||!a)&&e.chain().command(({tr:e})=>(e.delete(i.pos-2,i.pos),!0)).exitCode().run()},ArrowUp:({editor:e})=>{if(!this.options.exitOnArrowUp)return!1;const{state:t}=e,{selection:n}=t,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type)return!1;if(0!==i.parentOffset)return!1;const r=i.before();return!(r>0)&&e.commands.insertDefaultBlock({pos:r})},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:i}=t,{$from:o,empty:r}=n;if(!r||o.parent.type!==this.type)return!1;if(o.parentOffset!==o.parent.nodeSize-2)return!1;const a=o.after();return void 0!==a&&(i.nodeAt(a)?e.commands.command(({tr:e})=>(e.setSelection(p.near(i.resolve(a))),!0)):e.commands.exitCode())}}},addInputRules(){return[d({find:x,type:this.type,getAttributes:e=>({language:e[1]})}),d({find:w,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new g({key:new h("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData)return!1;if(this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),i=t.clipboardData.getData("vscode-editor-data"),o=i?JSON.parse(i):void 0,r=null==o?void 0:o.mode;if(!n||!r)return!1;const{tr:a,schema:s}=e.state,l=s.text(n.replace(/\r\n?/g,"\n"));return a.replaceSelectionWith(this.type.create({language:r},l)),a.selection.$from.parent.type!==this.type&&a.setSelection(f.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta("paste",!0),e.dispatch(a),!0}}})]}}),E=/* @__PURE__ */e(/* @__PURE__ */t((e,t)=>{function n(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{const i=e[t],o=typeof i;"object"!==o&&"function"!==o||Object.isFrozen(i)||n(i)}),e}var i=class{constructor(e){void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function o(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function r(e,...t){const n=Object.create(null);for(const i in e)n[i]=e[i];return t.forEach(function(e){for(const t in e)n[t]=e[t]}),n}var a=e=>!!e.scope,s=class{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=o(e)}openNode(e){if(!a(e))return;const t=((e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const n=e.split(".");return[`${t}${n.shift()}`,...n.map((e,t)=>`${e}${"_".repeat(t+1)}`)].join(" ")}return`${t}${e}`})(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){a(e)&&(this.buffer+="</span>")}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}},l=(e={})=>{const t={children:[]};return Object.assign(t,e),t},c=class e{constructor(){this.rootNode=l(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const t=l({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return"string"==typeof t?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(t){"string"!=typeof t&&t.children&&(t.children.every(e=>"string"==typeof e)?t.children=[t.children.join("")]:t.children.forEach(t=>{e._collapse(t)}))}},u=class extends c{constructor(e){super(),this.options=e}addText(e){""!==e&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){const n=e.root;t&&(n.scope=`language:${t}`),this.add(n)}toHTML(){return new s(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function d(e){return e?"string"==typeof e?e:e.source:null}function g(e){return f("(?=",e,")")}function h(e){return f("(?:",e,")*")}function p(e){return f("(?:",e,")?")}function f(...e){return e.map(e=>d(e)).join("")}function m(...e){return"("+(function(e){const t=e[e.length-1];return"object"==typeof t&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}(e).capture?"":"?:")+e.map(e=>d(e)).join("|")+")"}function b(e){return new RegExp(e.toString()+"|").exec("").length-1}var x=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function w(e,{joinWith:t}){let n=0;return e.map(e=>{n+=1;const t=n;let i=d(e),o="";for(;i.length>0;){const e=x.exec(i);if(!e){o+=i;break}o+=i.substring(0,e.index),i=i.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?o+="\\"+String(Number(e[1])+t):(o+=e[0],"("===e[0]&&n++)}return o}).map(e=>`(${e})`).join(t)}var y="[a-zA-Z]\\w*",E="[a-zA-Z_]\\w*",v="\\b\\d+(\\.\\d+)?",_="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",O="\\b(0b[01]+)",S={begin:"\\\\[\\s\\S]",relevance:0},k={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[S]},M={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[S]},A=function(e,t,n={}){const i=r({scope:"comment",begin:e,end:t,contains:[]},n);i.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const o=m("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return i.contains.push({begin:f(/[ ]+/,"(",o,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),i},N=A("//","$"),T=A("/\\*","\\*/"),R=A("#","$"),L={scope:"number",begin:v,relevance:0},j={scope:"number",begin:_,relevance:0},I={scope:"number",begin:O,relevance:0},B={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[S,{begin:/\[/,end:/\]/,relevance:0,contains:[S]}]},C={scope:"title",begin:y,relevance:0},P={scope:"title",begin:E,relevance:0},D=/*#__PURE__*/Object.freeze({__proto__:null,APOS_STRING_MODE:k,BACKSLASH_ESCAPE:S,BINARY_NUMBER_MODE:I,BINARY_NUMBER_RE:O,COMMENT:A,C_BLOCK_COMMENT_MODE:T,C_LINE_COMMENT_MODE:N,C_NUMBER_MODE:j,C_NUMBER_RE:_,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:R,IDENT_RE:y,MATCH_NOTHING_RE:/\b\B/,METHOD_GUARD:{begin:"\\.\\s*[a-zA-Z_]\\w*",relevance:0},NUMBER_MODE:L,NUMBER_RE:v,PHRASAL_WORDS_MODE:{begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},QUOTE_STRING_MODE:M,REGEXP_MODE:B,RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",SHEBANG:(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=f(t,/.*\b/,e.binary,/\b.*/)),r({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{0!==e.index&&t.ignoreMatch()}},e)},TITLE_MODE:C,UNDERSCORE_IDENT_RE:E,UNDERSCORE_TITLE_MODE:P});function H(e,t){"."===e.input[e.index-1]&&t.ignoreMatch()}function $(e,t){void 0!==e.className&&(e.scope=e.className,delete e.className)}function z(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=H,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,void 0===e.relevance&&(e.relevance=0))}function U(e,t){Array.isArray(e.illegal)&&(e.illegal=m(...e.illegal))}function W(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function X(e,t){void 0===e.relevance&&(e.relevance=1)}var G=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},e);Object.keys(e).forEach(t=>{delete e[t]}),e.keywords=n.keywords,e.begin=f(n.beforeMatch,g(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},K=["of","and","for","in","not","or","if","then","parent","list","value"];function Z(e,t,n="keyword"){const i=Object.create(null);return"string"==typeof e?o(n,e.split(" ")):Array.isArray(e)?o(n,e):Object.keys(e).forEach(function(n){Object.assign(i,Z(e[n],t,n))}),i;function o(e,n){t&&(n=n.map(e=>e.toLowerCase())),n.forEach(function(t){const n=t.split("|");i[n[0]]=[e,F(n[0],n[1])]})}}function F(e,t){return t?Number(t):function(e){return K.includes(e.toLowerCase())}(e)?0:1}var V={},J=(e,t)=>{V[`${e}/${t}`]||(V[`${e}/${t}`]=!0)},Y=/* @__PURE__ */new Error;function q(e,t,{key:n}){let i=0;const o=e[n],r={},a={};for(let s=1;s<=t.length;s++)a[s+i]=o[s],r[s+i]=!0,i+=b(t[s-1]);e[n]=a,e[n]._emit=r,e[n]._multi=!0}function Q(e){!function(e){e.scope&&"object"==typeof e.scope&&null!==e.scope&&(e.beginScope=e.scope,delete e.scope)}(e),"string"==typeof e.beginScope&&(e.beginScope={_wrap:e.beginScope}),"string"==typeof e.endScope&&(e.endScope={_wrap:e.endScope}),function(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw Y;if("object"!=typeof e.beginScope||null===e.beginScope)throw Y;q(e,e.begin,{key:"beginScope"}),e.begin=w(e.begin,{joinWith:""})}}(e),function(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw Y;if("object"!=typeof e.endScope||null===e.endScope)throw Y;q(e,e.end,{key:"endScope"}),e.end=w(e.end,{joinWith:""})}}(e)}function ee(e){function t(t,n){return new RegExp(d(t),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(n?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=b(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null);const e=this.regexes.map(e=>e[1]);this.matcherRe=t(w(e,{joinWith:"|"}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;const t=this.matcherRe.exec(e);if(!t)return null;const n=t.findIndex((e,t)=>t>0&&void 0!==e),i=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,i)}}class i{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];const t=new n;return this.rules.slice(e).forEach(([e,n])=>t.addRule(e,n)),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),"begin"===t.type&&this.count++}exec(e){const t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition())if(n&&n.index===this.lastIndex);else{const t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=r(e.classNameAliases||{}),function n(o,a){const s=o;if(o.isCompiled)return s;[$,W,Q,G].forEach(e=>e(o,a)),e.compilerExtensions.forEach(e=>e(o,a)),o.__beforeBegin=null,[z,U,X].forEach(e=>e(o,a)),o.isCompiled=!0;let l=null;return"object"==typeof o.keywords&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),l=o.keywords.$pattern,delete o.keywords.$pattern),l=l||/\w+/,o.keywords&&(o.keywords=Z(o.keywords,e.case_insensitive)),s.keywordPatternRe=t(l,!0),a&&(o.begin||(o.begin=/\B|\b/),s.beginRe=t(s.begin),o.end||o.endsWithParent||(o.end=/\B|\b/),o.end&&(s.endRe=t(s.end)),s.terminatorEnd=d(s.end)||"",o.endsWithParent&&a.terminatorEnd&&(s.terminatorEnd+=(o.end?"|":"")+a.terminatorEnd)),o.illegal&&(s.illegalRe=t(o.illegal)),o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map(function(e){return function(e){e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return r(e,{variants:null},t)}));return e.cachedVariants?e.cachedVariants:te(e)?r(e,{starts:e.starts?r(e.starts):null}):Object.isFrozen(e)?r(e):e}("self"===e?o:e)})),o.contains.forEach(function(e){n(e,s)}),o.starts&&n(o.starts,a),s.matcher=function(e){const t=new i;return e.contains.forEach(e=>t.addRule(e.begin,{rule:e,type:"begin"})),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:"end"}),e.illegal&&t.addRule(e.illegal,{type:"illegal"}),t}(s),s}(e)}function te(e){return!!e&&(e.endsWithParent||te(e.starts))}var ne=class extends Error{constructor(e,t){super(e),this.name="HTMLInjectionError",this.html=t}},ie=o,oe=r,re=Symbol("nomatch"),ae=function(e){const t=Object.create(null),o=Object.create(null),r=[];let a=!0;const s="Could not find the language '{}', did you forget to load/include a language module?",l={disableAutodetect:!0,name:"Plain text",contains:[]};let c={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:u};function d(e){return c.noHighlightRe.test(e)}function b(e,t,n){let i="",o="";"object"==typeof t?(i=e,n=t.ignoreIllegals,o=t.language):(J("10.7.0","highlight(lang, code, ...args) has been deprecated."),J("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"),o=e,i=t),void 0===n&&(n=!0);const r={code:i,language:o};k("before:highlight",r);const a=r.result?r.result:x(r.language,r.code,n);return a.code=r.code,k("after:highlight",a),a}function x(e,n,o,r){const l=Object.create(null);function u(e,t){return e.keywords[t]}function d(){if(!M.keywords)return void N.addText(T);let e=0;M.keywordPatternRe.lastIndex=0;let t=M.keywordPatternRe.exec(T),n="";for(;t;){n+=T.substring(e,t.index);const i=O.case_insensitive?t[0].toLowerCase():t[0],o=u(M,i);if(o){const[e,r]=o;if(N.addText(n),n="",l[i]=(l[i]||0)+1,l[i]<=7&&(R+=r),e.startsWith("_"))n+=t[0];else{const n=O.classNameAliases[e]||e;h(t[0],n)}}else n+=t[0];e=M.keywordPatternRe.lastIndex,t=M.keywordPatternRe.exec(T)}n+=T.substring(e),N.addText(n)}function g(){null!=M.subLanguage?function(){if(""===T)return;let e=null;if("string"==typeof M.subLanguage){if(!t[M.subLanguage])return void N.addText(T);e=x(M.subLanguage,T,!0,A[M.subLanguage]),A[M.subLanguage]=e._top}else e=w(T,M.subLanguage.length?M.subLanguage:null);M.relevance>0&&(R+=e.relevance),N.__addSublanguage(e._emitter,e.language)}():d(),T=""}function h(e,t){""!==e&&(N.startScope(t),N.addText(e),N.endScope())}function p(e,t){let n=1;const i=t.length-1;for(;n<=i;){if(!e._emit[n]){n++;continue}const i=O.classNameAliases[e[n]]||e[n],o=t[n];i?h(o,i):(T=o,d(),T=""),n++}}function f(e,t){return e.scope&&"string"==typeof e.scope&&N.openNode(O.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(h(T,O.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),T=""):e.beginScope._multi&&(p(e.beginScope,t),T="")),M=Object.create(e,{parent:{value:M}}),M}function m(e,t,n){let o=function(e,t){const n=e&&e.exec(t);return n&&0===n.index}(e.endRe,n);if(o){if(e["on:end"]){const n=new i(e);e["on:end"](t,n),n.isMatchIgnored&&(o=!1)}if(o){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return m(e.parent,t,n)}function b(e){return 0===M.matcher.regexIndex?(T+=e[0],1):(I=!0,0)}function y(e){const t=e[0],i=n.substring(e.index),o=m(M,e,i);if(!o)return re;const r=M;M.endScope&&M.endScope._wrap?(g(),h(t,M.endScope._wrap)):M.endScope&&M.endScope._multi?(g(),p(M.endScope,e)):r.skip?T+=t:(r.returnEnd||r.excludeEnd||(T+=t),g(),r.excludeEnd&&(T=t));do{M.scope&&N.closeNode(),M.skip||M.subLanguage||(R+=M.relevance),M=M.parent}while(M!==o.parent);return o.starts&&f(o.starts,e),r.returnEnd?0:t.length}let E={};function v(t,r){const s=r&&r[0];if(T+=t,null==s)return g(),0;if("begin"===E.type&&"end"===r.type&&E.index===r.index&&""===s){if(T+=n.slice(r.index,r.index+1),!a){const t=/* @__PURE__ */new Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=E.rule,t}return 1}if(E=r,"begin"===r.type)return function(e){const t=e[0],n=e.rule,o=new i(n),r=[n.__beforeBegin,n["on:begin"]];for(const i of r)if(i&&(i(e,o),o.isMatchIgnored))return b(t);return n.skip?T+=t:(n.excludeBegin&&(T+=t),g(),n.returnBegin||n.excludeBegin||(T=t)),f(n,e),n.returnBegin?0:t.length}(r);if("illegal"===r.type&&!o){const e=/* @__PURE__ */new Error('Illegal lexeme "'+s+'" for mode "'+(M.scope||"<unnamed>")+'"');throw e.mode=M,e}if("end"===r.type){const e=y(r);if(e!==re)return e}if("illegal"===r.type&&""===s)return T+="\n",1;if(j>1e5&&j>3*r.index)/* @__PURE__ */throw new Error("potential infinite loop, way more iterations than matches");return T+=s,s.length}const O=_(e);if(!O)throw s.replace("{}",e),new Error('Unknown language: "'+e+'"');const S=ee(O);let k="",M=r||S;const A={},N=new c.__emitter(c);!function(){const e=[];for(let t=M;t!==O;t=t.parent)t.scope&&e.unshift(t.scope);e.forEach(e=>N.openNode(e))}();let T="",R=0,L=0,j=0,I=!1;try{if(O.__emitTokens)O.__emitTokens(n,N);else{for(M.matcher.considerAll();;){j++,I?I=!1:M.matcher.considerAll(),M.matcher.lastIndex=L;const e=M.matcher.exec(n);if(!e)break;const t=v(n.substring(L,e.index),e);L=e.index+t}v(n.substring(L))}return N.finalize(),k=N.toHTML(),{language:e,value:k,relevance:R,illegal:!1,_emitter:N,_top:M}}catch(B){if(B.message&&B.message.includes("Illegal"))return{language:e,value:ie(n),illegal:!0,relevance:0,_illegalBy:{message:B.message,index:L,context:n.slice(L-100,L+100),mode:B.mode,resultSoFar:k},_emitter:N};if(a)return{language:e,value:ie(n),illegal:!1,relevance:0,errorRaised:B,_emitter:N,_top:M};throw B}}function w(e,n){n=n||c.languages||Object.keys(t);const i=function(e){const t={value:ie(e),illegal:!1,relevance:0,_top:l,_emitter:new c.__emitter(c)};return t._emitter.addText(e),t}(e),o=n.filter(_).filter(S).map(t=>x(t,e,!1));o.unshift(i);const[r,a]=o.sort((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(_(e.language).supersetOf===t.language)return 1;if(_(t.language).supersetOf===e.language)return-1}return 0}),s=r;return s.secondBest=a,s}function y(e){let t=null;const n=function(e){let t=e.className+" ";t+=e.parentNode?e.parentNode.className:"";const n=c.languageDetectRe.exec(t);if(n){const e=_(n[1]);return e||s.replace("{}",n[1]),e?n[1]:"no-highlight"}return t.split(/\s+/).find(e=>d(e)||_(e))}(e);if(d(n))return;if(k("before:highlightElement",{el:e,language:n}),e.dataset.highlighted)return;if(e.children.length>0&&(c.ignoreUnescapedHTML,c.throwUnescapedHTML))throw new ne("One of your code blocks includes unescaped HTML.",e.innerHTML);t=e;const i=t.textContent,r=n?b(i,{language:n,ignoreIllegals:!0}):w(i);e.innerHTML=r.value,e.dataset.highlighted="yes",function(e,t,n){const i=t&&o[t]||n;e.classList.add("hljs"),e.classList.add(`language-${i}`)}(e,n,r.language),e.result={language:r.language,re:r.relevance,relevance:r.relevance},r.secondBest&&(e.secondBest={language:r.secondBest.language,relevance:r.secondBest.relevance}),k("after:highlightElement",{el:e,result:r,text:i})}let E=!1;function v(){if("loading"===document.readyState)return E||window.addEventListener("DOMContentLoaded",function(){v()},!1),void(E=!0);document.querySelectorAll(c.cssSelector).forEach(y)}function _(e){return e=(e||"").toLowerCase(),t[e]||t[o[e]]}function O(e,{languageName:t}){"string"==typeof e&&(e=[e]),e.forEach(e=>{o[e.toLowerCase()]=t})}function S(e){const t=_(e);return t&&!t.disableAutodetect}function k(e,t){const n=e;r.forEach(function(e){e[n]&&e[n](t)})}Object.assign(e,{highlight:b,highlightAuto:w,highlightAll:v,highlightElement:y,highlightBlock:function(e){return J("10.7.0","highlightBlock will be removed entirely in v12.0"),J("10.7.0","Please use highlightElement now."),y(e)},configure:function(e){c=oe(c,e)},initHighlighting:()=>{v(),J("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")},initHighlightingOnLoad:function(){v(),J("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")},registerLanguage:function(n,i){let o=null;try{o=i(e)}catch(r){if("Language definition for '{}' could not be registered.".replace("{}",n),!a)throw r;o=l}o.name||(o.name=n),t[n]=o,o.rawDefinition=i.bind(null,e),o.aliases&&O(o.aliases,{languageName:n})},unregisterLanguage:function(e){delete t[e];for(const t of Object.keys(o))o[t]===e&&delete o[t]},listLanguages:function(){return Object.keys(t)},getLanguage:_,registerAliases:O,autoDetection:S,inherit:oe,addPlugin:function(e){!function(e){e["before:highlightBlock"]&&!e["before:highlightElement"]&&(e["before:highlightElement"]=t=>{e["before:highlightBlock"](Object.assign({block:t.el},t))}),e["after:highlightBlock"]&&!e["after:highlightElement"]&&(e["after:highlightElement"]=t=>{e["after:highlightBlock"](Object.assign({block:t.el},t))})}(e),r.push(e)},removePlugin:function(e){const t=r.indexOf(e);-1!==t&&r.splice(t,1)}}),e.debugMode=function(){a=!1},e.safeMode=function(){a=!0},e.versionString="11.11.1",e.regex={concat:f,lookahead:g,either:m,optional:p,anyNumberOfTimes:h};for(const i in D)"object"==typeof D[i]&&n(D[i]);return Object.assign(e,D),e},se=ae({});se.newInstance=()=>ae({}),t.exports=se,se.HighlightJS=se,se.default=se})()).default;function v(e,t=[]){return e.flatMap(e=>{const n=[...t,...e.properties?e.properties.className:[]];return e.children?v(e.children,n):{text:e.value,classes:n}})}function _(e){return e.value||e.children||[]}function O({doc:e,name:t,lowlight:n,defaultLanguage:i}){const o=[];return c(e,e=>e.type.name===t).forEach(e=>{var t;let r=e.pos+1;const a=e.node.attrs.language||i,s=n.listLanguages();var l;v(a&&(s.includes(a)||(l=a,Boolean(E.getLanguage(l)))||(null==(t=n.registered)?void 0:t.call(n,a)))?_(n.highlight(a,e.node.textContent)):_(n.highlightAuto(e.node.textContent))).forEach(e=>{const t=r+e.text.length;if(e.classes.length){const n=m.inline(r,t,{class:e.classes.join(" ")});o.push(n)}r=t})}),b.create(e,o)}function S({name:e,lowlight:t,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(e=>"function"==typeof t[e]))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const i=new g({key:new h("lowlight"),state:{init:(i,{doc:o})=>O({doc:o,name:e,lowlight:t,defaultLanguage:n}),apply:(i,o,r,a)=>{const s=r.selection.$head.parent.type.name,l=a.selection.$head.parent.type.name,u=c(r.doc,t=>t.type.name===e),d=c(a.doc,t=>t.type.name===e);return i.docChanged&&([s,l].includes(e)||d.length!==u.length||i.steps.some(e=>void 0!==e.from&&void 0!==e.to&&u.some(t=>t.pos>=e.from&&t.pos+t.node.nodeSize<=e.to)))?O({doc:i.doc,name:e,lowlight:t,defaultLanguage:n}):o.map(i.mapping,i.doc)}},props:{decorations:e=>i.getState(e)}});return i}function k(){const e=o(M.name),{icon:t,tooltip:r,tooltipOptions:l={},action:c,isActive:u}=e?.componentProps??{},{dataState:d,disabled:g,update:h}=i(u);return e?/* @__PURE__ */s(n,{action:()=>{g||c&&(c(),h())},dataState:d,disabled:g,icon:t,tooltip:r,tooltipOptions:l}):/* @__PURE__ */s(a,{})}var M=y.extend({addOptions(){var e;return{...null==(e=this.parent)?void 0:e.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},addProseMirrorPlugins(){var e;return[...(null==(e=this.parent)?void 0:e.call(this))||[],S({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}}).extend({addOptions(){return{...this.parent?.(),button:({editor:e,t:t})=>({componentProps:{action:()=>e.chain().focus().setCodeBlock({language:"plaintext"}).run(),isActive:()=>e.isActive("codeBlock"),disabled:!1,icon:"Code2",tooltip:t("editor.codeblock.tooltip")}})}}});export{k as n,M as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-BeavJI0R.cjs"),t=require("./toggle-CRftKzl0.cjs"),n=require("./useButtonProps-D2Hd5DbR.cjs");let i=require("react");i=e.__toESM(i,1);let o=require("react/jsx-runtime"),r=require("@tiptap/core"),a=require("@tiptap/pm/state"),s=require("@tiptap/pm/view");var l=/^```([a-z]+)?[\s\n]$/,c=/^~~~([a-z]+)?[\s\n]$/,u=r.Node.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;const{languageClassPrefix:n}=this.options;if(!n)return null;const i=[...(null==(t=e.firstElementChild)?void 0:t.classList)||[]].filter(e=>e.startsWith(n)).map(e=>e.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:t}){return["pre",(0,r.mergeAttributes)(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(e,t)=>{var n,i;return!1===(null==(n=e.raw)?void 0:n.startsWith("```"))&&!1===(null==(i=e.raw)?void 0:i.startsWith("~~~"))&&"indented"!==e.codeBlockStyle?[]:t.createNode("codeBlock",{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[])},renderMarkdown:(e,t)=>{var n;let i="";const o=(null==(n=e.attrs)?void 0:n.language)||"";return i=e.content?[`\`\`\`${o}`,t.renderChildren(e.content),"```"].join("\n"):`\`\`\`${o}\n\n\`\`\``,i},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=1===t.pos;return!(!e||t.parent.type.name!==this.name)&&(!(!n&&t.parent.textContent.length)&&this.editor.commands.clearNodes())},Tab:({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=null!=(t=this.options.tabSize)?t:4,{state:i}=e,{selection:o}=i,{$from:r,empty:a}=o;if(r.parent.type!==this.type)return!1;const s=" ".repeat(n);return a?e.commands.insertContent(s):e.commands.command(({tr:e})=>{const{from:t,to:n}=o,r=i.doc.textBetween(t,n,"\n","\n").split("\n").map(e=>s+e).join("\n");return e.replaceWith(t,n,i.schema.text(r)),!0})},"Shift-Tab":({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=null!=(t=this.options.tabSize)?t:4,{state:i}=e,{selection:o}=i,{$from:r,empty:s}=o;return r.parent.type===this.type&&(s?e.commands.command(({tr:e})=>{var t;const{pos:o}=r,s=r.start(),l=r.end(),c=i.doc.textBetween(s,l,"\n","\n").split("\n");let u=0,d=0;const g=o-s;for(let n=0;n<c.length;n+=1){if(d+c[n].length>=g){u=n;break}d+=c[n].length+1}const h=(null==(t=c[u].match(/^ */))?void 0:t[0])||"",p=Math.min(h.length,n);if(0===p)return!0;let f=s;for(let n=0;n<u;n+=1)f+=c[n].length+1;return e.delete(f,f+p),o-f<=p&&e.setSelection(a.TextSelection.create(e.doc,f)),!0}):e.commands.command(({tr:e})=>{const{from:t,to:r}=o,a=i.doc.textBetween(t,r,"\n","\n").split("\n").map(e=>{var t;const i=(null==(t=e.match(/^ */))?void 0:t[0])||"",o=Math.min(i.length,n);return e.slice(o)}).join("\n");return e.replaceWith(t,r,i.schema.text(a)),!0}))},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:n}=t,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type)return!1;const r=i.parentOffset===i.parent.nodeSize-2,a=i.parent.textContent.endsWith("\n\n");return!(!r||!a)&&e.chain().command(({tr:e})=>(e.delete(i.pos-2,i.pos),!0)).exitCode().run()},ArrowUp:({editor:e})=>{if(!this.options.exitOnArrowUp)return!1;const{state:t}=e,{selection:n}=t,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type)return!1;if(0!==i.parentOffset)return!1;const r=i.before();return!(r>0)&&e.commands.insertDefaultBlock({pos:r})},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:i}=t,{$from:o,empty:r}=n;if(!r||o.parent.type!==this.type)return!1;if(o.parentOffset!==o.parent.nodeSize-2)return!1;const s=o.after();return void 0!==s&&(i.nodeAt(s)?e.commands.command(({tr:e})=>(e.setSelection(a.Selection.near(i.resolve(s))),!0)):e.commands.exitCode())}}},addInputRules(){return[(0,r.textblockTypeInputRule)({find:l,type:this.type,getAttributes:e=>({language:e[1]})}),(0,r.textblockTypeInputRule)({find:c,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new a.Plugin({key:new a.PluginKey("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData)return!1;if(this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),i=t.clipboardData.getData("vscode-editor-data"),o=i?JSON.parse(i):void 0,r=null==o?void 0:o.mode;if(!n||!r)return!1;const{tr:s,schema:l}=e.state,c=l.text(n.replace(/\r\n?/g,"\n"));return s.replaceSelectionWith(this.type.create({language:r},c)),s.selection.$from.parent.type!==this.type&&s.setSelection(a.TextSelection.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),e.dispatch(s),!0}}})]}}),d=e.__commonJSMin((e,t)=>{function n(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{const i=e[t],o=typeof i;"object"!==o&&"function"!==o||Object.isFrozen(i)||n(i)}),e}var i=class{constructor(e){void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function o(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function r(e,...t){const n=Object.create(null);for(const i in e)n[i]=e[i];return t.forEach(function(e){for(const t in e)n[t]=e[t]}),n}var a=e=>!!e.scope,s=class{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=o(e)}openNode(e){if(!a(e))return;const t=((e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const n=e.split(".");return[`${t}${n.shift()}`,...n.map((e,t)=>`${e}${"_".repeat(t+1)}`)].join(" ")}return`${t}${e}`})(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){a(e)&&(this.buffer+="</span>")}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}},l=(e={})=>{const t={children:[]};return Object.assign(t,e),t},c=class e{constructor(){this.rootNode=l(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const t=l({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return"string"==typeof t?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(t){"string"!=typeof t&&t.children&&(t.children.every(e=>"string"==typeof e)?t.children=[t.children.join("")]:t.children.forEach(t=>{e._collapse(t)}))}},u=class extends c{constructor(e){super(),this.options=e}addText(e){""!==e&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){const n=e.root;t&&(n.scope=`language:${t}`),this.add(n)}toHTML(){return new s(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function d(e){return e?"string"==typeof e?e:e.source:null}function g(e){return f("(?=",e,")")}function h(e){return f("(?:",e,")*")}function p(e){return f("(?:",e,")?")}function f(...e){return e.map(e=>d(e)).join("")}function m(...e){return"("+(function(e){const t=e[e.length-1];return"object"==typeof t&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}(e).capture?"":"?:")+e.map(e=>d(e)).join("|")+")"}function b(e){return new RegExp(e.toString()+"|").exec("").length-1}var x=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function w(e,{joinWith:t}){let n=0;return e.map(e=>{n+=1;const t=n;let i=d(e),o="";for(;i.length>0;){const e=x.exec(i);if(!e){o+=i;break}o+=i.substring(0,e.index),i=i.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?o+="\\"+String(Number(e[1])+t):(o+=e[0],"("===e[0]&&n++)}return o}).map(e=>`(${e})`).join(t)}var y="[a-zA-Z]\\w*",E="[a-zA-Z_]\\w*",v="\\b\\d+(\\.\\d+)?",_="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",S="\\b(0b[01]+)",O={begin:"\\\\[\\s\\S]",relevance:0},k={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[O]},M={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[O]},A=function(e,t,n={}){const i=r({scope:"comment",begin:e,end:t,contains:[]},n);i.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const o=m("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return i.contains.push({begin:f(/[ ]+/,"(",o,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),i},N=A("//","$"),T=A("/\\*","\\*/"),R=A("#","$"),j={scope:"number",begin:v,relevance:0},L={scope:"number",begin:_,relevance:0},B={scope:"number",begin:S,relevance:0},I={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[O,{begin:/\[/,end:/\]/,relevance:0,contains:[O]}]},C={scope:"title",begin:y,relevance:0},P={scope:"title",begin:E,relevance:0},D=Object.freeze({__proto__:null,APOS_STRING_MODE:k,BACKSLASH_ESCAPE:O,BINARY_NUMBER_MODE:B,BINARY_NUMBER_RE:S,COMMENT:A,C_BLOCK_COMMENT_MODE:T,C_LINE_COMMENT_MODE:N,C_NUMBER_MODE:L,C_NUMBER_RE:_,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:R,IDENT_RE:y,MATCH_NOTHING_RE:/\b\B/,METHOD_GUARD:{begin:"\\.\\s*[a-zA-Z_]\\w*",relevance:0},NUMBER_MODE:j,NUMBER_RE:v,PHRASAL_WORDS_MODE:{begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},QUOTE_STRING_MODE:M,REGEXP_MODE:I,RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",SHEBANG:(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=f(t,/.*\b/,e.binary,/\b.*/)),r({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{0!==e.index&&t.ignoreMatch()}},e)},TITLE_MODE:C,UNDERSCORE_IDENT_RE:E,UNDERSCORE_TITLE_MODE:P});function H(e,t){"."===e.input[e.index-1]&&t.ignoreMatch()}function $(e,t){void 0!==e.className&&(e.scope=e.className,delete e.className)}function z(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=H,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,void 0===e.relevance&&(e.relevance=0))}function U(e,t){Array.isArray(e.illegal)&&(e.illegal=m(...e.illegal))}function W(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function q(e,t){void 0===e.relevance&&(e.relevance=1)}var K=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},e);Object.keys(e).forEach(t=>{delete e[t]}),e.keywords=n.keywords,e.begin=f(n.beforeMatch,g(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},X=["of","and","for","in","not","or","if","then","parent","list","value"];function G(e,t,n="keyword"){const i=Object.create(null);return"string"==typeof e?o(n,e.split(" ")):Array.isArray(e)?o(n,e):Object.keys(e).forEach(function(n){Object.assign(i,G(e[n],t,n))}),i;function o(e,n){t&&(n=n.map(e=>e.toLowerCase())),n.forEach(function(t){const n=t.split("|");i[n[0]]=[e,Z(n[0],n[1])]})}}function Z(e,t){return t?Number(t):function(e){return X.includes(e.toLowerCase())}(e)?0:1}var F={},J=(e,t)=>{F[`${e}/${t}`]||(F[`${e}/${t}`]=!0)},V=new Error;function Y(e,t,{key:n}){let i=0;const o=e[n],r={},a={};for(let s=1;s<=t.length;s++)a[s+i]=o[s],r[s+i]=!0,i+=b(t[s-1]);e[n]=a,e[n]._emit=r,e[n]._multi=!0}function Q(e){!function(e){e.scope&&"object"==typeof e.scope&&null!==e.scope&&(e.beginScope=e.scope,delete e.scope)}(e),"string"==typeof e.beginScope&&(e.beginScope={_wrap:e.beginScope}),"string"==typeof e.endScope&&(e.endScope={_wrap:e.endScope}),function(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw V;if("object"!=typeof e.beginScope||null===e.beginScope)throw V;Y(e,e.begin,{key:"beginScope"}),e.begin=w(e.begin,{joinWith:""})}}(e),function(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw V;if("object"!=typeof e.endScope||null===e.endScope)throw V;Y(e,e.end,{key:"endScope"}),e.end=w(e.end,{joinWith:""})}}(e)}function ee(e){function t(t,n){return new RegExp(d(t),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(n?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=b(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null);const e=this.regexes.map(e=>e[1]);this.matcherRe=t(w(e,{joinWith:"|"}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;const t=this.matcherRe.exec(e);if(!t)return null;const n=t.findIndex((e,t)=>t>0&&void 0!==e),i=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,i)}}class i{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];const t=new n;return this.rules.slice(e).forEach(([e,n])=>t.addRule(e,n)),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),"begin"===t.type&&this.count++}exec(e){const t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition())if(n&&n.index===this.lastIndex);else{const t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=r(e.classNameAliases||{}),function n(o,a){const s=o;if(o.isCompiled)return s;[$,W,Q,K].forEach(e=>e(o,a)),e.compilerExtensions.forEach(e=>e(o,a)),o.__beforeBegin=null,[z,U,q].forEach(e=>e(o,a)),o.isCompiled=!0;let l=null;return"object"==typeof o.keywords&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),l=o.keywords.$pattern,delete o.keywords.$pattern),l=l||/\w+/,o.keywords&&(o.keywords=G(o.keywords,e.case_insensitive)),s.keywordPatternRe=t(l,!0),a&&(o.begin||(o.begin=/\B|\b/),s.beginRe=t(s.begin),o.end||o.endsWithParent||(o.end=/\B|\b/),o.end&&(s.endRe=t(s.end)),s.terminatorEnd=d(s.end)||"",o.endsWithParent&&a.terminatorEnd&&(s.terminatorEnd+=(o.end?"|":"")+a.terminatorEnd)),o.illegal&&(s.illegalRe=t(o.illegal)),o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map(function(e){return function(e){e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return r(e,{variants:null},t)}));return e.cachedVariants?e.cachedVariants:te(e)?r(e,{starts:e.starts?r(e.starts):null}):Object.isFrozen(e)?r(e):e}("self"===e?o:e)})),o.contains.forEach(function(e){n(e,s)}),o.starts&&n(o.starts,a),s.matcher=function(e){const t=new i;return e.contains.forEach(e=>t.addRule(e.begin,{rule:e,type:"begin"})),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:"end"}),e.illegal&&t.addRule(e.illegal,{type:"illegal"}),t}(s),s}(e)}function te(e){return!!e&&(e.endsWithParent||te(e.starts))}var ne=class extends Error{constructor(e,t){super(e),this.name="HTMLInjectionError",this.html=t}},ie=o,oe=r,re=Symbol("nomatch"),ae=function(e){const t=Object.create(null),o=Object.create(null),r=[];let a=!0;const s="Could not find the language '{}', did you forget to load/include a language module?",l={disableAutodetect:!0,name:"Plain text",contains:[]};let c={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:u};function d(e){return c.noHighlightRe.test(e)}function b(e,t,n){let i="",o="";"object"==typeof t?(i=e,n=t.ignoreIllegals,o=t.language):(J("10.7.0","highlight(lang, code, ...args) has been deprecated."),J("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"),o=e,i=t),void 0===n&&(n=!0);const r={code:i,language:o};k("before:highlight",r);const a=r.result?r.result:x(r.language,r.code,n);return a.code=r.code,k("after:highlight",a),a}function x(e,n,o,r){const l=Object.create(null);function u(e,t){return e.keywords[t]}function d(){if(!M.keywords)return void N.addText(T);let e=0;M.keywordPatternRe.lastIndex=0;let t=M.keywordPatternRe.exec(T),n="";for(;t;){n+=T.substring(e,t.index);const i=S.case_insensitive?t[0].toLowerCase():t[0],o=u(M,i);if(o){const[e,r]=o;if(N.addText(n),n="",l[i]=(l[i]||0)+1,l[i]<=7&&(R+=r),e.startsWith("_"))n+=t[0];else{const n=S.classNameAliases[e]||e;h(t[0],n)}}else n+=t[0];e=M.keywordPatternRe.lastIndex,t=M.keywordPatternRe.exec(T)}n+=T.substring(e),N.addText(n)}function g(){null!=M.subLanguage?function(){if(""===T)return;let e=null;if("string"==typeof M.subLanguage){if(!t[M.subLanguage])return void N.addText(T);e=x(M.subLanguage,T,!0,A[M.subLanguage]),A[M.subLanguage]=e._top}else e=w(T,M.subLanguage.length?M.subLanguage:null);M.relevance>0&&(R+=e.relevance),N.__addSublanguage(e._emitter,e.language)}():d(),T=""}function h(e,t){""!==e&&(N.startScope(t),N.addText(e),N.endScope())}function p(e,t){let n=1;const i=t.length-1;for(;n<=i;){if(!e._emit[n]){n++;continue}const i=S.classNameAliases[e[n]]||e[n],o=t[n];i?h(o,i):(T=o,d(),T=""),n++}}function f(e,t){return e.scope&&"string"==typeof e.scope&&N.openNode(S.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(h(T,S.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),T=""):e.beginScope._multi&&(p(e.beginScope,t),T="")),M=Object.create(e,{parent:{value:M}}),M}function m(e,t,n){let o=function(e,t){const n=e&&e.exec(t);return n&&0===n.index}(e.endRe,n);if(o){if(e["on:end"]){const n=new i(e);e["on:end"](t,n),n.isMatchIgnored&&(o=!1)}if(o){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return m(e.parent,t,n)}function b(e){return 0===M.matcher.regexIndex?(T+=e[0],1):(B=!0,0)}function y(e){const t=e[0],i=n.substring(e.index),o=m(M,e,i);if(!o)return re;const r=M;M.endScope&&M.endScope._wrap?(g(),h(t,M.endScope._wrap)):M.endScope&&M.endScope._multi?(g(),p(M.endScope,e)):r.skip?T+=t:(r.returnEnd||r.excludeEnd||(T+=t),g(),r.excludeEnd&&(T=t));do{M.scope&&N.closeNode(),M.skip||M.subLanguage||(R+=M.relevance),M=M.parent}while(M!==o.parent);return o.starts&&f(o.starts,e),r.returnEnd?0:t.length}let E={};function v(t,r){const s=r&&r[0];if(T+=t,null==s)return g(),0;if("begin"===E.type&&"end"===r.type&&E.index===r.index&&""===s){if(T+=n.slice(r.index,r.index+1),!a){const t=new Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=E.rule,t}return 1}if(E=r,"begin"===r.type)return function(e){const t=e[0],n=e.rule,o=new i(n),r=[n.__beforeBegin,n["on:begin"]];for(const i of r)if(i&&(i(e,o),o.isMatchIgnored))return b(t);return n.skip?T+=t:(n.excludeBegin&&(T+=t),g(),n.returnBegin||n.excludeBegin||(T=t)),f(n,e),n.returnBegin?0:t.length}(r);if("illegal"===r.type&&!o){const e=new Error('Illegal lexeme "'+s+'" for mode "'+(M.scope||"<unnamed>")+'"');throw e.mode=M,e}if("end"===r.type){const e=y(r);if(e!==re)return e}if("illegal"===r.type&&""===s)return T+="\n",1;if(L>1e5&&L>3*r.index)throw new Error("potential infinite loop, way more iterations than matches");return T+=s,s.length}const S=_(e);if(!S)throw s.replace("{}",e),new Error('Unknown language: "'+e+'"');const O=ee(S);let k="",M=r||O;const A={},N=new c.__emitter(c);!function(){const e=[];for(let t=M;t!==S;t=t.parent)t.scope&&e.unshift(t.scope);e.forEach(e=>N.openNode(e))}();let T="",R=0,j=0,L=0,B=!1;try{if(S.__emitTokens)S.__emitTokens(n,N);else{for(M.matcher.considerAll();;){L++,B?B=!1:M.matcher.considerAll(),M.matcher.lastIndex=j;const e=M.matcher.exec(n);if(!e)break;const t=v(n.substring(j,e.index),e);j=e.index+t}v(n.substring(j))}return N.finalize(),k=N.toHTML(),{language:e,value:k,relevance:R,illegal:!1,_emitter:N,_top:M}}catch(I){if(I.message&&I.message.includes("Illegal"))return{language:e,value:ie(n),illegal:!0,relevance:0,_illegalBy:{message:I.message,index:j,context:n.slice(j-100,j+100),mode:I.mode,resultSoFar:k},_emitter:N};if(a)return{language:e,value:ie(n),illegal:!1,relevance:0,errorRaised:I,_emitter:N,_top:M};throw I}}function w(e,n){n=n||c.languages||Object.keys(t);const i=function(e){const t={value:ie(e),illegal:!1,relevance:0,_top:l,_emitter:new c.__emitter(c)};return t._emitter.addText(e),t}(e),o=n.filter(_).filter(O).map(t=>x(t,e,!1));o.unshift(i);const[r,a]=o.sort((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(_(e.language).supersetOf===t.language)return 1;if(_(t.language).supersetOf===e.language)return-1}return 0}),s=r;return s.secondBest=a,s}function y(e){let t=null;const n=function(e){let t=e.className+" ";t+=e.parentNode?e.parentNode.className:"";const n=c.languageDetectRe.exec(t);if(n){const e=_(n[1]);return e||s.replace("{}",n[1]),e?n[1]:"no-highlight"}return t.split(/\s+/).find(e=>d(e)||_(e))}(e);if(d(n))return;if(k("before:highlightElement",{el:e,language:n}),e.dataset.highlighted)return;if(e.children.length>0&&(c.ignoreUnescapedHTML,c.throwUnescapedHTML))throw new ne("One of your code blocks includes unescaped HTML.",e.innerHTML);t=e;const i=t.textContent,r=n?b(i,{language:n,ignoreIllegals:!0}):w(i);e.innerHTML=r.value,e.dataset.highlighted="yes",function(e,t,n){const i=t&&o[t]||n;e.classList.add("hljs"),e.classList.add(`language-${i}`)}(e,n,r.language),e.result={language:r.language,re:r.relevance,relevance:r.relevance},r.secondBest&&(e.secondBest={language:r.secondBest.language,relevance:r.secondBest.relevance}),k("after:highlightElement",{el:e,result:r,text:i})}let E=!1;function v(){if("loading"===document.readyState)return E||window.addEventListener("DOMContentLoaded",function(){v()},!1),void(E=!0);document.querySelectorAll(c.cssSelector).forEach(y)}function _(e){return e=(e||"").toLowerCase(),t[e]||t[o[e]]}function S(e,{languageName:t}){"string"==typeof e&&(e=[e]),e.forEach(e=>{o[e.toLowerCase()]=t})}function O(e){const t=_(e);return t&&!t.disableAutodetect}function k(e,t){const n=e;r.forEach(function(e){e[n]&&e[n](t)})}Object.assign(e,{highlight:b,highlightAuto:w,highlightAll:v,highlightElement:y,highlightBlock:function(e){return J("10.7.0","highlightBlock will be removed entirely in v12.0"),J("10.7.0","Please use highlightElement now."),y(e)},configure:function(e){c=oe(c,e)},initHighlighting:()=>{v(),J("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")},initHighlightingOnLoad:function(){v(),J("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")},registerLanguage:function(n,i){let o=null;try{o=i(e)}catch(r){if("Language definition for '{}' could not be registered.".replace("{}",n),!a)throw r;o=l}o.name||(o.name=n),t[n]=o,o.rawDefinition=i.bind(null,e),o.aliases&&S(o.aliases,{languageName:n})},unregisterLanguage:function(e){delete t[e];for(const t of Object.keys(o))o[t]===e&&delete o[t]},listLanguages:function(){return Object.keys(t)},getLanguage:_,registerAliases:S,autoDetection:O,inherit:oe,addPlugin:function(e){!function(e){e["before:highlightBlock"]&&!e["before:highlightElement"]&&(e["before:highlightElement"]=t=>{e["before:highlightBlock"](Object.assign({block:t.el},t))}),e["after:highlightBlock"]&&!e["after:highlightElement"]&&(e["after:highlightElement"]=t=>{e["after:highlightBlock"](Object.assign({block:t.el},t))})}(e),r.push(e)},removePlugin:function(e){const t=r.indexOf(e);-1!==t&&r.splice(t,1)}}),e.debugMode=function(){a=!1},e.safeMode=function(){a=!0},e.versionString="11.11.1",e.regex={concat:f,lookahead:g,either:m,optional:p,anyNumberOfTimes:h};for(const i in D)"object"==typeof D[i]&&n(D[i]);return Object.assign(e,D),e},se=ae({});se.newInstance=()=>ae({}),t.exports=se,se.HighlightJS=se,se.default=se}),g=e.__toESM(d()).default;function h(e,t=[]){return e.flatMap(e=>{const n=[...t,...e.properties?e.properties.className:[]];return e.children?h(e.children,n):{text:e.value,classes:n}})}function p(e){return e.value||e.children||[]}function f({doc:e,name:t,lowlight:n,defaultLanguage:i}){const o=[];return(0,r.findChildren)(e,e=>e.type.name===t).forEach(e=>{var t;let r=e.pos+1;const a=e.node.attrs.language||i,l=n.listLanguages();var c;h(a&&(l.includes(a)||(c=a,Boolean(g.getLanguage(c)))||(null==(t=n.registered)?void 0:t.call(n,a)))?p(n.highlight(a,e.node.textContent)):p(n.highlightAuto(e.node.textContent))).forEach(e=>{const t=r+e.text.length;if(e.classes.length){const n=s.Decoration.inline(r,t,{class:e.classes.join(" ")});o.push(n)}r=t})}),s.DecorationSet.create(e,o)}function m({name:e,lowlight:t,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(e=>"function"==typeof t[e]))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const i=new a.Plugin({key:new a.PluginKey("lowlight"),state:{init:(i,{doc:o})=>f({doc:o,name:e,lowlight:t,defaultLanguage:n}),apply:(i,o,a,s)=>{const l=a.selection.$head.parent.type.name,c=s.selection.$head.parent.type.name,u=(0,r.findChildren)(a.doc,t=>t.type.name===e),d=(0,r.findChildren)(s.doc,t=>t.type.name===e);return i.docChanged&&([l,c].includes(e)||d.length!==u.length||i.steps.some(e=>void 0!==e.from&&void 0!==e.to&&u.some(t=>t.pos>=e.from&&t.pos+t.node.nodeSize<=e.to)))?f({doc:i.doc,name:e,lowlight:t,defaultLanguage:n}):o.map(i.mapping,i.doc)}},props:{decorations:e=>i.getState(e)}});return i}function b(){const e=n.useButtonProps(x.name),{icon:i,tooltip:r,tooltipOptions:a={},action:s,isActive:l}=e?.componentProps??{},{dataState:c,disabled:u,update:d}=n.useToggleActive(l);return e?(0,o.jsx)(t.ActionButton,{action:()=>{u||s&&(s(),d())},dataState:c,disabled:u,icon:i,tooltip:r,tooltipOptions:a}):(0,o.jsx)(o.Fragment,{})}var x=u.extend({addOptions(){var e;return{...null==(e=this.parent)?void 0:e.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},addProseMirrorPlugins(){var e;return[...(null==(e=this.parent)?void 0:e.call(this))||[],m({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}}).extend({addOptions(){return{...this.parent?.(),button:({editor:e,t:t})=>({componentProps:{action:()=>e.chain().focus().setCodeBlock({language:"plaintext"}).run(),isActive:()=>e.isActive("codeBlock"),disabled:!1,icon:"Code2",tooltip:t("editor.codeblock.tooltip")}})}}});Object.defineProperty(exports,"CodeBlock",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"RichTextCodeBlock",{enumerable:!0,get:function(){return b}});
|
|
1
|
+
const e=require("./rolldown-runtime-BeavJI0R.cjs"),t=require("./toggle-CRftKzl0.cjs"),n=require("./useButtonProps-D2Hd5DbR.cjs");let i=require("react");i=e.__toESM(i,1);let o=require("react/jsx-runtime"),r=require("@tiptap/core"),a=require("@tiptap/pm/state"),s=require("@tiptap/pm/view");var l=/^```([a-z]+)?[\s\n]$/,c=/^~~~([a-z]+)?[\s\n]$/,u=r.Node.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;const{languageClassPrefix:n}=this.options;if(!n)return null;const i=[...(null==(t=e.firstElementChild)?void 0:t.classList)||[]].filter(e=>e.startsWith(n)).map(e=>e.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:t}){return["pre",(0,r.mergeAttributes)(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(e,t)=>{var n,i;return!1===(null==(n=e.raw)?void 0:n.startsWith("```"))&&!1===(null==(i=e.raw)?void 0:i.startsWith("~~~"))&&"indented"!==e.codeBlockStyle?[]:t.createNode("codeBlock",{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[])},renderMarkdown:(e,t)=>{var n;let i="";const o=(null==(n=e.attrs)?void 0:n.language)||"";return i=e.content?[`\`\`\`${o}`,t.renderChildren(e.content),"```"].join("\n"):`\`\`\`${o}\n\n\`\`\``,i},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=1===t.pos;return!(!e||t.parent.type.name!==this.name)&&(!(!n&&t.parent.textContent.length)&&this.editor.commands.clearNodes())},Tab:({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=null!=(t=this.options.tabSize)?t:4,{state:i}=e,{selection:o}=i,{$from:r,empty:a}=o;if(r.parent.type!==this.type)return!1;const s=" ".repeat(n);return a?e.commands.insertContent(s):e.commands.command(({tr:e})=>{const{from:t,to:n}=o,r=i.doc.textBetween(t,n,"\n","\n").split("\n").map(e=>s+e).join("\n");return e.replaceWith(t,n,i.schema.text(r)),!0})},"Shift-Tab":({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=null!=(t=this.options.tabSize)?t:4,{state:i}=e,{selection:o}=i,{$from:r,empty:s}=o;return r.parent.type===this.type&&(s?e.commands.command(({tr:e})=>{var t;const{pos:o}=r,s=r.start(),l=r.end(),c=i.doc.textBetween(s,l,"\n","\n").split("\n");let u=0,d=0;const g=o-s;for(let n=0;n<c.length;n+=1){if(d+c[n].length>=g){u=n;break}d+=c[n].length+1}const h=(null==(t=c[u].match(/^ */))?void 0:t[0])||"",p=Math.min(h.length,n);if(0===p)return!0;let f=s;for(let n=0;n<u;n+=1)f+=c[n].length+1;return e.delete(f,f+p),o-f<=p&&e.setSelection(a.TextSelection.create(e.doc,f)),!0}):e.commands.command(({tr:e})=>{const{from:t,to:r}=o,a=i.doc.textBetween(t,r,"\n","\n").split("\n").map(e=>{var t;const i=(null==(t=e.match(/^ */))?void 0:t[0])||"",o=Math.min(i.length,n);return e.slice(o)}).join("\n");return e.replaceWith(t,r,i.schema.text(a)),!0}))},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:n}=t,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type)return!1;const r=i.parentOffset===i.parent.nodeSize-2,a=i.parent.textContent.endsWith("\n\n");return!(!r||!a)&&e.chain().command(({tr:e})=>(e.delete(i.pos-2,i.pos),!0)).exitCode().run()},ArrowUp:({editor:e})=>{if(!this.options.exitOnArrowUp)return!1;const{state:t}=e,{selection:n}=t,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type)return!1;if(0!==i.parentOffset)return!1;const r=i.before();return!(r>0)&&e.commands.insertDefaultBlock({pos:r})},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:i}=t,{$from:o,empty:r}=n;if(!r||o.parent.type!==this.type)return!1;if(o.parentOffset!==o.parent.nodeSize-2)return!1;const s=o.after();return void 0!==s&&(i.nodeAt(s)?e.commands.command(({tr:e})=>(e.setSelection(a.Selection.near(i.resolve(s))),!0)):e.commands.exitCode())}}},addInputRules(){return[(0,r.textblockTypeInputRule)({find:l,type:this.type,getAttributes:e=>({language:e[1]})}),(0,r.textblockTypeInputRule)({find:c,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new a.Plugin({key:new a.PluginKey("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData)return!1;if(this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),i=t.clipboardData.getData("vscode-editor-data"),o=i?JSON.parse(i):void 0,r=null==o?void 0:o.mode;if(!n||!r)return!1;const{tr:s,schema:l}=e.state,c=l.text(n.replace(/\r\n?/g,"\n"));return s.replaceSelectionWith(this.type.create({language:r},c)),s.selection.$from.parent.type!==this.type&&s.setSelection(a.TextSelection.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),e.dispatch(s),!0}}})]}}),d=e.__commonJSMin((e,t)=>{function n(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{const i=e[t],o=typeof i;"object"!==o&&"function"!==o||Object.isFrozen(i)||n(i)}),e}var i=class{constructor(e){void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function o(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function r(e,...t){const n=Object.create(null);for(const i in e)n[i]=e[i];return t.forEach(function(e){for(const t in e)n[t]=e[t]}),n}var a=e=>!!e.scope,s=class{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=o(e)}openNode(e){if(!a(e))return;const t=((e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const n=e.split(".");return[`${t}${n.shift()}`,...n.map((e,t)=>`${e}${"_".repeat(t+1)}`)].join(" ")}return`${t}${e}`})(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){a(e)&&(this.buffer+="</span>")}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}},l=(e={})=>{const t={children:[]};return Object.assign(t,e),t},c=class e{constructor(){this.rootNode=l(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const t=l({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return"string"==typeof t?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(t){"string"!=typeof t&&t.children&&(t.children.every(e=>"string"==typeof e)?t.children=[t.children.join("")]:t.children.forEach(t=>{e._collapse(t)}))}},u=class extends c{constructor(e){super(),this.options=e}addText(e){""!==e&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){const n=e.root;t&&(n.scope=`language:${t}`),this.add(n)}toHTML(){return new s(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function d(e){return e?"string"==typeof e?e:e.source:null}function g(e){return f("(?=",e,")")}function h(e){return f("(?:",e,")*")}function p(e){return f("(?:",e,")?")}function f(...e){return e.map(e=>d(e)).join("")}function m(...e){return"("+(function(e){const t=e[e.length-1];return"object"==typeof t&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}(e).capture?"":"?:")+e.map(e=>d(e)).join("|")+")"}function b(e){return new RegExp(e.toString()+"|").exec("").length-1}var x=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function w(e,{joinWith:t}){let n=0;return e.map(e=>{n+=1;const t=n;let i=d(e),o="";for(;i.length>0;){const e=x.exec(i);if(!e){o+=i;break}o+=i.substring(0,e.index),i=i.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?o+="\\"+String(Number(e[1])+t):(o+=e[0],"("===e[0]&&n++)}return o}).map(e=>`(${e})`).join(t)}var y="[a-zA-Z]\\w*",E="[a-zA-Z_]\\w*",v="\\b\\d+(\\.\\d+)?",_="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",S="\\b(0b[01]+)",O={begin:"\\\\[\\s\\S]",relevance:0},k={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[O]},M={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[O]},A=function(e,t,n={}){const i=r({scope:"comment",begin:e,end:t,contains:[]},n);i.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const o=m("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return i.contains.push({begin:f(/[ ]+/,"(",o,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),i},N=A("//","$"),T=A("/\\*","\\*/"),R=A("#","$"),j={scope:"number",begin:v,relevance:0},L={scope:"number",begin:_,relevance:0},B={scope:"number",begin:S,relevance:0},I={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[O,{begin:/\[/,end:/\]/,relevance:0,contains:[O]}]},C={scope:"title",begin:y,relevance:0},P={scope:"title",begin:E,relevance:0},D=Object.freeze({__proto__:null,APOS_STRING_MODE:k,BACKSLASH_ESCAPE:O,BINARY_NUMBER_MODE:B,BINARY_NUMBER_RE:S,COMMENT:A,C_BLOCK_COMMENT_MODE:T,C_LINE_COMMENT_MODE:N,C_NUMBER_MODE:L,C_NUMBER_RE:_,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:R,IDENT_RE:y,MATCH_NOTHING_RE:/\b\B/,METHOD_GUARD:{begin:"\\.\\s*[a-zA-Z_]\\w*",relevance:0},NUMBER_MODE:j,NUMBER_RE:v,PHRASAL_WORDS_MODE:{begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},QUOTE_STRING_MODE:M,REGEXP_MODE:I,RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",SHEBANG:(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=f(t,/.*\b/,e.binary,/\b.*/)),r({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{0!==e.index&&t.ignoreMatch()}},e)},TITLE_MODE:C,UNDERSCORE_IDENT_RE:E,UNDERSCORE_TITLE_MODE:P});function H(e,t){"."===e.input[e.index-1]&&t.ignoreMatch()}function $(e,t){void 0!==e.className&&(e.scope=e.className,delete e.className)}function z(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=H,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,void 0===e.relevance&&(e.relevance=0))}function U(e,t){Array.isArray(e.illegal)&&(e.illegal=m(...e.illegal))}function W(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function K(e,t){void 0===e.relevance&&(e.relevance=1)}var q=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},e);Object.keys(e).forEach(t=>{delete e[t]}),e.keywords=n.keywords,e.begin=f(n.beforeMatch,g(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},X=["of","and","for","in","not","or","if","then","parent","list","value"];function G(e,t,n="keyword"){const i=Object.create(null);return"string"==typeof e?o(n,e.split(" ")):Array.isArray(e)?o(n,e):Object.keys(e).forEach(function(n){Object.assign(i,G(e[n],t,n))}),i;function o(e,n){t&&(n=n.map(e=>e.toLowerCase())),n.forEach(function(t){const n=t.split("|");i[n[0]]=[e,Z(n[0],n[1])]})}}function Z(e,t){return t?Number(t):function(e){return X.includes(e.toLowerCase())}(e)?0:1}var F={},J=(e,t)=>{F[`${e}/${t}`]||(F[`${e}/${t}`]=!0)},V=new Error;function Y(e,t,{key:n}){let i=0;const o=e[n],r={},a={};for(let s=1;s<=t.length;s++)a[s+i]=o[s],r[s+i]=!0,i+=b(t[s-1]);e[n]=a,e[n]._emit=r,e[n]._multi=!0}function Q(e){!function(e){e.scope&&"object"==typeof e.scope&&null!==e.scope&&(e.beginScope=e.scope,delete e.scope)}(e),"string"==typeof e.beginScope&&(e.beginScope={_wrap:e.beginScope}),"string"==typeof e.endScope&&(e.endScope={_wrap:e.endScope}),function(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw V;if("object"!=typeof e.beginScope||null===e.beginScope)throw V;Y(e,e.begin,{key:"beginScope"}),e.begin=w(e.begin,{joinWith:""})}}(e),function(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw V;if("object"!=typeof e.endScope||null===e.endScope)throw V;Y(e,e.end,{key:"endScope"}),e.end=w(e.end,{joinWith:""})}}(e)}function ee(e){function t(t,n){return new RegExp(d(t),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(n?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=b(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null);const e=this.regexes.map(e=>e[1]);this.matcherRe=t(w(e,{joinWith:"|"}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;const t=this.matcherRe.exec(e);if(!t)return null;const n=t.findIndex((e,t)=>t>0&&void 0!==e),i=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,i)}}class i{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];const t=new n;return this.rules.slice(e).forEach(([e,n])=>t.addRule(e,n)),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),"begin"===t.type&&this.count++}exec(e){const t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition())if(n&&n.index===this.lastIndex);else{const t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=r(e.classNameAliases||{}),function n(o,a){const s=o;if(o.isCompiled)return s;[$,W,Q,q].forEach(e=>e(o,a)),e.compilerExtensions.forEach(e=>e(o,a)),o.__beforeBegin=null,[z,U,K].forEach(e=>e(o,a)),o.isCompiled=!0;let l=null;return"object"==typeof o.keywords&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),l=o.keywords.$pattern,delete o.keywords.$pattern),l=l||/\w+/,o.keywords&&(o.keywords=G(o.keywords,e.case_insensitive)),s.keywordPatternRe=t(l,!0),a&&(o.begin||(o.begin=/\B|\b/),s.beginRe=t(s.begin),o.end||o.endsWithParent||(o.end=/\B|\b/),o.end&&(s.endRe=t(s.end)),s.terminatorEnd=d(s.end)||"",o.endsWithParent&&a.terminatorEnd&&(s.terminatorEnd+=(o.end?"|":"")+a.terminatorEnd)),o.illegal&&(s.illegalRe=t(o.illegal)),o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map(function(e){return function(e){e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return r(e,{variants:null},t)}));return e.cachedVariants?e.cachedVariants:te(e)?r(e,{starts:e.starts?r(e.starts):null}):Object.isFrozen(e)?r(e):e}("self"===e?o:e)})),o.contains.forEach(function(e){n(e,s)}),o.starts&&n(o.starts,a),s.matcher=function(e){const t=new i;return e.contains.forEach(e=>t.addRule(e.begin,{rule:e,type:"begin"})),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:"end"}),e.illegal&&t.addRule(e.illegal,{type:"illegal"}),t}(s),s}(e)}function te(e){return!!e&&(e.endsWithParent||te(e.starts))}var ne=class extends Error{constructor(e,t){super(e),this.name="HTMLInjectionError",this.html=t}},ie=o,oe=r,re=Symbol("nomatch"),ae=function(e){const t=Object.create(null),o=Object.create(null),r=[];let a=!0;const s="Could not find the language '{}', did you forget to load/include a language module?",l={disableAutodetect:!0,name:"Plain text",contains:[]};let c={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:u};function d(e){return c.noHighlightRe.test(e)}function b(e,t,n){let i="",o="";"object"==typeof t?(i=e,n=t.ignoreIllegals,o=t.language):(J("10.7.0","highlight(lang, code, ...args) has been deprecated."),J("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"),o=e,i=t),void 0===n&&(n=!0);const r={code:i,language:o};k("before:highlight",r);const a=r.result?r.result:x(r.language,r.code,n);return a.code=r.code,k("after:highlight",a),a}function x(e,n,o,r){const l=Object.create(null);function u(e,t){return e.keywords[t]}function d(){if(!M.keywords)return void N.addText(T);let e=0;M.keywordPatternRe.lastIndex=0;let t=M.keywordPatternRe.exec(T),n="";for(;t;){n+=T.substring(e,t.index);const i=S.case_insensitive?t[0].toLowerCase():t[0],o=u(M,i);if(o){const[e,r]=o;if(N.addText(n),n="",l[i]=(l[i]||0)+1,l[i]<=7&&(R+=r),e.startsWith("_"))n+=t[0];else{const n=S.classNameAliases[e]||e;h(t[0],n)}}else n+=t[0];e=M.keywordPatternRe.lastIndex,t=M.keywordPatternRe.exec(T)}n+=T.substring(e),N.addText(n)}function g(){null!=M.subLanguage?function(){if(""===T)return;let e=null;if("string"==typeof M.subLanguage){if(!t[M.subLanguage])return void N.addText(T);e=x(M.subLanguage,T,!0,A[M.subLanguage]),A[M.subLanguage]=e._top}else e=w(T,M.subLanguage.length?M.subLanguage:null);M.relevance>0&&(R+=e.relevance),N.__addSublanguage(e._emitter,e.language)}():d(),T=""}function h(e,t){""!==e&&(N.startScope(t),N.addText(e),N.endScope())}function p(e,t){let n=1;const i=t.length-1;for(;n<=i;){if(!e._emit[n]){n++;continue}const i=S.classNameAliases[e[n]]||e[n],o=t[n];i?h(o,i):(T=o,d(),T=""),n++}}function f(e,t){return e.scope&&"string"==typeof e.scope&&N.openNode(S.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(h(T,S.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),T=""):e.beginScope._multi&&(p(e.beginScope,t),T="")),M=Object.create(e,{parent:{value:M}}),M}function m(e,t,n){let o=function(e,t){const n=e&&e.exec(t);return n&&0===n.index}(e.endRe,n);if(o){if(e["on:end"]){const n=new i(e);e["on:end"](t,n),n.isMatchIgnored&&(o=!1)}if(o){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return m(e.parent,t,n)}function b(e){return 0===M.matcher.regexIndex?(T+=e[0],1):(B=!0,0)}function y(e){const t=e[0],i=n.substring(e.index),o=m(M,e,i);if(!o)return re;const r=M;M.endScope&&M.endScope._wrap?(g(),h(t,M.endScope._wrap)):M.endScope&&M.endScope._multi?(g(),p(M.endScope,e)):r.skip?T+=t:(r.returnEnd||r.excludeEnd||(T+=t),g(),r.excludeEnd&&(T=t));do{M.scope&&N.closeNode(),M.skip||M.subLanguage||(R+=M.relevance),M=M.parent}while(M!==o.parent);return o.starts&&f(o.starts,e),r.returnEnd?0:t.length}let E={};function v(t,r){const s=r&&r[0];if(T+=t,null==s)return g(),0;if("begin"===E.type&&"end"===r.type&&E.index===r.index&&""===s){if(T+=n.slice(r.index,r.index+1),!a){const t=new Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=E.rule,t}return 1}if(E=r,"begin"===r.type)return function(e){const t=e[0],n=e.rule,o=new i(n),r=[n.__beforeBegin,n["on:begin"]];for(const i of r)if(i&&(i(e,o),o.isMatchIgnored))return b(t);return n.skip?T+=t:(n.excludeBegin&&(T+=t),g(),n.returnBegin||n.excludeBegin||(T=t)),f(n,e),n.returnBegin?0:t.length}(r);if("illegal"===r.type&&!o){const e=new Error('Illegal lexeme "'+s+'" for mode "'+(M.scope||"<unnamed>")+'"');throw e.mode=M,e}if("end"===r.type){const e=y(r);if(e!==re)return e}if("illegal"===r.type&&""===s)return T+="\n",1;if(L>1e5&&L>3*r.index)throw new Error("potential infinite loop, way more iterations than matches");return T+=s,s.length}const S=_(e);if(!S)throw s.replace("{}",e),new Error('Unknown language: "'+e+'"');const O=ee(S);let k="",M=r||O;const A={},N=new c.__emitter(c);!function(){const e=[];for(let t=M;t!==S;t=t.parent)t.scope&&e.unshift(t.scope);e.forEach(e=>N.openNode(e))}();let T="",R=0,j=0,L=0,B=!1;try{if(S.__emitTokens)S.__emitTokens(n,N);else{for(M.matcher.considerAll();;){L++,B?B=!1:M.matcher.considerAll(),M.matcher.lastIndex=j;const e=M.matcher.exec(n);if(!e)break;const t=v(n.substring(j,e.index),e);j=e.index+t}v(n.substring(j))}return N.finalize(),k=N.toHTML(),{language:e,value:k,relevance:R,illegal:!1,_emitter:N,_top:M}}catch(I){if(I.message&&I.message.includes("Illegal"))return{language:e,value:ie(n),illegal:!0,relevance:0,_illegalBy:{message:I.message,index:j,context:n.slice(j-100,j+100),mode:I.mode,resultSoFar:k},_emitter:N};if(a)return{language:e,value:ie(n),illegal:!1,relevance:0,errorRaised:I,_emitter:N,_top:M};throw I}}function w(e,n){n=n||c.languages||Object.keys(t);const i=function(e){const t={value:ie(e),illegal:!1,relevance:0,_top:l,_emitter:new c.__emitter(c)};return t._emitter.addText(e),t}(e),o=n.filter(_).filter(O).map(t=>x(t,e,!1));o.unshift(i);const[r,a]=o.sort((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(_(e.language).supersetOf===t.language)return 1;if(_(t.language).supersetOf===e.language)return-1}return 0}),s=r;return s.secondBest=a,s}function y(e){let t=null;const n=function(e){let t=e.className+" ";t+=e.parentNode?e.parentNode.className:"";const n=c.languageDetectRe.exec(t);if(n){const e=_(n[1]);return e||s.replace("{}",n[1]),e?n[1]:"no-highlight"}return t.split(/\s+/).find(e=>d(e)||_(e))}(e);if(d(n))return;if(k("before:highlightElement",{el:e,language:n}),e.dataset.highlighted)return;if(e.children.length>0&&(c.ignoreUnescapedHTML,c.throwUnescapedHTML))throw new ne("One of your code blocks includes unescaped HTML.",e.innerHTML);t=e;const i=t.textContent,r=n?b(i,{language:n,ignoreIllegals:!0}):w(i);e.innerHTML=r.value,e.dataset.highlighted="yes",function(e,t,n){const i=t&&o[t]||n;e.classList.add("hljs"),e.classList.add(`language-${i}`)}(e,n,r.language),e.result={language:r.language,re:r.relevance,relevance:r.relevance},r.secondBest&&(e.secondBest={language:r.secondBest.language,relevance:r.secondBest.relevance}),k("after:highlightElement",{el:e,result:r,text:i})}let E=!1;function v(){if("loading"===document.readyState)return E||window.addEventListener("DOMContentLoaded",function(){v()},!1),void(E=!0);document.querySelectorAll(c.cssSelector).forEach(y)}function _(e){return e=(e||"").toLowerCase(),t[e]||t[o[e]]}function S(e,{languageName:t}){"string"==typeof e&&(e=[e]),e.forEach(e=>{o[e.toLowerCase()]=t})}function O(e){const t=_(e);return t&&!t.disableAutodetect}function k(e,t){const n=e;r.forEach(function(e){e[n]&&e[n](t)})}Object.assign(e,{highlight:b,highlightAuto:w,highlightAll:v,highlightElement:y,highlightBlock:function(e){return J("10.7.0","highlightBlock will be removed entirely in v12.0"),J("10.7.0","Please use highlightElement now."),y(e)},configure:function(e){c=oe(c,e)},initHighlighting:()=>{v(),J("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")},initHighlightingOnLoad:function(){v(),J("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")},registerLanguage:function(n,i){let o=null;try{o=i(e)}catch(r){if("Language definition for '{}' could not be registered.".replace("{}",n),!a)throw r;o=l}o.name||(o.name=n),t[n]=o,o.rawDefinition=i.bind(null,e),o.aliases&&S(o.aliases,{languageName:n})},unregisterLanguage:function(e){delete t[e];for(const t of Object.keys(o))o[t]===e&&delete o[t]},listLanguages:function(){return Object.keys(t)},getLanguage:_,registerAliases:S,autoDetection:O,inherit:oe,addPlugin:function(e){!function(e){e["before:highlightBlock"]&&!e["before:highlightElement"]&&(e["before:highlightElement"]=t=>{e["before:highlightBlock"](Object.assign({block:t.el},t))}),e["after:highlightBlock"]&&!e["after:highlightElement"]&&(e["after:highlightElement"]=t=>{e["after:highlightBlock"](Object.assign({block:t.el},t))})}(e),r.push(e)},removePlugin:function(e){const t=r.indexOf(e);-1!==t&&r.splice(t,1)}}),e.debugMode=function(){a=!1},e.safeMode=function(){a=!0},e.versionString="11.11.1",e.regex={concat:f,lookahead:g,either:m,optional:p,anyNumberOfTimes:h};for(const i in D)"object"==typeof D[i]&&n(D[i]);return Object.assign(e,D),e},se=ae({});se.newInstance=()=>ae({}),t.exports=se,se.HighlightJS=se,se.default=se}),g=e.__toESM(d()).default;function h(e,t=[]){return e.flatMap(e=>{const n=[...t,...e.properties?e.properties.className:[]];return e.children?h(e.children,n):{text:e.value,classes:n}})}function p(e){return e.value||e.children||[]}function f({doc:e,name:t,lowlight:n,defaultLanguage:i}){const o=[];return(0,r.findChildren)(e,e=>e.type.name===t).forEach(e=>{var t;let r=e.pos+1;const a=e.node.attrs.language||i,l=n.listLanguages();var c;h(a&&(l.includes(a)||(c=a,Boolean(g.getLanguage(c)))||(null==(t=n.registered)?void 0:t.call(n,a)))?p(n.highlight(a,e.node.textContent)):p(n.highlightAuto(e.node.textContent))).forEach(e=>{const t=r+e.text.length;if(e.classes.length){const n=s.Decoration.inline(r,t,{class:e.classes.join(" ")});o.push(n)}r=t})}),s.DecorationSet.create(e,o)}function m({name:e,lowlight:t,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(e=>"function"==typeof t[e]))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const i=new a.Plugin({key:new a.PluginKey("lowlight"),state:{init:(i,{doc:o})=>f({doc:o,name:e,lowlight:t,defaultLanguage:n}),apply:(i,o,a,s)=>{const l=a.selection.$head.parent.type.name,c=s.selection.$head.parent.type.name,u=(0,r.findChildren)(a.doc,t=>t.type.name===e),d=(0,r.findChildren)(s.doc,t=>t.type.name===e);return i.docChanged&&([l,c].includes(e)||d.length!==u.length||i.steps.some(e=>void 0!==e.from&&void 0!==e.to&&u.some(t=>t.pos>=e.from&&t.pos+t.node.nodeSize<=e.to)))?f({doc:i.doc,name:e,lowlight:t,defaultLanguage:n}):o.map(i.mapping,i.doc)}},props:{decorations:e=>i.getState(e)}});return i}function b(){const e=n.useButtonProps(x.name),{icon:i,tooltip:r,tooltipOptions:a={},action:s,isActive:l}=e?.componentProps??{},{dataState:c,disabled:u,update:d}=n.useToggleActive(l);return e?(0,o.jsx)(t.ActionButton,{action:()=>{u||s&&(s(),d())},dataState:c,disabled:u,icon:i,tooltip:r,tooltipOptions:a}):(0,o.jsx)(o.Fragment,{})}var x=u.extend({addOptions(){var e;return{...null==(e=this.parent)?void 0:e.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},addProseMirrorPlugins(){var e;return[...(null==(e=this.parent)?void 0:e.call(this))||[],m({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}}).extend({addOptions(){return{...this.parent?.(),button:({editor:e,t:t})=>({componentProps:{action:()=>e.chain().focus().setCodeBlock({language:"plaintext"}).run(),isActive:()=>e.isActive("codeBlock"),disabled:!1,icon:"Code2",tooltip:t("editor.codeblock.tooltip")}})}}});Object.defineProperty(exports,"CodeBlock",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"RichTextCodeBlock",{enumerable:!0,get:function(){return b}});
|
package/dist/CodeBlock.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./rolldown-runtime-BeavJI0R.cjs");const e=require("./CodeBlock-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./rolldown-runtime-BeavJI0R.cjs");const e=require("./CodeBlock-zh4cX5EA.cjs");exports.CodeBlock=e.CodeBlock,exports.RichTextCodeBlock=e.RichTextCodeBlock;
|
package/dist/CodeBlock.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as o,t as r}from"./CodeBlock-
|
|
1
|
+
import{n as o,t as r}from"./CodeBlock-DLhI2Guf.js";export{r as CodeBlock,o as RichTextCodeBlock};
|
package/dist/CodeView.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./rolldown-runtime-BeavJI0R.cjs");const e=require("./toggle-CRftKzl0.cjs"),t=require("./useButtonProps-D2Hd5DbR.cjs");let o=require("react/jsx-runtime");var i=require("@tiptap/core").Extension.create({name:"codeView",addOptions(){return{...this.parent?.(),button:({editor:e,t:t})=>({componentProps:{action:()=>{e.commands.toggleCodeView()},isActive:()=>e.storage.codeView.isActive,disabled:!1,icon:"Html",tooltip:t("editor.codeView.tooltip")||"View HTML Code",customClass:"tiptap-code-view-button"}})}},addStorage:()=>({isActive:!1,originalContent:""}),addCommands:()=>({toggleCodeView:()=>({editor:e})=>{const t=e.storage.codeView.isActive;if(t)e.commands.setContent(e.getText());else{const t=e.getHTML();e.storage.codeView.originalContent=t;const o=t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");e.commands.setContent(`<div class="tiptap-code-view-wrapper">${o}</div>`)}return e.storage.codeView.isActive=!t,!0}})});exports.CodeView=i,exports.RichTextCodeView=function(){const
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./rolldown-runtime-BeavJI0R.cjs");const e=require("./toggle-CRftKzl0.cjs"),t=require("./useButtonProps-D2Hd5DbR.cjs");let o=require("react/jsx-runtime");var i=require("@tiptap/core").Extension.create({name:"codeView",addOptions(){return{...this.parent?.(),button:({editor:e,t:t})=>({componentProps:{action:()=>{e.commands.toggleCodeView()},isActive:()=>e.storage.codeView.isActive,disabled:!1,icon:"Html",tooltip:t("editor.codeView.tooltip")||"View HTML Code",customClass:"tiptap-code-view-button"}})}},addStorage:()=>({isActive:!1,originalContent:""}),addCommands:()=>({toggleCodeView:()=>({editor:e})=>{const t=e.storage.codeView.isActive;if(t)e.commands.setContent(e.getText());else{const t=e.getHTML();e.storage.codeView.originalContent=t;const o=t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");e.commands.setContent(`<div class="tiptap-code-view-wrapper">${o}</div>`)}return e.storage.codeView.isActive=!t,!0}})});exports.CodeView=i,exports.RichTextCodeView=function(){const r=t.useButtonProps(i.name),{icon:s,tooltip:n,shortcutKeys:c,tooltipOptions:a={},action:d,isActive:p}=r?.componentProps??{},{dataState:l,disabled:g,update:u}=t.useToggleActive(p);return r?(0,o.jsx)(e.ActionButton,{action:()=>{g||d&&(d(),u())},dataState:l,disabled:g,icon:s,shortcutKeys:c,tooltip:n,tooltipOptions:a}):(0,o.jsx)(o.Fragment,{})};
|
package/dist/CodeView.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as t}from"./toggle-BXl_NYYh.js";import{c as e,t as o}from"./useButtonProps-DSIajp_B.js";import{Fragment as i,jsx as a}from"react/jsx-runtime";import{Extension as s}from"@tiptap/core";function n(){const s=o(
|
|
1
|
+
import{n as t}from"./toggle-BXl_NYYh.js";import{c as e,t as o}from"./useButtonProps-DSIajp_B.js";import{Fragment as i,jsx as a}from"react/jsx-runtime";import{Extension as s}from"@tiptap/core";function n(){const s=o(r.name),{icon:n,tooltip:c,shortcutKeys:d,tooltipOptions:p={},action:l,isActive:m}=s?.componentProps??{},{dataState:g,disabled:u,update:w}=e(m);return s?/* @__PURE__ */a(t,{action:()=>{u||l&&(l(),w())},dataState:g,disabled:u,icon:n,shortcutKeys:d,tooltip:c,tooltipOptions:p}):/* @__PURE__ */a(i,{})}var r=s.create({name:"codeView",addOptions(){return{...this.parent?.(),button:({editor:t,t:e})=>({componentProps:{action:()=>{t.commands.toggleCodeView()},isActive:()=>t.storage.codeView.isActive,disabled:!1,icon:"Html",tooltip:e("editor.codeView.tooltip")||"View HTML Code",customClass:"tiptap-code-view-button"}})}},addStorage:()=>({isActive:!1,originalContent:""}),addCommands:()=>({toggleCodeView:()=>({editor:t})=>{const e=t.storage.codeView.isActive;if(e)t.commands.setContent(t.getText());else{const e=t.getHTML();t.storage.codeView.originalContent=e;const o=e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");t.commands.setContent(`<div class="tiptap-code-view-wrapper">${o}</div>`)}return t.storage.codeView.isActive=!e,!0}})});export{r as CodeView,n as RichTextCodeView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require("./rolldown-runtime-BeavJI0R.cjs");const t=require("./toggle-CRftKzl0.cjs"),e=require("./separator-
|
|
1
|
+
require("./rolldown-runtime-BeavJI0R.cjs");const t=require("./toggle-CRftKzl0.cjs"),e=require("./separator-CXjMk9dM.cjs"),o=require("./Icon-DQdA22_-.cjs"),r=require("./useButtonProps-D2Hd5DbR.cjs"),n=require("./dist-C5TeAoJ9.cjs");let i=require("react"),s=require("react/jsx-runtime");function l({fill:t}){return(0,s.jsx)("svg",{height:"18px",version:"1.1",viewBox:"0 0 240 240",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:1,children:(0,s.jsx)("g",{transform:"translate(0.000000, 0.500000)",children:(0,s.jsxs)("g",{transform:"translate(39.000000, 17.353553)",children:[(0,s.jsx)("path",{d:"M11,201.146447 L167,201.146447 C173.075132,201.146447 178,206.071314 178,212.146447 C178,218.221579 173.075132,223.146447 167,223.146447 L11,223.146447 C4.92486775,223.146447 7.43989126e-16,218.221579 0,212.146447 C-7.43989126e-16,206.071314 4.92486775,201.146447 11,201.146447 Z",fill:"string"==typeof t?t:"#000",fillRule:"evenodd"}),(0,s.jsx)("path",{d:"M72.3425855,16.8295583 C75.799482,7.50883712 86.1577877,2.75526801 95.4785089,6.21216449 C100.284516,7.99463061 104.096358,11.7387855 105.968745,16.4968188 L106.112518,16.8745422 L159.385152,161.694068 C161.291848,166.877345 158.635655,172.624903 153.452378,174.531599 C148.358469,176.405421 142.719567,173.872338 140.716873,168.864661 L140.614848,168.598825 L89.211,28.86 L37.3759214,168.623816 C35.4885354,173.712715 29.8981043,176.351047 24.7909589,174.617647 L24.5226307,174.522368 C19.4337312,172.634982 16.7953993,167.044551 18.5287999,161.937406 L18.6240786,161.669077 L72.3425855,16.8295583 Z",fill:"currentColor",fillRule:"nonzero"}),(0,s.jsx)("path",{d:"M121,103.146447 C126.522847,103.146447 131,107.623599 131,113.146447 C131,118.575687 126.673329,122.994378 121.279905,123.142605 L121,123.146447 L55,123.146447 C49.4771525,123.146447 45,118.669294 45,113.146447 C45,107.717207 49.3266708,103.298515 54.7200952,103.150288 L55,103.146447 L121,103.146447 Z",fill:"currentColor",fillRule:"nonzero"})]})})})})}function c(){const n=r.useButtonProps(u.name),{tooltip:c,isActive:a,defaultColor:d,colors:h,action:f}=n?.componentProps??{},{disabled:x,dataState:C}=r.useActive(a),[p,j]=(0,i.useState)(d);return(0,i.useEffect)(()=>{j(C)},[C]),n?(0,s.jsx)(e.ColorPicker,{colors:h,disabled:x,onChange:function(t){x||f&&(f?.(t),j(t))},value:p,children:(0,s.jsx)(t.ActionButton,{disabled:x,tooltip:c,children:(0,s.jsxs)("span",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-gap-[4px] richtext-text-sm",children:[(0,s.jsx)(l,{fill:C}),(0,s.jsx)(o.IconComponent,{className:"!richtext-h-3 !richtext-w-3 richtext-text-zinc-500",name:"MenuDown"})]})})}):(0,s.jsx)(s.Fragment,{})}var u=n.Color.extend({addStorage(){return{currentColor:this.options.defaultColor||void 0}},addOptions(){return{...this.parent?.(),button:({editor:t,t:e,extension:o})=>({componentProps:{colors:o.options.colors,defaultColor:o.options.defaultColor,action:e=>{if("string"==typeof e)return t.storage.color.currentColor=e,void t.chain().focus().setColor(e).run();t.chain().focus().unsetColor().run()},isActive:()=>{const{color:e}=t.getAttributes("textStyle");return e},disabled:!1,shortcutKeys:o.options.shortcutKeys??["⇧","alt","C"],tooltip:e("editor.color.tooltip")}})}},addKeyboardShortcuts(){return{...this.parent?.(),"Alt-Shift-c":()=>{const t=this.storage.currentColor||this.options.defaultColor;if(!t){const{color:t}=this.editor.getAttributes("textStyle");return!!t&&this.editor.chain().focus().unsetColor().run()}return this.editor.isActive("textStyle",{color:t})?this.editor.chain().focus().unsetColor().run():this.editor.chain().focus().setColor(t).run()}}}});Object.defineProperty(exports,"Color",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"RichTextColor",{enumerable:!0,get:function(){return c}});
|
package/dist/Color.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./rolldown-runtime-BeavJI0R.cjs");const o=require("./Color-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./rolldown-runtime-BeavJI0R.cjs");const o=require("./Color-D5zLljFV.cjs");exports.Color=o.Color,exports.RichTextColor=o.RichTextColor;
|