import {
  List
} from "./chunk-WV2HN6H4.js";
import {
  Heading
} from "./chunk-BESTU2AY.js";
import {
  Typo
} from "./chunk-PMJIFLDT.js";

// src/molecules/one-on-one-guide-list.tsx
import { useMemo } from "react";
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
var oneOnOneNoteTextReplacer = (args) => {
  const { text, userName, templateName } = args;
  return text.replace(/\{\{Template_Name\}\}/g, templateName).replace(/\{\{Subject_Name\}\}/g, userName);
};
function OneOnOneGuideList(props) {
  const { data, relacements, guideTitle, guideDescription } = props;
  const groupedData = useMemo(() => {
    return data == null ? void 0 : data.reduce(
      (acc, item) => {
        if (item.type === "title") {
          acc.push({ title: item.value, children: [] });
        } else {
          acc[acc.length - 1].children.push(item);
        }
        return acc;
      },
      []
    );
  }, [data]);
  return /* @__PURE__ */ jsxs(Fragment, { children: [
    /* @__PURE__ */ jsx(Heading, { mb: "2", variant: "heading5", children: oneOnOneNoteTextReplacer({
      text: guideTitle || "",
      userName: (relacements == null ? void 0 : relacements.userName) || "",
      templateName: (relacements == null ? void 0 : relacements.templateName) || ""
    }) }),
    /* @__PURE__ */ jsx(Typo, { as: "div", mb: "4", children: oneOnOneNoteTextReplacer({
      text: guideDescription || "",
      userName: (relacements == null ? void 0 : relacements.userName) || "\uD300\uC6D0",
      templateName: (relacements == null ? void 0 : relacements.templateName) || "1on1"
    }) }),
    /* @__PURE__ */ jsx(
      List.Root,
      {
        preSpace: "small",
        style: { fontWeight: "bold", gap: "var(--space-5)" },
        variant: "ol",
        children: groupedData == null ? void 0 : groupedData.map((item) => {
          return /* @__PURE__ */ jsxs(List.Item, { children: [
            /* @__PURE__ */ jsx(Typo, { as: "div", mb: "1", children: item.title }),
            item.children.map((child) => {
              if (child.type === "ul") {
                return /* @__PURE__ */ jsx(
                  List.Root,
                  {
                    preSpace: "small",
                    style: { fontWeight: "normal", gap: "var(--space-2)" },
                    variant: "ul",
                    children: child.value.map((el) => {
                      return /* @__PURE__ */ jsx(List.Item, { children: el }, el);
                    })
                  },
                  child.value[0]
                );
              }
              if (typeof child.value === "string") {
                return /* @__PURE__ */ jsx(Typo, { as: "div", mb: "2", weight: "regular", children: child.value }, child.value);
              }
              return null;
            })
          ] }, item.title);
        })
      }
    )
  ] });
}

export {
  oneOnOneNoteTextReplacer,
  OneOnOneGuideList
};
//# sourceMappingURL=chunk-O5MYSBA3.js.map