//>>built
define("dojox/lang/aspect",["dojo","dijit","dojox"],function(m,v,t){m.provide("dojox.lang.aspect");(function(){var h=t.lang.aspect,p=Array.prototype,n=[],d,q=function(){this.next_before=this.prev_before=this.next_around=this.prev_around=this.next_afterReturning=this.prev_afterReturning=this.next_afterThrowing=this.prev_afterThrowing=this;this.counter=0};m.extend(q,{add:function(a){var e=m.isFunction(a),c={advice:a,dynamic:e};this._add(c,"before","",e,a);this._add(c,"around","",e,a);this._add(c,"after",
"Returning",e,a);this._add(c,"after","Throwing",e,a);++this.counter;return c},_add:function(a,e,c,b,g){var f=e+c;if(b||g[e]||c&&g[f])e="next_"+f,f="prev_"+f,(a[f]=this[f])[e]=a,(a[e]=this)[f]=a},remove:function(a){this._remove(a,"before");this._remove(a,"around");this._remove(a,"afterReturning");this._remove(a,"afterThrowing");--this.counter},_remove:function(a,e){var c="next_"+e,b="prev_"+e;a[c]&&(a[c][b]=a[b],a[b][c]=a[c])},isEmpty:function(){return!this.counter}});var u=function(){return function(){var a=
arguments.callee,e=a.advices,c,b,g,f;d&&n.push(d);d={instance:this,joinPoint:a,depth:n.length,around:e.prev_around,dynAdvices:[],dynIndex:0};try{for(b=e.prev_before;b!=e;b=b.prev_before)b.dynamic?(d.dynAdvices.push(g=new b.advice(d)),(f=g.before)&&f.apply(g,arguments)):(f=b.advice,f.before.apply(f,arguments));try{c=(e.prev_around==e?a.target:h.proceed).apply(this,arguments)}catch(k){d.dynIndex=d.dynAdvices.length;for(b=e.next_afterThrowing;b!=e;b=b.next_afterThrowing)g=b.dynamic?d.dynAdvices[--d.dynIndex]:
b.advice,(f=g.afterThrowing)&&f.call(g,k),(f=g.after)&&f.call(g);throw k;}d.dynIndex=d.dynAdvices.length;for(b=e.next_afterReturning;b!=e;b=b.next_afterReturning)g=b.dynamic?d.dynAdvices[--d.dynIndex]:b.advice,(f=g.afterReturning)&&f.call(g,c),(f=g.after)&&f.call(g);var r=a._listeners;for(b in r)b in p||r[b].apply(this,arguments)}finally{for(b=0;b<d.dynAdvices.length;++b)g=d.dynAdvices[b],g.destroy&&g.destroy();d=n.length?n.pop():null}return c}};h.advise=function(a,e,c){"object"!=typeof a&&(a=a.prototype);
var b=[];e instanceof Array||(e=[e]);for(var g=0;g<e.length;++g){var f=e[g];if(f instanceof RegExp)for(var d in a)m.isFunction(a[d])&&f.test(d)&&b.push(d);else m.isFunction(a[f])&&b.push(f)}m.isArray(c)||(c=[c]);return h.adviseRaw(a,b,c)};h.adviseRaw=function(a,e,c){if(!e.length||!c.length)return null;for(var b={},g=c.length,f=e.length-1;0<=f;--f){var d=e[f],k=a[d],h=Array(g),l=k.advices;l||(l=a[d]=u(),l.target=k.target||k,l.targetName=d,l._listeners=k._listeners||[],l.advices=new q,l=l.advices);
for(k=0;k<g;++k)h[k]=l.add(c[k]);b[d]=h}return[a,b]};h.unadvise=function(a){if(a){var e=a[0];a=a[1];for(var c in a){for(var b=e[c],d=b.advices,f=a[c],h=f.length-1;0<=h;--h)d.remove(f[h]);if(d.isEmpty()){f=!0;d=b._listeners;if(d.length)for(h in d)if(!(h in p)){f=!1;break}f?e[c]=b.target:(h=e[c]=m._listener.getDispatcher(),h.target=b.target,h._listeners=d)}}}};h.getContext=function(){return d};h.getContextStack=function(){return n};h.proceed=function(){for(var a=d.joinPoint,e=a.advices,c=d.around;c!=
e;c=d.around)if(d.around=c.prev_around,c.dynamic){var c=d.dynAdvices[d.dynIndex++],b=c.around;if(b)return b.apply(c,arguments)}else return c.advice.around.apply(c.advice,arguments);return a.target.apply(d.instance,arguments)}})()});