args[0]:// if there is just a single argument object, just use that as the prototype
mixin(delegate(validArg(base)),args,1);// normally create a delegate to start with
functionConstructor(){
varinstance;
if(thisinstanceofConstructor){
// called with new operator, can proceed as is
instance=this;
}else{
// we allow for direct calls without a new operator, in this case we need to
// create the instance ourself.
Create.prototype=prototype;
instance=newCreate();
}
// call all the constructors with the given arguments
for(vari=0;i<constructorsLength;i++){
varconstructor=constructors[i];
varresult=constructor.apply(instance,arguments);
if(typeofresult=="object"){
if(resultinstanceofConstructor){
instance=result;
}else{
for(varjinresult){
if(result.hasOwnProperty(j)){
instance[j]=result[j];
}
}
}
}
}
returninstance;
}
// create a function that can retrieve the bases (constructors or prototypes)
Constructor._getBases=function(prototype){
returnprototype?prototypes:constructors;
};
// now get the prototypes and the constructors
varconstructors=getBases(args),
constructorsLength=constructors.length;
if(typeofargs[args.length-1]=="object"){
args[args.length-1]=prototype;
}
varprototypes=getBases(args,true);
Constructor.extend=extend;
if(!Compose.secure){
prototype.constructor=Constructor;
}
Constructor.prototype=prototype;
returnConstructor;
};
Compose.apply=function(thisObject,args){
// apply to the target
returnthisObject?
mixin(thisObject,args,0):// called with a target object, apply the supplied arguments as mixins to the target object
extend.apply.call(Compose,0,args);// get the Function.prototype apply function, call() it to apply arguments to Compose (the extend doesn't matter, just a handle way to grab apply, since we can't get it off of Compose)
};
Compose.call=function(thisObject){
// call() should correspond with apply behavior
returnmixin(thisObject,arguments,1);
};
functiongetBases(args,prototype){
// this function registers a set of constructors for a class, eliminating duplicate
// constructors that may result from diamond construction for classes (B->A, C->A, D->B&C, then D() should only call A() once)
varbases=[];
functioniterate(args,checkChildren){
outer:
for(vari=0;i<args.length;i++){
vararg=args[i];
vartarget=prototype&&typeofarg=="function"?
arg.prototype:arg;
if(prototype||typeofarg=="function"){
varargGetBases=checkChildren&&arg._getBases;
if(argGetBases){
iterate(argGetBases(prototype));// don't need to check children for these, this should be pre-flattened
}else{
for(varj=0;j<bases.length;j++){
if(target==bases[j]){
continueouter;
}
}
bases.push(target);
}
}
}
}
iterate(args,true);
returnbases;
}
// returning the export of the module
returnCompose;
});
})(typeofdefine!="undefined"?
define:// AMD/RequireJS format if available
function(deps,factory){
if(typeofmodule!="undefined"){
module.exports=factory();// CommonJS environment, like NodeJS
// require("./configure");
}else{
Compose=factory();// raw script, assign to Compose global
}
});
/*!
* TroopJS Utils URI module
*
* parts of code from parseUri 1.2.2 Copyright Steven Levithan <stevenlevithan.com>
*
* @license TroopJS Copyright 2012, Mikael Karon <mikael@karon.se>
define("template",[],function(){functionf(e){functionl(e,n,r){returnt[f]=n?'" +'+r+'+ "':'";'+r+'o += "',"<%"+String(f++)+"%>"}functionc(e,n){returnt[n]}functionh(e,t){returna[t]||t}vart=[],f=0;return('function template(data) { var o = "'+e.replace(n,"").replace(r,l).replace(s,h).replace(i,c)+'"; return o; }').replace(o,u)}vart={node:function(){vare=require.nodeRequire("fs");returnfunction(n,r){r(e.readFileSync(n,"utf8"))}},browser:function(){vare=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],t,n,r;if(typeofXMLHttpRequest!="undefined")n=XMLHttpRequest;elsee:{for(r=0;r<3;r++){t=e[r];try{n=ActiveXObject(t);breake}catch(i){}}thrownewError("XHR: XMLHttpRequest not available")}returnfunction(t,r){vari=newn;i.open("GET",t,!0),i.onreadystatechange=function(e){i.readyState===4&&r(i.responseText)},i.send(null)}},rhino:function(){vare="utf-8",t=java.lang.System.getProperty("line.separator");returnfunction(r,i){vars=newjava.io.File(r),o=newjava.io.BufferedReader(newjava.io.InputStreamReader(newjava.io.FileInputStream(s),e)),u=newjava.lang.StringBuffer,a,f="";try{a=o.readLine(),a&&a.length()&&a.charAt(0)===65279&&(a=a.substring(1)),u.append(a);while((a=o.readLine())!==null)u.append(t),u.append(a);f=String(u.toString())}finally{o.close()}i(f)}},borked:function(){returnfunction(){thrownewError("Environment unsupported.")}}},n=/^[\n\t\r]+|[\n\t\r]+$/g,r=/<%(=)?([\S\s]*?)%>/g,i=/<%(\d+)%>/gm,s=/(["\n\t\r])/gm,o=/o \+= "";| \+ ""/gm,u="",a={'"':'\\"',"\n":"\\n","":"\\t","\r":"\\r"},l={},c=t[typeofprocess!="undefined"&&process.versions&&!!process.versions.node?"node":typeofwindow!="undefined"&&window.navigator&&window.document||typeofimportScripts!="undefined"?"browser":typeofPackages!="undefined"?"rhino":"borked"]();return{load:function(e,t,n,r){vari=t.toUrl(e);c(i,function(s){try{s="define(function() { return "+f(s,e,i,r.template)+"; })"}catch(o){throwo.message="In "+i+", "+o.message,o}r.isBuild?l[e]=s:s+="\n//@ sourceURL='"+i+"'",n.fromText(e,s),t([e],function(e){n(e)})})},write:function(e,t,n){l.hasOwnProperty(t)&&n.asModule(e+"!"+t,l[t])}}}),function(e){e("compose",[],function(){functione(){}functionn(e){if(!e)thrownewError("Compose arguments must be functions or objects");returne}functionr(e,t,r){vars,o=t.length;for(;r<o;r++){varu=t[r];if(typeofu=="function"){vara=u.prototype;for(varlina){s=a[l];varc=a.hasOwnProperty(l);if(typeofs=="function"&&line&&s!==e[l]){varp=e[l];s==f?s=p:c||(i(s,l,h([].slice.call(t,0,r),!0))?s=p:i(p,l,h([u],!0))||console.error("Conflicted method "+l+", final composer must explicitly override with correct method."))}s&&s.install&&c&&!i(p,l,h([u],!0))?s.install.call(e,l):e[l]=s}}elsefor(varlinn(u)){vars=u[l];if(typeofs=="function"){if(s.install){s.install.call(e,l);continue}if(line&&s==f)continue}e[l]=s}}returne}functioni(e,t,n){for(varr=0;r<n.length;r++){vari=n[r];if(i[t]==e)return!0}}functions(e,t){functionn(){if(t)returnt.apply(this,arguments);thrownewError("Decorator not applied")}returnn.install=e,n}functiono(e){returnfunction(t){returns(functionn(r){vari=this[r];(t=this[r]=i?e(this,i,t):t).install=n},t)}}functionf(){thrownewError("This method is required and no implementation has been provided")}functionl(){vare=[this];returne.push.apply(e,arguments),c.apply(0,e)}functionc(i){functionu(){vart;thisinstanceofu?t=this:(e.prototype=o,t=newe);for(varn=0;n<f;n++){varr=a[n],i=r.apply(t,arguments);if(typeofi=="object")if(iinstanceofu)t=i;elsefor(varsini)i.hasOwnProperty(s)&&(t[s]=i[s])}returnt}vars=arguments,o=s.length<2&&typeofs[0]!="function"?s[0]:r(t(n(i)),s,1);u._getBases=function(e){returne?p:a};vara=h(s),f=a.length;typeofs[s.length-1]=="object"&&(s[s.length-1]=o);varp=h(s,!0);returnu.extend=l,c.secure||(o.constructor=u),u.prototype=o,u}functionh(e,t){functionr(e,i){e:for(vars=0;s<e.length;s++){varo=e[s],u=t&&typeofo=="function"?o.prototype:o;if(t||typeofo=="function"){vara=i&&o._getBases;if(a)r(a(t));else{for(varf=0;f<n.length;f++)if(u==n[f])continuee;n.push(u)}}}}varn=[];returnr(e,!0),n}vart=Object.create?function(e){returnObject.create(typeofe=="function"?e.prototype:e||Object.prototype)}:function(t){e.prototype=typeoft=="function"?t.prototype:t;varn=newe;returne.prototype=null,n};c._setMixin=function(e){r=e},c.Decorator=s,c.around=o(function(e,t,n){returnn.call(e,t)}),c.before=o(function(e,t,n){returnfunction(){vare=n.apply(this,arguments);if(e!==u)returnt.apply(this,e||arguments)}});varu=c.stop={},a;returnc.after=o(function(e,t,n){returnfunction(){vare=t.apply(this,arguments),r=n.apply(this,arguments);returnr===a?e:r}}),c.from=function(e,t){returnt?(typeofe=="function"?e.prototype:e)[t]:s(function(n){if(!(this[n]=typeofe=="string"?this[e]:(typeofe=="function"?e.prototype:e)[t||n]))thrownewError("Source method "+t+" was not available to be renamed to "+n)})},c.create=function(e){varn=r(t(e),arguments,1),i=arguments.length;for(vars=0;s<i;s++){varo=arguments[s];typeofo=="function"&&(n=o.call(n)||n)}returnn},c.required=f,c.apply=function(e,t){returne?r(e,t,0):l.apply.call(c,0,t)},c.call=function(e){returnr(e,arguments,1)},c})}(typeofdefine!="undefined"?define:function(e,t){typeofmodule!="undefined"?module.exports=t():Compose=t()}),define("troopjs-core/component/base",["compose","config"],function(t,n){varr=0;returnt(function(){this.instanceCount=r++},{displayName:"core/component",config:n,toString:functioni(){vare=this;returne.displayName+"@"+e.instanceCount}})}),define("troopjs-core/util/deferred",["jquery"],function(t){returnt.Deferred}),define("troopjs-core/util/unique",[],function(){returnfunction(t){varn=this,r=n.length,i=[],s,o,u,a;e:for(o=u=a=0;o<r;o++,u=0){s=n[o];while(u<a)if(t.call(n,s,i[u++])===!0)continuee;i[a++]=s}returni}}),define("troopjs-core/pubsub/topic",["../component/base","../util/unique"],function(t,n){functions(e,t){returne.publisherInstanceCount===t.publisherInstanceCount}varr=Object.prototype.toString,i=r.call(Array.prototype);returnt.extend(function(t,n,r){vari=this;i.topic=t,i.publisher=n,i.parent=r,i.publisherInstanceCount=n.instanceCount},{displayName:"core/pubsub/topic",toString:functiono(){returnthis.topic},trace:function(){vart=this,o=t.constructor,u,a,f="",l,c,h;while(t){if(r.call(t)===i){c=n.call(t,s);for(l=0,h=c.length;l<h;l++)a=c[l],c[l]=a.constructor===o?a.trace():a.topic;f+=c.join(",");break}u=t.parent,f+=u?t.publisher+":":t.publisher,t=u}returnf}})}),define("troopjs-core/pubsub/hub",["compose","../component/base","./topic"],function(t,n,r){vari=Function,s="memory",o="context",u="callback",a="length",f="head",l="tail",c="next",h="handled",p={},d={},v=0;returnt.create({displayName:"core/pubsub/hub",subscribe:function(t){varn=this,r=arguments[a],v=arguments[1],m=arguments[2],g=arguments[3],y,b,w,E,S,x;if(vinstanceofi)g=v,m=!1,v=p,y=1;elseif(v===!0||v===!1)g=m,m=v,v=p,y=2;elseif(minstanceofi)g=m,m=!1,y=2;else{if(!(ginstanceofi))returnn;y=3}if(tind){b=d[t],w={callback:arguments[y++],context:v},x=linb?b[l][c]=w:b[f]=w;while(y<r)x=x[c]={callback:arguments[y++],context:v};b[l]=x;if(m&&sinb){m=b[s],E=m[h];if(m[a]>0)while(w){if(w[h]===E){w=w[c];continue}w[h]=E,w[u].apply(w[o],m),w=w[c]}elsewhile(w){if(w[h]===E){w=w[c];continue}w[h]=E,w[u].call(w[o]),w=w[c]}}}else{S=x={callback:arguments[y++],context:v};while(y<r)x=x[c]={callback:arguments[y++],context:v};d[t]={head:S,tail:x}}returnn},unsubscribe:function(t){varn=arguments[a],r=arguments[1],s=arguments[2],h,v,m,g,y=null;if(rinstanceofi)s=r,r=p,h=1;else{if(!(sinstanceofi))returnself;h=2}e:{if(!(tind))breake;v=d[t],g=v[f];while(h<n){s=arguments[h++],m=y=g;do{if(m[u]===s&&m[o]===r){if(m===g){g=y=m[c];continue}y[c]=m[c];continue}y=m}while(m=m[c])}g&&y?(v[f]=g,v[l]=y):(deletev[f],deletev[l])}returnthis},publish:function(t){varn,r,i=arguments[h]=v++;if(tind){n=d[t],n[s]=arguments,r=n[f];if(arguments[a]>0)while(r){if(r[h]===i){r=r[c];continue}r[h]=i,r[u].apply(r[o],arguments),r=r[c]}elsewhile(r){if(r[h]===i){r=r[c];continue}r[h]=i,r[u].call(r[o]),r=r[c]}}elsearguments[a]>0&&(d[t]=n={},n[s]=arguments);returnthis}})}),define("troopjs-core/component/gadget",["compose","./base","../util/deferred","../pubsub/hub"],function(t,n,r,i){vars=null,o=Function,u=/^hub(?::(\w+))?\/(.+)/,a=/^sig\/(.+)/,f=i.publish,l=i.subscribe,c=i.unsubscribe,h="memory",p="subscriptions";returnn.extend(function(){varn=this,i=n.constructor._getBases(!0),u,f,l,c,h,p,d={},v,m,g=null;for(c=i.length;c>=0;c--){u=i[c];e:for(ginu){l=u[g];if(!(linstanceofo))continue;m=a.exec(g);if(m!==s){v=m[1];if(vind){f=d[v],h=p=f.length;while(h--)if(l===f[h])continuee;f[p]=l}elsed[v]=[l]}}}t.call(n,{signal:functiony(y,e){vart=this,n,i,s=e;if(yind){n=d[y],i=n.length;while(--i)s=r(function(e){varr=n[i],o=s;e.done(function(){r.call(t,y,o)})});n[0].call(t,y,s)}elsee&&e.resolve();returnt}})},{displayName:"core/component/gadget","sig/initialize":function(t,n){varr=this,a=r[p]=[],f=s,l,c,d;for(finr){l=r[f];if(!(linstanceofo))continue;c=u.exec(f),c!==s&&(d=c[2],i.subscribe(d,r,c[1]===h,l),a[a.length]=[d,r,l],r[f]=s)}returnn&&n.resolve(),r},"sig/finalize":function(t,n){varr=this,s=r[p],o;while(o=s.shift())i.unsubscribe(o[0],o[1],o[2]);returnn&&n.resolve(),r},publish:function(){vart=this;returnf.apply(i,arguments),t},subscribe:function(){vart=this;returnl.apply(i,arguments),t},unsubscribe:function(){vart=this;returnc.apply(i,arguments),t},start:function(t){varn=this;returnr(function(i){r(function(t){n.signal("initialize",t)}).done(function(){n.signal("start",i)}).fail(i.reject),t&&i.then(t.resolve,t.reject)}),n},stop:function(t){varn=this;returnr(function(i){r(function(t){n.signal("stop",t)}).done(function(){n.signal("finalize",i)}).fail(i.reject),t&&i.then(t.resolve,t.reject)}),n}})}),define("troopjs-core/component/service",["./gadget"],function(t){returnt.extend({displayName:"core/component/service"})}),define("troopjs-core/util/merge",[],function(){vart=Array,n=Object;returnfunctionr(e){vari=this,s=null,o,u,a,f;for(o=0,u=arguments.length;o<u;o++){e=arguments[o];for(sine)a=e[s],f=a.constructor,sini?f===t?i[s]=i[s].concat(a):f===n?r.call(i[s],a):i[s]=a:i[s]=a}returni}}),define("troopjs-core/remote/ajax",["../component/service","../pubsub/topic","jquery","../util/merge"],function(t,n,r,i){returnt.extend({displayName:"core/remote/ajax","hub/ajax":function(t,s,o){r.ajax(i.call({headers:{"x-request-id":(newDate).getTime(),"x-components":tinstanceofn?t.trace():t}},s)).then(o.resolve,o.reject)}})}),define("troopjs-core/util/uri",["compose"],function(t){varn=null,r=Function,i=Array,s=i.prototype,o=typeofObject.prototype,u=typeofString.prototype,a=/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:([^?#]*)(?:\?([^#]*))?(?:#(.*))?)/,f="protocol",l="authority",c="path",h="query",p="anchor",d=["source",f,l,"userInfo","user","password","host","port",c,h,p],v=t.secure;t.secure=!0;varm=t(function(t){varr=this,s,a=n,f,l=/(?:&|^)([^&=]*)=?([^&]*)/g;switch(typeoft){caseo:for(aint)r[a]=t[a];break;caseu:while(s=l.exec(str))a=s[1],ainr?(f=r[a],finstanceofi?f[f.length]=s[2]:r[a]=[f,s[2]]):r[a]=s[2]}},{toString:functionb(){vare=this,t=n,s=n,o=[],u=0,a;for(tine){if(e[t]instanceofr)continue;o[u++]=t}o.sort();while(u--){t=o[u],s=e[t];if(sinstanceofi){s=s.slice(0),s.sort(),a=s.length;while(a--)s[a]=t+"="+s[a];o[u]=s.join("&")}elseo[u]=t+"="+s}returno.join("&")}}),g=t(s,function(t){if(!t||t.length===0)return;varn=this,r,i=/(?:\/|^)([^\/]*)/g;while(r=i.exec(t))n.push(r[1])},{toString:functionw(){returnthis.join("/")}}),y=t(function(t){varn=this,r=a.exec(t),i=r.length,s;while(i--)s=r[i],s&&(n[d[i]]=s);hinn&&(n[h]=m(n[h])),cinn&&(n[c]=g(n[c]))},{toString:functionE(){vare=this,t=[f,"://",l,"/",c,"?",h,"#",p],n,r;fine||t.splice(0,3),cine||t.splice(0,2),pine||t.splice(-2,2),hine||t.splice(-2,2),n=t.length;while(n--)r=t[n],rine&&(t[n]=e[r]);returnt.join("")}});returnt.secure=v,y.Path=g,y.Query=m,y}),define("troopjs-core/route/router",["../component/service","../util/uri"],function(t,n){functionu(e){vart=e.data,r=n(e.target.location.hash.replace(o,"")),i=r.toString();i!==t[s]&&(t[s]=i,t.publish(s,r))}varr="hashchange",i="$element",s="route",o=/^#/;returnt.extend(function(t){this[i]=t},{displayName:"core/route/router","sig/initialize":function(t,n){vars=this;returns[i].bind(r,s,u),n&&n.resolve(),s},"sig/start":function(t,n){vars=this;returns[i].trigger(r),n&&n.resolve(),s},"sig/finalize":function(t,n){vars=this;returns[i].unbind(r,u),n&&n.resolve(),s}})}),define("troopjs-core/store/base",["compose","../component/gadget"],function(t,n){varr="storage";returnn.extend({storage:t.required,set:function(t,n,i){this[r].setItem(t,JSON.stringify(n)),i&&i.resolve(n)},get:function(t,n){vari=JSON.parse(this[r].getItem(t));n&&n.resolve(i)},remove:function(t,n){this[r].removeItem(t),n&&n.resolve()},clear:function(t){this[r].clear(),t&&t.resolve()}})}),define("troopjs-core/store/local",["compose","./base"],function(t,n){returnt.create(n,{displayName:"core/store/local",storage:window.localStorage})}),define("troopjs-core/store/session",["compose","./base"],function(t,n){returnt.create(n,{displayName:"core/store/session",storage:window.sessionStorage})}),define("troopjs-core/dimensions/service",["../component/service"],function(t){functioni(e,t,r){e.data.publish(n,t,r)}varn="dimensions",r="$element";returnt.extend(function(t,i){vars=this;s[r]=t,s[n]=i},{displayName:"core/dimensions/service","sig/initialize":function(t,s){varo=this;o[r].bind(n+"."+o[n],o,i),s&&s.resolve()},"sig/start":function(t,i){vars=this;s[r].trigger("resize."+n),i&&i.resolve()},"sig/finalize":function(t,s){varo=this;o[r].unbind(n+"."+o[n],i),s&&s.resolve()}})}),define("troopjs-core/component/widget",["./gadget","jquery","../util/deferred"],function(t,n,r){functionx(e,t,n){returnfunction(){returnf.call(arguments,e),n.apply(t,arguments)}}functionT(e){functiont(){vart=this,n=t[g],i=arguments,u=a.call(i),f=i.length,c=f>0&&i[f-1][w]instanceofs?l.call(i):o;returnc&&c.notifyWith(this,["beforeRender"]),e.call(n,uinstanceofs?u.apply(t,i):u),c&&c.notifyWith(this,["afterRender"]),r(function(t){t.done(function(){n.trigger(m,arguments)}),c&&t.then(c.resolve,c.reject,c.notify),n.find(E).weave(t)}),t}returnt}vari=null,s=Function,o=undefined,u=Array.prototype,a=u.shift,f=u.unshift,l=u.pop,c=n.fn.trigger,h=n.fn.one,p=n.fn.bind,d=n.fn.unbind,v=/^dom(?::(\w+))?\/([^\.]+(?:\.(.+))?)/,m="widget/refresh",g="$element",y="$proxies",b="one",w="then",E="[data-weave]",S="[data-woven]";returnt.extend(function(t,n){varr=this;r[g]=t,n&&(r.displayName=n)},{displayName:"core/component/widget","sig/initialize":function(t,n){varr=this,o=r[g],u=r[y]=[],a=i,f,l,c;for(ainr){f=r[a];if(!(finstanceofs))continue;l=v.exec(a),l!==i&&(c=l[2],f=x(c,r,f),(l[2]===b?h:p).call(o,c,r,f),u[u.length]=[c,f],r[a]=i)}returnn&&n.resolve(),r},"sig/finalize":function(t,n){varr=this,i=r[g],s=r[y],o;while(o=s.shift())i.unbind(o[0],o[1]);returnn&&n.resolve(),r},weave:function(t){varn=this;returnn[g].find(E).weave(t),n},unweave:function(){vart=this;returnt[g].find(S).andSelf().unweave(),this},one:function(){vart=this;returnh.apply(t[g],arguments),t},bind:function(){vart=this;returnp.apply(t[g],arguments),t},unbind:function(){vart=this;returnd.apply(t[g],arguments),t},trigger:function(){vart=this;returnc.apply(t[g],arguments),t},before:T(n.fn.before),after:T(n.fn.after),html:T(n.fn.html),text:T(n.fn.text),append:T(n.fn.append),prepend:T(n.fn.prepend),empty:function(t){varn=this;returnr(function(r){vari=n[g],s=i.contents().detach();i.trigger(m,n),setTimeout(function(){vart=s.get();s.remove(),r.resolve(t)},0),t&&r.then(t.resolve,t.reject)}),n}})}),define("troopjs-core/widget/placeholder",["../component/widget","../util/deferred"],function(t,n){functionp(){vare=this,t=arguments,s=t.length,o=s>0&&t[s-1][h]instanceofi?u.call(t):r;returnn(function(i){vars,u,h,p;if(aine)i.resolve(e[a]);else{i.done(function(n){e[l].attr(f,n),e[a]=n}),h=e[c],p=[e[l],h];for(s=0,u=t.length;s<u;s++)p[s+2]=t[s];require([h],function(t){varr=t.apply(t,p);n(function(t){r.start(t)}).done(function(){i.resolve(r)}).fail(i.reject)})}o&&i.then(o.resolve,o.reject)}),e}functiond(e){vart=this;returnn(function(i){vars;aint?(s=t[a],deletet[a],t[l].removeAttr(f),n(function(t){s.stop(t)}).then(i.resolve,i.reject)):i.resolve(),e&&i.then(e.resolve,e.reject)}),t}varr=undefined,i=Function,s=Array,o=s.prototype,u=o.pop,a="holding",f="data-"+a,l="$element",c="target",h="then";returnt.extend(function(t,n,r){this[c]=r},{displayName:"core/widget/placeholder",release:p,hold:d,finalize:d})}),define("troopjs-core/route/placeholder",["../widget/placeholder"],function(t){varn=null,r="route";returnt.extend(function(t,n){this[r]=RegExp(t.data("route"))},{displayName:"core/route/placeholder","hub:memory/route":function(t,i){vars=this,o=s[r].exec(i.path);o!==n?s.release.apply(s,o.slice(1)):s.hold()}})}),define("troopjs-core/widget/application",["../component/widget","../util/deferred"],function(t,n){returnt.extend({displayName:"core/widget/application","sig/start":function(t,n){varr=this;returnr.weave(n),r},"sig/stop":function(t,n){varr=this;returnr.unweave(n),r}})}),define("troopjs-core/util/each",["jquery"],function(t){returnt.each}),define("troopjs-core/util/grep",["jquery"],function(t){returnt.grep}),define("troopjs-core/util/tr",[],function(){vart=typeofNumber();returnfunction(n){varr=this,i=[],s,o=r.length,u;if(typeofo===t&&o===0||o>0&&0inr&&o-1inr)for(s=0;s<o;s++)i.push(n.call(r,r[s],s));elseif(r)for(uinr)i.push(n.call(r,r[u],u));returni}}),define("troopjs-core/util/when",["jquery"],function(t){returnt.when}),define("troopjs-jquery/action",["jquery"],function(t){functionv(e,t){returne?e+"."+o:i}functionm(e){varn=t(this),i=s.call(arguments,1),a=uine?e[u].type:o,f=e[o];e.type=o+"/"+f+"."+a,n.trigger(e,i),e.result!==r&&(e.type=o+"/"+f+"!",n.trigger(e,i),e.result!==r&&(e.type=o+"."+a,n.trigger(e,i)))}functiong(e){varr=t(e.target).closest("[data-action]");if(r.length===0)return;vars=r.data(),u=a.exec(s[o]);if(u===i)return;varv=u[1],m=u[2],g=u[3];if(m!==n&&!RegExp(m.split(l).join("|")).test(e.type))return;vary=g!==n?g.split(f):[];t.each(y,function(t,r){rins?y[t]=s[r]:c.test(r)?y[t]=r.slice(1,-1):h.test(r)?y[t]=Number(r):p.test(r)?y[t]=d.test(r):y[t]=n}),r.trigger(t.Event(e,{type:o+"!",action:v}),y),e.stopPropagation()}varn=undefined,r=!1,i=null,s=Array.prototype.slice,o="action",u="originalEvent",a=/^([\w\d\s_\-\/]+)(?:\.([\w\.]+))?(?:\((.*)\))?$/,f=/\s*,\s*/,l=/\.+/,c=/^(["']).*\1$/,h=/^\d+$/,p=/^(?:false|true)$/i,d=/^true$/i;t.event.special[o]={setup:function(n,r,i){t(this).bind(o,n,m)},add:function(n){varr=t.map(n.namespace.split(l),v);r.length!==0&&t(this).bind(r.join(""),g)},remove:function(n){varr=t.map(n.namespace.split(l),v);r.length!==0&&t(this).unbind(r.join(""),g)},teardown:function(n){t(this).unbind(o,m)}},t.fn[o]=function(n){returnt(this).trigger({type:o+"!",action:n},s.call(arguments,1))}}),define("troopjs-jquery/destroy",["jquery"],function(t){t.event.special.destroy={remove:function(n){varr=this;n.handler.call(r,t.Event({type:n.type,data:n.data,namespace:n.namespace,target:r}))}}}),define("troopjs-jquery/resize",["jquery"],function(t){functiona(e,n){varo=t.data(n),u=t(n),a=u.width(),f=u.height();(a!==o[i]||f!==o[s])&&u.trigger(r,[o[i]=a,o[s]=f])}functionf(){o.each(a)}varn=null,r="resize",i="w",s="h",o=t([]),u=n;t.event.special[r]={setup:function(n,a,l){varc=this;if(t.isWindow(c))return!1;varh=t.data(c,r,{}),p=t(c);h[i]=p.width(),h[s]=p.height(),o=o.add(c),o.length===1&&(u=setInterval(f,100))},teardown:function(i){vars=this;if(t.isWindow(s))return!1;t.removeData(s,r),o=o.not(s),o.length===0&&u!==n&&clearInterval(u)}}}),define("troopjs-jquery/dimensions",["jquery"],function(t){functiona(e,t){returnt-e}functionf(e){varr=t(this),a=r.width(),f=r.height();t.each(t.data(self,n),function(t,l){varc=l[i],h=l[s],p,d,v;v=c.length,p=c[v-1];while(c[--v]<a)p=c[v];v=h.length,d=h[v-1];while(h[--v]<f)d=h[v];if(p!==l[o]||d!==l[u])l[o]=p,l[u]=d,r.trigger(n+"."+t,[p,d])})}varn="dimensions",r="resize."+n,i="w",s="h",o="_"+i,u="_"+s;t.event.special[n]={setup:function(i,s,o){t(this).bind(r,f).data(n,{})},add:function(r){varo=this,u=r.namespace,f={},l=f[i]=[],c=f[s]=[],h=/(w|h)(\d+)/g,p;while(p=h.exec(u))f[p[1]].push(parseInt(p[2]));l.sort(a),c.sort(a),t.data(o,n)[u]=f},remove:function(r){deletet.data(this,n)[r.namespace]},teardown:function(i){t(this).removeData(n).unbind(r,f)}}}),define("troopjs-jquery/hashchange",["jquery"],function(t){functiona(e){vart=s.exec(e.location.href);returnt&&t[1]?decodeURIComponent(t[1]):""}functionf(e){vart=this,n;t.element=n=e.createElement("iframe"),n.src="about:blank",n.style.display="none"}varn="interval",r="hashchange",i="on"+r,s=/#(.*)$/,o=/\?/,u=!1;f.prototype={getElement:function(){returnthis.element},getHash:function(){returnthis.element.contentWindow.frameHash},update:function(e){vart=this,n=t.element.contentWindow.document;if(t.getHash()===e)return;n.open(),n.write("<html><head><title>' + document.title + '</title><script type='text/javascript'>var frameHash='"+e+"';</script></head><body> </body></html>"),n.close()}},t.event.special[r]={setup:function(s,l,c){varh=this;if(iinh)return!1;if(!t.isWindow(h))thrownewError("Unable to bind 'hashchange' to a non-window object");varp=t(h),d=a(h),v=h.location;p.data(n,h.setInterval(u?function(){vart=h.document,n=v.protocol==="file:",i=newf(t);returnt.body.appendChild(i.getElement()),i.update(d),function(){vart=d,s,u=a(h),f=i.getHash();f!==d&&f!==u?(s=decodeURIComponent(f),d!==s&&(d=s,i.update(d),p.trigger(r,[s,t])),v.hash="#"+encodeURI(n?f.replace(o,"%3F"):f)):u!==d&&(s=decodeURIComponent(u),d!==s&&(d=s,p.trigger(r,[s,t])))}}():function(){vart=d,n,i=a(h);i!==d&&(n=decodeURIComponent(i),d!==n&&(d=n,p.trigger(r,[n,t])))},25))},teardown:function(r){vars=this;if(iins)return!1;s.clearInterval(t.data(s,n))}}}),define("troopjs-jquery/weave",["jquery"],function(t){functionx(e){t(this).unweave()}varn=undefined,r=Array,i=Function,s=r.prototype,o=s.join,u=s.pop,a=t.when,f="then",l="weave",c="unweave",h="woven",p="destroy",d="data-"+l,v="data-"+h,m="["+d+"]",g="["+v+"]",y=/\s*,\s*/,b=/^(["']).*\1$/,w=/^\d+$/,E=/^(?:false|true)$/i,S=/^true$/i;t.fn[l]=function(){varr=[],s=0,c=t(this),g=arguments,T=g.length,N=T>0&&g[T-1][f]instanceofi?u.call(g):n;returnc.filter(m).each(function(i,u){varf=t(u),c=f.data(),m=f.attr(d)||"",T=/[\s,]*([\w_\-\/]+)(?:\(([^\)]+)\))?/g,C=[],k=s,L=0,A;f.data(l,m).data(h,C).removeAttr(d);while(A=T.exec(m))t.Deferred(function(i){varo=L++,u,a,l,h;r[s++]=i,i.done(function(t){C[o]=t});vard=A[1],v=[f,d];for(u=0,l=g.length,a=v.length;u<l;u++,a++)v[a]=g[u];varm=A[2];if(m!==n){m=m.split(y);for(u=0,l=m.length,a=v.length;u<l;u++,a++)h=m[u],hinc?v[a]=c[h]:b.test(h)?v[a]=h.slice(1,-1):w.test(h)?v[a]=Number(h):E.test(h)?v[a]=S.test(h):v[a]=h}require([d],function(n){varr=n.apply(n,v).bind(p,x);N&&N.notifyWith(r,["wired",r]),t.Deferred(function(t){r.start(t)}).done(function(){i.resolve(r)}).fail(i.reject)})});a.apply(t,r.slice(k,s)).done(function(){f.attr(v,o.call(arguments,""))})}),N&&a.apply(t,r).then(N.resolve,N.reject),c},t.fn[c]=function(n){varr=[],i=0,s=t(this);returns.filter(g).each(function(n,s){varo=t(s),u=o.data(h),a;o.removeData(h).removeAttr(v);while(a=u.shift())t.Deferred(function(t){r[i++]=t,a.stop(t)});o.attr(d,o.data(l)).removeData(l).unbind(p,x)}),n&&a.apply(t,r).then(n.resolve,n.reject),s}});