"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 introspection_exports = {};
__export(introspection_exports, {
  getElementChildren: () => getElementChildren,
  getElementId: () => getElementId,
  getFileIds: () => getFileIds,
  getPageIds: () => getPageIds,
  getSwatchIds: () => getSwatchIds,
  getTableIds: () => getTableIds,
  getTypographyIds: () => getTypographyIds
});
module.exports = __toCommonJS(introspection_exports);
var import_descriptors = require("./descriptors");
var import_controls = require("@makeswift/controls");
var import_prop_controllers = require("@makeswift/prop-controllers");
var import_deleted = require("./deleted");
function getElementChildren(descriptor, prop) {
  if (prop == null)
    return [];
  if (!(0, import_descriptors.isLegacyDescriptor)(descriptor)) {
    return descriptor.introspect(prop, import_controls.Targets.ChildrenElement);
  }
  switch (descriptor.type) {
    case import_prop_controllers.Types.Grid:
      return (0, import_prop_controllers.getGridPropControllerElementChildren)(prop);
    default:
      return [];
  }
}
function getElementId(descriptor, prop) {
  if (prop == null)
    return null;
  if (!(0, import_descriptors.isLegacyDescriptor)(descriptor)) {
    return null;
  }
  switch (descriptor.type) {
    case import_prop_controllers.Types.ElementID:
      return (0, import_prop_controllers.getElementIDPropControllerDataElementID)(prop) ?? null;
    default:
      return null;
  }
}
function getSwatchIds(descriptor, prop) {
  if (prop == null)
    return [];
  if (!(0, import_descriptors.isLegacyDescriptor)(descriptor)) {
    return descriptor.introspect(prop, import_controls.Targets.Swatch);
  }
  switch (descriptor.type) {
    case import_prop_controllers.Types.Backgrounds:
      return (0, import_prop_controllers.getBackgroundsPropControllerSwatchIds)(prop);
    case import_prop_controllers.Types.Border:
      return (0, import_prop_controllers.getBorderPropControllerDataSwatchIds)(prop);
    case import_prop_controllers.Types.NavigationLinks: {
      return (0, import_prop_controllers.getNavigationLinksPropControllerSwatchIds)(prop);
    }
    case import_prop_controllers.Types.ResponsiveColor:
      return (0, import_prop_controllers.getResponsiveColorPropControllerDataSwatchIds)(prop);
    case import_prop_controllers.Types.Shadows:
      return (0, import_prop_controllers.getShadowsPropControllerDataSwatchIds)(prop);
    case import_deleted.DELETED_PROP_CONTROLLER_TYPES.RichText: {
      return (0, import_controls.introspectRichTextData)(prop, import_controls.Targets.Swatch);
    }
    default:
      return [];
  }
}
function getFileIds(descriptor, prop) {
  if (prop == null)
    return [];
  if (!(0, import_descriptors.isLegacyDescriptor)(descriptor)) {
    return descriptor.introspect(prop, import_controls.Targets.File);
  }
  switch (descriptor.type) {
    case import_prop_controllers.Types.Backgrounds:
      return (0, import_prop_controllers.getBackgroundsPropControllerFileIds)(prop);
    case import_prop_controllers.Types.Image: {
      return (0, import_prop_controllers.getImagePropControllerFileIds)(prop);
    }
    case import_prop_controllers.Types.Images: {
      return (0, import_prop_controllers.getImagesPropControllerFileIds)(prop);
    }
    default:
      return [];
  }
}
function getTypographyIds(descriptor, prop) {
  if (prop == null)
    return [];
  if (!(0, import_descriptors.isLegacyDescriptor)(descriptor)) {
    return descriptor.introspect(prop, import_controls.Targets.Typography);
  }
  switch (descriptor.type) {
    case import_deleted.DELETED_PROP_CONTROLLER_TYPES.RichText: {
      return (0, import_controls.introspectRichTextData)(prop, import_controls.Targets.Typography);
    }
    default:
      return [];
  }
}
function getTableIds(descriptor, prop) {
  if (prop == null)
    return [];
  if (!(0, import_descriptors.isLegacyDescriptor)(descriptor)) {
    return descriptor.introspect(prop, import_controls.Targets.Table);
  }
  switch (descriptor.type) {
    case import_prop_controllers.Types.Table: {
      return (0, import_prop_controllers.getTablePropControllerDataTableIds)(prop);
    }
    default:
      return [];
  }
}
function getPageIds(descriptor, prop) {
  if (prop == null)
    return [];
  if (!(0, import_descriptors.isLegacyDescriptor)(descriptor)) {
    return descriptor.introspect(prop, import_controls.Targets.Page);
  }
  switch (descriptor.type) {
    case import_prop_controllers.Types.Link: {
      return (0, import_prop_controllers.getLinkPropControllerPageIds)(prop);
    }
    case import_prop_controllers.Types.NavigationLinks: {
      return (0, import_prop_controllers.getNavigationLinksPropControllerPageIds)(prop);
    }
    case import_deleted.DELETED_PROP_CONTROLLER_TYPES.RichText: {
      return (0, import_controls.introspectRichTextData)(prop, import_controls.Targets.Page);
    }
    default:
      return [];
  }
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  getElementChildren,
  getElementId,
  getFileIds,
  getPageIds,
  getSwatchIds,
  getTableIds,
  getTypographyIds
});
//# sourceMappingURL=introspection.js.map