plugin-build-guide-block 1.0.11 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/client/components/SpaceSelect.d.ts +2 -0
  2. package/dist/client/index.js +9 -1
  3. package/dist/client/locale.d.ts +3 -0
  4. package/dist/client/models/UserGuideBlockModel.d.ts +3 -3
  5. package/dist/client/schemaSettings.d.ts +2 -0
  6. package/dist/client/schemas/spacesSchema.d.ts +118 -0
  7. package/dist/externalVersion.js +8 -8
  8. package/dist/locale/en-US.json +12 -1
  9. package/dist/locale/namespace.d.ts +6 -0
  10. package/dist/locale/namespace.js +36 -0
  11. package/dist/locale/vi-VN.json +3 -0
  12. package/dist/locale/zh-CN.json +3 -0
  13. package/dist/node_modules/marked/bin/main.js +279 -0
  14. package/dist/node_modules/marked/bin/marked.js +15 -0
  15. package/dist/node_modules/marked/lib/marked.cjs +1 -0
  16. package/dist/node_modules/marked/lib/marked.d.cts +657 -0
  17. package/dist/node_modules/marked/lib/marked.d.ts +657 -0
  18. package/dist/node_modules/marked/lib/marked.esm.js +2432 -0
  19. package/dist/node_modules/marked/lib/marked.umd.js +2456 -0
  20. package/dist/node_modules/marked/man/marked.1 +111 -0
  21. package/dist/node_modules/marked/marked.min.js +6 -0
  22. package/dist/node_modules/marked/package.json +1 -0
  23. package/dist/server/actions/build.js +383 -101
  24. package/dist/server/actions/getMarkdown.d.ts +2 -0
  25. package/dist/server/actions/getMarkdown.js +53 -0
  26. package/dist/server/collections/ai-build-guide-pages.d.ts +2 -0
  27. package/dist/server/collections/ai-build-guide-pages.js +90 -0
  28. package/dist/server/collections/ai-build-guide-spaces.js +42 -0
  29. package/dist/server/plugin.d.ts +3 -0
  30. package/dist/server/plugin.js +58 -13
  31. package/package.json +51 -31
  32. package/src/client/UserGuideBlock.tsx +368 -53
  33. package/src/client/UserGuideBlockProvider.tsx +9 -8
  34. package/src/client/components/SpaceSelect.tsx +37 -0
  35. package/src/client/locale.ts +18 -0
  36. package/src/client/models/UserGuideBlockModel.ts +19 -29
  37. package/src/client/plugin.tsx +53 -30
  38. package/src/client/schemaSettings.ts +65 -0
  39. package/src/client/schemas/spacesSchema.ts +434 -316
  40. package/src/locale/en-US.json +12 -1
  41. package/src/locale/namespace.ts +6 -0
  42. package/src/locale/vi-VN.json +3 -0
  43. package/src/locale/zh-CN.json +3 -0
  44. package/src/server/actions/build.ts +497 -176
  45. package/src/server/actions/getMarkdown.ts +26 -0
  46. package/src/server/collections/ai-build-guide-pages.ts +60 -0
  47. package/src/server/collections/ai-build-guide-spaces.ts +57 -15
  48. package/src/server/plugin.ts +130 -76
  49. package/src/server/collections/.gitkeep +0 -0
@@ -75,6 +75,44 @@ export declare const spacesSchema: {
75
75
  };
76
76
  };
77
77
  };
78
+ outputFormat: {
79
+ type: string;
80
+ title: string;
81
+ required: boolean;
82
+ default: string;
83
+ 'x-decorator': string;
84
+ 'x-component': string;
85
+ enum: {
86
+ label: string;
87
+ value: string;
88
+ }[];
89
+ };
90
+ targetChapterCount: {
91
+ type: string;
92
+ title: string;
93
+ required: boolean;
94
+ default: number;
95
+ 'x-decorator': string;
96
+ 'x-component': string;
97
+ 'x-component-props': {
98
+ min: number;
99
+ max: number;
100
+ precision: number;
101
+ style: {
102
+ width: string;
103
+ };
104
+ };
105
+ };
106
+ chapterGuidance: {
107
+ type: string;
108
+ title: string;
109
+ 'x-decorator': string;
110
+ 'x-component': string;
111
+ 'x-component-props': {
112
+ rows: number;
113
+ placeholder: string;
114
+ };
115
+ };
78
116
  systemPrompt: {
79
117
  type: string;
80
118
  title: string;
@@ -159,6 +197,32 @@ export declare const spacesSchema: {
159
197
  };
160
198
  };
161
199
  };
