@noirmd/previewer 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,46 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
1
30
  // NReditor.tsx
2
- import React9, { useRef as useRef6, useState as useState5 } from "react";
3
- import CodeMirror from "@uiw/react-codemirror";
4
- import { EditorView, Decoration, ViewPlugin, lineNumbers, scrollPastEnd, keymap } from "@codemirror/view";
31
+ var NReditor_exports = {};
32
+ __export(NReditor_exports, {
33
+ default: () => NReditor_default
34
+ });
35
+ module.exports = __toCommonJS(NReditor_exports);
36
+ var import_react11 = __toESM(require("react"), 1);
37
+ var import_react_codemirror = __toESM(require("@uiw/react-codemirror"), 1);
38
+ var import_view = require("@codemirror/view");
5
39
 
6
40
  // custom-syntax.ts
7
- import { StreamLanguage } from "@codemirror/language";
8
- import { tags as t } from "@lezer/highlight";
9
- var customStreamParserV2 = StreamLanguage.define({
41
+ var import_language = require("@codemirror/language");
42
+ var import_highlight = require("@lezer/highlight");
43
+ var customStreamParserV2 = import_language.StreamLanguage.define({
10
44
  startState: () => ({
11
45
  inCodeBlock: false,
12
46
  inDirectiveHeader: false,
@@ -274,39 +308,39 @@ var customStreamParserV2 = StreamLanguage.define({
274
308
  return null;
275
309
  },
276
310
  tokenTable: {
277
- heading: t.heading,
278
- keyword: t.keyword,
279
- typeName: t.typeName,
280
- string: t.string,
281
- attributeName: t.attributeName,
282
- propertyName: t.propertyName,
283
- className: t.className,
284
- comment: t.comment,
285
- variableName: t.variableName,
286
- meta: t.meta,
287
- strong: t.strong,
288
- emphasis: t.emphasis,
289
- strongEmphasis: [t.strong, t.emphasis],
290
- strikethrough: t.strikethrough,
291
- underline: t.special(t.emphasis),
292
- highlight: t.special(t.comment),
293
- url: t.url,
294
- link: t.string,
295
- number: t.number,
296
- function: t.function(t.variableName)
311
+ heading: import_highlight.tags.heading,
312
+ keyword: import_highlight.tags.keyword,
313
+ typeName: import_highlight.tags.typeName,
314
+ string: import_highlight.tags.string,
315
+ attributeName: import_highlight.tags.attributeName,
316
+ propertyName: import_highlight.tags.propertyName,
317
+ className: import_highlight.tags.className,
318
+ comment: import_highlight.tags.comment,
319
+ variableName: import_highlight.tags.variableName,
320
+ meta: import_highlight.tags.meta,
321
+ strong: import_highlight.tags.strong,
322
+ emphasis: import_highlight.tags.emphasis,
323
+ strongEmphasis: [import_highlight.tags.strong, import_highlight.tags.emphasis],
324
+ strikethrough: import_highlight.tags.strikethrough,
325
+ underline: import_highlight.tags.special(import_highlight.tags.emphasis),
326
+ highlight: import_highlight.tags.special(import_highlight.tags.comment),
327
+ url: import_highlight.tags.url,
328
+ link: import_highlight.tags.string,
329
+ number: import_highlight.tags.number,
330
+ function: import_highlight.tags.function(import_highlight.tags.variableName)
297
331
  }
298
332
  });
299
333
 
300
334
  // NReditor.tsx
301
- import { RangeSetBuilder } from "@codemirror/state";
302
- import { syntaxHighlighting, HighlightStyle, foldService, foldGutter, foldAll, unfoldAll } from "@codemirror/language";
303
- import { tags as t2 } from "@lezer/highlight";
335
+ var import_state = require("@codemirror/state");
336
+ var import_language2 = require("@codemirror/language");
337
+ var import_highlight2 = require("@lezer/highlight");
304
338
 
305
339
  // useDebounce.ts
306
- import { useState, useEffect } from "react";
340
+ var import_react = require("react");
307
341
  function useDebounce(value, delay) {
308
- const [debouncedValue, setDebouncedValue] = useState(value);
309
- useEffect(() => {
342
+ const [debouncedValue, setDebouncedValue] = (0, import_react.useState)(value);
343
+ (0, import_react.useEffect)(() => {
310
344
  const timer = setTimeout(() => setDebouncedValue(value), delay);
311
345
  return () => clearTimeout(timer);
312
346
  }, [value, delay]);
@@ -314,7 +348,7 @@ function useDebounce(value, delay) {
314
348
  }
315
349
 
316
350
  // CustomMarkdownRenderer.tsx
317
- import React8, { useState as useState4, useEffect as useEffect5, useCallback as useCallback2, useMemo, useId as useId3, useRef as useRef5 } from "react";
351
+ var import_react10 = __toESM(require("react"), 1);
318
352
 
319
353
  // utils.ts
320
354
  function parseCssString(cssText) {
@@ -739,87 +773,87 @@ function splitSlots(rawContent) {
739
773
  }
740
774
 
741
775
  // ui-components.tsx
742
- import { useState as useState2, useRef } from "react";
776
+ var import_react2 = require("react");
743
777
 
744
778
  // highlightSetup.ts
745
- import hljs from "highlight.js/lib/core";
746
- import javascript from "highlight.js/lib/languages/javascript";
747
- import typescript from "highlight.js/lib/languages/typescript";
748
- import python from "highlight.js/lib/languages/python";
749
- import css from "highlight.js/lib/languages/css";
750
- import xml from "highlight.js/lib/languages/xml";
751
- import json from "highlight.js/lib/languages/json";
752
- import bash from "highlight.js/lib/languages/bash";
753
- import sql from "highlight.js/lib/languages/sql";
754
- import markdown from "highlight.js/lib/languages/markdown";
755
- import java from "highlight.js/lib/languages/java";
756
- import csharp from "highlight.js/lib/languages/csharp";
757
- import cpp from "highlight.js/lib/languages/cpp";
758
- import go from "highlight.js/lib/languages/go";
759
- import rust from "highlight.js/lib/languages/rust";
760
- import php from "highlight.js/lib/languages/php";
761
- import ruby from "highlight.js/lib/languages/ruby";
762
- import swift from "highlight.js/lib/languages/swift";
763
- import kotlin from "highlight.js/lib/languages/kotlin";
764
- import dart from "highlight.js/lib/languages/dart";
765
- import yaml from "highlight.js/lib/languages/yaml";
766
- import toml from "highlight.js/lib/languages/ini";
767
- import dockerfile from "highlight.js/lib/languages/dockerfile";
768
- import diff from "highlight.js/lib/languages/diff";
769
- import shell from "highlight.js/lib/languages/shell";
770
- hljs.registerLanguage("javascript", javascript);
771
- hljs.registerLanguage("js", javascript);
772
- hljs.registerLanguage("jsx", javascript);
773
- hljs.registerLanguage("typescript", typescript);
774
- hljs.registerLanguage("ts", typescript);
775
- hljs.registerLanguage("tsx", typescript);
776
- hljs.registerLanguage("python", python);
777
- hljs.registerLanguage("py", python);
778
- hljs.registerLanguage("css", css);
779
- hljs.registerLanguage("html", xml);
780
- hljs.registerLanguage("xml", xml);
781
- hljs.registerLanguage("svg", xml);
782
- hljs.registerLanguage("json", json);
783
- hljs.registerLanguage("bash", bash);
784
- hljs.registerLanguage("sh", bash);
785
- hljs.registerLanguage("zsh", bash);
786
- hljs.registerLanguage("sql", sql);
787
- hljs.registerLanguage("markdown", markdown);
788
- hljs.registerLanguage("md", markdown);
789
- hljs.registerLanguage("java", java);
790
- hljs.registerLanguage("csharp", csharp);
791
- hljs.registerLanguage("cs", csharp);
792
- hljs.registerLanguage("cpp", cpp);
793
- hljs.registerLanguage("c", cpp);
794
- hljs.registerLanguage("go", go);
795
- hljs.registerLanguage("rust", rust);
796
- hljs.registerLanguage("rs", rust);
797
- hljs.registerLanguage("php", php);
798
- hljs.registerLanguage("ruby", ruby);
799
- hljs.registerLanguage("rb", ruby);
800
- hljs.registerLanguage("swift", swift);
801
- hljs.registerLanguage("kotlin", kotlin);
802
- hljs.registerLanguage("kt", kotlin);
803
- hljs.registerLanguage("dart", dart);
804
- hljs.registerLanguage("yaml", yaml);
805
- hljs.registerLanguage("yml", yaml);
806
- hljs.registerLanguage("toml", toml);
807
- hljs.registerLanguage("ini", toml);
808
- hljs.registerLanguage("dockerfile", dockerfile);
809
- hljs.registerLanguage("docker", dockerfile);
810
- hljs.registerLanguage("diff", diff);
811
- hljs.registerLanguage("shell", shell);
812
- var highlightSetup_default = hljs;
779
+ var import_core = __toESM(require("highlight.js/lib/core"), 1);
780
+ var import_javascript = __toESM(require("highlight.js/lib/languages/javascript"), 1);
781
+ var import_typescript = __toESM(require("highlight.js/lib/languages/typescript"), 1);
782
+ var import_python = __toESM(require("highlight.js/lib/languages/python"), 1);
783
+ var import_css = __toESM(require("highlight.js/lib/languages/css"), 1);
784
+ var import_xml = __toESM(require("highlight.js/lib/languages/xml"), 1);
785
+ var import_json = __toESM(require("highlight.js/lib/languages/json"), 1);
786
+ var import_bash = __toESM(require("highlight.js/lib/languages/bash"), 1);
787
+ var import_sql = __toESM(require("highlight.js/lib/languages/sql"), 1);
788
+ var import_markdown = __toESM(require("highlight.js/lib/languages/markdown"), 1);
789
+ var import_java = __toESM(require("highlight.js/lib/languages/java"), 1);
790
+ var import_csharp = __toESM(require("highlight.js/lib/languages/csharp"), 1);
791
+ var import_cpp = __toESM(require("highlight.js/lib/languages/cpp"), 1);
792
+ var import_go = __toESM(require("highlight.js/lib/languages/go"), 1);
793
+ var import_rust = __toESM(require("highlight.js/lib/languages/rust"), 1);
794
+ var import_php = __toESM(require("highlight.js/lib/languages/php"), 1);
795
+ var import_ruby = __toESM(require("highlight.js/lib/languages/ruby"), 1);
796
+ var import_swift = __toESM(require("highlight.js/lib/languages/swift"), 1);
797
+ var import_kotlin = __toESM(require("highlight.js/lib/languages/kotlin"), 1);
798
+ var import_dart = __toESM(require("highlight.js/lib/languages/dart"), 1);
799
+ var import_yaml = __toESM(require("highlight.js/lib/languages/yaml"), 1);
800
+ var import_ini = __toESM(require("highlight.js/lib/languages/ini"), 1);
801
+ var import_dockerfile = __toESM(require("highlight.js/lib/languages/dockerfile"), 1);
802
+ var import_diff = __toESM(require("highlight.js/lib/languages/diff"), 1);
803
+ var import_shell = __toESM(require("highlight.js/lib/languages/shell"), 1);
804
+ import_core.default.registerLanguage("javascript", import_javascript.default);
805
+ import_core.default.registerLanguage("js", import_javascript.default);
806
+ import_core.default.registerLanguage("jsx", import_javascript.default);
807
+ import_core.default.registerLanguage("typescript", import_typescript.default);
808
+ import_core.default.registerLanguage("ts", import_typescript.default);
809
+ import_core.default.registerLanguage("tsx", import_typescript.default);
810
+ import_core.default.registerLanguage("python", import_python.default);
811
+ import_core.default.registerLanguage("py", import_python.default);
812
+ import_core.default.registerLanguage("css", import_css.default);
813
+ import_core.default.registerLanguage("html", import_xml.default);
814
+ import_core.default.registerLanguage("xml", import_xml.default);
815
+ import_core.default.registerLanguage("svg", import_xml.default);
816
+ import_core.default.registerLanguage("json", import_json.default);
817
+ import_core.default.registerLanguage("bash", import_bash.default);
818
+ import_core.default.registerLanguage("sh", import_bash.default);
819
+ import_core.default.registerLanguage("zsh", import_bash.default);
820
+ import_core.default.registerLanguage("sql", import_sql.default);
821
+ import_core.default.registerLanguage("markdown", import_markdown.default);
822
+ import_core.default.registerLanguage("md", import_markdown.default);
823
+ import_core.default.registerLanguage("java", import_java.default);
824
+ import_core.default.registerLanguage("csharp", import_csharp.default);
825
+ import_core.default.registerLanguage("cs", import_csharp.default);
826
+ import_core.default.registerLanguage("cpp", import_cpp.default);
827
+ import_core.default.registerLanguage("c", import_cpp.default);
828
+ import_core.default.registerLanguage("go", import_go.default);
829
+ import_core.default.registerLanguage("rust", import_rust.default);
830
+ import_core.default.registerLanguage("rs", import_rust.default);
831
+ import_core.default.registerLanguage("php", import_php.default);
832
+ import_core.default.registerLanguage("ruby", import_ruby.default);
833
+ import_core.default.registerLanguage("rb", import_ruby.default);
834
+ import_core.default.registerLanguage("swift", import_swift.default);
835
+ import_core.default.registerLanguage("kotlin", import_kotlin.default);
836
+ import_core.default.registerLanguage("kt", import_kotlin.default);
837
+ import_core.default.registerLanguage("dart", import_dart.default);
838
+ import_core.default.registerLanguage("yaml", import_yaml.default);
839
+ import_core.default.registerLanguage("yml", import_yaml.default);
840
+ import_core.default.registerLanguage("toml", import_ini.default);
841
+ import_core.default.registerLanguage("ini", import_ini.default);
842
+ import_core.default.registerLanguage("dockerfile", import_dockerfile.default);
843
+ import_core.default.registerLanguage("docker", import_dockerfile.default);
844
+ import_core.default.registerLanguage("diff", import_diff.default);
845
+ import_core.default.registerLanguage("shell", import_shell.default);
846
+ var highlightSetup_default = import_core.default;
813
847
 
814
848
  // ui-components.tsx
815
- import { Dialog } from "@base-ui/react/dialog";
816
- import { jsx, jsxs } from "react/jsx-runtime";
849
+ var import_dialog = require("@base-ui/react/dialog");
850
+ var import_jsx_runtime = require("react/jsx-runtime");
817
851
  var IconRenderer = ({ iconName, extraClasses = "" }) => {
818
852
  if (!iconName) return null;
819
853
  const baseClass = `material-symbols-rounded !text-[1em] leading-none align-top ${extraClasses}`;
820
854
  const isCodepoint = /^[eE][0-9a-fA-F]{3,4}$/.test(iconName);
821
855
  if (isCodepoint) {
822
- return /* @__PURE__ */ jsx(
856
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
823
857
  "span",
824
858
  {
825
859
  className: baseClass,
@@ -828,11 +862,11 @@ var IconRenderer = ({ iconName, extraClasses = "" }) => {
828
862
  }
829
863
  );
830
864
  }
831
- return /* @__PURE__ */ jsx("span", { className: baseClass, "aria-hidden": "true", children: iconName });
865
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: baseClass, "aria-hidden": "true", children: iconName });
832
866
  };
833
867
  var CodeBlock = ({ code, language, title }) => {
834
- const [copied, setCopied] = useState2(false);
835
- const timerRef = useRef(null);
868
+ const [copied, setCopied] = (0, import_react2.useState)(false);
869
+ const timerRef = (0, import_react2.useRef)(null);
836
870
  const lang = language?.split(/[\s{]/)[0]?.trim() || "";
837
871
  let html;
838
872
  try {
@@ -850,13 +884,13 @@ var CodeBlock = ({ code, language, title }) => {
850
884
  if (timerRef.current) clearTimeout(timerRef.current);
851
885
  timerRef.current = setTimeout(() => setCopied(false), 1800);
852
886
  };
853
- return /* @__PURE__ */ jsxs("div", { className: "not-prose my-4 rounded-2xl border border-border overflow-hidden bg-background-secondary-solid/5", children: [
854
- title && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-4 py-2 border-b border-border bg-background-secondary-solid/10 text-xs sm:text-sm font-mono text-text-secondary", children: [
855
- /* @__PURE__ */ jsx("span", { className: "material-symbols-rounded text-base", children: "description" }),
887
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "not-prose my-4 rounded-2xl border border-border overflow-hidden bg-background-secondary-solid/5", children: [
888
+ title && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2 px-4 py-2 border-b border-border bg-background-secondary-solid/10 text-xs sm:text-sm font-mono text-text-secondary", children: [
889
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "material-symbols-rounded text-base", children: "description" }),
856
890
  title
857
891
  ] }),
858
- /* @__PURE__ */ jsx("div", { className: "overflow-auto [&_pre]:m-0 [&_pre]:p-4 [&_pre]:text-xs sm:[&_pre]:text-sm", children: /* @__PURE__ */ jsx("pre", { className: "m-0", children: /* @__PURE__ */ jsx("code", { className: `language-${lang || "plaintext"}`, dangerouslySetInnerHTML: { __html: html } }) }) }),
859
- /* @__PURE__ */ jsx("button", { className: "absolute top-2 right-2 p-1.5 rounded-lg bg-background-secondary-solid/20 hover:bg-background-secondary-solid/40 transition-colors cursor-pointer border-none text-text-secondary hover:text-text-primary", onClick: handleCopy, title: "Copy code", children: /* @__PURE__ */ jsx("span", { className: "material-symbols-rounded", style: { fontSize: "1rem" }, children: copied ? "check" : "content_copy" }) })
892
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "overflow-auto [&_pre]:m-0 [&_pre]:p-4 [&_pre]:text-xs sm:[&_pre]:text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { className: "m-0", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { className: `language-${lang || "plaintext"}`, dangerouslySetInnerHTML: { __html: html } }) }) }),
893
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "absolute top-2 right-2 p-1.5 rounded-lg bg-background-secondary-solid/20 hover:bg-background-secondary-solid/40 transition-colors cursor-pointer border-none text-text-secondary hover:text-text-primary", onClick: handleCopy, title: "Copy code", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "material-symbols-rounded", style: { fontSize: "1rem" }, children: copied ? "check" : "content_copy" }) })
860
894
  ] });
861
895
  };
862
896
  var defaultIcons = {
@@ -875,17 +909,17 @@ var typeClasses = {
875
909
  };
876
910
  var Admonition = ({ type, title, icon, className = "", style, children }) => {
877
911
  const iconToRender = icon || defaultIcons[type] || "info";
878
- return /* @__PURE__ */ jsxs(
912
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
879
913
  "div",
880
914
  {
881
915
  className: `not-prose rounded-2xl mb-6 border shadow-xs p-4 ${typeClasses[type] || typeClasses.note} ${className}`,
882
916
  style,
883
917
  children: [
884
- title && /* @__PURE__ */ jsxs("h5", { className: "font-bold text-base mb-2 m-0 flex items-center gap-2", children: [
885
- /* @__PURE__ */ jsx(IconRenderer, { iconName: iconToRender, extraClasses: "shrink-0" }),
886
- /* @__PURE__ */ jsx("span", { children: title })
918
+ title && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h5", { className: "font-bold text-base mb-2 m-0 flex items-center gap-2", children: [
919
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconRenderer, { iconName: iconToRender, extraClasses: "shrink-0" }),
920
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: title })
887
921
  ] }),
888
- /* @__PURE__ */ jsx("div", { className: "text-sm leading-relaxed opacity-90", children })
922
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-sm leading-relaxed opacity-90", children })
889
923
  ]
890
924
  }
891
925
  );
@@ -898,16 +932,16 @@ var Details = ({
898
932
  style,
899
933
  children
900
934
  }) => {
901
- const [isOpen, setIsOpen] = useState2(defaultOpen);
935
+ const [isOpen, setIsOpen] = (0, import_react2.useState)(defaultOpen);
902
936
  const iconToRender = icon || "play_arrow";
903
- return /* @__PURE__ */ jsxs(
937
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
904
938
  "details",
905
939
  {
906
940
  className: `not-prose rounded-2xl border border-border mb-4 bg-background-primary/5 ${className}`,
907
941
  open: isOpen,
908
942
  style,
909
943
  children: [
910
- /* @__PURE__ */ jsxs(
944
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
911
945
  "summary",
912
946
  {
913
947
  className: "cursor-pointer p-4 font-bold flex items-center gap-2 list-none [&::-webkit-details-marker]:hidden hover:text-accent-primary transition-colors",
@@ -916,45 +950,45 @@ var Details = ({
916
950
  setIsOpen((prev) => !prev);
917
951
  },
918
952
  children: [
919
- /* @__PURE__ */ jsx(
953
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
920
954
  IconRenderer,
921
955
  {
922
956
  iconName: iconToRender,
923
957
  extraClasses: `transition-transform ${isOpen ? "rotate-90" : ""}`
924
958
  }
925
959
  ),
926
- /* @__PURE__ */ jsx("span", { children: title })
960
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: title })
927
961
  ]
928
962
  }
929
963
  ),
930
- isOpen && /* @__PURE__ */ jsx("div", { className: "px-4 pb-4 border-t border-border pt-3 text-sm leading-relaxed opacity-90 overflow-hidden min-w-0", children })
964
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "px-4 pb-4 border-t border-border pt-3 text-sm leading-relaxed opacity-90 overflow-hidden min-w-0", children })
931
965
  ]
932
966
  }
