"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
require("lodash/cloneDeep");
require("lodash/get");
require("lodash/omit");
require("lodash/isNaN");
const schema = require("./schema-34663b27.js");
require("lodash/merge");
require("lodash/set");
require("@strapi/helper-plugin");
const jsxRuntime = require("react/jsx-runtime");
const designSystem = require("@strapi/design-system");
const PropTypes = require("prop-types");
const reactIntl = require("react-intl");
const index = require("./index-3e77a6ab.js");
const useAdminUsers = require("./useAdminUsers-05d6b26a.js");
const useReviewWorkflows = require("./useReviewWorkflows-799e0305.js");
const colors = require("./colors-c24a54f0.js");
require("react");
require("react-dnd");
require("@reduxjs/toolkit");
require("./index-3649838b.js");
require("react-dom/client");
require("invariant");
require("lodash/isFunction");
require("lodash/pick");
require("react-helmet");
require("react-router-dom");
require("react-redux");
require("@radix-ui/react-context");
require("@strapi/design-system/v2");
require("@strapi/icons");
require("formik");
require("lodash/camelCase");
require("react-query");
require("styled-components");
require("yup");
require("lodash/defaultsDeep");
require("qs");
require("immer");
require("lodash/isBoolean");
require("lodash/isEmpty");
require("lodash/toNumber");
require("lodash/sortBy");
require("./DragLayer-f07eee6c.js");
require("./AuthenticatedApp-bb793364.js");
require("semver/functions/lt");
require("semver/functions/valid");
require("react-dnd-html5-backend");
require("react-error-boundary");
require("axios");
require("lodash/isObject");
require("lodash/isEqual");
require("lodash/upperFirst");
require("lodash/size");
require("lodash/take");
require("slate");
require("slate-history");
require("slate-react");
require("@radix-ui/react-toolbar");
require("./useDebounce-4712871e.js");
require("react-window");
require("codemirror5");
require("highlight.js");
require("markdown-it");
require("markdown-it-abbr");
require("markdown-it-container");
require("markdown-it-deflist");
require("markdown-it-emoji");
require("markdown-it-footnote");
require("markdown-it-ins");
require("markdown-it-mark");
require("markdown-it-sub");
require("markdown-it-sup");
require("sanitize-html");
require("codemirror5/addon/display/placeholder");
require("lodash/toLower");
require("lodash/toString");
require("react-dom");
require("fractional-indexing");
require("lodash/uniqBy");
require("lodash/unset");
require("lodash/isArray");
require("lodash/flatMap");
require("lodash/uniq");
require("./formatAPIErrors-b599cf27.js");
require("date-fns/parseISO");
require("lodash/isNumber");
require("lodash/groupBy");
require("./constants-85da8cc4.js");
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
const PropTypes__default = /* @__PURE__ */ _interopDefault(PropTypes);
const AssigneeFilter = ({ value, onChange }) => {
  const { formatMessage } = reactIntl.useIntl();
  const { users, isLoading } = useAdminUsers.useAdminUsers();
  return /* @__PURE__ */ jsxRuntime.jsx(
    designSystem.Combobox,
    {
      value,
      "aria-label": formatMessage({
        id: "content-manager.components.Filters.usersSelect.label",
        defaultMessage: "Search and select an user to filter"
      }),
      onChange,
      loading: isLoading,
      children: users.map((user) => {
        return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: user.id.toString(), children: index.getDisplayName(user, formatMessage) }, user.id);
      })
    }
  );
};
AssigneeFilter.propTypes = {
  onChange: PropTypes__default.default.func.isRequired,
  value: PropTypes__default.default.string
};
AssigneeFilter.defaultProps = {
  value: ""
};
const StageFilter = ({ value, onChange, uid }) => {
  const { formatMessage } = reactIntl.useIntl();
  const {
    workflows: [workflow],
    isLoading
  } = useReviewWorkflows.useReviewWorkflows({ filters: { contentTypes: uid } });
  return /* @__PURE__ */ jsxRuntime.jsx(
    designSystem.SingleSelect,
    {
      "aria-label": formatMessage({
        id: "content-manager.components.Filters.reviewWorkflows.label",
        defaultMessage: "Search and select an workflow stage to filter"
      }),
      value,
      onChange,
      loading: isLoading,
      customizeContent: () => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { as: "span", justifyContent: "space-between", alignItems: "center", width: "100%", children: [
        /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", ellipsis: true, children: value }),
        isLoading ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { small: true, style: { display: "flex" } }) : null
      ] }),
      children: (workflow?.stages ?? []).map(({ id, color, name }) => {
        const { themeColorName } = colors.getStageColorByHex(color);
        return /* @__PURE__ */ jsxRuntime.jsx(
          designSystem.SingleSelectOption,
          {
            startIcon: /* @__PURE__ */ jsxRuntime.jsx(
              designSystem.Flex,
              {
                height: 2,
                background: color,
                borderColor: themeColorName === "neutral0" ? "neutral150" : "transparent",
                hasRadius: true,
                shrink: 0,
                width: 2
              }
            ),
            value: name,
            children: name
          },
          id
        );
      })
    }
  );
};
StageFilter.defaultProps = {
  value: ""
};
StageFilter.propTypes = {
  onChange: PropTypes__default.default.func.isRequired,
  uid: PropTypes__default.default.string.isRequired,
  value: PropTypes__default.default.string
};
const REVIEW_WORKFLOW_FILTERS = [
  {
    fieldSchema: {
      type: "relation",
      mainField: {
        name: "name",
        schema: {
          type: "string"
        }
      }
    },
    metadatas: {
      customInput: StageFilter,
      label: {
        id: schema.getTrad(`containers.ListPage.table-headers.reviewWorkflows.stage`),
        defaultMessage: "Review stage"
      }
    },
    name: "strapi_stage"
  },
  {
    fieldSchema: {
      type: "relation",
      mainField: {
        name: "id",
        schema: {
          type: "int"
        }
      }
    },
    metadatas: {
      customInput: AssigneeFilter,
      customOperators: [
        {
          intlLabel: {
            id: "components.FilterOptions.FILTER_TYPES.$eq",
            defaultMessage: "is"
          },
          value: "$eq"
        },
        {
          intlLabel: {
            id: "components.FilterOptions.FILTER_TYPES.$ne",
            defaultMessage: "is not"
          },
          value: "$ne"
        }
      ],
      label: {
        id: schema.getTrad(`containers.ListPage.table-headers.reviewWorkflows.assignee.label`),
        defaultMessage: "Assignee"
      }
    },
    name: "strapi_assignee"
  }
];
exports.REVIEW_WORKFLOW_FILTERS = REVIEW_WORKFLOW_FILTERS;
//# sourceMappingURL=constants-5f4463f0.js.map
