"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 internal_exports = {};
__export(internal_exports, {
  InternalActionTypes: () => InternalActionTypes,
  apiResourceFulfilled: () => apiResourceFulfilled,
  changeElementTree: () => changeElementTree,
  createElementTree: () => createElementTree,
  deleteElementTree: () => deleteElementTree,
  registerComponent: () => registerComponent,
  registerComponentEffect: () => registerComponentEffect,
  registerComponentHandle: () => registerComponentHandle,
  registerComponentHandleEffect: () => registerComponentHandleEffect,
  registerMeasurable: () => registerMeasurable,
  registerMeasurableEffect: () => registerMeasurableEffect,
  registerPropControllers: () => registerPropControllers,
  registerPropControllersHandle: () => registerPropControllersHandle,
  registerReactComponentEffect: () => registerReactComponentEffect,
  setIsInBuilder: () => setIsInBuilder,
  unregisterComponent: () => unregisterComponent,
  unregisterMeasurable: () => unregisterMeasurable,
  unregisterPropControllers: () => unregisterPropControllers,
  unregisterPropControllersHandle: () => unregisterPropControllersHandle,
  updateAPIClientCache: () => updateAPIClientCache
});
module.exports = __toCommonJS(internal_exports);
const InternalActionTypes = {
  API_RESOURCE_FULFILLED: "API_RESOURCE_FULFILLED",
  CREATE_ELEMENT_TREE: "CREATE_ELEMENT_TREE",
  DELETE_ELEMENT_TREE: "DELETE_ELEMENT_TREE",
  CHANGE_ELEMENT_TREE: "CHANGE_ELEMENT_TREE",
  REGISTER_COMPONENT: "REGISTER_COMPONENT",
  UNREGISTER_COMPONENT: "UNREGISTER_COMPONENT",
  REGISTER_COMPONENT_HANDLE: "REGISTER_COMPONENT_HANDLE",
  UNREGISTER_COMPONENT_HANDLE: "UNREGISTER_COMPONENT_HANDLE",
  REGISTER_MEASURABLE: "REGISTER_MEASURABLE",
  UNREGISTER_MEASURABLE: "UNREGISTER_MEASURABLE",
  REGISTER_PROP_CONTROLLERS: "REGISTER_PROP_CONTROLLERS",
  UNREGISTER_PROP_CONTROLLERS: "UNREGISTER_PROP_CONTROLLERS",
  REGISTER_PROP_CONTROLLERS_HANDLE: "REGISTER_PROP_CONTROLLERS_HANDLE",
  UNREGISTER_PROP_CONTROLLERS_HANDLE: "UNREGISTER_PROP_CONTROLLERS_HANDLE",
  REGISTER_REACT_COMPONENT: "REGISTER_REACT_COMPONENT",
  UNREGISTER_REACT_COMPONENT: "UNREGISTER_REACT_COMPONENT",
  SET_IS_IN_BUILDER: "SET_IS_IN_BUILDER",
  UPDATE_API_CLIENT_CACHE: "UPDATE_API_CLIENT_CACHE"
};
function apiResourceFulfilled(resourceType, resourceId, resource, locale) {
  return {
    type: InternalActionTypes.API_RESOURCE_FULFILLED,
    payload: { resourceType, resourceId, resource, locale }
  };
}
function createElementTree(payload) {
  return {
    type: InternalActionTypes.CREATE_ELEMENT_TREE,
    payload
  };
}
function deleteElementTree(payload) {
  return { type: InternalActionTypes.DELETE_ELEMENT_TREE, payload };
}
function changeElementTree(payload) {
  return {
    type: InternalActionTypes.CHANGE_ELEMENT_TREE,
    payload
  };
}
function registerComponent(type, meta, propControllerDescriptors) {
  return {
    type: InternalActionTypes.REGISTER_COMPONENT,
    payload: { type, meta, propControllerDescriptors }
  };
}
function unregisterComponent(type) {
  return { type: InternalActionTypes.UNREGISTER_COMPONENT, payload: { type } };
}
function registerComponentEffect(type, meta, propControllerDescriptors) {
  return (dispatch) => {
    dispatch(registerComponent(type, meta, propControllerDescriptors));
    return () => {
      dispatch(unregisterComponent(type));
    };
  };
}
function registerComponentHandle(documentKey, elementKey, componentHandle) {
  return {
    type: InternalActionTypes.REGISTER_COMPONENT_HANDLE,
    payload: { documentKey, elementKey, componentHandle }
  };
}
function unregisterComponentHandle(documentKey, elementKey) {
  return {
    type: InternalActionTypes.UNREGISTER_COMPONENT_HANDLE,
    payload: { documentKey, elementKey }
  };
}
function registerComponentHandleEffect(documentKey, elementKey, componentHandle) {
  return (dispatch) => {
    dispatch(registerComponentHandle(documentKey, elementKey, componentHandle));
    return () => {
      dispatch(unregisterComponentHandle(documentKey, elementKey));
    };
  };
}
function registerMeasurable(documentKey, elementKey, measurable) {
  return {
    type: InternalActionTypes.REGISTER_MEASURABLE,
    payload: { documentKey, elementKey, measurable }
  };
}
function unregisterMeasurable(documentKey, elementKey) {
  return { type: InternalActionTypes.UNREGISTER_MEASURABLE, payload: { documentKey, elementKey } };
}
function registerMeasurableEffect(documentKey, elementKey, measurable) {
  return (dispatch) => {
    dispatch(registerMeasurable(documentKey, elementKey, measurable));
    return () => {
      dispatch(unregisterMeasurable(documentKey, elementKey));
    };
  };
}
function registerPropControllersHandle(documentKey, elementKey, handle) {
  return {
    type: InternalActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE,
    payload: { documentKey, elementKey, handle }
  };
}
function unregisterPropControllersHandle(documentKey, elementKey) {
  return {
    type: InternalActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE,
    payload: { documentKey, elementKey }
  };
}
function registerPropControllers(documentKey, elementKey, propControllers) {
  return {
    type: InternalActionTypes.REGISTER_PROP_CONTROLLERS,
    payload: { documentKey, elementKey, propControllers }
  };
}
function unregisterPropControllers(documentKey, elementKey) {
  return {
    type: InternalActionTypes.UNREGISTER_PROP_CONTROLLERS,
    payload: { documentKey, elementKey }
  };
}
function registerReactComponent(type, component) {
  return { type: InternalActionTypes.REGISTER_REACT_COMPONENT, payload: { type, component } };
}
function unregisterReactComponent(type) {
  return { type: InternalActionTypes.UNREGISTER_REACT_COMPONENT, payload: { type } };
}
function registerReactComponentEffect(type, component) {
  return (dispatch) => {
    dispatch(registerReactComponent(type, component));
    return () => {
      dispatch(unregisterReactComponent(type));
    };
  };
}
function setIsInBuilder(isInBuilder) {
  return { type: InternalActionTypes.SET_IS_IN_BUILDER, payload: isInBuilder };
}
function updateAPIClientCache(payload) {
  return { type: InternalActionTypes.UPDATE_API_CLIENT_CACHE, payload };
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  InternalActionTypes,
  apiResourceFulfilled,
  changeElementTree,
  createElementTree,
  deleteElementTree,
  registerComponent,
  registerComponentEffect,
  registerComponentHandle,
  registerComponentHandleEffect,
  registerMeasurable,
  registerMeasurableEffect,
  registerPropControllers,
  registerPropControllersHandle,
  registerReactComponentEffect,
  setIsInBuilder,
  unregisterComponent,
  unregisterMeasurable,
  unregisterPropControllers,
  unregisterPropControllersHandle,
  updateAPIClientCache
});
//# sourceMappingURL=internal.js.map