933
967
  );
934
968
  };
935
969
  var Modal = ({ title, isOpen, onClose, children }) => {
936
- return /* @__PURE__ */ jsx(Dialog.Root, { open: isOpen, onOpenChange: (open) => {
970
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog.Root, { open: isOpen, onOpenChange: (open) => {
937
971
  if (!open) onClose();
938
- }, children: /* @__PURE__ */ jsxs(Dialog.Portal, { children: [
939
- /* @__PURE__ */ jsx(Dialog.Backdrop, { className: "fixed inset-0 z-[9999] bg-black/60" }),
940
- /* @__PURE__ */ jsx(Dialog.Viewport, { className: "fixed inset-0 z-[9999] flex items-center justify-center p-4", children: /* @__PURE__ */ jsxs(Dialog.Popup, { className: "bg-background-primary border border-border shadow-2xl rounded-3xl w-full max-w-3xl max-h-[85vh] flex flex-col overflow-hidden", children: [
941
- /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center p-4 border-b border-border bg-background-secondary-solid/20", children: [
942
- /* @__PURE__ */ jsx(Dialog.Title, { className: "text-lg font-bold !m-0", children: title }),
943
- /* @__PURE__ */ jsx(Dialog.Close, { className: "w-8 h-8 rounded-full hover:bg-white/10 flex items-center justify-center transition-colors cursor-pointer border-none bg-transparent", children: /* @__PURE__ */ jsx("span", { className: "material-symbols-rounded text-base", children: "close" }) })
972
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dialog.Dialog.Portal, { children: [
973
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog.Backdrop, { className: "fixed inset-0 z-[9999] bg-black/60" }),
974
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog.Viewport, { className: "fixed inset-0 z-[9999] flex items-center justify-center p-4", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dialog.Dialog.Popup, { className: "bg-background-primary border border-border shadow-2xl rounded-3xl w-full max-w-3xl max-h-[85vh] flex flex-col overflow-hidden", children: [
975
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex justify-between items-center p-4 border-b border-border bg-background-secondary-solid/20", children: [
976
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog.Title, { className: "text-lg font-bold !m-0", children: title }),
977
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog.Close, { className: "w-8 h-8 rounded-full hover:bg-white/10 flex items-center justify-center transition-colors cursor-pointer border-none bg-transparent", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "material-symbols-rounded text-base", children: "close" }) })
944
978
  ] }),
945
- /* @__PURE__ */ jsx("div", { className: "p-6 overflow-auto min-h-0 text-text-primary [&_h1:first-child]:mt-0 [&_h2:first-child]:mt-0 [&_h3:first-child]:mt-0 [&_h4:first-child]:mt-0 [&_h5:first-child]:mt-0 [&_h6:first-child]:mt-0", children })
979
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "p-6 overflow-auto min-h-0 text-text-primary [&_h1:first-child]:mt-0 [&_h2:first-child]:mt-0 [&_h3:first-child]:mt-0 [&_h4:first-child]:mt-0 [&_h5:first-child]:mt-0 [&_h6:first-child]:mt-0", children })
946
980
  ] }) })
947
981
  ] }) });
