@plumile/ui 0.1.146 → 0.1.147

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 (69) hide show
  1. package/README.md +3 -0
  2. package/lib/esm/atomic/molecules/markdown/components/MarkdownArticleContainer.css.js +1 -0
  3. package/lib/esm/atomic/molecules/markdown/components/MarkdownCodeCopyButton.js +19 -35
  4. package/lib/esm/atomic/molecules/markdown/components/MarkdownCodeCopyButton.js.map +1 -1
  5. package/lib/esm/atomic/molecules/markdown/components/MarkdownEmphasis.css.js +0 -1
  6. package/lib/esm/backoffice/atoms/copyable_text/CopyableText.js +22 -42
  7. package/lib/esm/backoffice/atoms/copyable_text/CopyableText.js.map +1 -1
  8. package/lib/esm/backoffice/molecules/backoffice_json_viewer/BackofficeJsonViewer.js +2 -1
  9. package/lib/esm/backoffice/molecules/backoffice_json_viewer/BackofficeJsonViewer.js.map +1 -1
  10. package/lib/esm/backoffice/shared/copyWithExecCommand.js +1 -14
  11. package/lib/esm/hooks/useClipboardCopy.js +31 -0
  12. package/lib/esm/hooks/useClipboardCopy.js.map +1 -0
  13. package/lib/esm/index.js +223 -221
  14. package/lib/esm/node_modules/@shikijs/core/dist/index.js +99 -96
  15. package/lib/esm/node_modules/@shikijs/core/dist/index.js.map +1 -1
  16. package/lib/esm/node_modules/@shikijs/core/node_modules/@shikijs/types/dist/index.js.map +1 -1
  17. package/lib/esm/node_modules/@shikijs/primitive/dist/index.js +91 -85
  18. package/lib/esm/node_modules/@shikijs/primitive/dist/index.js.map +1 -1
  19. package/lib/esm/node_modules/@shikijs/primitive/node_modules/@shikijs/types/dist/index.js.map +1 -1
  20. package/lib/esm/node_modules/cytoscape/dist/cytoscape.esm.js +1 -1
  21. package/lib/esm/node_modules/cytoscape/dist/cytoscape.esm.js.map +1 -1
  22. package/lib/esm/node_modules/react-shiki/dist/index.js +1 -1
  23. package/lib/esm/node_modules/shiki/dist/bundle-full.js +1 -1
  24. package/lib/esm/node_modules/shiki/dist/bundle-full.js.map +1 -1
  25. package/lib/esm/node_modules/shiki/dist/{chunk-CtajNgzt.js → chunk-D1SwGrFN.js} +2 -2
  26. package/lib/esm/node_modules/shiki/dist/chunk-D1SwGrFN.js.map +1 -0
  27. package/lib/esm/node_modules/shiki/dist/engine-oniguruma.js +1 -1
  28. package/lib/esm/node_modules/shiki/dist/engine-oniguruma.js.map +1 -1
  29. package/lib/esm/node_modules/shiki/dist/{langs-bundle-full-DfKZStlK.js → langs-bundle-full-YTHnHqaM.js} +2 -2
  30. package/lib/esm/node_modules/shiki/dist/{langs-bundle-full-DfKZStlK.js.map → langs-bundle-full-YTHnHqaM.js.map} +1 -1
  31. package/lib/esm/node_modules/shiki/dist/themes.js.map +1 -1
  32. package/lib/esm/node_modules/shiki/node_modules/@shikijs/engine-oniguruma/dist/index.js.map +1 -1
  33. package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/apex.js +1 -1
  34. package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/apex.js.map +1 -1
  35. package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/c3.js +1 -1
  36. package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/c3.js.map +1 -1
  37. package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/csharp.js +1 -1
  38. package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/csharp.js.map +1 -1
  39. package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/hack.js +1 -1
  40. package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/hack.js.map +1 -1
  41. package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/julia.js +1 -1
  42. package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/julia.js.map +1 -1
  43. package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/just.js +1 -1
  44. package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/just.js.map +1 -1
  45. package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/latex.js +1 -1
  46. package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/latex.js.map +1 -1
  47. package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/luau.js +1 -1
  48. package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/luau.js.map +1 -1
  49. package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/php.js +1 -1
  50. package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/php.js.map +1 -1
  51. package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/sql.js +1 -1
  52. package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/sql.js.map +1 -1
  53. package/lib/esm/node_modules/shiki/node_modules/@shikijs/themes/dist/vesper.js +1 -1
  54. package/lib/esm/node_modules/shiki/node_modules/@shikijs/themes/dist/vesper.js.map +1 -1
  55. package/lib/esm/shared/clipboard.js +55 -0
  56. package/lib/esm/shared/clipboard.js.map +1 -0
  57. package/lib/types/atomic/molecules/markdown/components/MarkdownCodeCopyButton.d.ts.map +1 -1
  58. package/lib/types/backoffice/atoms/copyable_text/CopyableText.d.ts.map +1 -1
  59. package/lib/types/backoffice/shared/copyWithExecCommand.d.ts +1 -1
  60. package/lib/types/backoffice/shared/copyWithExecCommand.d.ts.map +1 -1
  61. package/lib/types/hooks/useClipboardCopy.d.ts +9 -0
  62. package/lib/types/hooks/useClipboardCopy.d.ts.map +1 -0
  63. package/lib/types/index.d.ts +2 -0
  64. package/lib/types/index.d.ts.map +1 -1
  65. package/lib/types/shared/clipboard.d.ts +9 -0
  66. package/lib/types/shared/clipboard.d.ts.map +1 -0
  67. package/package.json +4 -4
  68. package/lib/esm/backoffice/shared/copyWithExecCommand.js.map +0 -1
  69. package/lib/esm/node_modules/shiki/dist/chunk-CtajNgzt.js.map +0 -1
