loader-base-min.js revision 92810c498455dfca3072cc0c6d3a49b3a51e9b4c
YUI.add("loader-base",function(D){var M=function(){var g=D.version,f=D.config,a="/build/",b=g+a,Z=D.Env.base,V=f.gallery||"gallery-2010.07.07-19-52",d=V+a,Y="2in3",W=f[Y]||"3",U=f.yui2||"2.8.1",X=Y+"."+W+"/"+U+a,c=Z+"combo?",e={version:g,root:b,base:D.Env.base,comboBase:c,skin:{defaultSkin:"sam",base:"assets/skins/",path:"skin.css",after:["cssreset","cssfonts","cssreset-context","cssfonts-context"]},groups:{},patterns:{}},L=e.groups;L[g]={};L.gallery={base:Z+d,ext:false,combine:true,root:d,comboBase:c,patterns:{"gallery-":{},"gallerycss-":{type:"css"}}};L.yui2={base:Z+X,combine:true,ext:false,root:X,comboBase:c,patterns:{"yui2-":{configFn:function(h){if(/-skin|reset|fonts|grids|base/.test(h.name)){h.type="css";h.path=h.path.replace(/\.js/,".css");h.path=h.path.replace(/\/yui2-skin/,"/assets/skins/sam/yui2-skin");}}}}};YUI.Env[g]=e;};if(!YUI.Env[D.version]){M();}var F={},C=[],N=(D.UA.ie)?2048:8192,A=YUI.Env,P=A._loaded,Q="css",K="js",R=D.version,T="",E=D.Object,J=D.Array,H=YUI.Env._loaderQueue,S=A[R],B="skin-",I=D.Lang,O=A.mods,G=D.cached(function(U,V,W,L){var X=U+"/"+V;if(!L){X+="-min";}X+="."+(W||Q);return X;});D.Env.meta=S;D.Loader=function(V){var U=D.Env.meta.modules,L=this;L.context=D;L.base=D.Env.meta.base;L.comboBase=D.Env.meta.comboBase;L.combine=V.base&&(V.base.indexOf(L.comboBase.substr(0,20))>-1);L.maxURLLength=N;L.root=D.Env.meta.root;L.timeout=0;L.forceMap={};L.allowRollup=true;L.filters={};L.required={};L.patterns={};L.moduleInfo={};L.groups=D.merge(D.Env.meta.groups);L.skin=D.merge(D.Env.meta.skin);L.conditions={};L.config=V;L._config(V);L._internal=true;E.each(U,function(X,W){L.addModule(X,W);});E.each(O,function(X,W){if((!(W in L.moduleInfo))&&("details" in X)){L.addModule(X.details,W);}});L._internal=false;L.sorted=[];L.loaded=P[R];L.dirty=true;L.inserted={};L.skipped={};L.results={};L._requires=D.cached(function(d,c){var Z,b,W,e,f,X=L.moduleInfo,Y=X[d],a=X[c];if(!Y||!a){return false;}b=Y.expanded_map;W=Y.after;e=Y.after_map;if(b&&(c in b)){return true;}if(e&&(c in e)){return true;}else{if(W&&J.indexOf(W,c)>-1){return true;}}f=X[c]&&X[c].supersedes;if(f){for(Z=0;Z<f.length;Z++){if(L._requires(d,f[Z])){return true;}}}if(Y.ext&&Y.type==Q&&!a.ext&&a.type==Q){return true;}return false;});};D.Loader.prototype={FILTER_DEFS:{RAW:{"searchExp":"-min\\.js","replaceStr":".js"},DEBUG:{"searchExp":"-min\\.js","replaceStr":"-debug.js"}},_config:function(Z){var V,U,Y,W,X,a,L=this;if(Z){for(V in Z){if(Z.hasOwnProperty(V)){Y=Z[V];if(V=="require"){L.require(Y);}else{if(V=="skin"){D.mix(L.skin,Z[V],true);}else{if(V=="groups"){for(U in Y){if(Y.hasOwnProperty(U)){a=U;X=Y[U];L.addGroup(X,a);}}}else{if(V=="modules"){E.each(Y,L.addModule,L);}else{if(V=="maxURLLength"){L[V]=Math.min(N,Y);}else{L[V]=Y;}}}}}}}}W=L.filter;if(I.isString(W)){W=W.toUpperCase();L.filterName=W;L.filter=L.FILTER_DEFS[W];if(W=="DEBUG"){L.require("yui-log","dump");}}},formatSkin:D.cached(function(V,L){var U=B+V;if(L){U=U+"-"+L;}return U;}),_addSkin:function(b,Z,a){var Y,X,L,W=this.moduleInfo,U=this.skin,V=W[Z]&&W[Z].ext;if(Z){L=this.formatSkin(b,Z);if(!W[L]){Y=W[Z];X=Y.pkg||Z;this.addModule({name:L,group:Y.group,type:"css",after:U.after,after_map:J.hash(U.after),path:(a||X)+"/"+U.base+b+"/"+Z+".css",ext:V});}}return L;},addGroup:function(W,U){var V=W.modules,L=this;U=U||W.name;W.name=U;L.groups[U]=W;if(W.patterns){E.each(W.patterns,function(Y,X){Y.group=U;L.patterns[X]=Y;});}if(V){E.each(V,function(Y,X){Y.group=U;L.addModule(Y,X);},L);}},addModule:function(h,t){t=t||h.name;h.name=t;if(!h||!h.name){return null;}if(!h.type){h.type=K;}if(!h.path&&!h.fullpath){h.path=G(t,t,h.type);}h.ext=("ext" in h)?h.ext:(this._internal)?false:true;h.requires=h.requires||[];var p=h.submodules,n,k,L,e,V,g,U,m,f,c,Z,X,W,r,q,d,Y,a=this.conditions,b;this.moduleInfo[t]=h;if(!h.langPack&&h.lang){f=J(h.lang);for(m=0;m<f.length;m++){r=f[m];c=this.getLangPackName(r,t);V=this.moduleInfo[c];if(!V){V=this._addLangPack(r,h,c);}}}if(p){L=h.supersedes||[];k=0;for(n in p){if(p.hasOwnProperty(n)){e=p[n];e.path=e.path||G(t,n,h.type);e.pkg=t;e.group=h.group;if(e.supersedes){L=L.concat(e.supersedes);}V=this.addModule(e,n);L.push(n);if(V.skinnable){h.skinnable=true;d=this.skin.overrides;if(d&&d[n]){for(m=0;m<d[n].length;m++){Y=this._addSkin(d[n][m],n,t);L.push(Y);}}Y=this._addSkin(this.skin.defaultSkin,n,t);L.push(Y);}if(e.lang&&e.lang.length){f=J(e.lang);for(m=0;m<f.length;m++){r=f[m];c=this.getLangPackName(r,t);Z=this.getLangPackName(r,n);V=this.moduleInfo[c];if(!V){V=this._addLangPack(r,h,c);}X=X||J.hash(V.supersedes);if(!(Z in X)){V.supersedes.push(Z);}h.lang=h.lang||[];W=W||J.hash(h.lang);if(!(r in W)){h.lang.push(r);}}}k++;}}h.supersedes=E.keys(J.hash(L));h.rollup=(k<4)?k:Math.min(k-1,4);}g=h.plugins;if(g){for(n in g){if(g.hasOwnProperty(n)){U=g[n];U.pkg=t;U.path=U.path||G(t,n,h.type);U.requires=U.requires||[];U.group=h.group;this.addModule(U,n);if(h.skinnable){this._addSkin(this.skin.defaultSkin,n,t);}}}}if(h.condition){b=h.condition.trigger;a[b]=a[b]||{};a[b][t]=h.condition;}if(h.configFn){q=h.configFn(h);if(q===false){delete this.moduleInfo[t];h=null;}}return h;},require:function(U){var L=(typeof U==="string")?arguments:U;this.dirty=true;D.mix(this.required,J.hash(L));},getRequires:function(h){if(!h||h._parsed){return C;}var e,Z,b,k,U,W,X=O[h.name]&&O[h.name].details,g=[],L=h.requires,V=h.optional,f=h.lang||h.intl,Y=this.moduleInfo,c={},a="intl";if(h.temp&&X){delete h.expanded;delete h.temp;if(X.requires){h.requires=h.requires.concat(X.requires);}if(X.optional){h.optional=(h.optional)?h.optional.concat(X.optional):X.optional;}}if(h.expanded&&(!h.langCache||h.langCache==this.lang)){return h.expanded;}h._parsed=true;for(e=0;e<L.length;e++){if(!c[L[e]]){g.push(L[e]);c[L[e]]=true;Z=this.getModule(L[e]);if(Z){k=this.getRequires(Z);f=f||(Z.expanded_map&&(a in Z.expanded_map));for(b=0;b<k.length;b++){g.push(k[b]);}}}}L=h.supersedes;if(L){for(e=0;e<L.length;e++){if(!c[L[e]]){g.push(L[e]);c[L[e]]=true;Z=this.getModule(L[e]);if(Z){k=this.getRequires(Z);f=f||(Z.expanded_map&&(a in Z.expanded_map));
for(b=0;b<k.length;b++){g.push(k[b]);}}}}}if(V&&this.loadOptional){for(e=0;e<V.length;e++){if(!c[V[e]]){g.push(V[e]);c[V[e]]=true;Z=Y[V[e]];k=this.getRequires(Z);f=f||(Z.expanded_map&&(a in Z.expanded_map));for(b=0;b<k.length;b++){g.push(k[b]);}}}}h._parsed=false;if(f){if(h.lang&&!h.langPack&&D.Intl){W=D.Intl.lookupBestLang(this.lang||T,h.lang);h.langCache=this.lang;U=this.getLangPackName(W,h.name);if(U){g.unshift(U);}}g.unshift(a);}h.expanded_map=J.hash(g);h.expanded=E.keys(h.expanded_map);return h.expanded;},getProvides:function(U){var L=this.getModule(U),W,V;if(!L){return F;}if(L&&!L.provides){W={};V=L.supersedes;if(V){J.each(V,function(X){D.mix(W,this.getProvides(X));},this);}W[U]=true;L.provides=W;}return L.provides;},calculate:function(W,V){if(W||V||this.dirty){var U=E.keys(this.required).sort().join()+this.ignoreRegistered+V,L=this.results[U];this.key=U;if(L){this.sorted=E.keys(this._reduce(J.hash(L)));}else{this._config(W);this._setup();this._explode();this._conditions();if(this.allowRollup){this._rollup();}this._reduce();this._sort();}}},_addLangPack:function(Y,L,X){var V=L.name,U=G((L.pkg||V),X,K,true),W=this.moduleInfo[X];if(W){return W;}this.addModule({path:U,intl:true,langPack:true,ext:L.ext,group:L.group,supersedes:[]},X,true);if(Y){D.Env.lang=D.Env.lang||{};D.Env.lang[Y]=D.Env.lang[Y]||{};D.Env.lang[Y][V]=true;}return this.moduleInfo[X];},_setup:function(){var W=this.moduleInfo,U,a,Z,X,V,Y,b,L;for(U in W){if(W.hasOwnProperty(U)){X=W[U];if(X){if(X.skinnable){V=this.skin.overrides;if(V&&V[U]){for(a=0;a<V[U].length;a++){b=this._addSkin(V[U][a],U);X.requires.push(b);}}else{b=this._addSkin(this.skin.defaultSkin,U);X.requires.push(b);}}X.requires=E.keys(J.hash(X.requires));if(X.lang&&X.lang.length){L=this.getLangPackName(T,U);this._addLangPack(null,X,L);}}}}Y={};if(!this.ignoreRegistered){D.mix(Y,A.mods);}if(this.ignore){D.mix(Y,J.hash(this.ignore));}for(Z in Y){if(Y.hasOwnProperty(Z)){D.mix(Y,this.getProvides(Z));}}if(this.force){for(a=0;a<this.force.length;a++){if(this.force[a] in Y){delete Y[this.force[a]];}}}D.mix(this.loaded,Y);},getLangPackName:D.cached(function(U,L){return("lang/"+L+((U)?"_"+U:""));}),_explode:function(){var W=this.required,L,V,U={};this.dirty=false;E.each(W,function(X,Y){if(!U[Y]){U[Y]=true;L=this.getModule(Y);if(L){var Z=L.expound;if(Z){W[Z]=this.getModule(Z);V=this.getRequires(W[Z]);D.mix(W,J.hash(V));}V=this.getRequires(L);D.mix(W,J.hash(V));}}},this);},_conditions:function(){var V,L,U,X,Y=this.conditions,W=this.required;E.each(W,function(Z,a){if(!(a in this.loaded)){V=Y[a];if(V){E.each(V,function(c,b){if(!((b in W)||(b in this.loaded))){if(c){X=(c.ua&&D.UA[c.ua])||(c.test&&c.test(D,W));}if(X){L=this.getModule(b);if(L){W[b]=true;U=this.getRequires(L);D.mix(W,J.hash(U));}}}},this);}}},this);},getModule:function(Y){if(!Y){return null;}var X,W,U,L=this.moduleInfo[Y],V=this.patterns;if(!L){for(U in V){if(V.hasOwnProperty(U)){X=V[U];if(Y.indexOf(U)>-1){W=X;break;}}}if(W){if(X.action){X.action.call(this,Y,U);}else{L=this.addModule(D.merge(W),Y);L.temp=true;}}}return L;},_rollup:function(){},_reduce:function(Y){Y=Y||this.required;var V,U,X,L,W=this.loadType;for(V in Y){if(Y.hasOwnProperty(V)){L=this.getModule(V);if((this.loaded[V]&&!this.forceMap[V]&&!this.ignoreRegistered)||(W&&L&&L.type!=W)){delete Y[V];}else{X=L&&L.supersedes;if(X){for(U=0;U<X.length;U=U+1){if(X[U] in Y){delete Y[X[U]];}}}}}}return Y;},_finish:function(V,U){H.running=false;var L=this.onEnd;if(L){L.call(this.context,{msg:V,data:this.data,success:U});}this._continue();},_onSuccess:function(){var L=D.merge(this.skipped),U;E.each(L,function(V){delete this.inserted[V];},this);this.skipped={};D.mix(this.loaded,this.inserted);U=this.onSuccess;if(U){U.call(this.context,{msg:"success",data:this.data,success:true,skipped:L});}this._finish("success",true);},_onFailure:function(V){var L=this.onFailure,U="failure: "+V.msg;if(L){L.call(this.context,{msg:U,data:this.data,success:false});}this._finish(U,false);},_onTimeout:function(){var L=this.onTimeout;if(L){L.call(this.context,{msg:"timeout",data:this.data,success:false});}this._finish("timeout",false);},_sort:function(){var e=E.keys(this.required),Y={},L=0,V,d,c,X,W,Z,U;for(;;){V=e.length;Z=false;for(X=L;X<V;X++){d=e[X];for(W=X+1;W<V;W++){U=d+e[W];if(!Y[U]&&this._requires(d,e[W])){c=e.splice(W,1);e.splice(X,0,c[0]);Y[U]=true;Z=true;break;}}if(Z){break;}else{L++;}}if(!Z){break;}}this.sorted=e;this.results[this.key]=e;},_insert:function(V,W,U){if(V){this._config(V);}this.calculate(W);this.loadType=U;if(!U){var L=this;this._internalCallback=function(){var Y=L.onCSS,a,Z,X;if(this.insertBefore&&D.UA.ie){a=D.config.doc.getElementById(this.insertBefore);Z=a.parentNode;X=a.nextSibling;Z.removeChild(a);if(X){Z.insertBefore(a,X);}else{Z.appendChild(a);}}if(Y){Y.call(L.context,D);}L._internalCallback=null;L._insert(null,null,K);};this._insert(null,null,Q);return;}this._loading=true;this._combineComplete={};this.loadNext();},_continue:function(){if(!(H.running)&&H.size()>0){H.running=true;H.next()();}},insert:function(V,U){var L=this,W=D.merge(this,true);delete W.require;delete W.dirty;H.add(function(){L._insert(W,V,U);});this._continue();},loadNext:function(X){if(!this._loading){return;}var e,p,o,l,W,b,Y,k,a,d,n,L,Z,h,V,c,q,r,U=this.loadType,g=this,t=function(i){g.loadNext(i.data);},f=function(s){g._combineComplete[U]=true;var m,j=c.length;for(m=0;m<j;m++){g.inserted[c[m]]=true;}t(s);};if(this.combine&&(!this._combineComplete[U])){c=[];this._combining=c;e=this.sorted;p=e.length;r=this.comboBase;W=r;q=[];h={};for(o=0;o<p;o++){Z=r;l=this.getModule(e[o]);d=l&&l.group;if(d){a=this.groups[d];if(!a.combine){l.combine=false;continue;}l.combine=true;if(a.comboBase){Z=a.comboBase;}if(a.root){l.root=a.root;}}h[Z]=h[Z]||[];h[Z].push(l);}for(n in h){if(h.hasOwnProperty(n)){W=n;V=h[n];p=V.length;for(o=0;o<p;o++){l=V[o];if(l&&(l.type===U)&&(l.combine||!l.ext)){L=(l.root||this.root)+l.path;if((W!==n)&&(o<(p-1))&&((L.length+W.length)>this.maxURLLength)){q.push(this._filter(W));
W=n;}W+=L;if(o<(p-1)){W+="&";}c.push(l.name);}}if(c.length&&(W!=n)){q.push(this._filter(W));}}}if(c.length){if(U===Q){b=D.Get.css;k=this.cssAttributes;}else{b=D.Get.script;k=this.jsAttributes;}b(q,{data:this._loading,onSuccess:f,onFailure:this._onFailure,onTimeout:this._onTimeout,insertBefore:this.insertBefore,charset:this.charset,attributes:k,timeout:this.timeout,autopurge:false,context:this});return;}else{this._combineComplete[U]=true;}}if(X){if(X!==this._loading){return;}this.inserted[X]=true;if(this.onProgress){this.onProgress.call(this.context,{name:X,data:this.data});}}e=this.sorted;p=e.length;for(o=0;o<p;o=o+1){if(e[o] in this.inserted){continue;}if(e[o]===this._loading){return;}l=this.getModule(e[o]);if(!l){Y="Undefined module "+e[o]+" skipped";this.skipped[e[o]]=true;continue;}a=(l.group&&this.groups[l.group])||F;if(!U||U===l.type){this._loading=e[o];if(l.type===Q){b=D.Get.css;k=this.cssAttributes;}else{b=D.Get.script;k=this.jsAttributes;}W=(l.fullpath)?this._filter(l.fullpath,e[o]):this._url(l.path,e[o],a.base||l.base);b(W,{data:e[o],onSuccess:t,insertBefore:this.insertBefore,charset:this.charset,attributes:k,onFailure:this._onFailure,onTimeout:this._onTimeout,timeout:this.timeout,autopurge:false,context:g});return;}}this._loading=null;b=this._internalCallback;if(b){this._internalCallback=null;b.call(this);}else{this._onSuccess();}},_filter:function(V,U){var X=this.filter,L=U&&(U in this.filters),W=L&&this.filters[U];if(V){if(L){X=(I.isString(W))?this.FILTER_DEFS[W.toUpperCase()]||null:W;}if(X){V=V.replace(new RegExp(X.searchExp,"g"),X.replaceStr);}}return V;},_url:function(V,L,U){return this._filter((U||this.base||"")+V,L);}};},"@VERSION@",{requires:["get"]});