948
982
  };
949
983
 
950
984
  // renderers.tsx
951
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
985
+ var import_jsx_runtime2 = require("react/jsx-runtime");
952
986
  function renderInline(text) {
953
987
  if (!text) return text;
954
988
  const parsePart = (part, key) => {
955
989
  let match2;
956
990
  if (match2 = part.match(/^\|\[([^\]]+)\]\|$/)) {
957
- return /* @__PURE__ */ jsx2(IconRenderer, { iconName: match2[1] }, key);
991
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(IconRenderer, { iconName: match2[1] }, key);
958
992
  }
959
993
  if (match2 = part.match(/^!~(.+?)~!$/)) {
960
994
  const content = match2[1];
@@ -973,7 +1007,7 @@ function renderInline(text) {
973
1007
  type = parts[textIndex] === "both" ? "underline line-through" : parts[textIndex++];
974
1008
  }
975
1009
  const innerText = parts.slice(textIndex).join(";");
976
- return /* @__PURE__ */ jsx2(
1010
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
977
1011
  "span",
978
1012
  {
979
1013
  style: {
@@ -986,31 +1020,31 @@ function renderInline(text) {
986
1020
  );
987
1021
  }
988
1022
  if (match2 = part.match(/%([^%\s]+?)%([\s\S]+?)%%/)) {
989
- return /* @__PURE__ */ jsx2("span", { style: { color: match2[1] }, children: renderInline(match2[2]) }, key);
1023
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { color: match2[1] }, children: renderInline(match2[2]) }, key);
990
1024
  }
991
1025
  if (match2 = part.match(/^!>([^<]+?)<!$/)) {
992
- return /* @__PURE__ */ jsx2("span", { className: "bg-text-primary text-bg-primary px-1 rounded hover:bg-transparent transition-colors cursor-pointer", children: renderInline(match2[1]) }, key);
1026
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "bg-text-primary text-bg-primary px-1 rounded hover:bg-transparent transition-colors cursor-pointer", children: renderInline(match2[1]) }, key);
993
1027
  }
994
1028
  if (match2 = part.match(/^==(.+?)==$/)) {
995
- return /* @__PURE__ */ jsx2("mark", { className: "bg-yellow-500/20 text-inherit px-0.5 rounded", children: renderInline(match2[1]) }, key);
1029
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("mark", { className: "bg-yellow-500/20 text-inherit px-0.5 rounded", children: renderInline(match2[1]) }, key);
996
1030
  }
997
1031
  if (match2 = part.match(/^\*\*\*(.+?)\*\*\*$/)) {
998
- return /* @__PURE__ */ jsx2("strong", { children: /* @__PURE__ */ jsx2("em", { children: renderInline(match2[1]) }) }, key);
1032
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("strong", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("em", { children: renderInline(match2[1]) }) }, key);
999
1033
  }
1000
1034
  if (match2 = part.match(/^\*\*(.+?)\*\*$/)) {
1001
- return /* @__PURE__ */ jsx2("strong", { children: renderInline(match2[1]) }, key);
1035
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("strong", { children: renderInline(match2[1]) }, key);
1002
1036
  }
1003
1037
  if (match2 = part.match(/^_(.+?)_$/)) {
1004
- return /* @__PURE__ */ jsx2("em", { children: renderInline(match2[1]) }, key);
1038
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("em", { children: renderInline(match2[1]) }, key);
1005
1039
  }
1006
1040
  if (match2 = part.match(/^~~(.+?)~~$/)) {
1007
- return /* @__PURE__ */ jsx2("del", { children: renderInline(match2[1]) }, key);
1041
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("del", { children: renderInline(match2[1]) }, key);
1008
1042
  }
