import { Node_Type } from "./../../ricos-schema/legacy/wix/rich_content/v1/index.js";
import { includesGroup } from "./../../ricos-types/tiptap.js";
import { createRicosFunctionalExtension } from "./../../plugin-commons/index.js";
import { ResizerHOC, createResizerHoc } from "./react-resizer.js";
const isResizableGroup = (group) => typeof group === "object" && group?.group === "resizable";
const resizable = createRicosFunctionalExtension({
  type: "extension",
  groups: [],
  name: "ricos-resizable",
  reconfigure(config, extensions, _ricosProps, _settings, services) {
    const types = extensions.filter((extension) => !(services.context.isMobile && extension.name === Node_Type.IMAGE)).filter((extension) => includesGroup(extension.groups, "resizable")).map(({ name }) => name);
    const defaultHoc = ResizerHOC;
    return {
      ...config,
      priority: 80,
      addNodeHoc: () => {
        return {
          nodeTypes: types,
          getNodeHoc: (extension) => {
            const group = extension.groups.find(isResizableGroup);
            return group ? createResizerHoc(group.options) : defaultHoc;
          },
          priority: 80
        };
      }
    };
  },
  createExtensionConfig() {
    return {
      name: this.name
    };
  }
});
export {
  resizable
};
//# sourceMappingURL=extension.js.map
