{"version":3,"file":"present-unless-rules.mjs","names":[],"sources":["../../../../../../../../@warlock.js/seal/src/rules/conditional/present-unless-rules.ts"],"sourcesContent":["import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Present unless rule - field must be present unless another field equals a specific value\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentUnlessRule: SchemaRule<{\r\n  field: string;\r\n  value: any;\r\n  scope?: \"global\" | \"sibling\";\r\n}> = {\r\n  name: \"presentUnless\",\r\n  description: \"The field must be present unless another field equals a specific value\",\r\n  sortOrder: -2,\r\n  requiresValue: false,\r\n  defaultErrorMessage: \"The :input field must be present\",\r\n  async validate(value: any, context) {\r\n    const { value: expectedValue } = this.context.options;\r\n    const fieldValue = getFieldValue(this, context);\r\n\r\n    // Field must be present unless the other field equals the expected value\r\n    if (value === undefined && fieldValue !== expectedValue) {\r\n      this.context.translationParams.value = expectedValue;\r\n      this.context.translatableParams.field = this.context.options.field;\r\n      return invalidRule(this, context);\r\n    }\r\n\r\n    return VALID_RULE;\r\n  },\r\n};\r\n"],"mappings":";;;;;;;;;AAOA,MAAa,oBAIR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,OAAO,kBAAkB,KAAK,QAAQ;EAC9C,MAAM,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,UAAU,UAAa,eAAe,eAAe;GACvD,KAAK,QAAQ,kBAAkB,QAAQ;GACvC,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;GAC7D,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF"}