"use strict";
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
  for (var prop in b || (b = {}))
    if (__hasOwnProp.call(b, prop))
      __defNormalProp(a, prop, b[prop]);
  if (__getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(b)) {
      if (__propIsEnum.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    }
  return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __objRest = (source, exclude) => {
  var target = {};
  for (var prop in source)
    if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
      target[prop] = source[prop];
  if (source != null && __getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(source)) {
      if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
        target[prop] = source[prop];
    }
  return target;
};
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/molecules/one-on-one-guide-list.tsx
var one_on_one_guide_list_exports = {};
__export(one_on_one_guide_list_exports, {
  OneOnOneGuideList: () => OneOnOneGuideList,
  oneOnOneNoteTextReplacer: () => oneOnOneNoteTextReplacer
});
module.exports = __toCommonJS(one_on_one_guide_list_exports);
var import_react4 = require("react");

// src/atoms/heading.tsx
var import_themes = require("@radix-ui/themes");
var import_react = require("react");

// src/utils/map-with-responsive.ts
var mapWithResponsive = (args) => {
  const { value, mapFn } = args;
  if (typeof value === "string") {
    return mapFn(value);
  }
  ;
  if (typeof value === "object") {
    const newObj = {};
    let key;
    for (key in value) {
      newObj[key] = mapFn(value[key]);
    }
    return newObj;
  }
  return value;
};

// src/atoms/heading.tsx
var import_themes2 = require("@radix-ui/themes");
var import_jsx_runtime = require("react/jsx-runtime");
var mapVariant = (variant) => {
  switch (variant) {
    case "heading1":
      return "7";
    case "heading2":
      return "6";
    case "heading3":
      return "5";
    case "heading4":
      return "4";
    case "heading5":
      return "3";
    default:
      return void 0;
  }
};
function Heading2(props) {
  const _a = props, { size, children, variant } = _a, rest = __objRest(_a, ["size", "children", "variant"]);
  const radixSize = (0, import_react.useMemo)(() => {
    return variant ? mapWithResponsive({
      value: variant,
      mapFn: mapVariant
    }) : size;
  }, [size, variant]);
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_themes.Heading, __spreadProps(__spreadValues({}, rest), { size: radixSize, children }));
}

// src/atoms/list.tsx
var import_react3 = require("react");
var import_clsx = require("clsx");

// src/atoms/typo.tsx
var import_themes3 = require("@radix-ui/themes");
var import_react2 = require("react");
var import_jsx_runtime2 = require("react/jsx-runtime");
var Typo = (0, import_react2.forwardRef)(
  (props, ref) => {
    const _a = props, { size, variant, children } = _a, rest = __objRest(_a, ["size", "variant", "children"]);
    const radixSize = (0, import_react2.useMemo)(() => {
      if (size !== void 0) return size;
      if (variant === void 0) return "2";
      return mapWithResponsive({
        value: variant,
        mapFn: (variantValue) => {
          switch (variantValue) {
            case "caption":
              return "1";
            case "subtitle":
              return "3";
            case "body":
            default:
              return "2";
          }
        }
      });
    }, [size, variant]);
    return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_themes3.Text, __spreadProps(__spreadValues({}, rest), { ref, size: radixSize, children }));
  }
);
Typo.displayName = "Typo";

// src/atoms/flex.tsx
var import_themes4 = require("@radix-ui/themes");

// src/atoms/list.tsx
var import_jsx_runtime3 = require("react/jsx-runtime");
function Root(props) {
  const _a = props, {
    variant,
    size = "large",
    children,
    preSpace,
    className: propsClassName
  } = _a, rest = __objRest(_a, [
    "variant",
    "size",
    "children",
    "preSpace",
    "className"
  ]);
  const Comp = variant === "ol" ? "ol" : "ul";
  const className = (0, import_react3.useMemo)(
    () => (0, import_clsx.clsx)(
      {
        "pre-space-small": preSpace === "small"
      },
      propsClassName
    ),
    [preSpace, propsClassName]
  );
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ListContext.Provider, { value: { size }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_themes4.Flex, __spreadProps(__spreadValues({ asChild: true, direction: "column", gap: "1" }, rest), { className, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Comp, { children }) })) });
}
function Item(props) {
  const { children } = props;
  const { size } = useList();
  const variant = (0, import_react3.useMemo)(() => {
    return mapWithResponsive({
      value: size,
      mapFn: (sizeValue) => {
        return sizeValue === "small" ? "caption" : "body";
      }
    });
  }, [size]);
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Typo, { asChild: true, variant, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("li", { children }) });
}
var ListContext = (0, import_react3.createContext)({
  size: "large"
});
function useList() {
  return (0, import_react3.useContext)(ListContext);
}
var List = {
  Root,
  Item
};

// src/molecules/one-on-one-guide-list.tsx
var import_jsx_runtime4 = require("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 = (0, import_react4.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__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
    /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Heading2, { mb: "2", variant: "heading5", children: oneOnOneNoteTextReplacer({
      text: guideTitle || "",
      userName: (relacements == null ? void 0 : relacements.userName) || "",
      templateName: (relacements == null ? void 0 : relacements.templateName) || ""
    }) }),
    /* @__PURE__ */ (0, import_jsx_runtime4.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__ */ (0, import_jsx_runtime4.jsx)(
      List.Root,
      {
        preSpace: "small",
        style: { fontWeight: "bold", gap: "var(--space-5)" },
        variant: "ol",
        children: groupedData == null ? void 0 : groupedData.map((item) => {
          return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(List.Item, { children: [
            /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Typo, { as: "div", mb: "1", children: item.title }),
            item.children.map((child) => {
              if (child.type === "ul") {
                return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
                  List.Root,
                  {
                    preSpace: "small",
                    style: { fontWeight: "normal", gap: "var(--space-2)" },
                    variant: "ul",
                    children: child.value.map((el) => {
                      return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(List.Item, { children: el }, el);
                    })
                  },
                  child.value[0]
                );
              }
              if (typeof child.value === "string") {
                return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Typo, { as: "div", mb: "2", weight: "regular", children: child.value }, child.value);
              }
              return null;
            })
          ] }, item.title);
        })
      }
    )
  ] });
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  OneOnOneGuideList,
  oneOnOneNoteTextReplacer
});
//# sourceMappingURL=one-on-one-guide-list.cjs.map