"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);

// packages/block-editor/src/components/inserter/block-patterns-tab/utils.js
var utils_exports = {};
__export(utils_exports, {
  INSERTER_PATTERN_TYPES: () => INSERTER_PATTERN_TYPES,
  INSERTER_SYNC_TYPES: () => INSERTER_SYNC_TYPES,
  allPatternsCategory: () => allPatternsCategory,
  isPatternFiltered: () => isPatternFiltered,
  myPatternsCategory: () => myPatternsCategory,
  starterPatternsCategory: () => starterPatternsCategory
});
module.exports = __toCommonJS(utils_exports);
var import_i18n = require("@wordpress/i18n");
var INSERTER_PATTERN_TYPES = {
  user: "user",
  theme: "theme",
  directory: "directory"
};
var INSERTER_SYNC_TYPES = {
  full: "fully",
  unsynced: "unsynced"
};
var allPatternsCategory = {
  name: "allPatterns",
  label: (0, import_i18n._x)("All", "patterns")
};
var myPatternsCategory = {
  name: "myPatterns",
  label: (0, import_i18n.__)("My patterns")
};
var starterPatternsCategory = {
  name: "core/starter-content",
  label: (0, import_i18n.__)("Starter content")
};
function isPatternFiltered(pattern, sourceFilter, syncFilter) {
  const isUserPattern = pattern.name.startsWith("core/block");
  const isDirectoryPattern = pattern.source === "core" || pattern.source?.startsWith("pattern-directory");
  if (sourceFilter === INSERTER_PATTERN_TYPES.theme && (isUserPattern || isDirectoryPattern)) {
    return true;
  }
  if (sourceFilter === INSERTER_PATTERN_TYPES.directory && (isUserPattern || !isDirectoryPattern)) {
    return true;
  }
  if (sourceFilter === INSERTER_PATTERN_TYPES.user && pattern.type !== INSERTER_PATTERN_TYPES.user) {
    return true;
  }
  if (syncFilter === INSERTER_SYNC_TYPES.full && pattern.syncStatus !== "") {
    return true;
  }
  if (syncFilter === INSERTER_SYNC_TYPES.unsynced && pattern.syncStatus !== "unsynced" && isUserPattern) {
    return true;
  }
  return false;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  INSERTER_PATTERN_TYPES,
  INSERTER_SYNC_TYPES,
  allPatternsCategory,
  isPatternFiltered,
  myPatternsCategory,
  starterPatternsCategory
});
//# sourceMappingURL=utils.js.map