@@ -4,19 +4,21 @@ import { FontStyle as t } from "../../vscode-textmate/dist/index.js";
4
4
  import { applyColorReplacements as n, codeToTokensBase as r, codeToTokensWithThemes as i, createShikiPrimitiveAsync as a, getLastGrammarState as o, getLastGrammarStateFromMap as s, isNoneTheme as c, isPlainLang as l, isSpecialLang as u, isSpecialTheme as d, resolveColorReplacements as f, setLastGrammarStateToMap as p, splitLines as m } from "../../primitive/dist/index.js";
5
5
  import { toHtml as h } from "../../../hast-util-to-html/lib/index.js";
6
6
  //#region ../../node_modules/@shikijs/core/dist/index.mjs
7
- function g(e, t) {
7
+ var g = /\s+/g;
8
+ function _(e, t) {
8
9
  if (!t) return e;
9
- e.properties ||= {}, e.properties.class ||= [], typeof e.properties.class == "string" && (e.properties.class = e.properties.class.split(/\s+/g)), Array.isArray(e.properties.class) || (e.properties.class = []);
10
- let n = Array.isArray(t) ? t : t.split(/\s+/g);
10
+ e.properties ||= {}, e.properties.class ||= [], typeof e.properties.class == "string" && (e.properties.class = e.properties.class.split(g)), Array.isArray(e.properties.class) || (e.properties.class = []);
11
+ let n = Array.isArray(t) ? t : t.split(g);
11
12
  for (let t of n) t && !e.properties.class.includes(t) && e.properties.class.push(t);
12
13
  return e;
13
14
  }
14
- function _(e) {
15
+ var v = /:?lang=["']([^"']+)["']/g, y = /(?:```|~~~)([\w-]+)/g, b = /\\begin\{([\w-]+)\}/g, x = /<script\s+(?:type|lang)=["']([^"']+)["']/gi;
16
+ function S(e) {
15
17
  let t = m(e, !0).map(([e]) => e);
16
18
  function n(n) {
17
19
  if (n === e.length) return {
18
20
  line: t.length - 1,
19
- character: t[t.length - 1].length
21
+ character: t.at(-1).length
20
22
  };
21
23
  let r = n, i = 0;
22
24
  for (let e of t) {
@@ -39,30 +41,30 @@ function _(e) {
39
41
  posToIndex: r
40
42
  };
41
43
  }
42
- function v(e, t, n) {
44
+ function C(e, t, n) {
43
45
  let r = /* @__PURE__ */ new Set();
44
- for (let t of e.matchAll(/:?lang=["']([^"']+)["']/g)) {
46
+ for (let t of e.matchAll(v)) {
45
47
  let e = t[1].toLowerCase().trim();
46
48
  e && r.add(e);
47
49
  }
48
- for (let t of e.matchAll(/(?:```|~~~)([\w-]+)/g)) {
50
+ for (let t of e.matchAll(y)) {
49
51
  let e = t[1].toLowerCase().trim();
50
52
  e && r.add(e);
51
53
  }
52
- for (let t of e.matchAll(/\\begin\{([\w-]+)\}/g)) {
54
+ for (let t of e.matchAll(b)) {
53
55
  let e = t[1].toLowerCase().trim();
54
56
  e && r.add(e);
55
57
  }
56
- for (let t of e.matchAll(/<script\s+(?:type|lang)=["']([^"']+)["']/gi)) {
58
+ for (let t of e.matchAll(x)) {
57
59
  let e = t[1].toLowerCase().trim(), n = e.includes("/") ? e.split("/").pop() : e;
58
60
  n && r.add(n);
59
61
  }
60
- if (!n) return Array.from(r);
62
+ if (!n) return [...r];
61
63
  let i = n.getBundledLanguages();
62
- return Array.from(r).filter((e) => e && i[e]);
64
+ return [...r].filter((e) => e && i[e]);
63
65
  }
64
- var y = "light-dark()", b = ["color", "background-color"];
65
- function x(e, t) {
66
+ var w = ["color", "background-color"];
67
+ function T(e, t) {
66
68
  let n = 0, r = [];
67
69
  for (let i of t) i > n && r.push({
68
70
  ...e,
@@ -75,26 +77,26 @@ function x(e, t) {
75
77
  offset: e.offset + n
76
78
  }), r;
77
79
  }
78
- function S(e, t) {
79
- let n = Array.from(t instanceof Set ? t : new Set(t)).sort((e, t) => e - t);
80
+ function E(e, t) {
81
+ let n = [...t instanceof Set ? t : new Set(t)].sort((e, t) => e - t);
80
82
  return n.length ? e.map((e) => e.flatMap((e) => {
81
83
  let t = n.filter((t) => e.offset < t && t < e.offset + e.content.length).map((t) => t - e.offset).sort((e, t) => e - t);
82
- return t.length ? x(e, t) : e;
84
+ return t.length ? T(e, t) : e;
83
85
  })) : e;
84
86
  }
85
- function C(t, n, r, i, a = "css-vars") {
87
+ function D(t, n, r, i, a = "css-vars") {
86
88
  let o = {
87
89
  content: t.content,
88
90
  explanation: t.explanation,
89
91
  offset: t.offset
90
- }, s = n.map((e) => w(t.variants[e])), c = new Set(s.flatMap((e) => Object.keys(e))), l = {}, u = (e, t) => {
92
+ }, s = n.map((e) => O(t.variants[e])), c = new Set(s.flatMap((e) => Object.keys(e))), l = {}, u = (e, t) => {
91
93
  let i = t === "color" ? "" : t === "background-color" ? "-bg" : `-${t}`;
92
94
  return r + n[e] + (t === "color" ? "" : i);
93
95
  };
94
96
  return s.forEach((t, r) => {
95
97
  for (let o of c) {
96
98
  let c = t[o] || "inherit";
97
- if (r === 0 && i && b.includes(o)) if (i === y && s.length > 1) {
99
+ if (r === 0 && i && w.includes(o)) if (i === "light-dark()" && s.length > 1) {
98
100
  let t = n.findIndex((e) => e === "light"), i = n.findIndex((e) => e === "dark");
99
101
  if (t === -1 || i === -1) throw new e("When using `defaultColor: \"light-dark()\"`, you must provide both `light` and `dark` themes");
100
102
  l[o] = `light-dark(${s[t][o] || "inherit"}, ${s[i][o] || "inherit"})`, a === "css-vars" && (l[u(r, o)] = c);
@@ -103,7 +105,7 @@ function C(t, n, r, i, a = "css-vars") {
103
105
  }
104
106
  }), o.htmlStyle = l, o;
105
107
  }
106
- function w(e) {
108
+ function O(e) {
107
109
  let n = {};
108
110
  if (e.color && (n.color = e.color), e.bgColor && (n["background-color"] = e.bgColor), e.fontStyle) {
109
111
  e.fontStyle & t.Italic && (n["font-style"] = "italic"), e.fontStyle & t.Bold && (n["font-weight"] = "bold");
@@ -112,14 +114,14 @@ function w(e) {
112
114
  }
113
115
  return n;
114
116
  }
115
- function T(e) {
117
+ function k(e) {
116
118
  return typeof e == "string" ? e : Object.entries(e).map(([e, t]) => `${e}:${t}`).join(";");
117
119
  }
118
- function E() {
120
+ function A() {
119
121
  let t = /* @__PURE__ */ new WeakMap();
120
122
  function n(n) {
121
123
  if (!t.has(n.meta)) {
122
- let r = _(n.source);
124
+ let r = S(n.source);
123
125
  function i(t) {
124
126
  if (typeof t == "number") {
125
127
  if (t < 0 || t > n.source.length) throw new e(`Invalid decoration offset: ${t}. Code length: ${n.source.length}`);
@@ -144,7 +146,7 @@ function E() {
144
146
  start: i(e.start),
145
147
  end: i(e.end)
146
148
  }));
147
- D(a), t.set(n.meta, {
149
+ j(a), t.set(n.meta, {
148
150
  decorations: a,
149
151
  converter: r,
150
152
  source: n.source
@@ -155,15 +157,15 @@ function E() {
155
157
  return {
156
158
  name: "shiki:decorations",
157
159
  tokens(e) {
158
- if (this.options.decorations?.length) return S(e, n(this).decorations.flatMap((e) => [e.start.offset, e.end.offset]));
160
+ if (this.options.decorations?.length) return E(e, n(this).decorations.flatMap((e) => [e.start.offset, e.end.offset]));
159
161
  },
160
162
  code(t) {
161
163
  if (!this.options.decorations?.length) return;
162
- let r = n(this), i = Array.from(t.children).filter((e) => e.type === "element" && e.tagName === "span");
164
+ let r = n(this), i = [...t.children].filter((e) => e.type === "element" && e.tagName === "span");
163
165
  if (i.length !== r.converter.lines.length) throw new e(`Number of lines in code element (${i.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);
164
166
  function a(t, n, r, a) {
165
167
  let o = i[t], c = "", l = -1, u = -1;
166
- if (n === 0 && (l = 0), r === 0 && (u = 0), r === Infinity && (u = o.children.length), l === -1 || u === -1) for (let e = 0; e < o.children.length; e++) c += O(o.children[e]), l === -1 && c.length === n && (l = e + 1), u === -1 && c.length === r && (u = e + 1);
168
+ if (n === 0 && (l = 0), r === 0 && (u = 0), r === Infinity && (u = o.children.length), l === -1 || u === -1) for (let e = 0; e < o.children.length; e++) c += M(o.children[e]), l === -1 && c.length === n && (l = e + 1), u === -1 && c.length === r && (u = e + 1);
167
169
  if (l === -1) throw new e(`Failed to find start index for decoration ${JSON.stringify(a.start)}`);
168
170
  if (u === -1) throw new e(`Failed to find end index for decoration ${JSON.stringify(a.end)}`);
169
171
  let d = o.children.slice(l, u);
@@ -188,7 +190,7 @@ function E() {
188
190
  ...e.properties,
189
191
  ...r,
190
192
  class: e.properties.class
191
- }, t.properties?.class && g(e, t.properties.class), e = i(e, n) || e, e;
193
+ }, t.properties?.class && _(e, t.properties.class), e = i(e, n) || e, e;
192
194
  }
193
195
  let c = [], l = r.decorations.sort((e, t) => t.start.offset - e.start.offset || e.end.offset - t.end.offset);
194
196
  for (let e of l) {
@@ -204,7 +206,7 @@ function E() {
204
206
  }
205
207
  };
206
208
  }
207
- function D(t) {
209
+ function j(t) {
208
210
  for (let n = 0; n < t.length; n++) {
209
211
  let r = t[n];
210
212
  if (r.start.offset > r.end.offset) throw new e(`Invalid decoration range: ${JSON.stringify(r.start)} - ${JSON.stringify(r.end)}`);
@@ -217,20 +219,20 @@ function D(t) {
217
219
  }
218
220
  }
219
221
  }
220
- function O(e) {
221
- return e.type === "text" ? e.value : e.type === "element" ? e.children.map(O).join("") : "";
222
+ function M(e) {
223
+ return e.type === "text" ? e.value : e.type === "element" ? e.children.map(M).join("") : "";
222
224
  }
223
- var k = [/* @__PURE__ */ E()];
224
- function A(e) {
225
- let t = j(e.transformers || []);
225
+ var N = [/* @__PURE__ */ A()];
226
+ function P(e) {
227
+ let t = F(e.transformers || []);
226
228
  return [
227
229
  ...t.pre,
228
230
  ...t.normal,
229
231
  ...t.post,
230
- ...k
232
+ ...N
231
233
  ];
232
234
  }
233
- function j(e) {
235
+ function F(e) {
234
236
  let t = [], n = [], r = [];
235
237
  for (let i of e) switch (i.enforce) {
236
238
  case "pre":
@@ -247,7 +249,7 @@ function j(e) {
247
249
  normal: r
248
250
  };
249
251
  }
250
- var M = [
252
+ var I = [
251
253
  "black",
252
254
  "red",
253
255
  "green",
@@ -264,7 +266,7 @@ var M = [
264
266
  "brightMagenta",
265
267
  "brightCyan",
266
268
  "brightWhite"
267
- ], N = {
269
+ ], L = {
268
270
  1: "bold",
269
271
  2: "dim",
270
272
  3: "italic",
@@ -273,7 +275,7 @@ var M = [
273
275
  8: "hidden",
274
276
  9: "strikethrough"
275
277
  };
276
- function P(e, t) {
278
+ function R(e, t) {
277
279
  let n = e.indexOf("\x1B", t);
278
280
  if (n !== -1 && e[n + 1] === "[") {
279
281
  let t = e.indexOf("m", n);
@@ -285,7 +287,7 @@ function P(e, t) {
285
287
  }
286
288
  return { position: e.length };
287
289
  }
288
- function F(e) {
290
+ function z(e) {
289
291
  let t = e.shift();
290
292
  if (t === "2") {
291
293
  let t = e.splice(0, 3).map((e) => Number.parseInt(e));
@@ -301,19 +303,19 @@ function F(e) {
301
303
  };
302
304
  }
303
305
  }
304
- function I(e) {
306
+ function ee(e) {
305
307
  let t = [];
306
308
  for (; e.length > 0;) {
307
309
  let n = e.shift();
308
310
  if (!n) continue;
309
311
  let r = Number.parseInt(n);
310
312
  if (!Number.isNaN(r)) if (r === 0) t.push({ type: "resetAll" });
311
- else if (r <= 9) N[r] && t.push({
313
+ else if (r <= 9) L[r] && t.push({
312
314
  type: "setDecoration",
313
- value: N[r]
315
+ value: L[r]
314
316
  });
315
317
  else if (r <= 29) {
316
- let e = N[r - 20];
318
+ let e = L[r - 20];
317
319
  e && (t.push({
318
320
  type: "resetDecoration",
319
321
  value: e
@@ -325,11 +327,11 @@ function I(e) {
325
327
  type: "setForegroundColor",
326
328
  value: {
327
329
  type: "named",
328
- name: M[r - 30]
330
+ name: I[r - 30]
329
331
  }
330
332
  });
331
333
  else if (r === 38) {
332
- let n = F(e);
334
+ let n = z(e);
333
335
  n && t.push({
334
336
  type: "setForegroundColor",
335
337
  value: n
@@ -339,11 +341,11 @@ function I(e) {
339
341
  type: "setBackgroundColor",
340
342
  value: {
341
343
  type: "named",
342
- name: M[r - 40]
344
+ name: I[r - 40]
343
345
  }
344
346
  });
345
347
  else if (r === 48) {
346
- let n = F(e);
348
+ let n = z(e);
347
349
  n && t.push({
348
350
  type: "setBackgroundColor",
349
351
  value: n
@@ -358,31 +360,31 @@ function I(e) {
358
360
  type: "setForegroundColor",
359
361
  value: {
360
362
  type: "named",
361
- name: M[r - 90 + 8]
363
+ name: I[r - 90 + 8]
362
364
  }
363
365
  }) : r >= 100 && r <= 107 && t.push({
364
366
  type: "setBackgroundColor",
365
367
  value: {
366
368
  type: "named",
367
- name: M[r - 100 + 8]
369
+ name: I[r - 100 + 8]
368
370
  }
369
371
  });
370
372
  }
371
373
  return t;
372
374
  }
373
- function L() {
375
+ function te() {
374
376
  let e = null, t = null, n = /* @__PURE__ */ new Set();
375
377
  return { parse(r) {
376
378
  let i = [], a = 0;
377
379
  do {
378
- let o = P(r, a), s = o.sequence ? r.substring(a, o.startPosition) : r.substring(a);
380
+ let o = R(r, a), s = o.sequence ? r.substring(a, o.startPosition) : r.substring(a);
379
381
  if (s.length > 0 && i.push({
380
382
  value: s,
381
383
  foreground: e,
382
384
  background: t,
383
385
  decorations: new Set(n)
384
386
  }), o.sequence) {
385
- let r = I(o.sequence);
387
+ let r = ee(o.sequence);
386
388
  for (let i of r) i.type === "resetAll" ? (e = null, t = null, n.clear()) : i.type === "resetForegroundColor" ? e = null : i.type === "resetBackgroundColor" ? t = null : i.type === "resetDecoration" && n.delete(i.value);
387
389
  for (let i of r) i.type === "setForegroundColor" ? e = i.value : i.type === "setBackgroundColor" ? t = i.value : i.type === "setDecoration" && n.add(i.value);
388
390
  }
@@ -391,7 +393,7 @@ function L() {
391
393
  return i;
392
394
  } };
393
395
  }
394
- var R = {
396
+ var ne = {
395
397
  black: "#000000",
396
398
  red: "#bb0000",
397
399
  green: "#00bb00",
@@ -409,7 +411,7 @@ var R = {
409
411
  brightCyan: "#55ffff",
410
412
  brightWhite: "#ffffff"
411
413
  };
412
- function z(e = R) {
414
+ function re(e = ne) {
413
415
  function t(t) {
414
416
  return e[t];
415
417
  }
@@ -420,7 +422,7 @@ function z(e = R) {
420
422
  function i() {
421
423
  if (r) return r;
422
424
  r = [];
423
- for (let e = 0; e < M.length; e++) r.push(t(M[e]));
425
+ for (let e = 0; e < I.length; e++) r.push(t(I[e]));
424
426
  let e = [
425
427
  0,
426
428
  95,
@@ -454,7 +456,7 @@ function z(e = R) {
454
456
  }
455
457
  return { value: o };
456
458
  }
457
- var B = {
459
+ var ie = /#([0-9a-f]{3,8})/i, ae = /var\((--[\w-]+-ansi-[\w-]+)\)/, B = {
458
460
  black: "#000000",
459
461
  red: "#cd3131",
460
462
  green: "#0DBC79",
@@ -473,10 +475,10 @@ var B = {
473
475
  brightWhite: "#FFFFFF"
474
476
  };
475
477
  function V(e, r, i) {
476
- let a = f(e, i), o = m(r), s = z(Object.fromEntries(M.map((t) => {
478
+ let a = f(e, i), o = m(r), s = re(Object.fromEntries(I.map((t) => {
477
479
  let n = `terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`;
478
480
  return [t, e.colors?.[n] || B[t]];
479
- }))), c = L();
481
+ }))), c = te();
480
482
  return o.map((r) => c.parse(r[0]).map((i) => {
481
483
  let o, c;
482
484
  i.decorations.has("reverse") ? (o = i.background ? s.value(i.background) : e.bg, c = i.foreground ? s.value(i.foreground) : e.fg) : (o = i.foreground ? s.value(i.foreground) : e.fg, c = i.background ? s.value(i.background) : void 0), o = n(o, a), c = n(c, a), i.decorations.has("dim") && (o = H(o));
@@ -491,7 +493,7 @@ function V(e, r, i) {
491
493
  }));
492
494
  }
493
495
  function H(e) {
494
- let t = e.match(/#([0-9a-f]{3,8})/i);
496
+ let t = e.match(ie);
495
497
  if (t) {
496
498
  let e = t[1];
497
499
  if (e.length === 8) {
@@ -506,7 +508,7 @@ function H(e) {
506
508
  return `#${t}${t}${n}${n}${r}${r}80`;
507
509
  }
508
510
  }
509
- let n = e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);
511
+ let n = e.match(ae);
510
512
  return n ? `var(${n[1]}-dim)` : e;
511
513
  }
512
514
  function U(e, t, n = {}) {
@@ -526,11 +528,11 @@ function W(t, r, a) {
526
528
  })).sort((e, t) => e.color === n ? -1 : +(t.color === n));
527
529
  if (_.length === 0) throw new e("`themes` option must not be empty");
528
530
  let v = i(t, r, a, U);
529
- if (m = s(v), n && y !== n && !_.find((e) => e.color === n)) throw new e(`\`themes\` option must contain the defaultColor key \`${n}\``);
530
- let b = _.map((e) => t.getTheme(e.theme)), x = _.map((e) => e.color);
531
- l = v.map((e) => e.map((e) => C(e, x, h, n, g))), m && p(l, m);
532
- let S = _.map((e) => f(e.theme, a));
533
- c = G(_, b, S, h, n, "fg", g), o = G(_, b, S, h, n, "bg", g), u = `shiki-themes ${b.map((e) => e.name).join(" ")}`, d = n ? void 0 : [c, o].join(";");
531
+ if (m = s(v), n && n !== "light-dark()" && !_.some((e) => e.color === n)) throw new e(`\`themes\` option must contain the defaultColor key \`${n}\``);
532
+ let y = _.map((e) => t.getTheme(e.theme)), b = _.map((e) => e.color);
533
+ l = v.map((e) => e.map((e) => D(e, b, h, n, g))), m && p(l, m);
534
+ let x = _.map((e) => f(e.theme, a));
535
+ c = G(_, y, x, h, n, "fg", g), o = G(_, y, x, h, n, "bg", g), u = `shiki-themes ${y.map((e) => e.name).join(" ")}`, d = n ? void 0 : [c, o].join(";");
534
536
  } else if ("theme" in a) {
535
537
  let e = f(a.theme, a);
536
538
  l = U(t, r, a);
@@ -550,7 +552,7 @@ function G(t, r, i, a, o, s, c) {
550
552
  return t.map((l, u) => {
551
553
  let d = n(r[u][s], i[u]) || "inherit", f = `${a + l.color}${s === "bg" ? "-bg" : ""}:${d}`;
552
554
  if (u === 0 && o) {
553
- if (o === y && t.length > 1) {
555
+ if (o === "light-dark()" && t.length > 1) {
554
556
  let a = t.findIndex((e) => e.color === "light"), o = t.findIndex((e) => e.color === "dark");
555
557
  if (a === -1 || o === -1) throw new e("When using `defaultColor: \"light-dark()\"`, you must provide both `light` and `dark` themes");
556
558
  return `light-dark(${n(r[a][s], i[a]) || "inherit"}, ${n(r[o][s], i[o]) || "inherit"});${f}`;
@@ -560,24 +562,25 @@ function G(t, r, i, a, o, s, c) {
560
562
  return c === "css-vars" ? f : null;
561
563
  }).filter((e) => !!e).join(";");
562
564
  }
563
- function K(e, t, n, r = {
565
+ var K = /^\s+$/, q = /^(\s*)(.*?)(\s*)$/;
566
+ function J(e, t, n, r = {
564
567
  meta: {},
565
568
  options: n,
566
- codeToHast: (t, n) => K(e, t, n),
569
+ codeToHast: (t, n) => J(e, t, n),
567
570
  codeToTokens: (t, n) => W(e, t, n)
568
571
  }) {
569
572
  let i = t;
570
- for (let e of A(n)) i = e.preprocess?.call(r, i, n) || i;
573
+ for (let e of P(n)) i = e.preprocess?.call(r, i, n) || i;
571
574
  let { tokens: a, fg: o, bg: s, themeName: c, rootStyle: l, grammarState: u } = W(e, i, n), { mergeWhitespaces: d = !0, mergeSameStyleTokens: f = !1 } = n;
572
- d === !0 ? a = J(a) : d === "never" && (a = Y(a)), f && (a = X(a));
575
+ d === !0 ? a = oe(a) : d === "never" && (a = se(a)), f && (a = X(a));
573
576
  let p = {
574
577
  ...r,
575
578
  get source() {
576
579
  return i;
577
580
  }
578
581
  };
579
- for (let e of A(n)) a = e.tokens?.call(p, a) || a;
580
- return q(a, {
582
+ for (let e of P(n)) a = e.tokens?.call(p, a) || a;
583
+ return Y(a, {
581
584
  ...n,
582
585
  fg: o,
583
586
  bg: s,
@@ -585,8 +588,8 @@ function K(e, t, n, r = {
585
588
  rootStyle: n.rootStyle === !1 ? !1 : n.rootStyle ?? l
586
589
  }, p, u);
587
590
  }
588
- function q(e, t, n, r = s(e)) {
589
- let i = A(t), a = [], o = {
591
+ function Y(e, t, n, r = s(e)) {
592
+ let i = P(t), a = [], o = {
590
593
  type: "root",
591
594
  children: []
592
595
  }, { structure: c = "classic", tabindex: l = "0" } = t, u = { class: `shiki ${t.themeName || ""}` };
@@ -606,7 +609,7 @@ function q(e, t, n, r = s(e)) {
606
609
  }, m = [], h = {
607
610
  ...n,
608
611
  structure: c,
609
- addClassToHast: g,
612
+ addClassToHast: _,
610
613
  get source() {
611
614
  return n.source;
612
615
  },
@@ -654,7 +657,7 @@ function q(e, t, n, r = s(e)) {
654
657
  type: "text",
655
658
  value: a.content
656
659
  }]
657
- }, s = T(a.htmlStyle || w(a));
660
+ }, s = k(a.htmlStyle || O(a));
658
661
  s && (e.properties.style = s);
659
662
  for (let o of i) e = o?.span?.call(h, e, t + 1, r, n, a) || e;
660
663
  c === "inline" ? o.children.push(e) : c === "classic" && n.children.push(e), r += a.content.length;
@@ -701,16 +704,16 @@ function q(e, t, n, r = s(e)) {
701
704
  t.type === "element" && o.children.push(...t.children);
702
705
  }
703
706
  }
704
- let _ = o;
705
- for (let e of i) _ = e?.root?.call(h, _) || _;
706
- return r && p(_, r), _;
707
+ let g = o;
708
+ for (let e of i) g = e?.root?.call(h, g) || g;
709
+ return r && p(g, r), g;
707
710
  }
708
- function J(e) {
711
+ function oe(e) {
709
712
  return e.map((e) => {
710
713
  let n = [], r = "", i;
711
714
  return e.forEach((a, o) => {
712
715
  let s = !(a.fontStyle && (a.fontStyle & t.Underline || a.fontStyle & t.Strikethrough));
713
- s && a.content.match(/^\s+$/) && e[o + 1] ? (i === void 0 && (i = a.offset), r += a.content) : r ? (s ? n.push({
716
+ s && K.test(a.content) && e[o + 1] ? (i === void 0 && (i = a.offset), r += a.content) : r ? (s ? n.push({
714
717
  ...a,
715
718
  offset: i,
716
719
  content: r + a.content
@@ -721,10 +724,10 @@ function J(e) {
721
724
  }), n;
722
725
  });
723
726
  }
724
- function Y(e) {
727
+ function se(e) {
725
728
  return e.map((e) => e.flatMap((e) => {
726
- if (e.content.match(/^\s+$/)) return e;
727
- let t = e.content.match(/^(\s*)(.*?)(\s*)$/);
729
+ if (K.test(e.content)) return e;
730
+ let t = e.content.match(q);
728
731
  if (!t) return e;
729
732
  let [, n, r, i] = t;
730
733
  if (!n && !i) return e;
@@ -750,21 +753,21 @@ function X(e) {
750
753
  n.push({ ...r });
751
754
  continue;
752
755
  }
753
- let e = n[n.length - 1], i = T(e.htmlStyle || w(e)), a = T(r.htmlStyle || w(r)), o = e.fontStyle && (e.fontStyle & t.Underline || e.fontStyle & t.Strikethrough), s = r.fontStyle && (r.fontStyle & t.Underline || r.fontStyle & t.Strikethrough);
756
+ let e = n.at(-1), i = k(e.htmlStyle || O(e)), a = k(r.htmlStyle || O(r)), o = e.fontStyle && (e.fontStyle & t.Underline || e.fontStyle & t.Strikethrough), s = r.fontStyle && (r.fontStyle & t.Underline || r.fontStyle & t.Strikethrough);
754
757
  !o && !s && i === a ? e.content += r.content : n.push({ ...r });
755
758
  }
756
759
  return n;
757
760
  });
758
761
  }
759
762
  var Z = h;
760
- function ee(e, t, n) {
763
+ function ce(e, t, n) {
761
764
  let r = {
762
765
  meta: {},
763
766
  options: n,
764
- codeToHast: (t, n) => K(e, t, n),
767
+ codeToHast: (t, n) => J(e, t, n),
765
768
  codeToTokens: (t, n) => W(e, t, n)
766
- }, i = Z(K(e, t, n, r));
767
- for (let e of A(n)) i = e.postprocess?.call(r, i, n) || i;
769
+ }, i = Z(J(e, t, n, r));
770
+ for (let e of P(n)) i = e.postprocess?.call(r, i, n) || i;
768
771
  return i;
769
772
  }
770
773
  async function Q(e) {
@@ -774,15 +777,15 @@ async function Q(e) {
774
777
  codeToTokensBase: (e, n) => U(t, e, n),
775
778
  codeToTokensWithThemes: (e, n) => i(t, e, n),
776
779
  codeToTokens: (e, n) => W(t, e, n),
777
- codeToHast: (e, n) => K(t, e, n),
778
- codeToHtml: (e, n) => ee(t, e, n),
780
+ codeToHast: (e, n) => J(t, e, n),
781
+ codeToHtml: (e, n) => ce(t, e, n),
779
782
  getBundledLanguages: () => ({}),
780
783
  getBundledThemes: () => ({}),
781
784
  ...t,
782
785
  getInternalContext: () => t
783
786
  };
784
787
  }
785
- function te(t) {
788
+ function le(t) {
786
789
  let n = t.langs, r = t.themes, i = t.engine;
787
790
  async function a(t) {
788
791
  function a(r) {
@@ -845,7 +848,7 @@ function $(e) {
845
848
  }
846
849
  return n;
847
850
  }
848
- function ne(e, t) {
851
+ function ue(e, t) {
849
852
  let n = $(e);
850
853
  async function r(e, r) {
851
854
  let i = await n({
@@ -882,6 +885,6 @@ function ne(e, t) {
882
885
  };
883
886
  }
884
887
  //#endregion
885
- export { g as addClassToHast, te as createBundledHighlighter, Q as createHighlighterCore, _ as createPositionConverter, ne as createSingletonShorthands, C as flatTokenVariants, w as getTokenStyleObject, v as guessEmbeddedLanguages, Z as hastToHtml, $ as makeSingletonHighlighter, x as splitToken, S as splitTokens, T as stringifyTokenStyle, V as tokenizeAnsiWithTheme, q as tokensToHast, E as transformerDecorations };
888
+ export { _ as addClassToHast, le as createBundledHighlighter, Q as createHighlighterCore, S as createPositionConverter, ue as createSingletonShorthands, D as flatTokenVariants, O as getTokenStyleObject, C as guessEmbeddedLanguages, Z as hastToHtml, $ as makeSingletonHighlighter, T as splitToken, E as splitTokens, k as stringifyTokenStyle, V as tokenizeAnsiWithTheme, Y as tokensToHast, A as transformerDecorations };
886
889
 
887
890
  //# sourceMappingURL=index.js.map