//>>builtdefine(["dojo/_base/kernel","dojox","dojo/_base/array"],function(q,h){q.getObject("json.schema",!0,h);h.json.schema.validate=function(d,m){returnthis._validate(d,m,!1)};h.json.schema.checkPropertyChange=function(d,m,h){returnthis._validate(d,m,h||"property")};h.json.schema.mustBeValid=function(d){if(!d.valid)thrownewTypeError(q.map(d.errors,function(d){return"for property "+d.property+": "+d.message}).join(", "));};h.json.schema._validate=function(d,h,n){functionl(b,a,k,e){functionc(a){f.push({property:k,message:a})}functiong(a,b){if(a){if(!("string"!=typeofa||"any"==a||("null"==a?null===b:typeofb==a)||binstanceofArray&&"array"==a||"integer"==a&&0===b%1))return[{property:k,message:typeofb+" value found, but a "+a+" is required"}];if(ainstanceofArray){for(varc=[],e=0;e<a.length&&(c=g(a[e],b)).length;e++);if(c.length)returnc}elseif("object"==typeofa)returnc=f,f=[],l(b,a,k),a=f,f=c,a}return[]}vard;k+=k?"number"==typeofe?"["+e+"]":"undefined"==typeofe?"":"."+e:e;if(("object"!=typeofa||ainstanceofArray)&&(k||"function"!=typeofa))return"function"==typeofa?Object(b)instanceofa||c("is not an instance of the class/constructor "+a.name):a&&c("Invalid schema/property definition "+a),null;n&&a.readonly&&c("is a readonly field, it can not be changed");a["extends"]&&l(b,a["extends"],k,e);if(void0===b)a.optional||c("is missing and it is not optional");elseif(f=f.concat(g(a.type,b)),a.disallow&&!g(a.disallow,b).length&&c(" disallowed value was matched"),null!==b){if(binstanceofArray){if(a.items)if(a.itemsinstanceofArray)for(e=0,d=b.length;e<d;e++)f.concat(l(b[e],a.items[e],k,e));elsefor(e=0,d=b.length;e<d;e++)f.concat(l(b[e],a.items,k,e));a.minItems&&b.length<a.minItems&&c("There must be a minimum of "+a.minItems+" in the array");a.maxItems&&b.length>a.maxItems&&c("There must be a maximum of "+a.maxItems+" in the array")}elsea.properties&&f.concat(m(b,a.properties,k,a.additionalProperties));a.pattern&&"string"==typeofb&&!b.match(a.pattern)&&c("does not match the regex pattern "+a.pattern);a.maxLength&&"string"==typeofb&&b.length>a.maxLength&&c("may only be "+a.maxLength+" characters long");a.minLength&&"string"==typeofb&&b.length<a.minLength&&c("must be at least "+a.minLength+" characters long");typeofb==typeofa.minimum&&a.minimum>b&&c("must have a minimum value of "+a.minimum);typeofb==typeofa.maximum&&a.maximum<b&&c("must have a maximum value of "+a.maximum);if(a["enum"]){e=a["enum"];d=e.length;for(varh,p=0;p<d;p++)if(e[p]===b){h=1;break}h||c("does not have a value in the enumeration "+e.join(", "))}"number"==typeofa.maxDecimal&&b.toString().match(newRegExp("\\.[0-9]{"+(a.maxDecimal+1)+",}"))&&c("may only have "+a.maxDecimal+" digits of decimal places")}returnnull}functionm(b,a,d,e){if("object"==typeofa){("object"!=typeofb||binstanceofArray)&&f.push({property:d,message:"an object is required"});for(varcina)if(a.hasOwnProperty(c)&&("_"!=c.charAt(0)||"_"!=c.charAt(1))){varg=b[c];l(g,a[c],d,c)}}for(cinb)!b.hasOwnProperty(c)||"_"==c.charAt(0)&&"_"==c.charAt(1)||!a||a[c]||!1!==e||f.push({property:d,message:typeofg+"The property "+c+" is not defined in the schema and the schema does not allow additional properties"}),g=a&&a[c]&&a[c].requires,!g||ginb||f.push({property:d,message:"the presence of the property "+c+" requires that "+g+" also be present"}),g=b[c],!a||"object"!=typeofa||cina||l(g,e,d,c),!n&&g&&g.$schema&&(f=f.concat(l(g,g.$schema,d,c)));returnf}varf=[];h&&l(d,h,"",n||"");!n&&d&&d.$schema&&l(d,d.$schema,"","");return{valid:!f.length,errors:f}};returnh.json.schema});