"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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);
var usePresetValue_exports = {};
__export(usePresetValue_exports, {
  defaultValue: () => defaultValue,
  usePresetValue: () => usePresetValue
});
module.exports = __toCommonJS(usePresetValue_exports);
var import_react = require("react");
var import_controls = require("@makeswift/controls");
var import_breakpoints = require("../../../../../state/modules/breakpoints");
var import_use_breakpoints = require("../../../hooks/use-breakpoints");
var import_controls2 = require("../../../../../controls");
function usePresetValue(definition) {
  const breakpoints = (0, import_use_breakpoints.useBreakpoints)();
  return (0, import_react.useMemo)(
    () => [
      {
        type: import_controls.Slate.BlockType.Default,
        children: [
          {
            text: definition.config.defaultValue ?? "",
            ...definition.config.mode === import_controls2.RichText.Mode.Inline ? {} : {
              typography: {
                style: [
                  {
                    deviceId: (0, import_controls.getBaseBreakpoint)(breakpoints).id,
                    value: {
                      fontWeight: 400,
                      fontSize: { value: 18, unit: "px" },
                      lineHeight: 1.5
                    }
                  },
                  ...breakpoints.some(({ id }) => id === import_breakpoints.DefaultBreakpointID.Mobile) ? [
                    {
                      deviceId: import_breakpoints.DefaultBreakpointID.Mobile,
                      value: { fontSize: { value: 16, unit: "px" } }
                    }
                  ] : []
                ]
              }
            }
          }
        ]
      }
    ],
    [definition.config.mode, definition.config.defaultValue, breakpoints]
  );
}
const defaultValue = [
  {
    type: import_controls.Slate.BlockType.Default,
    children: [
      {
        text: ""
      }
    ]
  }
];
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  defaultValue,
  usePresetValue
});
//# sourceMappingURL=usePresetValue.js.map