{"version":3,"file":"matches.mjs","names":[],"sources":["../../../../../../../../@warlock.js/seal/src/rules/string/matches.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Matches rule - value must match another field value\r\n */\r\nexport const matchesRule: SchemaRule<{ field: string }> = {\r\n  name: \"matches\",\r\n  defaultErrorMessage: \"The :input must match :field\",\r\n  async validate(value: any, context) {\r\n    const otherFieldValue = get(context.allValues, this.context.options.field);\r\n\r\n    if (value === otherFieldValue) {\r\n      return VALID_RULE;\r\n    }\r\n\r\n    this.context.translatableParams.field = this.context.options.field;\r\n\r\n    return invalidRule(this, context);\r\n  },\r\n};\r\n"],"mappings":";;;;;;;;AAOA,MAAa,cAA6C;CACxD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAGlC,IAAI,UAFoB,IAAI,QAAQ,WAAW,KAAK,QAAQ,QAAQ,KAExC,GAC1B,OAAO;EAGT,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}