/*
	Copyright (c) 2004-2016, The JS Foundation All Rights Reserved.
	Available via Academic Free License >= 2.1 OR the modified BSD license.
	see: http://dojotoolkit.org/license for details
*/

//>>built
define("dojo/query","./_base/kernel ./has ./dom ./on ./_base/array ./_base/lang ./selector/_loader ./selector/_loader!default".split(" "),function(l,q,z,A,m,p,B,y){function w(a,b){var c=function(e,f){if("string"==typeof f&&(f=z.byId(f),!f))return new b([]);var h="string"==typeof e?a(e,f):e?e.end&&e.on?e:[e]:[];return h.end&&h.on?h:new b(h)};c.matches=a.match||function(e,f,h){return 0<c.filter([e],f,h).length};c.filter=a.filter||function(e,f,h){return c(f,h).filter(function(C){return-1<m.indexOf(e,
C)})};if("function"!=typeof a){var d=a.search;a=function(e,f){return d(f||document,e)}}return c}q.add("array-extensible",function(){return 1==p.delegate([],{length:1}).length&&!q("bug-for-in-skips-shadowed")});var x=Array.prototype,r=x.slice,D=x.concat,t=m.forEach,u=function(a,b,c){b=[0].concat(r.call(b,0));c=c||l.global;return function(d){b[0]=d;return a.apply(c,b)}},k=function(a){var b=this instanceof g&&q("array-extensible");"number"==typeof a&&(a=Array(a));var c=a&&"length"in a?a:arguments;if(b||
!c.sort){for(var d=b?this:[],e=d.length=c.length,f=0;f<e;f++)d[f]=c[f];if(b)return d;c=d}p._mixin(c,v);c._NodeListCtor=function(h){return g(h)};return c},g=k,v=g.prototype=q("array-extensible")?[]:{};g._wrap=v._wrap=function(a,b,c){a=new (c||this._NodeListCtor||g)(a);return b?a._stash(b):a};g._adaptAsMap=function(a,b){return function(){return this.map(u(a,arguments,b))}};g._adaptAsForEach=function(a,b){return function(){this.forEach(u(a,arguments,b));return this}};g._adaptAsFilter=function(a,b){return function(){return this.filter(u(a,
arguments,b))}};g._adaptWithCondition=function(a,b,c){return function(){var d=arguments,e=u(a,d,c);if(b.call(c||l.global,d))return this.map(e);this.forEach(e);return this}};t(["slice","splice"],function(a){var b=x[a];v[a]=function(){return this._wrap(b.apply(this,arguments),"slice"==a?this:null)}});t(["indexOf","lastIndexOf","every","some"],function(a){var b=m[a];v[a]=function(){return b.apply(l,[this].concat(r.call(arguments,0)))}});p.extend(k,{constructor:g,_NodeListCtor:g,toString:function(){return this.join(",")},
_stash:function(a){this._parent=a;return this},on:function(a,b){var c=this.map(function(d){return A(d,a,b)});c.remove=function(){for(var d=0;d<c.length;d++)c[d].remove()};return c},end:function(){return this._parent?this._parent:new this._NodeListCtor(0)},concat:function(a){var b=r.call(this,0),c=m.map(arguments,function(d){return r.call(d,0)});return this._wrap(D.apply(b,c),this)},map:function(a,b){return this._wrap(m.map(this,a,b),this)},forEach:function(a,b){t(this,a,b);return this},filter:function(a){var b=
arguments,c=this,d=0;if("string"==typeof a){c=n._filterResult(this,b[0]);if(1==b.length)return c._stash(this);d=1}return this._wrap(m.filter(c,b[d],b[d+1]),this)},instantiate:function(a,b){var c=p.isFunction(a)?a:p.getObject(a);b=b||{};return this.forEach(function(d){new c(b,d)})},at:function(){var a=new this._NodeListCtor(0);t(arguments,function(b){0>b&&(b=this.length+b);this[b]&&a.push(this[b])},this);return a._stash(this)}});var n=w(y,k);l.query=w(y,function(a){return k(a)});n.load=function(a,
b,c){B.load(a,b,function(d){c(w(d,k))})};l._filterQueryResult=n._filterResult=function(a,b,c){return new k(n.filter(a,b,c))};l.NodeList=n.NodeList=k;return n});