//>>built
define("dojox/jsonPath/query",["dojo/_base/kernel","dojo/_base/lang"],function(p,x){var n=function(q,n,f){f||(f={});var u=[],p=function(a){return u[a]}.name;if("PATH"==f.resultType&&"RESULT"==f.evalType)throw Error("RESULT based evaluation not supported with PATH based results");var e={resultType:f.resultType||"VALUE",normalize:function(a){var d=[];a=a.replace(/'([^']|'')*'/g,function(a){return p+"("+(u.push(eval(a))-1)+")"});for(var b=-1;b!=d.length;)b=d.length,a=a.replace(/(\??\([^\(\)]*\))/g,function(a){return"#"+
(d.push(a)-1)});a=a.replace(/[\['](#[0-9]+)[\]']/g,"[$1]").replace(/'?\.'?|\['?/g,";").replace(/;;;|;;/g,";..;").replace(/;$|'?\]|'$/g,"");for(b=-1;b!=a;)b=a,a=a.replace(/#([0-9]+)/g,function(a,b){return d[b]});return a.split(";")},asPaths:function(a){var d,b,e,r,f;for(b=0;b<a.length;b++){e="$";r=a[b];d=1;for(f=r.length;d<f;d++)e+=/^[0-9*]+$/.test(r[d])?"["+r[d]+"]":"['"+r[d]+"']";a[b]=e}return a},exec:function(a,d,b){function l(a,c,b){a&&a.hasOwnProperty(c)&&"VALUE"!=e.resultType&&g.push(k.concat([c]));
b?m=a[c]:a&&a.hasOwnProperty(c)&&m.push(a[c])}function f(a){m.push(a);g.push(k);e.walk(a,function(b){if("object"===typeof a[b]){var c=k;k=k.concat(b);f(a[b]);k=c}})}function n(a,b){if(b instanceof Array){var c=b.length,d=0,h=c,e=1;a.replace(/^(-?[0-9]*):(-?[0-9]*):?(-?[0-9]*)$/g,function(a,b,c,f){d=parseInt(b||d,10);h=parseInt(c||h,10);e=parseInt(f||e,10)});d=0>d?Math.max(0,d+c):Math.min(c,d);h=0>h?Math.max(0,h+c):Math.min(c,h);for(c=d;c<h;c+=e)l(b,c)}}function p(a,b){var c=b.match(/^_str\(([0-9]+)\)$/);
return c?u[c[1]]:a}function q(a,c){if(/^\(.*?\)$/.test(c))l(a,e.eval(c,a),b);else if("*"===c)e.walk(a,b&&a instanceof Array?function(b){e.walk(a[b],function(c){l(a[b],c)})}:function(b){l(a,b)});else if(".."===c)f(a);else if(/,/.test(c)){var d,h,g;d=c.split(/'?,'?/);g=0;for(h=d.length;g<h;g++)l(a,p(d[g],c))}else/^\?\(.*?\)$/.test(c)?e.walk(a,function(b){e.eval(c.replace(/^\?\((.*?)\)$/,"$1"),a[b])&&l(a,b)}):/^(-?[0-9]*):(-?[0-9]*):?([0-9]*)$/.test(c)?n(c,a):(c=p(c,c),b&&a instanceof Array&&!/^[0-9*]+$/.test(c)?
e.walk(a,function(b){l(a[b],c)}):l(a,c,b))}for(var k=["$"],m=b?d:[d],g=[k],v,w;a.length;){v=a.shift();if(null===(d=m)||void 0===d)return d;m=[];w=g;g=[];b?q(d,v):e.walk(d,function(a){k=w[a]||k;q(d[a],v)})}if("BOTH"==e.resultType){g=e.asPaths(g);a=[];var t;for(t=0;t<g.length;t++)a.push({path:g[t],value:m[t]});return a}return"PATH"==e.resultType?e.asPaths(g):m},walk:function(a,d){var b,e;if(a instanceof Array)for(b=0,e=a.length;b<e;b++)b in a&&d(b);else if("object"===typeof a)for(b in a)a.hasOwnProperty(b)&&
d(b)},eval:function(a,d){try{return q&&d&&eval(a.replace(/@/g,"v"))}catch(b){throw new SyntaxError("jsonPath: "+b.message+": "+a.replace(/@/g,"v").replace(/\^/g,"_a"));}}};return n&&q?e.exec(e.normalize(n).slice(1),q,"RESULT"==f.evalType):!1};p.isAsync||(x.getObject("dojox.jsonPath",!0).query=n);return n});