1009
1043
  if (match2 = part.match(/^`([^`]+)`$/)) {
1010
- return /* @__PURE__ */ jsx2("code", { className: "text-[0.875em] font-mono bg-background-secondary/50 px-1.5 py-0.5 rounded text-text-primary", children: match2[1] }, key);
1044
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("code", { className: "text-[0.875em] font-mono bg-background-secondary/50 px-1.5 py-0.5 rounded text-text-primary", children: match2[1] }, key);
1011
1045
  }
1012
1046
  if (match2 = part.match(/^\[([^\]]+?)\]\(([^)]+?)\)$/)) {
1013
- return /* @__PURE__ */ jsx2(
1047
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1014
1048
  "a",
1015
1049
  {
1016
1050
  href: match2[2],
@@ -1023,7 +1057,7 @@ function renderInline(text) {
1023
1057
  );
1024
1058
  }
1025
1059
  if (part.startsWith("<") && part.endsWith(">")) {
1026
- return /* @__PURE__ */ jsx2("span", { dangerouslySetInnerHTML: { __html: part } }, key);
1060
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { dangerouslySetInnerHTML: { __html: part } }, key);
1027
1061
  }
1028
1062
  return part;
1029
1063
  };
@@ -1046,13 +1080,13 @@ function renderInline(text) {
1046
1080
  }
1047
1081
  function renderTable(content) {
1048
1082
  const rows = content.split("\n").filter((r) => r.trim());
1049
- if (rows.length < 2) return /* @__PURE__ */ jsx2("p", { children: content });
1083
+ if (rows.length < 2) return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: content });
1050
1084
  const parseRow = (row) => row.split("|").map((c) => c.trim()).filter(Boolean);
1051
1085
  const headerCells = parseRow(rows[0]);
1052
1086
  const bodyRows = rows.slice(2).map(parseRow);
1053
- return /* @__PURE__ */ jsx2("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs2("table", { className: "w-full text-sm sm:text-base border-collapse my-4", children: [
1054
- /* @__PURE__ */ jsx2("thead", { children: /* @__PURE__ */ jsx2("tr", { children: headerCells.map((cell, ci) => /* @__PURE__ */ jsx2("th", { className: "border border-border px-3 py-2 bg-background-secondary-solid/10 text-left font-bold", children: renderInline(cell) }, ci)) }) }),
1055
- /* @__PURE__ */ jsx2("tbody", { children: bodyRows.map((cells, ri) => /* @__PURE__ */ jsx2("tr", { children: cells.map((cell, ci) => /* @__PURE__ */ jsx2("td", { className: "border border-border px-3 py-2", children: renderInline(cell) }, ci)) }, ri)) })
1087
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("table", { className: "w-full text-sm sm:text-base border-collapse my-4", children: [
1088
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tr", { children: headerCells.map((cell, ci) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { className: "border border-border px-3 py-2 bg-background-secondary-solid/10 text-left font-bold", children: renderInline(cell) }, ci)) }) }),
1089
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tbody", { children: bodyRows.map((cells, ri) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tr", { children: cells.map((cell, ci) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { className: "border border-border px-3 py-2", children: renderInline(cell) }, ci)) }, ri)) })
1056
1090
  ] }) });
1057
1091
  }
1058
1092
  function renderList(content) {
@@ -1069,23 +1103,23 @@ function renderList(content) {
1069
1103
  });
1070
1104
  }
1071
1105
  }
1072
- if (items.length === 0) return /* @__PURE__ */ jsx2("p", { children: content });
1106
+ if (items.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: content });
1073
1107
  const isOrdered = /^\d+\.$/.test(items[0].marker);
1074
1108
  const Tag = isOrdered ? "ol" : "ul";
1075
- return /* @__PURE__ */ jsx2(Tag, { className: `${isOrdered ? "list-decimal" : "list-disc"} pl-6 my-3 space-y-1 text-sm sm:text-base`, children: items.map((item, index) => /* @__PURE__ */ jsx2("li", { className: "leading-relaxed", children: renderInline(item.text) }, index)) });
1109
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Tag, { className: `${isOrdered ? "list-decimal" : "list-disc"} pl-6 my-3 space-y-1 text-sm sm:text-base`, children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("li", { className: "leading-relaxed", children: renderInline(item.text) }, index)) });
1076
1110
  }
1077
1111
  function extractHeaders(elements) {
1078
1112
  return elements.filter((el) => el.type === "header");
1079
1113
  }
1080
1114
 
1081
1115
  // directives/AdmonitionDirective.tsx
1082
- import { jsx as jsx3 } from "react/jsx-runtime";
1116
+ var import_jsx_runtime3 = require("react/jsx-runtime");
1083
1117
  var AdmonitionDirective = ({
1084
1118
  directiveType,
1085
1119
  props,
1086
1120
  renderSlot
1087
1121
  }) => {
1088
- return /* @__PURE__ */ jsx3(
1122
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1089
1123
  Admonition,
1090
1124
  {
1091
1125
  type: directiveType,
@@ -1100,8 +1134,8 @@ var AdmonitionDirective = ({
1100
1134
  var AdmonitionDirective_default = AdmonitionDirective;
1101
1135
 
1102
1136
  // directives/CardDirective.tsx
1103
- import React2, { useId } from "react";
1104
- import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
1137
+ var import_react3 = __toESM(require("react"), 1);
1138
+ var import_jsx_runtime4 = require("react/jsx-runtime");
1105
1139
  var CardDirective = ({
1106
1140
  directiveType,
1107
1141
  props,
@@ -1110,7 +1144,7 @@ var CardDirective = ({
1110
1144
  context,
1111
1145
  options = {}
1112
1146
  }) => {
1113
- const stableId = useId();
1147
+ const stableId = (0, import_react3.useId)();
1114
1148
  const { title, image, icon, class: customClass, url, target } = props;
1115
1149
  const hasDescription = !!slots.description;
1116
1150
  const { isSingleCard } = options;
@@ -1121,8 +1155,8 @@ var CardDirective = ({
1121
1155
  const inlineStyles = props.style ? parseCssString(props.style) : {};
1122
1156
  const description = hasDescription ? renderSlot("description") : null;
1123
1157
  const content = renderSlot("content") || renderSlot("default");
1124
- return /* @__PURE__ */ jsxs3(React2.Fragment, { children: [
1125
- /* @__PURE__ */ jsxs3(
1158
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react3.default.Fragment, { children: [
1159
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1126
1160
  "div",
1127
1161
  {
1128
1162
  className: `flex flex-col h-full rounded-3xl transition-all relative overflow-hidden group border min-w-[18rem] w-[18rem] max-w-[20rem] ${isModal || isLink ? "cursor-pointer !border-accent-primary/10 hover:border-accent-primary/50" : "border-border"} ${wrapperClass}`,
@@ -1138,20 +1172,20 @@ var CardDirective = ({
1138
1172
  if (e.key === "Enter" || e.key === " ") context.setModals((prev) => ({ ...prev, [modalId]: true }));
1139
1173
  } : void 0,
1140
1174
  children: [
1141
- image && /* @__PURE__ */ jsxs3("div", { className: `w-full ${isSingleCard ? "h-[240px]" : "h-[160px]"} overflow-hidden relative transition-all duration-500`, children: [
1142
- /* @__PURE__ */ jsx4("img", { src: image, alt: title || "", className: "w-full h-full object-cover !m-0" }),
1143
- /* @__PURE__ */ jsx4("div", { className: "absolute inset-0 bg-gradient-to-t from-background-primary/40 to-transparent" })
1175
+ image && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: `w-full ${isSingleCard ? "h-[240px]" : "h-[160px]"} overflow-hidden relative transition-all duration-500`, children: [
1176
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("img", { src: image, alt: title || "", className: "w-full h-full object-cover !m-0" }),
1177
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "absolute inset-0 bg-gradient-to-t from-background-primary/40 to-transparent" })
1144
1178
  ] }),
1145
- /* @__PURE__ */ jsxs3("div", { className: `flex flex-col flex-1 bg-background-primary/80 rounded-t-xl p-6 relative ${image ? "-mt-10" : ""} border-t border-white/5 shadow-2xl`, children: [
1146
- /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-3 mb-3", children: [
1147
- icon && /* @__PURE__ */ jsx4("div", { className: "w-10 h-10 text-[1.6em] rounded-xl bg-accent-primary/20 flex items-center justify-center shrink-0 text-accent-primary", children: /* @__PURE__ */ jsx4(IconRenderer, { iconName: icon }) }),
1148
- /* @__PURE__ */ jsx4("h3", { className: "text-base font-black tracking-tight leading-tight !m-0", children: title })
1179
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: `flex flex-col flex-1 bg-background-primary/80 rounded-t-xl p-6 relative ${image ? "-mt-10" : ""} border-t border-white/5 shadow-2xl`, children: [
1180
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-center gap-3 mb-3", children: [
1181
+ icon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "w-10 h-10 text-[1.6em] rounded-xl bg-accent-primary/20 flex items-center justify-center shrink-0 text-accent-primary", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IconRenderer, { iconName: icon }) }),
1182
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { className: "text-base font-black tracking-tight leading-tight !m-0", children: title })
1149
1183
  ] }),
1150
- /* @__PURE__ */ jsxs3("div", { className: "flex-1 flex flex-col gap-2", children: [
1151
- description && /* @__PURE__ */ jsx4("div", { className: "text-sm opacity-80 leading-relaxed font-medium", children: description }),
1152
- directiveType === "card" && content && /* @__PURE__ */ jsx4("div", { className: "mt-2", children: content })
1184
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex-1 flex flex-col gap-2", children: [
1185
+ description && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "text-sm opacity-80 leading-relaxed font-medium", children: description }),
1186
+ directiveType === "card" && content && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mt-2", children: content })
1153
1187
  ] }),
1154
- (isModal || isLink) && /* @__PURE__ */ jsx4("div", { className: "mt-6 flex justify-end", children: isLink && url ? /* @__PURE__ */ jsxs3(
1188
+ (isModal || isLink) && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mt-6 flex justify-end", children: isLink && url ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1155
1189
  "a",
1156
1190
  {
1157
1191
  href: url,
@@ -1160,25 +1194,25 @@ var CardDirective = ({
1160
1194
  className: "bg-accent-primary/20 hover:bg-accent-primary/30 px-4 py-2 rounded-xl flex items-center gap-1.5 text-[10px] font-black uppercase tracking-widest opacity-50 group-hover:opacity-100 group-hover:text-accent-primary transition-all no-underline",
1161
1195
  onClick: (e) => e.stopPropagation(),
1162
1196
  children: [
1163
- /* @__PURE__ */ jsx4(IconRenderer, { iconName: "open_in_new" }),
1197
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IconRenderer, { iconName: "open_in_new" }),
1164
1198
  " Link"
1165
1199
  ]
1166
1200
  }
1167
- ) : isModal ? /* @__PURE__ */ jsxs3("div", { className: "bg-accent-primary/20 hover:bg-accent-primary/30 px-4 py-2 cursor-pointer rounded-xl flex items-center gap-1.5 text-[10px] font-black uppercase tracking-widest opacity-50 group-hover:opacity-100 group-hover:text-accent-primary transition-all", children: [
1168
- /* @__PURE__ */ jsx4(IconRenderer, { iconName: "arrow_forward" }),
1201
+ ) : isModal ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "bg-accent-primary/20 hover:bg-accent-primary/30 px-4 py-2 cursor-pointer rounded-xl flex items-center gap-1.5 text-[10px] font-black uppercase tracking-widest opacity-50 group-hover:opacity-100 group-hover:text-accent-primary transition-all", children: [
1202
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IconRenderer, { iconName: "arrow_forward" }),
1169
1203
  " Abrir"
1170
1204
  ] }) : null })
1171
1205
  ] })
1172
1206
  ]
1173
1207
  }
1174
1208
  ),
1175
- isModal && /* @__PURE__ */ jsx4(
1209
+ isModal && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1176
1210
  Modal,
1177
1211
  {
1178
1212
  title: title || "Detalles",
1179
1213
  isOpen: !!context.modals[modalId],
1180
1214
  onClose: () => context.setModals((prev) => ({ ...prev, [modalId]: false })),
1181
- children: /* @__PURE__ */ jsx4("div", { className: "prose prose-sm max-w-none", children: content })
1215
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "prose prose-sm max-w-none", children: content })
1182
1216
  }
1183
1217
  )
1184
1218
  ] });
@@ -1186,12 +1220,12 @@ var CardDirective = ({
1186
1220
  var CardDirective_default = CardDirective;
1187
1221
 
1188
1222
  // directives/DetailsDirective.tsx
1189
- import { jsx as jsx5 } from "react/jsx-runtime";
1223
+ var import_jsx_runtime5 = require("react/jsx-runtime");
1190
1224
  var DetailsDirective = ({
1191
1225
  props,
1192
1226
  renderSlot
1193
1227
  }) => {
1194
- return /* @__PURE__ */ jsx5(
1228
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1195
1229
  Details,
1196
1230
  {
1197
1231
  title: props.title || "Details",
@@ -1206,14 +1240,14 @@ var DetailsDirective = ({
1206
1240
  var DetailsDirective_default = DetailsDirective;
1207
1241
 
1208
1242
  // directives/ModalDirective.tsx
1209
- import { useId as useId2 } from "react";
1210
- import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
1243
+ var import_react4 = require("react");
1244
+ var import_jsx_runtime6 = require("react/jsx-runtime");
1211
1245
  var ModalDirective = ({
1212
1246
  props,
1213
1247
  renderSlot,
1214
1248
  context
1215
1249
  }) => {
1216
- const stableId = useId2();
1250
+ const stableId = (0, import_react4.useId)();
1217
1251
  const modalId = `modal-${props.id || stableId}`;
1218
1252
  const label = props.label || props.title || "Open";
1219
1253
  const modalTitle = props.title || "Modal";
@@ -1238,12 +1272,12 @@ var ModalDirective = ({
1238
1272
  const handleClose = () => {
1239
1273
  context.setModals((prev) => ({ ...prev, [modalId]: false }));
1240
1274
  };
1241
- return /* @__PURE__ */ jsxs4("div", { className: `not-prose ${wrapperClass}`.trim(), children: [
1242
- /* @__PURE__ */ jsxs4("button", { className: btnClass, onClick: handleOpen, children: [
1243
- props.icon && /* @__PURE__ */ jsx6(IconRenderer, { iconName: props.icon }),
1275
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: `not-prose ${wrapperClass}`.trim(), children: [
1276
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("button", { className: btnClass, onClick: handleOpen, children: [
1277
+ props.icon && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IconRenderer, { iconName: props.icon }),
1244
1278
  label
1245
1279
  ] }),
1246
- /* @__PURE__ */ jsx6(
1280
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1247
1281
  Modal,
1248
1282
  {
1249
1283
  title: modalTitle,
@@ -1257,8 +1291,8 @@ var ModalDirective = ({
1257
1291
  var ModalDirective_default = ModalDirective;
1258
1292
 
1259
1293
  // directives/ButtonDirective.tsx
1260
- import React4 from "react";
1261
- import { Fragment, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
1294
+ var import_react5 = __toESM(require("react"), 1);
1295
+ var import_jsx_runtime7 = require("react/jsx-runtime");
1262
1296
  var ButtonDirective = ({
1263
1297
  props,
1264
1298
  renderSlot
@@ -1283,7 +1317,7 @@ var ButtonDirective = ({
1283
1317
  };
1284
1318
  const wrapperClass = customClass.split(/\s+/).map((c) => positionMap[c] || c).join(" ");
1285
1319
  if (label) {
1286
- return /* @__PURE__ */ jsx7("div", { className: `not-prose ${wrapperClass}`.trim(), children: /* @__PURE__ */ jsxs5(
1320
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: `not-prose ${wrapperClass}`.trim(), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1287
1321
  "a",
1288
1322
  {
1289
1323
  href: url,
@@ -1291,7 +1325,7 @@ var ButtonDirective = ({
1291
1325
  rel: "noopener noreferrer",
1292
1326
  className: btnClass,
1293
1327
  children: [
1294
- /* @__PURE__ */ jsx7(IconRenderer, { iconName: icon }),
1328
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(IconRenderer, { iconName: icon }),
1295
1329
  label
1296
1330
  ]
1297
1331
  }
@@ -1300,21 +1334,21 @@ var ButtonDirective = ({
1300
1334
  const slotContent = renderSlot("default");
1301
1335
  const findLinks = (element) => {
1302
1336
  if (!element) return [];
1303
- if (React4.isValidElement(element) && element.type === "a") {
1337
+ if (import_react5.default.isValidElement(element) && element.type === "a") {
1304
1338
  return [element];
1305
1339
  }
1306
1340
  if (Array.isArray(element)) {
1307
1341
  return element.flatMap(findLinks);
1308
1342
  }
1309
- if (React4.isValidElement(element) && element.props.children) {
1343
+ if (import_react5.default.isValidElement(element) && element.props.children) {
1310
1344
  return findLinks(element.props.children);
1311
1345
  }
1312
1346
  return [];
1313
1347
  };
1314
1348
  const links = findLinks(slotContent);
1315
1349
  if (links.length > 0) {
1316
- return /* @__PURE__ */ jsx7("div", { className: `not-prose ${wrapperClass}`.trim(), children: links.map(
1317
- (link, index) => React4.cloneElement(
1350
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: `not-prose ${wrapperClass}`.trim(), children: links.map(
1351
+ (link, index) => import_react5.default.cloneElement(
1318
1352
  link,
1319
1353
  {
1320
1354
  key: index,
@@ -1322,22 +1356,22 @@ var ButtonDirective = ({
1322
1356
  target,
1323
1357
  rel: "noopener noreferrer"
1324
1358
  },
1325
- /* @__PURE__ */ jsxs5(Fragment, { children: [
1326
- /* @__PURE__ */ jsx7(IconRenderer, { iconName: icon }),
1359
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
1360
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(IconRenderer, { iconName: icon }),
1327
1361
  link.props.children
1328
1362
  ] })
1329
1363
  )
1330
1364
  ) });
1331
1365
  }
1332
- return /* @__PURE__ */ jsx7("div", { className: `not-prose ${wrapperClass}`.trim(), children: /* @__PURE__ */ jsxs5("a", { href: url, target, rel: "noopener noreferrer", className: btnClass, children: [
1333
- /* @__PURE__ */ jsx7(IconRenderer, { iconName: icon }),
1366
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: `not-prose ${wrapperClass}`.trim(), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("a", { href: url, target, rel: "noopener noreferrer", className: btnClass, children: [
1367
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(IconRenderer, { iconName: icon }),
1334
1368
  slotContent
1335
1369
  ] }) });
1336
1370
  };
1337
1371
  var ButtonDirective_default = ButtonDirective;
1338
1372
 
1339
1373
  // directives/WrapperDirective.tsx
1340
- import { jsx as jsx8 } from "react/jsx-runtime";
1374
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1341
1375
  var WrapperDirective = ({
1342
1376
  props,
1343
1377
  renderSlot
@@ -1354,13 +1388,13 @@ var WrapperDirective = ({
1354
1388
  wrapperProps[key] = value;
1355
1389
  }
1356
1390
  }
1357
- return /* @__PURE__ */ jsx8("div", { ...wrapperProps, children: renderSlot("default") });
1391
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { ...wrapperProps, children: renderSlot("default") });
1358
1392
  };
1359
1393
  var WrapperDirective_default = WrapperDirective;
1360
1394
 
1361
1395
  // directives/SlideDirective.tsx
1362
- import { useState as useState3, useEffect as useEffect2, useCallback, useRef as useRef2, useLayoutEffect } from "react";
1363
- import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
1396
+ var import_react6 = require("react");
1397
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1364
1398
  var slideCounter = 0;
1365
1399
  var SlideDirective = ({
1366
1400
  props,
@@ -1370,23 +1404,23 @@ var SlideDirective = ({
1370
1404
  const rawContent = slots.default || "";
1371
1405
  const lines = rawContent.split("\n").map((l) => l.trim()).filter(Boolean);
1372
1406
  const elements = lines.map((line) => context.parseMarkdown(line));
1373
- const [current, setCurrent] = useState3(0);
1407
+ const [current, setCurrent] = (0, import_react6.useState)(0);
1374
1408
  const interval = parseInt(props.interval || "3000", 10);
1375
1409
  const speed = parseInt(props.speed || "500", 10);
1376
- const elRefs = useRef2([]);
1377
- const [maxH, setMaxH] = useState3(0);
1378
- useLayoutEffect(() => {
1410
+ const elRefs = (0, import_react6.useRef)([]);
1411
+ const [maxH, setMaxH] = (0, import_react6.useState)(0);
1412
+ (0, import_react6.useLayoutEffect)(() => {
1379
1413
  let h = 0;
1380
1414
  elRefs.current.forEach((el) => {
1381
1415
  if (el) h = Math.max(h, el.offsetHeight);
1382
1416
  });
1383
1417
  if (h > 0) setMaxH(h);
1384
1418
  }, [elements]);
1385
- const cycle = useCallback(() => {
1419
+ const cycle = (0, import_react6.useCallback)(() => {
1386
1420
  if (elements.length <= 1) return;
1387
1421
  setCurrent((prev) => (prev + 1) % elements.length);
1388
1422
  }, [elements.length]);
1389
- useEffect2(() => {
1423
+ (0, import_react6.useEffect)(() => {
1390
1424
  if (elements.length <= 1) return;
1391
1425
  const id = setInterval(cycle, interval);
1392
1426
  return () => clearInterval(id);
@@ -1413,14 +1447,14 @@ var SlideDirective = ({
1413
1447
  const forcedFontSize = textSizeMatch ? textSizeMap[textSizeMatch[0]] : null;
1414
1448
  const scopeClass = `sld-${++slideCounter}`;
1415
1449
  const className = textSizeMatch ? rawClass.replace(textSizeMatch[0], "").replace(/\s+/g, " ").trim() : rawClass;
1416
- return /* @__PURE__ */ jsxs6(
1450
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1417
1451
  "div",
1418
1452
  {
1419
1453
  className: "not-prose",
1420
1454
  style: { height: maxH || "auto", position: "relative", overflow: "hidden", ...inlineStyle },
1421
1455
  children: [
1422
- forcedFontSize && /* @__PURE__ */ jsx9("style", { children: `.${scopeClass} * { font-size: ${forcedFontSize} !important; line-height: normal !important; }` }),
1423
- /* @__PURE__ */ jsx9(
1456
+ forcedFontSize && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("style", { children: `.${scopeClass} * { font-size: ${forcedFontSize} !important; line-height: normal !important; }` }),
1457
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1424
1458
  "div",
1425
1459
  {
1426
1460
  style: {
@@ -1431,14 +1465,14 @@ var SlideDirective = ({
1431
1465
  transition: `transform ${speed}ms cubic-bezier(0.16, 1, 0.3, 1)`,
1432
1466
  transform: `translateY(${-current * maxH}px)`
1433
1467
  },
1434
- children: elements.map((tokens, i) => /* @__PURE__ */ jsx9(
1468
+ children: elements.map((tokens, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1435
1469
  "div",
1436
1470
  {
1437
1471
  ref: (el) => {
1438
1472
  elRefs.current[i] = el;
1439
1473
  },
1440
1474
  style: maxH ? { height: maxH, display: "flex", alignItems: "center", overflow: "hidden" } : { display: "flex", alignItems: "center" },
1441
- children: /* @__PURE__ */ jsx9("div", { className: `${scopeClass} ${className}`, style: { width: "100%" }, children: context.processAndRenderElements(tokens) })
1475
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `${scopeClass} ${className}`, style: { width: "100%" }, children: context.processAndRenderElements(tokens) })
1442
1476
  },
1443
1477
  i
1444
1478
  ))
@@ -1477,7 +1511,7 @@ var directiveRegistry = {
1477
1511
  var directives_default = directiveRegistry;
1478
1512
 
1479
1513
  // DirectiveRenderer.tsx
1480
- import { jsx as jsx10 } from "react/jsx-runtime";
1514
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1481
1515
  var DirectiveRenderer = ({
1482
1516
  element,
1483
1517
  context,
@@ -1502,31 +1536,31 @@ var DirectiveRenderer = ({
1502
1536
  allElements
1503
1537
  };
1504
1538
  if (Component) {
1505
- return /* @__PURE__ */ jsx10(Component, { ...directiveProps }, index);
1539
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Component, { ...directiveProps }, index);
1506
1540
  }
1507
- return /* @__PURE__ */ jsx10("div", { className: `my-4 p-4 rounded-2xl border border-border bg-background-primary/5`, children: renderSlot("default") }, index);
1541
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: `my-4 p-4 rounded-2xl border border-border bg-background-primary/5`, children: renderSlot("default") }, index);
1508
1542
  };
1509
1543
  var DirectiveRenderer_default = DirectiveRenderer;
1510
1544
 
1511
1545
  // RawHtmlRenderer.tsx
1512
- import { useRef as useRef4, useEffect as useEffect4 } from "react";
1546
+ var import_react8 = require("react");
1513
1547
 
1514
1548
  // useTailwindCDN.ts
1515
- import { useEffect as useEffect3, useRef as useRef3 } from "react";
1549
+ var import_react7 = require("react");
1516
1550
  function scanTailwindCDN() {
1517
1551
  const tw = window.tailwind;
1518
1552
  if (tw?.scan) tw.scan();
1519
1553
  }
1520
1554
 
1521
1555
  // RawHtmlRenderer.tsx
1522
- import { jsx as jsx11 } from "react/jsx-runtime";
1556
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1523
1557
  var RawHtmlRenderer = ({
1524
1558
  content,
1525
1559
  globalStyles,
1526
1560
  wrapperClassName
1527
1561
  }) => {
1528
- const containerRef = useRef4(null);
1529
- useEffect4(() => {
1562
+ const containerRef = (0, import_react8.useRef)(null);
1563
+ (0, import_react8.useEffect)(() => {
1530
1564
  if (!containerRef.current) return;
1531
1565
  const scripts = containerRef.current.querySelectorAll("script");
1532
1566
  scripts.forEach((oldScript) => {
@@ -1539,7 +1573,7 @@ var RawHtmlRenderer = ({
1539
1573
  });
1540
1574
  scanTailwindCDN();
1541
1575
  }, [content]);
1542
- useEffect4(() => {
1576
+ (0, import_react8.useEffect)(() => {
1543
1577
  if (!globalStyles) return;
1544
1578
  const styleEl = document.createElement("style");
1545
1579
  styleEl.setAttribute("data-global", "");
@@ -1549,25 +1583,25 @@ var RawHtmlRenderer = ({
1549
1583
  if (styleEl.parentNode) document.head.removeChild(styleEl);
1550
1584
  };
1551
1585
  }, [globalStyles]);
1552
- return /* @__PURE__ */ jsx11("div", { className: wrapperClassName, ref: containerRef, children: /* @__PURE__ */ jsx11("div", { dangerouslySetInnerHTML: { __html: content } }) });
1586
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: wrapperClassName, ref: containerRef, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { dangerouslySetInnerHTML: { __html: content } }) });
1553
1587
  };
1554
1588
  var RawHtmlRenderer_default = RawHtmlRenderer;
1555
1589
 
1556
1590
  // context.tsx
1557
- import { createContext, useContext } from "react";
1558
- var RenderCtx = createContext(null);
1591
+ var import_react9 = require("react");
1592
+ var RenderCtx = (0, import_react9.createContext)(null);
1559
1593
  var RenderContextProvider = RenderCtx.Provider;
1560
1594
 
1561
1595
  // CustomMarkdownRenderer.tsx
1562
- import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
1596
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1563
1597
  var CustomMarkdownRenderer = ({ content: initialContent }) => {
1564
- const [modals, setModals] = useState4({});
1565
- const baseId = useId3().replace(/:/g, "");
1598
+ const [modals, setModals] = (0, import_react10.useState)({});
1599
+ const baseId = (0, import_react10.useId)().replace(/:/g, "");
1566
1600
  const articleClass = `scope-${baseId}`;
1567
- const contextRef = useRef5(null);
1601
+ const contextRef = (0, import_react10.useRef)(null);
1568
1602
  resetScopeCounter();
1569
- const allElements = useMemo(() => parseMarkdown(initialContent), [initialContent]);
1570
- useEffect5(() => {
1603
+ const allElements = (0, import_react10.useMemo)(() => parseMarkdown(initialContent), [initialContent]);
1604
+ (0, import_react10.useEffect)(() => {
1571
1605
  const handleHashChange = () => {
1572
1606
  const hash = window.location.hash;
1573
1607
  if (hash) {
@@ -1580,7 +1614,7 @@ var CustomMarkdownRenderer = ({ content: initialContent }) => {
1580
1614
  window.addEventListener("hashchange", handleHashChange);
1581
1615
  return () => window.removeEventListener("hashchange", handleHashChange);
1582
1616
  }, [initialContent]);
1583
- const renderElement = useCallback2(
1617
+ const renderElement = (0, import_react10.useCallback)(
1584
1618
  (element, index, _depth = 0) => {
1585
1619
  switch (element.type) {
1586
1620
  case "header": {
@@ -1598,7 +1632,7 @@ var CustomMarkdownRenderer = ({ content: initialContent }) => {
1598
1632
  if (alignCenter) headerClasses += " text-center";
1599
1633
  if (alignRight) headerClasses += " text-right";
1600
1634
  if (userClasses) headerClasses += ` ${userClasses}`;
1601
- return React8.createElement(
1635
+ return import_react10.default.createElement(
1602
1636
  HeaderTag,
1603
1637
  { key: index, id: element.id, className: headerClasses },
1604
1638
  renderInline(text)
@@ -1609,13 +1643,13 @@ var CustomMarkdownRenderer = ({ content: initialContent }) => {
1609
1643
  const processedContent = lines.map((line, lineIndex) => {
1610
1644
  const hardBreakMatch = line.match(/^(.*?)(\s{2,})$/);
1611
1645
  if (hardBreakMatch) {
1612
- return /* @__PURE__ */ jsxs7(React8.Fragment, { children: [
1646
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react10.default.Fragment, { children: [
1613
1647
  renderInline(hardBreakMatch[1]),
1614
- /* @__PURE__ */ jsx12("br", {})
1648
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("br", {})
1615
1649
  ] }, lineIndex);
1616
1650
  }
1617
1651
  const isLastLine = lineIndex === lines.length - 1;
1618
- return /* @__PURE__ */ jsxs7(React8.Fragment, { children: [
1652
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react10.default.Fragment, { children: [
1619
1653
  renderInline(line),
1620
1654
  !isLastLine && " "
1621
1655
  ] }, lineIndex);
@@ -1624,10 +1658,10 @@ var CustomMarkdownRenderer = ({ content: initialContent }) => {
1624
1658
  let pClasses = "md-p";
1625
1659
  if (pUserClasses) pClasses += ` ${pUserClasses}`;
1626
1660
  if (element.align) pClasses += ` text-${element.align}`;
1627
- return /* @__PURE__ */ jsx12("p", { id: element.id, className: pClasses, children: processedContent }, index);
1661
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { id: element.id, className: pClasses, children: processedContent }, index);
1628
1662
  }
1629
1663
  case "codeblock":
1630
- return /* @__PURE__ */ jsx12(
1664
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1631
1665
  CodeBlock,
1632
1666
  {
1633
1667
  code: element.content,
@@ -1637,7 +1671,7 @@ var CustomMarkdownRenderer = ({ content: initialContent }) => {
1637
1671
  index
1638
1672
  );
1639
1673
  case "directive":
1640
- return /* @__PURE__ */ jsx12(
1674
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1641
1675
  DirectiveRenderer_default,
1642
1676
  {
1643
1677
  element,
@@ -1658,7 +1692,7 @@ var CustomMarkdownRenderer = ({ content: initialContent }) => {
1658
1692
  }
1659
1693
  );
1660
1694
  const wrapperClassName = "w-full my-4";
1661
- return /* @__PURE__ */ jsx12(
1695
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1662
1696
  RawHtmlRenderer_default,
1663
1697
  {
1664
1698
  content: processedContent,
@@ -1671,14 +1705,14 @@ var CustomMarkdownRenderer = ({ content: initialContent }) => {
1671
1705
  case "html-block": {
1672
1706
  const htmlBlock = element;
1673
1707
  const props = parseHtmlAttrs(htmlBlock.attrs);
1674
- return React8.createElement(
1708
+ return import_react10.default.createElement(
1675
1709
  htmlBlock.tag,
1676
1710
  { key: index, ...props },
1677
1711
  ...processAndRenderElements(htmlBlock.children, _depth + 1)
1678
1712
  );
1679
1713
  }
1680
1714
  case "image":
1681
- return /* @__PURE__ */ jsx12(
1715
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1682
1716
  "img",
1683
1717
  {
1684
1718
  alt: element.alt,
@@ -1689,22 +1723,22 @@ var CustomMarkdownRenderer = ({ content: initialContent }) => {
1689
1723
  index
1690
1724
  );
1691
1725
  case "table":
1692
- return /* @__PURE__ */ jsx12("div", { children: renderTable(element.content) }, index);
1726
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: renderTable(element.content) }, index);
1693
1727
  case "list":
1694
- return /* @__PURE__ */ jsx12("div", { children: renderList(element.content) }, index);
1728
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: renderList(element.content) }, index);
1695
1729
  case "blockquote":
1696
- return /* @__PURE__ */ jsx12("blockquote", { className: `border-l-4 border-accent-primary/30 pl-4 italic text-text-secondary my-4 text-sm sm:text-base${element.classes ? ` ${element.classes}` : ""}`, children: renderInline(element.content) }, index);
1730
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("blockquote", { className: `border-l-4 border-accent-primary/30 pl-4 italic text-text-secondary my-4 text-sm sm:text-base${element.classes ? ` ${element.classes}` : ""}`, children: renderInline(element.content) }, index);
1697
1731
  case "hr":
1698
- return /* @__PURE__ */ jsx12("hr", { className: "my-8 border-border" }, index);
1732
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("hr", { className: "my-8 border-border" }, index);
1699
1733
  case "toc":
1700
- return /* @__PURE__ */ jsx12("div", { children: generateToc(allElements) }, index);
1734
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: generateToc(allElements) }, index);
1701
1735
  default:
1702
1736
  return null;
1703
1737
  }
1704
1738
  },
1705
1739
  [allElements]
1706
1740
  );
1707
- const processAndRenderElements = useCallback2(
1741
+ const processAndRenderElements = (0, import_react10.useCallback)(
1708
1742
  (elements, depth = 0) => {
1709
1743
  const result = [];
1710
1744
  let i = 0;
@@ -1725,7 +1759,7 @@ var CustomMarkdownRenderer = ({ content: initialContent }) => {
1725
1759
  const justifyClasses = firstCardClass.match(/\bjustify-\S+/g) || [];
1726
1760
  const wrapperJustify = justifyClasses.length > 0 ? justifyClasses.join(" ") : "";
1727
1761
  result.push(
1728
- /* @__PURE__ */ jsx12("div", { className: `not-prose flex flex-wrap gap-6 my-6 ${wrapperJustify}`, children: cards.map((card, ci) => /* @__PURE__ */ jsx12(React8.Fragment, { children: renderElement(card, ci, depth) }, ci)) }, `card-grid-${result.length}`)
1762
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `not-prose flex flex-wrap gap-6 my-6 ${wrapperJustify}`, children: cards.map((card, ci) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react10.default.Fragment, { children: renderElement(card, ci, depth) }, ci)) }, `card-grid-${result.length}`)
1729
1763
  );
1730
1764
  }
1731
1765
  } else {
@@ -1740,12 +1774,12 @@ var CustomMarkdownRenderer = ({ content: initialContent }) => {
1740
1774
  const generateToc = (elements) => {
1741
1775
  const headers = extractHeaders(elements);
1742
1776
  if (headers.length === 0) return null;
1743
- return /* @__PURE__ */ jsxs7("nav", { className: "not-prose my-6 p-4 rounded-2xl border border-border bg-background-primary/5", children: [
1744
- /* @__PURE__ */ jsx12("div", { className: "text-base font-bold mb-3", children: "Table of Contents" }),
1745
- /* @__PURE__ */ jsx12("ul", { className: "space-y-1 list-none p-0 m-0", children: headers.map((h, i) => {
1777
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("nav", { className: "not-prose my-6 p-4 rounded-2xl border border-border bg-background-primary/5", children: [
1778
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "text-base font-bold mb-3", children: "Table of Contents" }),
1779
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { className: "space-y-1 list-none p-0 m-0", children: headers.map((h, i) => {
1746
1780
  if (h.type !== "header") return null;
1747
1781
  const indentClass = h.level <= 2 ? "pl-0" : h.level === 3 ? "pl-4" : h.level === 4 ? "pl-8" : "pl-12";
1748
- return /* @__PURE__ */ jsx12("li", { className: `${indentClass} text-sm sm:text-base`, children: /* @__PURE__ */ jsx12(
1782
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("li", { className: `${indentClass} text-sm sm:text-base`, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1749
1783
  "a",
1750
1784
  {
1751
1785
  href: `#${h.id}`,
