@synclineapi/mdx-editor 0.1.1

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.
@@ -0,0 +1,2845 @@
1
+ import w from "highlight.js";
2
+ class H {
3
+ constructor() {
4
+ this.listeners = /* @__PURE__ */ new Map();
5
+ }
6
+ on(e, t) {
7
+ this.listeners.has(e) || this.listeners.set(e, /* @__PURE__ */ new Set()), this.listeners.get(e).add(t);
8
+ }
9
+ off(e, t) {
10
+ var o;
11
+ (o = this.listeners.get(e)) == null || o.delete(t);
12
+ }
13
+ emit(e, t) {
14
+ var o;
15
+ (o = this.listeners.get(e)) == null || o.forEach((i) => {
16
+ try {
17
+ i(t);
18
+ } catch (s) {
19
+ console.error(`[SynclineMDX] Error in event handler for "${e}":`, s);
20
+ }
21
+ });
22
+ }
23
+ removeAllListeners(e) {
24
+ e ? this.listeners.delete(e) : this.listeners.clear();
25
+ }
26
+ }
27
+ class D {
28
+ constructor(e, t) {
29
+ this.editorApi = e, this.plugins = /* @__PURE__ */ new Map(), this.toolbarItems = /* @__PURE__ */ new Map(), this.shortcuts = [], this.renderers = [], this.parsers = [], this.styleElements = [], this.events = t;
30
+ }
31
+ async register(e) {
32
+ if (this.plugins.has(e.name)) {
33
+ console.warn(`[SynclineMDX] Plugin "${e.name}" is already registered.`);
34
+ return;
35
+ }
36
+ if (e.dependencies) {
37
+ for (const t of e.dependencies)
38
+ if (!this.plugins.has(t))
39
+ throw new Error(`[SynclineMDX] Plugin "${e.name}" requires "${t}" which is not registered.`);
40
+ }
41
+ if (this.plugins.set(e.name, e), e.toolbarItems)
42
+ for (const t of e.toolbarItems)
43
+ this.toolbarItems.set(t.id, t);
44
+ e.shortcuts && this.shortcuts.push(...e.shortcuts), e.renderers && (this.renderers.push(...e.renderers), this.renderers.sort((t, o) => (o.priority ?? 0) - (t.priority ?? 0))), e.parsers && (this.parsers.push(...e.parsers), this.parsers.sort((t, o) => (o.priority ?? 0) - (t.priority ?? 0))), e.styles && this.injectStyles(e.styles), e.init && await e.init(this.createContext()), this.events.emit("plugin-registered", e.name);
45
+ }
46
+ unregister(e) {
47
+ const t = this.plugins.get(e);
48
+ if (t) {
49
+ if (t.destroy && t.destroy(this.createContext()), t.toolbarItems)
50
+ for (const o of t.toolbarItems)
51
+ this.toolbarItems.delete(o.id);
52
+ if (t.shortcuts && (this.shortcuts = this.shortcuts.filter(
53
+ (o) => !t.shortcuts.some((i) => i.key === o.key)
54
+ )), t.renderers) {
55
+ const o = new Set(t.renderers.map((i) => i.name));
56
+ this.renderers = this.renderers.filter((i) => !o.has(i.name));
57
+ }
58
+ if (t.parsers) {
59
+ const o = new Set(t.parsers.map((i) => i.name));
60
+ this.parsers = this.parsers.filter((i) => !o.has(i.name));
61
+ }
62
+ this.plugins.delete(e), this.events.emit("plugin-removed", e);
63
+ }
64
+ }
65
+ getToolbarItem(e) {
66
+ return this.toolbarItems.get(e);
67
+ }
68
+ getAllToolbarItems() {
69
+ return this.toolbarItems;
70
+ }
71
+ getShortcuts() {
72
+ return this.shortcuts;
73
+ }
74
+ getRenderers() {
75
+ return this.renderers;
76
+ }
77
+ getParsers() {
78
+ return this.parsers;
79
+ }
80
+ hasPlugin(e) {
81
+ return this.plugins.has(e);
82
+ }
83
+ createContext() {
84
+ return {
85
+ editor: this.editorApi,
86
+ registerToolbarItem: (e) => this.toolbarItems.set(e.id, e),
87
+ registerShortcut: (e) => this.shortcuts.push(e),
88
+ registerRenderer: (e) => {
89
+ this.renderers.push(e), this.renderers.sort((t, o) => (o.priority ?? 0) - (t.priority ?? 0));
90
+ },
91
+ registerParser: (e) => {
92
+ this.parsers.push(e), this.parsers.sort((t, o) => (o.priority ?? 0) - (t.priority ?? 0));
93
+ },
94
+ injectStyles: (e) => this.injectStyles(e),
95
+ emit: (e, t) => this.events.emit(e, t),
96
+ on: (e, t) => this.events.on(e, t),
97
+ off: (e, t) => this.events.off(e, t)
98
+ };
99
+ }
100
+ injectStyles(e) {
101
+ const t = document.createElement("style");
102
+ t.setAttribute("data-syncline-mdx", "plugin"), t.textContent = e, document.head.appendChild(t), this.styleElements.push(t);
103
+ }
104
+ destroy() {
105
+ for (const [e] of this.plugins)
106
+ this.unregister(e);
107
+ for (const e of this.styleElements)
108
+ e.remove();
109
+ this.styleElements = [];
110
+ }
111
+ }
112
+ class z {
113
+ constructor(e, t, o, i) {
114
+ this.config = e, this.pluginManager = t, this.editorApi = o, this.events = i, this.activeDropdown = null, this.documentClickHandler = (s) => {
115
+ this.activeDropdown && !this.activeDropdown.contains(s.target) && this.closeDropdowns();
116
+ };
117
+ }
118
+ render(e) {
119
+ this.el = document.createElement("div"), this.el.className = "smdx-toolbar";
120
+ for (const t of this.config) {
121
+ const o = document.createElement("div");
122
+ o.className = "smdx-toolbar-row", this.renderRow(t, o), this.el.appendChild(o);
123
+ }
124
+ return e.appendChild(this.el), document.addEventListener("click", this.documentClickHandler), this.el;
125
+ }
126
+ renderRow(e, t) {
127
+ for (const o of e)
128
+ typeof o == "string" ? o === "|" ? this.renderDivider(t) : this.renderItem(o, t) : "type" in o && o.type === "divider" ? this.renderDivider(t) : "type" in o && o.type === "group" && this.renderGroup(o, t);
129
+ }
130
+ renderDivider(e) {
131
+ const t = document.createElement("span");
132
+ t.className = "smdx-toolbar-divider", e.appendChild(t);
133
+ }
134
+ renderItem(e, t) {
135
+ const o = this.pluginManager.getToolbarItem(e);
136
+ if (o)
137
+ if (o.children && o.children.length > 0)
138
+ this.renderDropdownItem(o, t);
139
+ else {
140
+ const i = this.createButton(o);
141
+ t.appendChild(i);
142
+ }
143
+ }
144
+ renderGroup(e, t) {
145
+ if (e.display === "dropdown")
146
+ this.renderDropdownGroup(e, t);
147
+ else {
148
+ const o = document.createElement("div");
149
+ o.className = "smdx-toolbar-group";
150
+ for (const i of e.items)
151
+ typeof i == "string" ? this.renderItem(i, o) : this.renderGroup(i, o);
152
+ t.appendChild(o);
153
+ }
154
+ }
155
+ renderDropdownGroup(e, t) {
156
+ const o = document.createElement("div");
157
+ o.className = "smdx-toolbar-dropdown";
158
+ const i = document.createElement("button");
159
+ i.className = "smdx-toolbar-btn smdx-toolbar-dropdown-trigger", i.type = "button", i.innerHTML = `${e.icon || ""}<span class="smdx-toolbar-btn-label">${e.label || ""}</span><svg class="smdx-dropdown-arrow" width="10" height="6" viewBox="0 0 10 6"><path d="M1 1l4 4 4-4" stroke="currentColor" fill="none" stroke-width="1.5"/></svg>`, i.title = e.label || "", i.setAttribute("aria-label", e.label || "Dropdown"), i.setAttribute("aria-haspopup", "true"), i.setAttribute("aria-expanded", "false");
160
+ const s = document.createElement("div");
161
+ s.className = "smdx-toolbar-dropdown-menu", s.setAttribute("role", "menu"), s.style.display = "none";
162
+ for (const n of e.items)
163
+ if (typeof n == "string") {
164
+ const a = this.pluginManager.getToolbarItem(n);
165
+ if (!a) continue;
166
+ if (a.children && a.children.length > 0)
167
+ this.renderSubmenu(a, s);
168
+ else {
169
+ const d = this.createMenuButton(a);
170
+ s.appendChild(d);
171
+ }
172
+ } else {
173
+ const a = document.createElement("div");
174
+ if (a.className = "smdx-toolbar-dropdown-section", n.label) {
175
+ const d = document.createElement("div");
176
+ d.className = "smdx-toolbar-dropdown-section-label", d.textContent = n.label, a.appendChild(d);
177
+ }
178
+ for (const d of n.items)
179
+ if (typeof d == "string") {
180
+ const l = this.pluginManager.getToolbarItem(d);
181
+ if (l)
182
+ if (l.children && l.children.length > 0)
183
+ this.renderSubmenu(l, a);
184
+ else {
185
+ const c = this.createMenuButton(l);
186
+ a.appendChild(c);
187
+ }
188
+ }
189
+ s.appendChild(a);
190
+ }
191
+ i.addEventListener("click", (n) => {
192
+ n.stopPropagation(), this.toggleDropdown(s, o);
193
+ }), o.appendChild(i), o.appendChild(s), t.appendChild(o);
194
+ }
195
+ renderDropdownItem(e, t) {
196
+ const o = document.createElement("div");
197
+ o.className = "smdx-toolbar-dropdown";
198
+ const i = document.createElement("button");
199
+ i.className = "smdx-toolbar-btn smdx-toolbar-dropdown-trigger", i.type = "button", i.innerHTML = `${e.icon || ""}<span class="smdx-toolbar-btn-label">${e.label}</span><svg class="smdx-dropdown-arrow" width="10" height="6" viewBox="0 0 10 6"><path d="M1 1l4 4 4-4" stroke="currentColor" fill="none" stroke-width="1.5"/></svg>`, i.title = e.tooltip || e.label, i.setAttribute("aria-label", e.tooltip || e.label), i.setAttribute("aria-haspopup", "true"), i.setAttribute("aria-expanded", "false");
200
+ const s = document.createElement("div");
201
+ s.className = "smdx-toolbar-dropdown-menu", s.setAttribute("role", "menu"), s.style.display = "none";
202
+ for (const n of e.children)
203
+ if (n.children && n.children.length > 0)
204
+ this.renderSubmenu(n, s);
205
+ else {
206
+ const a = this.createMenuButton(n);
207
+ s.appendChild(a);
208
+ }
209
+ i.addEventListener("click", (n) => {
210
+ n.stopPropagation(), this.toggleDropdown(s, o);
211
+ }), o.appendChild(i), o.appendChild(s), t.appendChild(o);
212
+ }
213
+ renderSubmenu(e, t) {
214
+ const o = document.createElement("div");
215
+ o.className = "smdx-toolbar-submenu";
216
+ const i = document.createElement("button");
217
+ i.className = "smdx-toolbar-menu-btn smdx-toolbar-submenu-trigger", i.type = "button", i.innerHTML = `${e.icon || ""}<span>${e.label}</span><svg class="smdx-submenu-arrow" width="6" height="10" viewBox="0 0 6 10"><path d="M1 1l4 4-4 4" stroke="currentColor" fill="none" stroke-width="1.5"/></svg>`;
218
+ const s = document.createElement("div");
219
+ s.className = "smdx-toolbar-dropdown-menu smdx-toolbar-submenu-menu", s.style.display = "none";
220
+ for (const c of e.children)
221
+ if (c.children && c.children.length > 0)
222
+ this.renderSubmenu(c, s);
223
+ else {
224
+ const m = this.createMenuButton(c);
225
+ s.appendChild(m);
226
+ }
227
+ const n = () => {
228
+ const c = o.getBoundingClientRect();
229
+ s.style.left = `${c.right}px`, s.style.top = `${c.top}px`, requestAnimationFrame(() => {
230
+ const m = s.getBoundingClientRect();
231
+ m.right > window.innerWidth && (s.style.left = `${c.left - m.width}px`), m.bottom > window.innerHeight && (s.style.top = `${window.innerHeight - m.height - 8}px`);
232
+ });
233
+ };
234
+ let a = null;
235
+ const d = () => {
236
+ a && (clearTimeout(a), a = null), s.style.display = "", n();
237
+ }, l = () => {
238
+ a && clearTimeout(a), a = setTimeout(() => {
239
+ s.style.display = "none", a = null;
240
+ }, 120);
241
+ };
242
+ i.addEventListener("mouseenter", d), s.addEventListener("mouseenter", d), o.addEventListener("mouseleave", l), s.addEventListener("mouseleave", l), o.appendChild(i), o.appendChild(s), t.appendChild(o);
243
+ }
244
+ createButton(e) {
245
+ const t = document.createElement("button");
246
+ return t.className = `smdx-toolbar-btn${e.className ? " " + e.className : ""}`, t.type = "button", t.tabIndex = 0, t.title = e.tooltip || e.label, t.setAttribute("aria-label", e.tooltip || e.label), t.dataset.toolbarId = e.id, e.icon ? t.innerHTML = e.icon : t.textContent = e.label, e.shortcutLabel && (t.title += ` (${e.shortcutLabel})`), t.addEventListener("click", (o) => {
247
+ o.preventDefault(), this.executeAction(e);
248
+ }), e.render && e.render(t, this.getActionContext()), t;
249
+ }
250
+ createMenuButton(e) {
251
+ const t = document.createElement("button");
252
+ return t.className = `smdx-toolbar-menu-btn${e.className ? " " + e.className : ""}`, t.type = "button", t.setAttribute("role", "menuitem"), t.dataset.toolbarId = e.id, t.innerHTML = `${e.icon || ""}<span>${e.label}</span>${e.shortcutLabel ? `<span class="smdx-shortcut-label">${e.shortcutLabel}</span>` : ""}`, t.addEventListener("click", (o) => {
253
+ o.preventDefault(), this.closeDropdowns(), this.executeAction(e);
254
+ }), t;
255
+ }
256
+ executeAction(e) {
257
+ var o;
258
+ const t = this.getActionContext();
259
+ (o = e.isDisabled) != null && o.call(e, t) || (e.action(t), this.events.emit("toolbar-action", e.id));
260
+ }
261
+ getActionContext() {
262
+ return {
263
+ editor: this.editorApi,
264
+ selection: this.editorApi.getSelection()
265
+ };
266
+ }
267
+ toggleDropdown(e, t) {
268
+ if (e.style.display === "none") {
269
+ this.closeDropdowns(), e.style.display = "", this.activeDropdown = t;
270
+ const o = t.querySelector(".smdx-toolbar-dropdown-trigger");
271
+ o == null || o.setAttribute("aria-expanded", "true");
272
+ } else {
273
+ e.style.display = "none";
274
+ const o = t.querySelector(".smdx-toolbar-dropdown-trigger");
275
+ o == null || o.setAttribute("aria-expanded", "false"), this.activeDropdown = null;
276
+ }
277
+ }
278
+ closeDropdowns() {
279
+ var e, t;
280
+ (e = this.el) == null || e.querySelectorAll(".smdx-toolbar-dropdown-menu").forEach((o) => {
281
+ o.style.display = "none";
282
+ }), (t = this.el) == null || t.querySelectorAll('[aria-expanded="true"]').forEach((o) => {
283
+ o.setAttribute("aria-expanded", "false");
284
+ }), this.activeDropdown = null;
285
+ }
286
+ updateActiveStates() {
287
+ var t;
288
+ const e = this.getActionContext();
289
+ (t = this.el) == null || t.querySelectorAll("[data-toolbar-id]").forEach((o) => {
290
+ const i = o.dataset.toolbarId, s = this.pluginManager.getToolbarItem(i);
291
+ s != null && s.isActive && o.classList.toggle("smdx-active", s.isActive(e)), s != null && s.isDisabled && (o.disabled = s.isDisabled(e));
292
+ });
293
+ }
294
+ destroy() {
295
+ var e;
296
+ document.removeEventListener("click", this.documentClickHandler), (e = this.el) == null || e.remove();
297
+ }
298
+ }
299
+ const R = /* @__PURE__ */ new Set([
300
+ "script",
301
+ "style",
302
+ "object",
303
+ "embed",
304
+ "base",
305
+ "form",
306
+ "input",
307
+ "link",
308
+ "meta",
309
+ "noscript",
310
+ "applet",
311
+ "frame",
312
+ "frameset"
313
+ ]), N = [
314
+ "https://www.youtube.com/embed/",
315
+ "https://youtube.com/embed/",
316
+ "https://codepen.io/",
317
+ "https://codesandbox.io/embed/"
318
+ ];
319
+ function O(r) {
320
+ return N.some((e) => r.startsWith(e));
321
+ }
322
+ const S = /^on/i, j = /^\s*javascript\s*:/i;
323
+ function G(r) {
324
+ if (typeof document > "u")
325
+ return r;
326
+ const t = new DOMParser().parseFromString(`<!DOCTYPE html><body>${r}</body>`, "text/html"), o = document.createTreeWalker(t.body, NodeFilter.SHOW_ELEMENT), i = [];
327
+ let s = o.currentNode;
328
+ for (; s; ) {
329
+ if (s.nodeType === Node.ELEMENT_NODE) {
330
+ const n = s, a = n.tagName.toLowerCase();
331
+ if (R.has(a))
332
+ i.push(n);
333
+ else if (a === "iframe") {
334
+ const d = n.getAttribute("src") || "";
335
+ if (!O(d))
336
+ i.push(n);
337
+ else {
338
+ const l = [];
339
+ for (const c of Array.from(n.attributes))
340
+ S.test(c.name) && l.push(c.name);
341
+ for (const c of l)
342
+ n.removeAttribute(c);
343
+ }
344
+ } else {
345
+ const d = [];
346
+ for (const l of Array.from(n.attributes))
347
+ (S.test(l.name) || (l.name === "href" || l.name === "src" || l.name === "action") && j.test(l.value)) && d.push(l.name);
348
+ for (const l of d)
349
+ n.removeAttribute(l);
350
+ }
351
+ }
352
+ s = o.nextNode();
353
+ }
354
+ for (const n of i)
355
+ n.remove();
356
+ return t.body.innerHTML;
357
+ }
358
+ class _ {
359
+ constructor() {
360
+ this.renderers = [], this.parsers = [];
361
+ }
362
+ setRenderers(e) {
363
+ this.renderers = e;
364
+ }
365
+ setParsers(e) {
366
+ this.parsers = e;
367
+ }
368
+ async render(e) {
369
+ let t = e;
370
+ const o = this.validateMdxTags(e), i = [];
371
+ t = t.replace(/`([^`\n]+)`/g, (s, n) => {
372
+ const a = i.length;
373
+ return i.push(n), `%%INLINECODE_${a}%%`;
374
+ }), t = this.applyParsers(t), t = this.applyRenderers(t);
375
+ for (let s = 0; s < i.length; s++)
376
+ t = t.replace(`%%INLINECODE_${s}%%`, `\`${i[s]}\``);
377
+ return t = this.renderMarkdown(t), o.length > 0 && (t = o.map(
378
+ (n) => `<div class="smdx-parse-error"><span class="smdx-parse-error-icon">&#9888;</span> ${this.escapeHtml(n)}</div>`
379
+ ).join("") + t), G(t);
380
+ }
381
+ applyParsers(e) {
382
+ let t = e;
383
+ for (const o of this.parsers)
384
+ t = t.replace(o.pattern, (...i) => {
385
+ const s = i;
386
+ return o.transform(s);
387
+ });
388
+ return t;
389
+ }
390
+ applyRenderers(e) {
391
+ let t = e;
392
+ for (const o of this.renderers)
393
+ t = t.replace(o.pattern, (i, ...s) => {
394
+ const n = {};
395
+ return s.length > 0 && (n.content = s[0] || ""), o.render(i, n);
396
+ });
397
+ return t;
398
+ }
399
+ /**
400
+ * Lightweight built-in markdown renderer.
401
+ * Handles standard markdown without external deps.
402
+ */
403
+ renderMarkdown(e) {
404
+ let t = e;
405
+ const o = [];
406
+ t = t.replace(/```(\w*)(?:[\t ]+([\w.\/ \-]+?))?\n([\s\S]*?)```/g, (s, n, a, d) => {
407
+ const l = o.length, c = {
408
+ js: "JavaScript",
409
+ javascript: "JavaScript",
410
+ ts: "TypeScript",
411
+ typescript: "TypeScript",
412
+ py: "Python",
413
+ python: "Python",
414
+ java: "Java",
415
+ rb: "Ruby",
416
+ ruby: "Ruby",
417
+ go: "Go",
418
+ rust: "Rust",
419
+ rs: "Rust",
420
+ cpp: "C++",
421
+ c: "C",
422
+ cs: "C#",
423
+ csharp: "C#",
424
+ php: "PHP",
425
+ swift: "Swift",
426
+ kt: "Kotlin",
427
+ kotlin: "Kotlin",
428
+ scala: "Scala",
429
+ sh: "Shell",
430
+ bash: "Bash",
431
+ zsh: "Zsh",
432
+ sql: "SQL",
433
+ html: "HTML",
434
+ css: "CSS",
435
+ scss: "SCSS",
436
+ less: "LESS",
437
+ json: "JSON",
438
+ yaml: "YAML",
439
+ yml: "YAML",
440
+ xml: "XML",
441
+ md: "Markdown",
442
+ markdown: "Markdown",
443
+ graphql: "GraphQL",
444
+ dart: "Dart",
445
+ r: "R",
446
+ lua: "Lua",
447
+ perl: "Perl",
448
+ text: "Text",
449
+ txt: "Text"
450
+ };
451
+ let m;
452
+ const h = d.trimEnd();
453
+ try {
454
+ n && w.getLanguage(n) ? m = w.highlight(h, { language: n }).value : m = w.highlightAuto(h).value;
455
+ } catch {
456
+ m = this.escapeHtml(h);
457
+ }
458
+ const x = n ? c[n.toLowerCase()] || n.charAt(0).toUpperCase() + n.slice(1) : "", u = x ? `<span class="smdx-code-lang">${x}</span>` : "", b = a ? `<span class="smdx-code-filename"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"/><polyline points="14 2 14 8 20 8"/></svg>${this.escapeHtml(a)}</span>` : "", v = '<button class="smdx-copy-btn" data-copy-btn="true" title="Copy code" aria-label="Copy code"><svg class="smdx-copy-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"/></svg><svg class="smdx-check-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="20 6 9 17 4 12"/></svg></button>', f = x || a, k = f ? `<div class="smdx-code-header">${u}${b}${v}</div>` : "";
459
+ return o.push(
460
+ `<div class="smdx-code-block${f ? " smdx-has-header" : ""}">${k}<pre><code class="hljs language-${n || "text"}">${m}</code></pre>${f ? "" : v}</div>`
461
+ ), `%%CODEBLOCK_${l}%%`;
462
+ }), t = t.replace(/`([^`]+)`/g, (s, n) => `<code class="smdx-inline-code">${this.escapeHtml(n)}</code>`);
463
+ const i = (s) => s.toLowerCase().replace(/[^\w]+/g, "-").replace(/^-|-$/g, "");
464
+ t = t.replace(/^######\s+(.+)$/gm, (s, n) => `<h6 id="${i(n)}">${n}</h6>`), t = t.replace(/^#####\s+(.+)$/gm, (s, n) => `<h5 id="${i(n)}">${n}</h5>`), t = t.replace(/^####\s+(.+)$/gm, (s, n) => `<h4 id="${i(n)}">${n}</h4>`), t = t.replace(/^###\s+(.+)$/gm, (s, n) => `<h3 id="${i(n)}">${n}</h3>`), t = t.replace(/^##\s+(.+)$/gm, (s, n) => `<h2 id="${i(n)}">${n}</h2>`), t = t.replace(/^#\s+(.+)$/gm, (s, n) => `<h1 id="${i(n)}">${n}</h1>`), t = t.replace(/^---$/gm, "<hr/>"), t = t.replace(/\*\*\*(.+?)\*\*\*/g, "<strong><em>$1</em></strong>"), t = t.replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>"), t = t.replace(/\*(.+?)\*/g, "<em>$1</em>"), t = t.replace(/~~(.+?)~~/g, "<del>$1</del>"), t = t.replace(/^>\s+(.+)$/gm, "<blockquote>$1</blockquote>"), t = t.replace(/^- \[x\]\s+(.+)$/gm, '<div class="smdx-task"><input type="checkbox" checked disabled /><span>$1</span></div>'), t = t.replace(/^- \[ \]\s+(.+)$/gm, '<div class="smdx-task"><input type="checkbox" disabled /><span>$1</span></div>'), t = t.replace(/^[-*]\s+(.+)$/gm, '<li class="smdx-ul-item">$1</li>'), t = t.replace(/((?:<li class="smdx-ul-item">.*<\/li>\n?)+)/g, "<ul>$1</ul>"), t = t.replace(/^\d+\.\s+(.+)$/gm, '<li class="smdx-ol-item">$1</li>'), t = t.replace(/((?:<li class="smdx-ol-item">.*<\/li>\n?)+)/g, "<ol>$1</ol>"), t = t.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, '<img src="$2" alt="$1" class="smdx-image"/>'), t = t.replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>'), t = this.renderTables(t), t = t.replace(/ {2,}$/gm, "<br/>"), t = t.replace(/^(?!\s*<[a-zA-Z/!]|\s*%%)(.*\S.*)$/gm, "<p>$1</p>"), t = t.replace(/<p>\s*<\/p>/g, "");
465
+ for (let s = 0; s < o.length; s++)
466
+ t = t.replace(`%%CODEBLOCK_${s}%%`, o[s]);
467
+ return t;
468
+ }
469
+ renderTables(e) {
470
+ const t = /(?:^(\|.+\|)\n(\|[-| :]+\|)\n((?:\|.+\|\n?)*))/gm;
471
+ return e.replace(t, (o, i, s, n) => {
472
+ const a = this.parseTableRow(i), d = n.trim().split(`
473
+ `).filter(Boolean).map((c) => this.parseTableRow(c));
474
+ let l = '<div class="smdx-table-wrapper"><table class="smdx-table"><thead><tr>';
475
+ for (const c of a)
476
+ l += `<th>${c}</th>`;
477
+ l += "</tr></thead><tbody>";
478
+ for (const c of d) {
479
+ l += "<tr>";
480
+ for (const m of c)
481
+ l += `<td>${m}</td>`;
482
+ l += "</tr>";
483
+ }
484
+ return l += "</tbody></table></div>", l;
485
+ });
486
+ }
487
+ parseTableRow(e) {
488
+ return e.split("|").slice(1, -1).map((t) => t.trim());
489
+ }
490
+ escapeHtml(e) {
491
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
492
+ }
493
+ /**
494
+ * Validate MDX component tags — detect unclosed or mismatched tags.
495
+ * Only checks PascalCase tags (MDX components), not standard HTML.
496
+ */
497
+ validateMdxTags(e) {
498
+ const t = [];
499
+ let o = e.replace(/```[\s\S]*?```/g, "");
500
+ o = o.replace(/`[^`]+`/g, "");
501
+ const i = [], s = o.split(`
502
+ `);
503
+ for (let n = 0; n < s.length; n++) {
504
+ const a = s[n];
505
+ let d;
506
+ const l = /<\/?([A-Z][A-Za-z0-9]*)(?:\s[^>]*)?\/?>|<([A-Z][A-Za-z0-9]*)(?:\s[^>]*)?>/g;
507
+ for (; (d = l.exec(a)) !== null; ) {
508
+ const c = d[0];
509
+ if (c.endsWith("/>")) continue;
510
+ const m = d[1] || d[2];
511
+ if (!m) continue;
512
+ const h = d.index + 1;
513
+ if (c.startsWith("</")) {
514
+ let u = !1;
515
+ for (let b = i.length - 1; b >= 0; b--)
516
+ if (i[b].tag === m) {
517
+ i.splice(b, 1), u = !0;
518
+ break;
519
+ }
520
+ u || t.push(`Unexpected closing tag '</${m}>' at line ${n + 1}:${h} — no matching opening tag found.`);
521
+ } else
522
+ i.push({ tag: m, line: n + 1, col: h });
523
+ }
524
+ }
525
+ for (const n of i)
526
+ t.push(`Expected a closing tag for '<${n.tag}>' (${n.line}:${n.col}) before the end of the document.`);
527
+ return t;
528
+ }
529
+ }
530
+ class F {
531
+ constructor(e = 100) {
532
+ this.stack = [], this.pointer = -1, this.maxSize = e;
533
+ }
534
+ push(e) {
535
+ this.pointer < this.stack.length - 1 && (this.stack = this.stack.slice(0, this.pointer + 1)), this.stack[this.stack.length - 1] !== e && (this.stack.push(e), this.stack.length > this.maxSize && this.stack.shift(), this.pointer = this.stack.length - 1);
536
+ }
537
+ undo() {
538
+ if (this.pointer > 0)
539
+ return this.pointer--, this.stack[this.pointer];
540
+ }
541
+ redo() {
542
+ if (this.pointer < this.stack.length - 1)
543
+ return this.pointer++, this.stack[this.pointer];
544
+ }
545
+ current() {
546
+ return this.stack[this.pointer];
547
+ }
548
+ clear() {
549
+ this.stack = [], this.pointer = -1;
550
+ }
551
+ }
552
+ class q {
553
+ constructor(e) {
554
+ this.events = new H(), this.renderer = new _(), this.history = new F(), this.renderTimer = null, this.historyTimer = null, this._destroyed = !1, this.config = e, this.mode = e.mode || "split", this.init();
555
+ }
556
+ init() {
557
+ const e = typeof this.config.container == "string" ? document.querySelector(this.config.container) : this.config.container;
558
+ if (!e)
559
+ throw new Error("[SynclineMDX] Container element not found");
560
+ this.buildDOM(e), this.config.theme && this.applyTheme(this.config.theme), this.pluginManager = new D(this, this.events);
561
+ const t = this.config.toolbar || [this.getDefaultToolbar()];
562
+ this.toolbar = new z(t, this.pluginManager, this, this.events), this.config.value && (this.textarea.value = this.config.value), this.config.plugins ? this.registerPlugins(this.config.plugins).then(() => {
563
+ this.toolbar.render(this.toolbarEl), this.history.push(this.textarea.value), this.renderPreview();
564
+ }) : (this.toolbar.render(this.toolbarEl), this.history.push(this.textarea.value), this.renderPreview()), this.textarea.addEventListener("input", this.onInput.bind(this)), this.textarea.addEventListener("keydown", this.onKeyDown.bind(this)), this.textarea.addEventListener("click", this.onSelectionChange.bind(this)), this.textarea.addEventListener("select", this.onSelectionChange.bind(this)), this.textarea.addEventListener("focus", () => this.events.emit("focus")), this.textarea.addEventListener("blur", () => this.events.emit("blur")), this.config.scrollSync !== !1 && this.textarea.addEventListener("scroll", () => {
565
+ requestAnimationFrame(() => {
566
+ const o = this.textarea.scrollHeight - this.textarea.clientHeight, i = o > 0 ? this.textarea.scrollTop / o : 0, s = this.previewContent.scrollHeight - this.previewContent.clientHeight;
567
+ this.previewContent.scrollTop = i * s;
568
+ });
569
+ }), this.config.readOnly && (this.textarea.readOnly = !0), this.config.placeholder && (this.textarea.placeholder = this.config.placeholder), this.setMode(this.mode), this.config.onChange && this.on("change", (o) => {
570
+ typeof o == "string" && this.config.onChange(o);
571
+ });
572
+ }
573
+ buildDOM(e) {
574
+ this.root = document.createElement("div"), this.root.className = "smdx-editor", this.root.setAttribute("role", "application"), this.root.setAttribute("aria-label", "Markdown Editor");
575
+ const t = document.createElement("a");
576
+ t.className = "smdx-skip-link", t.href = "#smdx-editor-content", t.textContent = "Skip to editor", this.root.appendChild(t), this.toolbarEl = document.createElement("div"), this.toolbarEl.className = "smdx-toolbar-container", this.toolbarEl.setAttribute("role", "toolbar"), this.toolbarEl.setAttribute("aria-label", "Formatting toolbar");
577
+ const o = document.createElement("div");
578
+ o.className = "smdx-main", this.editorPane = document.createElement("div"), this.editorPane.className = "smdx-editor-pane", this.editorPane.id = "smdx-editor-content", this.textarea = document.createElement("textarea"), this.textarea.className = "smdx-textarea", this.textarea.spellcheck = !0, this.textarea.setAttribute("autocomplete", "off"), this.textarea.setAttribute("autocorrect", "off"), this.textarea.setAttribute("autocapitalize", "off"), this.textarea.setAttribute("role", "textbox"), this.textarea.setAttribute("aria-label", "Markdown editor"), this.textarea.setAttribute("aria-multiline", "true"), this.editorPane.appendChild(this.textarea), this.previewPane = document.createElement("div"), this.previewPane.className = "smdx-preview-pane", this.previewContent = document.createElement("div"), this.previewContent.className = "smdx-preview-content", this.previewContent.setAttribute("role", "region"), this.previewContent.setAttribute("aria-label", "Preview"), this.previewContent.setAttribute("aria-live", "polite"), this.previewContent.addEventListener("click", (i) => {
579
+ const s = i.target, n = s.closest("[data-smdx-tab-btn]");
580
+ if (n) {
581
+ const c = n.closest(".smdx-tabs");
582
+ if (c) {
583
+ const m = parseInt(n.dataset.tabIndex ?? "0", 10);
584
+ c.querySelectorAll(".smdx-tab-btn").forEach((h) => h.classList.remove("smdx-active")), n.classList.add("smdx-active"), c.querySelectorAll(".smdx-tab-panel").forEach((h, x) => {
585
+ h.style.display = x === m ? "block" : "none";
586
+ });
587
+ }
588
+ return;
589
+ }
590
+ const a = s.closest("[data-copy-btn]");
591
+ if (!a) return;
592
+ const d = a.closest(".smdx-code-block"), l = d == null ? void 0 : d.querySelector("code");
593
+ l && navigator.clipboard.writeText(l.textContent || "").then(() => {
594
+ a.classList.add("smdx-copied"), setTimeout(() => a.classList.remove("smdx-copied"), 2e3);
595
+ }).catch(() => {
596
+ });
597
+ }), this.previewPane.appendChild(this.previewContent), o.appendChild(this.editorPane), o.appendChild(this.previewPane), this.statusBar = document.createElement("div"), this.statusBar.className = "smdx-status-bar", this.statusBar.setAttribute("role", "status"), this.statusBar.setAttribute("aria-label", "Editor status"), this.updateStatusBar(), this.root.appendChild(this.toolbarEl), this.root.appendChild(o), this.root.appendChild(this.statusBar), e.appendChild(this.root);
598
+ }
599
+ async registerPlugins(e) {
600
+ for (const t of e)
601
+ await this.pluginManager.register(t);
602
+ }
603
+ getDefaultToolbar() {
604
+ return [
605
+ "heading",
606
+ "|",
607
+ "bold",
608
+ "italic",
609
+ "strikethrough",
610
+ "|",
611
+ "quote",
612
+ "link",
613
+ "image",
614
+ "|",
615
+ "code",
616
+ "codeBlock",
617
+ "|",
618
+ "unorderedList",
619
+ "orderedList",
620
+ "taskList",
621
+ "|",
622
+ "table",
623
+ "|",
624
+ "highlight",
625
+ "admonition",
626
+ "|",
627
+ "accordion",
628
+ "steps",
629
+ "tab",
630
+ "|",
631
+ "card",
632
+ "multiColumn",
633
+ "|",
634
+ "tip",
635
+ "container",
636
+ "|",
637
+ "emoji",
638
+ "formula",
639
+ "|",
640
+ "embedVideo",
641
+ "embedOthers",
642
+ "|",
643
+ "mermaid",
644
+ "|",
645
+ "copyText",
646
+ "tooltip"
647
+ ];
648
+ }
649
+ // ─── Input handlers ──────────────────────────────
650
+ onInput() {
651
+ this.historyTimer && clearTimeout(this.historyTimer), this.historyTimer = setTimeout(() => {
652
+ this.history.push(this.textarea.value);
653
+ }, 300), this.scheduleRender(), this.updateStatusBar(), this.events.emit("change", this.textarea.value);
654
+ }
655
+ onKeyDown(e) {
656
+ if (e.key === "Tab") {
657
+ e.preventDefault();
658
+ const i = this.textarea.selectionStart, s = this.textarea.selectionEnd, n = this.textarea.value;
659
+ if (e.shiftKey) {
660
+ const a = n.lastIndexOf(`
661
+ `, i - 1) + 1;
662
+ n.substring(a, a + 2) === " " && (this.textarea.value = n.substring(0, a) + n.substring(a + 2), this.textarea.selectionStart = Math.max(i - 2, a), this.textarea.selectionEnd = Math.max(s - 2, a));
663
+ } else
664
+ this.textarea.value = n.substring(0, i) + " " + n.substring(s), this.textarea.selectionStart = this.textarea.selectionEnd = i + 2;
665
+ this.onInput();
666
+ return;
667
+ }
668
+ if (e.metaKey || e.ctrlKey) {
669
+ if (e.key === "z" && !e.shiftKey) {
670
+ e.preventDefault(), this.undo();
671
+ return;
672
+ }
673
+ if (e.key === "z" && e.shiftKey || e.key === "y") {
674
+ e.preventDefault(), this.redo();
675
+ return;
676
+ }
677
+ }
678
+ const o = this.pluginManager.getShortcuts();
679
+ for (const i of o)
680
+ if (this.matchShortcut(e, i.key)) {
681
+ e.preventDefault(), i.action({
682
+ editor: this,
683
+ selection: this.getSelection()
684
+ });
685
+ return;
686
+ }
687
+ }
688
+ matchShortcut(e, t) {
689
+ const o = t.toLowerCase().split("+"), i = o.includes("cmd") || o.includes("meta"), s = o.includes("ctrl"), n = o.includes("shift"), a = o.includes("alt"), d = i || s, l = o.filter((m) => !["cmd", "meta", "ctrl", "shift", "alt"].includes(m))[0];
690
+ return (i ? e.metaKey : !e.metaKey || d) && (s ? e.ctrlKey : !e.ctrlKey || d) && (n ? e.shiftKey : !e.shiftKey) && (a ? e.altKey : !e.altKey) && (d ? e.metaKey || e.ctrlKey : !e.metaKey && !e.ctrlKey) && e.key.toLowerCase() === l;
691
+ }
692
+ onSelectionChange() {
693
+ this.toolbar.updateActiveStates(), this.events.emit("selection-change", this.getSelection());
694
+ }
695
+ scheduleRender() {
696
+ this.renderTimer && clearTimeout(this.renderTimer), this.renderTimer = setTimeout(() => this.renderPreview(), 150);
697
+ }
698
+ updateStatusBar() {
699
+ const e = this.getWordCount(), t = this.getLineCount();
700
+ this.statusBar.innerHTML = `<span>Words: ${e}</span><span>Lines: ${t}</span>`;
701
+ const o = document.createElement("div");
702
+ o.className = "smdx-mode-switch", ["editor", "split", "preview"].forEach((i) => {
703
+ const s = document.createElement("button");
704
+ s.type = "button", s.className = `smdx-mode-btn${i === this.mode ? " smdx-active" : ""}`, s.textContent = i.charAt(0).toUpperCase() + i.slice(1), s.setAttribute("aria-label", `${i.charAt(0).toUpperCase() + i.slice(1)} mode`), s.setAttribute("aria-pressed", String(i === this.mode)), s.addEventListener("click", () => this.setMode(i)), o.appendChild(s);
705
+ }), this.statusBar.appendChild(o);
706
+ }
707
+ // ─── EditorAPI implementation ──────────────────
708
+ getValue() {
709
+ return this.textarea.value;
710
+ }
711
+ setValue(e) {
712
+ this.textarea.value = e, this.history.push(e), this.scheduleRender(), this.events.emit("change", e);
713
+ }
714
+ insertText(e) {
715
+ const t = this.textarea.selectionStart, o = this.textarea.selectionEnd, i = this.textarea.value;
716
+ this.textarea.value = i.substring(0, t) + e + i.substring(o), this.textarea.selectionStart = this.textarea.selectionEnd = t + e.length, this.textarea.focus(), this.onInput();
717
+ }
718
+ wrapSelection(e, t) {
719
+ const { start: o, end: i, text: s } = this.getSelection(), n = this.textarea.value, a = e + (s || "text") + t;
720
+ this.textarea.value = n.substring(0, o) + a + n.substring(i), this.textarea.selectionStart = o + e.length, this.textarea.selectionEnd = o + e.length + (s || "text").length, this.textarea.focus(), this.onInput();
721
+ }
722
+ replaceSelection(e) {
723
+ const { start: t, end: o } = this.getSelection(), i = this.textarea.value;
724
+ this.textarea.value = i.substring(0, t) + e + i.substring(o), this.textarea.selectionStart = this.textarea.selectionEnd = t + e.length, this.textarea.focus(), this.onInput();
725
+ }
726
+ getSelection() {
727
+ const e = this.textarea.selectionStart, t = this.textarea.selectionEnd, o = this.textarea.value;
728
+ return {
729
+ start: e,
730
+ end: t,
731
+ text: o.substring(e, t),
732
+ beforeText: o.substring(0, e),
733
+ afterText: o.substring(t)
734
+ };
735
+ }
736
+ setSelection(e, t) {
737
+ this.textarea.selectionStart = e, this.textarea.selectionEnd = t, this.textarea.focus();
738
+ }
739
+ insertBlock(e) {
740
+ const { start: t, end: o } = this.getSelection(), i = this.textarea.value, s = i.substring(0, t), n = i.substring(o), a = s.length > 0 && !s.endsWith(`
741
+ `), d = n.length > 0 && !n.startsWith(`
742
+ `), l = (a ? `
743
+
744
+ ` : "") + e + (d ? `
745
+
746
+ ` : "");
747
+ this.textarea.value = s + l + n, this.textarea.selectionStart = this.textarea.selectionEnd = s.length + l.length, this.textarea.focus(), this.onInput();
748
+ }
749
+ getTextarea() {
750
+ return this.textarea;
751
+ }
752
+ getPreview() {
753
+ return this.previewContent;
754
+ }
755
+ getRoot() {
756
+ return this.root;
757
+ }
758
+ focus() {
759
+ this.textarea.focus();
760
+ }
761
+ async renderPreview() {
762
+ this.renderer.setRenderers(this.pluginManager.getRenderers()), this.renderer.setParsers(this.pluginManager.getParsers());
763
+ const e = await this.renderer.render(this.textarea.value);
764
+ this.previewContent.innerHTML = e, this.events.emit("render", e);
765
+ }
766
+ getMode() {
767
+ return this.mode;
768
+ }
769
+ setMode(e) {
770
+ this.mode = e, this.root.classList.remove("smdx-mode-split", "smdx-mode-editor", "smdx-mode-preview"), this.root.classList.add(`smdx-mode-${e}`), this.updateStatusBar(), this.events.emit("mode-change", e);
771
+ }
772
+ registerPlugin(e) {
773
+ this.pluginManager.register(e).then(() => {
774
+ this.toolbarEl.innerHTML = "", this.toolbar.render(this.toolbarEl), this.renderPreview();
775
+ });
776
+ }
777
+ unregisterPlugin(e) {
778
+ this.pluginManager.unregister(e), this.toolbarEl.innerHTML = "", this.toolbar.render(this.toolbarEl), this.renderPreview();
779
+ }
780
+ on(e, t) {
781
+ this.events.on(e, t);
782
+ }
783
+ off(e, t) {
784
+ this.events.off(e, t);
785
+ }
786
+ emit(e, t) {
787
+ this.events.emit(e, t);
788
+ }
789
+ destroy() {
790
+ this._destroyed || (this._destroyed = !0, this.pluginManager.destroy(), this.toolbar.destroy(), this.events.removeAllListeners(), this.renderTimer && clearTimeout(this.renderTimer), this.historyTimer && clearTimeout(this.historyTimer), this.root.remove());
791
+ }
792
+ undo() {
793
+ const e = this.history.undo();
794
+ e !== void 0 && (this.textarea.value = e, this.scheduleRender(), this.events.emit("change", e));
795
+ }
796
+ redo() {
797
+ const e = this.history.redo();
798
+ e !== void 0 && (this.textarea.value = e, this.scheduleRender(), this.events.emit("change", e));
799
+ }
800
+ getCurrentLine() {
801
+ const e = this.textarea.value, t = this.textarea.selectionStart, o = e.lastIndexOf(`
802
+ `, t - 1) + 1, i = e.indexOf(`
803
+ `, t);
804
+ return e.substring(o, i === -1 ? e.length : i);
805
+ }
806
+ getCurrentLineNumber() {
807
+ const e = this.textarea.value, t = this.textarea.selectionStart;
808
+ return e.substring(0, t).split(`
809
+ `).length;
810
+ }
811
+ replaceCurrentLine(e) {
812
+ const t = this.textarea.value, o = this.textarea.selectionStart, i = t.lastIndexOf(`
813
+ `, o - 1) + 1;
814
+ let s = t.indexOf(`
815
+ `, o);
816
+ s === -1 && (s = t.length), this.textarea.value = t.substring(0, i) + e + t.substring(s), this.textarea.selectionStart = this.textarea.selectionEnd = i + e.length, this.onInput();
817
+ }
818
+ insertAt(e, t) {
819
+ const o = this.textarea.value;
820
+ this.textarea.value = o.substring(0, e) + t + o.substring(e), this.textarea.selectionStart = this.textarea.selectionEnd = e + t.length, this.onInput();
821
+ }
822
+ getWordCount() {
823
+ const e = this.textarea.value.trim();
824
+ return e ? e.split(/\s+/).length : 0;
825
+ }
826
+ getLineCount() {
827
+ return this.textarea.value.split(`
828
+ `).length;
829
+ }
830
+ // ─── Theme ──────────────────────────────────────
831
+ applyTheme(e) {
832
+ for (const [t, o] of Object.entries(e))
833
+ this.root.style.setProperty(t.startsWith("--") ? t : `--smdx-${t}`, o);
834
+ }
835
+ }
836
+ const p = {
837
+ heading: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 12h16M4 6v12M20 6v12"/></svg>',
838
+ h1: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><text x="2" y="17" font-size="14" fill="currentColor" stroke="none" font-weight="bold">H1</text></svg>',
839
+ h2: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><text x="2" y="17" font-size="14" fill="currentColor" stroke="none" font-weight="bold">H2</text></svg>',
840
+ h3: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><text x="2" y="17" font-size="14" fill="currentColor" stroke="none" font-weight="bold">H3</text></svg>',
841
+ h4: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><text x="2" y="17" font-size="14" fill="currentColor" stroke="none" font-weight="bold">H4</text></svg>',
842
+ h5: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><text x="2" y="17" font-size="14" fill="currentColor" stroke="none" font-weight="bold">H5</text></svg>',
843
+ h6: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><text x="2" y="17" font-size="14" fill="currentColor" stroke="none" font-weight="bold">H6</text></svg>',
844
+ bold: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M6 4h8a4 4 0 014 4 4 4 0 01-4 4H6zM6 12h9a4 4 0 014 4 4 4 0 01-4 4H6z"/></svg>',
845
+ italic: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="19" y1="4" x2="10" y2="4"/><line x1="14" y1="20" x2="5" y2="20"/><line x1="15" y1="4" x2="9" y2="20"/></svg>',
846
+ strikethrough: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M16 4H9a3 3 0 00-3 3v0a3 3 0 003 3h6a3 3 0 013 3v0a3 3 0 01-3 3H8"/><line x1="4" y1="12" x2="20" y2="12"/></svg>',
847
+ quote: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V21z"/><path d="M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3z"/></svg>',
848
+ link: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M10 13a5 5 0 007.54.54l3-3a5 5 0 00-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 00-7.54-.54l-3 3a5 5 0 007.07 7.07l1.71-1.71"/></svg>',
849
+ image: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>',
850
+ code: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/></svg>',
851
+ codeBlock: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="3" width="20" height="18" rx="2"/><polyline points="10 8 6 12 10 16"/><polyline points="14 8 18 12 14 16"/></svg>',
852
+ unorderedList: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><circle cx="4" cy="6" r="1" fill="currentColor"/><circle cx="4" cy="12" r="1" fill="currentColor"/><circle cx="4" cy="18" r="1" fill="currentColor"/></svg>',
853
+ orderedList: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="10" y1="6" x2="21" y2="6"/><line x1="10" y1="12" x2="21" y2="12"/><line x1="10" y1="18" x2="21" y2="18"/><text x="2" y="9" font-size="8" fill="currentColor" stroke="none">1</text><text x="2" y="15" font-size="8" fill="currentColor" stroke="none">2</text><text x="2" y="21" font-size="8" fill="currentColor" stroke="none">3</text></svg>',
854
+ taskList: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="5" width="6" height="6" rx="1"/><path d="M5 8l1 1 2-2"/><line x1="13" y1="8" x2="21" y2="8"/><rect x="3" y="13" width="6" height="6" rx="1"/><line x1="13" y1="16" x2="21" y2="16"/></svg>',
855
+ table: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2"/><line x1="3" y1="9" x2="21" y2="9"/><line x1="3" y1="15" x2="21" y2="15"/><line x1="9" y1="3" x2="9" y2="21"/><line x1="15" y1="3" x2="15" y2="21"/></svg>',
856
+ highlight: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 013 3L7 19l-4 1 1-4L16.5 3.5z"/></svg>',
857
+ admonition: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>',
858
+ tab: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="6" width="20" height="14" rx="2"/><path d="M2 10h20"/><path d="M5 6V4a2 2 0 012-2h4a2 2 0 012 2v2"/></svg>',
859
+ imageBackground: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="2" width="20" height="20" rx="2"/><rect x="5" y="5" width="14" height="14" rx="1" stroke-dasharray="4,2"/><circle cx="12" cy="12" r="3"/></svg>',
860
+ imageFrame: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="2" width="20" height="20" rx="2"/><rect x="5" y="5" width="14" height="14" rx="1"/></svg>',
861
+ accordion: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="6" rx="1"/><path d="M15 6l-3 3-3-3"/><rect x="3" y="13" width="18" height="6" rx="1"/></svg>',
862
+ accordionGroup: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="2" width="18" height="5" rx="1"/><rect x="3" y="9" width="18" height="5" rx="1"/><rect x="3" y="16" width="18" height="5" rx="1"/></svg>',
863
+ multiColumn: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="7" height="18" rx="1"/><rect x="14" y="3" width="7" height="18" rx="1"/></svg>',
864
+ card: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="3"/><line x1="7" y1="10" x2="17" y2="10"/><line x1="7" y1="14" x2="13" y2="14"/></svg>',
865
+ cardGroup: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="3" width="8" height="8" rx="2"/><rect x="14" y="3" width="8" height="8" rx="2"/><rect x="2" y="13" width="8" height="8" rx="2"/><rect x="14" y="13" width="8" height="8" rx="2"/></svg>',
866
+ step: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="5" r="3"/><circle cx="12" cy="12" r="3"/><circle cx="12" cy="19" r="3"/><line x1="12" y1="8" x2="12" y2="9"/><line x1="12" y1="15" x2="12" y2="16"/></svg>',
867
+ tip: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 18h6M10 22h4M12 2a7 7 0 017 7c0 2.38-1.19 4.47-3 5.74V17H8v-2.26C6.19 13.47 5 11.38 5 9a7 7 0 017-7z"/></svg>',
868
+ container: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" stroke-dasharray="4,2"/></svg>',
869
+ copyText: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"/></svg>',
870
+ tooltip: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="12" rx="2"/><path d="M9 15l3 4 3-4"/></svg>',
871
+ embedVideo: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="4" width="20" height="16" rx="2"/><polygon points="10,8 16,12 10,16"/></svg>',
872
+ embedOthers: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M2 12h20"/><ellipse cx="12" cy="12" rx="4" ry="10"/></svg>',
873
+ mermaid: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="2" width="8" height="6" rx="1"/><rect x="14" y="16" width="8" height="6" rx="1"/><rect x="14" y="2" width="8" height="6" rx="1"/><path d="M10 5h4M6 8v8l12-4"/></svg>',
874
+ emoji: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><line x1="9" y1="9" x2="9.01" y2="9"/><line x1="15" y1="9" x2="15.01" y2="9"/></svg>',
875
+ formula: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><text x="3" y="17" font-size="14" fill="currentColor" stroke="none" font-style="italic">∑x</text></svg>',
876
+ insert: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="16"/><line x1="8" y1="12" x2="16" y2="12"/></svg>',
877
+ scrollSync: '<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 12h16M12 4v16"/></svg>'
878
+ };
879
+ function V() {
880
+ return {
881
+ name: "heading",
882
+ toolbarItems: [
883
+ {
884
+ id: "heading",
885
+ label: "Heading",
886
+ icon: p.heading,
887
+ tooltip: "Heading",
888
+ children: [1, 2, 3, 4, 5, 6].map((r) => ({
889
+ id: `h${r}`,
890
+ label: `Heading ${r}`,
891
+ icon: p[`h${r}`],
892
+ tooltip: `Heading ${r}`,
893
+ action: ({ editor: e }) => {
894
+ const t = "#".repeat(r) + " ", i = e.getCurrentLine().replace(/^#{1,6}\s*/, "");
895
+ e.replaceCurrentLine(t + i);
896
+ }
897
+ })),
898
+ action: ({ editor: r }) => {
899
+ const e = r.getCurrentLine(), t = e.match(/^(#{1,6})\s/);
900
+ if (t) {
901
+ const o = Math.min(t[1].length + 1, 6), i = e.replace(/^#{1,6}\s*/, "");
902
+ r.replaceCurrentLine("#".repeat(o) + " " + i);
903
+ } else
904
+ r.replaceCurrentLine("# " + e);
905
+ }
906
+ }
907
+ ],
908
+ shortcuts: [
909
+ { key: "Ctrl+1", action: ({ editor: r }) => r.replaceCurrentLine("# " + r.getCurrentLine().replace(/^#{1,6}\s*/, "")), description: "Heading 1" },
910
+ { key: "Ctrl+2", action: ({ editor: r }) => r.replaceCurrentLine("## " + r.getCurrentLine().replace(/^#{1,6}\s*/, "")), description: "Heading 2" },
911
+ { key: "Ctrl+3", action: ({ editor: r }) => r.replaceCurrentLine("### " + r.getCurrentLine().replace(/^#{1,6}\s*/, "")), description: "Heading 3" }
912
+ ]
913
+ };
914
+ }
915
+ function W() {
916
+ return {
917
+ name: "bold",
918
+ toolbarItems: [{
919
+ id: "bold",
920
+ label: "Bold",
921
+ icon: p.bold,
922
+ tooltip: "Bold",
923
+ shortcutLabel: "⌘B",
924
+ action: ({ editor: r }) => r.wrapSelection("**", "**"),
925
+ isActive: ({ selection: r }) => {
926
+ const { beforeText: e, afterText: t, text: o } = r;
927
+ return e.endsWith("**") && t.startsWith("**") || /^\*\*.+\*\*$/.test(o);
928
+ }
929
+ }],
930
+ shortcuts: [
931
+ { key: "Ctrl+b", action: ({ editor: r }) => r.wrapSelection("**", "**"), description: "Bold" }
932
+ ]
933
+ };
934
+ }
935
+ function K() {
936
+ return {
937
+ name: "italic",
938
+ toolbarItems: [{
939
+ id: "italic",
940
+ label: "Italic",
941
+ icon: p.italic,
942
+ tooltip: "Italic",
943
+ shortcutLabel: "⌘I",
944
+ action: ({ editor: r }) => r.wrapSelection("*", "*"),
945
+ isActive: ({ selection: r }) => {
946
+ const { beforeText: e, afterText: t, text: o } = r;
947
+ return e.endsWith("*") && !e.endsWith("**") && t.startsWith("*") && !t.startsWith("**") || /^\*[^*]+\*$/.test(o);
948
+ }
949
+ }],
950
+ shortcuts: [
951
+ { key: "Ctrl+i", action: ({ editor: r }) => r.wrapSelection("*", "*"), description: "Italic" }
952
+ ]
953
+ };
954
+ }
955
+ function U() {
956
+ return {
957
+ name: "strikethrough",
958
+ toolbarItems: [{
959
+ id: "strikethrough",
960
+ label: "Strikethrough",
961
+ icon: p.strikethrough,
962
+ tooltip: "Strikethrough",
963
+ shortcutLabel: "⌘⇧X",
964
+ action: ({ editor: r }) => r.wrapSelection("~~", "~~")
965
+ }],
966
+ shortcuts: [
967
+ { key: "Ctrl+Shift+x", action: ({ editor: r }) => r.wrapSelection("~~", "~~"), description: "Strikethrough" }
968
+ ]
969
+ };
970
+ }
971
+ function Y() {
972
+ return {
973
+ name: "quote",
974
+ toolbarItems: [{
975
+ id: "quote",
976
+ label: "Quote",
977
+ icon: p.quote,
978
+ tooltip: "Blockquote",
979
+ shortcutLabel: "⌘⇧.",
980
+ action: ({ editor: r }) => {
981
+ const e = r.getCurrentLine();
982
+ e.startsWith("> ") ? r.replaceCurrentLine(e.substring(2)) : r.replaceCurrentLine("> " + e);
983
+ }
984
+ }],
985
+ shortcuts: [
986
+ {
987
+ key: "Ctrl+Shift+.",
988
+ action: ({ editor: r }) => {
989
+ const e = r.getCurrentLine();
990
+ r.replaceCurrentLine(e.startsWith("> ") ? e.substring(2) : "> " + e);
991
+ },
992
+ description: "Blockquote"
993
+ }
994
+ ]
995
+ };
996
+ }
997
+ function X() {
998
+ return {
999
+ name: "link",
1000
+ toolbarItems: [{
1001
+ id: "link",
1002
+ label: "Link",
1003
+ icon: p.link,
1004
+ tooltip: "Insert Link",
1005
+ shortcutLabel: "⌘K",
1006
+ action: ({ editor: r, selection: e }) => {
1007
+ e.text ? r.replaceSelection(`[${e.text}](url)`) : r.insertText("[link text](url)");
1008
+ }
1009
+ }],
1010
+ shortcuts: [
1011
+ {
1012
+ key: "Ctrl+k",
1013
+ action: ({ editor: r, selection: e }) => {
1014
+ e.text ? r.replaceSelection(`[${e.text}](url)`) : r.insertText("[link text](url)");
1015
+ },
1016
+ description: "Insert Link"
1017
+ }
1018
+ ]
1019
+ };
1020
+ }
1021
+ function J() {
1022
+ return {
1023
+ name: "image",
1024
+ toolbarItems: [{
1025
+ id: "image",
1026
+ label: "Image",
1027
+ icon: p.image,
1028
+ tooltip: "Insert Image",
1029
+ action: ({ editor: r, selection: e }) => {
1030
+ const t = e.text || "alt text";
1031
+ r.replaceSelection(`![${t}](image-url)`);
1032
+ }
1033
+ }]
1034
+ };
1035
+ }
1036
+ function Z() {
1037
+ return {
1038
+ name: "code",
1039
+ toolbarItems: [
1040
+ {
1041
+ id: "code",
1042
+ label: "Inline Code",
1043
+ icon: p.code,
1044
+ tooltip: "Inline Code",
1045
+ shortcutLabel: "⌘E",
1046
+ action: ({ editor: r }) => r.wrapSelection("`", "`")
1047
+ },
1048
+ {
1049
+ id: "codeBlock",
1050
+ label: "Code Block",
1051
+ icon: p.codeBlock,
1052
+ tooltip: "Code Block",
1053
+ shortcutLabel: "⌘⇧C",
1054
+ action: ({ editor: r, selection: e }) => {
1055
+ r.insertBlock("```language\n" + (e.text || "code here") + "\n```");
1056
+ }
1057
+ }
1058
+ ],
1059
+ shortcuts: [
1060
+ { key: "Ctrl+e", action: ({ editor: r }) => r.wrapSelection("`", "`"), description: "Inline Code" },
1061
+ {
1062
+ key: "Ctrl+Shift+c",
1063
+ action: ({ editor: r, selection: e }) => {
1064
+ r.insertBlock("```language\n" + (e.text || "code here") + "\n```");
1065
+ },
1066
+ description: "Code Block"
1067
+ }
1068
+ ]
1069
+ };
1070
+ }
1071
+ function Q() {
1072
+ return {
1073
+ name: "unorderedList",
1074
+ toolbarItems: [{
1075
+ id: "unorderedList",
1076
+ label: "Unordered List",
1077
+ icon: p.unorderedList,
1078
+ tooltip: "Bullet List",
1079
+ action: ({ editor: r }) => {
1080
+ const e = r.getCurrentLine();
1081
+ e.match(/^[-*]\s/) ? r.replaceCurrentLine(e.replace(/^[-*]\s/, "")) : r.replaceCurrentLine("- " + e);
1082
+ }
1083
+ }]
1084
+ };
1085
+ }
1086
+ function ee() {
1087
+ return {
1088
+ name: "orderedList",
1089
+ toolbarItems: [{
1090
+ id: "orderedList",
1091
+ label: "Ordered List",
1092
+ icon: p.orderedList,
1093
+ tooltip: "Numbered List",
1094
+ action: ({ editor: r }) => {
1095
+ const e = r.getCurrentLine();
1096
+ e.match(/^\d+\.\s/) ? r.replaceCurrentLine(e.replace(/^\d+\.\s/, "")) : r.replaceCurrentLine("1. " + e);
1097
+ }
1098
+ }]
1099
+ };
1100
+ }
1101
+ function te() {
1102
+ return {
1103
+ name: "taskList",
1104
+ toolbarItems: [{
1105
+ id: "taskList",
1106
+ label: "Task List",
1107
+ icon: p.taskList,
1108
+ tooltip: "Task List",
1109
+ action: ({ editor: r }) => {
1110
+ const e = r.getCurrentLine();
1111
+ e.match(/^- \[[ x]\]\s/) ? r.replaceCurrentLine(e.replace(/^- \[[ x]\]\s/, "")) : r.replaceCurrentLine("- [ ] " + e);
1112
+ }
1113
+ }]
1114
+ };
1115
+ }
1116
+ function re() {
1117
+ return {
1118
+ name: "table",
1119
+ toolbarItems: [{
1120
+ id: "table",
1121
+ label: "Table",
1122
+ icon: p.table,
1123
+ tooltip: "Insert Table",
1124
+ action: ({ editor: r }) => {
1125
+ r.insertBlock(`| Header 1 | Header 2 | Header 3 |
1126
+ | -------- | -------- | -------- |
1127
+ | Cell 1 | Cell 2 | Cell 3 |
1128
+ | Cell 4 | Cell 5 | Cell 6 |`);
1129
+ }
1130
+ }]
1131
+ };
1132
+ }
1133
+ const oe = [
1134
+ { name: "Yellow", color: "#fef08a", darkColor: "#854d0e", class: "yellow" },
1135
+ { name: "Green", color: "#bbf7d0", darkColor: "#166534", class: "green" },
1136
+ { name: "Blue", color: "#bfdbfe", darkColor: "#1e3a5f", class: "blue" },
1137
+ { name: "Purple", color: "#ddd6fe", darkColor: "#4c1d95", class: "purple" },
1138
+ { name: "Pink", color: "#fbcfe8", darkColor: "#831843", class: "pink" },
1139
+ { name: "Red", color: "#fecaca", darkColor: "#991b1b", class: "red" },
1140
+ { name: "Orange", color: "#fed7aa", darkColor: "#9a3412", class: "orange" },
1141
+ { name: "Cyan", color: "#a5f3fc", darkColor: "#155e75", class: "cyan" }
1142
+ ];
1143
+ function ie() {
1144
+ return {
1145
+ name: "highlight",
1146
+ toolbarItems: [{
1147
+ id: "highlight",
1148
+ label: "Highlight",
1149
+ icon: p.highlight,
1150
+ tooltip: "Highlight Text",
1151
+ children: oe.map((r) => ({
1152
+ id: `highlight-${r.class}`,
1153
+ label: r.name,
1154
+ icon: `<span class="smdx-color-dot" style="background:${r.color}"></span>`,
1155
+ tooltip: `${r.name} Highlight`,
1156
+ action: ({ editor: e }) => {
1157
+ e.wrapSelection(`<Highlight color="${r.class}">`, "</Highlight>");
1158
+ }
1159
+ })),
1160
+ action: ({ editor: r }) => {
1161
+ r.wrapSelection('<Highlight color="yellow">', "</Highlight>");
1162
+ }
1163
+ }],
1164
+ renderers: [{
1165
+ name: "highlight",
1166
+ pattern: /<Highlight\s+color="([^"]+)">([\s\S]*?)<\/Highlight>/g,
1167
+ render: (r) => {
1168
+ const e = r.match(/<Highlight\s+color="([^"]+)">([\s\S]*?)<\/Highlight>/);
1169
+ return e ? `<mark class="smdx-highlight smdx-highlight-${e[1]}">${e[2]}</mark>` : r;
1170
+ }
1171
+ }],
1172
+ styles: `
1173
+ .smdx-highlight { padding: 2px 4px; border-radius: 3px; }
1174
+ .smdx-highlight-yellow { background-color: #fef08a; }
1175
+ .smdx-highlight-green { background-color: #bbf7d0; }
1176
+ .smdx-highlight-blue { background-color: #bfdbfe; }
1177
+ .smdx-highlight-purple { background-color: #ddd6fe; }
1178
+ .smdx-highlight-pink { background-color: #fbcfe8; }
1179
+ .smdx-highlight-red { background-color: #fecaca; }
1180
+ .smdx-highlight-orange { background-color: #fed7aa; }
1181
+ .smdx-highlight-cyan { background-color: #a5f3fc; }
1182
+ .smdx-dark .smdx-highlight-yellow { background-color: #854d0e; color: #fef08a; }
1183
+ .smdx-dark .smdx-highlight-green { background-color: #166534; color: #bbf7d0; }
1184
+ .smdx-dark .smdx-highlight-blue { background-color: #1e3a5f; color: #bfdbfe; }
1185
+ .smdx-dark .smdx-highlight-purple { background-color: #4c1d95; color: #ddd6fe; }
1186
+ .smdx-dark .smdx-highlight-pink { background-color: #831843; color: #fbcfe8; }
1187
+ .smdx-dark .smdx-highlight-red { background-color: #991b1b; color: #fecaca; }
1188
+ .smdx-dark .smdx-highlight-orange { background-color: #9a3412; color: #fed7aa; }
1189
+ .smdx-dark .smdx-highlight-cyan { background-color: #155e75; color: #a5f3fc; }
1190
+ .smdx-color-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.15); vertical-align: middle; margin-right: 6px; }
1191
+ `
1192
+ };
1193
+ }
1194
+ const E = [
1195
+ {
1196
+ type: "tip",
1197
+ label: "TIP",
1198
+ color: "#10b981",
1199
+ bg: "#ecfdf5",
1200
+ icon: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="12" r="10" fill="#10b981"/><path d="M9 12l2 2 4-4" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>'
1201
+ },
1202
+ {
1203
+ type: "warning",
1204
+ label: "WARNING",
1205
+ color: "#f59e0b",
1206
+ bg: "#fffbeb",
1207
+ icon: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z" fill="#f59e0b"/><path d="M12 9v4M12 17h.01" stroke="#fff" stroke-width="2" stroke-linecap="round"/></svg>'
1208
+ },
1209
+ {
1210
+ type: "caution",
1211
+ label: "CAUTION",
1212
+ color: "#f97316",
1213
+ bg: "#fff7ed",
1214
+ icon: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="12" r="10" fill="#f97316"/><path d="M12 8v4M12 16h.01" stroke="#fff" stroke-width="2" stroke-linecap="round"/></svg>'
1215
+ },
1216
+ {
1217
+ type: "danger",
1218
+ label: "DANGER",
1219
+ color: "#ef4444",
1220
+ bg: "#fef2f2",
1221
+ icon: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="12" r="10" fill="#ef4444"/><path d="M15 9l-6 6M9 9l6 6" stroke="#fff" stroke-width="2" stroke-linecap="round"/></svg>'
1222
+ },
1223
+ {
1224
+ type: "check",
1225
+ label: "CHECK",
1226
+ color: "#22c55e",
1227
+ bg: "#f0fdf4",
1228
+ icon: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="12" r="10" fill="#22c55e"/><path d="M8 12l3 3 5-5" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>'
1229
+ },
1230
+ {
1231
+ type: "info",
1232
+ label: "INFO",
1233
+ color: "#3b82f6",
1234
+ bg: "#eff6ff",
1235
+ icon: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="12" r="10" fill="#3b82f6"/><path d="M12 16v-4M12 8h.01" stroke="#fff" stroke-width="2" stroke-linecap="round"/></svg>'
1236
+ },
1237
+ {
1238
+ type: "note",
1239
+ label: "NOTE",
1240
+ color: "#8b5cf6",
1241
+ bg: "#f5f3ff",
1242
+ icon: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none"><rect x="3" y="3" width="18" height="18" rx="3" fill="#8b5cf6"/><path d="M8 10h8M8 14h5" stroke="#fff" stroke-width="2" stroke-linecap="round"/></svg>'
1243
+ }
1244
+ ];
1245
+ function se() {
1246
+ return {
1247
+ name: "admonition",
1248
+ toolbarItems: [{
1249
+ id: "admonition",
1250
+ label: "Admonition",
1251
+ icon: p.admonition,
1252
+ tooltip: "Admonition / Callout",
1253
+ children: E.map((r) => ({
1254
+ id: `admonition-${r.type}`,
1255
+ label: r.label,
1256
+ icon: r.icon,
1257
+ tooltip: `${r.label} callout`,
1258
+ action: ({ editor: e }) => {
1259
+ e.insertBlock(`:::${r.type}
1260
+ ${r.label}: Your message here
1261
+ :::`);
1262
+ }
1263
+ })),
1264
+ action: ({ editor: r }) => {
1265
+ r.insertBlock(`:::info
1266
+ INFO: Your message here
1267
+ :::`);
1268
+ }
1269
+ }],
1270
+ renderers: [{
1271
+ name: "admonition",
1272
+ pattern: /:::(tip|warning|caution|danger|check|info|note)(?:\[([^\]]*)\])?\n([\s\S]*?):::/g,
1273
+ render: (r) => {
1274
+ const e = r.match(/:::(tip|warning|caution|danger|check|info|note)(?:\[([^\]]*)\])?\n([\s\S]*?):::/);
1275
+ if (!e) return r;
1276
+ const t = E.find((i) => i.type === e[1]), o = e[2] || t.label;
1277
+ return `<div class="smdx-admonition smdx-admonition-${e[1]}"><div class="smdx-admonition-title"><span class="smdx-admonition-icon">${t.icon}</span>${o}</div><div class="smdx-admonition-content">${e[3]}</div></div>`;
1278
+ },
1279
+ priority: 10
1280
+ }],
1281
+ styles: `
1282
+ .smdx-admonition { padding: 14px 16px; border-radius: 6px; margin: 12px 0; border-left: 4px solid; }
1283
+ .smdx-admonition-title { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 6px; font-size: 0.85em; text-transform: uppercase; letter-spacing: 0.02em; }
1284
+ .smdx-admonition-icon { display: flex; align-items: center; flex-shrink: 0; }
1285
+ .smdx-admonition-icon svg { display: block; }
1286
+ .smdx-admonition-content { font-size: 0.95em; line-height: 1.6; color: var(--smdx-text, #1e293b); }
1287
+ .smdx-admonition-content p { margin: 4px 0; }
1288
+ .smdx-admonition-tip { border-left-color: #10b981; background: #ecfdf5; }
1289
+ .smdx-admonition-tip .smdx-admonition-title { color: #10b981; }
1290
+ .smdx-admonition-warning { border-left-color: #f59e0b; background: #fffbeb; }
1291
+ .smdx-admonition-warning .smdx-admonition-title { color: #f59e0b; }
1292
+ .smdx-admonition-caution { border-left-color: #f97316; background: #fff7ed; }
1293
+ .smdx-admonition-caution .smdx-admonition-title { color: #f97316; }
1294
+ .smdx-admonition-danger { border-left-color: #ef4444; background: #fef2f2; }
1295
+ .smdx-admonition-danger .smdx-admonition-title { color: #ef4444; }
1296
+ .smdx-admonition-check { border-left-color: #22c55e; background: #f0fdf4; }
1297
+ .smdx-admonition-check .smdx-admonition-title { color: #22c55e; }
1298
+ .smdx-admonition-info { border-left-color: #3b82f6; background: #eff6ff; }
1299
+ .smdx-admonition-info .smdx-admonition-title { color: #3b82f6; }
1300
+ .smdx-admonition-note { border-left-color: #8b5cf6; background: #f5f3ff; }
1301
+ .smdx-admonition-note .smdx-admonition-title { color: #8b5cf6; }
1302
+ .smdx-dark .smdx-admonition-tip { background: #052e16; }
1303
+ .smdx-dark .smdx-admonition-warning { background: #451a03; }
1304
+ .smdx-dark .smdx-admonition-caution { background: #431407; }
1305
+ .smdx-dark .smdx-admonition-danger { background: #450a0a; }
1306
+ .smdx-dark .smdx-admonition-check { background: #052e16; }
1307
+ .smdx-dark .smdx-admonition-info { background: #172554; }
1308
+ .smdx-dark .smdx-admonition-note { background: #2e1065; }
1309
+ .smdx-dark .smdx-admonition-content { color: var(--smdx-text, #e2e8f0); }
1310
+ `
1311
+ };
1312
+ }
1313
+ function ne(r) {
1314
+ const e = r.split(`
1315
+ `), t = e.filter((i) => i.trim().length > 0), o = t.length > 0 ? Math.min(...t.map((i) => i.match(/^\s*/)[0].length)) : 0;
1316
+ return o > 0 ? e.map((i) => i.slice(o)).join(`
1317
+ `).trim() : r.trim();
1318
+ }
1319
+ function ae() {
1320
+ return {
1321
+ name: "tab",
1322
+ toolbarItems: [{
1323
+ id: "tab",
1324
+ label: "Tab",
1325
+ icon: p.tab,
1326
+ tooltip: "Insert Tabs",
1327
+ action: ({ editor: r }) => {
1328
+ r.insertBlock(
1329
+ `<Tabs>
1330
+ <Tab title="Tab 1">
1331
+ Content for tab 1
1332
+ </Tab>
1333
+ <Tab title="Tab 2">
1334
+ Content for tab 2
1335
+ </Tab>
1336
+ </Tabs>`
1337
+ );
1338
+ }
1339
+ }],
1340
+ renderers: [{
1341
+ name: "tabs",
1342
+ pattern: /<Tabs>([\s\S]*?)<\/Tabs>/g,
1343
+ render: (r) => {
1344
+ const e = /<Tab\s+title="([^"]*)">([\s\S]*?)<\/Tab>/g;
1345
+ let t = [], o;
1346
+ for (; (o = e.exec(r)) !== null; )
1347
+ t.push({ title: o[1], content: ne(o[2]) });
1348
+ if (t.length === 0) return r;
1349
+ let s = `<div class="smdx-tabs" data-tab-id="${"tab-" + Math.random().toString(36).substring(2, 8)}"><div class="smdx-tabs-header">`;
1350
+ return t.forEach((n, a) => {
1351
+ s += `<button class="smdx-tab-btn${a === 0 ? " smdx-active" : ""}" data-smdx-tab-btn="true" data-tab-index="${a}">${n.title}</button>`;
1352
+ }), s += "</div>", t.forEach((n, a) => {
1353
+ s += `<div class="smdx-tab-panel" style="display:${a === 0 ? "block" : "none"}">${n.content}</div>`;
1354
+ }), s += "</div>", s;
1355
+ },
1356
+ priority: 15
1357
+ }],
1358
+ styles: `
1359
+ .smdx-tabs { border: 1px solid var(--smdx-border, #e2e8f0); border-radius: 8px; overflow: hidden; margin: 12px 0; }
1360
+ .smdx-tabs-header { display: flex; background: var(--smdx-bg-muted, #f8fafc); border-bottom: 1px solid var(--smdx-border, #e2e8f0); }
1361
+ .smdx-tab-btn { padding: 8px 16px; border: none; background: none; cursor: pointer; font-size: 0.9em; color: var(--smdx-text-muted, #64748b); border-bottom: 2px solid transparent; transition: all 0.15s; }
1362
+ .smdx-tab-btn:hover { color: var(--smdx-text, #1e293b); }
1363
+ .smdx-tab-btn.smdx-active { color: var(--smdx-primary, #6366f1); border-bottom-color: var(--smdx-primary, #6366f1); background: var(--smdx-bg, #fff); }
1364
+ .smdx-tab-panel { padding: 16px; }
1365
+ `
1366
+ };
1367
+ }
1368
+ function de() {
1369
+ return {
1370
+ name: "imageBackground",
1371
+ toolbarItems: [{
1372
+ id: "imageBackground",
1373
+ label: "Image Background",
1374
+ icon: p.imageBackground,
1375
+ tooltip: "Image with Background",
1376
+ action: ({ editor: r }) => {
1377
+ r.insertBlock(`<ImageBackground src="image-url" alt="description" background="#f0f0f0">
1378
+ Content overlaying the image
1379
+ </ImageBackground>`);
1380
+ }
1381
+ }],
1382
+ renderers: [{
1383
+ name: "imageBackground",
1384
+ pattern: /<ImageBackground\s+src="([^"]*)"(?:\s+alt="([^"]*)")?(?:\s+background="([^"]*)")?\s*>([\s\S]*?)<\/ImageBackground>/g,
1385
+ render: (r) => {
1386
+ const e = r.match(/<ImageBackground\s+src="([^"]*)"(?:\s+alt="([^"]*)")?(?:\s+background="([^"]*)")?\s*>([\s\S]*?)<\/ImageBackground>/);
1387
+ return e ? `<div class="smdx-image-bg" style="${e[3] ? `background-image:url(${e[1]});background-color:${e[3]}` : `background-image:url(${e[1]})`}">
1388
+ <div class="smdx-image-bg-overlay">${e[4].trim()}</div>
1389
+ </div>` : r;
1390
+ }
1391
+ }],
1392
+ styles: `
1393
+ .smdx-image-bg { background-size: cover; background-position: center; border-radius: 8px; overflow: hidden; min-height: 200px; display: flex; align-items: center; justify-content: center; margin: 12px 0; background-color: var(--smdx-bg-muted, #f0f0f0); border: 1px solid var(--smdx-border, #e2e8f0); }
1394
+ .smdx-image-bg-overlay { background: rgba(0,0,0,0.5); color: white; padding: 24px; width: 100%; text-align: center; }
1395
+ .smdx-dark .smdx-image-bg-overlay { background: rgba(0,0,0,0.6); }
1396
+ `
1397
+ };
1398
+ }
1399
+ function le() {
1400
+ return {
1401
+ name: "imageFrame",
1402
+ toolbarItems: [{
1403
+ id: "imageFrame",
1404
+ label: "Image Frame",
1405
+ icon: p.imageFrame,
1406
+ tooltip: "Image in Frame",
1407
+ action: ({ editor: r }) => {
1408
+ r.insertBlock('<ImageFrame src="image-url" alt="description" caption="Image caption" />');
1409
+ }
1410
+ }],
1411
+ renderers: [{
1412
+ name: "imageFrame",
1413
+ pattern: /<ImageFrame\s+src="([^"]*)"(?:\s+alt="([^"]*)")?(?:\s+caption="([^"]*)")?\s*\/>/g,
1414
+ render: (r) => {
1415
+ const e = r.match(/<ImageFrame\s+src="([^"]*)"(?:\s+alt="([^"]*)")?(?:\s+caption="([^"]*)")?\s*\/>/);
1416
+ return e ? `<figure class="smdx-image-frame">
1417
+ <img src="${e[1]}" alt="${e[2] || ""}" />
1418
+ ${e[3] ? `<figcaption>${e[3]}</figcaption>` : ""}
1419
+ </figure>` : r;
1420
+ }
1421
+ }],
1422
+ styles: `
1423
+ .smdx-image-frame { border: 1px solid var(--smdx-border, #e2e8f0); border-radius: 8px; overflow: hidden; margin: 12px 0; padding: 8px; background: var(--smdx-bg-muted, #f8fafc); }
1424
+ .smdx-image-frame img { width: 100%; border-radius: 4px; display: block; }
1425
+ .smdx-image-frame figcaption { text-align: center; padding: 8px 0 4px; font-size: 0.85em; color: var(--smdx-text-muted, #64748b); }
1426
+ `
1427
+ };
1428
+ }
1429
+ function M(r) {
1430
+ const e = r.split(`
1431
+ `), t = e.filter((i) => i.trim().length > 0), o = t.length > 0 ? Math.min(...t.map((i) => i.match(/^\s*/)[0].length)) : 0;
1432
+ return o > 0 ? e.map((i) => i.slice(o)).join(`
1433
+ `).trim() : r.trim();
1434
+ }
1435
+ function ce() {
1436
+ return {
1437
+ name: "accordion",
1438
+ toolbarItems: [{
1439
+ id: "accordion",
1440
+ label: "Accordion",
1441
+ icon: p.accordion,
1442
+ tooltip: "Insert Accordion",
1443
+ action: ({ editor: r }) => {
1444
+ r.insertBlock(
1445
+ `<Accordion title="Accordion Title" defaultOpen>
1446
+ Your content here. You can include any markdown or components.
1447
+ </Accordion>`
1448
+ );
1449
+ }
1450
+ }],
1451
+ renderers: [{
1452
+ name: "accordion",
1453
+ pattern: /<Accordion\s+title="([^"]*)"(\s+defaultOpen)?\s*>([\s\S]*?)<\/Accordion>/g,
1454
+ render: (r) => {
1455
+ const e = r.match(/<Accordion\s+title="([^"]*)"(\s+defaultOpen)?\s*>([\s\S]*?)<\/Accordion>/);
1456
+ return e ? `<details class="smdx-accordion"${e[2] ? " open" : ""}><summary class="smdx-accordion-header"><span class="smdx-accordion-arrow"></span><span class="smdx-accordion-title">${e[1]}</span></summary><div class="smdx-accordion-content">${M(e[3])}</div></details>` : r;
1457
+ },
1458
+ priority: 12
1459
+ }],
1460
+ styles: `
1461
+ .smdx-accordion { border: 1px solid var(--smdx-border, #e2e8f0); border-radius: 8px; margin: 8px 0; overflow: hidden; background: var(--smdx-bg, #fff); }
1462
+ .smdx-accordion-header { padding: 14px 18px; cursor: pointer; display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 0.95em; user-select: none; list-style: none; color: var(--smdx-text, #1e293b); }
1463
+ .smdx-accordion-header::-webkit-details-marker { display: none; }
1464
+ .smdx-accordion-arrow { display: inline-block; width: 0; height: 0; border-left: 5px solid var(--smdx-text-muted, #64748b); border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform 0.2s; flex-shrink: 0; }
1465
+ details[open] > .smdx-accordion-header .smdx-accordion-arrow { transform: rotate(90deg); }
1466
+ .smdx-accordion-title { flex: 1; }
1467
+ .smdx-accordion-content { padding: 14px 18px 18px 18px; border-top: 1px solid var(--smdx-border, #e2e8f0); }
1468
+ .smdx-accordion-content p { margin: 6px 0; }
1469
+ .smdx-accordion-content > :last-child { margin-bottom: 0; }
1470
+ `
1471
+ };
1472
+ }
1473
+ function me() {
1474
+ return {
1475
+ name: "accordionGroup",
1476
+ dependencies: ["accordion"],
1477
+ toolbarItems: [{
1478
+ id: "accordionGroup",
1479
+ label: "Accordion Group",
1480
+ icon: p.accordionGroup,
1481
+ tooltip: "Insert Accordion Group",
1482
+ action: ({ editor: r }) => {
1483
+ r.insertBlock(
1484
+ `<AccordionGroup>
1485
+ <Accordion title="Section 1" defaultOpen>
1486
+ Content for section 1
1487
+ </Accordion>
1488
+ <Accordion title="Section 2">
1489
+ Content for section 2
1490
+ </Accordion>
1491
+ <Accordion title="Section 3">
1492
+ Content for section 3
1493
+ </Accordion>
1494
+ </AccordionGroup>`
1495
+ );
1496
+ }
1497
+ }],
1498
+ renderers: [{
1499
+ name: "accordionGroup",
1500
+ pattern: /<AccordionGroup>([\s\S]*?)<\/AccordionGroup>/g,
1501
+ render: (r) => {
1502
+ const e = r.match(/<AccordionGroup>([\s\S]*?)<\/AccordionGroup>/);
1503
+ return e ? `<div class="smdx-accordion-group">${e[1]}</div>` : r;
1504
+ },
1505
+ priority: 14
1506
+ }],
1507
+ styles: `
1508
+ .smdx-accordion-group { display: flex; flex-direction: column; gap: 0; margin: 12px 0; }
1509
+ .smdx-accordion-group > :not(.smdx-accordion) { display: none; }
1510
+ .smdx-accordion-group .smdx-accordion { margin: 0; border-radius: 0; border-bottom: none; }
1511
+ .smdx-accordion-group .smdx-accordion:first-of-type { border-radius: 8px 8px 0 0; }
1512
+ .smdx-accordion-group .smdx-accordion:last-of-type { border-radius: 0 0 8px 8px; border-bottom: 1px solid var(--smdx-border, #e2e8f0); }
1513
+ `
1514
+ };
1515
+ }
1516
+ function pe() {
1517
+ return {
1518
+ name: "multiColumn",
1519
+ toolbarItems: [{
1520
+ id: "multiColumn",
1521
+ label: "Columns",
1522
+ icon: p.multiColumn,
1523
+ tooltip: "Multiple Columns",
1524
+ children: [2, 3, 4, 5].map((r) => ({
1525
+ id: `columns-${r}`,
1526
+ label: `${r} Columns`,
1527
+ tooltip: `${r} column layout`,
1528
+ action: ({ editor: e }) => {
1529
+ const t = Array.from(
1530
+ { length: r },
1531
+ (o, i) => ` <Column>
1532
+ Column ${i + 1} content
1533
+ </Column>`
1534
+ ).join(`
1535
+ `);
1536
+ e.insertBlock(`<Columns count="${r}">
1537
+ ${t}
1538
+ </Columns>`);
1539
+ }
1540
+ })),
1541
+ action: ({ editor: r }) => {
1542
+ r.insertBlock(
1543
+ `<Columns count="2">
1544
+ <Column>
1545
+ Column 1 content
1546
+ </Column>
1547
+ <Column>
1548
+ Column 2 content
1549
+ </Column>
1550
+ </Columns>`
1551
+ );
1552
+ }
1553
+ }],
1554
+ renderers: [{
1555
+ name: "columns",
1556
+ pattern: /<Columns\s+count="(\d+)">([\s\S]*?)<\/Columns>/g,
1557
+ render: (r) => {
1558
+ const e = r.match(/<Columns\s+count="(\d+)">([\s\S]*?)<\/Columns>/);
1559
+ if (!e) return r;
1560
+ const t = parseInt(e[1]), o = /<Column>([\s\S]*?)<\/Column>/g;
1561
+ let i = [], s;
1562
+ for (; (s = o.exec(e[2])) !== null; )
1563
+ i.push(M(s[1]));
1564
+ let n = `<div class="smdx-columns" style="grid-template-columns:repeat(${t},1fr)">`;
1565
+ for (const a of i)
1566
+ n += `<div class="smdx-column">${a}</div>`;
1567
+ return n += "</div>", n;
1568
+ },
1569
+ priority: 13
1570
+ }],
1571
+ styles: `
1572
+ .smdx-columns { display: grid; gap: 16px; margin: 12px 0; }
1573
+ .smdx-column { padding: 12px; border: 1px solid var(--smdx-border, #e2e8f0); border-radius: 6px; }
1574
+ `
1575
+ };
1576
+ }
1577
+ function he(r) {
1578
+ const e = r.split(`
1579
+ `), t = e.filter((i) => i.trim().length > 0), o = t.length > 0 ? Math.min(...t.map((i) => i.match(/^\s*/)[0].length)) : 0;
1580
+ return o > 0 ? e.map((i) => i.slice(o)).join(`
1581
+ `).trim() : r.trim();
1582
+ }
1583
+ function xe() {
1584
+ return {
1585
+ name: "card",
1586
+ toolbarItems: [{
1587
+ id: "card",
1588
+ label: "Card",
1589
+ icon: p.card,
1590
+ tooltip: "Insert Card",
1591
+ action: ({ editor: r }) => {
1592
+ r.insertBlock(
1593
+ `<Card title="Card Title" icon="📄" href="/link">
1594
+ Card description or content goes here.
1595
+ </Card>`
1596
+ );
1597
+ }
1598
+ }],
1599
+ renderers: [{
1600
+ name: "card",
1601
+ pattern: /<Card\s+title="([^"]*)"(?:\s+icon="([^"]*)")?(?:\s+href="([^"]*)")?\s*>([\s\S]*?)<\/Card>/g,
1602
+ render: (r) => {
1603
+ const e = r.match(/<Card\s+title="([^"]*)"(?:\s+icon="([^"]*)")?(?:\s+href="([^"]*)")?\s*>([\s\S]*?)<\/Card>/);
1604
+ if (!e) return r;
1605
+ const t = e[3] ? "a" : "div", o = e[3] ? ` href="${e[3]}" target="_blank" rel="noopener noreferrer"` : "", i = e[2] ? `<span class="smdx-card-icon">${e[2]}</span>` : "", s = e[3] ? '<svg class="smdx-card-arrow" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 18l6-6-6-6"/></svg>' : "";
1606
+ return `<${t} class="smdx-card"${o}><div class="smdx-card-header">${i}<span class="smdx-card-title">${e[1]}</span>${s}</div><div class="smdx-card-content">${he(e[4])}</div></${t}>`;
1607
+ },
1608
+ priority: 11
1609
+ }],
1610
+ styles: `
1611
+ .smdx-card { display: block; border: 1px solid var(--smdx-border, #e2e8f0); border-radius: 10px; padding: 16px 20px; margin: 8px 0; text-decoration: none; color: inherit; transition: border-color 0.2s, box-shadow 0.2s, background 0.2s; background: var(--smdx-bg, #fff); }
1612
+ a.smdx-card { cursor: pointer; }
1613
+ a.smdx-card:hover { border-color: var(--smdx-primary, #6366f1); box-shadow: 0 2px 12px rgba(99,102,241,0.1); background: var(--smdx-bg-muted, #f8fafc); }
1614
+ .smdx-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
1615
+ .smdx-card-icon { font-size: 1.25em; flex-shrink: 0; }
1616
+ .smdx-card-title { font-weight: 700; font-size: 1em; color: var(--smdx-text, #1e293b); }
1617
+ .smdx-card-arrow { margin-left: auto; flex-shrink: 0; color: var(--smdx-text-muted, #94a3b8); transition: transform 0.2s, color 0.2s; }
1618
+ a.smdx-card:hover .smdx-card-arrow { transform: translateX(2px); color: var(--smdx-primary, #6366f1); }
1619
+ .smdx-card-content { font-size: 0.9em; color: var(--smdx-text-muted, #64748b); line-height: 1.5; }
1620
+ `
1621
+ };
1622
+ }
1623
+ function ue() {
1624
+ return {
1625
+ name: "cardGroup",
1626
+ dependencies: ["card"],
1627
+ toolbarItems: [{
1628
+ id: "cardGroup",
1629
+ label: "Card Group",
1630
+ icon: p.cardGroup,
1631
+ tooltip: "Insert Card Group",
1632
+ action: ({ editor: r }) => {
1633
+ r.insertBlock(
1634
+ `<CardGroup cols="2">
1635
+ <Card title="Card 1" icon="📄">
1636
+ Description for card 1
1637
+ </Card>
1638
+ <Card title="Card 2" icon="🔧">
1639
+ Description for card 2
1640
+ </Card>
1641
+ <Card title="Card 3" icon="🚀">
1642
+ Description for card 3
1643
+ </Card>
1644
+ <Card title="Card 4" icon="💡">
1645
+ Description for card 4
1646
+ </Card>
1647
+ </CardGroup>`
1648
+ );
1649
+ }
1650
+ }],
1651
+ renderers: [{
1652
+ name: "cardGroup",
1653
+ pattern: /<CardGroup(?:\s+cols="(\d+)")?\s*>([\s\S]*?)<\/CardGroup>/g,
1654
+ render: (r) => {
1655
+ const e = r.match(/<CardGroup(?:\s+cols="(\d+)")?\s*>([\s\S]*?)<\/CardGroup>/);
1656
+ return e ? `<div class="smdx-card-group" style="grid-template-columns:repeat(${e[1] || "2"},1fr)">${e[2]}</div>` : r;
1657
+ },
1658
+ priority: 13
1659
+ }],
1660
+ styles: `
1661
+ .smdx-card-group { display: grid; gap: 12px; margin: 12px 0; }
1662
+ .smdx-card-group .smdx-card { margin: 0; }
1663
+ `
1664
+ };
1665
+ }
1666
+ function B(r) {
1667
+ const e = r.split(`
1668
+ `), t = e.filter((i) => i.trim().length > 0), o = t.length > 0 ? Math.min(...t.map((i) => i.match(/^\s*/)[0].length)) : 0;
1669
+ return o > 0 ? e.map((i) => i.slice(o)).join(`
1670
+ `).trim() : r.trim();
1671
+ }
1672
+ function ge() {
1673
+ return {
1674
+ name: "step",
1675
+ toolbarItems: [{
1676
+ id: "steps",
1677
+ label: "Steps",
1678
+ icon: p.step,
1679
+ tooltip: "Insert Steps",
1680
+ action: ({ editor: r }) => {
1681
+ r.insertBlock(
1682
+ `<Steps>
1683
+ <Step title="First Step">
1684
+ These are instructions or content that only pertain to the first step.
1685
+ </Step>
1686
+ <Step title="Second Step">
1687
+ These are instructions or content that only pertain to the second step.
1688
+ </Step>
1689
+ <Step title="Third Step">
1690
+ These are instructions or content that only pertain to the third step.
1691
+ </Step>
1692
+ </Steps>`
1693
+ );
1694
+ }
1695
+ }],
1696
+ renderers: [{
1697
+ name: "steps",
1698
+ pattern: /<Steps>([\s\S]*?)<\/Steps>/g,
1699
+ render: (r) => {
1700
+ const e = r.match(/<Steps>([\s\S]*?)<\/Steps>/);
1701
+ if (!e) return r;
1702
+ const t = /<Step\s+title="([^"]*)">([\s\S]*?)<\/Step>/g;
1703
+ let o = [], i;
1704
+ for (; (i = t.exec(e[1])) !== null; )
1705
+ o.push({ title: i[1], content: B(i[2]) });
1706
+ let s = '<div class="smdx-steps">';
1707
+ return o.forEach((n, a) => {
1708
+ const d = a === o.length - 1;
1709
+ s += `<div class="smdx-step"><div class="smdx-step-indicator"><div class="smdx-step-number">${a + 1}</div>${d ? "" : '<div class="smdx-step-line"></div>'}</div><div class="smdx-step-content"><div class="smdx-step-title">${n.title}</div><div class="smdx-step-body">${n.content}</div></div></div>`;
1710
+ }), s += "</div>", s;
1711
+ },
1712
+ priority: 15
1713
+ }],
1714
+ styles: `
1715
+ .smdx-steps { margin: 20px 0; }
1716
+ .smdx-step { display: flex; gap: 20px; position: relative; }
1717
+ .smdx-step-indicator { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; min-width: 34px; position: relative; }
1718
+ .smdx-step-number { width: 34px; height: 34px; min-width: 34px; min-height: 34px; border-radius: 50%; background: var(--smdx-bg-muted, #f1f5f9); color: var(--smdx-text-muted, #475569); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.85em; border: 1px solid var(--smdx-border, #e2e8f0); position: relative; z-index: 1; box-sizing: border-box; }
1719
+ .smdx-step-line { width: 2px; flex: 1; background: var(--smdx-border, #e2e8f0); min-height: 100%; }
1720
+ .smdx-step-content { flex: 1; padding-bottom: 32px; min-width: 0; }
1721
+ .smdx-step:last-child .smdx-step-content { padding-bottom: 0; }
1722
+ .smdx-step-title { font-weight: 700; font-size: 1.05em; color: var(--smdx-text, #1e293b); margin-bottom: 8px; }
1723
+ .smdx-step-body { color: var(--smdx-text-muted, #64748b); font-size: 0.95em; line-height: 1.7; }
1724
+ `
1725
+ };
1726
+ }
1727
+ const T = [
1728
+ {
1729
+ type: "good",
1730
+ label: "Good",
1731
+ color: "#22c55e",
1732
+ bg: "#f0fdf4",
1733
+ icon: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="12" r="10" fill="#22c55e"/><path d="M8 12l3 3 5-5" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>'
1734
+ },
1735
+ {
1736
+ type: "bad",
1737
+ label: "Bad",
1738
+ color: "#ef4444",
1739
+ bg: "#fef2f2",
1740
+ icon: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="12" r="10" fill="#ef4444"/><path d="M15 9l-6 6M9 9l6 6" stroke="#fff" stroke-width="2" stroke-linecap="round"/></svg>'
1741
+ },
1742
+ {
1743
+ type: "info",
1744
+ label: "Info",
1745
+ color: "#3b82f6",
1746
+ bg: "#eff6ff",
1747
+ icon: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="12" r="10" fill="#3b82f6"/><path d="M12 16v-4M12 8h.01" stroke="#fff" stroke-width="2" stroke-linecap="round"/></svg>'
1748
+ }
1749
+ ];
1750
+ function be() {
1751
+ return {
1752
+ name: "tip",
1753
+ toolbarItems: [{
1754
+ id: "tip",
1755
+ label: "Tip",
1756
+ icon: p.tip,
1757
+ tooltip: "Insert Tip",
1758
+ children: T.map((r) => ({
1759
+ id: `tip-${r.type}`,
1760
+ label: r.label,
1761
+ icon: r.icon,
1762
+ tooltip: `${r.label} tip`,
1763
+ action: ({ editor: e }) => {
1764
+ e.insertBlock(`<Tip${r.type.charAt(0).toUpperCase() + r.type.slice(1)}>Your tip message here</Tip${r.type.charAt(0).toUpperCase() + r.type.slice(1)}>`);
1765
+ }
1766
+ })),
1767
+ action: ({ editor: r }) => {
1768
+ r.insertBlock("<TipGood>Your tip message here</TipGood>");
1769
+ }
1770
+ }],
1771
+ renderers: T.map((r) => ({
1772
+ name: `tip-${r.type}`,
1773
+ pattern: new RegExp(`<Tip${r.type.charAt(0).toUpperCase() + r.type.slice(1)}>([\\s\\S]*?)<\\/Tip${r.type.charAt(0).toUpperCase() + r.type.slice(1)}>`, "g"),
1774
+ render: (e) => {
1775
+ const t = `Tip${r.type.charAt(0).toUpperCase() + r.type.slice(1)}`, o = new RegExp(`<${t}>([\\s\\S]*?)<\\/${t}>`), i = e.match(o);
1776
+ return i ? `<div class="smdx-tip smdx-tip-${r.type}"><span class="smdx-tip-icon">${r.icon}</span><span class="smdx-tip-text">${i[1].trim()}</span></div>` : e;
1777
+ },
1778
+ priority: 10
1779
+ })),
1780
+ styles: `
1781
+ .smdx-tip { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: 6px; margin: 8px 0; font-size: 0.95em; border-left: 4px solid; }
1782
+ .smdx-tip-icon { flex-shrink: 0; display: flex; align-items: center; margin-top: 1px; }
1783
+ .smdx-tip-icon svg { display: block; }
1784
+ .smdx-tip-text { flex: 1; line-height: 1.5; }
1785
+ .smdx-tip-good { border-left-color: #22c55e; background: #f0fdf4; }
1786
+ .smdx-tip-bad { border-left-color: #ef4444; background: #fef2f2; }
1787
+ .smdx-tip-info { border-left-color: #3b82f6; background: #eff6ff; }
1788
+ .smdx-dark .smdx-tip-good { background: #052e16; }
1789
+ .smdx-dark .smdx-tip-bad { background: #450a0a; }
1790
+ .smdx-dark .smdx-tip-info { background: #172554; }
1791
+ `
1792
+ };
1793
+ }
1794
+ function fe() {
1795
+ return {
1796
+ name: "container",
1797
+ toolbarItems: [{
1798
+ id: "container",
1799
+ label: "Container",
1800
+ icon: p.container,
1801
+ tooltip: "Insert Container",
1802
+ action: ({ editor: r }) => {
1803
+ r.insertBlock(
1804
+ `<Container>
1805
+ Content inside a styled container.
1806
+ </Container>`
1807
+ );
1808
+ }
1809
+ }],
1810
+ renderers: [{
1811
+ name: "container",
1812
+ pattern: /<Container(?:\s+title="([^"]*)")?>([\s\S]*?)<\/Container>/g,
1813
+ render: (r) => {
1814
+ const e = r.match(/<Container(?:\s+title="([^"]*)")?>([\s\S]*?)<\/Container>/);
1815
+ return e ? `<div class="smdx-container">${e[1] ? `<div class="smdx-container-title">${e[1]}</div>` : ""}<div class="smdx-container-content">${B(e[2])}</div></div>` : r;
1816
+ }
1817
+ }],
1818
+ styles: `
1819
+ .smdx-container { border: 1px solid var(--smdx-border, #e2e8f0); border-radius: 8px; padding: 16px; margin: 12px 0; background: var(--smdx-bg-muted, #f8fafc); }
1820
+ .smdx-container-title { font-weight: 600; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--smdx-border, #e2e8f0); }
1821
+ `
1822
+ };
1823
+ }
1824
+ function ve() {
1825
+ return {
1826
+ name: "copyText",
1827
+ toolbarItems: [{
1828
+ id: "copyText",
1829
+ label: "Copy Text",
1830
+ icon: p.copyText,
1831
+ tooltip: "Copyable Text Block",
1832
+ action: ({ editor: r }) => {
1833
+ r.insertBlock("<CopyText>Text that users can click to copy</CopyText>");
1834
+ }
1835
+ }],
1836
+ renderers: [{
1837
+ name: "copyText",
1838
+ pattern: /<CopyText>([\s\S]*?)<\/CopyText>/g,
1839
+ render: (r) => {
1840
+ const e = r.match(/<CopyText>([\s\S]*?)<\/CopyText>/);
1841
+ if (!e) return r;
1842
+ const t = e[1].trim();
1843
+ return `<div class="smdx-copy-text" onclick="navigator.clipboard.writeText(this.dataset.text);this.classList.add('smdx-copied');setTimeout(()=>this.classList.remove('smdx-copied'),2000)" data-text="${t.replace(/"/g, "&quot;")}"><code class="smdx-copy-text-content">${t}</code><button class="smdx-copy-text-btn" type="button"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"/></svg></button></div>`;
1844
+ }
1845
+ }],
1846
+ styles: `
1847
+ .smdx-copy-text { display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--smdx-bg-muted, #f1f5f9); border: 1px solid var(--smdx-border, #e2e8f0); border-radius: 8px; cursor: pointer; transition: all 0.15s; font-size: 0.9em; margin: 6px 0; }
1848
+ .smdx-copy-text:hover { border-color: var(--smdx-primary, #6366f1); }
1849
+ .smdx-copy-text.smdx-copied { border-color: #22c55e; background: #f0fdf4; }
1850
+ .smdx-copy-text-content { font-family: var(--smdx-font-mono, monospace); color: var(--smdx-text, #1e293b); flex: 1; }
1851
+ .smdx-copy-text-btn { display: flex; align-items: center; justify-content: center; border: none; background: none; padding: 2px; cursor: pointer; color: var(--smdx-text-muted, #94a3b8); flex-shrink: 0; transition: color 0.15s; }
1852
+ .smdx-copy-text:hover .smdx-copy-text-btn { color: var(--smdx-text, #1e293b); }
1853
+ .smdx-copy-text.smdx-copied .smdx-copy-text-btn { color: #22c55e; }
1854
+ .smdx-dark .smdx-copy-text.smdx-copied { background: #052e16; border-color: #166534; }
1855
+ `
1856
+ };
1857
+ }
1858
+ function ke() {
1859
+ return {
1860
+ name: "tooltip",
1861
+ toolbarItems: [{
1862
+ id: "tooltip",
1863
+ label: "Tooltip",
1864
+ icon: p.tooltip,
1865
+ tooltip: "Insert Tooltip",
1866
+ action: ({ editor: r }) => {
1867
+ const t = r.getSelection().text || "hover text";
1868
+ r.replaceSelection(`<Tooltip tip="Tooltip content">${t}</Tooltip>`);
1869
+ }
1870
+ }],
1871
+ renderers: [{
1872
+ name: "tooltip",
1873
+ pattern: /<Tooltip\s+tip="([^"]*)">([\s\S]*?)<\/Tooltip>/g,
1874
+ render: (r) => {
1875
+ const e = r.match(/<Tooltip\s+tip="([^"]*)">([\s\S]*?)<\/Tooltip>/);
1876
+ return e ? `<span class="smdx-tooltip-wrapper"><span class="smdx-tooltip-trigger">${e[2]}<span class="smdx-tooltip-popup">${e[1]}</span></span></span>` : r;
1877
+ }
1878
+ }],
1879
+ styles: `
1880
+ .smdx-tooltip-wrapper { position: relative; display: inline; }
1881
+ .smdx-tooltip-trigger { position: relative; border-bottom: 1px dashed var(--smdx-primary, #6366f1); cursor: help; text-decoration: none; }
1882
+ .smdx-tooltip-popup { visibility: hidden; opacity: 0; position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); padding: 6px 12px; background: #1e293b; color: #fff; border-radius: 6px; font-size: 0.8em; white-space: nowrap; transition: opacity 0.15s, visibility 0.15s; z-index: 1000; pointer-events: none; }
1883
+ .smdx-tooltip-popup::after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -5px; border: 5px solid transparent; border-top-color: #1e293b; }
1884
+ .smdx-tooltip-trigger:hover .smdx-tooltip-popup { visibility: visible; opacity: 1; }
1885
+ .smdx-dark .smdx-tooltip-popup { background: #e2e8f0; color: #1e293b; }
1886
+ .smdx-dark .smdx-tooltip-popup::after { border-top-color: #e2e8f0; }
1887
+ `
1888
+ };
1889
+ }
1890
+ function ye() {
1891
+ return {
1892
+ name: "embedVideo",
1893
+ toolbarItems: [{
1894
+ id: "embedVideo",
1895
+ label: "Embed Video",
1896
+ icon: p.embedVideo,
1897
+ tooltip: "Embed Video",
1898
+ children: [
1899
+ {
1900
+ id: "embed-youtube",
1901
+ label: "YouTube",
1902
+ tooltip: "Embed YouTube video",
1903
+ action: ({ editor: r }) => {
1904
+ r.insertBlock('<EmbedVideo type="youtube" src="https://www.youtube.com/watch?v=VIDEO_ID" />');
1905
+ }
1906
+ },
1907
+ {
1908
+ id: "embed-video-file",
1909
+ label: "Video File",
1910
+ tooltip: "Embed video file",
1911
+ action: ({ editor: r }) => {
1912
+ r.insertBlock('<EmbedVideo type="file" src="video.mp4" />');
1913
+ }
1914
+ }
1915
+ ],
1916
+ action: ({ editor: r }) => {
1917
+ r.insertBlock('<EmbedVideo type="youtube" src="https://www.youtube.com/watch?v=VIDEO_ID" />');
1918
+ }
1919
+ }],
1920
+ renderers: [{
1921
+ name: "embedVideo",
1922
+ pattern: /<EmbedVideo\s+type="([^"]*)"(?:\s+src="([^"]*)")?\s*\/>/g,
1923
+ render: (r) => {
1924
+ const e = r.match(/<EmbedVideo\s+type="([^"]*)"(?:\s+src="([^"]*)")?\s*\/>/);
1925
+ if (!e) return r;
1926
+ const t = e[1], o = e[2] || "";
1927
+ if (t === "youtube") {
1928
+ const i = o.match(/(?:v=|\/embed\/|youtu\.be\/)([\w-]+)/), s = i ? i[1] : o;
1929
+ return `<div class="smdx-embed-video">
1930
+ <iframe src="https://www.youtube.com/embed/${encodeURIComponent(s)}" frameborder="0" allowfullscreen allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"></iframe>
1931
+ </div>`;
1932
+ }
1933
+ return `<div class="smdx-embed-video">
1934
+ <video controls src="${o}" class="smdx-video-player">
1935
+ Your browser does not support the video tag.
1936
+ </video>
1937
+ </div>`;
1938
+ }
1939
+ }],
1940
+ styles: `
1941
+ .smdx-embed-video { position: relative; width: 100%; padding-top: 56.25%; margin: 12px 0; border-radius: 8px; overflow: hidden; background: #000; }
1942
+ .smdx-embed-video iframe, .smdx-embed-video video { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
1943
+ `
1944
+ };
1945
+ }
1946
+ function we() {
1947
+ return {
1948
+ name: "embedOthers",
1949
+ toolbarItems: [{
1950
+ id: "embedOthers",
1951
+ label: "Embed",
1952
+ icon: p.embedOthers,
1953
+ tooltip: "Embed External Content",
1954
+ children: [
1955
+ {
1956
+ id: "embed-github",
1957
+ label: "GitHub Gist",
1958
+ tooltip: "Embed GitHub Gist",
1959
+ action: ({ editor: r }) => {
1960
+ r.insertBlock('<Embed type="github" src="https://gist.github.com/USER/GIST_ID" />');
1961
+ }
1962
+ },
1963
+ {
1964
+ id: "embed-twitter",
1965
+ label: "Twitter/X Post",
1966
+ tooltip: "Embed Tweet",
1967
+ action: ({ editor: r }) => {
1968
+ r.insertBlock('<Embed type="twitter" src="https://twitter.com/user/status/TWEET_ID" />');
1969
+ }
1970
+ },
1971
+ {
1972
+ id: "embed-codepen",
1973
+ label: "CodePen",
1974
+ tooltip: "Embed CodePen",
1975
+ action: ({ editor: r }) => {
1976
+ r.insertBlock('<Embed type="codepen" src="https://codepen.io/user/pen/PEN_ID" />');
1977
+ }
1978
+ },
1979
+ {
1980
+ id: "embed-codesandbox",
1981
+ label: "CodeSandbox",
1982
+ tooltip: "Embed CodeSandbox",
1983
+ action: ({ editor: r }) => {
1984
+ r.insertBlock('<Embed type="codesandbox" src="https://codesandbox.io/s/SANDBOX_ID" />');
1985
+ }
1986
+ }
1987
+ ],
1988
+ action: ({ editor: r }) => {
1989
+ r.insertBlock('<Embed type="github" src="https://gist.github.com/USER/GIST_ID" />');
1990
+ }
1991
+ }],
1992
+ renderers: [{
1993
+ name: "embedOthers",
1994
+ pattern: /<Embed\s+[^>]*?\/>/g,
1995
+ render: (r) => {
1996
+ const e = r.match(/type="([^"]*)"/), t = r.match(/src="([^"]*)"/), o = r.match(/label="([^"]*)"/);
1997
+ if (!e) return r;
1998
+ const i = e[1], s = t ? t[1] : "", n = o ? o[1] : "";
1999
+ switch (i) {
2000
+ case "github":
2001
+ return `<div class="smdx-embed smdx-embed-card"><div class="smdx-embed-card-icon"><svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"/></svg></div><div class="smdx-embed-card-body"><div class="smdx-embed-card-title">${n || "GitHub Gist"}</div><div class="smdx-embed-card-url">${s}</div></div><a href="${s}" target="_blank" rel="noopener noreferrer" class="smdx-embed-card-link">Open <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg></a></div>`;
2002
+ case "twitter":
2003
+ return `<div class="smdx-embed smdx-embed-card"><div class="smdx-embed-card-icon smdx-embed-twitter-icon"><svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></svg></div><div class="smdx-embed-card-body"><div class="smdx-embed-card-title">${n || "Post on X (Twitter)"}</div><div class="smdx-embed-card-url">${s}</div></div><a href="${s}" target="_blank" rel="noopener noreferrer" class="smdx-embed-card-link">Open <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg></a></div>`;
2004
+ case "codepen": {
2005
+ const a = s.match(/codepen\.io\/([^/]+)\/pen\/([^/?]+)/);
2006
+ return a ? `<div class="smdx-embed smdx-embed-codepen"><iframe height="400" style="width:100%" scrolling="no" src="https://codepen.io/${encodeURIComponent(a[1])}/embed/${encodeURIComponent(a[2])}?default-tab=result" frameborder="no" loading="lazy" allowtransparency="true" allowfullscreen="true"></iframe></div>` : `<div class="smdx-embed smdx-embed-card"><div class="smdx-embed-card-icon"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="12 2 22 8.5 22 15.5 12 22 2 15.5 2 8.5 12 2"/><line x1="12" y1="22" x2="12" y2="15.5"/><polyline points="22 8.5 12 15.5 2 8.5"/></svg></div><div class="smdx-embed-card-body"><div class="smdx-embed-card-title">${n || "CodePen"}</div><div class="smdx-embed-card-url">${s}</div></div><a href="${s}" target="_blank" rel="noopener noreferrer" class="smdx-embed-card-link">Open <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg></a></div>`;
2007
+ }
2008
+ case "codesandbox": {
2009
+ const a = s.split("/").pop() || "";
2010
+ return `<div class="smdx-embed smdx-embed-codesandbox"><iframe src="https://codesandbox.io/embed/${encodeURIComponent(a)}" style="width:100%;height:500px;border:0;border-radius:4px;overflow:hidden" allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking" sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"></iframe></div>`;
2011
+ }
2012
+ default:
2013
+ return `<div class="smdx-embed smdx-embed-card"><div class="smdx-embed-card-icon"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M10 13a5 5 0 007.54.54l3-3a5 5 0 00-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 00-7.54-.54l-3 3a5 5 0 007.07 7.07l1.71-1.71"/></svg></div><div class="smdx-embed-card-body"><div class="smdx-embed-card-title">${n || "Embedded Content"}</div><div class="smdx-embed-card-url">${s}</div></div><a href="${s}" target="_blank" rel="noopener noreferrer" class="smdx-embed-card-link">Open <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg></a></div>`;
2014
+ }
2015
+ }
2016
+ }],
2017
+ styles: `
2018
+ .smdx-embed { margin: 12px 0; border-radius: 8px; overflow: hidden; }
2019
+ .smdx-embed iframe { border: 1px solid var(--smdx-border, #e2e8f0); border-radius: 8px; }
2020
+ .smdx-embed-card { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border: 1px solid var(--smdx-border, #e2e8f0); border-radius: 8px; background: var(--smdx-bg-muted, #f8fafc); transition: border-color 0.15s; }
2021
+ .smdx-embed-card:hover { border-color: var(--smdx-primary, #6366f1); }
2022
+ .smdx-embed-card-icon { width: 40px; height: 40px; border-radius: 8px; background: var(--smdx-bg, #fff); border: 1px solid var(--smdx-border, #e2e8f0); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--smdx-text-muted, #64748b); }
2023
+ .smdx-embed-twitter-icon { color: #000; }
2024
+ .smdx-dark .smdx-embed-twitter-icon { color: #fff; }
2025
+ .smdx-embed-card-body { flex: 1; min-width: 0; }
2026
+ .smdx-embed-card-title { font-weight: 600; font-size: 0.9em; color: var(--smdx-text, #1e293b); }
2027
+ .smdx-embed-card-url { font-size: 0.8em; color: var(--smdx-text-muted, #64748b); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
2028
+ .smdx-embed-card-link { display: flex; align-items: center; gap: 4px; font-size: 0.8em; font-weight: 500; color: var(--smdx-primary, #6366f1); text-decoration: none; white-space: nowrap; flex-shrink: 0; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--smdx-border, #e2e8f0); background: var(--smdx-bg, #fff); transition: background 0.15s; }
2029
+ .smdx-embed-card-link:hover { background: var(--smdx-bg-muted, #f8fafc); text-decoration: none; }
2030
+ `
2031
+ };
2032
+ }
2033
+ const L = [
2034
+ { id: "flowchart", label: "Flowchart", template: `graph TD
2035
+ Start --> Stop` },
2036
+ { id: "sequence", label: "Sequence Diagram", template: `sequenceDiagram
2037
+ Alice->>John: Hello John, how are you?
2038
+ John-->>Alice: Great!
2039
+ Alice-)John: See you later!` },
2040
+ { id: "class", label: "Class Diagram", template: `classDiagram
2041
+ Animal <|-- Duck
2042
+ Animal <|-- Fish
2043
+ Animal <|-- Zebra
2044
+ Animal : +int age
2045
+ Animal : +String gender
2046
+ Animal: +isMammal()
2047
+ Animal: +mate()
2048
+ class Duck{
2049
+ +String beakColor
2050
+ +swim()
2051
+ +quack()
2052
+ }
2053
+ class Fish{
2054
+ -int sizeInFeet
2055
+ -canEat()
2056
+ }
2057
+ class Zebra{
2058
+ +bool is_wild
2059
+ +run()
2060
+ }` },
2061
+ { id: "state", label: "State Diagram", template: `stateDiagram-v2
2062
+ [*] --> Still
2063
+ Still --> [*]
2064
+
2065
+ Still --> Moving
2066
+ Moving --> Still
2067
+ Moving --> Crash
2068
+ Crash --> [*]` },
2069
+ { id: "er", label: "ER Diagram", template: `erDiagram
2070
+ CUSTOMER ||--o{ ORDER : places
2071
+ ORDER ||--|{ LINE-ITEM : contains
2072
+ CUSTOMER }|..|{ DELIVERY-ADDRESS : uses` },
2073
+ { id: "journey", label: "User Journey", template: `journey
2074
+ title My working day
2075
+ section Go to work
2076
+ Make tea: 5: Me
2077
+ Go upstairs: 3: Me
2078
+ Do work: 1: Me, Cat
2079
+ section Go home
2080
+ Go downstairs: 5: Me
2081
+ Sit down: 5: Me` },
2082
+ { id: "gantt", label: "Gantt Diagram", template: `gantt
2083
+ title A Gantt Diagram
2084
+ dateFormat YYYY-MM-DD
2085
+ section Section
2086
+ A task :a1, 2014-01-01, 30d
2087
+ Another task :after a1 , 20d
2088
+ section Another
2089
+ Task in sec :2014-01-12 , 12d
2090
+ another task : 24d` }
2091
+ ];
2092
+ function Ce() {
2093
+ return {
2094
+ name: "mermaid",
2095
+ toolbarItems: [{
2096
+ id: "mermaid",
2097
+ label: "Mermaid",
2098
+ icon: p.mermaid,
2099
+ tooltip: "Insert Mermaid Diagram",
2100
+ children: L.map((r) => ({
2101
+ id: `mermaid-${r.id}`,
2102
+ label: r.label,
2103
+ tooltip: `Insert ${r.label}`,
2104
+ action: ({ editor: e }) => {
2105
+ e.insertBlock("```mermaid\n" + r.template + "\n```");
2106
+ }
2107
+ })),
2108
+ action: ({ editor: r }) => {
2109
+ r.insertBlock("```mermaid\n" + L[0].template + "\n```");
2110
+ }
2111
+ }],
2112
+ renderers: [{
2113
+ name: "mermaid",
2114
+ pattern: /```mermaid\n([\s\S]*?)```/g,
2115
+ render: (r) => {
2116
+ const e = r.match(/```mermaid\n([\s\S]*?)```/);
2117
+ if (!e) return r;
2118
+ const t = "mermaid-" + Math.random().toString(36).substring(2, 10), o = encodeURIComponent(e[1].trim());
2119
+ return `<div class="smdx-mermaid" data-mermaid-id="${t}" data-mermaid-code="${o}"><div class="smdx-mermaid-placeholder">Loading diagram…</div></div>`;
2120
+ },
2121
+ priority: 20
2122
+ }],
2123
+ async init(r) {
2124
+ const e = async () => {
2125
+ try {
2126
+ const t = window.mermaid;
2127
+ if (!t) return;
2128
+ const o = r.editor.getRoot().classList.contains("smdx-dark");
2129
+ t.initialize({ startOnLoad: !1, theme: o ? "dark" : "default" });
2130
+ const i = r.editor.getPreview();
2131
+ if (!i) return;
2132
+ const s = i.querySelectorAll(".smdx-mermaid[data-mermaid-code]");
2133
+ for (const n of Array.from(s)) {
2134
+ const a = decodeURIComponent(n.getAttribute("data-mermaid-code")), d = n.getAttribute("data-mermaid-id");
2135
+ try {
2136
+ const { svg: l } = await t.render(d, a);
2137
+ n.innerHTML = l, n.removeAttribute("data-mermaid-code");
2138
+ } catch {
2139
+ n.innerHTML = `<pre class="smdx-mermaid-error">${a.replace(/</g, "&lt;").replace(/>/g, "&gt;")}</pre>`, n.removeAttribute("data-mermaid-code");
2140
+ }
2141
+ }
2142
+ } catch {
2143
+ }
2144
+ };
2145
+ r.on("render", e);
2146
+ },
2147
+ styles: `
2148
+ .smdx-mermaid { margin: 12px 0; text-align: center; }
2149
+ .smdx-mermaid svg { max-width: 100%; height: auto; }
2150
+ .smdx-mermaid-placeholder { padding: 24px; color: var(--smdx-text-muted, #94a3b8); font-size: 0.9em; }
2151
+ .smdx-mermaid-error { background: var(--smdx-bg-muted, #f8fafc); padding: 16px; border-radius: 8px; border: 1px solid var(--smdx-border, #e2e8f0); text-align: left; font-size: 0.85em; overflow-x: auto; }
2152
+ .smdx-dark .smdx-mermaid text { fill: #e2e8f0 !important; }
2153
+ .smdx-dark .smdx-mermaid .edgeLabel { background-color: #2a2a3c !important; color: #e2e8f0 !important; }
2154
+ .smdx-dark .smdx-mermaid .edgeLabel p { color: #e2e8f0 !important; }
2155
+ .smdx-dark .smdx-mermaid .label { color: #e2e8f0 !important; }
2156
+ .smdx-dark .smdx-mermaid .nodeLabel { color: #e2e8f0 !important; }
2157
+ .smdx-dark .smdx-mermaid .node rect,
2158
+ .smdx-dark .smdx-mermaid .node circle,
2159
+ .smdx-dark .smdx-mermaid .node ellipse,
2160
+ .smdx-dark .smdx-mermaid .node polygon,
2161
+ .smdx-dark .smdx-mermaid .node .label-container { fill: #2a2a3c !important; stroke: #818cf8 !important; }
2162
+ .smdx-dark .smdx-mermaid .edgePath .path { stroke: #94a3b8 !important; }
2163
+ .smdx-dark .smdx-mermaid .arrowheadPath { fill: #94a3b8 !important; }
2164
+ .smdx-dark .smdx-mermaid marker path { fill: #94a3b8 !important; stroke: #94a3b8 !important; }
2165
+ .smdx-dark .smdx-mermaid .flowchart-link { stroke: #94a3b8 !important; }
2166
+ .smdx-dark .smdx-mermaid line { stroke: #94a3b8 !important; }
2167
+ .smdx-dark .smdx-mermaid .messageLine0,
2168
+ .smdx-dark .smdx-mermaid .messageLine1 { stroke: #94a3b8 !important; }
2169
+ .smdx-dark .smdx-mermaid .messageText { fill: #e2e8f0 !important; }
2170
+ .smdx-dark .smdx-mermaid .actor { fill: #2a2a3c !important; stroke: #818cf8 !important; }
2171
+ .smdx-dark .smdx-mermaid .actor-line { stroke: #4b5563 !important; }
2172
+ .smdx-dark .smdx-mermaid text.actor > tspan { fill: #e2e8f0 !important; }
2173
+ .smdx-dark .smdx-mermaid .loopText > tspan { fill: #e2e8f0 !important; }
2174
+ .smdx-dark .smdx-mermaid .labelBox { fill: #2a2a3c !important; stroke: #818cf8 !important; }
2175
+ .smdx-dark .smdx-mermaid .loopLine { stroke: #4b5563 !important; }
2176
+ .smdx-dark .smdx-mermaid .note { fill: #374151 !important; stroke: #4b5563 !important; }
2177
+ .smdx-dark .smdx-mermaid .noteText > tspan { fill: #e2e8f0 !important; }
2178
+ .smdx-dark .smdx-mermaid .activation0,
2179
+ .smdx-dark .smdx-mermaid .activation1,
2180
+ .smdx-dark .smdx-mermaid .activation2 { fill: #374151 !important; stroke: #818cf8 !important; }
2181
+ .smdx-dark .smdx-mermaid .statediagram-state rect.divider { fill: #374151 !important; stroke: #4b5563 !important; }
2182
+ .smdx-dark .smdx-mermaid .relationshipLine { stroke: #94a3b8 !important; }
2183
+ .smdx-dark .smdx-mermaid .entityBox { fill: #2a2a3c !important; stroke: #818cf8 !important; }
2184
+ .smdx-dark .smdx-mermaid .attributeBoxEven { fill: #2a2a3c !important; }
2185
+ .smdx-dark .smdx-mermaid .attributeBoxOdd { fill: #374151 !important; }
2186
+ .smdx-dark .smdx-mermaid .er.relationshipLabel { fill: #e2e8f0 !important; }
2187
+ .smdx-dark .smdx-mermaid .journey-section-column { fill: #374151 !important; }
2188
+ .smdx-dark .smdx-mermaid .task { fill: #2a2a3c !important; stroke: #818cf8 !important; }
2189
+ .smdx-dark .smdx-mermaid .taskText { fill: #e2e8f0 !important; }
2190
+ .smdx-dark .smdx-mermaid .sectionTitle { fill: #e2e8f0 !important; }
2191
+ .smdx-dark .smdx-mermaid .grid .tick line { stroke: #374151 !important; }
2192
+ .smdx-dark .smdx-mermaid .grid .tick text { fill: #94a3b8 !important; }
2193
+ .smdx-dark .smdx-mermaid .titleText { fill: #e2e8f0 !important; }
2194
+ .smdx-dark .smdx-mermaid .pieCircle { stroke: #1e1e2e !important; }
2195
+ .smdx-dark .smdx-mermaid .section0,
2196
+ .smdx-dark .smdx-mermaid .section1 { fill: #374151 !important; }
2197
+ .smdx-dark .smdx-mermaid .today { stroke: #818cf8 !important; }
2198
+ `
2199
+ };
2200
+ }
2201
+ const C = [
2202
+ ["😀", "grinning smile happy"],
2203
+ ["😂", "joy laugh cry tears"],
2204
+ ["🥰", "love hearts smiling"],
2205
+ ["😎", "cool sunglasses"],
2206
+ ["🤔", "thinking hmm"],
2207
+ ["😢", "cry sad tear"],
2208
+ ["😡", "angry mad rage"],
2209
+ ["🥳", "party celebrate"],
2210
+ ["👍", "thumbs up good yes ok"],
2211
+ ["👎", "thumbs down bad no"],
2212
+ ["👋", "wave hello hi bye"],
2213
+ ["🙏", "pray please thanks"],
2214
+ ["💪", "strong muscle flex"],
2215
+ ["🎉", "party tada celebrate confetti"],
2216
+ ["🔥", "fire hot lit"],
2217
+ ["⭐", "star favorite"],
2218
+ ["❤️", "heart love red"],
2219
+ ["💔", "broken heart"],
2220
+ ["💯", "hundred perfect score"],
2221
+ ["✅", "check done yes complete"],
2222
+ ["❌", "cross no wrong cancel"],
2223
+ ["⚠️", "warning alert caution"],
2224
+ ["💡", "idea bulb light tip"],
2225
+ ["🚀", "rocket launch ship fast"],
2226
+ ["📝", "memo note write edit"],
2227
+ ["📌", "pin pushpin"],
2228
+ ["📎", "paperclip clip attach"],
2229
+ ["🔗", "link chain url"],
2230
+ ["📁", "folder file directory"],
2231
+ ["🗂️", "dividers tabs index"],
2232
+ ["🔍", "search magnifying find look"],
2233
+ ["🔧", "wrench tool fix settings"],
2234
+ ["🎯", "target goal dart bullseye"],
2235
+ ["🏆", "trophy winner cup award"],
2236
+ ["🎨", "art palette paint color"],
2237
+ ["🎵", "music note song"],
2238
+ ["📊", "chart bar graph stats"],
2239
+ ["📈", "chart up increase growth"],
2240
+ ["📉", "chart down decrease decline"],
2241
+ ["💰", "money bag dollar rich"],
2242
+ ["🕐", "clock time one"],
2243
+ ["📅", "calendar date schedule"],
2244
+ ["🌟", "glowing star sparkle shine"],
2245
+ ["🌍", "earth globe world"],
2246
+ ["☀️", "sun sunny bright"],
2247
+ ["🌙", "moon crescent night"],
2248
+ ["⚡", "lightning bolt zap electric"],
2249
+ ["💧", "water drop droplet"],
2250
+ ["🟢", "green circle dot"],
2251
+ ["🔴", "red circle dot"],
2252
+ ["🟡", "yellow circle dot"],
2253
+ ["🔵", "blue circle dot"],
2254
+ ["⚪", "white circle dot"],
2255
+ ["⚫", "black circle dot"],
2256
+ ["🟣", "purple circle dot"],
2257
+ ["🟠", "orange circle dot"]
2258
+ ];
2259
+ function $e() {
2260
+ return {
2261
+ name: "emoji",
2262
+ toolbarItems: [{
2263
+ id: "emoji",
2264
+ label: "Emoji",
2265
+ icon: p.emoji,
2266
+ tooltip: "Insert Emoji",
2267
+ action: (r) => {
2268
+ },
2269
+ render: (r, e) => {
2270
+ r.addEventListener("click", (t) => {
2271
+ t.preventDefault(), t.stopPropagation(), Se(r, e.editor);
2272
+ });
2273
+ }
2274
+ }]
2275
+ };
2276
+ }
2277
+ function Se(r, e) {
2278
+ var l;
2279
+ (l = document.querySelector(".smdx-emoji-picker")) == null || l.remove();
2280
+ const t = document.createElement("div");
2281
+ t.className = "smdx-emoji-picker";
2282
+ const o = r.closest(".smdx-editor");
2283
+ o != null && o.classList.contains("smdx-dark") && t.classList.add("smdx-dark");
2284
+ const i = document.createElement("input");
2285
+ i.type = "text", i.placeholder = "Search emoji...", i.className = "smdx-emoji-search", t.appendChild(i);
2286
+ const s = document.createElement("div");
2287
+ s.className = "smdx-emoji-grid";
2288
+ const n = (c) => {
2289
+ s.innerHTML = "";
2290
+ for (const [m] of c) {
2291
+ const h = document.createElement("button");
2292
+ h.type = "button", h.className = "smdx-emoji-btn", h.textContent = m, h.addEventListener("click", () => {
2293
+ e.insertText(m), t.remove();
2294
+ }), s.appendChild(h);
2295
+ }
2296
+ };
2297
+ n(C), i.addEventListener("input", () => {
2298
+ const c = i.value.toLowerCase().trim();
2299
+ if (!c) {
2300
+ n(C);
2301
+ return;
2302
+ }
2303
+ n(C.filter(([, m]) => m.includes(c)));
2304
+ }), t.appendChild(s);
2305
+ const a = r.getBoundingClientRect();
2306
+ t.style.position = "fixed", t.style.top = `${a.bottom + 4}px`, t.style.left = `${a.left}px`, document.body.appendChild(t);
2307
+ const d = (c) => {
2308
+ !t.contains(c.target) && c.target !== r && (t.remove(), document.removeEventListener("click", d));
2309
+ };
2310
+ setTimeout(() => document.addEventListener("click", d), 0), i.focus();
2311
+ }
2312
+ function Ee() {
2313
+ return {
2314
+ name: "formula",
2315
+ toolbarItems: [{
2316
+ id: "formula",
2317
+ label: "Formula",
2318
+ icon: p.formula,
2319
+ tooltip: "Insert Formula",
2320
+ children: [
2321
+ {
2322
+ id: "formula-inline",
2323
+ label: "Inline Formula",
2324
+ tooltip: "Inline math: $formula$",
2325
+ action: ({ editor: r }) => {
2326
+ r.wrapSelection("$", "$");
2327
+ }
2328
+ },
2329
+ {
2330
+ id: "formula-block",
2331
+ label: "Block Formula",
2332
+ tooltip: "Block math: $$formula$$",
2333
+ action: ({ editor: r, selection: e }) => {
2334
+ r.insertBlock(`$$
2335
+ ` + (e.text || "E = mc^2") + `
2336
+ $$`);
2337
+ }
2338
+ }
2339
+ ],
2340
+ action: ({ editor: r }) => {
2341
+ r.wrapSelection("$", "$");
2342
+ }
2343
+ }],
2344
+ renderers: [
2345
+ {
2346
+ name: "formula-block",
2347
+ pattern: /\$\$([\s\S]*?)\$\$/g,
2348
+ render: (r) => {
2349
+ const e = r.match(/\$\$([\s\S]*?)\$\$/);
2350
+ if (!e) return r;
2351
+ const t = e[1].trim();
2352
+ try {
2353
+ const o = window.katex;
2354
+ if (o)
2355
+ return `<div class="smdx-formula-block">${o.renderToString(t, { displayMode: !0, throwOnError: !1 })}</div>`;
2356
+ } catch {
2357
+ }
2358
+ return `<div class="smdx-formula-block smdx-formula-fallback"><code>${t}</code></div>`;
2359
+ },
2360
+ priority: 18
2361
+ },
2362
+ {
2363
+ name: "formula-inline",
2364
+ pattern: new RegExp("(?<!\\$)\\$(?!\\$)((?:[^$\\\\]|\\\\.)+)\\$", "g"),
2365
+ render: (r) => {
2366
+ const e = r.match(new RegExp("(?<!\\$)\\$(?!\\$)((?:[^$\\\\]|\\\\.)+)\\$"));
2367
+ if (!e) return r;
2368
+ const t = e[1].trim();
2369
+ try {
2370
+ const o = window.katex;
2371
+ if (o)
2372
+ return o.renderToString(t, { displayMode: !1, throwOnError: !1 });
2373
+ } catch {
2374
+ }
2375
+ return `<code class="smdx-formula-inline">${t}</code>`;
2376
+ },
2377
+ priority: 17
2378
+ }
2379
+ ],
2380
+ styles: `
2381
+ .smdx-formula-block { text-align: center; margin: 16px 0; font-size: 1.2em; overflow-x: auto; }
2382
+ .smdx-formula-fallback { background: var(--smdx-bg-muted, #f8fafc); padding: 12px; border-radius: 6px; border: 1px solid var(--smdx-border, #e2e8f0); }
2383
+ .smdx-formula-inline { font-size: 0.95em; }
2384
+
2385
+ .smdx-emoji-picker { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.12); z-index: 1000; width: 300px; padding: 8px; }
2386
+ .smdx-emoji-search { width: 100%; padding: 6px 10px; border: 1px solid #e2e8f0; border-radius: 4px; margin-bottom: 8px; font-size: 0.9em; outline: none; box-sizing: border-box; background: #fff; color: #1e293b; }
2387
+ .smdx-emoji-search:focus { border-color: #6366f1; }
2388
+ .smdx-emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 200px; overflow-y: auto; }
2389
+ .smdx-emoji-btn { border: none; background: none; font-size: 1.3em; padding: 4px; border-radius: 4px; cursor: pointer; line-height: 1; }
2390
+ .smdx-emoji-btn:hover { background: #f1f5f9; }
2391
+ .smdx-dark .smdx-emoji-picker, .smdx-emoji-picker.smdx-dark { background: #1e1e2e; border-color: #374151; box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
2392
+ .smdx-dark .smdx-emoji-search, .smdx-emoji-picker.smdx-dark .smdx-emoji-search { background: #2a2a3c; color: #e2e8f0; border-color: #374151; }
2393
+ .smdx-dark .smdx-emoji-search:focus, .smdx-emoji-picker.smdx-dark .smdx-emoji-search:focus { border-color: #818cf8; }
2394
+ .smdx-dark .smdx-emoji-btn:hover, .smdx-emoji-picker.smdx-dark .smdx-emoji-btn:hover { background: #2a2a3c; }
2395
+ `
2396
+ };
2397
+ }
2398
+ function g(r) {
2399
+ return r.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
2400
+ }
2401
+ function Te() {
2402
+ const r = /* @__PURE__ */ new Map();
2403
+ async function e(i) {
2404
+ if (r.has(i)) return r.get(i);
2405
+ try {
2406
+ let s = await fetch(i + "?raw");
2407
+ if (s.ok || (s = await fetch(i)), !s.ok) {
2408
+ const c = { content: null, error: `File not found: ${i} (${s.status})` };
2409
+ return r.set(i, c), c;
2410
+ }
2411
+ let n = await s.text();
2412
+ const a = n.trimStart();
2413
+ if (a.startsWith("<!DOCTYPE") || a.startsWith("<!doctype") || a.startsWith("<html")) {
2414
+ const c = { content: null, error: `File not found: ${i}` };
2415
+ return r.set(i, c), c;
2416
+ }
2417
+ const d = n.match(/^export default (?:\/\*(?:[^*]|\*(?!\/))*\*\/\s*)?["']([\s\S]*)["']\s*;?\s*$/);
2418
+ d && (n = d[1].replace(/\\n/g, `
2419
+ `).replace(/\\r/g, "\r").replace(/\\t/g, " ").replace(/\\"/g, '"').replace(/\\'/g, "'").replace(/\\\\/g, "\\").replace(/\\u([\da-fA-F]{4})/g, (c, m) => String.fromCharCode(parseInt(m, 16))));
2420
+ const l = { content: n };
2421
+ return r.set(i, l), l;
2422
+ } catch {
2423
+ const s = { content: null, error: `Failed to load: ${i}` };
2424
+ return r.set(i, s), s;
2425
+ }
2426
+ }
2427
+ function t(i, s) {
2428
+ const n = s.match(/^(\d+)-(\d+)$/);
2429
+ if (!n) return i;
2430
+ const a = Math.max(1, parseInt(n[1], 10)), d = parseInt(n[2], 10);
2431
+ return i.split(`
2432
+ `).slice(a - 1, d).join(`
2433
+ `);
2434
+ }
2435
+ async function o(i) {
2436
+ const s = i.querySelectorAll(".smdx-import[data-src]");
2437
+ for (const a of s) {
2438
+ if (a.dataset.loaded === "true") continue;
2439
+ a.dataset.loaded = "true";
2440
+ const d = a.dataset.src, { content: l, error: c } = await e(d);
2441
+ c ? (a.innerHTML = `<span class="smdx-import-icon">⚠️</span> <span class="smdx-import-error">${g(c)}</span>`, a.classList.add("smdx-import-failed")) : (a.innerHTML = `<div class="smdx-import-header"><span class="smdx-import-icon">📄</span> <code>${g(d)}</code></div><div class="smdx-import-content">${g(l)}</div>`, a.classList.add("smdx-import-loaded"));
2442
+ }
2443
+ const n = i.querySelectorAll(".smdx-snippet[data-src]");
2444
+ for (const a of n) {
2445
+ if (a.dataset.loaded === "true") continue;
2446
+ a.dataset.loaded = "true";
2447
+ const d = a.dataset.src, l = a.dataset.lines || "", { content: c, error: m } = await e(d);
2448
+ if (m)
2449
+ a.innerHTML = `<span class="smdx-snippet-icon">⚠️</span> <span class="smdx-snippet-error">${g(m)}</span>`, a.classList.add("smdx-snippet-failed");
2450
+ else {
2451
+ const h = l ? t(c, l) : c, x = d.split(".").pop() || "text", u = l ? ` <span class="smdx-snippet-lines">(lines ${g(l)})</span>` : "";
2452
+ a.innerHTML = `<div class="smdx-snippet-header"><span class="smdx-snippet-icon">📋</span> <code>${g(d)}</code>${u}</div><pre class="smdx-snippet-code"><code class="language-${g(x)}">${g(h)}</code></pre>`, a.classList.add("smdx-snippet-loaded");
2453
+ }
2454
+ }
2455
+ }
2456
+ return {
2457
+ name: "insert",
2458
+ init(i) {
2459
+ i.on("render", () => {
2460
+ const s = i.editor.getPreview();
2461
+ s && o(s);
2462
+ });
2463
+ },
2464
+ toolbarItems: [{
2465
+ id: "insert",
2466
+ label: "Insert",
2467
+ icon: p.insert,
2468
+ tooltip: "Insert Component",
2469
+ children: [
2470
+ {
2471
+ id: "insert-endpoint",
2472
+ label: "API Endpoint",
2473
+ tooltip: "Insert API endpoint block",
2474
+ action: ({ editor: i }) => {
2475
+ i.insertBlock(
2476
+ `<Endpoint method="GET" path="/api/v1/resource">
2477
+ Description of the endpoint.
2478
+
2479
+ **Parameters:**
2480
+ | Name | Type | Description |
2481
+ |------|------|-------------|
2482
+ | id | string | Resource ID |
2483
+
2484
+ **Response:**
2485
+ \`\`\`json
2486
+ {
2487
+ "status": "success",
2488
+ "data": {}
2489
+ }
2490
+ \`\`\`
2491
+ </Endpoint>`
2492
+ );
2493
+ }
2494
+ },
2495
+ {
2496
+ id: "insert-markdown",
2497
+ label: "Markdown Import",
2498
+ tooltip: "Import external markdown",
2499
+ action: ({ editor: i }) => {
2500
+ i.insertBlock('<Import src="./path/to/file.md" />');
2501
+ }
2502
+ },
2503
+ {
2504
+ id: "insert-snippet",
2505
+ label: "Code Snippet",
2506
+ tooltip: "Insert code snippet reference",
2507
+ action: ({ editor: i }) => {
2508
+ i.insertBlock('<Snippet src="./snippets/example.ts" lines="1-20" />');
2509
+ }
2510
+ }
2511
+ ],
2512
+ action: () => {
2513
+ }
2514
+ }],
2515
+ renderers: [
2516
+ {
2517
+ name: "endpoint",
2518
+ pattern: /<Endpoint\s+method="([^"]*)"(?:\s+path="([^"]*)")?\s*>([\s\S]*?)<\/Endpoint>/g,
2519
+ render: (i) => {
2520
+ const s = i.match(/<Endpoint\s+method="([^"]*)"(?:\s+path="([^"]*)")?\s*>([\s\S]*?)<\/Endpoint>/);
2521
+ if (!s) return i;
2522
+ const n = s[1].toUpperCase(), a = s[2] || "";
2523
+ return `<div class="smdx-endpoint">
2524
+ <div class="smdx-endpoint-header">
2525
+ <span class="smdx-endpoint-method" style="background:${{
2526
+ GET: "#22c55e",
2527
+ POST: "#3b82f6",
2528
+ PUT: "#f59e0b",
2529
+ PATCH: "#a855f7",
2530
+ DELETE: "#ef4444"
2531
+ }[n] || "#64748b"}">${n}</span>
2532
+ <code class="smdx-endpoint-path">${a}</code>
2533
+ </div>
2534
+ <div class="smdx-endpoint-body">${s[3].trim()}</div>
2535
+ </div>`;
2536
+ },
2537
+ priority: 10
2538
+ },
2539
+ {
2540
+ name: "import",
2541
+ pattern: /<Import\s+src="([^"]*)"(?:\s*\/)?>/g,
2542
+ render: (i) => {
2543
+ const s = i.match(/<Import\s+src="([^"]*)"(?:\s*\/)?>/);
2544
+ if (!s) return i;
2545
+ const n = s[1];
2546
+ return `<div class="smdx-import" data-src="${g(n)}"><span class="smdx-import-icon">📄</span> Loading <code>${g(n)}</code>…</div>`;
2547
+ }
2548
+ },
2549
+ {
2550
+ name: "snippet",
2551
+ pattern: /<Snippet\s+src="([^"]*)"(?:\s+lines="([^"]*)")?\s*\/>/g,
2552
+ render: (i) => {
2553
+ const s = i.match(/<Snippet\s+src="([^"]*)"(?:\s+lines="([^"]*)")?\s*\/>/);
2554
+ if (!s) return i;
2555
+ const n = s[1], a = s[2] || "";
2556
+ return `<div class="smdx-snippet" data-src="${g(n)}"${a ? ` data-lines="${g(a)}"` : ""}><span class="smdx-snippet-icon">📋</span> Loading <code>${g(n)}</code>…</div>`;
2557
+ }
2558
+ }
2559
+ ],
2560
+ styles: `
2561
+ .smdx-endpoint { border: 1px solid var(--smdx-border, #e2e8f0); border-radius: 8px; overflow: hidden; margin: 12px 0; }
2562
+ .smdx-endpoint-header { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--smdx-bg-muted, #f8fafc); border-bottom: 1px solid var(--smdx-border, #e2e8f0); }
2563
+ .smdx-endpoint-method { color: white; padding: 2px 8px; border-radius: 4px; font-weight: 700; font-size: 0.8em; letter-spacing: 0.05em; }
2564
+ .smdx-endpoint-path { font-family: monospace; font-size: 0.9em; }
2565
+ .smdx-endpoint-body { padding: 16px; }
2566
+ .smdx-import, .smdx-snippet { border: 1px solid var(--smdx-border, #e2e8f0); border-radius: 8px; margin: 8px 0; overflow: hidden; font-size: 0.9em; }
2567
+ .smdx-import:not(.smdx-import-loaded):not(.smdx-import-failed),
2568
+ .smdx-snippet:not(.smdx-snippet-loaded):not(.smdx-snippet-failed) { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--smdx-bg-muted, #f8fafc); }
2569
+ .smdx-import-header, .smdx-snippet-header { display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: var(--smdx-bg-muted, #f8fafc); border-bottom: 1px solid var(--smdx-border, #e2e8f0); font-size: 0.85em; }
2570
+ .smdx-import-content { padding: 16px; white-space: pre-wrap; font-size: 0.9em; line-height: 1.6; }
2571
+ .smdx-snippet-code { margin: 0; padding: 16px; background: var(--smdx-bg-code, #1e293b); color: var(--smdx-text-code, #e2e8f0); overflow-x: auto; font-size: 0.85em; line-height: 1.5; }
2572
+ .smdx-snippet-code code { font-family: var(--smdx-font-mono, 'SF Mono', 'Fira Code', monospace); }
2573
+ .smdx-snippet-lines { color: var(--smdx-text-muted, #94a3b8); font-size: 0.9em; }
2574
+ .smdx-import-failed, .smdx-snippet-failed { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: #fef2f2; border-color: #fecaca; }
2575
+ .smdx-import-error, .smdx-snippet-error { color: #b91c1c; }
2576
+ .smdx-dark .smdx-import-failed, .smdx-dark .smdx-snippet-failed { background: #450a0a; border-color: #991b1b; }
2577
+ .smdx-dark .smdx-import-error, .smdx-dark .smdx-snippet-error { color: #fca5a5; }
2578
+ `
2579
+ };
2580
+ }
2581
+ function Le() {
2582
+ return {
2583
+ name: "toc",
2584
+ toolbarItems: [{
2585
+ id: "toc",
2586
+ label: "ToC",
2587
+ icon: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="3" y1="6" x2="21" y2="6"/><line x1="6" y1="12" x2="21" y2="12"/><line x1="6" y1="18" x2="21" y2="18"/><circle cx="3" cy="12" r="1" fill="currentColor"/><circle cx="3" cy="18" r="1" fill="currentColor"/></svg>',
2588
+ tooltip: "Toggle Table of Contents",
2589
+ action: ({ editor: r }) => {
2590
+ const e = r.getRoot(), t = e.querySelector(".smdx-toc-sidebar");
2591
+ t ? (t.remove(), e.classList.remove("smdx-toc-open")) : (e.classList.add("smdx-toc-open"), I(r));
2592
+ }
2593
+ }],
2594
+ init(r) {
2595
+ r.on("render", () => {
2596
+ r.editor.getRoot().classList.contains("smdx-toc-open") && I(r.editor);
2597
+ });
2598
+ },
2599
+ styles: `
2600
+ .smdx-toc-sidebar { position: absolute; top: 0; right: 0; width: 220px; height: 100%; overflow-y: auto; background: var(--smdx-bg, #fff); border-left: 1px solid var(--smdx-border, #e2e8f0); padding: 16px 12px; z-index: 50; font-size: 0.85em; }
2601
+ .smdx-toc-open .smdx-preview-pane { position: relative; }
2602
+ .smdx-toc-title { font-weight: 700; font-size: 0.8em; text-transform: uppercase; letter-spacing: 0.05em; color: var(--smdx-text-muted, #64748b); margin-bottom: 12px; }
2603
+ .smdx-toc-list { list-style: none; padding: 0; margin: 0; }
2604
+ .smdx-toc-item { margin: 0; }
2605
+ .smdx-toc-link { display: block; padding: 4px 8px; color: var(--smdx-text-muted, #64748b); text-decoration: none; border-radius: 4px; transition: background 0.15s, color 0.15s; cursor: pointer; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
2606
+ .smdx-toc-link:hover { background: var(--smdx-bg-muted, #f1f5f9); color: var(--smdx-text, #1e293b); }
2607
+ .smdx-toc-link.smdx-toc-h2 { padding-left: 16px; }
2608
+ .smdx-toc-link.smdx-toc-h3 { padding-left: 28px; font-size: 0.95em; }
2609
+ .smdx-toc-link.smdx-toc-h4 { padding-left: 40px; font-size: 0.9em; }
2610
+ `
2611
+ };
2612
+ }
2613
+ function I(r) {
2614
+ var m;
2615
+ const e = r.getRoot(), t = e.querySelector(".smdx-preview-pane");
2616
+ if (!t) return;
2617
+ (m = e.querySelector(".smdx-toc-sidebar")) == null || m.remove();
2618
+ const o = r.getValue(), i = [], s = o.split(`
2619
+ `);
2620
+ for (const h of s) {
2621
+ const x = h.match(/^(#{1,4})\s+(.+)$/);
2622
+ if (x) {
2623
+ const u = x[2].replace(/[*_`~]/g, ""), b = u.toLowerCase().replace(/[^\w]+/g, "-").replace(/^-|-$/g, "");
2624
+ i.push({ level: x[1].length, text: u, slug: b });
2625
+ }
2626
+ }
2627
+ if (i.length === 0) return;
2628
+ const n = document.createElement("div");
2629
+ n.className = "smdx-toc-sidebar";
2630
+ const a = document.createElement("div");
2631
+ a.className = "smdx-toc-title", a.textContent = "On this page", n.appendChild(a);
2632
+ const d = document.createElement("ul");
2633
+ d.className = "smdx-toc-list";
2634
+ const l = r.getPreview(), c = e.querySelector(".smdx-textarea");
2635
+ i.forEach((h) => {
2636
+ const x = document.createElement("li");
2637
+ x.className = "smdx-toc-item";
2638
+ const u = document.createElement("a");
2639
+ u.className = `smdx-toc-link smdx-toc-h${h.level}`, u.textContent = h.text, u.title = h.text, u.addEventListener("click", (b) => {
2640
+ b.preventDefault();
2641
+ const v = l.querySelector(`#${CSS.escape(h.slug)}`);
2642
+ if (v && v.scrollIntoView({ behavior: "smooth", block: "start" }), c) {
2643
+ const f = c.value.split(`
2644
+ `);
2645
+ let k = 0;
2646
+ for (let y = 0; y < f.length; y++) {
2647
+ const $ = f[y].match(/^#{1,4}\s+(.+)$/);
2648
+ if ($ && $[1].replace(/[*_`~]/g, "") === h.text) {
2649
+ c.focus(), c.setSelectionRange(k, k);
2650
+ const A = parseFloat(getComputedStyle(c).lineHeight) || 22, P = y * A - c.clientHeight / 3;
2651
+ c.scrollTop = Math.max(0, P);
2652
+ break;
2653
+ }
2654
+ k += f[y].length + 1;
2655
+ }
2656
+ }
2657
+ }), x.appendChild(u), d.appendChild(x);
2658
+ }), n.appendChild(d), t.appendChild(n);
2659
+ }
2660
+ function Ie() {
2661
+ return {
2662
+ name: "breakLine",
2663
+ toolbarItems: [{
2664
+ id: "breakLine",
2665
+ label: "Line Break",
2666
+ icon: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 7H3"/><path d="M21 17H9"/><path d="M18 13l3 4-3 4"/></svg>',
2667
+ tooltip: "Insert Line Break",
2668
+ action: ({ editor: r }) => {
2669
+ r.insertText(`<br/>
2670
+ `);
2671
+ }
2672
+ }]
2673
+ };
2674
+ }
2675
+ function Me() {
2676
+ return {
2677
+ name: "horizontalRule",
2678
+ toolbarItems: [{
2679
+ id: "horizontalRule",
2680
+ label: "Horizontal Rule",
2681
+ icon: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="3" y1="12" x2="21" y2="12"/></svg>',
2682
+ tooltip: "Insert Horizontal Rule",
2683
+ action: ({ editor: r }) => {
2684
+ r.insertBlock("---");
2685
+ }
2686
+ }]
2687
+ };
2688
+ }
2689
+ function Be() {
2690
+ return [
2691
+ V(),
2692
+ W(),
2693
+ K(),
2694
+ U(),
2695
+ Y(),
2696
+ X(),
2697
+ J(),
2698
+ Z(),
2699
+ Q(),
2700
+ ee(),
2701
+ te(),
2702
+ re(),
2703
+ ie(),
2704
+ se(),
2705
+ ae(),
2706
+ de(),
2707
+ le(),
2708
+ ce(),
2709
+ me(),
2710
+ pe(),
2711
+ xe(),
2712
+ ue(),
2713
+ ge(),
2714
+ be(),
2715
+ fe(),
2716
+ ve(),
2717
+ ke(),
2718
+ ye(),
2719
+ we(),
2720
+ Ce(),
2721
+ $e(),
2722
+ Ee(),
2723
+ Te(),
2724
+ Le(),
2725
+ Ie(),
2726
+ Me()
2727
+ ];
2728
+ }
2729
+ function Ae() {
2730
+ return [
2731
+ [
2732
+ // Primary row
2733
+ "heading",
2734
+ "|",
2735
+ "bold",
2736
+ "italic",
2737
+ "strikethrough",
2738
+ "|",
2739
+ "quote",
2740
+ "link",
2741
+ "image",
2742
+ "|",
2743
+ "code",
2744
+ "codeBlock",
2745
+ "|",
2746
+ "unorderedList",
2747
+ "orderedList",
2748
+ "taskList",
2749
+ "|",
2750
+ "table",
2751
+ "|",
2752
+ "emoji",
2753
+ "formula",
2754
+ "|",
2755
+ "toc",
2756
+ "|",
2757
+ {
2758
+ type: "group",
2759
+ label: "Insert",
2760
+ icon: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="16"/><line x1="8" y1="12" x2="16" y2="12"/></svg>',
2761
+ display: "dropdown",
2762
+ items: [
2763
+ {
2764
+ type: "group",
2765
+ label: "Layout",
2766
+ items: ["highlight", "admonition", "tab", "imageBackground", "imageFrame", "accordion", "accordionGroup", "multiColumn", "card", "cardGroup", "steps", "tip", "container"]
2767
+ },
2768
+ {
2769
+ type: "group",
2770
+ label: "Others",
2771
+ items: ["copyText", "tooltip", "embedVideo", "embedOthers", "breakLine", "horizontalRule"]
2772
+ },
2773
+ {
2774
+ type: "group",
2775
+ label: "Diagrams",
2776
+ items: ["mermaid"]
2777
+ },
2778
+ {
2779
+ type: "group",
2780
+ label: "Apidog Widget",
2781
+ items: ["insert"]
2782
+ }
2783
+ ]
2784
+ }
2785
+ ]
2786
+ ];
2787
+ }
2788
+ function De(r) {
2789
+ return new q({
2790
+ plugins: Be(),
2791
+ toolbar: Ae(),
2792
+ placeholder: "Start writing markdown...",
2793
+ scrollSync: !0,
2794
+ mode: "split",
2795
+ ...r
2796
+ });
2797
+ }
2798
+ export {
2799
+ H as EventEmitter,
2800
+ F as History,
2801
+ D as PluginManager,
2802
+ _ as Renderer,
2803
+ q as SynclineMDXEditor,
2804
+ z as Toolbar,
2805
+ me as accordionGroupPlugin,
2806
+ ce as accordionPlugin,
2807
+ se as admonitionPlugin,
2808
+ Be as allPlugins,
2809
+ W as boldPlugin,
2810
+ Ie as breakLinePlugin,
2811
+ ue as cardGroupPlugin,
2812
+ xe as cardPlugin,
2813
+ Z as codePlugin,
2814
+ fe as containerPlugin,
2815
+ ve as copyTextPlugin,
2816
+ De as createEditor,
2817
+ Ae as defaultToolbar,
2818
+ we as embedOthersPlugin,
2819
+ ye as embedVideoPlugin,
2820
+ $e as emojiPlugin,
2821
+ Ee as formulaPlugin,
2822
+ V as headingPlugin,
2823
+ ie as highlightPlugin,
2824
+ Me as horizontalRulePlugin,
2825
+ p as icons,
2826
+ de as imageBackgroundPlugin,
2827
+ le as imageFramePlugin,
2828
+ J as imagePlugin,
2829
+ Te as insertPlugin,
2830
+ K as italicPlugin,
2831
+ X as linkPlugin,
2832
+ Ce as mermaidPlugin,
2833
+ pe as multiColumnPlugin,
2834
+ ee as orderedListPlugin,
2835
+ Y as quotePlugin,
2836
+ ge as stepPlugin,
2837
+ U as strikethroughPlugin,
2838
+ ae as tabPlugin,
2839
+ re as tablePlugin,
2840
+ te as taskListPlugin,
2841
+ be as tipPlugin,
2842
+ Le as tocPlugin,
2843
+ ke as tooltipPlugin,
2844
+ Q as unorderedListPlugin
2845
+ };