import { supportsActivity } from "./components/activity-with-fallback";
import { registerComponentEffect, registerReactComponentEffect } from "../../state/actions/internal";
import { ComponentIcon } from "../../state/modules/components-meta";
import { RuntimeCore } from "./runtime-core";
function validateComponentType(type, component) {
  const componentName = component?.name ?? "Component";
  if (typeof type !== "string" || type === "") {
    throw new Error(
      `${componentName}: A non-empty string \`type\` is required for component registration, got ${type}`
    );
  }
}
class ReactRuntimeCore extends RuntimeCore {
  registerComponent(component, {
    type,
    label,
    icon = ComponentIcon.Cube,
    hidden = false,
    description,
    builtinSuspense,
    props
  }) {
    validateComponentType(type, component);
    const unregisterComponent = this.store.dispatch(
      registerComponentEffect(
        type,
        { label, icon, hidden, description, builtinSuspense },
        props ?? {}
      )
    );
    if (supportsActivity() && builtinSuspense !== void 0) {
      console.warn(
        "builtinSuspense is ignored in React >= 19.2; components are always wrapped in <Activity>."
      );
    }
    const unregisterReactComponent = this.store.dispatch(
      registerReactComponentEffect(type, component)
    );
    return () => {
      unregisterComponent();
      unregisterReactComponent();
    };
  }
  constructor({ breakpoints } = {}) {
    super({ breakpoints });
  }
}
export {
  ReactRuntimeCore
};
//# sourceMappingURL=react-runtime-core.js.map