@@ -1771,33 +1805,33 @@ var CustomMarkdownRenderer = ({ content: initialContent }) => {
1771
1805
  processAndRenderElements
1772
1806
  };
1773
1807
  contextRef.current = contextForDirectives;
1774
- return /* @__PURE__ */ jsx12(RenderContextProvider, { value: contextForDirectives, children: processAndRenderElements(allElements) });
1808
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RenderContextProvider, { value: contextForDirectives, children: processAndRenderElements(allElements) });
1775
1809
  };
1776
1810
  var CustomMarkdownRenderer_default = CustomMarkdownRenderer;
1777
1811
 
1778
1812
  // NReditor.tsx
1779
- import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
1780
- var customSyntaxHighlighting = HighlightStyle.define([
1781
- { tag: t2.heading, fontWeight: "bold", color: "var(--tc-heading, #e2e8f0)" },
1782
- { tag: t2.quote, color: "var(--tc-quote, #94a3b8)", fontStyle: "italic" },
1783
- { tag: t2.meta, color: "var(--tc-meta, #64748b)" },
1784
- { tag: t2.variableName, color: "var(--tc-variable, #38bdf8)" },
1785
- { tag: t2.strong, fontWeight: "bold" },
1786
- { tag: t2.emphasis, fontStyle: "italic" },
1787
- { tag: t2.strikethrough, textDecoration: "line-through" },
1788
- { tag: t2.link, color: "var(--tc-link, #38bdf8)" },
1789
- { tag: t2.url, color: "var(--tc-link, #38bdf8)" },
1790
- { tag: t2.comment, color: "var(--tc-comment, #64748b)" },
1791
- { tag: t2.keyword, color: "var(--tc-heading, #e2e8f0)", fontWeight: "bold" },
1792
- { tag: t2.typeName, color: "var(--tc-type, #a78bfa)" },
1793
- { tag: t2.string, color: "var(--tc-string, #4ade80)" },
1794
- { tag: t2.attributeName, color: "var(--tc-attribute, #fb923c)" },
1795
- { tag: t2.propertyName, color: "#0ea5e9" },
1796
- { tag: t2.className, color: "#f59e0b", fontStyle: "italic" },
1797
- { tag: t2.special(t2.emphasis), textDecoration: "underline" },
1798
- { tag: t2.special(t2.comment), backgroundColor: "var(--tc-highlight-bg, rgba(255,255,255,0.05))", padding: "0 2px", borderRadius: "2px" }
1813
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1814
+ var customSyntaxHighlighting = import_language2.HighlightStyle.define([
1815
+ { tag: import_highlight2.tags.heading, fontWeight: "bold", color: "var(--tc-heading, #e2e8f0)" },
1816
+ { tag: import_highlight2.tags.quote, color: "var(--tc-quote, #94a3b8)", fontStyle: "italic" },
1817
+ { tag: import_highlight2.tags.meta, color: "var(--tc-meta, #64748b)" },
1818
+ { tag: import_highlight2.tags.variableName, color: "var(--tc-variable, #38bdf8)" },
1819
+ { tag: import_highlight2.tags.strong, fontWeight: "bold" },
1820
+ { tag: import_highlight2.tags.emphasis, fontStyle: "italic" },
1821
+ { tag: import_highlight2.tags.strikethrough, textDecoration: "line-through" },
1822
+ { tag: import_highlight2.tags.link, color: "var(--tc-link, #38bdf8)" },
1823
+ { tag: import_highlight2.tags.url, color: "var(--tc-link, #38bdf8)" },
1824
+ { tag: import_highlight2.tags.comment, color: "var(--tc-comment, #64748b)" },
1825
+ { tag: import_highlight2.tags.keyword, color: "var(--tc-heading, #e2e8f0)", fontWeight: "bold" },
1826
+ { tag: import_highlight2.tags.typeName, color: "var(--tc-type, #a78bfa)" },
1827
+ { tag: import_highlight2.tags.string, color: "var(--tc-string, #4ade80)" },
1828
+ { tag: import_highlight2.tags.attributeName, color: "var(--tc-attribute, #fb923c)" },
1829
+ { tag: import_highlight2.tags.propertyName, color: "#0ea5e9" },
1830
+ { tag: import_highlight2.tags.className, color: "#f59e0b", fontStyle: "italic" },
1831
+ { tag: import_highlight2.tags.special(import_highlight2.tags.emphasis), textDecoration: "underline" },
1832
+ { tag: import_highlight2.tags.special(import_highlight2.tags.comment), backgroundColor: "var(--tc-highlight-bg, rgba(255,255,255,0.05))", padding: "0 2px", borderRadius: "2px" }
1799
1833
  ]);
1800
- var customEditorTheme = EditorView.theme({
1834
+ var customEditorTheme = import_view.EditorView.theme({
1801
1835
  "&": {
1802
1836
  color: "var(--color-text-primary, #e2e8f0)",
1803
1837
  backgroundColor: "transparent !important",
@@ -1988,7 +2022,7 @@ var customEditorTheme = EditorView.theme({
1988
2022
  accentColor: "var(--color-accent-primary, #38bdf8)"
1989
2023
  }
1990
2024
  });
1991
- var customFoldService = foldService.of((state, lineStart) => {
2025
+ var customFoldService = import_language2.foldService.of((state, lineStart) => {
1992
2026
  const line = state.doc.lineAt(lineStart);
1993
2027
  const trimmed = line.text.trim();
1994
2028
  const dirMatch = trimmed.match(/^:::(.+)/);
@@ -2051,7 +2085,7 @@ var customFoldService = foldService.of((state, lineStart) => {
2051
2085
  }
2052
2086
  return null;
2053
2087
  });
2054
- var directivePlugin = ViewPlugin.fromClass(
2088
+ var directivePlugin = import_view.ViewPlugin.fromClass(
2055
2089
  class {
2056
2090
  constructor(view) {
2057
2091
  this.decorations = this.getDecorations(view);
@@ -2062,7 +2096,7 @@ var directivePlugin = ViewPlugin.fromClass(
2062
2096
  }
2063
2097
  }
2064
2098
  getDecorations(view) {
2065
- const builder = new RangeSetBuilder();
2099
+ const builder = new import_state.RangeSetBuilder();
2066
2100
  const doc = view.state.doc;
2067
2101
  const visibleRanges = view.visibleRanges;
2068
2102
  if (visibleRanges.length === 0) return builder.finish();
@@ -2106,7 +2140,7 @@ var directivePlugin = ViewPlugin.fromClass(
2106
2140
  builder.add(
2107
2141
  line.from,
2108
2142
  line.from,
2109
- Decoration.line({ class: lineClasses.join(" ") })
2143
+ import_view.Decoration.line({ class: lineClasses.join(" ") })
2110
2144
  );
2111
2145
  }
2112
2146
  if (isClosingLine) {
@@ -2118,7 +2152,7 @@ var directivePlugin = ViewPlugin.fromClass(
2118
2152
  },
2119
2153
  { decorations: (v) => v.decorations }
2120
2154
  );
2121
- var blockquotePlugin = ViewPlugin.fromClass(
2155
+ var blockquotePlugin = import_view.ViewPlugin.fromClass(
2122
2156
  class {
2123
2157
  constructor(view) {
2124
2158
  this.decorations = this.getDecorations(view);
@@ -2129,7 +2163,7 @@ var blockquotePlugin = ViewPlugin.fromClass(
2129
2163
  }
2130
2164
  }
2131
2165
  getDecorations(view) {
2132
- const builder = new RangeSetBuilder();
2166
+ const builder = new import_state.RangeSetBuilder();
2133
2167
  for (const { from, to } of view.visibleRanges) {
2134
2168
  for (let pos = from; pos <= to; ) {
2135
2169
  const line = view.state.doc.lineAt(pos);
@@ -2137,7 +2171,7 @@ var blockquotePlugin = ViewPlugin.fromClass(
2137
2171
  builder.add(
2138
2172
  line.from,
2139
2173
  line.from,
2140
- Decoration.line({ class: "cm-blockquote-line" })
2174
+ import_view.Decoration.line({ class: "cm-blockquote-line" })
2141
2175
  );
2142
2176
  }
2143
2177
  pos = line.to + 1;
@@ -2148,7 +2182,7 @@ var blockquotePlugin = ViewPlugin.fromClass(
2148
2182
  },
2149
2183
  { decorations: (v) => v.decorations }
2150
2184
  );
2151
- var spoilerPlugin = ViewPlugin.fromClass(
2185
+ var spoilerPlugin = import_view.ViewPlugin.fromClass(
2152
2186
  class {
2153
2187
  constructor(view) {
2154
2188
  this.decorations = this.getDecorations(view);
@@ -2159,7 +2193,7 @@ var spoilerPlugin = ViewPlugin.fromClass(
2159
2193
  }
2160
2194
  }
2161
2195
  getDecorations(view) {
2162
- const builder = new RangeSetBuilder();
2196
+ const builder = new import_state.RangeSetBuilder();
2163
2197
  const spoilerRegex = /!>([\s\S]+?)<!(?=\s|$)/g;
2164
2198
  const ranges = [];
2165
2199
  for (const { from, to } of view.visibleRanges) {
@@ -2172,13 +2206,13 @@ var spoilerPlugin = ViewPlugin.fromClass(
2172
2206
  const contentStart = start + 2;
2173
2207
  const contentEnd = end - 2;
2174
2208
  if (contentStart >= contentEnd) continue;
2175
- ranges.push({ from: start, to: contentStart, dec: Decoration.replace({}) });
2209
+ ranges.push({ from: start, to: contentStart, dec: import_view.Decoration.replace({}) });
2176
2210
  ranges.push({
2177
2211
  from: contentStart,
2178
2212
  to: contentEnd,
2179
- dec: Decoration.mark({ class: "cm-spoiler" })
2213
+ dec: import_view.Decoration.mark({ class: "cm-spoiler" })
2180
2214
  });
2181
- ranges.push({ from: contentEnd, to: end, dec: Decoration.replace({}) });
2215
+ ranges.push({ from: contentEnd, to: end, dec: import_view.Decoration.replace({}) });
2182
2216
  }
2183
2217
  }
2184
2218
  ranges.sort((a, b) => a.from - b.from || a.to - b.to);
@@ -2188,7 +2222,7 @@ var spoilerPlugin = ViewPlugin.fromClass(
2188
2222
  },
2189
2223
  { decorations: (v) => v.decorations }
2190
2224
  );
2191
- var colorTextPlugin = ViewPlugin.fromClass(
2225
+ var colorTextPlugin = import_view.ViewPlugin.fromClass(
2192
2226
  class {
2193
2227
  constructor(view) {
2194
2228
  this.decorations = this.getDecorations(view);
@@ -2199,7 +2233,7 @@ var colorTextPlugin = ViewPlugin.fromClass(
2199
2233
  }
2200
2234
  }
2201
2235
  getDecorations(view) {
2202
- const builder = new RangeSetBuilder();
2236
+ const builder = new import_state.RangeSetBuilder();
2203
2237
  const colorRegex = /%([^%\s]+?)%((?:(?!%%).)*)%%/g;
2204
2238
  for (const { from, to } of view.visibleRanges) {
2205
2239
  const text = view.state.doc.sliceString(from, to);
@@ -2211,7 +2245,7 @@ var colorTextPlugin = ViewPlugin.fromClass(
2211
2245
  builder.add(
2212
2246
  startPos,
2213
2247
  endPos,
2214
- Decoration.mark({ attributes: { style: `color: ${color}` } })
2248
+ import_view.Decoration.mark({ attributes: { style: `color: ${color}` } })
2215
2249
  );
2216
2250
  }
2217
2251
  }
@@ -2227,25 +2261,25 @@ var NReditor = ({
2227
2261
  debounceMs = 300,
2228
2262
  tailwindCDN = false
2229
2263
  }) => {
2230
- const editorRef = useRef6(null);
2231
- const [isAllFolded, setIsAllFolded] = useState5(false);
2232
- const [editorMode, setEditorMode] = useState5("editor");
2264
+ const editorRef = (0, import_react11.useRef)(null);
2265
+ const [isAllFolded, setIsAllFolded] = (0, import_react11.useState)(false);
2266
+ const [editorMode, setEditorMode] = (0, import_react11.useState)("editor");
2233
2267
  const debouncedContent = useDebounce(value, debounceMs);
2234
2268
  const handleToggleFold = () => {
2235
2269
  if (!editorRef.current) return;
2236
2270
  if (isAllFolded) {
2237
- unfoldAll(editorRef.current);
2271
+ (0, import_language2.unfoldAll)(editorRef.current);
2238
2272
  setIsAllFolded(false);
2239
2273
  } else {
2240
- foldAll(editorRef.current);
2274
+ (0, import_language2.foldAll)(editorRef.current);
2241
2275
  setIsAllFolded(true);
2242
2276
  }
2243
2277
  };
2244
- const extensions = React9.useMemo(
2278
+ const extensions = import_react11.default.useMemo(
2245
2279
  () => [
2246
2280
  customStreamParserV2,
2247
- lineNumbers(),
2248
- foldGutter({
2281
+ (0, import_view.lineNumbers)(),
2282
+ (0, import_language2.foldGutter)({
2249
2283
  markerDOM: (open) => {
2250
2284
  const span = document.createElement("span");
2251
2285
  span.style.cursor = "pointer";
@@ -2259,12 +2293,12 @@ var NReditor = ({
2259
2293
  }),
2260
2294
  customFoldService,
2261
2295
  customEditorTheme,
2262
- syntaxHighlighting(customSyntaxHighlighting),
2263
- EditorView.lineWrapping,
2264
- scrollPastEnd(),
2265
- keymap.of([
2266
- { key: "Ctrl-Shift-[", run: foldAll },
2267
- { key: "Ctrl-Shift-]", run: unfoldAll }
2296
+ (0, import_language2.syntaxHighlighting)(customSyntaxHighlighting),
2297
+ import_view.EditorView.lineWrapping,
2298
+ (0, import_view.scrollPastEnd)(),
2299
+ import_view.keymap.of([
2300
+ { key: "Ctrl-Shift-[", run: import_language2.foldAll },
2301
+ { key: "Ctrl-Shift-]", run: import_language2.unfoldAll }
2268
2302
  ]),
2269
2303
  directivePlugin,
2270
2304
  blockquotePlugin,
@@ -2278,9 +2312,9 @@ var NReditor = ({
2278
2312
  { key: "split", icon: "vertical_split", label: "Split" },
2279
2313
  { key: "preview", icon: "visibility", label: "Preview" }
2280
2314
  ];
2281
- return /* @__PURE__ */ jsxs8("div", { className: `relative flex-1 flex flex-col min-h-0 ${className || ""}`, children: [
2282
- /* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between px-2 py-1.5 border-b border-border/30 bg-background-secondary-solid/50 rounded-t-2xl shrink-0", children: [
2283
- /* @__PURE__ */ jsx13(
2315
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `relative flex-1 flex flex-col min-h-0 ${className || ""}`, children: [
2316
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center justify-between px-2 py-1.5 border-b border-border/30 bg-background-secondary-solid/50 rounded-t-2xl shrink-0", children: [
2317
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2284
2318
  "button",
2285
2319
  {
2286
2320
  onClick: handleToggleFold,
@@ -2289,27 +2323,27 @@ var NReditor = ({
2289
2323
  children: isAllFolded ? "\u2569" : "\u2566"
2290
2324
  }
2291
2325
  ),
2292
- /* @__PURE__ */ jsx13("div", { className: "flex items-center gap-0.5 bg-black/10 dark:bg-white/5 rounded-lg p-0.5", children: modeButtons.map((btn) => /* @__PURE__ */ jsxs8(
2326
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex items-center gap-0.5 bg-black/10 dark:bg-white/5 rounded-lg p-0.5", children: modeButtons.map((btn) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2293
2327
  "button",
2294
2328
  {
2295
2329
  onClick: () => setEditorMode(btn.key),
2296
2330
  className: `flex items-center gap-1 px-2.5 py-1 text-xs rounded-md transition-colors ${editorMode === btn.key ? "bg-accent-primary/20 text-accent-primary font-semibold" : "text-text-secondary hover:text-text-primary hover:bg-white/5"}`,
2297
2331
  title: btn.label,
2298
2332
  children: [
2299
- /* @__PURE__ */ jsx13("span", { className: "material-symbols-rounded text-sm", children: btn.icon }),
2300
- /* @__PURE__ */ jsx13("span", { className: "hidden sm:inline", children: btn.label })
2333
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "material-symbols-rounded text-sm", children: btn.icon }),
2334
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "hidden sm:inline", children: btn.label })
2301
2335
  ]
2302
2336
  },
2303
2337
  btn.key
2304
2338
  )) })
2305
2339
  ] }),
2306
- /* @__PURE__ */ jsxs8("div", { className: "flex-1 min-h-0 flex", children: [
2307
- (editorMode === "editor" || editorMode === "split") && /* @__PURE__ */ jsx13(
2340
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex-1 min-h-0 flex", children: [
2341
+ (editorMode === "editor" || editorMode === "split") && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2308
2342
  "div",
2309
2343
  {
2310
2344
  className: `${editorMode === "split" ? "w-1/2 border-r border-border/30" : "w-full"} flex-1 flex flex-col min-h-0 min-w-0`,
2311
- children: /* @__PURE__ */ jsx13(
2312
- CodeMirror,
2345
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2346
+ import_react_codemirror.default,
2313
2347
  {
2314
2348
  value,
2315
2349
  onChange,
@@ -2327,18 +2361,15 @@ var NReditor = ({
2327
2361
  )
2328
2362
  }
2329
2363
  ),
2330
- (editorMode === "preview" || editorMode === "split") && /* @__PURE__ */ jsx13(
2364
+ (editorMode === "preview" || editorMode === "split") && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2331
2365
  "div",
2332
2366
  {
2333
2367
  className: `${editorMode === "split" ? "w-1/2" : "w-full"} flex-1 min-h-0 overflow-auto min-w-0`,
2334
- children: /* @__PURE__ */ jsx13("div", { className: "nr-prose h-full shadow-xs overflow-auto p-4", children: /* @__PURE__ */ jsx13(CustomMarkdownRenderer_default, { content: debouncedContent }) })
2368
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "nr-prose h-full shadow-xs overflow-auto p-4", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CustomMarkdownRenderer_default, { content: debouncedContent }) })
2335
2369
  }
2336
2370
  )
2337
2371
  ] })
2338
2372
  ] });
2339
2373
  };
2340
2374
  var NReditor_default = NReditor;
2341
- export {
2342
- NReditor_default as default
2343
- };
2344
- //# sourceMappingURL=NReditor.mjs.map
2375
+ //# sourceMappingURL=NReditor.cjs.map