@hasna/instructions 0.7.6 → 0.7.7

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.
@@ -129,6 +129,1332 @@ function boundedReadPage(items, total, options = {}) {
129
129
  };
130
130
  }
131
131
  var init_bounded_read = () => {};
132
+
133
+ // ../../node_modules/.bun/marked@18.0.5/node_modules/marked/lib/marked.esm.js
134
+ function M() {
135
+ return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
136
+ }
137
+ function N(l) {
138
+ T = l;
139
+ }
140
+ function E(l) {
141
+ let e = [];
142
+ return (t) => {
143
+ let n = Math.max(0, Math.min(3, t - 1)), s = e[n];
144
+ return s || (s = l(n), e[n] = s), s;
145
+ };
146
+ }
147
+ function d(l, e = "") {
148
+ let t = typeof l == "string" ? l : l.source, n = { replace: (s, r) => {
149
+ let i = typeof r == "string" ? r : r.source;
150
+ return i = i.replace(m.caret, "$1"), t = t.replace(s, i), n;
151
+ }, getRegex: () => new RegExp(t, e) };
152
+ return n;
153
+ }
154
+ function O(l, e) {
155
+ if (e) {
156
+ if (m.escapeTest.test(l))
157
+ return l.replace(m.escapeReplace, ge);
158
+ } else if (m.escapeTestNoEncode.test(l))
159
+ return l.replace(m.escapeReplaceNoEncode, ge);
160
+ return l;
161
+ }
162
+ function V(l) {
163
+ try {
164
+ l = encodeURI(l).replace(m.percentDecode, "%");
165
+ } catch {
166
+ return null;
167
+ }
168
+ return l;
169
+ }
170
+ function Y(l, e) {
171
+ let t = l.replace(m.findPipe, (r, i, o) => {
172
+ let u = false, a = i;
173
+ for (;--a >= 0 && o[a] === "\\"; )
174
+ u = !u;
175
+ return u ? "|" : " |";
176
+ }), n = t.split(m.splitPipe), s = 0;
177
+ if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), e)
178
+ if (n.length > e)
179
+ n.splice(e);
180
+ else
181
+ for (;n.length < e; )
182
+ n.push("");
183
+ for (;s < n.length; s++)
184
+ n[s] = n[s].trim().replace(m.slashPipe, "|");
185
+ return n;
186
+ }
187
+ function $(l, e, t) {
188
+ let n = l.length;
189
+ if (n === 0)
190
+ return "";
191
+ let s = 0;
192
+ for (;s < n; ) {
193
+ let r = l.charAt(n - s - 1);
194
+ if (r === e && !t)
195
+ s++;
196
+ else if (r !== e && t)
197
+ s++;
198
+ else
199
+ break;
200
+ }
201
+ return l.slice(0, n - s);
202
+ }
203
+ function ee(l) {
204
+ let e = l.split(`
205
+ `), t = e.length - 1;
206
+ for (;t >= 0 && m.blankLine.test(e[t]); )
207
+ t--;
208
+ return e.length - t <= 2 ? l : e.slice(0, t + 1).join(`
209
+ `);
210
+ }
211
+ function fe(l, e) {
212
+ if (l.indexOf(e[1]) === -1)
213
+ return -1;
214
+ let t = 0;
215
+ for (let n = 0;n < l.length; n++)
216
+ if (l[n] === "\\")
217
+ n++;
218
+ else if (l[n] === e[0])
219
+ t++;
220
+ else if (l[n] === e[1] && (t--, t < 0))
221
+ return n;
222
+ return t > 0 ? -2 : -1;
223
+ }
224
+ function me(l, e = 0) {
225
+ let t = e, n = "";
226
+ for (let s of l)
227
+ if (s === "\t") {
228
+ let r = 4 - t % 4;
229
+ n += " ".repeat(r), t += r;
230
+ } else
231
+ n += s, t++;
232
+ return n;
233
+ }
234
+ function xe(l, e, t, n, s) {
235
+ let r = e.href, i = e.title || null, o = l[1].replace(s.other.outputLinkReplace, "$1");
236
+ n.state.inLink = true;
237
+ let u = { type: l[0].charAt(0) === "!" ? "image" : "link", raw: t, href: r, title: i, text: o, tokens: n.inlineTokens(o) };
238
+ return n.state.inLink = false, u;
239
+ }
240
+ function st(l, e, t) {
241
+ let n = l.match(t.other.indentCodeCompensation);
242
+ if (n === null)
243
+ return e;
244
+ let s = n[1];
245
+ return e.split(`
246
+ `).map((r) => {
247
+ let i = r.match(t.other.beginningSpace);
248
+ if (i === null)
249
+ return r;
250
+ let [o] = i;
251
+ return o.length >= s.length ? r.slice(s.length) : r;
252
+ }).join(`
253
+ `);
254
+ }
255
+ function g(l3, e) {
256
+ return z.parse(l3, e);
257
+ }
258
+ var T, _, Te, m, Oe, we, ye, B, Pe, j, oe, ae, Se, F, $e, U, Le, _e, H = "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", K, ze, le, Me, W, se, Ee, Ie, Ae, Ce, ue, Be, I, Z, X, De, pe, qe, ve, He, ce, Ze, Ge, he = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ne, Qe, je, Fe, Ue = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", Ke, We, Xe, Je, Ve, v, Ye, ke, de, et, ie, J, tt, Q, nt, D, A, rt, ge = (l) => rt[l], w = class {
259
+ options;
260
+ rules;
261
+ lexer;
262
+ constructor(e) {
263
+ this.options = e || T;
264
+ }
265
+ space(e) {
266
+ let t = this.rules.block.newline.exec(e);
267
+ if (t && t[0].length > 0)
268
+ return { type: "space", raw: t[0] };
269
+ }
270
+ code(e) {
271
+ let t = this.rules.block.code.exec(e);
272
+ if (t) {
273
+ let n = this.options.pedantic ? t[0] : ee(t[0]), s = n.replace(this.rules.other.codeRemoveIndent, "");
274
+ return { type: "code", raw: n, codeBlockStyle: "indented", text: s };
275
+ }
276
+ }
277
+ fences(e) {
278
+ let t = this.rules.block.fences.exec(e);
279
+ if (t) {
280
+ let n = t[0], s = st(n, t[3] || "", this.rules);
281
+ return { type: "code", raw: n, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: s };
282
+ }
283
+ }
284
+ heading(e) {
285
+ let t = this.rules.block.heading.exec(e);
286
+ if (t) {
287
+ let n = t[2].trim();
288
+ if (this.rules.other.endingHash.test(n)) {
289
+ let s = $(n, "#");
290
+ (this.options.pedantic || !s || this.rules.other.endingSpaceChar.test(s)) && (n = s.trim());
291
+ }
292
+ return { type: "heading", raw: $(t[0], `
293
+ `), depth: t[1].length, text: n, tokens: this.lexer.inline(n) };
294
+ }
295
+ }
296
+ hr(e) {
297
+ let t = this.rules.block.hr.exec(e);
298
+ if (t)
299
+ return { type: "hr", raw: $(t[0], `
300
+ `) };
301
+ }
302
+ blockquote(e) {
303
+ let t = this.rules.block.blockquote.exec(e);
304
+ if (t) {
305
+ let n = $(t[0], `
306
+ `).split(`
307
+ `), s = "", r = "", i = [];
308
+ for (;n.length > 0; ) {
309
+ let o = false, u = [], a;
310
+ for (a = 0;a < n.length; a++)
311
+ if (this.rules.other.blockquoteStart.test(n[a]))
312
+ u.push(n[a]), o = true;
313
+ else if (!o)
314
+ u.push(n[a]);
315
+ else
316
+ break;
317
+ n = n.slice(a);
318
+ let c = u.join(`
319
+ `), p = c.replace(this.rules.other.blockquoteSetextReplace, `
320
+ $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
321
+ s = s ? `${s}
322
+ ${c}` : c, r = r ? `${r}
323
+ ${p}` : p;
324
+ let k = this.lexer.state.top;
325
+ if (this.lexer.state.top = true, this.lexer.blockTokens(p, i, true), this.lexer.state.top = k, n.length === 0)
326
+ break;
327
+ let h = i.at(-1);
328
+ if (h?.type === "code")
329
+ break;
330
+ if (h?.type === "blockquote") {
331
+ let R = h, f = R.raw + `
332
+ ` + n.join(`
333
+ `), S = this.blockquote(f);
334
+ i[i.length - 1] = S, s = s.substring(0, s.length - R.raw.length) + S.raw, r = r.substring(0, r.length - R.text.length) + S.text;
335
+ break;
336
+ } else if (h?.type === "list") {
337
+ let R = h, f = R.raw + `
338
+ ` + n.join(`
339
+ `), S = this.list(f);
340
+ i[i.length - 1] = S, s = s.substring(0, s.length - h.raw.length) + S.raw, r = r.substring(0, r.length - R.raw.length) + S.raw, n = f.substring(i.at(-1).raw.length).split(`
341
+ `);
342
+ continue;
343
+ }
344
+ }
345
+ return { type: "blockquote", raw: s, tokens: i, text: r };
346
+ }
347
+ }
348
+ list(e) {
349
+ let t = this.rules.block.list.exec(e);
350
+ if (t) {
351
+ let n = t[1].trim(), s = n.length > 1, r = { type: "list", raw: "", ordered: s, start: s ? +n.slice(0, -1) : "", loose: false, items: [] };
352
+ n = s ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = s ? n : "[*+-]");
353
+ let i = this.rules.other.listItemRegex(n), o = false;
354
+ for (;e; ) {
355
+ let a = false, c = "", p = "";
356
+ if (!(t = i.exec(e)) || this.rules.block.hr.test(e))
357
+ break;
358
+ c = t[0], e = e.substring(c.length);
359
+ let k = me(t[2].split(`
360
+ `, 1)[0], t[1].length), h = e.split(`
361
+ `, 1)[0], R = !k.trim(), f = 0;
362
+ if (this.options.pedantic ? (f = 2, p = k.trimStart()) : R ? f = t[1].length + 1 : (f = k.search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, p = k.slice(f), f += t[1].length), R && this.rules.other.blankLine.test(h) && (c += h + `
363
+ `, e = e.substring(h.length + 1), a = true), !a) {
364
+ let S = this.rules.other.nextBulletRegex(f), te = this.rules.other.hrRegex(f), ne = this.rules.other.fencesBeginRegex(f), re = this.rules.other.headingBeginRegex(f), be = this.rules.other.htmlBeginRegex(f), Re = this.rules.other.blockquoteBeginRegex(f);
365
+ for (;e; ) {
366
+ let G = e.split(`
367
+ `, 1)[0], C;
368
+ if (h = G, this.options.pedantic ? (h = h.replace(this.rules.other.listReplaceNesting, " "), C = h) : C = h.replace(this.rules.other.tabCharGlobal, " "), ne.test(h) || re.test(h) || be.test(h) || Re.test(h) || S.test(h) || te.test(h))
369
+ break;
370
+ if (C.search(this.rules.other.nonSpaceChar) >= f || !h.trim())
371
+ p += `
372
+ ` + C.slice(f);
373
+ else {
374
+ if (R || k.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || ne.test(k) || re.test(k) || te.test(k))
375
+ break;
376
+ p += `
377
+ ` + h;
378
+ }
379
+ R = !h.trim(), c += G + `
380
+ `, e = e.substring(G.length + 1), k = C.slice(f);
381
+ }
382
+ }
383
+ r.loose || (o ? r.loose = true : this.rules.other.doubleBlankLine.test(c) && (o = true)), r.items.push({ type: "list_item", raw: c, task: !!this.options.gfm && this.rules.other.listIsTask.test(p), loose: false, text: p, tokens: [] }), r.raw += c;
384
+ }
385
+ let u = r.items.at(-1);
386
+ if (u)
387
+ u.raw = u.raw.trimEnd(), u.text = u.text.trimEnd();
388
+ else
389
+ return;
390
+ r.raw = r.raw.trimEnd();
391
+ for (let a of r.items) {
392
+ this.lexer.state.top = false, a.tokens = this.lexer.blockTokens(a.text, []);
393
+ let c = a.tokens[0];
394
+ if (a.task && (c?.type === "text" || c?.type === "paragraph")) {
395
+ a.text = a.text.replace(this.rules.other.listReplaceTask, ""), c.raw = c.raw.replace(this.rules.other.listReplaceTask, ""), c.text = c.text.replace(this.rules.other.listReplaceTask, "");
396
+ for (let k = this.lexer.inlineQueue.length - 1;k >= 0; k--)
397
+ if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[k].src)) {
398
+ this.lexer.inlineQueue[k].src = this.lexer.inlineQueue[k].src.replace(this.rules.other.listReplaceTask, "");
399
+ break;
400
+ }
401
+ let p = this.rules.other.listTaskCheckbox.exec(a.raw);
402
+ if (p) {
403
+ let k = { type: "checkbox", raw: p[0] + " ", checked: p[0] !== "[ ]" };
404
+ a.checked = k.checked, r.loose ? a.tokens[0] && ["paragraph", "text"].includes(a.tokens[0].type) && "tokens" in a.tokens[0] && a.tokens[0].tokens ? (a.tokens[0].raw = k.raw + a.tokens[0].raw, a.tokens[0].text = k.raw + a.tokens[0].text, a.tokens[0].tokens.unshift(k)) : a.tokens.unshift({ type: "paragraph", raw: k.raw, text: k.raw, tokens: [k] }) : a.tokens.unshift(k);
405
+ }
406
+ } else
407
+ a.task && (a.task = false);
408
+ if (!r.loose) {
409
+ let p = a.tokens.filter((h) => h.type === "space"), k = p.length > 0 && p.some((h) => this.rules.other.anyLine.test(h.raw));
410
+ r.loose = k;
411
+ }
412
+ }
413
+ if (r.loose)
414
+ for (let a of r.items) {
415
+ a.loose = true;
416
+ for (let c of a.tokens)
417
+ c.type === "text" && (c.type = "paragraph");
418
+ }
419
+ return r;
420
+ }
421
+ }
422
+ html(e) {
423
+ let t = this.rules.block.html.exec(e);
424
+ if (t) {
425
+ let n = ee(t[0]);
426
+ return { type: "html", block: true, raw: n, pre: t[1] === "pre" || t[1] === "script" || t[1] === "style", text: n };
427
+ }
428
+ }
429
+ def(e) {
430
+ let t = this.rules.block.def.exec(e);
431
+ if (t) {
432
+ let n = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), s = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
433
+ return { type: "def", tag: n, raw: $(t[0], `
434
+ `), href: s, title: r };
435
+ }
436
+ }
437
+ table(e) {
438
+ let t = this.rules.block.table.exec(e);
439
+ if (!t || !this.rules.other.tableDelimiter.test(t[2]))
440
+ return;
441
+ let n = Y(t[1]), s = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), r = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
442
+ `) : [], i = { type: "table", raw: $(t[0], `
443
+ `), header: [], align: [], rows: [] };
444
+ if (n.length === s.length) {
445
+ for (let o of s)
446
+ this.rules.other.tableAlignRight.test(o) ? i.align.push("right") : this.rules.other.tableAlignCenter.test(o) ? i.align.push("center") : this.rules.other.tableAlignLeft.test(o) ? i.align.push("left") : i.align.push(null);
447
+ for (let o = 0;o < n.length; o++)
448
+ i.header.push({ text: n[o], tokens: this.lexer.inline(n[o]), header: true, align: i.align[o] });
449
+ for (let o of r)
450
+ i.rows.push(Y(o, i.header.length).map((u, a) => ({ text: u, tokens: this.lexer.inline(u), header: false, align: i.align[a] })));
451
+ return i;
452
+ }
453
+ }
454
+ lheading(e) {
455
+ let t = this.rules.block.lheading.exec(e);
456
+ if (t) {
457
+ let n = t[1].trim();
458
+ return { type: "heading", raw: $(t[0], `
459
+ `), depth: t[2].charAt(0) === "=" ? 1 : 2, text: n, tokens: this.lexer.inline(n) };
460
+ }
461
+ }
462
+ paragraph(e) {
463
+ let t = this.rules.block.paragraph.exec(e);
464
+ if (t) {
465
+ let n = t[1].charAt(t[1].length - 1) === `
466
+ ` ? t[1].slice(0, -1) : t[1];
467
+ return { type: "paragraph", raw: t[0], text: n, tokens: this.lexer.inline(n) };
468
+ }
469
+ }
470
+ text(e) {
471
+ let t = this.rules.block.text.exec(e);
472
+ if (t)
473
+ return { type: "text", raw: t[0], text: t[0], tokens: this.lexer.inline(t[0]) };
474
+ }
475
+ escape(e) {
476
+ let t = this.rules.inline.escape.exec(e);
477
+ if (t)
478
+ return { type: "escape", raw: t[0], text: t[1] };
479
+ }
480
+ tag(e) {
481
+ let t = this.rules.inline.tag.exec(e);
482
+ if (t)
483
+ return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = true : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = false), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = true : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = false), { type: "html", raw: t[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: false, text: t[0] };
484
+ }
485
+ link(e) {
486
+ let t = this.rules.inline.link.exec(e);
487
+ if (t) {
488
+ let n = t[2].trim();
489
+ if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
490
+ if (!this.rules.other.endAngleBracket.test(n))
491
+ return;
492
+ let i = $(n.slice(0, -1), "\\");
493
+ if ((n.length - i.length) % 2 === 0)
494
+ return;
495
+ } else {
496
+ let i = fe(t[2], "()");
497
+ if (i === -2)
498
+ return;
499
+ if (i > -1) {
500
+ let u = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + i;
501
+ t[2] = t[2].substring(0, i), t[0] = t[0].substring(0, u).trim(), t[3] = "";
502
+ }
503
+ }
504
+ let s = t[2], r = "";
505
+ if (this.options.pedantic) {
506
+ let i = this.rules.other.pedanticHrefTitle.exec(s);
507
+ i && (s = i[1], r = i[3]);
508
+ } else
509
+ r = t[3] ? t[3].slice(1, -1) : "";
510
+ return s = s.trim(), this.rules.other.startAngleBracket.test(s) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? s = s.slice(1) : s = s.slice(1, -1)), xe(t, { href: s && s.replace(this.rules.inline.anyPunctuation, "$1"), title: r && r.replace(this.rules.inline.anyPunctuation, "$1") }, t[0], this.lexer, this.rules);
511
+ }
512
+ }
513
+ reflink(e, t) {
514
+ let n;
515
+ if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
516
+ let s = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), r = t[s.toLowerCase()];
517
+ if (!r) {
518
+ let i = n[0].charAt(0);
519
+ return { type: "text", raw: i, text: i };
520
+ }
521
+ return xe(n, r, n[0], this.lexer, this.rules);
522
+ }
523
+ }
524
+ emStrong(e, t, n = "") {
525
+ let s = this.rules.inline.emStrongLDelim.exec(e);
526
+ if (!s || !s[1] && !s[2] && !s[3] && !s[4] || s[4] && n.match(this.rules.other.unicodeAlphaNumeric))
527
+ return;
528
+ if (!(s[1] || s[3] || "") || !n || this.rules.inline.punctuation.exec(n)) {
529
+ let i = [...s[0]].length - 1, o, u, a = i, c = 0, p = s[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
530
+ for (p.lastIndex = 0, t = t.slice(-1 * e.length + i);(s = p.exec(t)) !== null; ) {
531
+ if (o = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !o)
532
+ continue;
533
+ if (u = [...o].length, s[3] || s[4]) {
534
+ a += u;
535
+ continue;
536
+ } else if ((s[5] || s[6]) && i % 3 && !((i + u) % 3)) {
537
+ c += u;
538
+ continue;
539
+ }
540
+ if (a -= u, a > 0)
541
+ continue;
542
+ u = Math.min(u, u + a + c);
543
+ let k = [...s[0]][0].length, h = e.slice(0, i + s.index + k + u);
544
+ if (Math.min(i, u) % 2) {
545
+ let f = h.slice(1, -1);
546
+ return { type: "em", raw: h, text: f, tokens: this.lexer.inlineTokens(f) };
547
+ }
548
+ let R = h.slice(2, -2);
549
+ return { type: "strong", raw: h, text: R, tokens: this.lexer.inlineTokens(R) };
550
+ }
551
+ }
552
+ }
553
+ codespan(e) {
554
+ let t = this.rules.inline.code.exec(e);
555
+ if (t) {
556
+ let n = t[2].replace(this.rules.other.newLineCharGlobal, " "), s = this.rules.other.nonSpaceChar.test(n), r = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
557
+ return s && r && (n = n.substring(1, n.length - 1)), { type: "codespan", raw: t[0], text: n };
558
+ }
559
+ }
560
+ br(e) {
561
+ let t = this.rules.inline.br.exec(e);
562
+ if (t)
563
+ return { type: "br", raw: t[0] };
564
+ }
565
+ del(e, t, n = "") {
566
+ let s = this.rules.inline.delLDelim.exec(e);
567
+ if (!s)
568
+ return;
569
+ if (!(s[1] || "") || !n || this.rules.inline.punctuation.exec(n)) {
570
+ let i = [...s[0]].length - 1, o, u, a = i, c = this.rules.inline.delRDelim;
571
+ for (c.lastIndex = 0, t = t.slice(-1 * e.length + i);(s = c.exec(t)) !== null; ) {
572
+ if (o = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !o || (u = [...o].length, u !== i))
573
+ continue;
574
+ if (s[3] || s[4]) {
575
+ a += u;
576
+ continue;
577
+ }
578
+ if (a -= u, a > 0)
579
+ continue;
580
+ u = Math.min(u, u + a);
581
+ let p = [...s[0]][0].length, k = e.slice(0, i + s.index + p + u), h = k.slice(i, -i);
582
+ return { type: "del", raw: k, text: h, tokens: this.lexer.inlineTokens(h) };
583
+ }
584
+ }
585
+ }
586
+ autolink(e) {
587
+ let t = this.rules.inline.autolink.exec(e);
588
+ if (t) {
589
+ let n, s;
590
+ return t[2] === "@" ? (n = t[1], s = "mailto:" + n) : (n = t[1], s = n), { type: "link", raw: t[0], text: n, href: s, tokens: [{ type: "text", raw: n, text: n }] };
591
+ }
592
+ }
593
+ url(e) {
594
+ let t;
595
+ if (t = this.rules.inline.url.exec(e)) {
596
+ let n, s;
597
+ if (t[2] === "@")
598
+ n = t[0], s = "mailto:" + n;
599
+ else {
600
+ let r;
601
+ do
602
+ r = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
603
+ while (r !== t[0]);
604
+ n = t[0], t[1] === "www." ? s = "http://" + t[0] : s = t[0];
605
+ }
606
+ return { type: "link", raw: t[0], text: n, href: s, tokens: [{ type: "text", raw: n, text: n }] };
607
+ }
608
+ }
609
+ inlineText(e) {
610
+ let t = this.rules.inline.text.exec(e);
611
+ if (t) {
612
+ let n = this.lexer.state.inRawBlock;
613
+ return { type: "text", raw: t[0], text: t[0], escaped: n };
614
+ }
615
+ }
616
+ }, x = class l {
617
+ tokens;
618
+ options;
619
+ state;
620
+ inlineQueue;
621
+ tokenizer;
622
+ constructor(e) {
623
+ this.tokens = [], this.tokens.links = Object.create(null), this.options = e || T, this.options.tokenizer = this.options.tokenizer || new w, this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, top: true };
624
+ let t = { other: m, block: D.normal, inline: A.normal };
625
+ this.options.pedantic ? (t.block = D.pedantic, t.inline = A.pedantic) : this.options.gfm && (t.block = D.gfm, this.options.breaks ? t.inline = A.breaks : t.inline = A.gfm), this.tokenizer.rules = t;
626
+ }
627
+ static get rules() {
628
+ return { block: D, inline: A };
629
+ }
630
+ static lex(e, t) {
631
+ return new l(t).lex(e);
632
+ }
633
+ static lexInline(e, t) {
634
+ return new l(t).inlineTokens(e);
635
+ }
636
+ lex(e) {
637
+ e = e.replace(m.carriageReturn, `
638
+ `), this.blockTokens(e, this.tokens);
639
+ for (let t = 0;t < this.inlineQueue.length; t++) {
640
+ let n = this.inlineQueue[t];
641
+ this.inlineTokens(n.src, n.tokens);
642
+ }
643
+ return this.inlineQueue = [], this.tokens;
644
+ }
645
+ blockTokens(e, t = [], n = false) {
646
+ this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(m.tabCharGlobal, " ").replace(m.spaceLine, ""));
647
+ let s = 1 / 0;
648
+ for (;e; ) {
649
+ if (e.length < s)
650
+ s = e.length;
651
+ else {
652
+ this.infiniteLoopError(e.charCodeAt(0));
653
+ break;
654
+ }
655
+ let r;
656
+ if (this.options.extensions?.block?.some((o) => (r = o.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), true) : false))
657
+ continue;
658
+ if (r = this.tokenizer.space(e)) {
659
+ e = e.substring(r.raw.length);
660
+ let o = t.at(-1);
661
+ r.raw.length === 1 && o !== undefined ? o.raw += `
662
+ ` : t.push(r);
663
+ continue;
664
+ }
665
+ if (r = this.tokenizer.code(e)) {
666
+ e = e.substring(r.raw.length);
667
+ let o = t.at(-1);
668
+ o?.type === "paragraph" || o?.type === "text" ? (o.raw += (o.raw.endsWith(`
669
+ `) ? "" : `
670
+ `) + r.raw, o.text += `
671
+ ` + r.text, this.inlineQueue.at(-1).src = o.text) : t.push(r);
672
+ continue;
673
+ }
674
+ if (r = this.tokenizer.fences(e)) {
675
+ e = e.substring(r.raw.length), t.push(r);
676
+ continue;
677
+ }
678
+ if (r = this.tokenizer.heading(e)) {
679
+ e = e.substring(r.raw.length), t.push(r);
680
+ continue;
681
+ }
682
+ if (r = this.tokenizer.hr(e)) {
683
+ e = e.substring(r.raw.length), t.push(r);
684
+ continue;
685
+ }
686
+ if (r = this.tokenizer.blockquote(e)) {
687
+ e = e.substring(r.raw.length), t.push(r);
688
+ continue;
689
+ }
690
+ if (r = this.tokenizer.list(e)) {
691
+ e = e.substring(r.raw.length), t.push(r);
692
+ continue;
693
+ }
694
+ if (r = this.tokenizer.html(e)) {
695
+ e = e.substring(r.raw.length), t.push(r);
696
+ continue;
697
+ }
698
+ if (r = this.tokenizer.def(e)) {
699
+ e = e.substring(r.raw.length);
700
+ let o = t.at(-1);
701
+ o?.type === "paragraph" || o?.type === "text" ? (o.raw += (o.raw.endsWith(`
702
+ `) ? "" : `
703
+ `) + r.raw, o.text += `
704
+ ` + r.raw, this.inlineQueue.at(-1).src = o.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = { href: r.href, title: r.title }, t.push(r));
705
+ continue;
706
+ }
707
+ if (r = this.tokenizer.table(e)) {
708
+ e = e.substring(r.raw.length), t.push(r);
709
+ continue;
710
+ }
711
+ if (r = this.tokenizer.lheading(e)) {
712
+ e = e.substring(r.raw.length), t.push(r);
713
+ continue;
714
+ }
715
+ let i = e;
716
+ if (this.options.extensions?.startBlock) {
717
+ let o = 1 / 0, u = e.slice(1), a;
718
+ this.options.extensions.startBlock.forEach((c) => {
719
+ a = c.call({ lexer: this }, u), typeof a == "number" && a >= 0 && (o = Math.min(o, a));
720
+ }), o < 1 / 0 && o >= 0 && (i = e.substring(0, o + 1));
721
+ }
722
+ if (this.state.top && (r = this.tokenizer.paragraph(i))) {
723
+ let o = t.at(-1);
724
+ n && o?.type === "paragraph" ? (o.raw += (o.raw.endsWith(`
725
+ `) ? "" : `
726
+ `) + r.raw, o.text += `
727
+ ` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = o.text) : t.push(r), n = i.length !== e.length, e = e.substring(r.raw.length);
728
+ continue;
729
+ }
730
+ if (r = this.tokenizer.text(e)) {
731
+ e = e.substring(r.raw.length);
732
+ let o = t.at(-1);
733
+ o?.type === "text" ? (o.raw += (o.raw.endsWith(`
734
+ `) ? "" : `
735
+ `) + r.raw, o.text += `
736
+ ` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = o.text) : t.push(r);
737
+ continue;
738
+ }
739
+ if (e) {
740
+ this.infiniteLoopError(e.charCodeAt(0));
741
+ break;
742
+ }
743
+ }
744
+ return this.state.top = true, t;
745
+ }
746
+ inline(e, t = []) {
747
+ return this.inlineQueue.push({ src: e, tokens: t }), t;
748
+ }
749
+ inlineTokens(e, t = []) {
750
+ this.tokenizer.lexer = this;
751
+ let n = e, s = null;
752
+ if (this.tokens.links) {
753
+ let a = Object.keys(this.tokens.links);
754
+ if (a.length > 0)
755
+ for (;(s = this.tokenizer.rules.inline.reflinkSearch.exec(n)) !== null; )
756
+ a.includes(s[0].slice(s[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, s.index) + "[" + "a".repeat(s[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
757
+ }
758
+ for (;(s = this.tokenizer.rules.inline.anyPunctuation.exec(n)) !== null; )
759
+ n = n.slice(0, s.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
760
+ let r;
761
+ for (;(s = this.tokenizer.rules.inline.blockSkip.exec(n)) !== null; )
762
+ r = s[2] ? s[2].length : 0, n = n.slice(0, s.index + r) + "[" + "a".repeat(s[0].length - r - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
763
+ n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
764
+ let i = false, o = "", u = 1 / 0;
765
+ for (;e; ) {
766
+ if (e.length < u)
767
+ u = e.length;
768
+ else {
769
+ this.infiniteLoopError(e.charCodeAt(0));
770
+ break;
771
+ }
772
+ i || (o = ""), i = false;
773
+ let a;
774
+ if (this.options.extensions?.inline?.some((p) => (a = p.call({ lexer: this }, e, t)) ? (e = e.substring(a.raw.length), t.push(a), true) : false))
775
+ continue;
776
+ if (a = this.tokenizer.escape(e)) {
777
+ e = e.substring(a.raw.length), t.push(a);
778
+ continue;
779
+ }
780
+ if (a = this.tokenizer.tag(e)) {
781
+ e = e.substring(a.raw.length), t.push(a);
782
+ continue;
783
+ }
784
+ if (a = this.tokenizer.link(e)) {
785
+ e = e.substring(a.raw.length), t.push(a);
786
+ continue;
787
+ }
788
+ if (a = this.tokenizer.reflink(e, this.tokens.links)) {
789
+ e = e.substring(a.raw.length);
790
+ let p = t.at(-1);
791
+ a.type === "text" && p?.type === "text" ? (p.raw += a.raw, p.text += a.text) : t.push(a);
792
+ continue;
793
+ }
794
+ if (a = this.tokenizer.emStrong(e, n, o)) {
795
+ e = e.substring(a.raw.length), t.push(a);
796
+ continue;
797
+ }
798
+ if (a = this.tokenizer.codespan(e)) {
799
+ e = e.substring(a.raw.length), t.push(a);
800
+ continue;
801
+ }
802
+ if (a = this.tokenizer.br(e)) {
803
+ e = e.substring(a.raw.length), t.push(a);
804
+ continue;
805
+ }
806
+ if (a = this.tokenizer.del(e, n, o)) {
807
+ e = e.substring(a.raw.length), t.push(a);
808
+ continue;
809
+ }
810
+ if (a = this.tokenizer.autolink(e)) {
811
+ e = e.substring(a.raw.length), t.push(a);
812
+ continue;
813
+ }
814
+ if (!this.state.inLink && (a = this.tokenizer.url(e))) {
815
+ e = e.substring(a.raw.length), t.push(a);
816
+ continue;
817
+ }
818
+ let c = e;
819
+ if (this.options.extensions?.startInline) {
820
+ let p = 1 / 0, k = e.slice(1), h;
821
+ this.options.extensions.startInline.forEach((R) => {
822
+ h = R.call({ lexer: this }, k), typeof h == "number" && h >= 0 && (p = Math.min(p, h));
823
+ }), p < 1 / 0 && p >= 0 && (c = e.substring(0, p + 1));
824
+ }
825
+ if (a = this.tokenizer.inlineText(c)) {
826
+ e = e.substring(a.raw.length), a.raw.slice(-1) !== "_" && (o = a.raw.slice(-1)), i = true;
827
+ let p = t.at(-1);
828
+ p?.type === "text" ? (p.raw += a.raw, p.text += a.text) : t.push(a);
829
+ continue;
830
+ }
831
+ if (e) {
832
+ this.infiniteLoopError(e.charCodeAt(0));
833
+ break;
834
+ }
835
+ }
836
+ return t;
837
+ }
838
+ infiniteLoopError(e) {
839
+ let t = "Infinite loop on byte: " + e;
840
+ if (this.options.silent)
841
+ console.error(t);
842
+ else
843
+ throw new Error(t);
844
+ }
845
+ }, y = class {
846
+ options;
847
+ parser;
848
+ constructor(e) {
849
+ this.options = e || T;
850
+ }
851
+ space(e) {
852
+ return "";
853
+ }
854
+ code({ text: e, lang: t, escaped: n }) {
855
+ let s = (t || "").match(m.notSpaceStart)?.[0], r = e.replace(m.endingNewline, "") + `
856
+ `;
857
+ return s ? '<pre><code class="language-' + O(s) + '">' + (n ? r : O(r, true)) + `</code></pre>
858
+ ` : "<pre><code>" + (n ? r : O(r, true)) + `</code></pre>
859
+ `;
860
+ }
861
+ blockquote({ tokens: e }) {
862
+ return `<blockquote>
863
+ ${this.parser.parse(e)}</blockquote>
864
+ `;
865
+ }
866
+ html({ text: e }) {
867
+ return e;
868
+ }
869
+ def(e) {
870
+ return "";
871
+ }
872
+ heading({ tokens: e, depth: t }) {
873
+ return `<h${t}>${this.parser.parseInline(e)}</h${t}>
874
+ `;
875
+ }
876
+ hr(e) {
877
+ return `<hr>
878
+ `;
879
+ }
880
+ list(e) {
881
+ let { ordered: t, start: n } = e, s = "";
882
+ for (let o = 0;o < e.items.length; o++) {
883
+ let u = e.items[o];
884
+ s += this.listitem(u);
885
+ }
886
+ let r = t ? "ol" : "ul", i = t && n !== 1 ? ' start="' + n + '"' : "";
887
+ return "<" + r + i + `>
888
+ ` + s + "</" + r + `>
889
+ `;
890
+ }
891
+ listitem(e) {
892
+ return `<li>${this.parser.parse(e.tokens)}</li>
893
+ `;
894
+ }
895
+ checkbox({ checked: e }) {
896
+ return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox"> ';
897
+ }
898
+ paragraph({ tokens: e }) {
899
+ return `<p>${this.parser.parseInline(e)}</p>
900
+ `;
901
+ }
902
+ table(e) {
903
+ let t = "", n = "";
904
+ for (let r = 0;r < e.header.length; r++)
905
+ n += this.tablecell(e.header[r]);
906
+ t += this.tablerow({ text: n });
907
+ let s = "";
908
+ for (let r = 0;r < e.rows.length; r++) {
909
+ let i = e.rows[r];
910
+ n = "";
911
+ for (let o = 0;o < i.length; o++)
912
+ n += this.tablecell(i[o]);
913
+ s += this.tablerow({ text: n });
914
+ }
915
+ return s && (s = `<tbody>${s}</tbody>`), `<table>
916
+ <thead>
917
+ ` + t + `</thead>
918
+ ` + s + `</table>
919
+ `;
920
+ }
921
+ tablerow({ text: e }) {
922
+ return `<tr>
923
+ ${e}</tr>
924
+ `;
925
+ }
926
+ tablecell(e) {
927
+ let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
928
+ return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
929
+ `;
930
+ }
931
+ strong({ tokens: e }) {
932
+ return `<strong>${this.parser.parseInline(e)}</strong>`;
933
+ }
934
+ em({ tokens: e }) {
935
+ return `<em>${this.parser.parseInline(e)}</em>`;
936
+ }
937
+ codespan({ text: e }) {
938
+ return `<code>${O(e, true)}</code>`;
939
+ }
940
+ br(e) {
941
+ return "<br>";
942
+ }
943
+ del({ tokens: e }) {
944
+ return `<del>${this.parser.parseInline(e)}</del>`;
945
+ }
946
+ link({ href: e, title: t, tokens: n }) {
947
+ let s = this.parser.parseInline(n), r = V(e);
948
+ if (r === null)
949
+ return s;
950
+ e = r;
951
+ let i = '<a href="' + e + '"';
952
+ return t && (i += ' title="' + O(t) + '"'), i += ">" + s + "</a>", i;
953
+ }
954
+ image({ href: e, title: t, text: n, tokens: s }) {
955
+ s && (n = this.parser.parseInline(s, this.parser.textRenderer));
956
+ let r = V(e);
957
+ if (r === null)
958
+ return O(n);
959
+ e = r;
960
+ let i = `<img src="${e}" alt="${O(n)}"`;
961
+ return t && (i += ` title="${O(t)}"`), i += ">", i;
962
+ }
963
+ text(e) {
964
+ return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : ("escaped" in e) && e.escaped ? e.text : O(e.text);
965
+ }
966
+ }, L = class {
967
+ strong({ text: e }) {
968
+ return e;
969
+ }
970
+ em({ text: e }) {
971
+ return e;
972
+ }
973
+ codespan({ text: e }) {
974
+ return e;
975
+ }
976
+ del({ text: e }) {
977
+ return e;
978
+ }
979
+ html({ text: e }) {
980
+ return e;
981
+ }
982
+ text({ text: e }) {
983
+ return e;
984
+ }
985
+ link({ text: e }) {
986
+ return "" + e;
987
+ }
988
+ image({ text: e }) {
989
+ return "" + e;
990
+ }
991
+ br() {
992
+ return "";
993
+ }
994
+ checkbox({ raw: e }) {
995
+ return e;
996
+ }
997
+ }, b = class l2 {
998
+ options;
999
+ renderer;
1000
+ textRenderer;
1001
+ constructor(e) {
1002
+ this.options = e || T, this.options.renderer = this.options.renderer || new y, this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new L;
1003
+ }
1004
+ static parse(e, t) {
1005
+ return new l2(t).parse(e);
1006
+ }
1007
+ static parseInline(e, t) {
1008
+ return new l2(t).parseInline(e);
1009
+ }
1010
+ parse(e) {
1011
+ this.renderer.parser = this;
1012
+ let t = "";
1013
+ for (let n = 0;n < e.length; n++) {
1014
+ let s = e[n];
1015
+ if (this.options.extensions?.renderers?.[s.type]) {
1016
+ let i = s, o = this.options.extensions.renderers[i.type].call({ parser: this }, i);
1017
+ if (o !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(i.type)) {
1018
+ t += o || "";
1019
+ continue;
1020
+ }
1021
+ }
1022
+ let r = s;
1023
+ switch (r.type) {
1024
+ case "space": {
1025
+ t += this.renderer.space(r);
1026
+ break;
1027
+ }
1028
+ case "hr": {
1029
+ t += this.renderer.hr(r);
1030
+ break;
1031
+ }
1032
+ case "heading": {
1033
+ t += this.renderer.heading(r);
1034
+ break;
1035
+ }
1036
+ case "code": {
1037
+ t += this.renderer.code(r);
1038
+ break;
1039
+ }
1040
+ case "table": {
1041
+ t += this.renderer.table(r);
1042
+ break;
1043
+ }
1044
+ case "blockquote": {
1045
+ t += this.renderer.blockquote(r);
1046
+ break;
1047
+ }
1048
+ case "list": {
1049
+ t += this.renderer.list(r);
1050
+ break;
1051
+ }
1052
+ case "checkbox": {
1053
+ t += this.renderer.checkbox(r);
1054
+ break;
1055
+ }
1056
+ case "html": {
1057
+ t += this.renderer.html(r);
1058
+ break;
1059
+ }
1060
+ case "def": {
1061
+ t += this.renderer.def(r);
1062
+ break;
1063
+ }
1064
+ case "paragraph": {
1065
+ t += this.renderer.paragraph(r);
1066
+ break;
1067
+ }
1068
+ case "text": {
1069
+ t += this.renderer.text(r);
1070
+ break;
1071
+ }
1072
+ default: {
1073
+ let i = 'Token with "' + r.type + '" type was not found.';
1074
+ if (this.options.silent)
1075
+ return console.error(i), "";
1076
+ throw new Error(i);
1077
+ }
1078
+ }
1079
+ }
1080
+ return t;
1081
+ }
1082
+ parseInline(e, t = this.renderer) {
1083
+ this.renderer.parser = this;
1084
+ let n = "";
1085
+ for (let s = 0;s < e.length; s++) {
1086
+ let r = e[s];
1087
+ if (this.options.extensions?.renderers?.[r.type]) {
1088
+ let o = this.options.extensions.renderers[r.type].call({ parser: this }, r);
1089
+ if (o !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(r.type)) {
1090
+ n += o || "";
1091
+ continue;
1092
+ }
1093
+ }
1094
+ let i = r;
1095
+ switch (i.type) {
1096
+ case "escape": {
1097
+ n += t.text(i);
1098
+ break;
1099
+ }
1100
+ case "html": {
1101
+ n += t.html(i);
1102
+ break;
1103
+ }
1104
+ case "link": {
1105
+ n += t.link(i);
1106
+ break;
1107
+ }
1108
+ case "image": {
1109
+ n += t.image(i);
1110
+ break;
1111
+ }
1112
+ case "checkbox": {
1113
+ n += t.checkbox(i);
1114
+ break;
1115
+ }
1116
+ case "strong": {
1117
+ n += t.strong(i);
1118
+ break;
1119
+ }
1120
+ case "em": {
1121
+ n += t.em(i);
1122
+ break;
1123
+ }
1124
+ case "codespan": {
1125
+ n += t.codespan(i);
1126
+ break;
1127
+ }
1128
+ case "br": {
1129
+ n += t.br(i);
1130
+ break;
1131
+ }
1132
+ case "del": {
1133
+ n += t.del(i);
1134
+ break;
1135
+ }
1136
+ case "text": {
1137
+ n += t.text(i);
1138
+ break;
1139
+ }
1140
+ default: {
1141
+ let o = 'Token with "' + i.type + '" type was not found.';
1142
+ if (this.options.silent)
1143
+ return console.error(o), "";
1144
+ throw new Error(o);
1145
+ }
1146
+ }
1147
+ }
1148
+ return n;
1149
+ }
1150
+ }, P, q = class {
1151
+ defaults = M();
1152
+ options = this.setOptions;
1153
+ parse = this.parseMarkdown(true);
1154
+ parseInline = this.parseMarkdown(false);
1155
+ Parser = b;
1156
+ Renderer = y;
1157
+ TextRenderer = L;
1158
+ Lexer = x;
1159
+ Tokenizer = w;
1160
+ Hooks = P;
1161
+ constructor(...e) {
1162
+ this.use(...e);
1163
+ }
1164
+ walkTokens(e, t) {
1165
+ let n = [];
1166
+ for (let s of e)
1167
+ switch (n = n.concat(t.call(this, s)), s.type) {
1168
+ case "table": {
1169
+ let r = s;
1170
+ for (let i of r.header)
1171
+ n = n.concat(this.walkTokens(i.tokens, t));
1172
+ for (let i of r.rows)
1173
+ for (let o of i)
1174
+ n = n.concat(this.walkTokens(o.tokens, t));
1175
+ break;
1176
+ }
1177
+ case "list": {
1178
+ let r = s;
1179
+ n = n.concat(this.walkTokens(r.items, t));
1180
+ break;
1181
+ }
1182
+ default: {
1183
+ let r = s;
1184
+ this.defaults.extensions?.childTokens?.[r.type] ? this.defaults.extensions.childTokens[r.type].forEach((i) => {
1185
+ let o = r[i].flat(1 / 0);
1186
+ n = n.concat(this.walkTokens(o, t));
1187
+ }) : r.tokens && (n = n.concat(this.walkTokens(r.tokens, t)));
1188
+ }
1189
+ }
1190
+ return n;
1191
+ }
1192
+ use(...e) {
1193
+ let t = this.defaults.extensions || { renderers: {}, childTokens: {} };
1194
+ return e.forEach((n) => {
1195
+ let s = { ...n };
1196
+ if (s.async = this.defaults.async || s.async || false, n.extensions && (n.extensions.forEach((r) => {
1197
+ if (!r.name)
1198
+ throw new Error("extension name required");
1199
+ if ("renderer" in r) {
1200
+ let i = t.renderers[r.name];
1201
+ i ? t.renderers[r.name] = function(...o) {
1202
+ let u = r.renderer.apply(this, o);
1203
+ return u === false && (u = i.apply(this, o)), u;
1204
+ } : t.renderers[r.name] = r.renderer;
1205
+ }
1206
+ if ("tokenizer" in r) {
1207
+ if (!r.level || r.level !== "block" && r.level !== "inline")
1208
+ throw new Error("extension level must be 'block' or 'inline'");
1209
+ let i = t[r.level];
1210
+ i ? i.unshift(r.tokenizer) : t[r.level] = [r.tokenizer], r.start && (r.level === "block" ? t.startBlock ? t.startBlock.push(r.start) : t.startBlock = [r.start] : r.level === "inline" && (t.startInline ? t.startInline.push(r.start) : t.startInline = [r.start]));
1211
+ }
1212
+ "childTokens" in r && r.childTokens && (t.childTokens[r.name] = r.childTokens);
1213
+ }), s.extensions = t), n.renderer) {
1214
+ let r = this.defaults.renderer || new y(this.defaults);
1215
+ for (let i in n.renderer) {
1216
+ if (!(i in r))
1217
+ throw new Error(`renderer '${i}' does not exist`);
1218
+ if (["options", "parser"].includes(i))
1219
+ continue;
1220
+ let o = i, u = n.renderer[o], a = r[o];
1221
+ r[o] = (...c) => {
1222
+ let p = u.apply(r, c);
1223
+ return p === false && (p = a.apply(r, c)), p || "";
1224
+ };
1225
+ }
1226
+ s.renderer = r;
1227
+ }
1228
+ if (n.tokenizer) {
1229
+ let r = this.defaults.tokenizer || new w(this.defaults);
1230
+ for (let i in n.tokenizer) {
1231
+ if (!(i in r))
1232
+ throw new Error(`tokenizer '${i}' does not exist`);
1233
+ if (["options", "rules", "lexer"].includes(i))
1234
+ continue;
1235
+ let o = i, u = n.tokenizer[o], a = r[o];
1236
+ r[o] = (...c) => {
1237
+ let p = u.apply(r, c);
1238
+ return p === false && (p = a.apply(r, c)), p;
1239
+ };
1240
+ }
1241
+ s.tokenizer = r;
1242
+ }
1243
+ if (n.hooks) {
1244
+ let r = this.defaults.hooks || new P;
1245
+ for (let i in n.hooks) {
1246
+ if (!(i in r))
1247
+ throw new Error(`hook '${i}' does not exist`);
1248
+ if (["options", "block"].includes(i))
1249
+ continue;
1250
+ let o = i, u = n.hooks[o], a = r[o];
1251
+ P.passThroughHooks.has(i) ? r[o] = (c) => {
1252
+ if (this.defaults.async && P.passThroughHooksRespectAsync.has(i))
1253
+ return (async () => {
1254
+ let k = await u.call(r, c);
1255
+ return a.call(r, k);
1256
+ })();
1257
+ let p = u.call(r, c);
1258
+ return a.call(r, p);
1259
+ } : r[o] = (...c) => {
1260
+ if (this.defaults.async)
1261
+ return (async () => {
1262
+ let k = await u.apply(r, c);
1263
+ return k === false && (k = await a.apply(r, c)), k;
1264
+ })();
1265
+ let p = u.apply(r, c);
1266
+ return p === false && (p = a.apply(r, c)), p;
1267
+ };
1268
+ }
1269
+ s.hooks = r;
1270
+ }
1271
+ if (n.walkTokens) {
1272
+ let r = this.defaults.walkTokens, i = n.walkTokens;
1273
+ s.walkTokens = function(o) {
1274
+ let u = [];
1275
+ return u.push(i.call(this, o)), r && (u = u.concat(r.call(this, o))), u;
1276
+ };
1277
+ }
1278
+ this.defaults = { ...this.defaults, ...s };
1279
+ }), this;
1280
+ }
1281
+ setOptions(e) {
1282
+ return this.defaults = { ...this.defaults, ...e }, this;
1283
+ }
1284
+ lexer(e, t) {
1285
+ return x.lex(e, t ?? this.defaults);
1286
+ }
1287
+ parser(e, t) {
1288
+ return b.parse(e, t ?? this.defaults);
1289
+ }
1290
+ parseMarkdown(e) {
1291
+ return (n, s) => {
1292
+ let r = { ...s }, i = { ...this.defaults, ...r }, o = this.onError(!!i.silent, !!i.async);
1293
+ if (this.defaults.async === true && r.async === false)
1294
+ return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
1295
+ if (typeof n > "u" || n === null)
1296
+ return o(new Error("marked(): input parameter is undefined or null"));
1297
+ if (typeof n != "string")
1298
+ return o(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
1299
+ if (i.hooks && (i.hooks.options = i, i.hooks.block = e), i.async)
1300
+ return (async () => {
1301
+ let u = i.hooks ? await i.hooks.preprocess(n) : n, c = await (i.hooks ? await i.hooks.provideLexer(e) : e ? x.lex : x.lexInline)(u, i), p = i.hooks ? await i.hooks.processAllTokens(c) : c;
1302
+ i.walkTokens && await Promise.all(this.walkTokens(p, i.walkTokens));
1303
+ let h = await (i.hooks ? await i.hooks.provideParser(e) : e ? b.parse : b.parseInline)(p, i);
1304
+ return i.hooks ? await i.hooks.postprocess(h) : h;
1305
+ })().catch(o);
1306
+ try {
1307
+ i.hooks && (n = i.hooks.preprocess(n));
1308
+ let a = (i.hooks ? i.hooks.provideLexer(e) : e ? x.lex : x.lexInline)(n, i);
1309
+ i.hooks && (a = i.hooks.processAllTokens(a)), i.walkTokens && this.walkTokens(a, i.walkTokens);
1310
+ let p = (i.hooks ? i.hooks.provideParser(e) : e ? b.parse : b.parseInline)(a, i);
1311
+ return i.hooks && (p = i.hooks.postprocess(p)), p;
1312
+ } catch (u) {
1313
+ return o(u);
1314
+ }
1315
+ };
1316
+ }
1317
+ onError(e, t) {
1318
+ return (n) => {
1319
+ if (n.message += `
1320
+ Please report this to https://github.com/markedjs/marked.`, e) {
1321
+ let s = "<p>An error occurred:</p><pre>" + O(n.message + "", true) + "</pre>";
1322
+ return t ? Promise.resolve(s) : s;
1323
+ }
1324
+ if (t)
1325
+ return Promise.reject(n);
1326
+ throw n;
1327
+ };
1328
+ }
1329
+ }, z, Ft, Ut, Kt, Wt, Xt, Vt, Yt;
1330
+ var init_marked_esm = __esm(() => {
1331
+ T = M();
1332
+ _ = { exec: () => null };
1333
+ Te = ((l = "") => {
1334
+ try {
1335
+ return !!new RegExp("(?<=1)(?<!1)" + l);
1336
+ } catch {
1337
+ return false;
1338
+ }
1339
+ })();
1340
+ m = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (l) => new RegExp(`^( {0,3}${l})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: E((l) => new RegExp(`^ {0,${l}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)), hrRegex: E((l) => new RegExp(`^ {0,${l}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)), fencesBeginRegex: E((l) => new RegExp(`^ {0,${l}}(?:\`\`\`|~~~)`)), headingBeginRegex: E((l) => new RegExp(`^ {0,${l}}#`)), htmlBeginRegex: E((l) => new RegExp(`^ {0,${l}}<(?:[a-z].*>|!--)`, "i")), blockquoteBeginRegex: E((l) => new RegExp(`^ {0,${l}}>`)) };
1341
+ Oe = /^(?:[ \t]*(?:\n|$))+/;
1342
+ we = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
1343
+ ye = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
1344
+ B = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
1345
+ Pe = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
1346
+ j = / {0,3}(?:[*+-]|\d{1,9}[.)])/;
1347
+ oe = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;
1348
+ ae = d(oe).replace(/bull/g, j).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).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/).replace(/\|table/g, "").getRegex();
1349
+ Se = d(oe).replace(/bull/g, j).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).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/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex();
1350
+ F = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
1351
+ $e = /^[^\n]+/;
1352
+ U = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/;
1353
+ Le = d(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", U).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
1354
+ _e = d(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, j).getRegex();
1355
+ K = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
1356
+ ze = d("^ {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[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))", "i").replace("comment", K).replace("tag", H).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
1357
+ le = d(F).replace("hr", B).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[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", H).getRegex();
1358
+ Me = d(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", le).getRegex();
1359
+ W = { blockquote: Me, code: we, def: Le, fences: ye, heading: Pe, hr: B, html: ze, lheading: ae, list: _e, newline: Oe, paragraph: le, table: _, text: $e };
1360
+ se = d("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", B).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3}\t)[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", H).getRegex();
1361
+ Ee = { ...W, lheading: Se, table: se, paragraph: d(F).replace("hr", B).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", se).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", H).getRegex() };
1362
+ Ie = { ...W, html: d(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", K).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: _, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: d(F).replace("hr", B).replace("heading", ` *#{1,6} *[^
1363
+ ]`).replace("lheading", ae).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() };
1364
+ Ae = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
1365
+ Ce = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
1366
+ ue = /^( {2,}|\\)\n(?!\s*$)/;
1367
+ Be = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
1368
+ I = /[\p{P}\p{S}]/u;
1369
+ Z = /[\s\p{P}\p{S}]/u;
1370
+ X = /[^\s\p{P}\p{S}]/u;
1371
+ De = d(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, Z).getRegex();
1372
+ pe = /(?!~)[\p{P}\p{S}]/u;
1373
+ qe = /(?!~)[\s\p{P}\p{S}]/u;
1374
+ ve = /(?:[^\s\p{P}\p{S}]|~)/u;
1375
+ He = d(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Te ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex();
1376
+ ce = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/;
1377
+ Ze = d(ce, "u").replace(/punct/g, I).getRegex();
1378
+ Ge = d(ce, "u").replace(/punct/g, pe).getRegex();
1379
+ Ne = d(he, "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, Z).replace(/punct/g, I).getRegex();
1380
+ Qe = d(he, "gu").replace(/notPunctSpace/g, ve).replace(/punctSpace/g, qe).replace(/punct/g, pe).getRegex();
1381
+ je = d("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, Z).replace(/punct/g, I).getRegex();
1382
+ Fe = d(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, I).getRegex();
1383
+ Ke = d(Ue, "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, Z).replace(/punct/g, I).getRegex();
1384
+ We = d(/\\(punct)/, "gu").replace(/punct/g, I).getRegex();
1385
+ Xe = d(/^<(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();
1386
+ Je = d(K).replace("(?:-->|$)", "-->").getRegex();
1387
+ Ve = d("^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", Je).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
1388
+ v = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/;
1389
+ Ye = d(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", v).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
1390
+ ke = d(/^!?\[(label)\]\[(ref)\]/).replace("label", v).replace("ref", U).getRegex();
1391
+ de = d(/^!?\[(ref)\](?:\[\])?/).replace("ref", U).getRegex();
1392
+ et = d("reflink|nolink(?!\\()", "g").replace("reflink", ke).replace("nolink", de).getRegex();
1393
+ ie = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/;
1394
+ J = { _backpedal: _, anyPunctuation: We, autolink: Xe, blockSkip: He, br: ue, code: Ce, del: _, delLDelim: _, delRDelim: _, emStrongLDelim: Ze, emStrongRDelimAst: Ne, emStrongRDelimUnd: je, escape: Ae, link: Ye, nolink: de, punctuation: De, reflink: ke, reflinkSearch: et, tag: Ve, text: Be, url: _ };
1395
+ tt = { ...J, link: d(/^!?\[(label)\]\((.*?)\)/).replace("label", v).getRegex(), reflink: d(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", v).getRegex() };
1396
+ Q = { ...J, emStrongRDelimAst: Qe, emStrongLDelim: Ge, delLDelim: Fe, delRDelim: Ke, url: d(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ie).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\S]|[^\s~\\]))\1(?=[^~]|$)/, text: d(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ie).getRegex() };
1397
+ nt = { ...Q, br: d(ue).replace("{2,}", "*").getRegex(), text: d(Q.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() };
1398
+ D = { normal: W, gfm: Ee, pedantic: Ie };
1399
+ A = { normal: J, gfm: Q, breaks: nt, pedantic: tt };
1400
+ rt = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" };
1401
+ P = class {
1402
+ options;
1403
+ block;
1404
+ constructor(e) {
1405
+ this.options = e || T;
1406
+ }
1407
+ static passThroughHooks = new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"]);
1408
+ static passThroughHooksRespectAsync = new Set(["preprocess", "postprocess", "processAllTokens"]);
1409
+ preprocess(e) {
1410
+ return e;
1411
+ }
1412
+ postprocess(e) {
1413
+ return e;
1414
+ }
1415
+ processAllTokens(e) {
1416
+ return e;
1417
+ }
1418
+ emStrongMask(e) {
1419
+ return e;
1420
+ }
1421
+ provideLexer(e = this.block) {
1422
+ return e ? x.lex : x.lexInline;
1423
+ }
1424
+ provideParser(e = this.block) {
1425
+ return e ? b.parse : b.parseInline;
1426
+ }
1427
+ };
1428
+ z = new q;
1429
+ g.options = g.setOptions = function(l3) {
1430
+ return z.setOptions(l3), g.defaults = z.defaults, N(g.defaults), g;
1431
+ };
1432
+ g.getDefaults = M;
1433
+ g.defaults = T;
1434
+ g.use = function(...l3) {
1435
+ return z.use(...l3), g.defaults = z.defaults, N(g.defaults), g;
1436
+ };
1437
+ g.walkTokens = function(l3, e) {
1438
+ return z.walkTokens(l3, e);
1439
+ };
1440
+ g.parseInline = z.parseInline;
1441
+ g.Parser = b;
1442
+ g.parser = b.parse;
1443
+ g.Renderer = y;
1444
+ g.TextRenderer = L;
1445
+ g.Lexer = x;
1446
+ g.lexer = x.lex;
1447
+ g.Tokenizer = w;
1448
+ g.Hooks = P;
1449
+ g.parse = g;
1450
+ Ft = g.options;
1451
+ Ut = g.setOptions;
1452
+ Kt = g.use;
1453
+ Wt = g.walkTokens;
1454
+ Xt = g.parseInline;
1455
+ Vt = b.parse;
1456
+ Yt = x.lex;
1457
+ });
132
1458
  // ../../node_modules/.bun/@hasna+contracts@1.0.2+e8014c875821e0be/node_modules/@hasna/contracts/dist/client/transport.js
133
1459
  import { createRequire } from "module";
134
1460
  var MAX_CREDENTIAL_FILE_BYTES, INSPECT_CUSTOM, CREDENTIAL_SEAL, AMBIENT_ENVIRONMENT, SECRETS_PACKAGE_SPECIFIER, requireSecretsSdk, IDEMPOTENT_METHODS, AUTHORITY_OVERRIDE_HEADERS;
@@ -378,7 +1704,7 @@ var util, objectUtil, ZodParsedType, getParsedType = (data) => {
378
1704
  };
379
1705
  var init_util = __esm(() => {
380
1706
  (function(util2) {
381
- util2.assertEqual = (_) => {};
1707
+ util2.assertEqual = (_2) => {};
382
1708
  function assertIs(_arg) {}
383
1709
  util2.assertIs = assertIs;
384
1710
  function assertNever(_x) {
@@ -426,7 +1752,7 @@ var init_util = __esm(() => {
426
1752
  return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
427
1753
  }
428
1754
  util2.joinValues = joinValues;
429
- util2.jsonStringifyReplacer = (_, value) => {
1755
+ util2.jsonStringifyReplacer = (_2, value) => {
430
1756
  if (typeof value === "bigint") {
431
1757
  return value.toString();
432
1758
  }
@@ -718,7 +2044,7 @@ function addIssueToContext(ctx, issueData) {
718
2044
  ctx.schemaErrorMap,
719
2045
  overrideMap,
720
2046
  overrideMap === en_default ? undefined : en_default
721
- ].filter((x) => !!x)
2047
+ ].filter((x2) => !!x2)
722
2048
  });
723
2049
  ctx.common.issues.push(issue);
724
2050
  }
@@ -792,7 +2118,7 @@ var makeIssue = (params) => {
792
2118
  };
793
2119
  }
794
2120
  let errorMessage = "";
795
- const maps = errorMaps.filter((m) => !!m).slice().reverse();
2121
+ const maps = errorMaps.filter((m2) => !!m2).slice().reverse();
796
2122
  for (const map of maps) {
797
2123
  errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
798
2124
  }
@@ -801,7 +2127,7 @@ var makeIssue = (params) => {
801
2127
  path: fullPath,
802
2128
  message: errorMessage
803
2129
  };
804
- }, EMPTY_PATH, INVALID, DIRTY = (value) => ({ status: "dirty", value }), OK = (value) => ({ status: "valid", value }), isAborted = (x) => x.status === "aborted", isDirty = (x) => x.status === "dirty", isValid = (x) => x.status === "valid", isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
2130
+ }, EMPTY_PATH, INVALID, DIRTY = (value) => ({ status: "dirty", value }), OK = (value) => ({ status: "valid", value }), isAborted = (x2) => x2.status === "aborted", isDirty = (x2) => x2.status === "dirty", isValid = (x2) => x2.status === "valid", isAsync = (x2) => typeof Promise !== "undefined" && x2 instanceof Promise;
805
2131
  var init_parseUtil = __esm(() => {
806
2132
  init_errors();
807
2133
  init_en();
@@ -1246,17 +2572,17 @@ function deepPartialify(schema) {
1246
2572
  return schema;
1247
2573
  }
1248
2574
  }
1249
- function mergeValues(a, b) {
2575
+ function mergeValues(a, b2) {
1250
2576
  const aType = getParsedType(a);
1251
- const bType = getParsedType(b);
1252
- if (a === b) {
2577
+ const bType = getParsedType(b2);
2578
+ if (a === b2) {
1253
2579
  return { valid: true, data: a };
1254
2580
  } else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
1255
- const bKeys = util.objectKeys(b);
2581
+ const bKeys = util.objectKeys(b2);
1256
2582
  const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
1257
- const newObj = { ...a, ...b };
2583
+ const newObj = { ...a, ...b2 };
1258
2584
  for (const key of sharedKeys) {
1259
- const sharedValue = mergeValues(a[key], b[key]);
2585
+ const sharedValue = mergeValues(a[key], b2[key]);
1260
2586
  if (!sharedValue.valid) {
1261
2587
  return { valid: false };
1262
2588
  }
@@ -1264,13 +2590,13 @@ function mergeValues(a, b) {
1264
2590
  }
1265
2591
  return { valid: true, data: newObj };
1266
2592
  } else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
1267
- if (a.length !== b.length) {
2593
+ if (a.length !== b2.length) {
1268
2594
  return { valid: false };
1269
2595
  }
1270
2596
  const newArray = [];
1271
2597
  for (let index = 0;index < a.length; index++) {
1272
2598
  const itemA = a[index];
1273
- const itemB = b[index];
2599
+ const itemB = b2[index];
1274
2600
  const sharedValue = mergeValues(itemA, itemB);
1275
2601
  if (!sharedValue.valid) {
1276
2602
  return { valid: false };
@@ -1278,7 +2604,7 @@ function mergeValues(a, b) {
1278
2604
  newArray.push(sharedValue.data);
1279
2605
  }
1280
2606
  return { valid: true, data: newArray };
1281
- } else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {
2607
+ } else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b2) {
1282
2608
  return { valid: true, data: a };
1283
2609
  } else {
1284
2610
  return { valid: false };
@@ -3205,7 +4531,7 @@ var init_types2 = __esm(() => {
3205
4531
  if (!schema)
3206
4532
  return null;
3207
4533
  return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
3208
- }).filter((x) => !!x);
4534
+ }).filter((x2) => !!x2);
3209
4535
  if (ctx.common.async) {
3210
4536
  return Promise.all(items).then((results) => {
3211
4537
  return ParseStatus.mergeArray(status, results);
@@ -3458,7 +4784,7 @@ var init_types2 = __esm(() => {
3458
4784
  return makeIssue({
3459
4785
  data: args,
3460
4786
  path: ctx.path,
3461
- errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
4787
+ errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x2) => !!x2),
3462
4788
  issueData: {
3463
4789
  code: ZodIssueCode.invalid_arguments,
3464
4790
  argumentsError: error
@@ -3469,7 +4795,7 @@ var init_types2 = __esm(() => {
3469
4795
  return makeIssue({
3470
4796
  data: returns,
3471
4797
  path: ctx.path,
3472
- errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
4798
+ errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x2) => !!x2),
3473
4799
  issueData: {
3474
4800
  code: ZodIssueCode.invalid_return_type,
3475
4801
  returnTypeError: error
@@ -3479,29 +4805,29 @@ var init_types2 = __esm(() => {
3479
4805
  const params = { errorMap: ctx.common.contextualErrorMap };
3480
4806
  const fn = ctx.data;
3481
4807
  if (this._def.returns instanceof ZodPromise) {
3482
- const me = this;
4808
+ const me2 = this;
3483
4809
  return OK(async function(...args) {
3484
4810
  const error = new ZodError([]);
3485
- const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
4811
+ const parsedArgs = await me2._def.args.parseAsync(args, params).catch((e) => {
3486
4812
  error.addIssue(makeArgsIssue(args, e));
3487
4813
  throw error;
3488
4814
  });
3489
4815
  const result = await Reflect.apply(fn, this, parsedArgs);
3490
- const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
4816
+ const parsedReturns = await me2._def.returns._def.type.parseAsync(result, params).catch((e) => {
3491
4817
  error.addIssue(makeReturnsIssue(result, e));
3492
4818
  throw error;
3493
4819
  });
3494
4820
  return parsedReturns;
3495
4821
  });
3496
4822
  } else {
3497
- const me = this;
4823
+ const me2 = this;
3498
4824
  return OK(function(...args) {
3499
- const parsedArgs = me._def.args.safeParse(args, params);
4825
+ const parsedArgs = me2._def.args.safeParse(args, params);
3500
4826
  if (!parsedArgs.success) {
3501
4827
  throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
3502
4828
  }
3503
4829
  const result = Reflect.apply(fn, this, parsedArgs.data);
3504
- const parsedReturns = me._def.returns.safeParse(result, params);
4830
+ const parsedReturns = me2._def.returns.safeParse(result, params);
3505
4831
  if (!parsedReturns.success) {
3506
4832
  throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
3507
4833
  }
@@ -4056,10 +5382,10 @@ var init_types2 = __esm(() => {
4056
5382
  }
4057
5383
  }
4058
5384
  }
4059
- static create(a, b) {
5385
+ static create(a, b2) {
4060
5386
  return new ZodPipeline({
4061
5387
  in: a,
4062
- out: b,
5388
+ out: b2,
4063
5389
  typeName: ZodFirstPartyTypeKind.ZodPipeline
4064
5390
  });
4065
5391
  }
@@ -4840,6 +6166,7 @@ var init_raw_store_root = __esm(() => {
4840
6166
  // src/lib/session-render.ts
4841
6167
  var SESSION_RENDER_PROFILE_ENTRYPOINTS, SESSION_RENDER_OWNED_CONFIG_TARGETS, IDENTITY_EXPORT_AUTHORITY, CODEWITH_PROTECTED_REPLACEMENT_TARGETS, CODEWITH_FLATTENED_ADAPTER, CODEWITH_NATIVE_ADAPTER, SESSION_TOOL_ADAPTERS, SESSION_RENDER_MANAGED_DIRS, SESSION_RENDER_SHARED_MANAGED_DIRS, SESSION_RENDER_EXCLUSIVE_MANAGED_PATHS, CANONICAL_IDENTITY_EXPORT_PACKAGES;
4842
6168
  var init_session_render = __esm(() => {
6169
+ init_marked_esm();
4843
6170
  init_global_agent_rules_standard();
4844
6171
  init_codewith_shared_todos_storage_standard();
4845
6172
  init_project_context();