200
+ buildPhase: {
201
+ type: string;
202
+ title: string;
203
+ 'x-decorator': string;
204
+ 'x-component': string;
205
+ properties: {
206
+ buildPhase: {
207
+ type: string;
208
+ 'x-component': string;
209
+ 'x-read-pretty': boolean;
210
+ };
211
+ };
212
+ };
213
+ pageCount: {
214
+ type: string;
215
+ title: string;
216
+ 'x-decorator': string;
217
+ 'x-component': string;
218
+ properties: {
219
+ pageCount: {
220
+ type: string;
221
+ 'x-component': string;
222
+ 'x-read-pretty': boolean;
223
+ };
224
+ };
225
+ };
162
226
  buildLog: {
163
227
  type: string;
164
228
  title: string;
@@ -230,6 +294,42 @@ export declare const spacesSchema: {
230
294
  'x-decorator': string;
231
295
  'x-component': string;
232
296
  };
297
+ outputFormat: {
298
+ type: string;
299
+ title: string;
300
+ required: boolean;
301
+ 'x-decorator': string;
302
+ 'x-component': string;
303
+ enum: {
304
+ label: string;
305
+ value: string;
306
+ }[];
307
+ };
308
+ targetChapterCount: {
309
+ type: string;
310
+ title: string;
311
+ required: boolean;
312
+ 'x-decorator': string;
313
+ 'x-component': string;
314
+ 'x-component-props': {
315
+ min: number;
316
+ max: number;
317
+ precision: number;
318
+ style: {
319
+ width: string;
320
+ };
321
+ };
322
+ };
323
+ chapterGuidance: {
324
+ type: string;
325
+ title: string;
326
+ 'x-decorator': string;
327
+ 'x-component': string;
328
+ 'x-component-props': {
329
+ rows: number;
330
+ placeholder: string;
331
+ };
332
+ };
233
333
  systemPrompt: {
234
334
  type: string;
235
335
  title: string;
@@ -260,6 +360,24 @@ export declare const spacesSchema: {
260
360
  };
261
361
  'x-read-pretty': boolean;
262
362
  };
363
+ generatedMarkdown: {
364
+ type: string;
365
+ title: string;
366
+ 'x-decorator': string;
367
+ 'x-component': string;
368
+ 'x-component-props': {
369
+ rows: number;
370
+ };
371
+ 'x-read-pretty': boolean;
372
+ 'x-reactions': {
373
+ dependencies: string[];
374
+ fulfill: {
375
+ state: {
376
+ visible: string;
377
+ };
378
+ };
379
+ };
380
+ };
263
381
  buildLog: {
264
382
  type: string;
265
383
  title: string;
@@ -8,19 +8,19 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.0.38",
11
+ "@nocobase/client": "2.0.45",
12
12
  "react": "18.2.0",
13
- "antd": "5.24.2",
14
13
  "@formily/react": "2.3.7",
14
+ "antd": "5.24.2",
15
15
  "react-i18next": "11.18.6",
16
16
  "@ant-design/icons": "5.6.1",
17
17
  "@formily/core": "2.3.7",
18
- "@nocobase/server": "2.0.38",
19
- "@nocobase/flow-engine": "2.0.38",
20
- "@nocobase/actions": "2.0.38",
21
- "@nocobase/database": "2.0.38",
22
- "@nocobase/plugin-ai": "2.0.38",
23
- "@nocobase/plugin-file-manager": "2.0.38",
18
+ "@nocobase/server": "2.0.45",
19
+ "@nocobase/flow-engine": "2.0.45",
20
+ "@nocobase/actions": "2.0.45",
21
+ "@nocobase/database": "2.0.45",
22
+ "@nocobase/plugin-ai": "2.0.45",
23
+ "@nocobase/plugin-file-manager": "2.0.45",
24
24
  "@langchain/core": "1.1.24",
25
25
  "axios": "1.7.7"
26
26
  };
@@ -15,7 +15,18 @@
15
15
  "Actions": "Actions",
16
16
  "Edit": "Edit",
17
17
  "Edit space": "Edit space",
18
- "Generated HTML": "Generated HTML",
18
+ "Generated HTML": "Generated HTML",
19
+ "Generated Markdown": "Generated Markdown",
20
+ "Output format": "Output format",
21
+ "Target chapters": "Target chapters",
22
+ "Chapter guidance": "Chapter guidance",
23
+ "Describe how the guide should be split into chapters": "Describe how the guide should be split into chapters",
24
+ "Build Phase": "Build Phase",
25
+ "Chapters": "Chapters",
26
+ "Breakdown Plan": "Breakdown Plan",
27
+ "Contents": "Contents",
28
+ "No guide content available": "No guide content available",
29
+ "Select Space": "Select Space",
19
30
  "Build Log": "Build Log",
20
31
  "Delete": "Delete",
21
32
  "Saved successfully": "Saved successfully",
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Shared namespace constant.
3
+ * Matches the namespace already used in inline schema strings
4
+ * such as {{t("...", { ns: "build-guide-block" })}}.
5
+ */
6
+ export declare const name = "build-guide-block";
@@ -0,0 +1,36 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __export = (target, all) => {
15
+ for (var name2 in all)
16
+ __defProp(target, name2, { get: all[name2], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+ var namespace_exports = {};
28
+ __export(namespace_exports, {
29
+ name: () => name
30
+ });
31
+ module.exports = __toCommonJS(namespace_exports);
32
+ const name = "build-guide-block";
33
+ // Annotate the CommonJS export names for ESM import in node:
34
+ 0 && (module.exports = {
35
+ name
36
+ });
@@ -16,6 +16,9 @@
16
16
  "Edit": "Sửa",
17
17
  "Edit space": "Sửa Space",
18
18
  "Generated HTML": "HTML Đã tạo",
19
+ "Generated Markdown": "Markdown Đã tạo",
20
+ "Output format": "Định dạng đầu ra",
21
+ "Select Space": "Chọn Space",
19
22
  "Build Log": "Log quá trình Build",
20
23
  "Delete": "Xóa",
21
24
  "Saved successfully": "Lưu thành công",
@@ -16,6 +16,9 @@
16
16
  "Edit": "编辑",
17
17
  "Edit space": "编辑空间",
18
18
  "Generated HTML": "生成的 HTML",
19
+ "Generated Markdown": "生成的 Markdown",
20
+ "Output format": "输出格式",
21
+ "Select Space": "选择空间",
19
22
  "Build Log": "构建日志",
20
23
  "Delete": "删除",
21
24
  "Saved successfully": "保存成功",
@@ -0,0 +1,279 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Marked CLI
5
+ * Copyright (c) 2011-2013, Christopher Jeffrey (MIT License)
6
+ */
7
+
8
+ import { promises } from 'node:fs';
9
+ import { dirname, resolve } from 'node:path';
10
+ import { homedir } from 'node:os';
11
+ import { createRequire } from 'node:module';
12
+ import { marked } from '../lib/marked.esm.js';
13
+
14
+ const { access, readFile, writeFile } = promises;
15
+ const require = createRequire(import.meta.url);
16
+
17
+ /**
18
+ * @param {Process} nodeProcess inject process so it can be mocked in tests.
19
+ */
20
+ export async function main(nodeProcess) {
21
+ /**
22
+ * Man Page
23
+ */
24
+ async function help() {
25
+ const { spawn } = await import('child_process');
26
+ const { fileURLToPath } = await import('url');
27
+
28
+ const options = {
29
+ cwd: nodeProcess.cwd(),
30
+ env: nodeProcess.env,
31
+ stdio: 'inherit'
32
+ };
33
+
34
+ const __dirname = dirname(fileURLToPath(import.meta.url));
35
+ const helpText = await readFile(resolve(__dirname, '../man/marked.1.md'), 'utf8');
36
+
37
+ // eslint-disable-next-line promise/param-names
38
+ await new Promise(res => {
39
+ spawn('man', [resolve(__dirname, '../man/marked.1')], options)
40
+ .on('error', () => {
41
+ console.log(helpText);
42
+ })
43
+ .on('close', res);
44
+ });
45
+ }
46
+
47
+ async function version() {
48
+ const pkg = require('../package.json');
49
+ console.log(pkg.version);
50
+ }
51
+
52
+ /**
53
+ * Main
54
+ */
55
+ async function start(argv) {
56
+ const files = [];
57
+ const options = {};
58
+ let input;
59
+ let output;
60
+ let string;
61
+ let arg;
62
+ let tokens;
63
+ let config;
64
+ let opt;
65
+ let noclobber;
66
+
67
+ function getArg() {
68
+ let arg = argv.shift();
69
+
70
+ if (arg.indexOf('--') === 0) {
71
+ // e.g. --opt
72
+ arg = arg.split('=');
73
+ if (arg.length > 1) {
74
+ // e.g. --opt=val
75
+ argv.unshift(arg.slice(1).join('='));
76
+ }
77
+ arg = arg[0];
78
+ } else if (arg[0] === '-') {
79
+ if (arg.length > 2) {
80
+ // e.g. -abc
81
+ argv = arg.substring(1).split('').map(function(ch) {
82
+ return '-' + ch;
83
+ }).concat(argv);
84
+ arg = argv.shift();
85
+ } else {
86
+ // e.g. -a
87
+ }
88
+ } else {
89
+ // e.g. foo
90
+ }
91
+
92
+ return arg;
93
+ }
94
+
95
+ while (argv.length) {
96
+ arg = getArg();
97
+ switch (arg) {
98
+ case '-o':
99
+ case '--output':
100
+ output = argv.shift();
101
+ break;
102
+ case '-i':
103
+ case '--input':
104
+ input = argv.shift();
105
+ break;
106
+ case '-s':
107
+ case '--string':
108
+ string = argv.shift();
109
+ break;
110
+ case '-t':
111
+ case '--tokens':
112
+ tokens = true;
113
+ break;
114
+ case '-c':
115
+ case '--config':
116
+ config = argv.shift();
117
+ break;
118
+ case '-n':
119
+ case '--no-clobber':
120
+ noclobber = true;
121
+ break;
122
+ case '-h':
123
+ case '--help':
124
+ return await help();
125
+ case '-v':
126
+ case '--version':
127
+ return await version();
128
+ default:
129
+ if (arg.indexOf('--') === 0) {
130
+ opt = camelize(arg.replace(/^--(no-)?/, ''));
131
+ if (!marked.defaults.hasOwnProperty(opt)) {
132
+ continue;
133
+ }
134
+ if (arg.indexOf('--no-') === 0) {
135
+ options[opt] = typeof marked.defaults[opt] !== 'boolean'
136
+ ? null
137
+ : false;
138
+ } else {
139
+ options[opt] = typeof marked.defaults[opt] !== 'boolean'
140
+ ? argv.shift()
141
+ : true;
142
+ }
143
+ } else {
144
+ files.push(arg);
145
+ }
146
+ break;
147
+ }
148
+ }
149
+
150
+ async function getData() {
151
+ if (!input) {
152
+ if (files.length <= 2) {
153
+ if (string) {
154
+ return string;
155
+ }
156
+ return await getStdin();
157
+ }
158
+ input = files.pop();
159
+ }
160
+ return await readFile(input, 'utf8');
161
+ }
162
+
163
+ function resolveFile(file) {
164
+ return resolve(file.replace(/^~/, homedir));
165
+ }
166
+
167
+ function fileExists(file) {
168
+ return access(resolveFile(file)).then(() => true, () => false);
169
+ }
170
+
171
+ async function runConfig(file) {
172
+ const configFile = resolveFile(file);
173
+ let markedConfig;
174
+ try {
175
+ // try require for json
176
+ markedConfig = require(configFile);
177
+ } catch (err) {
178
+ if (err.code !== 'ERR_REQUIRE_ESM') {
179
+ throw err;
180
+ }
181
+ // must import esm
182
+ markedConfig = await import('file:///' + configFile);
183
+ }
184
+
185
+ if (markedConfig.default) {
186
+ markedConfig = markedConfig.default;
187
+ }
188
+
189
+ if (typeof markedConfig === 'function') {
190
+ markedConfig(marked);
191
+ } else {
192
+ marked.use(markedConfig);
193
+ }
194
+ }
195
+
196
+ const data = await getData();
197
+
198
+ if (config) {
199
+ if (!await fileExists(config)) {
200
+ throw Error(`Cannot load config file '${config}'`);
201
+ }
202
+
203
+ await runConfig(config);
204
+ } else {
205
+ const defaultConfig = [
206
+ '~/.marked.json',
207
+ '~/.marked.js',
208
+ '~/.marked/index.js'
209
+ ];
210
+
211
+ for (const configFile of defaultConfig) {
212
+ if (await fileExists(configFile)) {
213
+ await runConfig(configFile);
214
+ break;
215
+ }
216
+ }
217
+ }
218
+
219
+ const html = tokens
220
+ ? JSON.stringify(marked.lexer(data, options), null, 2)
221
+ : await marked.parse(data, options);
222
+
223
+ if (output) {
224
+ if (noclobber && await fileExists(output)) {
225
+ throw Error('marked: output file \'' + output + '\' already exists, disable the \'-n\' / \'--no-clobber\' flag to overwrite\n');
226
+ }
227
+ return await writeFile(output, html);
228
+ }
229
+
230
+ nodeProcess.stdout.write(html + '\n');
231
+ }
232
+
233
+ /**
234
+ * Helpers
235
+ */
236
+ function getStdin() {
237
+ return new Promise((resolve, reject) => {
238
+ const stdin = nodeProcess.stdin;
239
+ let buff = '';
240
+
241
+ stdin.setEncoding('utf8');
242
+
243
+ stdin.on('data', function(data) {
244
+ buff += data;
245
+ });
246
+
247
+ stdin.on('error', function(err) {
248
+ reject(err);
249
+ });
250
+
251
+ stdin.on('end', function() {
252
+ resolve(buff);
253
+ });
254
+
255
+ stdin.resume();
256
+ });
257
+ }
258
+
259
+ /**
260
+ * @param {string} text
261
+ */
262
+ function camelize(text) {
263
+ return text.replace(/(\w)-(\w)/g, function(_, a, b) {
264
+ return a + b.toUpperCase();
265
+ });
266
+ }
267
+
268
+ try {
269
+ await start(nodeProcess.argv.slice());
270
+ nodeProcess.exit(0);
271
+ } catch (err) {
272
+ if (err.code === 'ENOENT') {
273
+ nodeProcess.stderr.write('marked: ' + err.path + ': No such file or directory');
274
+ } else {
275
+ nodeProcess.stderr.write(err.message);
276
+ }
277
+ return nodeProcess.exit(1);
278
+ }
279
+ }
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Marked CLI
5
+ * Copyright (c) 2011-2013, Christopher Jeffrey (MIT License)
6
+ */
7
+
8
+ import { main } from './main.js';
9
+
10
+ /**
11
+ * Expose / Entry Point
12
+ */
13
+
14
+ process.title = 'marked';
15
+ main(process);
@@ -0,0 +1 @@
1
+ (function(){"use strict";var e={741:function(e,t){function _getDefaults(){return{async:false,breaks:false,extensions:null,gfm:true,hooks:null,pedantic:false,renderer:null,silent:false,tokenizer:null,walkTokens:null}}t.defaults=_getDefaults();function changeDefaults(e){t.defaults=e}const n=/[&<>"']/;const s=new RegExp(n.source,"g");const r=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/;const i=new RegExp(r.source,"g");const l={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};const getEscapeReplacement=e=>l[e];function escape$1(e,t){if(t){if(n.test(e)){return e.replace(s,getEscapeReplacement)}}else{if(r.test(e)){return e.replace(i,getEscapeReplacement)}}return e}const o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function unescape(e){return e.replace(o,((e,t)=>{t=t.toLowerCase();if(t==="colon")return":";if(t.charAt(0)==="#"){return t.charAt(1)==="x"?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1))}return""}))}const a=/(^|[^\[])\^/g;function edit(e,t){let n=typeof e==="string"?e:e.source;t=t||"";const s={replace:(e,t)=>{let r=typeof t==="string"?t:t.source;r=r.replace(a,"$1");n=n.replace(e,r);return s},getRegex:()=>new RegExp(n,t)};return s}function cleanUrl(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return null}return e}const c={exec:()=>null};function splitCells(e,t){const n=e.replace(/\|/g,((e,t,n)=>{let s=false;let r=t;while(--r>=0&&n[r]==="\\")s=!s;if(s){return"|"}else{return" |"}})),s=n.split(/ \|/);let r=0;if(!s[0].trim()){s.shift()}if(s.length>0&&!s[s.length-1].trim()){s.pop()}if(t){if(s.length>t){s.splice(t)}else{while(s.length<t)s.push("")}}for(;r<s.length;r++){s[r]=s[r].trim().replace(/\\\|/g,"|")}return s}function rtrim(e,t,n){const s=e.length;if(s===0){return""}let r=0;while(r<s){const i=e.charAt(s-r-1);if(i===t&&!n){r++}else if(i!==t&&n){r++}else{break}}return e.slice(0,s-r)}function findClosingBracket(e,t){if(e.indexOf(t[1])===-1){return-1}let n=0;for(let s=0;s<e.length;s++){if(e[s]==="\\"){s++}else if(e[s]===t[0]){n++}else if(e[s]===t[1]){n--;if(n<0){return s}}}return-1}function outputLink(e,t,n,s){const r=t.href;const i=t.title?escape$1(t.title):null;const l=e[1].replace(/\\([\[\]])/g,"$1");if(e[0].charAt(0)!=="!"){s.state.inLink=true;const e={type:"link",raw:n,href:r,title:i,text:l,tokens:s.inlineTokens(l)};s.state.inLink=false;return e}return{type:"image",raw:n,href:r,title:i,text:escape$1(l)}}function indentCodeCompensation(e,t){const n=e.match(/^(\s+)(?:```)/);if(n===null){return t}const s=n[1];return t.split("\n").map((e=>{const t=e.match(/^\s+/);if(t===null){return e}const[n]=t;if(n.length>=s.length){return e.slice(s.length)}return e})).join("\n")}class _Tokenizer{options;rules;lexer;constructor(e){this.options=e||t.defaults}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0){return{type:"space",raw:t[0]}}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:!this.options.pedantic?rtrim(e,"\n"):e}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0];const n=indentCodeCompensation(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=rtrim(e,"#");if(this.options.pedantic){e=t.trim()}else if(!t||/ $/.test(t)){e=t.trim()}}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t){return{type:"hr",raw:t[0]}}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let e=t[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,"\n $1");e=rtrim(e.replace(/^ *>[ \t]?/gm,""),"\n");const n=this.lexer.state.top;this.lexer.state.top=true;const s=this.lexer.blockTokens(e);this.lexer.state.top=n;return{type:"blockquote",raw:t[0],tokens:s,text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const s=n.length>1;const r={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:false,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`;if(this.options.pedantic){n=s?n:"[*+-]"}const i=new RegExp(`^( {0,3}${n})((?:[\t ][^\\n]*)?(?:\\n|$))`);let l="";let o="";let a=false;while(e){let n=false;if(!(t=i.exec(e))){break}if(this.rules.block.hr.test(e)){break}l=t[0];e=e.substring(l.length);let s=t[2].split("\n",1)[0].replace(/^\t+/,(e=>" ".repeat(3*e.length)));let c=e.split("\n",1)[0];let h=0;if(this.options.pedantic){h=2;o=s.trimStart()}else{h=t[2].search(/[^ ]/);h=h>4?1:h;o=s.slice(h);h+=t[1].length}let u=false;if(!s&&/^ *$/.test(c)){l+=c+"\n";e=e.substring(c.length+1);n=true}if(!n){const t=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`);const n=new RegExp(`^ {0,${Math.min(3,h-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`);const r=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:\`\`\`|~~~)`);const i=new RegExp(`^ {0,${Math.min(3,h-1)}}#`);while(e){const a=e.split("\n",1)[0];c=a;if(this.options.pedantic){c=c.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")}if(r.test(c)){break}if(i.test(c)){break}if(t.test(c)){break}if(n.test(e)){break}if(c.search(/[^ ]/)>=h||!c.trim()){o+="\n"+c.slice(h)}else{if(u){break}if(s.search(/[^ ]/)>=4){break}if(r.test(s)){break}if(i.test(s)){break}if(n.test(s)){break}o+="\n"+c}if(!u&&!c.trim()){u=true}l+=a+"\n";e=e.substring(a.length+1);s=c.slice(h)}}if(!r.loose){if(a){r.loose=true}else if(/\n *\n *$/.test(l)){a=true}}let p=null;let f;if(this.options.gfm){p=/^\[[ xX]\] /.exec(o);if(p){f=p[0]!=="[ ] ";o=o.replace(/^\[[ xX]\] +/,"")}}r.items.push({type:"list_item",raw:l,task:!!p,checked:f,loose:false,text:o,tokens:[]});r.raw+=l}r.items[r.items.length-1].raw=l.trimEnd();r.items[r.items.length-1].text=o.trimEnd();r.raw=r.raw.trimEnd();for(let e=0;e<r.items.length;e++){this.lexer.state.top=false;r.items[e].tokens=this.lexer.blockTokens(r.items[e].text,[]);if(!r.loose){const t=r.items[e].tokens.filter((e=>e.type==="space"));const n=t.length>0&&t.some((e=>/\n.*\n/.test(e.raw)));r.loose=n}}if(r.loose){for(let e=0;e<r.items.length;e++){r.items[e].loose=true}}return r}}html(e){const t=this.rules.block.html.exec(e);if(t){const e={type:"html",block:true,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]};return e}}def(e){const t=this.rules.block.def.exec(e);if(t){const e=t[1].toLowerCase().replace(/\s+/g," ");const n=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"";const s=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:s}}}table(e){const t=this.rules.block.table.exec(e);if(!t){return}if(!/[:|]/.test(t[2])){return}const n=splitCells(t[1]);const s=t[2].replace(/^\||\| *$/g,"").split("|");const r=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[];const i={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length!==s.length){return}for(const e of s){if(/^ *-+: *$/.test(e)){i.align.push("right")}else if(/^ *:-+: *$/.test(e)){i.align.push("center")}else if(/^ *:-+ *$/.test(e)){i.align.push("left")}else{i.align.push(null)}}for(const e of n){i.header.push({text:e,tokens:this.lexer.inline(e)})}for(const e of r){i.rows.push(splitCells(e,i.header.length).map((e=>({text:e,tokens:this.lexer.inline(e)}))))}return i}lheading(e){const t=this.rules.block.lheading.exec(e);if(t){return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e=t[1].charAt(t[1].length-1)==="\n"?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){const t=this.rules.block.text.exec(e);if(t){return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}}escape(e){const t=this.rules.inline.escape.exec(e);if(t){return{type:"escape",raw:t[0],text:escape$1(t[1])}}}tag(e){const t=this.rules.inline.tag.exec(e);if(t){if(!this.lexer.state.inLink&&/^<a /i.test(t[0])){this.lexer.state.inLink=true}else if(this.lexer.state.inLink&&/^<\/a>/i.test(t[0])){this.lexer.state.inLink=false}if(!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])){this.lexer.state.inRawBlock=true}else if(this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])){this.lexer.state.inRawBlock=false}return{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:false,text:t[0]}}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^</.test(e)){if(!/>$/.test(e)){return}const t=rtrim(e.slice(0,-1),"\\");if((e.length-t.length)%2===0){return}}else{const e=findClosingBracket(t[2],"()");if(e>-1){const n=t[0].indexOf("!")===0?5:4;const s=n+t[1].length+e;t[2]=t[2].substring(0,e);t[0]=t[0].substring(0,s).trim();t[3]=""}}let n=t[2];let s="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);if(e){n=e[1];s=e[3]}}else{s=t[3]?t[3].slice(1,-1):""}n=n.trim();if(/^</.test(n)){if(this.options.pedantic&&!/>$/.test(e)){n=n.slice(1)}else{n=n.slice(1,-1)}}return outputLink(t,{href:n?n.replace(this.rules.inline.anyPunctuation,"$1"):n,title:s?s.replace(this.rules.inline.anyPunctuation,"$1"):s},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const e=(n[2]||n[1]).replace(/\s+/g," ");const s=t[e.toLowerCase()];if(!s){const e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return outputLink(n,s,n[0],this.lexer)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s)return;if(s[3]&&n.match(/[\p{L}\p{N}]/u))return;const r=s[1]||s[2]||"";if(!r||!n||this.rules.inline.punctuation.exec(n)){const n=[...s[0]].length-1;let r,i,l=n,o=0;const a=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;a.lastIndex=0;t=t.slice(-1*e.length+n);while((s=a.exec(t))!=null){r=s[1]||s[2]||s[3]||s[4]||s[5]||s[6];if(!r)continue;i=[...r].length;if(s[3]||s[4]){l+=i;continue}else if(s[5]||s[6]){if(n%3&&!((n+i)%3)){o+=i;continue}}l-=i;if(l>0)continue;i=Math.min(i,i+l+o);const t=[...s[0]][0].length;const a=e.slice(0,n+s.index+t+i);if(Math.min(n,i)%2){const e=a.slice(1,-1);return{type:"em",raw:a,text:e,tokens:this.lexer.inlineTokens(e)}}const c=a.slice(2,-2);return{type:"strong",raw:a,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const n=/[^ ]/.test(e);const s=/^ /.test(e)&&/ $/.test(e);if(n&&s){e=e.substring(1,e.length-1)}e=escape$1(e,true);return{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t){return{type:"br",raw:t[0]}}}del(e){const t=this.rules.inline.del.exec(e);if(t){return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let e,n;if(t[2]==="@"){e=escape$1(t[1]);n="mailto:"+e}else{e=escape$1(t[1]);n=e}return{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]==="@"){e=escape$1(t[0]);n="mailto:"+e}else{let s;do{s=t[0];t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??""}while(s!==t[0]);e=escape$1(t[0]);if(t[1]==="www."){n="http://"+t[0]}else{n=t[0]}}return{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let e;if(this.lexer.state.inRawBlock){e=t[0]}else{e=escape$1(t[0])}return{type:"text",raw:t[0],text:e}}}}const h=/^(?: *(?:\n|$))+/;const u=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/;const p=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;const f=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;const k=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;const d=/(?:[*+-]|\d{1,9}[.)])/;const g=edit(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,d).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex();const x=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;const m=/^[^\n]+/;const b=/(?!\s*\])(?:\\.|[^\[\]\\])+/;const w=edit(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",b).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();const y=edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,d).getRegex();const $="address|article|aside|base|basefont|blockquote|body|caption"+"|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption"+"|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe"+"|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option"+"|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title"+"|tr|track|ul";const _=/<!--(?:-?>|[\s\S]*?(?:-->|$))/;const z=edit("^ {0,3}(?:"+"<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)"+"|comment[^\\n]*(\\n+|$)"+"|<\\?[\\s\\S]*?(?:\\?>\\n*|$)"+"|<![A-Z][\\s\\S]*?(?:>\\n*|$)"+"|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)"+"|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)"+"|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)"+"|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)"+")","i").replace("comment",_).replace("tag",$).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();const R=edit(x).replace("hr",f).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",$).getRegex();const T=edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",R).getRegex();const A={blockquote:T,code:u,def:w,fences:p,heading:k,hr:f,html:z,lheading:g,list:y,newline:h,paragraph:R,table:c,text:m};const I=edit("^ *([^\\n ].*)\\n"+" {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)"+"(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",f).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",$).getRegex();const S={...A,table:I,paragraph:edit(x).replace("hr",f).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",I).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",$).getRegex()};const L={...A,html:edit("^ *(?:comment *(?:\\n|\\s*$)"+"|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)"+"|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",_).replace(/tag/g,"(?!(?:"+"a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub"+"|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)"+"\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:c,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:edit(x).replace("hr",f).replace("heading"," *#{1,6} *[^\n]").replace("lheading",g).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()};const E=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;const P=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;const q=/^( {2,}|\\)\n(?!\s*$)/;const Z=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;const C="\\p{P}\\p{S}";const D=edit(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,C).getRegex();const v=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g;const B=edit(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,C).getRegex();const Q=edit("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)"+"|[^*]+(?=[^*])"+"|(?!\\*)[punct](\\*+)(?=[\\s]|$)"+"|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)"+"|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])"+"|[\\s](\\*+)(?!\\*)(?=[punct])"+"|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])"+"|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,C).getRegex();const M=edit("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)"+"|[^_]+(?=[^_])"+"|(?!_)[punct](_+)(?=[\\s]|$)"+"|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)"+"|(?!_)[punct\\s](_+)(?=[^punct\\s])"+"|[\\s](_+)(?!_)(?=[punct])"+"|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,C).getRegex();const O=edit(/\\([punct])/,"gu").replace(/punct/g,C).getRegex();const H=edit(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex();const j=edit(_).replace("(?:--\x3e|$)","--\x3e").getRegex();const U=edit("^comment"+"|^</[a-zA-Z][\\w:-]*\\s*>"+"|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>"+"|^<\\?[\\s\\S]*?\\?>"+"|^<![a-zA-Z]+\\s[\\s\\S]*?>"+"|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",j).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();const X=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;const F=edit(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",X).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();const N=edit(/^!?\[(label)\]\[(ref)\]/).replace("label",X).replace("ref",b).getRegex();const G=edit(/^!?\[(ref)\](?:\[\])?/).replace("ref",b).getRegex();const J=edit("reflink|nolink(?!\\()","g").replace("reflink",N).replace("nolink",G).getRegex();const K={_backpedal:c,anyPunctuation:O,autolink:H,blockSkip:v,br:q,code:P,del:c,emStrongLDelim:B,emStrongRDelimAst:Q,emStrongRDelimUnd:M,escape:E,link:F,nolink:G,punctuation:D,reflink:N,reflinkSearch:J,tag:U,text:Z,url:c};const V={...K,link:edit(/^!?\[(label)\]\((.*?)\)/).replace("label",X).getRegex(),reflink:edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",X).getRegex()};const W={...K,escape:edit(E).replace("])","~|])").getRegex(),url:edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/};const Y={...W,br:edit(q).replace("{2,}","*").getRegex(),text:edit(W.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()};const ee={normal:A,gfm:S,pedantic:L};const te={normal:K,gfm:W,breaks:Y,pedantic:V};class _Lexer{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[];this.tokens.links=Object.create(null);this.options=e||t.defaults;this.options.tokenizer=this.options.tokenizer||new _Tokenizer;this.tokenizer=this.options.tokenizer;this.tokenizer.options=this.options;this.tokenizer.lexer=this;this.inlineQueue=[];this.state={inLink:false,inRawBlock:false,top:true};const n={block:ee.normal,inline:te.normal};if(this.options.pedantic){n.block=ee.pedantic;n.inline=te.pedantic}else if(this.options.gfm){n.block=ee.gfm;if(this.options.breaks){n.inline=te.breaks}else{n.inline=te.gfm}}this.tokenizer.rules=n}static get rules(){return{block:ee,inline:te}}static lex(e,t){const n=new _Lexer(t);return n.lex(e)}static lexInline(e,t){const n=new _Lexer(t);return n.inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,"\n");this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){const t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}this.inlineQueue=[];return this.tokens}blockTokens(e,t=[]){if(this.options.pedantic){e=e.replace(/\t/g," ").replace(/^ +$/gm,"")}else{e=e.replace(/^( *)(\t+)/gm,((e,t,n)=>t+" ".repeat(n.length)))}let n;let s;let r;let i;while(e){if(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((s=>{if(n=s.call({lexer:this},e,t)){e=e.substring(n.raw.length);t.push(n);return true}return false}))){continue}if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length);if(n.raw.length===1&&t.length>0){t[t.length-1].raw+="\n"}else{t.push(n)}continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length);s=t[t.length-1];if(s&&(s.type==="paragraph"||s.type==="text")){s.raw+="\n"+n.raw;s.text+="\n"+n.text;this.inlineQueue[this.inlineQueue.length-1].src=s.text}else{t.push(n)}continue}if(n=this.tokenizer.fences(e)){e=e.substring(n.raw.length);t.push(n);continue}if(n=this.tokenizer.heading(e)){e=e.substring(n.raw.length);t.push(n);continue}if(n=this.tokenizer.hr(e)){e=e.substring(n.raw.length);t.push(n);continue}if(n=this.tokenizer.blockquote(e)){e=e.substring(n.raw.length);t.push(n);continue}if(n=this.tokenizer.list(e)){e=e.substring(n.raw.length);t.push(n);continue}if(n=this.tokenizer.html(e)){e=e.substring(n.raw.length);t.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length);s=t[t.length-1];if(s&&(s.type==="paragraph"||s.type==="text")){s.raw+="\n"+n.raw;s.text+="\n"+n.raw;this.inlineQueue[this.inlineQueue.length-1].src=s.text}else if(!this.tokens.links[n.tag]){this.tokens.links[n.tag]={href:n.href,title:n.title}}continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length);t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length);t.push(n);continue}r=e;if(this.options.extensions&&this.options.extensions.startBlock){let t=Infinity;const n=e.slice(1);let s;this.options.extensions.startBlock.forEach((e=>{s=e.call({lexer:this},n);if(typeof s==="number"&&s>=0){t=Math.min(t,s)}}));if(t<Infinity&&t>=0){r=e.substring(0,t+1)}}if(this.state.top&&(n=this.tokenizer.paragraph(r))){s=t[t.length-1];if(i&&s.type==="paragraph"){s.raw+="\n"+n.raw;s.text+="\n"+n.text;this.inlineQueue.pop();this.inlineQueue[this.inlineQueue.length-1].src=s.text}else{t.push(n)}i=r.length!==e.length;e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length);s=t[t.length-1];if(s&&s.type==="text"){s.raw+="\n"+n.raw;s.text+="\n"+n.text;this.inlineQueue.pop();this.inlineQueue[this.inlineQueue.length-1].src=s.text}else{t.push(n)}continue}if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else{throw new Error(t)}}}this.state.top=true;return t}inline(e,t=[]){this.inlineQueue.push({src:e,tokens:t});return t}inlineTokens(e,t=[]){let n,s,r;let i=e;let l;let o,a;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0){while((l=this.tokenizer.rules.inline.reflinkSearch.exec(i))!=null){if(e.includes(l[0].slice(l[0].lastIndexOf("[")+1,-1))){i=i.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex)}}}}while((l=this.tokenizer.rules.inline.blockSkip.exec(i))!=null){i=i.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex)}while((l=this.tokenizer.rules.inline.anyPunctuation.exec(i))!=null){i=i.slice(0,l.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex)}while(e){if(!o){a=""}o=false;if(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((s=>{if(n=s.call({lexer:this},e,t)){e=e.substring(n.raw.length);t.push(n);return true}return false}))){continue}if(n=this.tokenizer.escape(e)){e=e.substring(n.raw.length);t.push(n);continue}if(n=this.tokenizer.tag(e)){e=e.substring(n.raw.length);s=t[t.length-1];if(s&&n.type==="text"&&s.type==="text"){s.raw+=n.raw;s.text+=n.text}else{t.push(n)}continue}if(n=this.tokenizer.link(e)){e=e.substring(n.raw.length);t.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length);s=t[t.length-1];if(s&&n.type==="text"&&s.type==="text"){s.raw+=n.raw;s.text+=n.text}else{t.push(n)}continue}if(n=this.tokenizer.emStrong(e,i,a)){e=e.substring(n.raw.length);t.push(n);continue}if(n=this.tokenizer.codespan(e)){e=e.substring(n.raw.length);t.push(n);continue}if(n=this.tokenizer.br(e)){e=e.substring(n.raw.length);t.push(n);continue}if(n=this.tokenizer.del(e)){e=e.substring(n.raw.length);t.push(n);continue}if(n=this.tokenizer.autolink(e)){e=e.substring(n.raw.length);t.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(e))){e=e.substring(n.raw.length);t.push(n);continue}r=e;if(this.options.extensions&&this.options.extensions.startInline){let t=Infinity;const n=e.slice(1);let s;this.options.extensions.startInline.forEach((e=>{s=e.call({lexer:this},n);if(typeof s==="number"&&s>=0){t=Math.min(t,s)}}));if(t<Infinity&&t>=0){r=e.substring(0,t+1)}}if(n=this.tokenizer.inlineText(r)){e=e.substring(n.raw.length);if(n.raw.slice(-1)!=="_"){a=n.raw.slice(-1)}o=true;s=t[t.length-1];if(s&&s.type==="text"){s.raw+=n.raw;s.text+=n.text}else{t.push(n)}continue}if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else{throw new Error(t)}}}return t}}class _Renderer{options;constructor(e){this.options=e||t.defaults}code(e,t,n){const s=(t||"").match(/^\S*/)?.[0];e=e.replace(/\n$/,"")+"\n";if(!s){return"<pre><code>"+(n?e:escape$1(e,true))+"</code></pre>\n"}return'<pre><code class="language-'+escape$1(s)+'">'+(n?e:escape$1(e,true))+"</code></pre>\n"}blockquote(e){return`<blockquote>\n${e}</blockquote>\n`}html(e,t){return e}heading(e,t,n){return`<h${t}>${e}</h${t}>\n`}hr(){return"<hr>\n"}list(e,t,n){const s=t?"ol":"ul";const r=t&&n!==1?' start="'+n+'"':"";return"<"+s+r+">\n"+e+"</"+s+">\n"}listitem(e,t,n){return`<li>${e}</li>\n`}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(e){return`<p>${e}</p>\n`}table(e,t){if(t)t=`<tbody>${t}</tbody>`;return"<table>\n"+"<thead>\n"+e+"</thead>\n"+t+"</table>\n"}tablerow(e){return`<tr>\n${e}</tr>\n`}tablecell(e,t){const n=t.header?"th":"td";const s=t.align?`<${n} align="${t.align}">`:`<${n}>`;return s+e+`</${n}>\n`}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,t,n){const s=cleanUrl(e);if(s===null){return n}e=s;let r='<a href="'+e+'"';if(t){r+=' title="'+t+'"'}r+=">"+n+"</a>";return r}image(e,t,n){const s=cleanUrl(e);if(s===null){return n}e=s;let r=`<img src="${e}" alt="${n}"`;if(t){r+=` title="${t}"`}r+=">";return r}text(e){return e}}class _TextRenderer{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class _Parser{options;renderer;textRenderer;constructor(e){this.options=e||t.defaults;this.options.renderer=this.options.renderer||new _Renderer;this.renderer=this.options.renderer;this.renderer.options=this.options;this.textRenderer=new _TextRenderer}static parse(e,t){const n=new _Parser(t);return n.parse(e)}static parseInline(e,t){const n=new _Parser(t);return n.parseInline(e)}parse(e,t=true){let n="";for(let s=0;s<e.length;s++){const r=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){const e=r;const t=this.options.extensions.renderers[e.type].call({parser:this},e);if(t!==false||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(e.type)){n+=t||"";continue}}switch(r.type){case"space":{continue}case"hr":{n+=this.renderer.hr();continue}case"heading":{const e=r;n+=this.renderer.heading(this.parseInline(e.tokens),e.depth,unescape(this.parseInline(e.tokens,this.textRenderer)));continue}case"code":{const e=r;n+=this.renderer.code(e.text,e.lang,!!e.escaped);continue}case"table":{const e=r;let t="";let s="";for(let t=0;t<e.header.length;t++){s+=this.renderer.tablecell(this.parseInline(e.header[t].tokens),{header:true,align:e.align[t]})}t+=this.renderer.tablerow(s);let i="";for(let t=0;t<e.rows.length;t++){const n=e.rows[t];s="";for(let t=0;t<n.length;t++){s+=this.renderer.tablecell(this.parseInline(n[t].tokens),{header:false,align:e.align[t]})}i+=this.renderer.tablerow(s)}n+=this.renderer.table(t,i);continue}case"blockquote":{const e=r;const t=this.parse(e.tokens);n+=this.renderer.blockquote(t);continue}case"list":{const e=r;const t=e.ordered;const s=e.start;const i=e.loose;let l="";for(let t=0;t<e.items.length;t++){const n=e.items[t];const s=n.checked;const r=n.task;let o="";if(n.task){const e=this.renderer.checkbox(!!s);if(i){if(n.tokens.length>0&&n.tokens[0].type==="paragraph"){n.tokens[0].text=e+" "+n.tokens[0].text;if(n.tokens[0].tokens&&n.tokens[0].tokens.length>0&&n.tokens[0].tokens[0].type==="text"){n.tokens[0].tokens[0].text=e+" "+n.tokens[0].tokens[0].text}}else{n.tokens.unshift({type:"text",text:e+" "})}}else{o+=e+" "}}o+=this.parse(n.tokens,i);l+=this.renderer.listitem(o,r,!!s)}n+=this.renderer.list(l,t,s);continue}case"html":{const e=r;n+=this.renderer.html(e.text,e.block);continue}case"paragraph":{const e=r;n+=this.renderer.paragraph(this.parseInline(e.tokens));continue}case"text":{let i=r;let l=i.tokens?this.parseInline(i.tokens):i.text;while(s+1<e.length&&e[s+1].type==="text"){i=e[++s];l+="\n"+(i.tokens?this.parseInline(i.tokens):i.text)}n+=t?this.renderer.paragraph(l):l;continue}default:{const e='Token with "'+r.type+'" type was not found.';if(this.options.silent){console.error(e);return""}else{throw new Error(e)}}}}return n}parseInline(e,t){t=t||this.renderer;let n="";for(let s=0;s<e.length;s++){const r=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){const e=this.options.extensions.renderers[r.type].call({parser:this},r);if(e!==false||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)){n+=e||"";continue}}switch(r.type){case"escape":{const e=r;n+=t.text(e.text);break}case"html":{const e=r;n+=t.html(e.text);break}case"link":{const e=r;n+=t.link(e.href,e.title,this.parseInline(e.tokens,t));break}case"image":{const e=r;n+=t.image(e.href,e.title,e.text);break}case"strong":{const e=r;n+=t.strong(this.parseInline(e.tokens,t));break}case"em":{const e=r;n+=t.em(this.parseInline(e.tokens,t));break}case"codespan":{const e=r;n+=t.codespan(e.text);break}case"br":{n+=t.br();break}case"del":{const e=r;n+=t.del(this.parseInline(e.tokens,t));break}case"text":{const e=r;n+=t.text(e.text);break}default:{const e='Token with "'+r.type+'" type was not found.';if(this.options.silent){console.error(e);return""}else{throw new Error(e)}}}}return n}}class _Hooks{options;constructor(e){this.options=e||t.defaults}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}class Marked{defaults=_getDefaults();options=this.setOptions;parse=this.#e(_Lexer.lex,_Parser.parse);parseInline=this.#e(_Lexer.lexInline,_Parser.parseInline);Parser=_Parser;Renderer=_Renderer;TextRenderer=_TextRenderer;Lexer=_Lexer;Tokenizer=_Tokenizer;Hooks=_Hooks;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(const s of e){n=n.concat(t.call(this,s));switch(s.type){case"table":{const e=s;for(const s of e.header){n=n.concat(this.walkTokens(s.tokens,t))}for(const s of e.rows){for(const e of s){n=n.concat(this.walkTokens(e.tokens,t))}}break}case"list":{const e=s;n=n.concat(this.walkTokens(e.items,t));break}default:{const e=s;if(this.defaults.extensions?.childTokens?.[e.type]){this.defaults.extensions.childTokens[e.type].forEach((s=>{const r=e[s].flat(Infinity);n=n.concat(this.walkTokens(r,t))}))}else if(e.tokens){n=n.concat(this.walkTokens(e.tokens,t))}}}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};e.forEach((e=>{const n={...e};n.async=this.defaults.async||n.async||false;if(e.extensions){e.extensions.forEach((e=>{if(!e.name){throw new Error("extension name required")}if("renderer"in e){const n=t.renderers[e.name];if(n){t.renderers[e.name]=function(...t){let s=e.renderer.apply(this,t);if(s===false){s=n.apply(this,t)}return s}}else{t.renderers[e.name]=e.renderer}}if("tokenizer"in e){if(!e.level||e.level!=="block"&&e.level!=="inline"){throw new Error("extension level must be 'block' or 'inline'")}const n=t[e.level];if(n){n.unshift(e.tokenizer)}else{t[e.level]=[e.tokenizer]}if(e.start){if(e.level==="block"){if(t.startBlock){t.startBlock.push(e.start)}else{t.startBlock=[e.start]}}else if(e.level==="inline"){if(t.startInline){t.startInline.push(e.start)}else{t.startInline=[e.start]}}}}if("childTokens"in e&&e.childTokens){t.childTokens[e.name]=e.childTokens}}));n.extensions=t}if(e.renderer){const t=this.defaults.renderer||new _Renderer(this.defaults);for(const n in e.renderer){if(!(n in t)){throw new Error(`renderer '${n}' does not exist`)}if(n==="options"){continue}const s=n;const r=e.renderer[s];const i=t[s];t[s]=(...e)=>{let n=r.apply(t,e);if(n===false){n=i.apply(t,e)}return n||""}}n.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new _Tokenizer(this.defaults);for(const n in e.tokenizer){if(!(n in t)){throw new Error(`tokenizer '${n}' does not exist`)}if(["options","rules","lexer"].includes(n)){continue}const s=n;const r=e.tokenizer[s];const i=t[s];t[s]=(...e)=>{let n=r.apply(t,e);if(n===false){n=i.apply(t,e)}return n}}n.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new _Hooks;for(const n in e.hooks){if(!(n in t)){throw new Error(`hook '${n}' does not exist`)}if(n==="options"){continue}const s=n;const r=e.hooks[s];const i=t[s];if(_Hooks.passThroughHooks.has(n)){t[s]=e=>{if(this.defaults.async){return Promise.resolve(r.call(t,e)).then((e=>i.call(t,e)))}const n=r.call(t,e);return i.call(t,n)}}else{t[s]=(...e)=>{let n=r.apply(t,e);if(n===false){n=i.apply(t,e)}return n}}}n.hooks=t}if(e.walkTokens){const t=this.defaults.walkTokens;const s=e.walkTokens;n.walkTokens=function(e){let n=[];n.push(s.call(this,e));if(t){n=n.concat(t.call(this,e))}return n}}this.defaults={...this.defaults,...n}}));return this}setOptions(e){this.defaults={...this.defaults,...e};return this}lexer(e,t){return _Lexer.lex(e,t??this.defaults)}parser(e,t){return _Parser.parse(e,t??this.defaults)}#e(e,t){return(n,s)=>{const r={...s};const i={...this.defaults,...r};if(this.defaults.async===true&&r.async===false){if(!i.silent){console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored.")}i.async=true}const l=this.#t(!!i.silent,!!i.async);if(typeof n==="undefined"||n===null){return l(new Error("marked(): input parameter is undefined or null"))}if(typeof n!=="string"){return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"))}if(i.hooks){i.hooks.options=i}if(i.async){return Promise.resolve(i.hooks?i.hooks.preprocess(n):n).then((t=>e(t,i))).then((e=>i.hooks?i.hooks.processAllTokens(e):e)).then((e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then((()=>e)):e)).then((e=>t(e,i))).then((e=>i.hooks?i.hooks.postprocess(e):e)).catch(l)}try{if(i.hooks){n=i.hooks.preprocess(n)}let s=e(n,i);if(i.hooks){s=i.hooks.processAllTokens(s)}if(i.walkTokens){this.walkTokens(s,i.walkTokens)}let r=t(s,i);if(i.hooks){r=i.hooks.postprocess(r)}return r}catch(e){return l(e)}}}#t(e,t){return n=>{n.message+="\nPlease report this to https://github.com/markedjs/marked.";if(e){const e="<p>An error occurred:</p><pre>"+escape$1(n.message+"",true)+"</pre>";if(t){return Promise.resolve(e)}return e}if(t){return Promise.reject(n)}throw n}}}const ne=new Marked;function marked(e,t){return ne.parse(e,t)}marked.options=marked.setOptions=function(e){ne.setOptions(e);marked.defaults=ne.defaults;changeDefaults(marked.defaults);return marked};marked.getDefaults=_getDefaults;marked.defaults=t.defaults;marked.use=function(...e){ne.use(...e);marked.defaults=ne.defaults;changeDefaults(marked.defaults);return marked};marked.walkTokens=function(e,t){return ne.walkTokens(e,t)};marked.parseInline=ne.parseInline;marked.Parser=_Parser;marked.parser=_Parser.parse;marked.Renderer=_Renderer;marked.TextRenderer=_TextRenderer;marked.Lexer=_Lexer;marked.lexer=_Lexer.lex;marked.Tokenizer=_Tokenizer;marked.Hooks=_Hooks;marked.parse=marked;const se=marked.options;const re=marked.setOptions;const ie=marked.use;const le=marked.walkTokens;const oe=marked.parseInline;const ae=marked;const ce=_Parser.parse;const he=_Lexer.lex;t.Hooks=_Hooks;t.Lexer=_Lexer;t.Marked=Marked;t.Parser=_Parser;t.Renderer=_Renderer;t.TextRenderer=_TextRenderer;t.Tokenizer=_Tokenizer;t.getDefaults=_getDefaults;t.lexer=he;t.marked=marked;t.options=se;t.parse=ae;t.parseInline=oe;t.parser=ce;t.setOptions=re;t.use=ie;t.walkTokens=le}};if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var t={};e[741](0,t);module.exports=t})();