{"version":3,"file":"pattern.mjs","names":[],"sources":["../../../../../../../../@warlock.js/seal/src/rules/string/pattern.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Pattern rule - validates against regex pattern\r\n */\r\nexport const patternRule: SchemaRule<{ pattern: RegExp }> = {\r\n  name: \"pattern\",\r\n  defaultErrorMessage: \"The :input does not match the required pattern\",\r\n  async validate(value: any, context) {\r\n    if (this.context.options.pattern.test(value)) {\r\n      return VALID_RULE;\r\n    }\r\n\r\n    this.context.translationParams.pattern = this.context.options.pattern.toString();\r\n    return invalidRule(this, context);\r\n  },\r\n};\r\n"],"mappings":";;;;;;;AAMA,MAAa,cAA+C;CAC1D,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,KAAK,QAAQ,QAAQ,QAAQ,KAAK,KAAK,GACzC,OAAO;EAGT,KAAK,QAAQ,kBAAkB,UAAU,KAAK,QAAQ,QAAQ,QAAQ,SAAS;EAC/E,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}