/*
	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/_base/declare",["./kernel","../has","./lang"],function(y,v,w){function p(c,b){throw Error("declare"+(b?" "+b:"")+": "+c);}function D(c,b){for(var a=[],f=[{cls:0,refs:[]}],d={},g=1,l=c.length,m=0,h,k,e,n,r;m<l;++m){(h=c[m])?"[object Function]"!=t.call(h)&&p("mixin #"+m+" is not a callable constructor.",b):p("mixin #"+m+" is unknown. Did you use dojo.require to pull it in?",b);k=h._meta?h._meta.bases:[h];e=0;for(h=k.length-1;0<=h;--h)n=k[h].prototype,n.hasOwnProperty("declaredClass")||
(n.declaredClass="uniqName_"+E++),n=n.declaredClass,d.hasOwnProperty(n)||(d[n]={count:0,refs:[],cls:k[h]},++g),n=d[n],e&&e!==n&&(n.refs.push(e),++e.count),e=n;++e.count;f[0].refs.push(e)}for(;f.length;){e=f.pop();a.push(e.cls);for(--g;r=e.refs,1==r.length;){e=r[0];if(!e||--e.count){e=0;break}a.push(e.cls);--g}if(e)for(m=0,l=r.length;m<l;++m)e=r[m],--e.count||f.push(e)}g&&p("can't build consistent linearization",b);h=c[0];a[0]=h?h._meta&&h===a[a.length-h._meta.bases.length]?h._meta.bases.length:1:
0;return a}function B(c,b,a,f){var d,g=this._inherited=this._inherited||{};if("string"===typeof c){var l=c;c=b;b=a;a=f}if("function"===typeof c){var m=c;c=b;b=a}else try{m=c.callee}catch(n){if(n instanceof TypeError)p("strict mode inherited() requires the caller function to be passed before arguments",this.declaredClass);else throw n;}(l=l||m.nom)||p("can't deduce a name to call inherited()",this.declaredClass);a=f=0;var h=this.constructor._meta;f=h.bases;var k=g.p;if("constructor"!=l){if(g.c!==m){k=
0;var e=f[0];h=e._meta;if(h.hidden[l]!==m){(d=h.chains)&&"string"==typeof d[l]&&p("calling chained method with inherited: "+l,this.declaredClass);do if(h=e._meta,d=e.prototype,h&&(d[l]===m&&d.hasOwnProperty(l)||h.hidden[l]===m))break;while(e=f[++k]);k=e?k:-1}}if(e=f[++k])if(d=e.prototype,e._meta&&d.hasOwnProperty(l))a=d[l];else{m=q[l];do if(d=e.prototype,(a=d[l])&&(e._meta?d.hasOwnProperty(l):a!==m))break;while(e=f[++k])}a=e&&a||q[l]}else{if(g.c!==m&&(k=0,(h=f[0]._meta)&&h.ctor!==m)){for((d=h.chains)&&
"manual"===d.constructor||p("calling chained constructor with inherited",this.declaredClass);(e=f[++k])&&(!(h=e._meta)||h.ctor!==m););k=e?k:-1}for(;(e=f[++k])&&!(a=(h=e._meta)?h.ctor:e););a=e&&a}g.c=a;g.p=k;if(a)return!0===b?a:a.apply(this,b||c)}function F(c,b,a){return"string"===typeof c?"function"===typeof b?this.__inherited(c,b,a,!0):this.__inherited(c,b,!0):"function"===typeof c?this.__inherited(c,b,!0):this.__inherited(c,!0)}function G(c,b,a,f){var d=this.getInherited(c,b,a);if(d)return d.apply(this,
f||a||b||c)}function H(c){for(var b=this.constructor._meta.bases,a=0,f=b.length;a<f;++a)if(b[a]===c)return!0;return this instanceof c}function I(c,b){for(var a in b)"constructor"!=a&&b.hasOwnProperty(a)&&(c[a]=b[a]);if(v("bug-for-in-skips-shadowed"))for(var f=w._extraNames,d=f.length;d;)a=f[--d],"constructor"!=a&&b.hasOwnProperty(a)&&(c[a]=b[a])}function J(c){u.safeMixin(this.prototype,c);return this}function K(c,b){c instanceof Array||"function"===typeof c||(b=c,c=void 0);b=b||{};c=c||[];return u([this].concat(c),
b)}function L(c,b){return function(){var a=arguments,f=a,d=a[0],g;var l=c.length;if(!(this instanceof a.callee))return z(a);if(b&&(d&&d.preamble||this.preamble)){var m=Array(c.length);m[0]=a;for(g=0;;){(d=a[0])&&(d=d.preamble)&&(a=d.apply(this,a)||a);d=c[g].prototype;(d=d.hasOwnProperty("preamble")&&d.preamble)&&(a=d.apply(this,a)||a);if(++g==l)break;m[g]=a}}for(g=l-1;0<=g;--g)d=c[g],(d=(l=d._meta)?l.ctor:d)&&d.apply(this,m?m[g]:a);(d=this.postscript)&&d.apply(this,f)}}function M(c,b){return function(){var a=
arguments,f=a,d=a[0];if(!(this instanceof a.callee))return z(a);b&&(d&&(d=d.preamble)&&(f=d.apply(this,f)||f),(d=this.preamble)&&d.apply(this,f));c&&c.apply(this,a);(d=this.postscript)&&d.apply(this,a)}}function N(c){return function(){var b=arguments,a=0,f,d;if(!(this instanceof b.callee))return z(b);for(;f=c[a];++a)if(f=(d=f._meta)?d.ctor:f){f.apply(this,b);break}(f=this.postscript)&&f.apply(this,b)}}function O(c,b,a){return function(){var f,d=0,g=1;a&&(d=b.length-1,g=-1);for(;f=b[d];d+=g){var l=
f._meta;(f=(l?l.hidden:f.prototype)[c])&&f.apply(this,arguments)}}}function C(c){A.prototype=c.prototype;c=new A;A.prototype=null;return c}function z(c){var b=c.callee,a=C(b);b.apply(a,c);return a}function u(c,b,a){"string"!=typeof c&&(a=b,b=c,c="");a=a||{};var f,d,g,l=1,m=b;if("[object Array]"==t.call(b)){var h=D(b,c);var k=h[0];l=h.length-k;b=h[l]}else h=[0],b?"[object Function]"==t.call(b)?(k=b._meta,h=h.concat(k?k.bases:b)):p("base class is not a callable constructor.",c):null!==b&&p("unknown base class. Did you use dojo.require to pull it in?",
c);if(b)for(f=l-1;;--f){var e=C(b);if(!f)break;k=h[f];(k._meta?I:x)(e,k.prototype);var n=v("csp-restrictions")?function(){}:new Function;n.superclass=b;n.prototype=e;b=e.constructor=n}else e={};u.safeMixin(e,a);k=a.constructor;k!==q.constructor&&(k.nom="constructor",e.constructor=k);for(f=l-1;f;--f)(k=h[f]._meta)&&k.chains&&(g=x(g||{},k.chains));e["-chains-"]&&(g=x(g||{},e["-chains-"]));b&&b.prototype&&b.prototype["-chains-"]&&(g=x(g||{},b.prototype["-chains-"]));k=!g||!g.hasOwnProperty("constructor");
h[0]=n=g&&"manual"===g.constructor?N(h):1==h.length?M(a.constructor,k):L(h,k);n._meta={bases:h,hidden:a,chains:g,parents:m,ctor:a.constructor};n.superclass=b&&b.prototype;n.extend=J;n.createSubclass=K;n.prototype=e;e.constructor=n;e.getInherited=F;e.isInstanceOf=H;e.inherited=P;e.__inherited=B;c&&(e.declaredClass=c,w.setObject(c,n));if(g)for(d in g)e[d]&&"string"==typeof g[d]&&"constructor"!=d&&(k=e[d]=O(d,h,"after"===g[d]),k.nom=d);return n}var x=w.mixin,q=Object.prototype,t=q.toString,E=0;var A=
v("csp-restrictions")?function(){}:new Function;var P=y.config.isDebug?G:B;y.safeMixin=u.safeMixin=function(c,b){for(g in b){var a=b[g];a===q[g]&&g in q||"constructor"==g||("[object Function]"==t.call(a)&&(a.nom=g),c[g]=a)}if(v("bug-for-in-skips-shadowed")&&b)for(var f=w._extraNames,d=f.length;d;){var g=f[--d];a=b[g];a===q[g]&&g in q||"constructor"==g||("[object Function]"==t.call(a)&&(a.nom=g),c[g]=a)}return c};return y.declare=u});