"use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.MapEntryRule=void 0;const t=require("./types"),r=e(require("../../../log"));exports.MapEntryRule=class{constructor(e,t,r){this.keyRule=e,this.valueRule=t,this.errorCallback=r}validate(e,a,i){i=i||a;const l=e[a];if(!l)return;const o=Object.keys(l),s={};try{for(const e of o)s.key=e,s.value=l[e],this.keyRule.validate({[e]:e},e),this.valueRule.validate(l,e)}catch(e){r.default.error("",`validate "${i}" in oh-package.json5 failed. error: ${e}.`),this.errorCallback(i,{attrName:i,ruleType:t.ValidationRuleType.MapEntry,errorMsg:this.getErrorMsg(i,s)})}}getErrorMsg(e,t){return`the attribute "${e}" contains invalid kv pair: "${t.key}:${t.value}" in oh-package.json5`}};