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