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

// src/components/systemSettings/registry/utils/validators.ts
var validators_exports = {};
__export(validators_exports, {
  createPrefixedAppIdentifierValidator: () => createPrefixedAppIdentifierValidator
});
module.exports = __toCommonJS(validators_exports);
var createPrefixedAppIdentifierValidator = (sectionCode) => {
  return (_, value) => {
    if (!value) {
      return Promise.resolve();
    }
    const expectedPrefix = `${sectionCode}.`;
    if (!value.startsWith(expectedPrefix)) {
      return Promise.reject(new Error(`键必须以 "${expectedPrefix}" 开头`));
    }
    const remainingPart = value.substring(expectedPrefix.length);
    if (!remainingPart) {
      return Promise.reject(new Error("键不能只包含前缀"));
    }
    const validPattern = /^[a-z0-9._]+$/;
    if (!validPattern.test(remainingPart)) {
      return Promise.reject(new Error("键只能包含小写字母、数字、点、下划线"));
    }
    if (remainingPart.startsWith(".") || remainingPart.startsWith("_") || remainingPart.endsWith(".") || remainingPart.endsWith("_")) {
      return Promise.reject(new Error("键不能以点或下划线开头或结尾"));
    }
    if (remainingPart.includes("..") || remainingPart.includes("__") || remainingPart.includes("._") || remainingPart.includes("_.")) {
      return Promise.reject(new Error("键不能包含连续的点或下划线"));
    }
    return Promise.resolve();
  };
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  createPrefixedAppIdentifierValidator
});
