infusion
Version:
Infusion is an application framework for developing flexible stuff with JavaScript
9 lines • 256 kB
JavaScript
/*!
infusion - v3.0.0-dev.20200326T173810Z.24ddb2718
Friday, March 27th, 2020, 9:20:50 PM
branch: FLUID-6482
revision: 24ddb2718
*/
var fluid_3_0_0=fluid_3_0_0||{},fluid=fluid||fluid_3_0_0;!function($,fluid){"use strict";fluid.version="Infusion 3.0.0",fluid.Error=Error,fluid.environment={fluid:fluid},fluid.global=fluid.global||"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},fluid.invokeLater=function(func){return setTimeout(func,1)},fluid.defeatLogging=!0,fluid.activityTracing=!1,fluid.activityTrace=[];var activityParser=/(%\w+)/g;function transformInternal(source,togo,key,args){for(var transit=source[key],j=0;j<args.length-1;++j)transit=args[j+1](transit,key);togo[key]=transit}fluid.renderOneActivity=function(activity,nowhile){for(var togo=!0===nowhile?[]:[" while "],message=activity.message,index=activityParser.lastIndex=0;;){var match=activityParser.exec(message);if(!match)break;var key=match[1].substring(1);togo.push(message.substring(index,match.index)),togo.push(activity.args[key]),index=activityParser.lastIndex}return index<message.length&&togo.push(message.substring(index)),togo},fluid.renderActivity=function(activityStack,renderer){return renderer=renderer||fluid.renderOneActivity,fluid.transform(activityStack,renderer)},fluid.singleThreadLocal=function(initFunc){var value=initFunc();return function(newValue){return void 0===newValue?value:value=newValue}},fluid.threadLocal=fluid.singleThreadLocal,fluid.globalThreadLocal=fluid.threadLocal(function(){return{}}),fluid.getActivityStack=function(){var root=fluid.globalThreadLocal();return root.activityStack||(root.activityStack=[]),root.activityStack},fluid.describeActivity=fluid.getActivityStack,fluid.logActivity=function(activity){activity=activity||fluid.describeActivity();var rendered=fluid.renderActivity(activity).reverse();0<rendered.length&&(fluid.log("Current activity: "),fluid.each(rendered,function(args){fluid.log.apply(null,args)}))},fluid.pushActivity=function(type,message,args){var record={type:type,message:message,args:args,time:(new Date).getTime()};fluid.activityTracing&&fluid.activityTrace.push(record),fluid.passLogLevel(fluid.logLevel.TRACE)&&fluid.log.apply(null,fluid.renderOneActivity(record,!0)),fluid.getActivityStack().push(record)},fluid.popActivity=function(popframes){popframes=popframes||1,fluid.activityTracing&&fluid.activityTrace.push({pop:popframes});var activityStack=fluid.getActivityStack(),popped=activityStack.length-popframes;activityStack.length=popped<0?0:popped},fluid.FluidError=function(){var togo=Error.apply(this,arguments);this.message=togo.message;try{throw togo}catch(togo){this.stack=togo.stack}return this},fluid.FluidError.prototype=Object.create(Error.prototype),fluid.logFailure=function(args,activity){fluid.log.apply(null,[fluid.logLevel.FAIL,"ASSERTION FAILED: "].concat(args)),fluid.logActivity(activity)},fluid.renderLoggingArg=function(arg){return void 0===arg?"undefined":fluid.isPrimitive(arg)||!fluid.isPlainObject(arg)?arg:JSON.stringify(arg)},fluid.builtinFail=function(args){var message=fluid.transform(args,fluid.renderLoggingArg).join("");throw new fluid.FluidError("Assertion failure - check console for more details: "+message)},fluid.fail=function(){var args=fluid.makeArray(arguments),activity=fluid.makeArray(fluid.describeActivity());fluid.popActivity(activity.length),fluid.failureEvent?fluid.failureEvent.fire(args,activity):(fluid.logFailure(args,activity),fluid.builtinFail(args,activity))},fluid.expect=function(name,target,members){fluid.transform(fluid.makeArray(members),function(key){void 0===target[key]&&fluid.fail(name+" missing required parameter "+key)})},fluid.isLogging=function(){return logLevelStack[0].priority>fluid.logLevel.IMPORTANT.priority},fluid.isLogLevel=function(arg){return fluid.isMarker(arg)&&void 0!==arg.priority},fluid.passLogLevel=function(testLogLevel){return testLogLevel.priority<=logLevelStack[0].priority},fluid.setLogging=function(enabled){var logLevel;"boolean"==typeof enabled?logLevel=fluid.logLevel[enabled?"INFO":"IMPORTANT"]:fluid.isLogLevel(enabled)?logLevel=enabled:fluid.fail("Unrecognised fluid logging level ",enabled),logLevelStack.unshift(logLevel),fluid.defeatLogging=!fluid.isLogging()},fluid.setLogLevel=fluid.setLogging,fluid.popLogging=function(){var togo=1===logLevelStack.length?logLevelStack[0]:logLevelStack.shift();return fluid.defeatLogging=!fluid.isLogging(),togo},fluid.doBrowserLog=function(args){"undefined"!=typeof console&&(console.debug?console.debug.apply(console,args):"function"==typeof console.log&&console.log.apply(console,args))},fluid.log=function(){var directArgs=fluid.makeArray(arguments),userLogLevel=fluid.logLevel.INFO;fluid.isLogLevel(directArgs[0])&&(userLogLevel=directArgs.shift()),fluid.passLogLevel(userLogLevel)&&fluid.loggingEvent.fire(directArgs)},fluid.isValue=function(value){return null!=value},fluid.isPrimitive=function(value){var valueType=typeof value;return!value||"string"===valueType||"boolean"===valueType||"number"===valueType||"function"===valueType},fluid.isJQuery=function(totest){return Boolean(totest&&totest.jquery&&totest.constructor&&totest.constructor.prototype&&totest.constructor.prototype.jquery)},fluid.isArrayable=function(totest){return Boolean(totest)&&("[object Array]"===Object.prototype.toString.call(totest)||fluid.isJQuery(totest))},fluid.isPlainObject=function(totest,strict){var string=Object.prototype.toString.call(totest);return"[object Array]"===string?!strict:"[object Object]"===string&&(!totest.constructor||!totest.constructor.prototype||Object.prototype.hasOwnProperty.call(totest.constructor.prototype,"isPrototypeOf"))},fluid.typeCode=function(totest){return fluid.isPrimitive(totest)||!fluid.isPlainObject(totest)?"primitive":fluid.isArrayable(totest)?"array":"object"},fluid.isIoCReference=function(ref){return"string"==typeof ref&&"{"===ref.charAt(0)&&0<ref.indexOf("}")},fluid.isDOMNode=function(obj){return obj&&"number"==typeof obj.nodeType},fluid.isComponent=function(obj){return obj&&obj.constructor===fluid.componentConstructor},fluid.isUncopyable=function(totest){return fluid.isPrimitive(totest)||!fluid.isPlainObject(totest)},fluid.isApplicable=function(totest){return totest.apply&&"function"==typeof totest.apply},fluid.identity=function(arg){return arg},fluid.notImplemented=function(){fluid.fail("This operation is not implemented")},fluid.firstDefined=function(a,b){return void 0===a?b:a},fluid.freshContainer=function(tocopy){return fluid.isArrayable(tocopy)?[]:{}},fluid.testStrategyRecursion=function(funcName,segs){segs.length>fluid.strategyRecursionBailout&&fluid.fail("Runaway recursion encountered in "+funcName+" - reached path depth of "+fluid.strategyRecursionBailout+" via path of "+segs.join(".")+"this object is probably circularly connected. Either adjust your object structure to remove the circularity or increase fluid.strategyRecursionBailout")},fluid.copyRecurse=function(tocopy,segs){return fluid.testStrategyRecursion("fluid.copy",segs),fluid.isUncopyable(tocopy)?tocopy:fluid.transform(tocopy,function(value,key){segs.push(key);var togo=fluid.copyRecurse(value,segs);return segs.pop(),togo})},fluid.copy=function(tocopy){return fluid.copyRecurse(tocopy,[])},fluid.extend=$.extend,fluid.makeArray=function(arg){var togo=[];if(null!=arg)if(fluid.isPrimitive(arg)||fluid.isPlainObject(arg,!0)||"number"!=typeof arg.length)togo.push(arg);else for(var i=0;i<arg.length;++i)togo[i]=arg[i];return togo},fluid.pushArray=function(holder,member,topush){var array=holder[member]?holder[member]:holder[member]=[];fluid.isArrayable(topush)?array.push.apply(array,topush):array.push(topush)},fluid.transform=function(source){if(fluid.isPrimitive(source))return source;var togo=fluid.freshContainer(source);if(fluid.isArrayable(source))for(var i=0;i<source.length;++i)transformInternal(source,togo,i,arguments);else for(var key in source)transformInternal(source,togo,key,arguments);return togo},fluid.each=function(source,func){if(fluid.isArrayable(source))for(var i=0;i<source.length;++i)func(source[i],i);else for(var key in source)func(source[key],key)},fluid.make_find=function(find_if){var target=!find_if&&void 0;return function(source,func,deffolt){var disp;if(fluid.isArrayable(source)){for(var i=0;i<source.length;++i)if((disp=func(source[i],i))!==target)return find_if?source[i]:disp}else for(var key in source)if((disp=func(source[key],key))!==target)return find_if?source[key]:disp;return deffolt}},fluid.find=fluid.make_find(!1),fluid.find_if=fluid.make_find(!0),fluid.accumulate=function(list,fn,arg){for(var i=0;i<list.length;++i)arg=fn(list[i],arg,i);return arg},fluid.add=function(a,b){return a+b},fluid.remove_if=function(source,fn,target){if(fluid.isArrayable(source))for(var i=source.length-1;0<=i;--i)fn(source[i],i)&&(target&&target.unshift(source[i]),source.splice(i,1));else for(var key in source)fn(source[key],key)&&(target&&(target[key]=source[key]),delete source[key]);return target||source},fluid.generate=function(n,generator,applyFunc){for(var togo=[],i=0;i<n;++i)togo[i]=applyFunc?generator(i):generator;return togo},fluid.iota=function(count,first){first=first||0;for(var togo=[],i=0;i<count;++i)togo[togo.length]=first++;return togo},fluid.getMembers=function(holder,name){return fluid.transform(holder,function(member){return fluid.get(member,name)})},fluid.filterKeys=function(toFilter,keys,exclude){return fluid.remove_if($.extend({},toFilter),function(value,key){return exclude^-1===keys.indexOf(key)})},fluid.censorKeys=function(toCensor,keys){return fluid.filterKeys(toCensor,keys,!0)},fluid.keys=function(obj){var togo=[];for(var key in obj)togo.push(key);return togo},fluid.values=function(obj){var togo=[];for(var key in obj)togo.push(obj[key]);return togo},fluid.contains=function(obj,value){return obj?fluid.isArrayable(obj)?-1!==obj.indexOf(value):fluid.find(obj,function(thisValue){if(value===thisValue)return!0}):void 0},fluid.keyForValue=function(obj,value){return fluid.find(obj,function(thisValue,key){if(value===thisValue)return key})},fluid.arrayToHash=function(array){var togo={};return fluid.each(array,function(el){togo[el]=!0}),togo},fluid.stableSort=function(array,func){for(var i=0;i<array.length;i++){var j,k=array[i];for(j=i;0<j&&func(k,array[j-1])<0;j--)array[j]=array[j-1];array[j]=k}},fluid.hashToArray=function(hash,keyName,func){var togo=[];return fluid.each(hash,function(el,key){var newEl={};newEl[keyName]=key,func?newEl=func(newEl,el,key)||newEl:$.extend(!0,newEl,el),togo.push(newEl)}),togo},fluid.flatten=function(array){var togo=[];return fluid.each(array,function(element){fluid.isArrayable(element)?togo=togo.concat(element):togo.push(element)}),togo},fluid.clear=function(target){if(fluid.isArrayable(target))target.length=0;else for(var i in target)delete target[i]},fluid.compareStringLength=function(ascending){return ascending?function(a,b){return a.length-b.length}:function(a,b){return b.length-a.length}},fluid.parseInteger=function(string){return isFinite(string)&&string%1==0?Number(string):NaN},fluid.roundToDecimal=function(num,scale,method){return scale=scale&&0<=scale?Math.round(scale):0,"ceil"===method||"floor"===method?Number(Math[method](num+"e"+scale)+"e-"+scale):Number((0<=num?1:-1)*(Math.round(Math.abs(num)+"e"+scale)+"e-"+scale))},fluid.debounce=function(func,wait,immediate){var timeout,result;return function(){var context=this,args=arguments,callNow=immediate&&!timeout;return clearTimeout(timeout),timeout=setTimeout(function(){timeout=null,immediate||(result=func.apply(context,args))},wait),callNow&&(result=func.apply(context,args)),result}},fluid.freezeRecursive=function(tofreeze,segs){return segs=segs||[],fluid.testStrategyRecursion("fluid.freezeRecursive",segs),fluid.isPlainObject(tofreeze)?(fluid.each(tofreeze,function(value,key){segs.push(key),fluid.freezeRecursive(value,segs),segs.pop()}),Object.freeze(tofreeze)):tofreeze},fluid.marker=function(){},fluid.makeMarker=function(value,extra){var togo=Object.create(fluid.marker.prototype);return togo.value=value,$.extend(togo,extra),Object.freeze(togo)},fluid.VALUE=fluid.makeMarker("VALUE"),fluid.NO_VALUE=fluid.makeMarker("NO_VALUE"),fluid.EXPAND=fluid.makeMarker("EXPAND"),fluid.isMarker=function(totest,type){return totest instanceof fluid.marker&&(!type||totest.value===type.value)},fluid.logLevelsSpec={FATAL:0,FAIL:5,WARN:10,IMPORTANT:12,INFO:15,TRACE:20},fluid.logLevel=fluid.transform(fluid.logLevelsSpec,function(value,key){return fluid.makeMarker(key,{priority:value})});var logLevelStack=[fluid.logLevel.IMPORTANT];fluid.model={},fluid.model.copyModel=function(target,source){fluid.clear(target),$.extend(!0,target,source)},fluid.model.parseEL=function(EL){return""===EL?[]:String(EL).split(".")},fluid.model.composePath=function(prefix,suffix){return""===prefix?suffix:""===suffix?prefix:prefix+"."+suffix},fluid.model.composeSegments=function(){return fluid.makeArray(arguments).join(".")},fluid.lastDotIndex=function(path){return path.lastIndexOf(".")},fluid.model.getToTailPath=function(path){var lastdot=fluid.lastDotIndex(path);return-1===lastdot?"":path.substring(0,lastdot)},fluid.model.getTailPath=function(path){var lastdot=fluid.lastDotIndex(path);return path.substring(lastdot+1)},fluid.path=fluid.model.composeSegments,fluid.composePath=fluid.model.composePath,fluid.requireDataBinding=function(){fluid.fail("Please include DataBinding.js in order to operate complex model accessor configuration")},fluid.model.setWithStrategy=fluid.model.getWithStrategy=fluid.requireDataBinding,fluid.model.resolvePathSegment=function(root,segment,create,origEnv){if(!origEnv&&root.resolvePathSegment){var togo=root.resolvePathSegment(segment);if(void 0!==togo)return togo}return create&&void 0===root[segment]?root[segment]={}:root[segment]},fluid.model.parseToSegments=function(EL,parseEL,copy){return"number"==typeof EL||"string"==typeof EL?parseEL(EL):copy?fluid.makeArray(EL):EL},fluid.model.pathToSegments=function(EL,config){var parser=config&&config.parser?config.parser.parse:fluid.model.parseEL;return fluid.model.parseToSegments(EL,parser)},fluid.model.accessImpl=function(root,EL,newValue,config,initSegs,returnSegs,traverser){var segs=fluid.model.pathToSegments(EL,config),initPos=0;if(initSegs&&(initPos=initSegs.length,segs=initSegs.concat(segs)),root=traverser(root,segs,initPos,config,newValue===fluid.NO_VALUE?0:1),newValue===fluid.NO_VALUE||newValue===fluid.VALUE)return returnSegs?{root:root,segs:segs}:root;root[segs[segs.length-1]]=newValue},fluid.model.accessSimple=function(root,EL,newValue,environment,initSegs,returnSegs){return fluid.model.accessImpl(root,EL,newValue,environment,initSegs,returnSegs,fluid.model.traverseSimple)},fluid.model.traverseSimple=function(root,segs,initPos,environment,uncess){for(var origEnv=environment,limit=segs.length-uncess,i=0;i<limit;++i){if(!root)return;var segment=segs[i];root=environment&&environment[segment]?environment[segment]:fluid.model.resolvePathSegment(root,segment,1===uncess,origEnv),environment=null}return root},fluid.model.setSimple=function(root,EL,newValue,environment,initSegs){fluid.model.accessSimple(root,EL,newValue,environment,initSegs,!1)},fluid.model.getSimple=function(root,EL,environment,initSegs){return null==EL||0===EL.length?root:fluid.model.accessSimple(root,EL,fluid.NO_VALUE,environment,initSegs,!1)},fluid.getImmediate=function(root,segs,i){for(var limit=void 0===i?segs.length:i+1,j=0;j<limit;++j)root=root?root[segs[j]]:void 0;return root},fluid.decodeAccessorArg=function(arg3){return arg3&&arg3!==fluid.model.defaultGetConfig&&arg3!==fluid.model.defaultSetConfig?"environment"===arg3.type?arg3.value:void 0:null},fluid.set=function(root,EL,newValue,config,initSegs){var env=fluid.decodeAccessorArg(config);void 0===env?fluid.model.setWithStrategy(root,EL,newValue,config,initSegs):fluid.model.setSimple(root,EL,newValue,env,initSegs)},fluid.get=function(root,EL,config,initSegs){var env=fluid.decodeAccessorArg(config);return void 0===env?fluid.model.getWithStrategy(root,EL,config,initSegs):fluid.model.accessImpl(root,EL,fluid.NO_VALUE,env,null,!1,fluid.model.traverseSimple)},fluid.getGlobalValue=function(path,env){if(path)return env=env||fluid.environment,fluid.get(fluid.global,path,{type:"environment",value:env})},fluid.bind=function(obj,fnName,args){return obj[fnName].apply(obj,fluid.makeArray(args))},fluid.invokeGlobalFunction=function(functionPath,args,environment){var func=fluid.getGlobalValue(functionPath,environment);if(func)return func.apply(null,fluid.isArrayable(args)?args:fluid.makeArray(args));fluid.fail("Error invoking global function: "+functionPath+" could not be located")},fluid.registerGlobalFunction=function(functionPath,func,env){env=env||fluid.environment,fluid.set(fluid.global,functionPath,func,{type:"environment",value:env})},fluid.setGlobalValue=fluid.registerGlobalFunction,fluid.registerNamespace=function(naimspace,env){env=env||fluid.environment;var existing=fluid.getGlobalValue(naimspace,env);return existing||(existing={},fluid.setGlobalValue(naimspace,existing,env)),existing},fluid.dumpEl=fluid.identity,fluid.renderTimestamp=fluid.identity,fluid.generateUniquePrefix=function(){return Math.floor(1e12*Math.random()).toString(36)+"-"};var fluid_prefix=fluid.generateUniquePrefix();fluid.fluidInstance=fluid_prefix;var fluid_guid=1;fluid.allocateGuid=function(){return fluid_prefix+fluid_guid++},fluid.registerNamespace("fluid.event"),fluid.extremePriority=4e9,fluid.priorityTypes={first:-1,last:1,before:0,after:0},fluid.extremalPriorities={none:0,testing:10,authoring:20},fluid.parsePriorityConstraint=function(constraint,fixedOnly,site){var segs=constraint.split(":"),type=segs[0],lookup=fluid.priorityTypes[type];return void 0===lookup&&fluid.fail("Invalid constraint type in priority field "+constraint+": the only supported values are "+fluid.keys(fluid.priorityTypes).join(", ")+" or numeric"),fixedOnly&&0===lookup&&fluid.fail("Constraint type in priority field "+constraint+" is not supported in a "+site+" record - you must use either a numeric value or first, last"),{type:segs[0],target:segs[1]}},fluid.parsePriority=function(priority,count,fixedOnly,site){var togo={count:count||0,fixed:null,constraint:null,site:site};"number"==typeof(priority=priority||0)?togo.fixed=-priority:togo.constraint=fluid.parsePriorityConstraint(priority,fixedOnly,site);var multiplier=togo.constraint?fluid.priorityTypes[togo.constraint.type]:0;if(0!==multiplier){var target=togo.constraint.target||"none",extremal=fluid.extremalPriorities[target];void 0===extremal&&fluid.fail("Unrecognised extremal priority target "+target+": the currently supported values are "+fluid.keys(fluid.extremalPriorities).join(", ")+": register your value in fluid.extremalPriorities"),togo.fixed=multiplier*(fluid.extremePriority+extremal)}return null!==togo.fixed&&(togo.fixed+=togo.count/1024),togo},fluid.renderPriority=function(parsed){return parsed.constraint?parsed.constraint.target?parsed.constraint.type+":"+parsed.constraint.target:parsed.constraint.type:Math.floor(parsed.fixed)},fluid.compareByPriority=function(recA,recB){return null!==recA.priority.fixed&&null!==recB.priority.fixed?recA.priority.fixed-recB.priority.fixed:(null===recA.priority.fixed)-(null===recB.priority.fixed)},fluid.honourConstraint=function(array,firstConstraint,c){var constraint=array[c].priority.constraint,matchIndex=fluid.find(array,function(element,index){return element.namespace===constraint.target?index:void 0},-1);if(-1===matchIndex)return!0;if(firstConstraint<=matchIndex)return!1;for(var target=matchIndex+("after"===constraint.type?1:0),temp=array[c],shift=c;target<=shift;--shift)array[shift]=array[shift-1];return array[target]=temp,!0},fluid.sortByPriority=function(array){fluid.stableSort(array,fluid.compareByPriority);for(var firstConstraint=fluid.find(array,function(element,index){return element.priority.constraint&&0===fluid.priorityTypes[element.priority.constraint.type]?index:void 0},array.length);;){if(firstConstraint===array.length)return array;for(var oldFirstConstraint=firstConstraint,c=firstConstraint;c<array.length;++c){fluid.honourConstraint(array,firstConstraint,c)&&++firstConstraint}if(firstConstraint===oldFirstConstraint){var holders=array.slice(firstConstraint);fluid.fail("Could not find targets for any constraints in "+holders[0].priority.site+" ",holders,": none of the targets ("+fluid.getMembers(holders,"priority.constraint.target").join(", ")+") matched any namespaces of the elements in (",array.slice(0,firstConstraint),") - this is caused by either an invalid or circular reference")}}},fluid.parsePriorityRecords=function(records,name){var array=fluid.hashToArray(records,"namespace",function(newElement,oldElement){$.extend(newElement,oldElement),newElement.priority=fluid.parsePriority(oldElement.priority,0,!1,name)});return fluid.sortByPriority(array),array},fluid.event.identifyListener=function(listener,soft){return"string"==typeof listener||listener.$$fluid_guid||soft||(listener.$$fluid_guid=fluid.allocateGuid()),listener.$$fluid_guid},fluid.event.impersonateListener=function(origListener,newListener){fluid.event.identifyListener(origListener),newListener.$$fluid_guid=origListener.$$fluid_guid},fluid.event.sortListeners=function(listeners){var togo=[];return fluid.each(listeners,function(oneNamespace){for(var headHard,i=0;i<oneNamespace.length;++i){var thisListener=oneNamespace[i];thisListener.softNamespace||headHard||(headHard=thisListener)}headHard?togo.push(headHard):togo=togo.concat(oneNamespace)}),fluid.sortByPriority(togo)},fluid.event.resolveListener=function(listener){var listenerName=listener.globalName||("string"==typeof listener?listener:null);if(listenerName){var listenerFunc=fluid.getGlobalValue(listenerName);listenerFunc?listener=listenerFunc:fluid.fail("Unable to look up name "+listenerName+" as a global function")}return listener},fluid.nameComponent=function(that){return that?"component with typename "+that.typeName+" and id "+that.id:"[unknown component]"},fluid.event.nameEvent=function(that,eventName){return eventName+" of "+fluid.nameComponent(that)},fluid.makeEventFirer=function(options){var that,name=(options=options||{}).name||"<anonymous>";return that={eventId:fluid.allocateGuid(),name:name,ownerId:options.ownerId,typeName:"fluid.event.firer",destroy:function(){that.destroyed=!0},addListener:function(){(function(){that.listeners={},that.byId={},that.sortedListeners=[],that.addListener=function(listener,namespace,priority,softNamespace,listenerId){var record;if(that.destroyed&&fluid.fail("Cannot add listener to destroyed event firer "+that.name),listener){fluid.isPlainObject(listener,!0)&&!fluid.isApplicable(listener)&&(listener=(record=listener).listener,namespace=record.namespace,priority=record.priority,softNamespace=record.softNamespace,listenerId=record.listenerId),"string"==typeof listener&&(listener={globalName:listener});var id=listenerId||fluid.event.identifyListener(listener);namespace=namespace||id,record=$.extend(record||{},{namespace:namespace,listener:listener,softNamespace:softNamespace,listenerId:listenerId,priority:fluid.parsePriority(priority,that.sortedListeners.length,!1,"listeners")}),that.byId[id]=record,(that.listeners[namespace]=fluid.makeArray(that.listeners[namespace]))[softNamespace?"push":"unshift"](record),that.sortedListeners=fluid.event.sortListeners(that.listeners)}},that.addListener.apply(null,arguments)}).apply(null,arguments)},removeListener:function(listener){if(that.listeners){var namespace,id,record;"string"==typeof listener?(namespace=listener,(record=that.listeners[namespace])||(id=namespace,namespace=null)):"function"==typeof listener&&((id=fluid.event.identifyListener(listener,!0))||fluid.fail("Cannot remove unregistered listener function ",listener," from event "+that.name));var rec=that.byId[id],softNamespace=rec&&rec.softNamespace;namespace=namespace||rec&&rec.namespace||id,delete that.byId[id],(record=that.listeners[namespace])&&(softNamespace?fluid.remove_if(record,function(thisLis){return thisLis.listener.$$fluid_guid===id||thisLis.listenerId===id}):record.shift(),0===record.length&&delete that.listeners[namespace]),that.sortedListeners=fluid.event.sortListeners(that.listeners)}},fire:function(){var listeners=that.sortedListeners;if(listeners&&!that.destroyed)for(var i=0;i<listeners.length;++i){var lisrec=listeners[i];"function"!=typeof lisrec.listener&&(lisrec.listener=fluid.event.resolveListener(lisrec.listener));var value,ret=lisrec.listener.apply(null,arguments);if((options.preventable&&!1===ret||that.destroyed)&&(value=!1),void 0!==value)return value}}}},fluid.fireEvent=function(component,eventName,args){var firer=component.events[eventName];firer&&firer.fire.apply(null,fluid.makeArray(args))},fluid.event.addListenerToFirer=function(firer,value,namespace,wrapper){if(wrapper=wrapper||fluid.identity,fluid.isArrayable(value))for(var i=0;i<value.length;++i)fluid.event.addListenerToFirer(firer,value[i],namespace,wrapper);else"function"==typeof value||"string"==typeof value?wrapper(firer).addListener(value,namespace):value&&"object"==typeof value&&wrapper(firer).addListener(value.listener,namespace||value.namespace,value.priority,value.softNamespace,value.listenerId)},fluid.event.resolveListenerRecord=function(records){return{records:records}},fluid.expandImmediate=function(material){fluid.fail("fluid.expandImmediate could not be loaded - please include FluidIoC.js in order to operate IoC-driven event with descriptor "+material)},fluid.mergeListeners=function(that,events,listeners){fluid.each(listeners,function(value,key){var firer,namespace;if(fluid.isIoCReference(key))(firer=fluid.expandImmediate(key,that))||fluid.fail("Error in listener record: key "+key+' could not be looked up to an event firer - did you miss out "events." when referring to an event firer?');else{var keydot=key.indexOf(".");-1!==keydot&&(namespace=key.substring(keydot+1),key=key.substring(0,keydot)),events[key]||fluid.fail("Listener registered for event "+key+" which is not defined for this component"),firer=events[key]}var record=fluid.event.resolveListenerRecord(value,that,key,namespace,!0);fluid.event.addListenerToFirer(firer,record.records,namespace,record.adderWrapper)})},fluid.eventFromRecord=function(eventSpec,eventKey,that){var event;return eventSpec&&("string"!=typeof eventSpec||fluid.isIoCReference(eventSpec))?fluid.event.resolveEvent?event=fluid.event.resolveEvent(that,eventKey,eventSpec):fluid.fail("fluid.event.resolveEvent could not be loaded - please include FluidIoC.js in order to operate IoC-driven event with descriptor ",eventSpec):event=fluid.makeEventFirer({name:fluid.event.nameEvent(that,eventKey),preventable:"preventable"===eventSpec,ownerId:that.id}),event},fluid.instantiateFirers=function(that,options){fluid.each(options.events,function(eventSpec,eventKey){that.events[eventKey]=fluid.eventFromRecord(eventSpec,eventKey,that)})},fluid.mergeListenerPolicy=function(target,source,key){return"string"!=typeof key&&fluid.fail("Error in listeners declaration - the keys in this structure must resolve to event names - got "+key+" from ",source),!fluid.isIoCReference(key)&&-1!==key.indexOf(".")?source||target:fluid.arrayConcatPolicy(target,source)},fluid.makeMergeListenersPolicy=function(merger,modelRelay){return function(target,source){return target=target||{},modelRelay&&(fluid.isArrayable(source)||"string"==typeof source.target)?target[""]=merger(target[""],source,""):fluid.each(source,function(listeners,key){target[key]=merger(target[key],listeners,key)}),target}},fluid.validateListenersImplemented=function(that){var errors=[];return fluid.each(that.events,function(event,name){fluid.each(event.sortedListeners,function(lisrec){lisrec.listener!==fluid.notImplemented&&"fluid.notImplemented"!==lisrec.listener.globalName||errors.push({name:name,namespace:lisrec.namespace,componentSource:fluid.model.getSimple(that.options.listeners,[name+"."+lisrec.namespace,0,"componentSource"])})})}),errors},fluid.unique=function(array){return fluid.remove_if(array,function(element,i){return!element||0<i&&element===array[i-1]})},fluid.arrayConcatPolicy=function(target,source){return fluid.makeArray(target).concat(fluid.makeArray(source))},fluid.loggingEvent=fluid.makeEventFirer({name:"logging event"}),fluid.addTimestampArg=function(args){var arg0=fluid.renderTimestamp(new Date)+": ";args.unshift(arg0)},fluid.loggingEvent.addListener(fluid.doBrowserLog,"log"),fluid.loggingEvent.addListener(fluid.identity,"filterArgs","before:log"),fluid.loggingEvent.addListener(fluid.addTimestampArg,"addTimestampArg","after:filterArgs"),fluid.failureEvent=fluid.makeEventFirer({name:"failure event"}),fluid.failureEvent.addListener(fluid.builtinFail,"fail"),fluid.failureEvent.addListener(fluid.logFailure,"log","before:fail"),fluid.pushSoftFailure=function(condition){"function"==typeof condition?fluid.failureEvent.addListener(condition,"fail"):-1===condition?fluid.failureEvent.removeListener("fail"):"boolean"==typeof condition&&fluid.fail("pushSoftFailure with boolean value is no longer supported")},fluid.componentConstructor=function(){},fluid.typeTag=function(name){var that=Object.create(fluid.componentConstructor.prototype);return that.typeName=name,that.id=fluid.allocateGuid(),that};var gradeTick=1,gradeTickStore={};function regenerateCursor(source,segs,limit,sourceStrategy){for(var i=0;i<limit;++i)source=sourceStrategy(source,segs[i],i,fluid.makeArray(segs));return source}fluid.defaultsStore={},fluid.resolveGradesImpl=function(gs,gradeNames){for(var i=(gradeNames=fluid.makeArray(gradeNames)).length-1;0<=i;--i){var gradeName=gradeNames[i];if(gradeName&&!gs.gradeHash[gradeName]){var options=(fluid.isIoCReference(gradeName)?null:fluid.rawDefaults(gradeName))||{},thisTick=gradeTickStore[gradeName]||gradeTick-1;gs.lastTick=Math.max(gs.lastTick,thisTick),gs.gradeHash[gradeName]=!0,gs.gradeChain.push(gradeName);for(var oGradeNames=fluid.makeArray(options.gradeNames),j=oGradeNames.length-1;0<=j;--j)fluid.resolveGradesImpl(gs,oGradeNames[j])}}return gs},fluid.resolveGradeStructure=function(defaultName,gradeNames){var gradeStruct={lastTick:0,gradeChain:[],gradeHash:{}};return fluid.resolveGradesImpl(gradeStruct,[defaultName].concat(fluid.makeArray(gradeNames))),gradeStruct.gradeChain.reverse(),gradeStruct},fluid.hasGrade=function(options,gradeName){return!(!options||!options.gradeNames)&&fluid.contains(options.gradeNames,gradeName)},fluid.resolveGrade=function(defaults,defaultName,gradeNames){var gradeStruct=fluid.resolveGradeStructure(defaultName,gradeNames),mergeArgs=fluid.transform(gradeStruct.gradeChain,fluid.rawDefaults,fluid.copy);fluid.remove_if(mergeArgs,function(options){return!options});for(var mergePolicy={},i=0;i<mergeArgs.length;++i)mergeArgs[i]&&mergeArgs[i].mergePolicy&&(mergePolicy=$.extend(!0,mergePolicy,mergeArgs[i].mergePolicy));mergeArgs=[mergePolicy,{}].concat(mergeArgs);var mergedDefaults=fluid.merge.apply(null,mergeArgs);return mergedDefaults.gradeNames=gradeStruct.gradeChain,fluid.freezeRecursive(mergedDefaults),{defaults:mergedDefaults,lastTick:gradeStruct.lastTick}},fluid.mergedDefaultsCache={},fluid.gradeNamesToKey=function(defaultName,gradeNames){return defaultName+"|"+gradeNames.join("|")},fluid.getMergedDefaults=function(defaultName,gradeNames){gradeNames=fluid.makeArray(gradeNames);var key=fluid.gradeNamesToKey(defaultName,gradeNames),mergedDefaults=fluid.mergedDefaultsCache[key];if(mergedDefaults){for(var lastTick=0,searchGrades=mergedDefaults.defaults.gradeNames||[],i=0;i<searchGrades.length;++i)lastTick=Math.max(lastTick,gradeTickStore[searchGrades[i]]||0);lastTick>mergedDefaults.lastTick&&(fluid.passLogLevel(fluid.logLevel.TRACE)&&fluid.log(fluid.logLevel.TRACE,"Clearing cache for component "+defaultName+" with gradeNames ",searchGrades),mergedDefaults=null)}if(!mergedDefaults){var defaults=fluid.rawDefaults(defaultName);if(!defaults)return defaults;mergedDefaults=fluid.mergedDefaultsCache[key]=fluid.resolveGrade(defaults,defaultName,gradeNames)}return mergedDefaults.defaults},fluid.upgradePrimitiveFunc=function(rec,key){if(rec&&fluid.isPrimitive(rec)){var togo={};return togo[key||("string"==typeof rec&&"{"!==rec.charAt(0)?"funcName":"func")]=rec,togo.args=fluid.NO_VALUE,togo}return rec},fluid.annotateListeners=function(componentName,options){options.listeners=fluid.transform(options.listeners,function(record){var togo=fluid.makeArray(record);return fluid.transform(togo,function(onerec){return(onerec=fluid.upgradePrimitiveFunc(onerec,"listener")).componentSource=componentName,onerec})}),options.invokers=fluid.transform(options.invokers,function(record){return(record=fluid.upgradePrimitiveFunc(record))&&(record.componentSource=componentName),record})},fluid.rawDefaults=function(componentName){var entry=fluid.defaultsStore[componentName];return entry&&entry.options},fluid.registerRawDefaults=function(componentName,options){fluid.pushActivity("registerRawDefaults","registering defaults for grade %componentName with options %options",{componentName:componentName,options:options});var optionsCopy=fluid.expandCompact?fluid.expandCompact(options):fluid.copy(options);fluid.annotateListeners(componentName,optionsCopy);var callerInfo=fluid.getCallerInfo&&fluid.getCallerInfo(6);fluid.defaultsStore[componentName]={options:optionsCopy,callerInfo:callerInfo},gradeTickStore[componentName]=gradeTick++,fluid.popActivity()},fluid.doIndexDefaults=function(defaultName,defaults,index,indexSpec){for(var requiredGrades=fluid.makeArray(indexSpec.gradeNames),i=0;i<requiredGrades.length;++i)if(!fluid.hasGrade(defaults,requiredGrades[i]))return;for(var keys=("function"==typeof indexSpec.indexFunc?indexSpec.indexFunc:fluid.getGlobalValue(indexSpec.indexFunc))(defaults)||[],j=0;j<keys.length;++j)fluid.pushArray(index,keys[j],defaultName)},fluid.indexDefaults=function(indexName,indexSpec){var index={};for(var defaultName in fluid.defaultsStore){var defaults=fluid.getMergedDefaults(defaultName);fluid.doIndexDefaults(defaultName,defaults,index,indexSpec)}return index},fluid.defaults=function(componentName,options){if(void 0===options)return fluid.getMergedDefaults(componentName);options&&options.options&&fluid.fail("Probable error in options structure for "+componentName+' with option named "options" - perhaps you meant to write these options at top level in fluid.defaults? - ',options),fluid.registerRawDefaults(componentName,options);var gradedDefaults=fluid.getMergedDefaults(componentName);fluid.hasGrade(gradedDefaults,"fluid.function")||fluid.makeComponentCreator(componentName)},fluid.makeComponentCreator=function(componentName){var creator=function(){var defaults=fluid.getMergedDefaults(componentName);if(defaults.gradeNames&&0!==defaults.gradeNames.length){if(defaults.initFunction)return fluid.initComponent(componentName,arguments);for(var blankGrades=[],i=0;i<defaults.gradeNames.length;++i){var gradeName=defaults.gradeNames[i];fluid.rawDefaults(gradeName)||blankGrades.push(gradeName)}0===blankGrades.length?fluid.fail("Cannot make component creator for type "+componentName+" which does not have an initFunction defined"):fluid.fail("The grade hierarchy of component with type "+componentName+" is incomplete - it inherits from the following grade(s): "+blankGrades.join(", ")+" for which the grade definitions are corrupt or missing. Please check the files which might include these grades and ensure they are readable and have been loaded by this instance of Infusion")}else fluid.fail("Cannot make component creator for type "+componentName+" which does not have any gradeNames defined")},existing=fluid.getGlobalValue(componentName);existing&&$.extend(creator,existing),fluid.setGlobalValue(componentName,creator)},fluid.emptyPolicy=fluid.freezeRecursive({}),fluid.derefMergePolicy=function(policy){return(policy?policy["*"]:fluid.emptyPolicy)||fluid.emptyPolicy},fluid.compileMergePolicy=function(mergePolicy){var builtins={},defaultValues={},togo={builtins:builtins,defaultValues:defaultValues};return mergePolicy&&fluid.each(mergePolicy,function(value,key){var parsed={},builtin=!0;if("function"==typeof value)parsed.func=value;else if("object"==typeof value)parsed=value;else if(fluid.isDefaultValueMergePolicy(value))fluid.set(defaultValues,key,"{that}.options."+value),builtin=!(togo.hasDefaults=!0);else for(var split=value.split(/\s*,\s*/),i=0;i<split.length;++i)parsed[split[i]]=!0;builtin&&fluid.set(builtins,fluid.composePath(key,"*"),parsed)}),togo},fluid.isDefaultValueMergePolicy=function(policy){return"string"==typeof policy&&-1===policy.indexOf(",")&&!/replace|nomerge|noexpand/.test(policy)},fluid.mergeOneImpl=function(thisTarget,thisSource,j,sources,newPolicy,i,segs){var togo=thisTarget,primitiveTarget=fluid.isPrimitive(thisTarget);return void 0!==thisSource&&(newPolicy.func||null===thisSource||!fluid.isPlainObject(thisSource)||newPolicy.nomerge?(sources[j]=void 0,togo=newPolicy.func?newPolicy.func.call(null,thisTarget,thisSource,segs[i-1],segs,i):thisSource):primitiveTarget&&(togo=thisTarget=fluid.freshContainer(thisSource))),togo},fluid.fetchMergeChildren=function(target,i,segs,sources,mergePolicy,options){for(var thisPolicy=fluid.derefMergePolicy(mergePolicy),j=sources.length-1;0<=j;--j){var source=sources[j];if(void 0!==source&&(fluid.each(source,function(newSource,name){var childPolicy=fluid.concreteTrundler(mergePolicy,name);name in target&&(!options.evaluateFully||void 0!==childPolicy||fluid.isPrimitive(target[name]))||(segs[i]=name,options.strategy(target,name,i+1,segs,sources,mergePolicy))}),thisPolicy.replace))break}return target},fluid.inEvaluationMarker=Object.freeze({__CURRENTLY_IN_EVALUATION__:!0}),fluid.strategyRecursionBailout=50,fluid.makeMergeStrategy=function(options){var strategy=function(target,name,i,segs,sources,policy){if(i>fluid.strategyRecursionBailout&&fluid.fail("Overflow/circularity in options merging, current path is ",segs," at depth ",i,' - please protect components from merging using the "nomerge" merge policy'),!fluid.isPrimitive(target)){var oldTarget;if(fluid.isTracing&&fluid.tracing.pathCount.push(fluid.path(segs.slice(0,i))),name in target){if(oldTarget=target[name],!options.evaluateFully)return oldTarget}else target!==fluid.inEvaluationMarker&&(target[name]=fluid.inEvaluationMarker);void 0===sources&&(segs=fluid.makeArray(segs),sources=function(sources,segs,limit,sourceStrategies){for(var togo=[],i=0;i<sources.length;++i){var thisSource=regenerateCursor(sources[i],segs,limit,sourceStrategies[i]);void 0!==thisSource&&togo.push(thisSource)}return togo}(options.sources,segs,i-1,options.sourceStrategies),policy=regenerateCursor(options.mergePolicy,segs,i-1,fluid.concreteTrundler));var start,limit,mul,newPolicyHolder=fluid.concreteTrundler(policy,name),newPolicy=fluid.derefMergePolicy(newPolicyHolder);mul=newPolicy.replace?(start=1-sources.length,limit=0,-1):(start=0,limit=sources.length-1,1);for(var thisTarget,newSources=[],j=start;j<=limit;++j){var k=mul*j,thisSource=options.sourceStrategies[k](sources[k],name,i,segs);if(void 0!==thisSource&&(fluid.isPrimitive(thisSource)||(newSources[k]=thisSource),void 0===oldTarget)){if(-1===mul){thisTarget=target[name]=thisSource;break}thisTarget=fluid.mergeOneImpl(thisTarget,thisSource,j,newSources,newPolicy,i,segs,options),target!==fluid.inEvaluationMarker&&(target[name]=thisTarget)}}return void 0!==oldTarget&&(thisTarget=oldTarget),0<newSources.length&&fluid.isPlainObject(thisTarget)&&fluid.fetchMergeChildren(thisTarget,i,segs,newSources,newPolicyHolder,options),void 0===oldTarget&&0===newSources.length&&delete target[name],thisTarget}};return options.strategy=strategy},fluid.driveStrategy=function(root,pathSegs,strategy){pathSegs=fluid.makeArray(pathSegs);for(var i=0;i<pathSegs.length;++i){if(!root)return;root=strategy(root,pathSegs[i],i+1,pathSegs)}return root},fluid.concreteTrundler=function(source,seg){return source?source[seg]:void 0},fluid.merge=function(policy){var sources=Array.prototype.slice.call(arguments,1),compiled=fluid.compileMergePolicy(policy).builtins,options=fluid.makeMergeOptions(compiled,sources,{});return options.initter(),options.target},fluid.simpleGingerBlock=function(source,recordType){return{target:source,simple:!0,strategy:fluid.concreteTrundler,initter:fluid.identity,recordType:recordType,priority:fluid.mergeRecordTypes[recordType]}},fluid.makeMergeOptions=function(policy,sources,userOptions){var options={mergePolicy:policy,sources:sources};return(options=$.extend(options,userOptions)).target=options.target||fluid.freshContainer(options.sources[0]),options.sourceStrategies=options.sourceStrategies||fluid.generate(options.sources.length,fluid.concreteTrundler),options.initter=function(){options.evaluateFully=!0,fluid.fetchMergeChildren(options.target,0,[],options.sources,options.mergePolicy,options)},fluid.makeMergeStrategy(options),options},fluid.transformOptions=function(options,transRec){return fluid.expect("Options transformation record",transRec,["transformer","config"]),fluid.getGlobalValue(transRec.transformer).call(null,options,transRec.config)},fluid.findMergeBlocks=function(mergeBlocks,recordType){return fluid.remove_if(fluid.makeArray(mergeBlocks),function(block){return block.recordType!==recordType})},fluid.transformOptionsBlocks=function(mergeBlocks,transformOptions,recordTypes){fluid.each(recordTypes,function(recordType){var blocks=fluid.findMergeBlocks(mergeBlocks,recordType);fluid.each(blocks,function(block){var source=block.source?"source":"target";block[block.simple||"target"===source?"target":"source"]=fluid.transformOptions(block[source],transformOptions)})})},fluid.dedupeDistributionNamespaces=function(mergeBlocks){var byNamespace={};fluid.remove_if(mergeBlocks,function(mergeBlock){var ns=mergeBlock.namespace;if(ns){if(byNamespace[ns]&&byNamespace[ns]!==mergeBlock.contextThat.id)return!0;byNamespace[ns]=mergeBlock.contextThat.id}})},fluid.deliverOptionsStrategy=fluid.identity,fluid.computeComponentAccessor=fluid.identity,fluid.computeDynamicComponents=fluid.identity,fluid.mergeRecordTypes={defaults:1e3,defaultValueMerge:900,subcomponentRecord:800,user:700,distribution:100},fluid.model.applyChangeRequest=function(model,request){var segs=request.segs;if(0===segs.length)"ADD"===request.type?$.extend(!0,model,request.value):fluid.clear(model);else if("ADD"===request.type)fluid.model.setSimple(model,request.segs,request.value);else{for(var i=0;i<segs.length-1;++i)if(!(model=model[segs[i]]))return;delete model[segs[segs.length-1]]}},fluid.destroyValue=function(target,segs){target&&fluid.model.applyChangeRequest(target,{type:"DELETE",segs:segs})},fluid.mergeComponentOptions=function(that,componentName,userOptions,localOptions){var rawDefaults=fluid.rawDefaults(componentName),defaults=fluid.getMergedDefaults(componentName,rawDefaults&&rawDefaults.gradeNames?null:localOptions.gradeNames),sharedMergePolicy={},mergeBlocks=[];mergeBlocks=fluid.expandComponentOptions?mergeBlocks.concat(fluid.expandComponentOptions(sharedMergePolicy,defaults,userOptions,that)):mergeBlocks.concat([fluid.simpleGingerBlock(defaults,"defaults"),fluid.simpleGingerBlock(userOptions,"user")]);var options={},sourceStrategies=[],sources=[],baseMergeOptions={target:options,sourceStrategies:sourceStrategies},updateBlocks=function(){fluid.each(mergeBlocks,function(block){fluid.isPrimitive(block.priority)&&(block.priority=fluid.parsePriority(block.priority,0,!1,"options distribution"))}),fluid.sortByPriority(mergeBlocks),fluid.dedupeDistributionNamespaces(mergeBlocks),sourceStrategies.length=0,sources.length=0,fluid.each(mergeBlocks,function(block){sourceStrategies.push(block.strategy),sources.push(block.target)})};updateBlocks();var compiledPolicy,mergePolicy,mergeOptions=fluid.makeMergeOptions(sharedMergePolicy,sources,baseMergeOptions);function computeMergePolicy(){mergePolicy=fluid.driveStrategy(options,"mergePolicy",mergeOptions.strategy),mergePolicy=$.extend({},fluid.rootMergePolicy,mergePolicy),compiledPolicy=fluid.compileMergePolicy(mergePolicy),$.extend(!0,sharedMergePolicy,compiledPolicy.builtins)}mergeOptions.mergeBlocks=mergeBlocks,mergeOptions.updateBlocks=updateBlocks,mergeOptions.destroyValue=function(segs){for(var i=0;i<mergeBlocks.length;++i)mergeBlocks[i].immutableTarget||fluid.destroyValue(mergeBlocks[i].target,segs);fluid.destroyValue(baseMergeOptions.target,segs)},computeMergePolicy(),mergeOptions.computeMergePolicy=computeMergePolicy,compiledPolicy.hasDefaults&&(fluid.generateExpandBlock?(mergeBlocks.push(fluid.generateExpandBlock({options:compiledPolicy.defaultValues,recordType:"defaultValueMerge",priority:fluid.mergeRecordTypes.defaultValueMerge},that,{})),updateBlocks()):fluid.fail("Cannot operate mergePolicy ",mergePolicy," for component ",that," without including FluidIoC.js")),that.options=options,fluid.driveStrategy(options,"gradeNames",mergeOptions.strategy),fluid.deliverOptionsStrategy(that,options,mergeOptions),fluid.computeComponentAccessor(that,userOptions&&userOptions.localRecord);var transformOptions=fluid.driveStrategy(options,"transformOptions",mergeOptions.strategy);return transformOptions&&(fluid.transformOptionsBlocks(mergeBlocks,transformOptions,["user","subcomponentRecord"]),updateBlocks()),baseMergeOptions.target.mergePolicy||computeMergePolicy(),mergeOptions},fluid.defaults("fluid.function",{}),fluid.invokeGradedFunction=function(name,spec){var defaults=fluid.defaults(name);defaults&&defaults.argumentMap&&fluid.hasGrade(defaults,"fluid.function")||fluid.fail("Cannot look up name "+name+" to a function with registered argumentMap - got defaults ",defaults);var args=[];return fluid.each(defaults.argumentMap,function(value,key){args[value]=spec[key]}),fluid.invokeGlobalFunction(name,args)},fluid.noNamespaceDistributionPrefix="no-namespace-distribution-",fluid.mergeOneDistribution=function(target,source,key){var namespace=source.namespace||key||fluid.noNamespaceDistributionPrefix+fluid.allocateGuid();target[source.namespace=namespace]=$.extend(!0,{},target[namespace],source)},fluid.distributeOptionsPolicy=function(target,source){if(target=target||{},fluid.isArrayable(source))for(var i=0;i<source.length;++i)fluid.mergeOneDistribution(target,source[i]);else"string"==typeof source.target?fluid.mergeOneDistribution(target,source):fluid.each(source,function(oneSource,key){fluid.mergeOneDistribution(target,oneSource,key)});return target},fluid.mergingArray=function(){},fluid.mergingArray.prototype=[],fluid.membersMergePolicy=function(target,source){return target=target||{},fluid.each(source,function(oneSource,key){target[key]||(target[key]=new fluid.mergingArray),oneSource instanceof fluid.mergingArray?target[key].push.apply(target[key],oneSource):void 0!==oneSource&&target[key].push(oneSource)}),target},fluid.invokerStrategies=fluid.arrayToHash(["func","funcName","listener","this","method","changePath","value"]),fluid.invokersMergePolicy=function(target,source){return target=target||{},fluid.each(source,function(oneInvoker,name){if(oneInvoker){oneInvoker=fluid.upgradePrimitiveFunc(oneInvoker);var oneT=target[name];for(var key in oneT||(oneT=target[name]={}),fluid.invokerStrategies)if(key in oneInvoker)for(var key2 in fluid.invokerStrategies)oneT[key2]=void 0;$.extend(oneT,oneInvoker)}else target[name]=oneInvoker}),target},fluid.rootMergePolicy={gradeNames:fluid.arrayConcatPolicy,distributeOptions:fluid.distributeOptionsPolicy,members:{noexpand:!0,func:fluid.membersMergePolicy},invokers:{noexpand:!0,func:fluid.invokersMergePolicy},transformOptions:"replace",listeners:fluid.makeMergeListenersPolicy(fluid.mergeListenerPolicy)},fluid.defaults("fluid.component",{initFunction:"fluid.initLittleComponent",mergePolicy:fluid.rootMergePolicy,argumentMap:{options:0},events:{onCreate:null,onDestroy:null,afterDestroy:null}}),fluid.defaults("fluid.emptySubcomponent",{gradeNames:["fluid.component"]}),fluid.computeNickName=function(typeName){var segs=fluid.model.parseEL(typeName);return segs[segs.length-1]},fluid.defaults("fluid.typeFount",{gradeNames:["fluid.component"]}),fluid.initLittleComponent=function(name,userOptions,localOptions,receiver){var that=fluid.typeTag(name);that.lifecycleStatus="constructing",localOptions=localOptions||{gradeNames:"fluid.component"},that.destroy=fluid.makeRootDestroy(that);var mergeOptions=fluid.mergeComponentOptions(that,name,userOptions,localOptions);mergeOptions.exceptions={members:{model:!0,modelRelay:!0}};var options=that.options;that.events={},(receiver||fluid.identity)(that,options,mergeOptions.strategy),fluid.computeDynamicComponents(that,mergeOptions);for(var i=0;i<mergeOptions.mergeBlocks.length;++i)mergeOptions.mergeBlocks[i].initter();return mergeOptions.initter(),delete options.mergePolicy,fluid.instantiateFirers(that,options),fluid.mergeListeners(that,that.events,options.listeners),that},fluid.diagnoseFailedView=fluid.identity,fluid.makeRootDestroy=function(that){return function(){fluid.doDestroy(that),fluid.fireEvent(that,"afterDestroy",[that,"",null])}},fluid.isDestroyed=function(that){return"destroyed"===that.lifecycleStatus},fluid.doDestroy=function(that,name,parent){for(var key in fluid.fireEvent(that,"onDestroy",[that,name||"",parent]),that.lifecycleStatus="destroyed",that.events)"afterDestroy"!==key&&"function"==typeof that.events[key].destroy&&that.events[key].destroy();that.applier&&that.applier.destroy()},fluid.initComponent=function(componentName,initArgs){var options=fluid.defaults(componentName);options.gradeNames||fluid.fail("Cannot initialise component "+componentName+" which has no gradeName registered");var that,args=[componentName].concat(fluid.makeArray(initArgs));fluid.pushActivity("initComponent","constructing component of type %componentName with arguments %initArgs",{componentName:componentName,initArgs:initArgs}),that=fluid.invokeGlobalFunction(options.initFunction,args),fluid.diagnoseFailedView(componentName,that,options,args),fluid.initDependents&&fluid.initDependents(that);var errors=fluid.validateListenersImplemented(that);return 0<errors.length&&fluid.fail(fluid.transform(errors,function(error){return["Error constructing component ",that," - the listener for event "+error.name+" with namespace "+error.namespace+(error.componentSource?" which was defined in grade "+error.componentSource:"")+" needs to be overridden with a concrete implementation"]})).join("\n"),"constructing"===that.lifecycleStatus&&(that.lifecycleStatus="constructed"),that.events.onCreate.fire(that),fluid.popActivity(),that},fluid.initSubcomponentImpl=function(that,entry,args){var togo;if("function"!=typeof entry){var entryType="string"==typeof entry?entry:entry.type;togo="fluid.emptySubcomponent"===entryType?null:fluid.invokeGlobalFunction(entryType,args)}else togo=entry.apply(null,args);return togo};fluid.simpleCSSMatcher={regexp:new RegExp("([#.]?)((?:[\\w\\u00c0-\\uFFFF*_-]|\\\\.)+)","g"),charToTag:{"":"tag","#":"id",".":"clazz"}},fluid.IoCSSMatcher={regexp:new RegExp("([&#]?)((?:[\\w\\u00c0-\\uFFFF*_-]|\\.|\\/)+)","g"),charToTag:{"":"context","&":"context","#":"id"}};var childSeg=new RegExp("\\s*(>)?\\s*","g");fluid.parseSelector=function(selstring,strategy){var togo=[];selstring=selstring.trim();for(var regexp=strategy.regexp,lastIndex=regexp.lastIndex=0;;){for(var atNode=[],first=!0;;){var segMatch=regexp.exec(selstring);if(!segMatch)break;if(segMatch.index!==lastIndex){if(!first)break;fluid.fail("Error in selector string - cannot match child selector expression starting at "+selstring.substring(lastIndex))}var thisNode={},text=segMatch[2],targetTag=strategy.charToTag[segMatch[1]];targetTag&&(thisNode[targetTag]=text),atNode[atNode.length]=thisNode,lastIndex=regexp.lastIndex,first=!1}childSeg.lastIndex=lastIndex;var fullAtNode={predList:atNode},childMatch=childSeg.exec(selstring);if(childMatch&&childMatch.index===lastIndex||fluid.fail("Error in selector string - can not match child selector expression at "+selstring.substring(lastIndex)),">"===childMatch[1]&&(fullAtNode.child=!0),togo[togo.length]=fullAtNode,childSeg.lastIndex>=selstring.length)break;lastIndex=childSeg.lastIndex,regexp.lastIndex=childSeg.lastIndex}return togo},fluid.flattenObjectPaths=function(originalObject){var flattenedObject={};return fluid.each(originalObject,function(value,key){if(null!==value&&"object"==typeof value){var flattenedSubObject=fluid.flattenObjectPaths(value);fluid.each(flattenedSubObject,function(subValue,subKey){flattenedObject[key+"."+subKey]=subValue}),"function"==typeof fluid.get(value,"toString")&&(flattenedObject[key]=value.toString())}else flattenedObject[key]=value}),flattenedObject},fluid.stringTemplate=function(template,values){var flattenedValues=fluid.flattenObjectPaths(values),keys=fluid.keys(flattenedValues);keys=keys.sort(fluid.compareStringLength());for(var i=0;i<keys.length;++i)for(var key=keys[i],templatePlaceholder="%"+key,replacementValue=flattenedValues[key],indexOfPlaceHolder=-1;-1!==(indexOfPlaceHolder=template.indexOf(templatePlaceholder));)template=template.slice(0,indexOfPlaceHolder)+replacementValue+template.slice(indexOfPlaceHolder+templatePlaceholder.length);return template}}(jQuery,fluid_3_0_0);fluid_3_0_0=fluid_3_0_0||{};!function($,fluid){"use strict";fluid.promise=function(){var that={onResolve:[],onReject:[],then:function(onResolve,onReject){return onResolve&&("resolve"===that.disposition?onResolve(that.value):that.onResolve.push(onResolve)),onReject&&("reject"===that.disposition?onReject(that.value):that.onReject.push(onReject)),that},resolve:function(value){return that.disposition?fluid.fail("Error: resolving promise ",that,' which has already received "'+that.disposition+'"'):that.complete("resolve",that.onResolve,value),that},reject:function(reason){return that.disposition?fluid.fail("Error: rejecting promise ",that,'which has already received "'+that.disposition+'"'):that.complete("reject",that.onReject,reason),that},complete:function(which,queue,arg){that.disposition=which,that.value=arg;for(var i=0;i<queue.length;++i)queue[i](arg)}};return that},fluid.isPromise=function(totest){return totest&&"function"==typeof totest.then},fluid.toPromise=function(promiseOrValue){if(fluid.isPromise(promiseOrValue))return promiseOrValue;var togo=fluid.promise();return togo.resolve(promiseOrValue),togo},fluid.promise.follow=function(source,target){source.then(target.resolve,target.reject)},fluid.promise.map=function(source,func){var promise=fluid.toPromise(source),togo=fluid.promise();return promise.then(function(value){var mapped=func(value);fluid.isPromise(mapped)?fluid.promise.follow(mapped,togo):togo.resolve(mapped)},function(error){togo.reject(error)}),togo},fluid.promise.makeSequencer=function(sources,options,strategy){return fluid.isArrayable(sources)||fluid.fail("fluid.promise sequence algorithms must be supplied an array as source"),{sources:sources,resolvedSources:[],index:0,strategy:strategy,options:options,returns:[],promise:fluid.promise()}},fluid.promise.progressSequence=function(that,retValue){that.returns.push(retValue),that.index++,fluid.promise.resumeSequence(that)},fluid.promise.processSequenceReject=function(that,error){for(var i=that.index-1;0<=i;--i){var resolved=that.resolvedSources[i];error=(fluid.isPromise(resolved)&&"function"==typeof resolved.accumulateRejectionReason?resolved.accumulateRejectionReason:fluid.identity)(error)}that.promise.reject(error)},fluid.promise.resumeSequence=function(that){if(that.index===that.sources.length)that.promise.resolve(that.strategy.resolveResult(that));else{var value=that.strategy.invokeNext(that);that.resolvedSources[that.index]=value,fluid.isPromise(value)?value.then(function(retValue){fluid.promise.progressSequence(that,retValue)},function(error){fluid.promise.processSequenceReject(that,error)}):fluid.promise.progressSequence(that,value)}},fluid.promise.makeSequenceStrategy=function(){return{invokeNext:function(that){var source=that.sources[that.index];return"function"==typeof source?source(that.options):source},resolveResult:function(that){return that.returns}}},fluid.promise.sequence=function(sources,options){var sequencer=fluid.promise.makeSequencer(sources,options,fluid.promise.makeSequenceStrategy());return fluid.promise.resumeSequence(sequencer),sequencer.promise},fluid.promise.makeTransformerStrategy=function(){return{invokeNext:function(that){var lisrec=that.sources[that.index];return lisrec.listener=fluid.event.resolveListener(lisrec.listener),lisrec.listener.apply(null,[that.returns[that.index],that.options])},resolveResult:function(that){return that.returns[that.index]}}},fluid.promise.makeTransformer=function(listeners,payload,options){listeners.unshift({listener:function(){return payload}});var sequencer=fluid.promise.makeSequencer(listeners,options,fluid.promise.makeTransformerStrategy());return sequencer.returns.push(null),fluid.promise.resumeSequence(sequencer),sequencer},fluid.promise.filterNamespaces=function(listeners,namespaces){return namespaces?fluid.remove_if(fluid.makeArray(listeners),function(element){return element.namespace&&!element.softNamespace&&!fluid.contains(namespaces,element.namespace)}):listeners},fluid.promise.fireTransformEvent=function(event,payload,options){var listeners=(options=options||{}).reverse?fluid.makeArray(event.sortedListeners).reverse():fluid.makeArray(event.sortedListeners);return listeners=fluid.promise.filterNamespaces(listeners,options.filterNamespaces),fluid.promise.makeTransformer(listeners,payload,options).promise}}(jQuery,fluid_3_0_0);fluid_3_0_0=fluid_3_0_0||{};!function($,fluid){"use strict";fluid.defaults("fluid.dataSource.encoding.JSON",{gradeNames:"fluid.component",invokers:{parse:"fluid.dataSource.parseJSON",render:"fluid.dataSource.stringifyJSON"},contentType:"application/json"}),fluid.defaults("fluid.dataSource.encoding.none",{gradeNames:"fluid.component",invokers:{parse:"fluid.identity",render:"fluid.identity"},contentType:"text/plain"}),fluid.dataSource.parseJSON=function(string){var togo=fluid.promise();if(string)try{togo.resolve(JSON.parse(string))}catch(err){togo.reject({message:err})}else togo.resolve(void 0);return togo},fluid.dataSource.stringifyJSON=function(obj){return void 0===obj?"":JSON.stringify(obj,null,4)},fluid.defaults("fluid.dataSource",{gradeNames:["fluid.component"],events:{onRead:null,onError:null},components:{encoding:{type:"fluid.dataSource.encoding.JSON"}},listeners:{"onRead.impl":{func:"fluid.notImplemented",priority:"first"},"onRead.encoding":{func:"{encoding}.parse",priority:"after:impl"}},invokers:{get:{funcName:"fluid.dataSource.get",args:["{that}","{arguments}.0","{arguments}.1"]}}}),fluid.defaults("fluid.dataSource.writable",{gradeNames:["fluid.component"],events:{onWrite:null,onWriteResponse:null},listeners:{"onWrite.encoding":{func:"{encoding}.render"},"onWrite.impl":{func:"fluid.notImplemented",priority:"after:encoding"},"onWriteResponse.encoding":{func:"{encoding}.parse"}},invokers:{set:{funcName:"fluid.dataSource.set",args:["{that}","{arguments}.0","{arguments}.1","{arguments}.2"]}}}),fluid.dataSource.registerStandardPromiseHandlers=function(that,promise,options){promise.then("function"==typeof options?options:null,options.onError?options.onError:that.events.onError.fire)},fluid.dataSource.defaultiseOptions=function(componentOptions,options,directModel,isSet){return(options=options||{}).directModel=directModel,options.operation=isSet?"set":"get",options.notFoundIsEmpty=options.notFoundIsEmpty||componentOptions.notFoundIsEmpty,options},fluid.dataSource.get=function(that,directModel,options){options=fluid.dataSource.defaultiseOptions(that.options,options,directModel);var promise=fluid.promise.fireTransformEvent(that.events.onRead,void 0,options);return fluid.dataSource.registerStandardPromiseHandlers(that,promise,options),promise},fluid.dataSource.set=function(that,directModel,model,options){options=fluid.dataSource.defaultiseOptions(that.options,options,directModel,!0);var transformPromise=fluid.promise.fireTransformEvent(that.events.onWrite,model,options),togo=fluid.promise();return transformPromise.then(function(setResponse){var options2=fluid.dataSource.defaultiseOptions(that.options,fluid.copy(options),directModel),retransformed=fluid.promise.fireTransformEvent(that.events.onWriteResponse,setResponse,options2);fluid.promise.follow(retransformed,togo)},function(error){togo.reject(error)}),fluid.dataSource.registerStandardPromiseHandlers(that,togo,options),togo}}(jQuery,fluid_3_0_0);fluid_3_0_0=fluid_3_0_0||{};!function($,fluid){"use strict";var matched,browser;fluid.uaMatch=function(ua){ua=ua.toLowerCase();var match=/(chrome)[ \/]([\w.]+)/.exec(ua)||/(webkit)[ \/]([\w.]+)/.exec(ua)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua)||/(msie) ([\w.]+)/.exec(ua)||ua.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua)||[];return{browser:match[1]||"",version:match[2]||"0"}},$.browser||(navigator.userAgent.match(/Trident\/7\./)?browser={msie:!0,version:11}:(browser={},(matched=fluid.uaMatch(navigator.userAgent)).browser&&(browser[matched.browser]=!0,browser.version=matched.version),browser.chrome?browser.webkit=!0:browser.webkit&&(browser.safari=!0)),$.browser=browser);fluid.getScopedData=function(target,key){var data=$(target).data("fluid-scoped-data");return data?data[key]:void 0},fluid.setScopedData=function(target,key,value){$(target).each(function(){var data=$.data(this,"fluid-scoped-data")||{};data[key]=value,$.data(this,"fluid-scoped-data",data)})};var lastFocusedElement=null;$(document).on("focusin",function(event){lastFocusedElement=event.target}),fluid.getLastFocusedElement=function(){return lastFocusedElement};fluid.enabled=function(target,state){if(target=$(target),void 0===state)return!1!==fluid.getScopedData(target,"enablement");$("*",target).add(target).each(function(){void 0!==fluid.getScopedData(this,"enablement")?fluid.setScopedData(this,"enablement",state):/select|textarea|input/i.test(this.nodeName)&&$(this).prop("disabled",!state)}),fluid.setScopedData(target,"enablement",state)},fluid.initEnablement=function(target){fluid.setScopedData(target,"enablement",!0)},fluid.resolveEventTarget=function(event){for(;event.originalEvent&&event.originalEvent.target;)event=event.originalEvent;return event.target},$.each(["focus","blur"],function(i,name){fluid[name]=function(elem){return func=name,(node=$(node=elem)).trigger("fluid-"+func),node.triggerHandler(func),node[func](),node;var node,func}}),fluid.changeElementValue=function(node,value){(node=$(node)).val(value).change()}}(jQuery,fluid_3_0_0);fluid_3_0_0=fluid_3_0_0||{};!function($,fluid){"use strict";fluid.dom=fluid.dom||{};var getNextNode=function(iterator){if(iterator.node.firstChild)return iterator.node=iterator.node.firstChild,iterator.depth+=1,iterator;for(;iterator.node;){if(iterator.node.nextSibling)return iterator.node=iterator.node.nextSibling,iterator;iterator.node=iterator.node.parentNode,iterator.depth-=1}return iterator};fluid.dom.iterateDom=function(node,acceptor,allNodes){for(var condition,currentNode={node:node,depth:0},prevNode=node;null!==currentNode.node&&0<=currentNode.depth&¤tNode.depth<fluid.dom.iterateDom.DOM_BAIL_DEPTH;){if(condition=null,(1===currentNode.node.nodeType||allNodes)&&(condition=acceptor(currentNode.node,currentNode.depth)),condition)if("delete"===condition)currentNode.node.parentNode.removeChild(currentNode.node),currentNode.node=prevNode;else if("stop"===condition)return currentNode.node;prevNode=currentNode.node,currentNode=getNextNode(currentNode)}},fluid.dom.iterateDom.DOM_BAIL_DEPTH=256,fluid.dom.isContainer=function(container,containee){for(;containee;containee=containee.parentNode)if(container===containee)return!0;return!1},fluid.dom.getElementText=function(element){for(var nodes=element.childNodes,text="",i=0;i<nodes.length;++i){var child=nodes[i];3===child.nodeType&&(text+=child.nodeValue)}return text}}(jQuery,fluid_3_0_0),fluid_3_0_0=fluid_3_0_0||{},function($,fluid){"use strict";var unUnicode=/(\\u[\dabcdef]{4}|\\x[\dabcdef]{2})/g;fluid.unescapeProperties=function(string){string=string.replace(unUnicode,function(match){var code=match.substring(2),parsed=parseInt(code,16);return String.fromCharCode(parsed)});for(var pos=0;;){var backpos=string.indexOf("\\",pos);if(-1===backpos)break;if(backpos===string.length-1)return[string.substring(0,string.length-1),!0];var replace=string.charAt(backpos+1);"n"===replace&&(replace="\n"),"r"===replace&&(replace="\r"),"t"===replace&&(replace="\t"),string=string.substring(0,backpos)+replace+string.substring(backpos+2),pos=backpos+1}return[string,!1]};var breakPos=/[^\\][\s:=]/;fluid.parseJavaProperties=function(text){for(var contin,key,valueComp,valueRaw,valueEsc,togo={},lines=(text=(text=text.replace(/\r\n/g,"\n")).replace(/\r/g,"\n")).split("\n"),i=0;i<lines.length;++i){var line=$.trim(lines[i]);if(line&&"#"!==line.charAt(0)&&"!"!==line.charAt(0)){if(contin)valueEsc=fluid.unescapeProperties(line);else{valueComp="";var breakpos=line.search(breakPos);-1===breakpos?(key=line,valueRaw=""):(key=$.trim(line.substring(0,breakpos+1)),":"!==(valueRaw=$.trim(line.substring(breakpos+2))).charAt(0)&&"="!==valueRaw.charAt(0)||(valueRaw=$.trim(valueRaw.substring(1)))),key=fluid.unescapeProperties(key)[0],valueEsc=fluid.unescapeProperties(valueRaw)}contin=valueEsc[1],valueEsc[1]?valueComp+=valueEsc[0]:togo[key]=valueComp+valueEsc[0]}}return togo},fluid.formatMessage=function(messageString,args){if(!args)return messageString;"string"==typeof args&&(args=[args]);for(var i=0;i<args.length;++i)messageString=messageString.replace("{"+i+"}",args[i]);return messageString}}(jQuery,fluid_3_0_0);fluid_3_0_0=fluid_3_0_0||{};!function($,fluid){"use strict";fluid.renderTimestamp=function(date){var zeropad=function(num,width){width||(width=2);var numstr=void 0===num?"":num.toString();return"00000".substring(5-width+numstr.length)+numstr};return zeropad(date.getHours())+":"+zeropad(date.getMinutes())+":"+zeropad(date.getSeconds())+"."+zeropad(date.getMilliseconds(),3)},fluid.isTracing=!1,fluid.registerNamespace("fluid.tracing"),fluid.tracing.pathCount=[],fluid.tracing.summarisePathCount=function(pathCount){pathCount=pathCount||fluid.tracing.pathCount;for(var togo={},i=0;i<pathCount.length;++i){var path=pathCount[i];togo[path]?++togo[path]:togo[path]=1}var toReallyGo=[];return fluid.each(togo,function(el,path){toReallyGo.push({path:path,count:el})}),toReallyGo.sort(function(a,b){return b.count-a.count}),toReallyGo},fluid.tracing.condensePathCount=function(prefixes,pathCount){prefixes=fluid.makeArray(prefixes);var prefixCount={};fluid.each(prefixes,function(prefix){prefixCount[prefix]=0});var togo=[];return fluid.each(pathCount,function(el){var path=el.path;fluid.find(prefixes,function(prefix){if(0===path.indexOf(prefix))return prefixCount[prefix]+=el.count,!0})||togo.push(el)}),fluid.each(prefixCount,function(count,path){togo.unshift({path:path,count:count})}),togo},fluid.detectStackStyle=function(e){var style="other",stackStyle={offset:0};return e.arguments?style="chrome":"undefined"!=typeof window&&window.opera&&e.stacktrace?style="opera10":e.stack?(style="firefox",stackStyle.offset=-1===e.stack.indexOf("Trace exception")?1:0):"undefined"==typeof window||!window.opera||"stacktrace"in e||(style="opera"),stackStyle.style=style,stackStyle},fluid.obtainException=function(){try{throw new Error("Trace exception")}catch(e){return e}};var stackStyle=fluid.detectStackStyle(fluid.obtainException());fluid.registerNamespace("fluid.exceptionDecoders"),fluid.decodeStack=function(){if("firefox"!==stackStyle.style)return null;var e=fluid.obtainException();return fluid.exceptionDecoders[stackStyle.style](e)},fluid.exceptionDecoders.firefox=function(e){var lines=e.stack.replace(/(?:\n@:0)?\s+$/m,"").replace(/^\(/gm,"{anonymous}(").split("\n");return fluid.transform(lines,function(line){var atind=(line=line.replace(/\)/g,"")).indexOf("at ");return-1===atind?[line]:[line.substring(atind+"at ".length),line.substring(0,atind)]})},fluid.getCallerInfo=function(atDepth){atDepth=(atDepth||3)-stackStyle.offset;var stack=fluid.decodeStack(),element=stack&&stack[atDepth]&&stack[atDepth][0];if(element){var lastslash=element.lastIndexOf("/");-1===lastslash&&(lastslash=0);var nextColon=element.indexOf(":",lastslash);return{path:element.substring(0,lastslash),filename:element.substring(lastslash+1,nextColon),index:element.substring(nextColon+1)}}return null},fluid.generatePadding=function(c,count){for(var togo="",i=0;i<count;++i)togo+=c;return togo},fluid.SYNTHETIC_PROPERTY=Object.freeze({}),fluid.getSafeProperty=function(obj,key){var desc=Object.getOwnPropertyDescriptor(obj,key);return desc&&!desc.get?obj[key]:fluid.SYNTHETIC_PROPERTY},fluid.prettyPrintJSON=function(obj,options){return(options=$.extend({indent:4,stack:[],output:""},options)).indentChars=fluid.generatePadding(" ",options.indent),function printImpl(obj,small,options){function out(str){options.output+=str}var big=small+options.indentChars,isFunction="function"==typeof obj;if(void 0!==options.maxRenderChars&&options.output.length>options.maxRenderChars)return!0;if(null===obj)out("null");else if(void 0===obj)out("undefined");else if(obj===fluid.SYNTHETIC_PROPERTY)out("[Synthetic property]");else if(fluid.isPrimitive(obj)&&!isFunction)out(JSON.stringify(obj));else{if(-1!==options.stack.indexOf(obj))return void out("(CIRCULAR)");var i;if(options.stack.push(obj),fluid.isArrayable(obj))if(0===obj.length)out("[]");else{for(out("[\n"+big),i=0;i<obj.length;++i){if(printImpl(obj[i],big,options))return!0;i!==obj.length-1&&out(",\n"+big)}out("\n"+small+"]")}else{out("{"+(isFunction?" Function":"")+"\n"+big);var keys=fluid.keys(obj);for(i=0;i<keys.length;++i){var key=keys[i],value=fluid.getSafeProperty(obj,key);if(out(JSON.stringify(key)+": "),printImpl(value,big,options))return!0;i!==keys.length-1&&out(",\n"+big)}out("\n"+small+"}")}options.stack.pop()}}(obj,"",options),options.output},fluid.dumpEl=function(element){var togo;if(!element)return"null";if(3===element.nodeType||8===element.nodeType)return"[data: "+element.data+"]";if(9===element.nodeType)return"[document: location "+element.location+"]";if(element.nodeType||!fluid.isArrayable(element))return togo=(element=$(element)).get(0).tagName,element.id&&(togo+="#"+element.id),element.attr("class")&&(togo+="."+element.attr("class")),togo;togo="[";for(var i=0;i<element.length;++i)togo+=fluid.dumpEl(element[i]),i<element.length-1&&(togo+=", ");return togo+"]"}}(jQuery,fluid_3_0_0);fluid_3_0_0=fluid_3_0_0||{};!function($,fluid){"use strict";fluid.visitComponentChildren=function(that,visitor,options,segs){for(var name in segs=segs||[],that){var component=that[name];if(!(!fluid.isComponent(component)||options.visited&&options.visited[component.id])){if(segs.push(name),options.visited&&(options.visited[component.id]=!0),visitor(component,name,segs,segs.length-1))return!0;options.flat||fluid.visitComponentChildren(component,visitor,options,segs),segs.pop()}}},fluid.getContextHash=function(instantiator,that){var shadow=instantiator.idToShadow[that.id];return shadow&&shadow.contextHash},fluid.componentHasGrade=function(that,gradeName){var contextHash=fluid.getContextHash(fluid.globalInstantiator,that);return!(!contextHash||!contextHash[gradeName])},fluid.visitComponentsForMatching=function(that,options,visitor){var instantiator=fluid.getInstantiator(that);options=$.extend({visited:{},instantiator:instantiator},options);var thatStack=[that],contextHashes=[fluid.getContextHash(instantiator,that)];fluid.visitComponentChildren(that,function(component,name,segs){thatStack.length=1,contextHashes.length=1;for(var i=0;i<segs.length;++i){var child=thatStack[i][segs[i]];thatStack[i+1]=child,contextHashes[i+1]=fluid.getContextHash(instantiator,child)||{}}return visitor(component,thatStack,contextHashes,segs,segs.length)},options,[])},fluid.getMemberNames=function(instantiator,thatStack){if(0===thatStack.length)return[];var path=instantiator.idToPath(thatStack[thatStack.length-1].id),segs=instantiator.parseEL(path);return segs.unshift.apply(segs,fluid.generate(thatStack.length-segs.length,"")),segs},fluid.visitComponentsForVisibility=function(instantiator,thatStack,visitor,options){options=options||{visited:{},flat:!0,instantiator:instantiator};for(var memberNames=fluid.getMemberNames(instantiator,thatStack),i=thatStack.length-1;0<=i;--i){var that=thatStack[i];if(options.visited[that.id]=!0,visitor(that,memberNames[i],memberNames,i))return;if(fluid.visitComponentChildren(that,visitor,options,memberNames))return;memberNames.pop()}},fluid.mountStrategy=function(prefix,root,toMount){var offset=prefix.length;return function(target,name,i,segs){if(!(i<=prefix.length)){for(var j=0;j<prefix.length;++j)if(segs[j]!==prefix[j])return;return toMount(target,name,i-prefix.length,segs.slice(offset))}}},fluid.invokerFromRecord=function(invokerec,name,that){fluid.pushActivity("makeInvoker","beginning instantiation of invoker with name %name and record %record as child of %that",{name:name,record:invokerec,that:that});var invoker=invokerec?fluid.makeInvoker(that,invokerec,name):void 0;return fluid.popActivity(),invoker},fluid.memberFromRecord=function(memberrecs,name,that){for(var togo,i=0;i<memberrecs.length;++i){var expanded=fluid.expandImmediate(memberrecs[i],that);togo=fluid.isPlainObject(togo)?$.extend(!0,togo,expanded):expanded}return togo},fluid.recordStrategy=function(that,options,optionsStrategy,recordPath,recordMaker,prefix,exceptions){return prefix=prefix||[],{strategy:function(target,name,i){if(1===i){var record=fluid.driveStrategy(options,[recordPath,name],optionsStrategy);if(void 0!==record){fluid.set(target,[name],fluid.inEvaluationMarker);var member=recordMaker(record,name,that);return fluid.set(target,[name],member),member}}},initter:function(){var records=fluid.driveStrategy(options,recordPath,optionsStrategy)||{};for(var name in records)exceptions&&exceptions[name]||fluid.getForComponent(that,prefix.concat([name]))}}},fluid.instantiateFirers=function(that){var shadow=fluid.shadowForComponent(that);(fluid.get(shadow,["eventStrategyBlock","initter"])||fluid.identity)()},fluid.makeDistributionRecord=function(contextThat,sourceRecord,sourcePath,targetSegs,exclusions,sourceType){sourceType=sourceType||"distribution",fluid.pushActivity("makeDistributionRecord","Making distribution record from source record %sourceRecord path %sourcePath to target path %targetSegs",{sourceRecord:sourceRecord,sourcePath:sourcePath,targetSegs:targetSegs});var source=fluid.copy(fluid.get(sourceRecord,sourcePath));fluid.each(exclusions,function(exclusion){fluid.model.applyChangeRequest(source,{segs:exclusion,type:"DELETE"})});var record={options:{}};return fluid.model.applyChangeRequest(record,{segs:targetSegs,type:"ADD",value:source}),fluid.checkComponentRecord(record),fluid.popActivity(),$.extend(record,{contextThat:contextThat,recordType:sourceType})},fluid.filterBlocks=function(contextThat,sourceBlocks,sourceSegs,targetSegs,exclusions,removeSource){var togo=[];return fluid.each(sourceBlocks,function(block){var source=fluid.get(block.source,sourceSegs);if(void 0!==source){togo.push(fluid.makeDistributionRecord(contextThat,block.source,sourceSegs,targetSegs,exclusions,block.recordType));var rescued=$.extend({},source);removeSource&&fluid.model.applyChangeRequest(block.source,{segs:sourceSegs,type:"DELETE"}),fluid.each(exclusions,function(exclusion){var orig=fluid.get(rescued,exclusion);fluid.set(block.source,sourceSegs.concat(exclusion),orig)})}}),togo},fluid.noteCollectedDistribution=function(parentShadow,memberName,distribution){fluid.model.setSimple(parentShadow,["collectedDistributions",memberName,distribution.id],!0)},fluid.isCollectedDistribution=function(parentShadow,memberName,distribution){return fluid.model.getSimple(parentShadow,["collectedDistributions",memberName,distribution.id])},fluid.clearCollectedDistributions=function(parentShadow,memberName){fluid.model.applyChangeRequest(parentShadow,{segs:["collectedDistributions",memberName],type:"DELETE"})},fluid.collectDistributions=function(distributedBlocks,parentShadow,distribution,thatStack,contextHashes,memberNames,i){var lastMember=memberNames[memberNames.length-1];!fluid.isCollectedDistribution(parentShadow,lastMember,distribution)&&fluid.matchIoCSelector(distribution.selector,thatStack,contextHashes,memberNames,i)&&(distributedBlocks.push.apply(distributedBlocks,distribution.blocks),fluid.noteCollectedDistribution(parentShadow,lastMember,distribution))},fluid.registerCollectedClearer=function(shadow,parentShadow,memberName){!shadow.collectedClearer&&parentShadow&&(shadow.collectedClearer=function(){fluid.clearCollectedDistributions(parentShadow,memberName)})},fluid.receiveDistributions=function(parentThat,gradeNames,memberName,that){var instantiator=fluid.getInstantiator(parentThat||that),thatStack=instantiator.getThatStack(parentThat||that);thatStack.unshift(fluid.rootComponent);var memberNames=fluid.getMemberNames(instantiator,thatStack),shadows=fluid.transform(thatStack,function(thisThat){return instantiator.idToShadow[thisThat.id]}),parentShadow=shadows[shadows.length-(parentThat?1:2)],contextHashes=fluid.getMembers(shadows,"contextHash");parentThat?(memberNames.push(memberName),contextHashes.push(fluid.gradeNamesToHash(gradeNames)),thatStack.push(that)):fluid.registerCollectedClearer(shadows[shadows.length-1],parentShadow,memberNames[memberNames.length-1]);for(var distributedBlocks=[],i=0;i<thatStack.length-1;++i)fluid.each(shadows[i].distributions,function(distribution){fluid.collectDistributions(distributedBlocks,parentShadow,distribution,thatStack,contextHashes,memberNames,i)});return distributedBlocks},fluid.computeTreeDistance=function(path1,path2){for(var i=0;i<path1.length&&i<path2.length&&path1[i]===path2[i];)++i;return path1.length+path2.length-2*i},fluid.computeDistributionPriority=function(targetThat,distributedBlock){if(!distributedBlock.priority){var instantiator=fluid.getInstantiator(targetThat),targetStack=instantiator.getThatStack(targetThat),targetPath=fluid.getMemberNames(instantiator,targetStack),sourceStack=instantiator.getThatStack(distributedBlock.contextThat),sourcePath=fluid.getMemberNames(instantiator,sourceStack),distance=fluid.computeTreeDistance(targetPath,sourcePath);distributedBlock.priority=fluid.mergeRecordTypes.distribution-distance}return distributedBlock},fluid.applyDistributions=function(that,preBlocks,targetShadow){var distributedBlocks=fluid.transform(preBlocks,function(preBlock){return fluid.generateExpandBlock(preBlock,that,targetShadow.mergePolicy)},function(distributedBlock){return fluid.computeDistributionPriority(that,distributedBlock)}),mergeOptions=targetShadow.mergeOptions;return mergeOptions.mergeBlocks.push.apply(mergeOptions.mergeBlocks,distributedBlocks),mergeOptions.updateBlocks(),distributedBlocks},fluid.matchIoCSelector=function(selector,thatStack,contextHashes,memberNames,i){for(var thatpos=thatStack.length-1,selpos=selector.length-1;;){for(var isChild=selector[selpos].child,mustMatchHere=thatpos===thatStack.length-1||isChild,that=thatStack[thatpos],selel=selector[selpos],match=!0,j=0;j<selel.predList.length;++j){var pred=selel.predList[j],context=pred.context;if(context&&"*"!==context&&!contextHashes[thatpos][context]&&memberNames[thatpos]!==context){match=!1;break}if(pred.id&&that.id!==pred.id){match=!1;break}}if(0===selpos&&i<thatpos&&mustMatchHere&&isChild&&(match=!1),match){if(0===selpos)return!0;--thatpos,--selpos}else{if(mustMatchHere)return!1;--thatpos}if(thatpos<i)return!1}},fluid.queryIoCSelector=function(root,selector,flat){var parsed=fluid.parseSelector(selector,fluid.IoCSSMatcher),togo=[];return fluid.visitComponentsForMatching(root,{flat:flat},function(that,thatStack,contextHashes){fluid.matchIoCSelector(parsed,thatStack,contextHashes,[],1)&&togo.push(that)}),togo},fluid.isIoCSSSelector=function(context){return-1!==context.indexOf(" ")},fluid.pushDistributions=function(targetHead,selector,target,blocks){var targetShadow=fluid.shadowForComponent(targetHead),id=fluid.allocateGuid(),distribution={id:id,target:target,selector:selector,blocks:blocks};return Object.freeze(distribution),Object.freeze(distribution.blocks),fluid.pushArray(targetShadow,"distributions",distribution),id},fluid.clearDistribution=function(targetHeadId,id){var targetHeadShadow=fluid.globalInstantiator.idToShadow[targetHeadId];targetHeadShadow&&fluid.remove_if(targetHeadShadow.distributions,function(distribution){return distribution.id===id})},fluid.clearDistributions=function(shadow){fluid.each(shadow.outDistributions,function(outDist){fluid.clearDistribution(outDist.targetHeadId,outDist.distributionId)})},fluid.extractSelectorHead=function(parsedSelector){var predList=parsedSelector[0].predList,context=predList[0].context;return predList.length=0,context},fluid.parseExpectedOptionsPath=function(path,role){var segs=fluid.model.parseEL(path);return"options"!==segs[0]&&fluid.fail("Error in options distribution path ",path," - only "+role+' paths beginning with "options" are supported'),segs.slice(1)},fluid.replicateProperty=function(source,property,targets){void 0!==source[property]&&fluid.each(targets,function(target){target[property]=source[property]})},fluid.undistributableOptions=["gradeNames","distributeOptions","argumentMap","initFunction","mergePolicy","progressiveCheckerOptions"],fluid.distributeOptions=function(that,optionsStrategy){var thatShadow=fluid.shadowForComponent(that),records=fluid.driveStrategy(that.options,"distributeOptions",optionsStrategy);fluid.each(records,function(record){fluid.pushActivity("distributeOptions","parsing distributeOptions block %record %that ",{that:that,record:record}),"string"!=typeof record.target&&fluid.fail("Error in options distribution record ",record,' a member named "target" must be supplied holding an IoC reference'),"string"==typeof record.source^void 0===record.record&&fluid.fail("Error in options distribution record ",record,': must supply either a member "source" holding an IoC reference or a member "record" holding a literal record');var targetHead,selector,context,targetRef=fluid.parseContextReference(record.target);if(fluid.isIoCSSSelector(targetRef.context)){selector=fluid.parseSelector(targetRef.context,fluid.IoCSSMatcher);var headContext=fluid.extractSelectorHead(selector);"/"===headContext?targetHead=fluid.rootComponent:context=headContext}else context=targetRef.context;(targetHead=targetHead||fluid.resolveContext(context,that))||fluid.fail("Error in options distribution record ",record," - could not resolve context {"+context+"} to a head component");var preBlocks,targetSegs=fluid.model.parseEL(targetRef.path);if(void 0!==record.record)preBlocks=[fluid.makeDistributionRecord(that,record.record,[],targetSegs,[])];else{var source=fluid.parseContextReference(record.source);"that"!==source.context&&fluid.fail("Error in options distribution record ",record," only a context of {that} is supported");var sourceSegs=fluid.parseExpectedOptionsPath(source.path,"source"),fullExclusions=fluid.makeArray(record.exclusions).concat(0===sourceSegs.length?fluid.undistributableOptions:[]),exclusions=fluid.transform(fullExclusions,function(exclusion){return fluid.model.parseEL(exclusion)});preBlocks=fluid.filterBlocks(that,thatShadow.mergeOptions.mergeBlocks,sourceSegs,targetSegs,exclusions,record.removeSource),thatShadow.mergeOptions.updateBlocks()}if(fluid.replicateProperty(record,"priority",preBlocks),fluid.replicateProperty(record,"namespace",preBlocks),selector){var distributionId=fluid.pushDistributions(targetHead,selector,record.target,preBlocks);thatShadow.outDistributions=thatShadow.outDistributions||[],thatShadow.outDistributions.push({targetHeadId:targetHead.id,distributionId:distributionId})}else{var targetShadow=fluid.shadowForComponent(targetHead);fluid.applyDistributions(that,preBlocks,targetShadow)}fluid.popActivity()})},fluid.gradeNamesToHash=function(gradeNames){var contextHash={};return fluid.each(gradeNames,function(gradeName){contextHash[gradeName]=!0,contextHash[fluid.computeNickName(gradeName)]=!0}),contextHash},fluid.cacheShadowGrades=function(that,shadow){var contextHash=fluid.gradeNamesToHash(that.options.gradeNames);contextHash[shadow.memberName]||(contextHash[shadow.memberName]="memberName"),shadow.contextHash=contextHash,fluid.each(contextHash,function(troo,context){shadow.ownScope[context]=that,shadow.parentShadow&&"fluid.rootComponent"!==shadow.parentShadow.that.type&&(shadow.parentShadow.childrenScope[context]=that)})},fluid.deliverOptionsStrategy=function(that,target,mergeOptions){var shadow=fluid.shadowForComponent(that,shadow);fluid.cacheShadowGrades(that,shadow),shadow.mergeOptions=mergeOptions},fluid.collectDistributedGrades=function(rec){var distributedBlocks=fluid.receiveDistributions(null,null,null,rec.that);if(0<distributedBlocks.length){var readyBlocks=fluid.applyDistributions(rec.that,distributedBlocks,rec.shadow),gradeNamesList=fluid.transform(fluid.getMembers(readyBlocks,["source","gradeNames"]),fluid.makeArray);fluid.accumulateDynamicGrades(rec,fluid.flatten(gradeNamesList))}},fluid.applyDynamicGrades=function(rec){rec.oldGradeNames=fluid.makeArray(rec.gradeNames);var newDefaults=fluid.copy(fluid.getMergedDefaults(rec.that.typeName,rec.gradeNames));rec.gradeNames.length=0,rec.gradeNames.push.apply(rec.gradeNames,newDefaults.gradeNames),fluid.each(rec.gradeNames,function(gradeName){fluid.isIoCReference(gradeName)||(rec.seenGrades[gradeName]=!0)});var shadow=rec.shadow;fluid.cacheShadowGrades(rec.that,shadow),shadow.mergeOptions.destroyValue(["mergePolicy"]),shadow.mergeOptions.destroyValue(["components"]),shadow.mergeOptions.destroyValue(["invokers"]),rec.defaultsBlock.source=newDefaults,shadow.mergeOptions.updateBlocks(),shadow.mergeOptions.computeMergePolicy(),fluid.accumulateDynamicGrades(rec,newDefaults.gradeNames)},fluid.accumulateDynamicGrades=function(rec,newGradeNames){fluid.each(newGradeNames,function(gradeName){rec.seenGrades[gradeName]||(fluid.isIoCReference(gradeName)?(rec.rawDynamic.push(gradeName),rec.seenGrades[gradeName]=!0):fluid.contains(rec.oldGradeNames,gradeName)||rec.plainDynamic.push(gradeName))})},fluid.computeDynamicGrades=function(that,shadow,strategy){delete that.options.gradeNames;var gradeNames=fluid.driveStrategy(that.options,"gradeNames",strategy);gradeNames.length=0;var rec={that:that,shadow:shadow,defaultsBlock:fluid.findMergeBlocks(shadow.mergeOptions.mergeBlocks,"defaults")[0],gradeNames:gradeNames,seenGrades:{},plainDynamic:[],rawDynamic:[]};for(fluid.each(shadow.mergeOptions.mergeBlocks,function(block){gradeNames.push.apply(gradeNames,fluid.makeArray(block.target&&block.target.gradeNames)),fluid.applyDynamicGrades(rec)}),fluid.collectDistributedGrades(rec);;){for(;0<rec.plainDynamic.length;)gradeNames.push.apply(gradeNames,rec.plainDynamic),rec.plainDynamic.length=0,fluid.applyDynamicGrades(rec),fluid.collectDistributedGrades(rec);if(!(0<rec.rawDynamic.length))break;var expanded=fluid.expandImmediate(rec.rawDynamic.shift(),that,shadow.localDynamic);"function"==typeof expanded&&(expanded=expanded()),expanded&&(rec.plainDynamic=rec.plainDynamic.concat(expanded))}shadow.collectedClearer&&(shadow.collectedClearer(),delete shadow.collectedClearer)},fluid.computeDynamicComponentKey=function(recordKey,sourceKey){return recordKey+(0===sourceKey?"":"-"+sourceKey)},fluid.hasDynamicComponentCount=function(shadow,key){var hypos=key.indexOf("-");if(-1!==hypos){var recordKey=key.substring(0,hypos);return void 0!==shadow.dynamicComponentCount&&void 0!==shadow.dynamicComponentCount[recordKey]}},fluid.clearDynamicParentRecord=function(shadow,key){if(fluid.hasDynamicComponentCount(shadow,key)){var holder=fluid.get(shadow.that,["options","components"]);holder&&delete holder[key]}},fluid.registerDynamicRecord=function(that,recordKey,sourceKey,record,toCensor){var key=fluid.computeDynamicComponentKey(recordKey,sourceKey),recordCopy=fluid.copy(record);return delete recordCopy[toCensor],fluid.set(that.options,["components",key],recordCopy),key},fluid.computeDynamicComponents=function(that,mergeOptions){var shadow=fluid.shadowForComponent(that),localSub=shadow.subcomponentLocal={},records=fluid.driveStrategy(that.options,"dynamicComponents",mergeOptions.strategy);fluid.each(records,function(record,recordKey){if(record.sources||record.createOnEvent||fluid.fail("Cannot process dynamicComponents record ",record,' without a "sources" or "createOnEvent" entry'),record.sources){var sources=fluid.expandOptions(record.sources,that);fluid.each(sources,function(source,sourceKey){var key=fluid.registerDynamicRecord(that,recordKey,sourceKey,record,"sources");localSub[key]={source:source,sourcePath:sourceKey}})}else if(record.createOnEvent){var event=fluid.event.expandOneEvent(that,record.createOnEvent);fluid.set(shadow,["dynamicComponentCount",recordKey],0);var listener=function(){var key=fluid.registerDynamicRecord(that,recordKey,shadow.dynamicComponentCount[recordKey]++,record,"createOnEvent"),localRecord={arguments:fluid.makeArray(arguments)};fluid.initDependent(that,key,localRecord)};event.addListener(listener),fluid.recordListener(event,listener,shadow)}})},fluid.computeComponentAccessor=function(that,localRecord){var instantiator=fluid.globalInstantiator,shadow=fluid.shadowForComponent(that);shadow.localDynamic=localRecord;var options=that.options,strategy=shadow.mergeOptions.strategy,optionsStrategy=fluid.mountStrategy(["options"],options,strategy);shadow.invokerStrategy=fluid.recordStrategy(that,options,strategy,"invokers",fluid.invokerFromRecord),shadow.eventStrategyBlock=fluid.recordStrategy(that,options,strategy,"events",fluid.eventFromRecord,["events"]);var eventStrategy=fluid.mountStrategy(["events"],that,shadow.eventStrategyBlock.strategy,["events"]);if(shadow.memberStrategy=fluid.recordStrategy(that,options,strategy,"members",fluid.memberFromRecord,null,{model:!0,modelRelay:!0}),shadow.getConfig={strategies:[fluid.model.funcResolverStrategy,fluid.makeGingerStrategy(that),optionsStrategy,shadow.invokerStrategy.strategy,shadow.memberStrategy.strategy,eventStrategy]},fluid.computeDynamicGrades(that,shadow,strategy,shadow.mergeOptions.mergeBlocks),fluid.distributeOptions(that,strategy),shadow.contextHash["fluid.resolveRoot"]){var memberName;if(shadow.contextHash["fluid.resolveRootSingle"]){var singleRootType=fluid.getForComponent(that,["options","singleRootType"]);singleRootType||fluid.fail("Cannot register object with grades "+Object.keys(shadow.contextHash).join(", ")+" as fluid.resolveRootSingle since it has not defined option singleRootType"),memberName=fluid.typeNameToMemberName(singleRootType)}else memberName=fluid.computeGlobalMemberName(that);var parent=fluid.resolveRootComponent;parent[memberName]&&instantiator.clearComponent(parent,memberName),instantiator.recordKnownComponent(parent,that,memberName,!1)}return shadow.getConfig},fluid.shadowForComponent=function(component){var instantiator=fluid.getInstantiator(component);return instantiator&&component?instantiator.idToShadow[component.id]:null},fluid.getForComponent=function(component,path){var shadow=fluid.shadowForComponent(component),getConfig=shadow?shadow.getConfig:void 0;return fluid.get(component,path,getConfig)},fluid.makeGingerStrategy=function(that){var instantiator=fluid.getInstantiator(that);return function(component,thisSeg,index,segs){var atval=component[thisSeg];if(atval===fluid.inEvaluationMarker&&index===segs.length&&fluid.fail('Error in component configuration - a circular reference was found during evaluation of path segment "'+thisSeg+'": for more details, see the activity records following this message in the console, or issue fluid.setLogging(fluid.logLevel.TRACE) when running your application'),1<index)return atval;if(void 0===atval&&component.hasOwnProperty(thisSeg))return fluid.NO_VALUE;if(void 0===atval){var parentPath=instantiator.idToShadow[component.id].path,childPath=instantiator.composePath(parentPath,thisSeg);atval=instantiator.pathToComponent[childPath]}if(void 0===atval){var subRecord=fluid.getForComponent(component,["options","components",thisSeg]);subRecord&&(subRecord.createOnEvent&&fluid.fail('Error resolving path segment "'+thisSeg+'" of path '+segs.join(".")+" since component with record ",subRecord,' has annotation "createOnEvent" - this very likely represents an implementation error. Either alter the reference so it does not match this component, or alter your workflow to ensure that the component is instantiated by the time this reference resolves'),fluid.initDependent(component,thisSeg),atval=component[thisSeg])}return atval}},fluid.frameworkGrades=["fluid.component","fluid.modelComponent","fluid.viewComponent","fluid.rendererComponent"],fluid.filterBuiltinGrades=function(gradeNames){return fluid.remove_if(fluid.makeArray(gradeNames),function(gradeName){return-1!==fluid.frameworkGrades.indexOf(gradeName)})},fluid.dumpGradeNames=function(that){return that.options&&that.options.gradeNames?" gradeNames: "+JSON.stringify(fluid.filterBuiltinGrades(that.options.gradeNames)):""},fluid.dumpThat=function(that){return'{ typeName: "'+that.typeName+'"'+fluid.dumpGradeNames(that)+" id: "+that.id+"}"},fluid.dumpThatStack=function(thatStack,instantiator){return fluid.transform(thatStack,function(that){var path=instantiator.idToPath(that.id);return fluid.dumpThat(that)+(path?" - path: "+path:"")}).join("\n")},fluid.dumpComponentPath=function(that){var path=fluid.pathForComponent(that);return path?fluid.pathUtil.composeSegments(path):"** no path registered for component **"},fluid.resolveContext=function(context,that,fast){if("that"===context)return that;if("object"==typeof context){var innerContext=fluid.resolveContext(context.context,that,fast);fluid.isComponent(innerContext)||fluid.triggerMismatchedPathError(context.context,that);var rawValue=fluid.getForComponent(innerContext,context.path),expanded=fluid.expandOptions(rawValue,that);return fluid.isComponent(expanded)||fluid.fail("Unable to resolve recursive context expression "+fluid.renderContextReference(context)+": the directly resolved value of "+rawValue+" did not resolve to a component in the scope of component ",that,": got ",expanded),expanded}var foundComponent,instantiator=fluid.globalInstantiator;if(fast)return instantiator.idToShadow[that.id].ownScope[context];var thatStack=instantiator.getFullStack(that);return fluid.visitComponentsForVisibility(instantiator,thatStack,function(component,name){var shadow=fluid.shadowForComponent(component);return context===name||shadow&&shadow.contextHash&&shadow.contextHash[context]||context===component.typeName?(foundComponent=component,!0):fluid.getForComponent(component,["options","components",context])&&!component[context]?(foundComponent=fluid.getForComponent(component,context),!0):void 0}),foundComponent},fluid.triggerMismatchedPathError=function(parsed,parentThat){var ref=fluid.renderContextReference(parsed);fluid.fail("Failed to resolve reference "+ref+" - could not match context with name "+parsed.context+" from component "+fluid.dumpThat(parentThat)+" at path "+fluid.dumpComponentPath(parentThat)+" component: ",parentThat)},fluid.makeStackFetcher=function(parentThat,localRecord,fast){return function(parsed){parentThat&&"destroyed"===parentThat.lifecycleStatus&&fluid.fail("Cannot resolve reference "+fluid.renderContextReference(parsed)+" from component "+fluid.dumpThat(parentThat)+" which has been destroyed");var context=parsed.context;if(localRecord&&context in localRecord)return fluid.get(localRecord[context],parsed.path);var foundComponent=fluid.resolveContext(context,parentThat,fast);return foundComponent||""===parsed.path||fluid.triggerMismatchedPathError(parsed,parentThat),fluid.getForComponent(foundComponent,parsed.path)}},fluid.makeStackResolverOptions=function(parentThat,localRecord,fast){return $.extend(fluid.copy(fluid.rawDefaults("fluid.makeExpandOptions")),{ELstyle:"{}",localRecord:localRecord||{},fetcher:fluid.makeStackFetcher(parentThat,localRecord,fast),contextThat:parentThat,exceptions:{members:{model:!0,modelRelay:!0}}})},fluid.clearListeners=function(shadow){fluid.each(shadow.listeners,function(rec){rec.event.removeListener(rec.listenerId||rec.listener)}),delete shadow.listeners},fluid.recordListener=function(event,listener,shadow,listenerId){event.ownerId!==shadow.that.id&&fluid.pushArray(shadow,"listeners",{event:event,listener:listener,listenerId:listenerId})},fluid.constructScopeObjects=function(instantiator,parent,child,childShadow){var parentShadow=parent?instantiator.idToShadow[parent.id]:null;childShadow.childrenScope=parentShadow?Object.create(parentShadow.ownScope):{},childShadow.ownScope=Object.create(childShadow.childrenScope),childShadow.parentShadow=parentShadow},fluid.clearChildrenScope=function(instantiator,parentShadow,child,childShadow){fluid.each(childShadow.contextHash,function(troo,context){parentShadow.childrenScope[context]===child&&delete parentShadow.childrenScope[context]})},fluid.instantiator=function(){var that=fluid.typeTag("instantiator");function recordComponent(parent,component,path,name,created){var shadow;if(created)(shadow=that.idToShadow[component.id]={}).that=component,shadow.path=path,shadow.memberName=name,fluid.constructScopeObjects(that,parent,component,shadow);else{(shadow=that.idToShadow[component.id]).injectedPaths=shadow.injectedPaths||{},shadow.injectedPaths[path]=!0;var parentShadow=that.idToShadow[parent.id],keys=fluid.keys(shadow.contextHash);fluid.remove_if(keys,function(key){return shadow.contextHash&&"memberName"===shadow.contextHash[key]}),keys.push(name),fluid.each(keys,function(context){parentShadow.childrenScope[context]||(parentShadow.childrenScope[context]=component)})}that.pathToComponent[path]&&fluid.fail("Error during instantiation - path "+path+" which has just created component "+fluid.dumpThat(component)+" has already been used for component "+fluid.dumpThat(that.pathToComponent[path])+" - this is a circular instantiation or other oversight. Please clear the component using instantiator.clearComponent() before reusing the path."),that.pathToComponent[path]=component}return $.extend(that,{lifecycleStatus:"constructed",pathToComponent:{},idToShadow:{},modelTransactions:{init:{}},composePath:fluid.model.composePath,composeSegments:fluid.model.composeSegments,parseEL:fluid.model.parseEL,events:{onComponentAttach:fluid.makeEventFirer({name:"instantiator's onComponentAttach event"}),onComponentClear:fluid.makeEventFirer({name:"instantiator's onComponentClear event"})}}),that.idToPath=function(id){var shadow=that.idToShadow[id];return shadow?shadow.path:""},that.getThatStack=function(component){var shadow=that.idToShadow[component.id];if(shadow){for(var path=shadow.path,parsed=that.parseEL(path),root=that.pathToComponent[""],togo=[],i=0;i<parsed.length;++i)root=root[parsed[i]],togo.push(root);return togo}return[]},that.getFullStack=function(component){var thatStack=component?that.getThatStack(component):[];return thatStack.unshift(fluid.resolveRootComponent),thatStack},that.recordRoot=function(component){recordComponent(null,component,"","",!0)},that.recordKnownComponent=function(parent,component,name,created){if(parent[name]=component,fluid.isComponent(component)||"instantiator"===component.type){var parentPath=that.idToShadow[parent.id].path,path=that.composePath(parentPath,name);recordComponent(parent,component,path,name,created),that.events.onComponentAttach.fire(component,path,that,created)}else fluid.fail("Cannot record non-component with value ",component,' at path "'+name+'" of parent ',parent)},that.clearConcreteComponent=function(destroyRec){fluid.each(destroyRec.childShadow.injectedPaths,function(troo,injectedPath){var parentPath=fluid.model.getToTailPath(injectedPath),otherParent=that.pathToComponent[parentPath];that.clearComponent(otherParent,fluid.model.getTailPath(injectedPath),destroyRec.child)}),fluid.clearDistributions(destroyRec.childShadow),fluid.clearListeners(destroyRec.childShadow),fluid.clearDynamicParentRecord(destroyRec.shadow,destroyRec.name),fluid.fireEvent(destroyRec.child,"afterDestroy",[destroyRec.child,destroyRec.name,destroyRec.component]),delete that.idToShadow[destroyRec.child.id]},that.clearComponent=function(component,name,child,options,nested,path){var shadow=that.idToShadow[component.id];options=options||{flat:!0,instantiator:that,destroyRecs:[]},child=child||component[name],void 0===(path=path||shadow.path)&&fluid.fail("Cannot clear component "+name+" from component ",component," which was not created by this instantiator");var childPath=that.composePath(path,name),childShadow=that.idToShadow[child.id];if(childShadow){var created=childShadow.path===childPath;that.events.onComponentClear.fire(child,childPath,component,created),created?(fluid.visitComponentChildren(child,function(gchild,gchildname,segs,i){var parentPath=that.composeSegments.apply(null,segs.slice(0,i));that.clearComponent(child,gchildname,null,options,!0,parentPath)},options,that.parseEL(childPath)),fluid.doDestroy(child,name,component),options.destroyRecs.push({child:child,childShadow:childShadow,name:name,component:component,shadow:shadow})):fluid.remove_if(childShadow.injectedPaths,function(troo,path){return path===childPath}),fluid.clearChildrenScope(that,shadow,child,childShadow),delete that.pathToComponent[childPath],nested||(delete component[name],fluid.each(options.destroyRecs,that.clearConcreteComponent))}},that},fluid.globalInstantiator=fluid.instantiator(),fluid.getInstantiator=function(component){var instantiator=fluid.globalInstantiator;return component&&instantiator.idToShadow[component.id]?instantiator:null},fluid.defaults("fluid.resolveRoot"),fluid.defaults("fluid.resolveRootSingle",{gradeNames:"fluid.resolveRoot"}),fluid.constructRootComponents=function(instantiator){fluid.rootComponent=instantiator.rootComponent=fluid.typeTag("fluid.rootComponent"),instantiator.recordRoot(fluid.rootComponent),fluid.resolveRootComponent=instantiator.resolveRootComponent=fluid.typeTag("fluid.resolveRootComponent"),instantiator.recordKnownComponent(fluid.rootComponent,fluid.resolveRootComponent,"resolveRootComponent",!0);var rootShadow=instantiator.idToShadow[fluid.rootComponent.id];rootShadow.contextHash={};var resolveRootShadow=instantiator.idToShadow[fluid.resolveRootComponent.id];resolveRootShadow.ownScope=rootShadow.ownScope,resolveRootShadow.childrenScope=rootShadow.childrenScope,instantiator.recordKnownComponent(fluid.resolveRootComponent,instantiator,"instantiator",!0),resolveRootShadow.childrenScope.instantiator=instantiator},fluid.constructRootComponents(fluid.globalInstantiator),fluid.expandOptions=function(args,that,mergePolicy,localRecord,outerExpandOptions){if(!args)return args;fluid.pushActivity("expandOptions","expanding options %args for component %that ",{that:that,args:args});var expandOptions=fluid.makeStackResolverOptions(that,localRecord);expandOptions.mergePolicy=mergePolicy,expandOptions.defer=outerExpandOptions&&outerExpandOptions.defer;var expanded=expandOptions.defer?fluid.makeExpandOptions(args,expandOptions):fluid.expand(args,expandOptions);return fluid.popActivity(),expanded},fluid.localRecordExpected=fluid.arrayToHash(["type","options","container","createOnEvent","priority","recordType"]),fluid.checkComponentRecord=function(localRecord){fluid.each(localRecord,function(value,key){fluid.localRecordExpected[key]||fluid.fail("Probable error in subcomponent record ",localRecord,' - key "'+key+'" found, where the only legal options are '+fluid.keys(fluid.localRecordExpected).join(", "))})},fluid.mergeRecordsToList=function(that,mergeRecords){var list=[];return fluid.each(mergeRecords,function(value,key){if("distributions"===(value.recordType=key))list.push.apply(list,fluid.transform(value,function(distributedBlock){return fluid.computeDistributionPriority(that,distributedBlock)}));else{if(!value.options)return;value.priority=fluid.mergeRecordTypes[key],void 0===value.priority&&fluid.fail("Merge record with unrecognised type "+key+": ",value),list.push(value)}}),list};fluid.generateExpandBlock=function(record,that,mergePolicy,localRecord){var expanded=fluid.expandOptions(record.options,record.contextThat||that,mergePolicy,localRecord,{defer:!0});return expanded.priority=record.priority,expanded.namespace=record.namespace,expanded.recordType=record.recordType,expanded};var expandComponentOptionsImpl=function(mergePolicy,defaults,initRecord,that){var policy,defaultCopy=fluid.copy(defaults);policy=mergePolicy,fluid.each(["gradeNames","mergePolicy","argumentMap","components","dynamicComponents","events","listeners","modelListeners","modelRelay","distributeOptions","transformOptions"],function(key){fluid.set(policy,[key,"*","noexpand"],!0)}),fluid.shadowForComponent(that).mergePolicy=mergePolicy;var mergeRecords={defaults:{options:defaultCopy}};$.extend(mergeRecords,initRecord.mergeRecords),mergeRecords.subcomponentRecord&&fluid.checkComponentRecord(mergeRecords.subcomponentRecord);var expandList=fluid.mergeRecordsToList(that,mergeRecords);return fluid.transform(expandList,function(value){return fluid.generateExpandBlock(value,that,mergePolicy,initRecord.localRecord)})};fluid.fabricateDestroyMethod=function(that,name,instantiator,child){return function(){instantiator.clearComponent(that,name,child)}},fluid.computeGlobalMemberName=function(that){return fluid.computeNickName(that.typeName)+"-"+that.id},fluid.typeNameToMemberName=function(typeName){return typeName.replace(/\./g,"_")},fluid.expandComponentOptions=function(mergePolicy,defaults,userOptions,that){var initRecord=userOptions,instantiator=userOptions&&userOptions.marker===fluid.EXPAND?userOptions.instantiator:null;fluid.pushActivity("expandComponentOptions","expanding component options %options with record %record for component %that",{options:instantiator?userOptions.mergeRecords.user:userOptions,record:initRecord,that:that}),instantiator||(instantiator=fluid.globalInstantiator,initRecord={mergeRecords:{user:{options:fluid.expandCompact(userOptions,!0)}},memberName:fluid.computeGlobalMemberName(that),instantiator:instantiator,parentThat:fluid.rootComponent}),that.destroy=fluid.fabricateDestroyMethod(initRecord.parentThat,initRecord.memberName,instantiator,that),instantiator.recordKnownComponent(initRecord.parentThat,that,initRecord.memberName,!0);var togo=expandComponentOptionsImpl(mergePolicy,defaults,initRecord,that);return fluid.popActivity(),togo},fluid.assembleCreatorArguments=function(parentThat,typeName,options){var upDefaults=fluid.defaults(typeName);upDefaults&&upDefaults.argumentMap||fluid.fail("Error in assembleCreatorArguments: cannot look up component type name "+typeName+" to a component creator grade with an argumentMap");var distributions=parentThat?fluid.receiveDistributions(parentThat,upDefaults.gradeNames,options.memberName,{}):[];fluid.each(distributions,function(distribution){fluid.computeDistributionPriority(parentThat,distribution),fluid.isPrimitive(distribution.priority)&&(distribution.priority=fluid.parsePriority(distribution.priority,0,!1,"options distribution"))}),fluid.sortByPriority(distributions);var localDynamic=options.localDynamic,localRecord=$.extend({},fluid.censorKeys(options.componentRecord,["type"]),localDynamic),argMap=upDefaults.argumentMap,findKeys=Object.keys(argMap).concat(["type"]);fluid.each(findKeys,function(name){for(var i=0;i<distributions.length;++i)void 0!==distributions[i][name]&&(localRecord[name]=distributions[i][name])}),typeName=localRecord.type||typeName,delete localRecord.type,delete localRecord.options;var mergeRecords={distributions:distributions};void 0!==options.componentRecord&&(mergeRecords.subcomponentRecord=$.extend({},options.componentRecord));var args=[];return fluid.each(argMap,function(index,name){var arg;if("options"===name)arg={marker:fluid.EXPAND,localRecord:localDynamic,mergeRecords:mergeRecords,instantiator:fluid.getInstantiator(parentThat),parentThat:parentThat,memberName:options.memberName};else{var value=localRecord[name];arg=fluid.expandImmediate(value,parentThat,localRecord)}args[index]=arg}),{args:args,funcName:typeName}},fluid.initDependent=function(that,name,localRecord){if(!that[name]){var instance,component=that.options.components[name],instantiator=fluid.globalInstantiator,shadow=instantiator.idToShadow[that.id],localDynamic=localRecord||shadow.subcomponentLocal&&shadow.subcomponentLocal[name];if(fluid.pushActivity("initDependent",'instantiating dependent component at path "%path" with record %record as child of %parent',{path:shadow.path+"."+name,record:component,parent:that}),"string"==typeof component||component.expander)that[name]=fluid.inEvaluationMarker,(instance=fluid.expandImmediate(component,that))?instantiator.recordKnownComponent(that,instance,name,!1):delete that[name];else if(component.type){var type=fluid.expandImmediate(component.type,that,localDynamic);type||fluid.fail("Error in subcomponent record: ",component.type," could not be resolved to a type for component ",name," of parent ",that);var invokeSpec=fluid.assembleCreatorArguments(that,type,{componentRecord:component,memberName:name,localDynamic:localDynamic});instance=fluid.initSubcomponentImpl(that,{type:invokeSpec.funcName},invokeSpec.args)}else fluid.fail("Unrecognised material in place of subcomponent "+name+' - no "type" field found');return fluid.popActivity(),instance}},fluid.bindDeferredComponent=function(that,componentName,component){var events=fluid.makeArray(component.createOnEvent);fluid.each(events,function(eventName){var event=fluid.isIoCReference(eventName)?fluid.expandOptions(eventName,that):that.events[eventName];event&&event.addListener||fluid.fail("Error instantiating createOnEvent component with name "+componentName+" of parent ",that," since event specification "+eventName+" could not be expanded to an event - got ",event),event.addListener(function(){fluid.pushActivity("initDeferred","instantiating deferred component %componentName of parent %that due to event %eventName",{componentName:componentName,that:that,eventName:eventName}),that[componentName]&&fluid.globalInstantiator.clearComponent(that,componentName);var localRecord={arguments:fluid.makeArray(arguments)};fluid.initDependent(that,componentName,localRecord),fluid.popActivity()},null,component.priority)})},fluid.priorityForComponent=function(component){return component.priority?component.priority:"fluid.typeFount"===component.type||fluid.hasGrade(fluid.defaults(component.type),"fluid.typeFount")?"first":void 0},fluid.initDependents=function(that){fluid.pushActivity("initDependents","instantiating dependent components for component %that",{that:that});var shadow=fluid.shadowForComponent(that);if(shadow.memberStrategy.initter(),shadow.invokerStrategy.initter(),fluid.getForComponent(that,"modelRelay"),fluid.getForComponent(that,"model"),!fluid.isDestroyed(that)){var components=that.options.components||{},componentSort=[];fluid.each(components,function(component,name){if(component.createOnEvent)fluid.bindDeferredComponent(that,name,component);else{var priority=fluid.priorityForComponent(component);componentSort.push({namespace:name,priority:fluid.parsePriority(priority)})}}),fluid.sortByPriority(componentSort),fluid.each(componentSort,function(entry){fluid.initDependent(that,entry.namespace)}),shadow.subcomponentLocal&&fluid.clear(shadow.subcomponentLocal),that.lifecycleStatus="constructed",fluid.assessTreeConstruction(that,shadow),fluid.popActivity()}},fluid.assessTreeConstruction=function(that,shadow){var instantiator=fluid.globalInstantiator,thatStack=instantiator.getThatStack(that);fluid.find_if(thatStack,function(that){return"constructing"===that.lifecycleStatus})?that.lifecycleStatus="constructed":fluid.markSubtree(instantiator,that,shadow.path,"treeConstructed")},fluid.markSubtree=function(instantiator,that,path,state){that.lifecycleStatus=state,fluid.visitComponentChildren(that,function(child,name){var childPath=instantiator.composePath(path,name),childShadow=instantiator.idToShadow[child.id];childShadow&&childShadow.path===childPath&&fluid.markSubtree(instantiator,child,childPath,state)},{flat:!0})},fluid.pathForComponent=function(component,instantiator){var shadow=(instantiator=instantiator||fluid.getInstantiator(component)||fluid.globalInstantiator).idToShadow[component.id];return shadow?instantiator.parseEL(shadow.path):null},fluid.construct=function(path,options,instantiator){var record=fluid.destroy(path,instantiator);return fluid.set(record.parent,["options","components",record.memberName],{type:options.type,options:options}),fluid.initDependent(record.parent,record.memberName)},fluid.destroy=function(path,instantiator){instantiator=instantiator||fluid.globalInstantiator;var segs=fluid.model.parseToSegments(path,instantiator.parseEL,!0);0===segs.length&&fluid.fail("Cannot destroy the root component");var memberName=segs.pop(),parentPath=instantiator.composeSegments.apply(null,segs),parent=instantiator.pathToComponent[parentPath];return parent||fluid.fail("Cannot modify component with nonexistent parent at path ",path),parent[memberName]&&parent[memberName].destroy(),{parent:parent,memberName:memberName}},fluid.constructSingle=function(parentPath,options,instantiator){instantiator=instantiator||fluid.globalInstantiator,parentPath=parentPath||"";var segs=fluid.model.parseToSegments(parentPath,instantiator.parseEL,!0);"string"==typeof options&&(options={type:options});var type=options.type;type||fluid.fail("Cannot construct singleton object without a type entry");var gradeNames=(options=$.extend({},options)).gradeNames=fluid.makeArray(options.gradeNames);gradeNames.unshift(type),options.type="fluid.component",0===segs.length&&gradeNames.push("fluid.resolveRoot");var memberName=fluid.typeNameToMemberName(options.singleRootType||type);segs.push(memberName),fluid.construct(segs,options,instantiator)},fluid.destroySingle=function(parentPath,typeName,instantiator){instantiator=instantiator||fluid.globalInstantiator;var segs=fluid.model.parseToSegments(parentPath,instantiator.parseEL,!0),memberName=fluid.typeNameToMemberName(typeName);segs.push(memberName),fluid.destroy(segs,instantiator)},fluid.makeGradeLinkage=function(linkageName,inputNames,outputNames){fluid.defaults(linkageName,{gradeNames:"fluid.component",distributeOptions:{record:outputNames,target:"{/ "+inputNames.join("&")+"}.options.gradeNames"}}),fluid.constructSingle([],linkageName)},fluid.componentForPath=function(path){return fluid.globalInstantiator.pathToComponent[fluid.isArrayable(path)?path.join("."):path]},fluid.debugger=function(){},fluid.defaults("fluid.debuggingProbe",{gradeNames:["fluid.component"]}),fluid.probeToDistribution=function(probe){var instantiator=fluid.globalInstantiator,parsed=fluid.parseContextReference(probe.target),segs=fluid.model.parseToSegments(parsed.path,instantiator.parseEL,!0);"options"!==segs[0]&&segs.unshift("options");var parsedPriority=fluid.parsePriority(probe.priority);return parsedPriority.constraint&&!parsedPriority.constraint.target&&(parsedPriority.constraint.target="authoring"),{target:"{/ "+parsed.context+"}."+instantiator.composeSegments.apply(null,segs),record:{func:probe.func,funcName:probe.funcName,args:probe.args,priority:fluid.renderPriority(parsedPriority)}}},fluid.registerProbes=function(probes){var probeDistribution=fluid.transform(probes,fluid.probeToDistribution),memberName="fluid_debuggingProbe_"+fluid.allocateGuid();return fluid.construct([memberName],{type:"fluid.debuggingProbe",distributeOptions:probeDistribution}),memberName},fluid.deregisterProbes=function(probeName){fluid.destroy([probeName])},fluid.thisistToApplicable=function(record,recthis,that){return{apply:function(noThis,args){var resolvedThis=fluid.expandOptions(recthis,that);"string"==typeof resolvedThis&&(resolvedThis=fluid.getGlobalValue(resolvedThis)),resolvedThis||fluid.fail("Could not resolve reference "+recthis+" to a value");var resolvedFunc=resolvedThis[record.method];return"function"!=typeof resolvedFunc&&fluid.fail("Object ",resolvedThis," at reference "+recthis+" has no member named "+record.method+" which is a function "),fluid.passLogLevel(fluid.logLevel.TRACE)&&fluid.log(fluid.logLevel.TRACE,"Applying arguments ",args," to method "+record.method+" of instance ",resolvedThis),resolvedFunc.apply(resolvedThis,args)}}},fluid.changeToApplicable=function(record,that){return{apply:function(noThis,args,localRecord,mergeRecord){var parsed=fluid.parseValidModelReference(that,"changePath listener record",record.changePath),value=fluid.expandOptions(record.value,that,{},fluid.extend(localRecord,{arguments:args})),sources=mergeRecord&&mergeRecord.source&&mergeRecord.source.length?fluid.makeArray(record.source).concat(mergeRecord.source):record.source;parsed.applier.change(parsed.modelSegs,value,record.type,sources)}}},fluid.recordToApplicable=function(record,that,standard){if(void 0!==record.changePath)return fluid.changeToApplicable(record,that,standard);var recthis=record.this;return record.method^recthis&&fluid.fail("Record ",that,' must contain both entries "method" and "this" if it contains either'),record.method?fluid.thisistToApplicable(record,recthis,that):null},fluid.getGlobalValueNonComponent=function(funcName,context){var defaults=fluid.defaults(funcName);return defaults&&fluid.hasGrade(defaults,"fluid.component")&&fluid.fail("Error in function specification - cannot invoke function "+funcName+" in the context of "+context+": component creator functions can only be used as subcomponents"),fluid.getGlobalValue(funcName)},fluid.makeInvoker=function(that,invokerec,name){void 0===(invokerec=fluid.upgradePrimitiveFunc(invokerec)).args||invokerec.args===fluid.NO_VALUE||fluid.isArrayable(invokerec.args)||(invokerec.args=fluid.makeArray(invokerec.args));var func=fluid.recordToApplicable(invokerec,that),invokePre=fluid.preExpand(invokerec.args),localRecord={},expandOptions=fluid.makeStackResolverOptions(that,localRecord,!0);return(func=func||(invokerec.funcName?fluid.getGlobalValueNonComponent(invokerec.funcName,"an invoker"):fluid.expandImmediate(invokerec.func,that)))&&func.apply?func===fluid.notImplemented&&fluid.fail("Error constructing component ",that," - the invoker named "+name+" which was defined in grade "+invokerec.componentSource+" needs to be overridden with a concrete implementation"):fluid.fail("Error in invoker record: could not resolve members func, funcName or method to a function implementation - got "+func+" from ",invokerec),function(){var togo,finalArgs;return!1===fluid.defeatLogging&&fluid.pushActivity("invokeInvoker","invoking invoker with name %name and record %record from path %path holding component %that",{name:name,record:invokerec,path:fluid.dumpComponentPath(that),that:that}),"destroyed"===that.lifecycleStatus?fluid.log(fluid.logLevel.WARN,"Ignoring call to invoker "+name+" of component ",that," which has been destroyed"):(localRecord.arguments=arguments,finalArgs=void 0===invokerec.args||invokerec.args===fluid.NO_VALUE?arguments:(fluid.expandImmediateImpl(invokePre,expandOptions),invokePre.source),togo=func.apply(null,finalArgs)),!1===fluid.defeatLogging&&fluid.popActivity(),togo}},fluid.event.makeTrackedListenerAdder=function(source){var shadow=fluid.shadowForComponent(source);return function(event){return{addListener:function(listener,namespace,priority,softNamespace,listenerId){fluid.recordListener(event,listener,shadow,listenerId),event.addListener.apply(null,arguments)}}}},fluid.event.listenerEngine=function(eventSpec,callback,adder){var argstruc={};fluid.each(eventSpec,function(event,eventName){adder(event).addListener(function(){argstruc[eventName]=fluid.makeArray(arguments),function(){if(!fluid.find(eventSpec,function(value,key){if(void 0===argstruc[key])return!0})){var oldstruc=argstruc;argstruc={},callback(oldstruc)}}()})})},fluid.event.dispatchListener=function(that,listener,eventName,eventSpec,wrappedArgs){void 0===eventSpec.args||eventSpec.args===fluid.NO_VALUE||fluid.isArrayable(eventSpec.args)||(eventSpec.args=fluid.makeArray(eventSpec.args)),listener=fluid.event.resolveListener(listener);var dispatchPre=fluid.preExpand(eventSpec.args),localRecord={},expandOptions=fluid.makeStackResolverOptions(that,localRecord,!0),togo=function(){!1===fluid.defeatLogging&&fluid.pushActivity("dispatchListener","firing to listener to event named %eventName of component %that",{eventName:eventName,that:that});var finalArgs,args=wrappedArgs?arguments[0]:arguments;localRecord.arguments=args,finalArgs=void 0!==eventSpec.args&&eventSpec.args!==fluid.NO_VALUE?(fluid.expandImmediateImpl(dispatchPre,expandOptions),dispatchPre.source):args;var togo=listener.apply(null,finalArgs);return!1===fluid.defeatLogging&&fluid.popActivity(),togo};return fluid.event.impersonateListener(listener,togo),togo},fluid.event.resolveSoftNamespace=function(key){if("string"!=typeof key)return null;var lastpos=Math.max(key.lastIndexOf("."),key.lastIndexOf("}"));return key.substring(lastpos+1)},fluid.event.resolveListenerRecord=function(lisrec,that,eventName,namespace,standard){var badRec=function(record,extra){fluid.fail("Error in listener record - could not resolve reference ",record,' to a listener or firer. Did you miss out "events." when referring to an event firer?'+extra)};fluid.pushActivity("resolveListenerRecord","resolving listener record for event named %eventName for component %that",{eventName:eventName,that:that});var records=fluid.makeArray(lisrec),togo={records:fluid.transform(records,function(record){var expanded=fluid.isPrimitive(record)||record.expander?{listener:record}:fluid.copy(record),methodist=fluid.recordToApplicable(record,that,standard);expanded.listener=methodist||(expanded.listener||expanded.func||expanded.funcName),expanded.listener||badRec(record,' Listener record must contain a member named "listener", "func", "funcName" or "method"');var softNamespace=record.method?fluid.event.resolveSoftNamespace(record.this)+"."+record.method:fluid.event.resolveSoftNamespace(expanded.listener);expanded.namespace||namespace||!softNamespace||(expanded.softNamespace=!0,expanded.namespace=(record.componentSource?record.componentSource:that.typeName)+"."+softNamespace);var listener=expanded.listener=fluid.expandOptions(expanded.listener,that);listener||badRec(record,"");var firer=!1;return"fluid.event.firer"===listener.typeName&&(listener=listener.fire,firer=!0),expanded.listener=standard&&(expanded.args&&"fluid.notImplemented"!==listener||firer)?fluid.event.dispatchListener(that,listener,eventName,expanded):listener,expanded.listenerId=fluid.allocateGuid(),expanded}),adderWrapper:standard?fluid.event.makeTrackedListenerAdder(that):null};return fluid.popActivity(),togo},fluid.event.expandOneEvent=function(that,event){var origin;return(origin="string"==typeof event&&"{"!==event.charAt(0)?fluid.getForComponent(that,["events",event]):fluid.expandOptions(event,that))&&"fluid.event.firer"===origin.typeName||fluid.fail("Error in event specification - could not resolve base event reference ",event," to an event firer: got ",origin),origin},fluid.event.expandEvents=function(that,event){return"string"==typeof event?fluid.event.expandOneEvent(that,event):fluid.transform(event,function(oneEvent){return fluid.event.expandOneEvent(that,oneEvent)})},fluid.event.resolveEvent=function(that,eventName,eventSpec){fluid.pushActivity("resolveEvent","resolving event with name %eventName attached to component %that",{eventName:eventName,that:that});var adder=fluid.event.makeTrackedListenerAdder(that);"string"==typeof eventSpec&&(eventSpec={event:eventSpec});var event="fluid.event.firer"===eventSpec.typeName?eventSpec:eventSpec.event||eventSpec.events;event||fluid.fail("Event specification for event with name "+eventName+" does not include a base event specification: ",eventSpec);var firer,origin="fluid.event.firer"===event.typeName?event:fluid.event.expandEvents(that,event),isMultiple="fluid.event.firer"!==origin.typeName;if(eventSpec.args||isMultiple){firer=fluid.makeEventFirer({name:" [composite] "+fluid.event.nameEvent(that,eventName)});var dispatcher=fluid.event.dispatchListener(that,firer.fire,eventName,eventSpec,isMultiple);isMultiple?fluid.event.listenerEngine(origin,dispatcher,adder):adder(origin).addListener(dispatcher)}else(firer={typeName:"fluid.event.firer",fire:function(){var outerArgs=fluid.makeArray(arguments);fluid.pushActivity("fireSynthetic","firing synthetic event %eventName ",{eventName:eventName});var togo=origin.fire.apply(null,outerArgs);return fluid.popActivity(),togo},addListener:function(listener,namespace,priority,softNamespace,listenerId){var dispatcher=fluid.event.dispatchListener(that,listener,eventName,eventSpec);adder(origin).addListener(dispatcher,namespace,priority,softNamespace,listenerId)},removeListener:function(listener){origin.removeListener(listener)}}).originEvent=origin;return fluid.popActivity(),firer},fluid.withEnvironment=function(envAdd,func,root){var key;root=root||fluid.globalThreadLocal();try{for(key in envAdd)root[key]=envAdd[key];return $.extend(root,envAdd),func()}finally{for(key in envAdd)delete root[key]}},fluid.fetchContextReference=function(parsed,directModel,env,elResolver,externalFetcher){elResolver&&(parsed=elResolver(parsed,env));var base=parsed.context?env[parsed.context]:directModel;return base?parsed.noDereference?parsed.path:fluid.get(base,parsed.path):externalFetcher&&externalFetcher(parsed)||base},fluid.makeEnvironmentFetcher=function(directModel,elResolver,envGetter,externalFetcher){return envGetter=envGetter||fluid.globalThreadLocal,function(parsed){var env=envGetter();return fluid.fetchContextReference(parsed,directModel,env,elResolver,externalFetcher)}},fluid.coerceToPrimitive=function(string){return"false"!==string&&("true"===string||(isFinite(string)?Number(string):string))},fluid.compactStringToRec=function(string,type){var openPos=string.indexOf("("),closePos=string.indexOf(")");if((-1===openPos^-1===closePos||closePos<openPos)&&fluid.fail("Badly-formed compact "+type+" record without matching parentheses: "+string),-1===openPos||-1===closePos)return"expander"===type&&fluid.fail("Badly-formed compact expander record without parentheses: "+string),string;var trail=string.substring(closePos+1);""!==$.trim(trail)&&fluid.fail("Badly-formed compact "+type+" record "+string+" - unexpected material following close parenthesis: "+trail);var prefix=string.substring(0,openPos),body=$.trim(string.substring(openPos+1,closePos)),args=""===body?[]:fluid.transform(body.split(","),$.trim,fluid.coerceToPrimitive),togo=fluid.upgradePrimitiveFunc(prefix,null);return togo.args=args,togo},fluid.expandPrefix="@expand:",fluid.expandCompactString=function(string,active){var rec=string;if(0===string.indexOf(fluid.expandPrefix)){var rem=string.substring(fluid.expandPrefix.length);rec={expander:fluid.compactStringToRec(rem,"expander")}}else active&&(rec=fluid.compactStringToRec(string,active));return rec};var singularPenRecord={listeners:"listener",modelListeners:"modelListener"},singularRecord=$.extend({invokers:"invoker"},singularPenRecord);function regenerateCursor(source,segs,limit,sourceStrategy){for(var i=0;i<limit;++i)source=sourceStrategy(source,segs[i],i,fluid.makeArray(segs));return source}fluid.expandCompactRec=function(segs,target,source){fluid.guardCircularExpansion(segs,segs.length);var pen=0<segs.length?segs[segs.length-1]:"",active=singularRecord[pen];!active&&1<segs.length&&(active=singularPenRecord[segs[segs.length-2]]),fluid.each(source,function(value,key){if(fluid.isPlainObject(value))return target[key]=fluid.freshContainer(value),segs.push(key),fluid.expandCompactRec(segs,target[key],value),void segs.pop();"string"==typeof value&&(value=fluid.expandCompactString(value,active)),target[key]=value})},fluid.expandCompact=function(options){var togo={};return fluid.expandCompactRec([],togo,options),togo},fluid.extractEL=function(string,options){if("ALL"===options.ELstyle||"{}"===options.ELstyle)return string;if(1===options.ELstyle.length){if(string.charAt(0)===options.ELstyle)return string.substring(1)}else if("${}"===options.ELstyle){var i1=string.indexOf("${"),i2=string.lastIndexOf("}");if(0===i1&&-1!==i2)return string.substring(2,i2)}},fluid.extractELWithContext=function(string,options){var EL=fluid.extractEL(string,options);return fluid.isIoCReference(EL)?fluid.parseContextReference(EL):"{}"===options.ELstyle?null:EL?{path:EL}:EL},fluid.parseContextReference=function(reference,index,delimiter){index=index||0;var endcpos,context,nested,isNested="{"===reference.charAt(index+1);-1===(endcpos=isNested?(nested=fluid.parseContextReference(reference,index+1,"}")).endpos:reference.indexOf("}",index+1))&&fluid.fail('Cannot parse context reference "'+reference+'": Malformed context reference without }'),context=isNested?nested:reference.substring(index+1,endcpos);var endpos=delimiter?reference.indexOf(delimiter,endcpos+1):reference.length,path=reference.substring(endcpos+1,endpos);return"."===path.charAt(0)&&(path=path.substring(1)),{context:context,path:path,endpos:endpos}},fluid.renderContextReference=function(parsed){var context=parsed.context;return"{"+(fluid.isPrimitive(context)?context:fluid.renderContextReference(context))+"}"+(parsed.path?"."+parsed.path:"")},fluid.resolveContextValue=function(string,options){function fetch(parsed){fluid.pushActivity("resolveContextValue","resolving context value %parsed",{parsed:parsed});var togo=options.fetcher(parsed);return fluid.pushActivity("resolvedContextValue","resolved value %parsed to value %value",{parsed:parsed,value:togo}),fluid.popActivity(2),togo}var parsed;if(options.bareContextRefs&&fluid.isIoCReference(string))return fetch(parsed=fluid.parseContextReference(string));if(options.ELstyle&&"${}"!==options.ELstyle&&(parsed=fluid.extractELWithContext(string,options)))return fetch(parsed);if("${}"===options.ELstyle)for(;"string"==typeof string;){var i1=string.indexOf("${"),i2=string.indexOf("}",i1+2);if(-1===i1||-1===i2)break;"{"===string.charAt(i1+2)?i2=(parsed=fluid.parseContextReference(string,i1+2,"}")).endpos:parsed={path:string.substring(i1+2,i2)};var subs=fetch(parsed),all=0===i1&&i2===string.length-1;if(null==subs)return subs;string=all?subs:string.substring(0,i1)+subs+string.substring(i2+1)}return string},fluid.fetchExpandChildren=function(target,i,segs,source,mergePolicy,options){if(source.expander){var expanded=fluid.expandExpander(target,source,options);if(fluid.isPrimitive(expanded)||!fluid.isPlainObject(expanded)||fluid.isArrayable(expanded)^fluid.isArrayable(target))return expanded;$.extend(!0,target,expanded)}return fluid.each(source,function(newSource,key){void 0===newSource?target[key]=void 0:"expander"!==key&&(segs[i]=key,!0!==fluid.getImmediate(options.exceptions,segs,i)&&options.strategy(target,key,i+1,segs,source,mergePolicy))}),target},fluid.isUnexpandable=function(source){return fluid.isPrimitive(source)||!fluid.isPlainObject(source)},fluid.expandSource=function(options,target,i,segs,deliverer,source,policy,recurse){var expanded,isTrunk,thisPolicy=fluid.derefMergePolicy(policy);return"string"!=typeof source||thisPolicy.noexpand?thisPolicy.noexpand||fluid.isUnexpandable(source)?expanded=source:source.expander?expanded=fluid.expandExpander(deliverer,source,options):(expanded=fluid.freshContainer(source),isTrunk=!0):options.defaultEL&&"{"!==source.charAt(0)?expanded=source:(fluid.pushActivity("expandContextValue","expanding context value %source held at path %path",{source:source,path:fluid.path.apply(null,segs.slice(0,i))}),expanded=fluid.resolveContextValue(source,options),fluid.popActivity(1)),expanded!==fluid.NO_VALUE&&deliverer(expanded),isTrunk&&recurse(expanded,source,i,segs,policy),expanded},fluid.guardCircularExpansion=function(segs,i){i>fluid.strategyRecursionBailout&&fluid.fail("Overflow/circularity in options expansion, current path is ",segs," at depth ",i,' - please ensure options are not circularly connected, or protect from expansion using the "noexpand" policy or expander')},fluid.makeExpandStrategy=function(options){var recurse=function(target,source,i,segs,policy){return fluid.fetchExpandChildren(target,i||0,segs||[],source,policy,options)},strategy=function(target,name,i,segs,source,policy){if(fluid.guardCircularExpansion(segs,i),target){if(target.hasOwnProperty(name))return target[name];void 0===source&&(source=regenerateCursor(options.source,segs,i-1,options.sourceStrategy),policy=regenerateCursor(options.mergePolicy,segs,i-1,fluid.concreteTrundler));var thisSource=options.sourceStrategy(source,name,i,segs),thisPolicy=fluid.concreteTrundler(policy,name);return fluid.expandSource(options,target,i,segs,function(value){target[name]=value},thisSource,thisPolicy,recurse)}};return options.recurse=recurse,options.strategy=strategy},fluid.defaults("fluid.makeExpandOptions",{ELstyle:"${}",bareContextRefs:!0,target:fluid.inCreationMarker}),fluid.makeExpandOptions=function(source,options){return(options=$.extend({},fluid.rawDefaults("fluid.makeExpandOptions"),options)).defaultEL="${}"===options.ELStyle&&options.bareContextRefs,options.expandSource=function(source){return fluid.expandSource(options,null,0,[],fluid.identity,source,options.mergePolicy,!1)},fluid.isUnexpandable(source)?(options.strategy=fluid.concreteTrundler,options.initter=fluid.identity,options.target="string"==typeof source?(options.defer?fluid.copy:fluid.identity)(options.expandSource(source)):source,options.immutableTarget=!0):(options.source=source,options.target=fluid.freshContainer(source),options.sourceStrategy=options.sourceStrategy||fluid.concreteTrundler,fluid.makeExpandStrategy(options),options.initter=function(){options.target=fluid.fetchExpandChildren(options.target,0,[],options.source,options.mergePolicy,options)}),options},fluid.expand=function(source,options){var expandOptions=fluid.makeExpandOptions(source,options);return expandOptions.initter(),expandOptions.target},fluid.preExpandRecurse=function(root,source,holder,member,rootSegs){function pushExpander(expander){root.expanders.push({expander:expander,holder:holder,member:member}),delete holder[member]}if(fluid.guardCircularExpansion(rootSegs,rootSegs.length),fluid.isIoCReference(source)){var parsed=fluid.parseContextReference(source),segs=fluid.model.parseEL(parsed.path);pushExpander({typeFunc:fluid.expander.fetch,context:parsed.context,segs:segs})}else fluid.isPlainObject(source)&&(source.expander?(source.expander.typeFunc=fluid.getGlobalValue(source.expander.type||"fluid.invokeFunc"),pushExpander(source.expander)):fluid.each(source,function(value,key){rootSegs.push(key),fluid.preExpandRecurse(root,value,source,key,rootSegs),rootSegs.pop()}))},fluid.preExpand=function(source){var root={expanders:[],source:fluid.isUnexpandable(source)?source:fluid.copy(source)};return fluid.preExpandRecurse(root,root.source,root,"source",[]),root},fluid.expandImmediate=function(source,that,localRecord){var options=fluid.makeStackResolverOptions(that,localRecord,!0),root=fluid.preExpand(source);return fluid.expandImmediateImpl(root,options),root.source},fluid.expandImmediateImpl=function(root,options){for(var expanders=root.expanders,i=0;i<expanders.length;++i){var expander=expanders[i];expander.holder[expander.member]=expander.expander.typeFunc(null,expander,options)}},fluid.expandExpander=function(deliverer,source,options){var expander=fluid.getGlobalValue(source.expander.type||"fluid.invokeFunc");return expander||fluid.fail("Unknown expander with type "+source.expander.type),expander(deliverer,source,options)},fluid.registerNamespace("fluid.expander"),fluid.expander.fetch=function(deliverer,source,options){var localRecord=options.localRecord,context=source.expander.context,segs=source.expander.segs,inLocal=void 0!==localRecord[context],contextStatus=options.contextThat.lifecycleStatus,fast="treeConstructed"===contextStatus||"destroyed"===contextStatus,component=inLocal?localRecord[context]:fluid.resolveContext(context,options.contextThat,fast);if(component){var root=component;if(inLocal||"constructing"!==component.lifecycleStatus)for(var i=0;i<segs.length;++i)root=root?root[segs[i]]:void 0;else root=fluid.getForComponent(component,segs);return void 0!==root||inLocal||(root=fluid.getForComponent(component,segs)),root}0<segs.length&&fluid.triggerMismatchedPathError(source.expander,options.contextThat)},fluid.invokeFunc=function(deliverer,source,options){var expander=source.expander,args=fluid.makeArray(expander.args);expander.args=args,args=options.recurse?options.recurse([],args):(expander=fluid.expandImmediate(expander,options.contextThat,options.localRecord)).args;var funcEntry=expander.func||expander.funcName,func=(options.expandSource?options.expandSource(funcEntry):funcEntry)||fluid.recordToApplicable(expander,options.contextThat);return"string"==typeof func&&(func=fluid.getGlobalValue(func)),func||fluid.fail("Error in expander record ",expander,": "+funcEntry+" could not be resolved to a function for component ",options.contextThat),func.apply(null,args)},fluid.noexpand=function(deliverer,source){return source.expander.value?source.expander.value:source.expander.tree}}(jQuery,fluid_3_0_0);fluid_3_0_0=fluid_3_0_0||{};!function($,fluid){"use strict";fluid.model.makeEnvironmentStrategy=function(environment){return function(root,segment,index){return 0===index&&environment[segment]?environment[segment]:void 0}},fluid.model.defaultCreatorStrategy=function(root,segment){if(void 0===root[segment])return root[segment]={},root[segment]},fluid.model.defaultFetchStrategy=function(root,segment){return root[segment]},fluid.model.funcResolverStrategy=function(root,segment){if(root.resolvePathSegment)return root.resolvePathSegment(segment)},fluid.model.traverseWithStrategy=function(root,segs,initPos,config,uncess){for(var strategies=config.strategies,limit=segs.length-uncess,i=initPos;i<limit;++i){if(!root)return root;for(var accepted,j=0;j<strategies.length&&void 0===(accepted=strategies[j](root,segs[i],i+1,segs));++j);accepted===fluid.NO_VALUE&&(accepted=void 0),root=accepted}return root},fluid.model.getValueAndSegments=function(root,EL,config,initSegs){return fluid.model.accessWithStrategy(root,EL,fluid.NO_VALUE,config,initSegs,!0)},fluid.model.makeTrundler=function(config){return function(valueSeg,EL){return fluid.model.getValueAndSegments(valueSeg.root,EL,config,valueSeg.segs)}},fluid.model.getWithStrategy=function(root,EL,config,initSegs){return fluid.model.accessWithStrategy(root,EL,fluid.NO_VALUE,config,initSegs)},fluid.model.setWithStrategy=function(root,EL,newValue,config,initSegs){fluid.model.accessWithStrategy(root,EL,newValue,config,initSegs)},fluid.model.accessWithStrategy=function(root,EL,newValue,config,initSegs,returnSegs){if(fluid.isPrimitive(EL)||fluid.isArrayable(EL))return fluid.model.accessImpl(root,EL,newValue,config,initSegs,returnSegs,fluid.model.traverseWithStrategy);var key=EL.type||"default",resolver=config.resolvers[key];resolver||fluid.fail("Unable to find resolver of type "+key);var trundler=fluid.model.makeTrundler(config),valueSeg={root:root,segs:initSegs};return valueSeg=resolver(valueSeg,EL,trundler),EL.path&&valueSeg&&(valueSeg=trundler(valueSeg,EL.path)),returnSegs?valueSeg:valueSeg?valueSeg.root:void 0},fluid.registerNamespace("fluid.pathUtil"),fluid.pathUtil.getPathSegmentImpl=function(accept,path,i){var segment=null;accept&&(segment="");for(var escaped=!1,limit=path.length;i<limit;++i){var c=path.charAt(i);if(escaped)escaped=!1,null!==segment&&(segment+=c);else{if("."===c)break;"\\"===c?escaped=!0:null!==segment&&(segment+=c)}}return null!==segment&&(accept[0]=segment),i};var globalAccept=[];fluid.pathUtil.parseEL=function(path){for(var togo=[],index=0,limit=path.length;index<limit;){var firstdot=fluid.pathUtil.getPathSegmentImpl(globalAccept,path,index);togo.push(globalAccept[0]),index=firstdot+1}return togo},fluid.pathUtil.composeSegment=function(prefix,toappend){toappend=toappend.toString();for(var i=0;i<toappend.length;++i){var c=toappend.charAt(i);"."!==c&&"\\"!==c&&"}"!==c||(prefix+="\\"),prefix+=c}return prefix},fluid.pathUtil.escapeSegment=function(segment){return fluid.pathUtil.composeSegment("",segment)},fluid.pathUtil.composePath=function(prefix,suffix){return 0!==prefix.length&&(prefix+="."),fluid.pathUtil.composeSegment(prefix,suffix)},fluid.pathUtil.composeSegments=function(){for(var path="",i=0;i<arguments.length;++i)path=fluid.pathUtil.composePath(path,arguments[i]);return path},fluid.pathUtil.matchSegments=function(toMatch,segs,start,end){if(end-start!==toMatch.length)return!1;for(var i=start;i<end;++i)if(segs[i]!==toMatch[i-start])return!1;return!0},fluid.model.unescapedParser={parse:fluid.model.parseEL,compose:fluid.model.composeSegments},fluid.model.defaultGetConfig={parser:fluid.model.unescapedParser,strategies:[fluid.model.funcResolverStrategy,fluid.model.defaultFetchStrategy]},fluid.model.defaultSetConfig={parser:fluid.model.unescapedParser,strategies:[fluid.model.funcResolverStrategy,fluid.model.defaultFetchStrategy,fluid.model.defaultCreatorStrategy]},fluid.model.escapedParser={parse:fluid.pathUtil.parseEL,compose:fluid.pathUtil.composeSegments},fluid.model.escapedGetConfig={parser:fluid.model.escapedParser,strategies:[fluid.model.defaultFetchStrategy]},fluid.model.escapedSetConfig={parser:fluid.model.escapedParser,strategies:[fluid.model.defaultFetchStrategy,fluid.model.defaultCreatorStrategy]},fluid.stronglyConnected=function(vertices,accessor){var that={stack:[],accessor:accessor,components:[],index:0};return vertices.forEach(function(vertex){void 0===vertex.tarjanIndex&&fluid.stronglyConnectedOne(vertex,that)}),that.components},fluid.stronglyConnectedOne=function(vertex,that){if(vertex.tarjanIndex=that.index,vertex.lowIndex=that.index,++that.index,that.stack.push(vertex),vertex.onStack=!0,that.accessor(vertex).forEach(function(outVertex){void 0===outVertex.tarjanIndex?(fluid.stronglyConnectedOne(outVertex,that),vertex.lowIndex=Math.min(vertex.lowIndex,outVertex.lowIndex)):outVertex.onStack&&(vertex.lowIndex=Math.min(vertex.lowIndex,outVertex.tarjanIndex))}),vertex.lowIndex===vertex.tarjanIndex){for(var outVertex,component=[];(outVertex=that.stack.pop()).onStack=!1,component.push(outVertex),outVertex!==vertex;);that.components.push(component)}},fluid.initRelayModel=function(that){return fluid.deenlistModelComponent(that),that.model},fluid.isModelComplete=function(that){return"model"in that&&that.model!==fluid.inEvaluationMarker},fluid.enlistModelComponent=function(that){var instantiator=fluid.getInstantiator(that),enlist=instantiator.modelTransactions.init[that.id];return enlist||(enlist={that:that,applier:fluid.getForComponent(that,"applier"),complete:fluid.isModelComplete(that)},instantiator.modelTransactions.init[that.id]=enlist),enlist},fluid.clearTransactions=function(){var instantiator=fluid.globalInstantiator;fluid.clear(instantiator.modelTransactions),instantiator.modelTransactions.init={}},fluid.failureEvent.addListener(fluid.clearTransactions,"clearTransactions","before:fail"),fluid.clearLinkCounts=function(transRec,relaysAlso){fluid.each(transRec,function(value,key){"number"==typeof value?transRec[key]=0:relaysAlso&&value.options&&"number"==typeof value.relayCount&&(value.relayCount=0)})},fluid.computeInitialOutArcs=function(transacs,mrec){return fluid.transform(mrec,function(recel,id){var oneOutArcs={},listeners=recel.that.applier.listeners.sortedListeners;fluid.each(listeners,function(listener){if(listener.isRelay&&!fluid.isExcludedChangeSource(transacs[id],listener.cond)){var targetId=listener.targetId;targetId!==id&&(oneOutArcs[targetId]=!0)}});var togo=Object.keys(oneOutArcs).map(function(id){return mrec[id]});return fluid.remove_if(togo,function(rec){return void 0===rec}),togo})},fluid.sortCompleteLast=function(reca,recb){return(reca.completeOnInit?1:0)-(recb.completeOnInit?1:0)},fluid.operateInitialTransaction=function(that,mrec){var transac,transId=fluid.allocateGuid(),transRec=fluid.getModelTransactionRec(that,transId),transacs=fluid.transform(mrec,function(recel){return transac=recel.that.applier.initiate(null,"init",transId),transRec[recel.that.applier.applierId]={transaction:transac},transac}),outArcs=fluid.computeInitialOutArcs(transacs,mrec),recs=fluid.values(mrec),components=fluid.stronglyConnected(recs,function(mrec){return outArcs[mrec.that.id]}),priorityIndex=0;components.forEach(function(component){component.forEach(function(recel){recel.initPriority=recel.completeOnInit?Math.Infinity:priorityIndex++})}),recs.sort(function(reca,recb){return reca.initPriority-recb.initPriority}),recs.forEach(function(recel){var that=recel.that,transac=transacs[that.id];recel.completeOnInit?fluid.initModelEvent(that,that.applier,transac,that.applier.listeners.sortedListeners):fluid.each(recel.initModels,function(initModel){transac.fireChangeRequest({type:"ADD",segs:[],value:initModel}),fluid.clearLinkCounts(transRec,!0)});var shadow=fluid.shadowForComponent(that);shadow&&(shadow.modelComplete=!0)}),transac.commit()},fluid.deenlistModelComponent=function(that){var instantiator=fluid.getInstantiator(that),mrec=instantiator.modelTransactions.init;if(mrec[that.id]&&(that.model=void 0,mrec[that.id].complete=!0,!fluid.find_if(mrec,function(recel){return!0!==recel.complete}))){try{fluid.operateInitialTransaction(that,mrec)}catch(e){throw fluid.clearTransactions(),e}instantiator.modelTransactions.init={}}},fluid.parseModelReference=function(that,ref){var parsed=fluid.parseContextReference(ref);return parsed.segs=that.applier.parseEL(parsed.path),parsed},fluid.parseValidModelReference=function(that,name,ref,implicitRelay){var parsed,contextTarget,target,reject=function(){var failArgs=["Error in "+name+": ",ref].concat(fluid.makeArray(arguments));fluid.fail.apply(null,failArgs)},rejectNonModel=function(value){reject(" must be a reference to a component with a ChangeApplier (descended from fluid.modelComponent), instead got ",value)};if("string"==typeof ref)if(fluid.isIoCReference(ref)){var modelPoint=(parsed=fluid.parseModelReference(that,ref)).segs.indexOf("model");-1===modelPoint?implicitRelay?parsed.nonModel=!0:reject(' must be a reference into a component model via a path including the segment "model"'):(parsed.modelSegs=parsed.segs.slice(modelPoint+1),parsed.contextSegs=parsed.segs.slice(0,modelPoint),delete parsed.path)}else parsed={path:ref,modelSegs:that.applier.parseEL(ref)};else fluid.isArrayable(ref.segs)||reject(' must contain an entry "segs" holding path segments referring a model path within a component'),parsed={context:ref.context,modelSegs:fluid.expandOptions(ref.segs,that)};return target=parsed.context?((contextTarget=fluid.resolveContext(parsed.context,that))||reject(" context must be a reference to an existing component"),parsed.contextSegs?fluid.getForComponent(contextTarget,parsed.contextSegs):contextTarget):that,parsed.nonModel||(fluid.isComponent(target)||rejectNonModel(target),target.applier||fluid.getForComponent(target,["applier"]),target.applier||rejectNonModel(target)),parsed.that=target,parsed.applier=target&&target.applier,parsed.path||(parsed.path=target&&target.applier.composeSegments.apply(null,parsed.modelSegs)),parsed},fluid.getModelTransactionRec=function(that,transId){var instantiator=fluid.getInstantiator(that);if(transId||fluid.fail("Cannot get transaction record without transaction id"),!instantiator)return null;var transRec=instantiator.modelTransactions[transId];return transRec||(transRec=instantiator.modelTransactions[transId]={relays:[],sources:{},externalChanges:{}}),transRec},fluid.recordChangeListener=function(component,applier,sourceListener,listenerId){var shadow=fluid.shadowForComponent(component);fluid.recordListener(applier.modelChanged,sourceListener,shadow,listenerId)},fluid.registerRelayTransaction=function(transRec,targetApplier,transId,options,npOptions){var newTrans=targetApplier.initiate("relay",null,transId),transEl=transRec[targetApplier.applierId]={transaction:newTrans,relayCount:0,namespace:npOptions.namespace,priority:npOptions.priority,options:options};return transEl.priority=fluid.parsePriority(transEl.priority,transRec.relays.length,!1,"model relay"),transRec.relays.push(transEl),transEl},fluid.relayRecursionBailout=100,fluid.registerDirectChangeRelay=function(target,targetSegs,source,sourceSegs,linkId,transducer,options,npOptions){var targetApplier=options.targetApplier||target.applier,sourceApplier=options.sourceApplier||source.applier,applierId=targetApplier.applierId;targetSegs=fluid.makeArray(targetSegs),sourceSegs=fluid.makeArray(sourceSegs);var sourceListener=function(newValue,oldValue,path,changeRequest,trans,applier){var transId=trans.id,transRec=fluid.getModelTransactionRec(target,transId);applier&&trans&&!transRec[applier.applierId]&&(transRec[applier.applierId]={transaction:trans});var existing=transRec[applierId];transRec[linkId]=transRec[linkId]||0;++transRec[linkId],transRec[linkId]>fluid.relayRecursionBailout&&fluid.fail("Error in model relay specification at component ",target," - operated more than "+fluid.relayRecursionBailout+" relays without model value settling - current model contents are ",trans.newHolder.model),existing||(existing=fluid.registerRelayTransaction(transRec,targetApplier,transId,options,npOptions)),transducer&&!options.targetApplier?transducer(existing.transaction,options.sourceApplier?void 0:newValue,sourceSegs,targetSegs,changeRequest):(changeRequest&&"DELETE"===changeRequest.type&&existing.transaction.fireChangeRequest({type:"DELETE",segs:targetSegs}),void 0!==newValue&&existing.transaction.fireChangeRequest({type:"ADD",segs:targetSegs,value:newValue}))},spec=sourceApplier.modelChanged.addListener({isRelay:!0,cond:transducer&&transducer.cond,targetId:target.id,targetApplierId:targetApplier.id,segs:sourceSegs,transactional:options.transactional},sourceListener);fluid.passLogLevel(fluid.logLevel.TRACE)&&fluid.log(fluid.logLevel.TRACE,"Adding relay listener with listenerId "+spec.listenerId+" to source applier with id "+sourceApplier.applierId+" from target applier with id "+applierId+" for target component with id "+target.id),source&&(fluid.recordChangeListener(source,sourceApplier,sourceListener,spec.listenerId),target!==source&&fluid.recordChangeListener(target,sourceApplier,sourceListener,spec.listenerId))},fluid.connectModelRelay=function(source,sourceSegs,target,targetSegs,options){var linkId=fluid.allocateGuid();function enlistComponent(component){var enlist=fluid.enlistModelComponent(component);enlist.complete&&(fluid.shadowForComponent(component).modelComplete&&(enlist.completeOnInit=!0))}enlistComponent(target),enlistComponent(source);var npOptions=fluid.filterKeys(options,["namespace","priority"]);options.update?options.targetApplier?fluid.registerDirectChangeRelay(source,sourceSegs,target,targetSegs,linkId,null,{transactional:!1,targetApplier:options.targetApplier,update:options.update},npOptions):fluid.registerDirectChangeRelay(target,targetSegs,source,[],linkId+"-transform",options.forwardAdapter,{transactional:!0,sourceApplier:options.forwardApplier},npOptions):(fluid.registerDirectChangeRelay(target,targetSegs,source,sourceSegs,linkId,options.forwardAdapter,{transactional:!1},npOptions),fluid.registerDirectChangeRelay(source,sourceSegs,target,targetSegs,linkId,options.backwardAdapter,{transactional:!1},npOptions))},fluid.parseSourceExclusionSpec=function(targetSpec,sourceSpec){return targetSpec.excludeSource=fluid.arrayToHash(fluid.makeArray(sourceSpec.excludeSource||(sourceSpec.includeSource?"*":void 0))),targetSpec.includeSource=fluid.arrayToHash(fluid.makeArray(sourceSpec.includeSource)),targetSpec},fluid.isExcludedChangeSource=function(transaction,spec){if(!spec||!spec.excludeSource)return!1;var excluded=spec.excludeSource["*"];for(var source in transaction.fullSources)spec.excludeSource[source]&&(excluded=!0),spec.includeSource[source]&&(excluded=!1);return excluded},fluid.model.guardedAdapter=function(transaction,cond,func,args){fluid.isExcludedChangeSource(transaction,cond)||func===fluid.model.transform.uninvertibleTransform||func.apply(null,args)},fluid.transformToAdapter=function(transform,targetPath){var basedTransform={};return basedTransform[targetPath]=transform,function(trans,newValue,sourceSegs,targetSegs,changeRequest){changeRequest&&"DELETE"===changeRequest.type&&trans.fireChangeRequest({type:"DELETE",path:targetPath}),fluid.model.transformWithRules(newValue,basedTransform,{finalApplier:trans})}},fluid.makeTransformPackage=function(componentThat,transform,sourcePath,targetPath,forwardCond,backwardCond,namespace,priority){var that={forwardHolder:{model:transform},backwardHolder:{model:null},generateAdapters:function(trans){if(that.forwardAdapterImpl=fluid.transformToAdapter(trans?trans.newHolder.model:that.forwardHolder.model,targetPath),null!==sourcePath){var inverted=fluid.model.transform.invertConfiguration(transform);inverted!==fluid.model.transform.uninvertibleTransform?(that.backwardHolder.model=inverted,that.backwardAdapterImpl=fluid.transformToAdapter(that.backwardHolder.model,sourcePath)):that.backwardAdapterImpl=inverted}},forwardAdapter:function(transaction,newValue){void 0===newValue&&that.generateAdapters(),fluid.model.guardedAdapter(transaction,forwardCond,that.forwardAdapterImpl,arguments)}};that.forwardAdapter.cond=forwardCond,that.runTransform=function(trans){trans.commit(),trans.reset()},that.forwardApplier=fluid.makeHolderChangeApplier(that.forwardHolder),that.forwardApplier.isRelayApplier=!0,that.invalidator=fluid.makeEventFirer({name:"Invalidator for model relay with applier "+that.forwardApplier.applierId}),null!==sourcePath&&(that.backwardApplier=fluid.makeHolderChangeApplier(that.backwardHolder),that.backwardAdapter=function(transaction){fluid.model.guardedAdapter(transaction,backwardCond,that.backwardAdapterImpl,arguments)},that.backwardAdapter.cond=backwardCond),that.update=that.invalidator.fire;var implicitOptions={targetApplier:that.forwardApplier,update:that.update,namespace:namespace,priority:priority,refCount:0};return that.forwardHolder.model=fluid.parseImplicitRelay(componentThat,transform,[],implicitOptions),that.refCount=implicitOptions.refCount,that.namespace=namespace,that.priority=priority,that.generateAdapters(),that.invalidator.addListener(that.generateAdapters),that.invalidator.addListener(that.runTransform),that},fluid.singleTransformToFull=function(singleTransform){return{"":{transform:$.extend(!0,{inputPath:""},singleTransform)}}},fluid.model.relayConditions={initOnly:{includeSource:"init"},liveOnly:{excludeSource:"init"},never:{includeSource:[]},always:{}},fluid.model.parseRelayCondition=function(condition){var exclusionRec;return"initOnly"===condition?fluid.log(fluid.logLevel.WARN,'The relay condition "initOnly" is deprecated: Please use the form \'includeSource: "init"\' instead'):"liveOnly"===condition&&fluid.log(fluid.logLevel.WARN,'The relay condition "liveOnly" is deprecated: Please use the form \'excludeSource: "init"\' instead'),condition?"string"==typeof condition?(exclusionRec=fluid.model.relayConditions[condition])||fluid.fail('Unrecognised model relay condition string "'+condition+'": the supported values are "never" or a record with members "includeSource" and/or "excludeSource"'):exclusionRec=condition:exclusionRec={},fluid.parseSourceExclusionSpec({},exclusionRec)},fluid.parseModelRelay=function(that,mrrec,key){var parsedSource=void 0!==mrrec.source?fluid.parseValidModelReference(that,'modelRelay record member "source"',mrrec.source):{path:null,modelSegs:null},parsedTarget=fluid.parseValidModelReference(that,'modelRelay record member "target"',mrrec.target),namespace=mrrec.namespace||key,transform=mrrec.singleTransform?fluid.singleTransformToFull(mrrec.singleTransform):mrrec.transform;transform||fluid.fail('Cannot parse modelRelay record without element "singleTransform" or "transform":',mrrec);var forwardCond=fluid.model.parseRelayCondition(mrrec.forward),backwardCond=fluid.model.parseRelayCondition(mrrec.backward),transformPackage=fluid.makeTransformPackage(that,transform,parsedSource.path,parsedTarget.path,forwardCond,backwardCond,namespace,mrrec.priority);0===transformPackage.refCount?fluid.connectModelRelay(parsedSource.that||that,parsedSource.modelSegs,parsedTarget.that,parsedTarget.modelSegs,fluid.filterKeys(transformPackage,["forwardAdapter","backwardAdapter","namespace","priority"])):(parsedSource.modelSegs&&fluid.fail('Error in model relay definition: If a relay transform has a model dependency, you can not specify a "source" entry - please instead enter this as "input" in the transform specification. Definition was ',mrrec," for component ",that),fluid.connectModelRelay(that,null,parsedTarget.that,parsedTarget.modelSegs,transformPackage))},fluid.parseImplicitRelay=function(that,modelRec,segs,options){var value;if(fluid.isIoCReference(modelRec)){var parsed=fluid.parseValidModelReference(that,"model reference from model (implicit relay)",modelRec,!0);parsed.nonModel?value=fluid.getForComponent(parsed.that,parsed.segs):(++options.refCount,fluid.connectModelRelay(that,segs,parsed.that,parsed.modelSegs,options))}else fluid.isPrimitive(modelRec)||!fluid.isPlainObject(modelRec)?value=modelRec:modelRec.expander&&fluid.isPlainObject(modelRec.expander)?value=fluid.expandOptions(modelRec,that):(value=fluid.freshContainer(modelRec),fluid.each(modelRec,function(innerValue,key){segs.push(key);var innerTrans=fluid.parseImplicitRelay(that,innerValue,segs,options);void 0!==innerTrans&&(value[key]=innerTrans),segs.pop()}));return value},fluid.model.notifyExternal=function(transRec){var allChanges=transRec?fluid.values(transRec.externalChanges):[];fluid.sortByPriority(allChanges);for(var i=0;i<allChanges.length;++i){var change=allChanges[i];change.args[5].destroyed||change.listener.apply(null,change.args)}fluid.clearLinkCounts(transRec,!0)},fluid.model.commitRelays=function(instantiator,transactionId){var transRec=instantiator.modelTransactions[transactionId];fluid.each(transRec,function(transEl){transEl.transaction&&(transEl.transaction.commit("relay"),transEl.transaction.reset())})},fluid.model.updateRelays=function(instantiator,transactionId){var transRec=instantiator.modelTransactions[transactionId],updates=0;return fluid.sortByPriority(transRec.relays),fluid.each(transRec.relays,function(transEl){0<transEl.transaction.changeRecord.changes&&transEl.relayCount<2&&transEl.options.update&&(transEl.relayCount++,fluid.clearLinkCounts(transRec),transEl.options.update(transEl.transaction,transRec),++updates)}),updates},fluid.establishModelRelay=function(that,optionsModel,optionsML,optionsMR,applier){var shadow=fluid.shadowForComponent(that);shadow.modelRelayEstablished?fluid.fail("FLUID-5887 failure: Model relay initialised twice on component",that):shadow.modelRelayEstablished=!0,fluid.mergeModelListeners(that,optionsML);var enlist=fluid.enlistModelComponent(that);fluid.each(optionsMR,function(mrrec,key){for(var i=0;i<mrrec.length;++i)fluid.parseModelRelay(that,mrrec[i],key)});var initModels=fluid.transform(optionsModel,function(modelRec){return fluid.parseImplicitRelay(that,modelRec,[],{refCount:0,priority:"first"})});enlist.initModels=initModels;var instantiator=fluid.getInstantiator(that);return applier.preCommit.addListener(function(transaction){for(;0<fluid.model.updateRelays(instantiator,transaction.id););}),applier.preCommit.addListener(function(transaction,applier,code){"relay"!==code&&fluid.model.commitRelays(instantiator,transaction.id)}),applier.postCommit.addListener(function(transaction,applier,code){"relay"!==code&&(fluid.model.notifyExternal(instantiator.modelTransactions[transaction.id]),delete instantiator.modelTransactions[transaction.id])}),null},fluid.defaults("fluid.modelComponent",{gradeNames:["fluid.component"],changeApplierOptions:{relayStyle:!0,cullUnchanged:!0},members:{model:"@expand:fluid.initRelayModel({that}, {that}.modelRelay)",applier:"@expand:fluid.makeHolderChangeApplier({that}, {that}.options.changeApplierOptions)",modelRelay:"@expand:fluid.establishModelRelay({that}, {that}.options.model, {that}.options.modelListeners, {that}.options.modelRelay, {that}.applier)"},mergePolicy:{model:{noexpand:!0,func:fluid.arrayConcatPolicy},modelListeners:fluid.makeMergeListenersPolicy(fluid.arrayConcatPolicy),modelRelay:fluid.makeMergeListenersPolicy(fluid.arrayConcatPolicy,!0)}}),fluid.modelChangedToChange=function(args){return{value:args[0],oldValue:args[1],path:args[2],transaction:args[4]}},fluid.event.invokeListener=function(listener,args,localRecord,mergeRecord){return"string"==typeof listener&&(listener=fluid.event.resolveListener(listener)),listener.apply(null,args,localRecord,mergeRecord)},fluid.resolveModelListener=function(that,record){var togo=function(){if(!fluid.isDestroyed(that)){var change=fluid.modelChangedToChange(arguments),args=arguments,localRecord={change:change,arguments:args},mergeRecord={source:Object.keys(change.transaction.sources)};record.args&&(args=fluid.expandOptions(record.args,that,{},localRecord)),fluid.event.invokeListener(record.listener,fluid.makeArray(args),localRecord,mergeRecord)}};return fluid.event.impersonateListener(record.listener,togo),togo},fluid.registerModelListeners=function(that,record,paths,namespace){var func=fluid.resolveModelListener(that,record);fluid.each(record.byTarget,function(parsedArray){var parsed=parsedArray[0],spec={listener:func,listenerId:fluid.allocateGuid(),segsArray:fluid.getMembers(parsedArray,"modelSegs"),pathArray:fluid.getMembers(parsedArray,"path"),includeSource:record.includeSource,excludeSource:record.excludeSource,priority:fluid.expandOptions(record.priority,that),transactional:!0};(spec=parsed.applier.modelChanged.addListener(spec,func,namespace,record.softNamespace),fluid.recordChangeListener(that,parsed.applier,func,spec.listenerId),that===parsed.that||fluid.isModelComplete(that))||fluid.getForComponent(that,["events","onCreate"]).addListener(function(){if(fluid.isModelComplete(parsed.that)){var trans=parsed.applier.initiate(null,"init");fluid.initModelEvent(that,parsed.applier,trans,[spec]),trans.commit()}})})},fluid.mergeModelListeners=function(that,listeners){fluid.each(listeners,function(value,key){"string"==typeof value&&(value={funcName:value});var records=fluid.event.resolveListenerRecord(value,that,"modelListeners",null,!1).records;fluid.each(records,function(record){record.byTarget={};var paths=fluid.makeArray(void 0===record.path?key:record.path);fluid.each(paths,function(path){var parsed=fluid.parseValidModelReference(that,"modelListeners entry",path);fluid.pushArray(record.byTarget,parsed.that.id,parsed)});var namespace=(record.namespace&&!record.softNamespace?record.namespace:null)||(void 0!==record.path?key:null);fluid.registerModelListeners(that,record,paths,namespace)})})},fluid.fireChanges=function(applier,changes){for(var i=0;i<changes.length;++i)applier.fireChangeRequest(changes[i])},fluid.model.isChangedPath=function(changeMap,segs){for(var i=0;i<=segs.length;++i){if("string"==typeof changeMap)return!0;i<segs.length&&changeMap&&(changeMap=changeMap[segs[i]])}return!1},fluid.model.setChangedPath=function(options,segs,value){var notePath=function(record){segs.unshift(record),fluid.model.setSimple(options,segs,value),segs.shift()};fluid.model.isChangedPath(options.changeMap,segs)||(++options.changes,notePath("changeMap")),fluid.model.isChangedPath(options.deltaMap,segs)||(++options.deltas,notePath("deltaMap"))},fluid.model.fetchChangeChildren=function(target,i,segs,source,options){fluid.each(source,function(value,key){segs[i]=key,fluid.model.applyChangeStrategy(target,key,i,segs,value,options),segs.length=i})},fluid.model.isSameValue=function(a,b){return"number"!=typeof a||"number"!=typeof b?a===b:a===b||a!=a&&b!=b||Math.abs((a-b)/b)<1e-12},fluid.model.applyChangeStrategy=function(target,name,i,segs,source,options){var targetSlot=target[name],sourceCode=fluid.typeCode(source),targetCode=fluid.typeCode(targetSlot),changedValue=fluid.NO_VALUE;"primitive"===sourceCode?fluid.model.isSameValue(targetSlot,source)||(changedValue=source,++options.unchanged):(targetCode!==sourceCode||"array"===sourceCode&&source.length!==targetSlot.length)&&(changedValue=fluid.freshContainer(source)),changedValue!==fluid.NO_VALUE&&(target[name]=changedValue,options.changeMap&&fluid.model.setChangedPath(options,segs,options.inverse?"DELETE":"ADD")),"primitive"!==sourceCode&&fluid.model.fetchChangeChildren(target[name],i+1,segs,source,options)},fluid.model.stepTargetAccess=function(target,type,segs,startpos,endpos,options){for(var i=startpos;i<endpos;++i){if(target)target[segs[i]]!==(target=fluid.model.traverseWithStrategy(target,segs,i,options["ADD"===type?"resolverSetConfig":"resolverGetConfig"],segs.length-i-1))&&options.changeMap&&fluid.model.setChangedPath(options,segs.slice(0,i+1),"ADD")}return{root:target,last:segs[endpos]}},fluid.model.defaultAccessorConfig=function(options){return(options=options||{}).resolverSetConfig=options.resolverSetConfig||fluid.model.escapedSetConfig,options.resolverGetConfig=options.resolverGetConfig||fluid.model.escapedGetConfig,options},fluid.model.applyHolderChangeRequest=function(holder,request,options){(options=fluid.model.defaultAccessorConfig(options)).deltaMap=options.changeMap?{}:null,options.deltas=0;var pen,length=request.segs.length,atRoot=0===length;if(pen=atRoot?{root:holder,last:"model"}:(holder.model||(holder.model={},fluid.model.setChangedPath(options,[],options.inverse?"DELETE":"ADD")),fluid.model.stepTargetAccess(holder.model,request.type,request.segs,0,length-1,options)),"ADD"===request.type){var value=request.value,segs=fluid.makeArray(request.segs);fluid.model.applyChangeStrategy(pen.root,pen.last,length-1,segs,value,options,atRoot)}else"DELETE"===request.type?pen.root&&void 0!==pen.root[pen.last]&&(delete pen.root[pen.last],options.changeMap&&fluid.model.setChangedPath(options,request.segs,"DELETE")):fluid.fail("Unrecognised change type of "+request.type);return options.deltas?options.deltaMap:null},fluid.model.diff=function(modela,modelb,options){options=options||{changes:0,unchanged:0,changeMap:{}};var togo,typea=fluid.typeCode(modela),typeb=fluid.typeCode(modelb);if("primitive"===typea&&"primitive"===typeb)togo=fluid.model.isSameValue(modela,modelb);else if("primitive"===typea^"primitive"===typeb)togo=!1;else{var holdera={model:fluid.copy(modela)};fluid.model.applyHolderChangeRequest(holdera,{value:modelb,segs:[],type:"ADD"},options);var holderb={model:fluid.copy(modelb)};options.inverse=!0,fluid.model.applyHolderChangeRequest(holderb,{value:modela,segs:[],type:"ADD"},options),togo=0===options.changes}return!1===togo&&0===options.changes?(options.changes=1,options.changeMap=void 0===modelb?"DELETE":"ADD"):!0===togo&&0===options.unchanged&&(options.unchanged=1),togo},fluid.outputMatches=function(matches,outSegs,root){fluid.each(root,function(value,key){matches.push(outSegs.concat(key))})},fluid.matchChanges=function(changeMap,specSegs,newHolder,oldHolder){for(var newRoot=newHolder.model,oldRoot=oldHolder.model,map=changeMap,outSegs=["model"],wildcard=!1,togo=[],i=0;i<specSegs.length;++i){var seg=specSegs[i];"*"===seg?i===specSegs.length-1?wildcard=!0:fluid.fail("Wildcard specification in modelChanged listener is only supported for the final path segment: "+specSegs.join(".")):(outSegs.push(seg),map=fluid.isPrimitive(map)?map:map[seg],newRoot=newRoot?newRoot[seg]:void 0,oldRoot=oldRoot?oldRoot[seg]:void 0)}return map&&(wildcard?"DELETE"===map?fluid.outputMatches(togo,outSegs,oldRoot):"ADD"===map?fluid.outputMatches(togo,outSegs,newRoot):fluid.outputMatches(togo,outSegs,map):togo.push(outSegs)),togo},fluid.storeExternalChange=function(transRec,applier,invalidPath,spec,args){var pathString=applier.composeSegments.apply(null,invalidPath),keyString=[applier.holder.id,spec.listenerId,spec.wildcard?pathString:""].join("|");transRec.externalChanges[keyString]={listener:spec.listener,namespace:spec.namespace,priority:spec.priority,args:args}},fluid.notifyModelChanges=function(listeners,changeMap,newHolder,oldHolder,changeRequest,transaction,applier,that){if(listeners)for(var transRec=transaction&&fluid.getModelTransactionRec(that,transaction.id),i=0;i<listeners.length;++i)for(var spec=listeners[i],multiplePaths=1<spec.segsArray.length,j=0;j<spec.segsArray.length;++j)for(var invalidPaths=fluid.matchChanges(changeMap,spec.segsArray[j],newHolder,oldHolder),k=0;k<invalidPaths.length;++k){if(applier.destroyed)return;var invalidPath=invalidPaths[k];spec.listener=fluid.event.resolveListener(spec.listener);var args=[multiplePaths?newHolder.model:fluid.model.getSimple(newHolder,invalidPath),multiplePaths?oldHolder.model:fluid.model.getSimple(oldHolder,invalidPath),multiplePaths?[]:invalidPath.slice(1),changeRequest,transaction,applier];if(!spec.isRelay){if(fluid.model.diff(args[0],args[1]))continue;if(fluid.isExcludedChangeSource(transaction,spec))continue}transRec&&!spec.isRelay&&spec.transactional?fluid.storeExternalChange(transRec,applier,invalidPath,spec,args):spec.listener.apply(null,args)}},fluid.bindELMethods=function(applier){applier.parseEL=function(EL){return fluid.model.pathToSegments(EL,applier.options.resolverSetConfig)},applier.composeSegments=function(){return applier.options.resolverSetConfig.parser.compose.apply(null,arguments)}},fluid.initModelEvent=function(that,applier,trans,listeners){fluid.notifyModelChanges(listeners,"ADD",trans.oldHolder,fluid.emptyHolder,null,trans,applier,that)},fluid.emptyHolder=fluid.freezeRecursive({model:void 0}),fluid.preFireChangeRequest=function(applier,changeRequest){changeRequest.type||(changeRequest.type="ADD"),changeRequest.segs=changeRequest.segs||applier.parseEL(changeRequest.path)},fluid.bindRequestChange=function(that){that.change=function(path,value,type,source){var changeRequest={path:path,value:value,type:type,source:source};that.fireChangeRequest(changeRequest)}},fluid.isObjectSimple=function(totest){return"[object Object]"===Object.prototype.toString.call(totest)},fluid.mergeChangeSources=function(target,globalSources){fluid.isObjectSimple(globalSources)?fluid.extend(target,globalSources):fluid.each(fluid.makeArray(globalSources),function(globalSource){target[globalSource]=!0})},fluid.ChangeApplier=function(){},fluid.makeHolderChangeApplier=function(holder,options){options=fluid.model.defaultAccessorConfig(options);var applierId=fluid.allocateGuid(),that=new fluid.ChangeApplier,name=fluid.isComponent(holder)?"ChangeApplier for component "+fluid.dumpThat(holder):"ChangeApplier with id "+applierId;return $.extend(that,{applierId:applierId,holder:holder,listeners:fluid.makeEventFirer({name:"Internal change listeners for "+name}),transListeners:fluid.makeEventFirer({name:"External change listeners for "+name}),options:options,modelChanged:{},preCommit:fluid.makeEventFirer({name:"preCommit event for "+name}),postCommit:fluid.makeEventFirer({name:"postCommit event for "+name})}),that.destroy=function(){that.preCommit.destroy(),that.postCommit.destroy(),that.destroyed=!0},that.modelChanged.addListener=function(spec,listener,namespace,softNamespace){return(spec="string"==typeof spec?{path:spec}:fluid.copy(spec)).listenerId=spec.listenerId||fluid.allocateGuid(),spec.namespace=namespace,spec.softNamespace=softNamespace,"string"==typeof listener&&(listener={globalName:listener}),spec.listener=listener,!1!==spec.transactional&&(spec.transactional=!0),spec.segsArray||(void 0!==spec.path&&(spec.segs=spec.segs||that.parseEL(spec.path)),spec.segsArray||(spec.segsArray=[spec.segs])),spec.isRelay||(fluid.parseSourceExclusionSpec(spec,spec),spec.wildcard=fluid.accumulate(fluid.transform(spec.segsArray,function(segs){return fluid.contains(segs,"*")}),fluid.add,0),spec.wildcard&&1<spec.segsArray.length&&fluid.fail("Error in model listener specification ",spec," - you may not supply a wildcard pattern as one of a set of multiple paths to be matched")),that[spec.transactional?"transListeners":"listeners"].addListener(spec),spec},that.modelChanged.removeListener=function(listener){that.listeners.removeListener(listener),that.transListeners.removeListener(listener)},that.fireChangeRequest=function(changeRequest){var ation=that.initiate("local",changeRequest.source);ation.fireChangeRequest(changeRequest),ation.commit()},that.initiate=function(localSource,globalSources,transactionId){var defeatPost="relay"===(localSource="init"===globalSources?null:localSource||"local"),trans={instanceId:fluid.allocateGuid(),id:transactionId||fluid.allocateGuid(),changeRecord:{resolverSetConfig:options.resolverSetConfig,resolverGetConfig:options.resolverGetConfig},reset:function(){trans.oldHolder=holder,trans.newHolder={model:fluid.copy(holder.model)},trans.changeRecord.changes=0,trans.changeRecord.unchanged=0,trans.changeRecord.changeMap={}},commit:function(code){if(that.preCommit.fire(trans,that,code),0<trans.changeRecord.changes){var oldHolder={model:holder.model};holder.model=trans.newHolder.model,fluid.notifyModelChanges(that.transListeners.sortedListeners,trans.changeRecord.changeMap,holder,oldHolder,null,trans,that,holder)}defeatPost||that.postCommit.fire(trans,that,code)},fireChangeRequest:function(changeRequest){fluid.preFireChangeRequest(that,changeRequest),changeRequest.transactionId=trans.id;var deltaMap=fluid.model.applyHolderChangeRequest(trans.newHolder,changeRequest,trans.changeRecord);fluid.notifyModelChanges(that.listeners.sortedListeners,deltaMap,trans.newHolder,holder,changeRequest,trans,that,holder)},hasChangeSource:function(source){return trans.fullSources[source]}},transRec=fluid.getModelTransactionRec(holder,trans.id);return transRec&&(fluid.mergeChangeSources(transRec.sources,globalSources),trans.sources=transRec.sources,trans.fullSources=Object.create(transRec.sources),trans.fullSources[localSource]=!0),trans.reset(),fluid.bindRequestChange(trans),trans},fluid.bindRequestChange(that),fluid.bindELMethods(that),that},fluid.modelPairToChanges=function(value,oldValue,changePathPrefix){changePathPrefix=changePathPrefix||"";var diffOptions={changes:0,unchanged:0,changeMap:{}};fluid.model.diff(oldValue,value,diffOptions);var changes=[];return fluid.modelPairToChangesImpl(value,fluid.pathUtil.parseEL(changePathPrefix),diffOptions.changeMap,[],changes),changes},fluid.modelPairToChangesImpl=function(value,changePathPrefixSegs,changeMap,changeSegs,changes){"ADD"===changeMap?changes.push({path:changePathPrefixSegs,value:value,type:"ADD"}):"DELETE"===changeMap?changes.push({path:changePathPrefixSegs,value:null,type:"DELETE"}):fluid.isPlainObject(changeMap,!0)&&fluid.each(changeMap,function(change,seg){var currentChangeSegs=changeSegs.concat([seg]);"ADD"===change?changes.push({path:changePathPrefixSegs.concat(currentChangeSegs),value:fluid.get(value,currentChangeSegs),type:"ADD"}):"DELETE"===change?changes.push({path:changePathPrefixSegs.concat(currentChangeSegs),value:null,type:"DELETE"}):fluid.isPlainObject(change,!0)&&fluid.modelPairToChangesImpl(value,changePathPrefixSegs,change,currentChangeSegs,changes)})}}(jQuery,fluid_3_0_0);fluid_3_0_0=fluid_3_0_0||{};!function($,fluid){"use strict";fluid.defaults("fluid.remoteModelComponent",{gradeNames:["fluid.modelComponent"],events:{afterFetch:null,onFetch:null,onFetchError:null,afterWrite:null,onWrite:null,onWriteError:null},members:{pendingRequests:{write:null,fetch:null}},model:{local:{},remote:{},requestInFlight:!1},modelListeners:{requestInFlight:{listener:"fluid.remoteModelComponent.launchPendingRequest",args:["{that}"]}},listeners:{"afterFetch.updateModel":{listener:"fluid.remoteModelComponent.updateModelFromFetch",args:["{that}","{arguments}.0"],priority:"before:unblock"},"afterFetch.unblock":{listener:"fluid.remoteModelComponent.unblockFetchReq",args:["{that}"]},"onFetchError.unblock":{listener:"fluid.remoteModelComponent.unblockFetchReq",args:["{that}"]},"afterWrite.updateRemoteModel":{listener:"fluid.remoteModelComponent.updateRemoteFromLocal",args:["{that}"]},"afterWrite.unblock":{changePath:"requestInFlight",value:!1,priority:"after:updateRemoteModel"},"onWriteError.unblock":{changePath:"requestInFlight",value:!1}},invokers:{fetch:{funcName:"fluid.remoteModelComponent.fetch",args:["{that}"]},fetchImpl:"fluid.notImplemented",write:{funcName:"fluid.remoteModelComponent.write",args:["{that}"]},writeImpl:"fluid.notImplemented"}}),fluid.remoteModelComponent.launchPendingRequest=function(that){that.model.requestInFlight||(that.pendingRequests.fetch?that.fetch():that.pendingRequests.write&&that.write())},fluid.remoteModelComponent.updateModelFromFetch=function(that,fetchedModel){var remoteChanges=fluid.modelPairToChanges(fetchedModel,that.model.remote,"local"),localChanges=fluid.modelPairToChanges(that.model.local,that.model.remote,"local"),changes=remoteChanges.concat(localChanges),transaction=that.applier.initiate();transaction.fireChangeRequest({path:"local",type:"DELETE"}),transaction.change("local",that.model.remote),transaction.fireChangeRequest({path:"remote",type:"DELETE"}),transaction.change("remote",fetchedModel),fluid.fireChanges(transaction,changes),transaction.commit()},fluid.remoteModelComponent.updateRemoteFromLocal=function(that){var transaction=that.applier.initiate();transaction.fireChangeRequest({path:"remote",type:"DELETE"}),transaction.change("remote",that.model.local),transaction.commit()},fluid.remoteModelComponent.makeSequenceStrategy=function(payload){return{invokeNext:function(that){var lisrec=that.sources[that.index];return lisrec.listener=fluid.event.resolveListener(lisrec.listener),lisrec.listener.apply(null,[payload,that.options])},resolveResult:function(){return payload}}},fluid.remoteModelComponent.makeSequence=function(listeners,payload,options){var sequencer=fluid.promise.makeSequencer(listeners,options,fluid.remoteModelComponent.makeSequenceStrategy(payload));return fluid.promise.resumeSequence(sequencer),sequencer},fluid.remoteModelComponent.fireEventSequence=function(event,payload,options){var listeners=fluid.makeArray(event.sortedListeners);return fluid.remoteModelComponent.makeSequence(listeners,payload,options).promise},fluid.remoteModelComponent.fetch=function(that){var activePromise,promise=fluid.promise();(that.pendingRequests.fetch?(activePromise=that.pendingRequests.fetch,fluid.promise.follow(activePromise,promise)):(activePromise=promise,that.pendingRequests.fetch=promise),that.model.requestInFlight)||fluid.remoteModelComponent.fireEventSequence(that.events.onFetch).then(function(){that.applier.change("requestInFlight",!0),that.fetchImpl().then(function(data){var afterFetchSeqPromise=fluid.remoteModelComponent.fireEventSequence(that.events.afterFetch,data);fluid.promise.follow(afterFetchSeqPromise,activePromise)},that.events.onFetchError.fire)},that.events.onFetchError.fire);return promise},fluid.remoteModelComponent.unblockFetchReq=function(that){that.pendingRequests.fetch=null,that.applier.change("requestInFlight",!1)},fluid.remoteModelComponent.write=function(that){var activePromise,promise=fluid.promise();(that.pendingRequests.write?(activePromise=that.pendingRequests.write,fluid.promise.follow(that.pendingRequests.write,promise)):activePromise=promise,that.model.requestInFlight)?that.pendingRequests.write=activePromise:fluid.remoteModelComponent.fireEventSequence(that.events.onWrite).then(function(){if(that.applier.change("requestInFlight",!0),that.pendingRequests.write=null,fluid.model.diff(that.model.local,that.model.remote)){var afterWriteSeqPromise=fluid.remoteModelComponent.fireEventSequence(that.events.afterWrite,that.model.local);fluid.promise.follow(afterWriteSeqPromise,activePromise)}else{that.writeImpl(that.model.local).then(function(data){var afterWriteSeqPromise=fluid.remoteModelComponent.fireEventSequence(that.events.afterWrite,data);fluid.promise.follow(afterWriteSeqPromise,activePromise)},that.events.onWriteError.fire)}},that.events.onWriteError.fire);return promise}}(jQuery,fluid_3_0_0);fluid_3_0_0=fluid_3_0_0||{};!function($,fluid){"use strict";fluid.registerNamespace("fluid.model.transform"),fluid.defaults("fluid.transformFunction",{gradeNames:"fluid.function"}),fluid.defaults("fluid.standardInputTransformFunction",{gradeNames:"fluid.transformFunction"}),fluid.defaults("fluid.standardOutputTransformFunction",{gradeNames:"fluid.transformFunction"}),fluid.defaults("fluid.multiInputTransformFunction",{gradeNames:"fluid.transformFunction"}),fluid.defaults("fluid.standardTransformFunction",{gradeNames:["fluid.standardInputTransformFunction","fluid.standardOutputTransformFunction"]}),fluid.defaults("fluid.lens",{gradeNames:"fluid.transformFunction",invertConfiguration:null}),fluid.model.transform.pathToRule=function(inputPath){return{transform:{type:"fluid.transforms.value",inputPath:inputPath}}},fluid.model.transform.literalValueToRule=function(input){return{transform:{type:"fluid.transforms.literalValue",input:input}}},fluid.model.composePaths=function(prefix,suffix){return suffix=0===suffix?"0":suffix||"",(prefix=0===prefix?"0":prefix||"")?suffix?prefix+"."+suffix:prefix:suffix},fluid.model.transform.accumulateInputPath=function(inputPath,transformer,paths){void 0!==inputPath&&paths.push(fluid.model.composePaths(transformer.inputPrefix,inputPath))},fluid.model.transform.accumulateStandardInputPath=function(input,transformSpec,transformer,paths){fluid.model.transform.getValue(void 0,transformSpec[input],transformer),fluid.model.transform.accumulateInputPath(transformSpec[input+"Path"],transformer,paths)},fluid.model.transform.accumulateMultiInputPaths=function(inputVariables,transformSpec,transformer,paths){fluid.each(inputVariables,function(v,k){fluid.model.transform.accumulateStandardInputPath(k,transformSpec,transformer,paths)})},fluid.model.transform.getValue=function(inputPath,value,transformer){var togo;return void 0!==inputPath&&(togo=fluid.get(transformer.source,fluid.model.composePaths(transformer.inputPrefix,inputPath),transformer.resolverGetConfig)),void 0===togo&&(togo=fluid.isPrimitive(value)?value:"literalValue"in value?value.literalValue:void 0===value.transform?value:transformer.expand(value)),togo},fluid.model.transform.NONDEFAULT_OUTPUT_PATH_RETURN={},fluid.model.transform.setValue=function(userOutputPath,value,transformer){var toset=fluid.copy(value),outputPath=fluid.model.composePaths(transformer.outputPrefix,userOutputPath);return void 0!==toset&&transformer.applier.change(outputPath,toset),userOutputPath?fluid.model.transform.NONDEFAULT_OUTPUT_PATH_RETURN:toset},fluid.model.transform.resolveParam=function(transformSpec,transformer,key,def){var val=fluid.model.transform.getValue(transformSpec[key+"Path"],transformSpec[key],transformer);return void 0!==val?val:def},fluid.model.transform.matchValue=function(expected,actual,partialMatches){var stats={changes:0,unchanged:0,changeMap:{}};return fluid.model.diff(expected,actual,stats),0===stats.unchanged?0:partialMatches?0xffffff000000-16777216*stats.changes+stats.unchanged:stats.changes?0:0xffffff000000+stats.unchanged},fluid.model.transform.invertPaths=function(transformSpec,transformer){var oldOutput=fluid.model.composePaths(transformer.outputPrefix,transformSpec.outputPath);return transformSpec.outputPath=fluid.model.composePaths(transformer.inputPrefix,transformSpec.inputPath),transformSpec.inputPath=oldOutput,transformSpec},fluid.model.transform.prefixApplier=function(transformSpec,transformer){transformSpec.inputPrefix&&transformer.inputPrefixOp.push(transformSpec.inputPrefix),transformSpec.outputPrefix&&transformer.outputPrefixOp.push(transformSpec.outputPrefix),transformer.expand(transformSpec.input),transformSpec.inputPrefix&&transformer.inputPrefixOp.pop(),transformSpec.outputPrefix&&transformer.outputPrefixOp.pop()},fluid.defaults("fluid.model.transform.prefixApplier",{gradeNames:["fluid.transformFunction"]}),fluid.model.makePathStack=function(transform,prefixName){var stack=transform[prefixName+"Stack"]=[];return transform[prefixName]="",{push:function(prefix){var newPath=fluid.model.composePaths(transform[prefixName],prefix);stack.push(transform[prefixName]),transform[prefixName]=newPath},pop:function(){transform[prefixName]=stack.pop()}}},fluid.model.transform.doTransform=function(transformSpec,transformer,transformOpts){var expdef=transformOpts.defaults,transformFn=fluid.getGlobalValue(transformOpts.typeName);"function"!=typeof transformFn&&fluid.fail("Transformation record specifies transformation function with name "+transformSpec.type+" which is not a function - ",transformFn),fluid.hasGrade(expdef,"fluid.transformFunction")||(expdef=fluid.defaults("fluid.standardTransformFunction"));var transformArgs=[transformSpec,transformer];if(fluid.hasGrade(expdef,"fluid.multiInputTransformFunction")){var inputs={};fluid.each(expdef.inputVariables,function(v,k){inputs[k]=function(){var input=fluid.model.transform.getValue(transformSpec[k+"Path"],transformSpec[k],transformer);return input=void 0===input&&null!==v?v:input}}),transformArgs.unshift(inputs)}if(fluid.hasGrade(expdef,"fluid.standardInputTransformFunction")){"input"in transformSpec||"inputPath"in transformSpec||fluid.fail('Error in transform specification. Either "input" or "inputPath" must be specified for a standardInputTransformFunction: received ',transformSpec);var expanded=fluid.model.transform.getValue(transformSpec.inputPath,transformSpec.input,transformer);if(transformArgs.unshift(expanded),void 0===expanded)return}var transformed=transformFn.apply(null,transformArgs);fluid.hasGrade(expdef,"fluid.standardOutputTransformFunction")&&(void 0!==(void 0!==transformSpec.outputPath?transformSpec.outputPath:transformOpts.doOutput?"":void 0)&&void 0!==transformed&&(fluid.model.transform.setValue(transformSpec.outputPath,transformed,transformer),transformed=void 0));return transformed};var globalAccept=[];fluid.registerNamespace("fluid.pathUtil"),fluid.pathUtil.getPathSegment=function(path,i){return fluid.pathUtil.getPathSegmentImpl(globalAccept,path,i),globalAccept[0]},fluid.pathUtil.getHeadPath=function(path){return fluid.pathUtil.getPathSegment(path,0)},fluid.pathUtil.getFromHeadPath=function(path){var firstdot=fluid.pathUtil.getPathSegmentImpl(null,path,0);return firstdot===path.length?"":path.substring(firstdot+1)},fluid.pathUtil.matchPath=function(spec,path,exact){for(var togo=[];;){if(""===path^""===spec&&exact)return null;if(!spec||!path)break;var spechead=fluid.pathUtil.getHeadPath(spec),pathhead=fluid.pathUtil.getHeadPath(path);if("*"!==spechead&&spechead!==pathhead)return null;togo.push(pathhead),spec=fluid.pathUtil.getFromHeadPath(spec),path=fluid.pathUtil.getFromHeadPath(path)}return togo},fluid.model.transform.expandWildcards=function(transformer,source){fluid.each(source,function(value,key){var q=transformer.queuedTransforms;transformer.pathOp.push(fluid.pathUtil.escapeSegment(key.toString()));for(var i=0;i<q.length;++i)if(fluid.pathUtil.matchPath(q[i].matchPath,transformer.path,!0)){var esCopy=fluid.copy(q[i].transformSpec);(void 0===esCopy.inputPath||fluid.model.transform.hasWildcard(esCopy.inputPath))&&(esCopy.inputPath=""),transformer.inputPrefixOp.push(transformer.path),transformer.outputPrefixOp.push(transformer.path);var transformOpts=fluid.model.transform.lookupType(esCopy.type),result=fluid.model.transform.doTransform(esCopy,transformer,transformOpts);void 0!==result&&fluid.model.transform.setValue(null,result,transformer),transformer.outputPrefixOp.pop(),transformer.inputPrefixOp.pop()}fluid.isPrimitive(value)||fluid.model.transform.expandWildcards(transformer,value),transformer.pathOp.pop()})},fluid.model.transform.hasWildcard=function(path){return"string"==typeof path&&-1!==path.indexOf("*")},fluid.model.transform.maybePushWildcard=function(transformSpec,transformer){var matchPath,hw=fluid.model.transform.hasWildcard;return hw(transformSpec.inputPath)?matchPath=fluid.model.composePaths(transformer.inputPrefix,transformSpec.inputPath):(hw(transformer.outputPrefix)||hw(transformSpec.outputPath))&&(matchPath=fluid.model.composePaths(transformer.outputPrefix,transformSpec.outputPath)),!!matchPath&&(transformer.queuedTransforms.push({transformSpec:transformSpec,outputPrefix:transformer.outputPrefix,inputPrefix:transformer.inputPrefix,matchPath:matchPath}),!0)},fluid.model.sortByKeyLength=function(inObject){return fluid.keys(inObject).sort(fluid.compareStringLength(!0))},fluid.model.transform.handleTransformStrategy=function(transformSpec,transformer,transformOpts){return fluid.model.transform.maybePushWildcard(transformSpec,transformer)?void 0:fluid.model.transform.doTransform(transformSpec,transformer,transformOpts)},fluid.model.transform.handleInvertStrategy=function(transformSpec,transformer,transformOpts){transformSpec=fluid.copy(transformSpec),fluid.hasGrade(transformOpts.defaults,"fluid.standardTransformFunction")&&(transformSpec=fluid.model.transform.invertPaths(transformSpec,transformer));var invertor=transformOpts.defaults&&transformOpts.defaults.invertConfiguration;if(invertor){var inverted=fluid.invokeGlobalFunction(invertor,[transformSpec,transformer]);transformer.inverted.push(inverted)}else transformer.inverted.push(fluid.model.transform.uninvertibleTransform)},fluid.model.transform.handleCollectStrategy=function(transformSpec,transformer,transformOpts){var defaults=transformOpts.defaults,standardInput=fluid.hasGrade(defaults,"fluid.standardInputTransformFunction"),multiInput=fluid.hasGrade(defaults,"fluid.multiInputTransformFunction");standardInput&&fluid.model.transform.accumulateStandardInputPath("input",transformSpec,transformer,transformer.inputPaths),multiInput&&fluid.model.transform.accumulateMultiInputPaths(defaults.inputVariables,transformSpec,transformer,transformer.inputPaths);var collector=defaults.collectInputPaths;if(collector){var collected=fluid.makeArray(fluid.invokeGlobalFunction(collector,[transformSpec,transformer]));Array.prototype.push.apply(transformer.inputPaths,collected)}},fluid.model.transform.lookupType=function(typeName,transformSpec){return typeName||fluid.fail("Transformation record is missing a type name: ",transformSpec),-1===typeName.indexOf(".")&&(typeName="fluid.transforms."+typeName),{defaults:fluid.defaults(typeName),typeName:typeName}},fluid.model.transform.processRule=function(rule,transformer){var togo,transformSpec,transformOpts;if("string"==typeof rule?rule=fluid.model.transform.pathToRule(rule):void 0!==rule.literalValue&&(rule=fluid.model.transform.literalValueToRule(rule.literalValue)),rule.transform)if(fluid.isArrayable(rule.transform)){var transforms=rule.transform;togo=void 0;for(var i=0;i<transforms.length;++i)transformSpec=transforms[i],transformOpts=fluid.model.transform.lookupType(transformSpec.type),transformer.transformHandler(transformSpec,transformer,transformOpts)}else transformSpec=rule.transform,transformOpts=fluid.model.transform.lookupType(transformSpec.type),togo=transformer.transformHandler(transformSpec,transformer,transformOpts);return fluid.isArrayable(rule)&&(transformer.collectedFlatSchemaOpts=transformer.collectedFlatSchemaOpts||{},transformer.collectedFlatSchemaOpts[transformer.outputPrefix]="array"),fluid.each(rule,function(value,key){if("transform"!==key){transformer.outputPrefixOp.push(key);var togo=transformer.expand(value,transformer);void 0!==togo&&(fluid.model.transform.setValue(null,togo,transformer),togo=void 0),transformer.outputPrefixOp.pop()}}),togo},fluid.model.transform.makeStrategy=function(transformer,handleFn,transformFn){transformFn=transformFn||fluid.model.transform.processRule,transformer.expand=function(rules){return transformFn(rules,transformer)},transformer.outputPrefixOp=fluid.model.makePathStack(transformer,"outputPrefix"),transformer.inputPrefixOp=fluid.model.makePathStack(transformer,"inputPrefix"),transformer.transformHandler=handleFn},fluid.model.transform.uninvertibleTransform=Object.freeze({}),fluid.model.transform.invertConfiguration=function(rules){var transformer={inverted:[]};return fluid.model.transform.makeStrategy(transformer,fluid.model.transform.handleInvertStrategy),transformer.expand(rules),-1===transformer.inverted.indexOf(fluid.model.transform.uninvertibleTransform)?{transform:transformer.inverted}:fluid.model.transform.uninvertibleTransform},fluid.model.transform.collectInputPaths=function(rules){var transformer={inputPaths:[]};fluid.model.transform.makeStrategy(transformer,fluid.model.transform.handleCollectStrategy),transformer.expand(rules);var inputPathHash=fluid.arrayToHash(transformer.inputPaths);return Object.keys(inputPathHash)},fluid.model.transform.flatSchemaStrategy=function(flatSchema,getConfig){var keys=fluid.model.sortByKeyLength(flatSchema);return function(root,segment,index,segs){for(var path=getConfig.parser.compose.apply(null,segs.slice(0,index)),i=0;i<keys.length;++i){var key=keys[i];if(null!==fluid.pathUtil.matchPath(key,path,!0))return flatSchema[key]}}},fluid.model.transform.defaultSchemaValue=function(schemaValue){return"array"===(fluid.isPrimitive(schemaValue)?schemaValue:schemaValue.type)?[]:{}},fluid.model.transform.isomorphicSchemaStrategy=function(source,getConfig){return function(root,segment,index,segs){var existing=fluid.get(source,segs.slice(0,index),getConfig);return fluid.isArrayable(existing)?"array":"object"}},fluid.model.transform.decodeStrategy=function(source,options,getConfig){return options.isomorphic?fluid.model.transform.isomorphicSchemaStrategy(source,getConfig):options.flatSchema?fluid.model.transform.flatSchemaStrategy(options.flatSchema,getConfig):void 0},fluid.model.transform.schemaToCreatorStrategy=function(strategy){return function(root,segment,index,segs){if(void 0===root[segment]){var schemaValue=strategy(root,segment,index,segs);return root[segment]=fluid.model.transform.defaultSchemaValue(schemaValue),root[segment]}}},fluid.model.transform.sequence=function(source,rules,options){for(var i=0;i<rules.length;++i)source=fluid.model.transform(source,rules[i],options);return source},fluid.model.compareByPathLength=function(changea,changeb){var pdiff=changea.path.length-changeb.path.length;return 0===pdiff?changea.sequence-changeb.sequence:pdiff},fluid.model.fireSortedChanges=function(changes,applier){changes.sort(fluid.model.compareByPathLength),fluid.fireChanges(applier,changes)},fluid.model.transformWithRules=function(source,rules,options){options=options||{};var getConfig=fluid.model.escapedGetConfig,setConfig=fluid.model.escapedSetConfig,schemaStrategy=fluid.model.transform.decodeStrategy(source,options,getConfig),transformer={source:source,target:{model:schemaStrategy?fluid.model.transform.defaultSchemaValue(schemaStrategy(null,"",0,[""])):{}},resolverGetConfig:getConfig,resolverSetConfig:setConfig,collectedFlatSchemaOpts:void 0,queuedChanges:[],queuedTransforms:[]};fluid.model.transform.makeStrategy(transformer,fluid.model.transform.handleTransformStrategy),transformer.applier={fireChangeRequest:function(changeRequest){changeRequest.sequence=transformer.queuedChanges.length,transformer.queuedChanges.push(changeRequest)}},fluid.bindRequestChange(transformer.applier),transformer.expand(rules);var rootSetConfig=fluid.copy(setConfig);return void 0!==transformer.collectedFlatSchemaOpts&&($.extend(transformer.collectedFlatSchemaOpts,options.flatSchema),schemaStrategy=fluid.model.transform.flatSchemaStrategy(transformer.collectedFlatSchemaOpts,getConfig)),rootSetConfig.strategies=[fluid.model.defaultFetchStrategy,schemaStrategy?fluid.model.transform.schemaToCreatorStrategy(schemaStrategy):fluid.model.defaultCreatorStrategy],transformer.finalApplier=options.finalApplier||fluid.makeHolderChangeApplier(transformer.target,{resolverSetConfig:rootSetConfig}),0<transformer.queuedTransforms.length&&(transformer.typeStack=[],transformer.pathOp=fluid.model.makePathStack(transformer,"path"),fluid.model.transform.expandWildcards(transformer,source)),fluid.model.fireSortedChanges(transformer.queuedChanges,transformer.finalApplier),transformer.target.model},$.extend(fluid.model.transformWithRules,fluid.model.transform),fluid.model.transform=fluid.model.transformWithRules,fluid.transformOne=function(rules){return{transformOptions:{transformer:"fluid.model.transformWithRules",config:rules}}},fluid.transformMany=function(rules){return{transformOptions:{transformer:"fluid.model.transform.sequence",config:rules}}}}(jQuery,fluid_3_0_0);fluid_3_0_0=fluid_3_0_0||{};!function($,fluid){"use strict";fluid.registerNamespace("fluid.model.transform"),fluid.registerNamespace("fluid.transforms"),fluid.defaults("fluid.transforms.value",{gradeNames:"fluid.standardTransformFunction",invertConfiguration:"fluid.identity"}),fluid.transforms.value=fluid.identity,fluid.transforms.identity=fluid.transforms.value,fluid.defaults("fluid.transforms.identity",{gradeNames:"fluid.transforms.value"}),fluid.transforms.invertToIdentity=function(transformSpec){return transformSpec.type="fluid.transforms.identity",transformSpec},fluid.defaults("fluid.transforms.literalValue",{gradeNames:"fluid.standardOutputTransformFunction"}),fluid.transforms.literalValue=function(transformSpec){return transformSpec.input},fluid.defaults("fluid.transforms.stringToNumber",{gradeNames:["fluid.standardTransformFunction","fluid.lens"],invertConfiguration:"fluid.transforms.stringToNumber.invert"}),fluid.transforms.stringToNumber=function(value){var newValue=Number(value);return isNaN(newValue)?void 0:newValue},fluid.transforms.stringToNumber.invert=function(transformSpec){return transformSpec.type="fluid.transforms.numberToString",transformSpec},fluid.defaults("fluid.transforms.numberToString",{gradeNames:["fluid.standardTransformFunction","fluid.lens"],invertConfiguration:"fluid.transforms.numberToString.invert"}),fluid.transforms.numberToString=function(value,transformSpec){if("number"==typeof value)return"number"!=typeof transformSpec.scale||isNaN(transformSpec.scale)?value.toString():fluid.roundToDecimal(value,transformSpec.scale,transformSpec.method).toString()},fluid.transforms.numberToString.invert=function(transformSpec){return transformSpec.type="fluid.transforms.stringToNumber",transformSpec},fluid.defaults("fluid.transforms.count",{gradeNames:"fluid.standardTransformFunction"}),fluid.transforms.count=function(value){return fluid.makeArray(value).length},fluid.defaults("fluid.transforms.round",{gradeNames:["fluid.standardTransformFunction","fluid.lens"],invertConfiguration:"fluid.transforms.invertToIdentity"}),fluid.transforms.round=function(value,transformSpec){return fluid.roundToDecimal(value,transformSpec.scale,transformSpec.method)},fluid.defaults("fluid.transforms.delete",{gradeNames:"fluid.transformFunction"}),fluid.transforms.delete=function(transformSpec,transformer){var outputPath=fluid.model.composePaths(transformer.outputPrefix,transformSpec.outputPath);transformer.applier.change(outputPath,null,"DELETE")},fluid.defaults("fluid.transforms.firstValue",{gradeNames:"fluid.standardOutputTransformFunction"}),fluid.transforms.firstValue=function(transformSpec,transformer){transformSpec.values&&transformSpec.values.length||fluid.fail('firstValue transformer requires an array of values at path named "values", supplied',transformSpec);for(var i=0;i<transformSpec.values.length;i++){var value=transformSpec.values[i],expanded=transformer.expand(value);if(void 0!==expanded)return expanded}},fluid.defaults("fluid.transforms.linearScale",{gradeNames:["fluid.multiInputTransformFunction","fluid.standardTransformFunction","fluid.lens"],invertConfiguration:"fluid.transforms.linearScale.invert",inputVariables:{factor:1,offset:0}}),fluid.transforms.linearScale=function(input,extraInputs){var factor=extraInputs.factor(),offset=extraInputs.offset();if("number"==typeof input&&"number"==typeof factor&&"number"==typeof offset)return input*factor+offset},fluid.transforms.linearScale.invert=function(transformSpec){return delete transformSpec.factorPath,delete transformSpec.offsetPath,void 0!==transformSpec.factor&&(transformSpec.factor=0===transformSpec.factor?0:1/transformSpec.factor),void 0!==transformSpec.offset&&(transformSpec.offset=-transformSpec.offset*(void 0!==transformSpec.factor?transformSpec.factor:1)),transformSpec},fluid.defaults("fluid.transforms.binaryOp",{gradeNames:["fluid.multiInputTransformFunction","fluid.standardOutputTransformFunction"],inputVariables:{left:null,right:null}}),fluid.transforms.binaryLookup={"===":function(a,b){return fluid.model.isSameValue(a,b)},"!==":function(a,b){return!fluid.model.isSameValue(a,b)},"<=":function(a,b){return a<=b},"<":function(a,b){return a<b},">=":function(a,b){return b<=a},">":function(a,b){return b<a},"+":function(a,b){return a+b},"-":function(a,b){return a-b},"*":function(a,b){return a*b},"/":function(a,b){return a/b},"%":function(a,b){return a%b},"&&":function(a,b){return a&&b},"||":function(a,b){return a||b}},fluid.transforms.binaryOp=function(inputs,transformSpec,transformer){var left=inputs.left(),right=inputs.right(),operator=fluid.model.transform.getValue(void 0,transformSpec.operator,transformer),fun=fluid.transforms.binaryLookup[operator];return void 0===fun||void 0===left||void 0===right?void 0:fun(left,right)},fluid.defaults("fluid.transforms.condition",{gradeNames:["fluid.multiInputTransformFunction","fluid.standardOutputTransformFunction"],inputVariables:{true:null,false:null,condition:null}}),fluid.transforms.condition=function(inputs){var condition=inputs.condition();if(null!==condition)return inputs[condition?"true":"false"]()},fluid.defaults("fluid.transforms.valueMapper",{gradeNames:["fluid.lens"],invertConfiguration:"fluid.transforms.valueMapper.invert",collectInputPaths:"fluid.transforms.valueMapper.collect"}),fluid.model.transform.compareMatches=function(speca,specb){var matchDiff=specb.matchValue-speca.matchValue;return 0===matchDiff?speca.index-specb.index:matchDiff},fluid.transforms.valueMapper=function(transformSpec,transformer){transformSpec.match||fluid.fail('valueMapper requires an array or hash of matches at path named "match", supplied ',transformSpec);var value=fluid.model.transform.getValue(transformSpec.defaultInputPath,transformSpec.defaultInput,transformer),matchedEntry=fluid.isArrayable(transformSpec.match)?fluid.transforms.valueMapper.longFormMatch(value,transformSpec,transformer):transformSpec.match[value];if(void 0===matchedEntry&&(matchedEntry=transformSpec.noMatch),void 0!==matchedEntry){var outputValue,outputPath=void 0===matchedEntry.outputPath?transformSpec.defaultOutputPath:matchedEntry.outputPath;return transformer.outputPrefixOp.push(outputPath),outputValue=fluid.isPrimitive(matchedEntry)?matchedEntry:matchedEntry.outputUndefinedValue?void 0:void 0===(outputValue=fluid.model.transform.resolveParam(matchedEntry,transformer,"outputValue",void 0))?transformSpec.defaultOutputValue:outputValue,"string"==typeof outputPath&&void 0!==outputValue&&(fluid.model.transform.setValue(void 0,outputValue,transformer,transformSpec.merge),outputValue=void 0),transformer.outputPrefixOp.pop(),outputValue}},fluid.transforms.valueMapper.longFormMatch=function(valueFromDefaultPath,transformSpec,transformer){var o=transformSpec.match;0===o.length&&fluid.fail("valueMapper supplied empty list of matches: ",transformSpec);for(var matchPower=[],i=0;i<o.length;++i){var option=o[i],value=option.inputPath?fluid.model.transform.getValue(option.inputPath,void 0,transformer):valueFromDefaultPath,matchValue=fluid.model.transform.matchValue(option.inputValue,value,option.partialMatches);matchPower[i]={index:i,matchValue:matchValue}}return matchPower.sort(fluid.model.transform.compareMatches),matchPower[0].matchValue<=0?void 0:o[matchPower[0].index]},fluid.transforms.valueMapper.invert=function(transformSpec,transformer){var match=[],togo={type:"fluid.transforms.valueMapper",match:match},isArray=fluid.isArrayable(transformSpec.match);togo.defaultInputPath=fluid.model.composePaths(transformer.outputPrefix,transformSpec.defaultOutputPath),togo.defaultOutputPath=fluid.model.composePaths(transformer.inputPrefix,transformSpec.defaultInputPath);var def=fluid.firstDefined;return fluid.each(transformSpec.match,function(option,key){if(!0!==option.outputUndefinedValue){var outOption={},origInputValue=def(isArray?option.inputValue:key,transformSpec.defaultInputValue);void 0===origInputValue&&fluid.fail("Failure inverting configuration for valueMapper - inputValue could not be resolved for record "+key+": ",transformSpec),outOption.outputValue=origInputValue,outOption.inputValue=!isArray&&fluid.isPrimitive(option)?option:def(option.outputValue,transformSpec.defaultOutputValue),option.outputPath&&(outOption.inputPath=fluid.model.composePaths(transformer.outputPrefix,def(option.outputPath,transformSpec.outputPath))),option.inputPath&&(outOption.outputPath=fluid.model.composePaths(transformer.inputPrefix,def(option.inputPath,transformSpec.inputPath))),match.push(outOption)}}),togo},fluid.transforms.valueMapper.collect=function(transformSpec,transformer){var togo=[];return fluid.model.transform.accumulateStandardInputPath("defaultInput",transformSpec,transformer,togo),fluid.each(transformSpec.match,function(option){fluid.model.transform.accumulateInputPath(option.inputPath,transformer,togo)}),togo},fluid.defaults("fluid.transforms.arrayToSetMembership",{gradeNames:["fluid.standardTransformFunction","fluid.lens"],invertConfiguration:"fluid.transforms.arrayToSetMembership.invert"}),fluid.transforms.arrayToSetMembership=function(value,transformSpec,transformer){var output={},options=transformSpec.options;return value&&fluid.isArrayable(value)||fluid.fail("arrayToSetMembership didn't find array at inputPath nor passed as value.",transformSpec),options||fluid.fail("arrayToSetMembership requires an options block set"),void 0===transformSpec.presentValue&&(transformSpec.presentValue=!0),void 0===transformSpec.missingValue&&(transformSpec.missingValue=!1),fluid.each(options,function(outPath,key){var outVal=-1!==value.indexOf(key)?transformSpec.presentValue:transformSpec.missingValue;fluid.set(output,outPath,outVal,transformer.resolverSetConfig)}),output},fluid.transforms.arrayToSetMembership.invertWithType=function(transformSpec,transformer,newType){transformSpec.type=newType;var newOptions={};return fluid.each(transformSpec.options,function(path,oldKey){newOptions[path]=oldKey}),transformSpec.options=newOptions,transformSpec},fluid.transforms.arrayToSetMembership.invert=function(transformSpec,transformer){return fluid.transforms.arrayToSetMembership.invertWithType(transformSpec,transformer,"fluid.transforms.setMembershipToArray")},fluid.defaults("fluid.transforms.setMembershipToArray",{gradeNames:["fluid.standardTransformFunction","fluid.lens"],invertConfiguration:"fluid.transforms.setMembershipToArray.invert"}),fluid.transforms.setMembershipToArray=function(input,transformSpec,transformer){var options=transformSpec.options;options||fluid.fail("setMembershipToArray requires an options block specified"),void 0===transformSpec.presentValue&&(transformSpec.presentValue=!0),void 0===transformSpec.missingValue&&(transformSpec.missingValue=!1);var outputArr=[];return fluid.each(options,function(outputVal,key){fluid.get(input,key,transformer.resolverGetConfig)===transformSpec.presentValue&&outputArr.push(outputVal)}),outputArr},fluid.transforms.setMembershipToArray.invert=function(transformSpec,transformer){return fluid.transforms.arrayToSetMembership.invertWithType(transformSpec,transformer,"fluid.transforms.arrayToSetMembership")},fluid.model.transform.applyPaths=function(operation,pathOp,paths){for(var i=0;i<paths.length;++i)"push"===operation?pathOp.push(paths[i]):pathOp.pop()},fluid.model.transform.expandInnerValues=function(inputPath,outputPath,transformer,innerValues){var inputPrefixOp=transformer.inputPrefixOp,outputPrefixOp=transformer.outputPrefixOp,apply=fluid.model.transform.applyPaths;apply("push",inputPrefixOp,inputPath),apply("push",outputPrefixOp,outputPath);var expanded={};return fluid.each(innerValues,function(innerValue){var expandedInner=transformer.expand(innerValue);fluid.isPrimitive(expandedInner)?expanded=expandedInner:$.extend(!0,expanded,expandedInner)}),apply("pop",outputPrefixOp,outputPath),apply("pop",inputPrefixOp,inputPath),expanded},fluid.defaults("fluid.transforms.indexArrayByKey",{gradeNames:["fluid.standardTransformFunction","fluid.lens"],invertConfiguration:"fluid.transforms.indexArrayByKey.invert"}),fluid.transforms.indexArrayByKey=function(arr,transformSpec,transformer){void 0===transformSpec.key&&fluid.fail("indexArrayByKey requires a 'key' option.",transformSpec),fluid.isArrayable(arr)||fluid.fail("indexArrayByKey didn't find array at inputPath.",transformSpec);var newHash={},pivot=transformSpec.key;return fluid.each(arr,function(v,k){var newKey=v[pivot],keyType=typeof newKey;"string"!==keyType&&"boolean"!==keyType&&"number"!==keyType&&fluid.fail("indexArrayByKey encountered untransformable array due to missing or invalid key",v);var content=fluid.copy(v);delete content[pivot],transformSpec.innerValue&&(content=fluid.model.transform.expandInnerValues([transformer.inputPrefix,transformSpec.inputPath,k.toString()],[transformSpec.outputPath,newKey],transformer,transformSpec.innerValue)),newHash[newKey]=content}),newHash},fluid.transforms.indexArrayByKey.invert=function(transformSpec){if(transformSpec.type="fluid.transforms.deindexIntoArrayByKey",transformSpec.innerValue)for(var innerValue=transformSpec.innerValue,i=0;i<innerValue.length;++i){var inverted=fluid.model.transform.invertConfiguration(innerValue[i]);if(inverted===fluid.model.transform.uninvertibleTransform)return inverted;innerValue[i]=inverted}return transformSpec},fluid.defaults("fluid.transforms.deindexIntoArrayByKey",{gradeNames:["fluid.standardTransformFunction","fluid.lens"],invertConfiguration:"fluid.transforms.deindexIntoArrayByKey.invert"}),fluid.transforms.deindexIntoArrayByKey=function(hash,transformSpec,transformer){void 0===transformSpec.key&&fluid.fail('deindexIntoArrayByKey requires a "key" option.',transformSpec);var newArray=[],pivot=transformSpec.key;return fluid.each(hash,function(v,k){var content={};content[pivot]=k,transformSpec.innerValue&&(v=fluid.model.transform.expandInnerValues([transformSpec.inputPath,k],[transformSpec.outputPath,newArray.length.toString()],transformer,transformSpec.innerValue)),$.extend(!0,content,v),newArray.push(content)}),newArray},fluid.transforms.deindexIntoArrayByKey.invert=function(transformSpec){if(transformSpec.type="fluid.transforms.indexArrayByKey",transformSpec.innerValue)for(var innerValue=transformSpec.innerValue,i=0;i<innerValue.length;++i)innerValue[i]=fluid.model.transform.invertConfiguration(innerValue[i]);return transformSpec},fluid.defaults("fluid.transforms.limitRange",{gradeNames:["fluid.standardTransformFunction","fluid.lens"],invertConfiguration:"fluid.transforms.invertToIdentity"}),fluid.transforms.limitRange=function(value,transformSpec){var min=transformSpec.min;void 0!==min&&(value<(min+=transformSpec.excludeMin||0)&&(value=min));var max=transformSpec.max;void 0!==max&&((max-=transformSpec.excludeMax||0)<value&&(value=max));return value},fluid.defaults("fluid.transforms.indexOf",{gradeNames:["fluid.standardTransformFunction","fluid.lens"],invertConfiguration:"fluid.transforms.indexOf.invert"}),fluid.transforms.indexOf=function(value,transformSpec){"number"==typeof transformSpec.notFound&&0<=transformSpec.notFound&&fluid.fail("A positive number is not allowed as 'notFound' value for indexOf");var offset=fluid.transforms.parseIndexationOffset(transformSpec.offset,"indexOf"),originalIndex=fluid.makeArray(transformSpec.array).indexOf(value);return-1===originalIndex&&transformSpec.notFound?transformSpec.notFound:originalIndex+offset},fluid.transforms.indexOf.invert=function(transformSpec,transformer){var togo=fluid.transforms.invertArrayIndexation(transformSpec,transformer);return togo.type="fluid.transforms.dereference",togo},fluid.defaults("fluid.transforms.dereference",{gradeNames:["fluid.standardTransformFunction","fluid.lens"],invertConfiguration:"fluid.transforms.dereference.invert"}),fluid.transforms.dereference=function(value,transformSpec){if("number"==typeof value){var offset=fluid.transforms.parseIndexationOffset(transformSpec.offset,"dereference");return fluid.makeArray(transformSpec.array)[value+offset]}},fluid.transforms.dereference.invert=function(transformSpec,transformer){var togo=fluid.transforms.invertArrayIndexation(transformSpec,transformer);return togo.type="fluid.transforms.indexOf",togo},fluid.transforms.parseIndexationOffset=function(offset,transformName){var parsedOffset=0;return void 0!==offset&&(parsedOffset=fluid.parseInteger(offset),isNaN(parsedOffset)&&fluid.fail(transformName+' requires the value of "offset" to be an integer or a string that can be converted to an integer. '+offset+" is invalid.")),parsedOffset},fluid.transforms.invertArrayIndexation=function(transformSpec){return isNaN(Number(transformSpec.offset))||(transformSpec.offset=-1*Number(transformSpec.offset)),transformSpec},fluid.defaults("fluid.transforms.stringTemplate",{gradeNames:"fluid.standardOutputTransformFunction"}),fluid.transforms.stringTemplate=function(transformSpec){return fluid.stringTemplate(transformSpec.template,transformSpec.terms)},fluid.defaults("fluid.transforms.free",{gradeNames:"fluid.transformFunction"}),fluid.transforms.free=function(transformSpec){var args=fluid.makeArray(transformSpec.args);return fluid.invokeGlobalFunction(transformSpec.func,args)},fluid.defaults("fluid.transforms.quantize",{gradeNames:"fluid.standardTransformFunction",collectInputPaths:"fluid.transforms.quantize.collect"}),fluid.transforms.quantize=function(value,transformSpec,transformer){transformSpec.ranges&&transformSpec.ranges.length||fluid.fail("fluid.transforms.quantize should have a key called ranges containing an array defining ranges to quantize");for(var i=0;i<transformSpec.ranges.length;i++){var rangeSpec=transformSpec.ranges[i];if(value<=rangeSpec.upperBound||void 0===rangeSpec.upperBound&&value>=Number.NEGATIVE_INFINITY)return fluid.isPrimitive(rangeSpec.output)?rangeSpec.output:transformer.expand(rangeSpec.output)}},fluid.transforms.quantize.collect=function(transformSpec,transformer){transformSpec.ranges.forEach(function(rangeSpec){fluid.isPrimitive(rangeSpec.output)||transformer.expand(rangeSpec.output)})},fluid.defaults("fluid.transforms.inRange",{gradeNames:"fluid.standardTransformFunction"}),fluid.transforms.inRange=function(value,transformSpec){return(void 0===transformSpec.min||transformSpec.min<=value)&&(void 0===transformSpec.max||transformSpec.max>=value)},fluid.transforms.stringToBoolean=function(value){return!!value&&!("0"===value||"false"===value)},fluid.transforms.stringToBoolean.invert=function(transformSpec){return transformSpec.type="fluid.transforms.booleanToString",transformSpec},fluid.defaults("fluid.transforms.stringToBoolean",{gradeNames:["fluid.standardTransformFunction","fluid.lens"],invertConfiguration:"fluid.transforms.stringToBoolean.invert"}),fluid.transforms.booleanToString=function(value){return value?"true":"false"},fluid.transforms.booleanToString.invert=function(transformSpec){return transformSpec.type="fluid.transforms.stringToBoolean",transformSpec},fluid.defaults("fluid.transforms.booleanToString",{gradeNames:["fluid.standardTransformFunction","fluid.lens"],invertConfiguration:"fluid.transforms.booleanToString.invert"}),fluid.transforms.JSONstringToObject=function(value){try{return JSON.parse(value)}catch(e){return}},fluid.transforms.JSONstringToObject.invert=function(transformSpec){return transformSpec.type="fluid.transforms.objectToJSONString",transformSpec},fluid.defaults("fluid.transforms.JSONstringToObject",{gradeNames:["fluid.standardTransformFunction","fluid.lens"],invertConfiguration:"fluid.transforms.JSONstringToObject.invert"}),fluid.transforms.objectToJSONString=function(value,transformSpec){var space=transformSpec.space||0;return JSON.stringify(value,null,space)},fluid.transforms.objectToJSONString.invert=function(transformSpec){return transformSpec.type="fluid.transforms.JSONstringToObject",transformSpec},fluid.defaults("fluid.transforms.objectToJSONString",{gradeNames:["fluid.standardTransformFunction","fluid.lens"],invertConfiguration:"fluid.transforms.objectToJSONString.invert"}),fluid.transforms.stringToDate=function(value){var date=new Date(value);return isNaN(date.getTime())?void 0:date},fluid.transforms.stringToDate.invert=function(transformSpec){return transformSpec.type="fluid.transforms.dateToString",transformSpec},fluid.defaults("fluid.transforms.stringToDate",{gradeNames:["fluid.standardTransformFunction","fluid.lens"],invertConfiguration:"fluid.transforms.stringToDate.invert"}),fluid.transforms.dateToString=function(value){if(value instanceof Date){var isoString=value.toISOString();return isoString.substring(0,isoString.indexOf("T"))}},fluid.transforms.dateToString.invert=function(transformSpec){return transformSpec.type="fluid.transforms.stringToDate",transformSpec},fluid.defaults("fluid.transforms.dateToString",{gradeNames:["fluid.standardTransformFunction","fluid.lens"],invertConfiguration:"fluid.transforms.dateToString.invert"}),fluid.transforms.dateTimeToString=function(value){return value instanceof Date?value.toISOString():void 0},fluid.defaults("fluid.transforms.dateTimeToString",{gradeNames:["fluid.standardTransformFunction","fluid.lens"],invertConfiguration:"fluid.transforms.dateToString.invert"})}(jQuery,fluid_3_0_0);fluid_3_0_0=fluid_3_0_0||{},fluid=fluid||fluid_3_0_0;!function($,fluid){"use strict";fluid.thatistBridge=function(name,peer){var togo=function(funcname){for(var segs=funcname.split("."),move=peer,i=0;i<segs.length;++i)move=move[segs[i]];var args=[this];2===arguments.length&&(args=args.concat($.makeArray(arguments[1])));var ret=move.apply(null,args);this.that=function(){return ret};var type=typeof ret;return!ret||"string"===type||"number"===type||"boolean"===type||ret&&void 0!==ret.length?ret:this};return $.fn[name]=togo},fluid.thatistBridge("fluid",fluid),fluid.thatistBridge("fluid_3_0_0",fluid_3_0_0);var normalizeTabindexName=function(){return $.browser.msie?"tabIndex":"tabindex"},canHaveDefaultTabindex=function(elements){return!(elements.length<=0)&&$(elements[0]).is("a, input, button, select, area, textarea, object")};fluid.tabindex=function(target,toIndex){return target=$(target),null!=toIndex?function(elements,toIndex){return elements.each(function(i,item){$(item).attr(normalizeTabindexName(),toIndex)})}(target,toIndex):function(elements){if(!(elements.length<=0)){if(!fluid.tabindex.hasAttr(elements))return canHaveDefaultTabindex(elements)?Number(0):void 0;var value=elements.attr(normalizeTabindexName());return Number(value)}}(target)},fluid.tabindex.remove=function(target){return(target=$(target)).each(function(i,item){$(item).removeAttr(normalizeTabindexName())})},fluid.tabindex.hasAttr=function(target){if((target=$(target)).length<=0)return!1;var togo=target.map(function(){var attributeNode=this.getAttributeNode(normalizeTabindexName());return!!attributeNode&&attributeNode.specified});return 1===togo.length?togo[0]:togo},fluid.tabindex.has=function(target){return target=$(target),fluid.tabindex.hasAttr(target)||canHaveDefaultTabindex(target)},fluid.a11y=$.a11y||{},fluid.a11y.orientation={HORIZONTAL:0,VERTICAL:1,BOTH:2};var UP_DOWN_KEYMAP={next:$.ui.keyCode.DOWN,previous:$.ui.keyCode.UP},LEFT_RIGHT_KEYMAP={next:$.ui.keyCode.RIGHT,previous:$.ui.keyCode.LEFT};fluid.tabbable=function(target){target=$(target),target.each(function(idx,item){(!(item=$(item)).fluid("tabindex.has")||item.fluid("tabindex")<0)&&item.fluid("tabindex",0)})};var CONTEXT_KEY="selectionContext",unselectElement=function(selectedElement,selectionContext){!function(selectedElement,handler){handler&&selectedElement&&handler(selectedElement)}(selectedElement,selectionContext.options.onUnselect)},selectElement=function(elementToSelect,selectionContext){var element;unselectElement(selectionContext.selectedElement(),selectionContext),elementToSelect=(element=elementToSelect).jquery?element[0]:element;var newIndex=selectionContext.selectables.index(elementToSelect);-1!==newIndex&&(selectionContext.activeItemIndex=newIndex,function(elementToSelect,handler){handler&&handler(elementToSelect)}(elementToSelect,selectionContext.options.onSelect))},reifyIndex=function(sc_that){var elements=sc_that.selectables;sc_that.activeItemIndex>=elements.length&&(sc_that.activeItemIndex=sc_that.options.noWrap?elements.length-1:0),sc_that.activeItemIndex<0&&-32768!==sc_that.activeItemIndex&&(sc_that.activeItemIndex=sc_that.options.noWrap?0:elements.length-1),0<=sc_that.activeItemIndex&&fluid.focus(elements[sc_that.activeItemIndex])},prepareShift=function(selectionContext){var selElm=selectionContext.selectedElement();selElm&&fluid.blur(selElm),unselectElement(selectionContext.selectedElement(),selectionContext),-32768===selectionContext.activeItemIndex&&(selectionContext.activeItemIndex=-1)},focusNextElement=function(selectionContext){prepareShift(selectionContext),++selectionContext.activeItemIndex,reifyIndex(selectionContext)},focusPreviousElement=function(selectionContext){prepareShift(selectionContext),--selectionContext.activeItemIndex,reifyIndex(selectionContext)},arrowKeyHandler=function(selectionContext,keyMap){return function(evt){evt.which===keyMap.next?(focusNextElement(selectionContext),evt.preventDefault()):evt.which===keyMap.previous&&(focusPreviousElement(selectionContext),evt.preventDefault())}},makeElementsSelectable=function(container,defaults,userOptions){var selectionContext,options=$.extend(!0,{},defaults,userOptions),keyMap=function(direction){var keyMap;return direction===fluid.a11y.orientation.HORIZONTAL?keyMap=LEFT_RIGHT_KEYMAP:direction===fluid.a11y.orientation.VERTICAL&&(keyMap=UP_DOWN_KEYMAP),keyMap}(options.direction),selectableElements=options.selectableElements?options.selectableElements:container.find(options.selectableSelector),that={container:container,activeItemIndex:-32768,selectables:selectableElements,focusIsLeavingContainer:!1,options:options};return that.selectablesUpdated=function(focusedItem){var selectionContext;"number"==typeof that.options.selectablesTabindex&&that.selectables.fluid("tabindex",that.options.selectablesTabindex),that.selectables.off("focus."+CONTEXT_KEY),that.selectables.off("blur."+CONTEXT_KEY),that.selectables.on("focus."+CONTEXT_KEY,(selectionContext=that,function(evt){return $(evt.target).fluid("tabindex",0),selectElement(evt.target,selectionContext),evt.stopPropagation()})),that.selectables.on("blur."+CONTEXT_KEY,function(selectionContext){return function(evt){return $(evt.target).fluid("tabindex",selectionContext.options.selectablesTabindex),unselectElement(evt.target,selectionContext),evt.stopPropagation()}}(that)),keyMap&&that.options.noBubbleListeners&&(that.selectables.off("keydown."+CONTEXT_KEY),that.selectables.on("keydown."+CONTEXT_KEY,arrowKeyHandler(that,keyMap))),focusedItem?selectElement(focusedItem,that):reifyIndex(that)},that.refresh=function(){that.options.selectableSelector||fluid.fail("Cannot refresh selectable context which was not initialised by a selector"),that.selectables=container.find(options.selectableSelector),that.selectablesUpdated()},that.selectedElement=function(){return that.activeItemIndex<0?null:that.selectables[that.activeItemIndex]},keyMap&&!that.options.noBubbleListeners&&container.keydown(arrowKeyHandler(that,keyMap)),container.keydown((selectionContext=that,function(evt){evt.which===$.ui.keyCode.TAB&&(function(selectionContext){-32768!==selectionContext.activeItemIndex&&(selectionContext.options.onLeaveContainer?selectionContext.options.onLeaveContainer(selectionContext.selectables[selectionContext.activeItemIndex]):selectionContext.options.onUnselect&&selectionContext.options.onUnselect(selectionContext.selectables[selectionContext.activeItemIndex])),selectionContext.options.rememberSelectionState||(selectionContext.activeItemIndex=-32768)}(selectionContext),evt.shiftKey&&(selectionContext.focusIsLeavingContainer=!0))})),container.focus(function(selectionContext){return function(evt){var shouldOrig=selectionContext.options.autoSelectFirstItem,shouldSelect="function"==typeof shouldOrig?shouldOrig():shouldOrig;return selectionContext.focusIsLeavingContainer&&(shouldSelect=!1),shouldSelect&&evt.target===selectionContext.container.get(0)&&(-32768===selectionContext.activeItemIndex&&(selectionContext.activeItemIndex=0),fluid.focus(selectionContext.selectables[selectionContext.activeItemIndex])),evt.stopPropagation()}}(that)),container.blur(function(selectionContext){return function(evt){return selectionContext.focusIsLeavingContainer=!1,evt.stopPropagation()}}(that)),that.selectablesUpdated(),that};fluid.selectable=function(target,options){target=$(target);var that=makeElementsSelectable(target,fluid.selectable.defaults,options);return fluid.setScopedData(target,CONTEXT_KEY,that),that},fluid.selectable.select=function(target,toSelect){fluid.focus(toSelect)},fluid.selectable.selectNext=function(target){target=$(target),focusNextElement(fluid.getScopedData(target,CONTEXT_KEY))},fluid.selectable.selectPrevious=function(target){target=$(target),focusPreviousElement(fluid.getScopedData(target,CONTEXT_KEY))},fluid.selectable.currentSelection=function(target){target=$(target);var that=fluid.getScopedData(target,CONTEXT_KEY);return $(that.selectedElement())},fluid.selectable.defaults={direction:fluid.a11y.orientation.VERTICAL,selectablesTabindex:-1,autoSelectFirstItem:!0,rememberSelectionState:!0,selectableSelector:".selectable",selectableElements:null,onSelect:null,onUnselect:null,onLeaveContainer:null,noWrap:!1};var makeActivationHandler=function(binding){return function(evt){var target=evt.target;if(fluid.enabled(target)&&((evt.which?evt.which:evt.keyCode)===binding.key&&binding.activateHandler&&function(binding,evt){if(!binding.modifier)return!0;var modifierKey=binding.modifier,isCtrlKeyPresent=modifierKey&&evt.ctrlKey,isAltKeyPresent=modifierKey&&evt.altKey,isShiftKeyPresent=modifierKey&&evt.shiftKey;return isCtrlKeyPresent||isAltKeyPresent||isShiftKeyPresent}(binding,evt))){var event=$.Event("fluid-activate");$(target).trigger(event,[binding.activateHandler]),event.isDefaultPrevented()&&evt.preventDefault()}}};fluid.activatable=function(target,fn,options){!function(elements,onActivateHandler,defaultKeys,options){var bindings=[];$(defaultKeys).each(function(index,key){bindings.push({modifier:null,key:key,activateHandler:onActivateHandler})}),options&&options.additionalBindings&&(bindings=bindings.concat(options.additionalBindings)),fluid.initEnablement(elements);for(var i=0;i<bindings.length;++i){var binding=bindings[i];elements.keydown(makeActivationHandler(binding))}elements.on("fluid-activate",function(evt,handler){return(handler=handler||onActivateHandler)?handler(evt):null})}(target=$(target),fn,fluid.activatable.defaults.keys,options)},fluid.activate=function(target){$(target).trigger("fluid-activate")},fluid.activatable.defaults={keys:[$.ui.keyCode.ENTER,$.ui.keyCode.SPACE]}}(jQuery,fluid_3_0_0);fluid_3_0_0=fluid_3_0_0||{};!function($,fluid){"use strict";fluid.defaults("fluid.viewComponent",{gradeNames:["fluid.modelComponent"],initFunction:"fluid.initView",argumentMap:{container:0,options:1},members:{dom:"@expand:fluid.initDomBinder({that}, {that}.options.selectors)"}}),fluid.dumpSelector=function(selectable){return"string"==typeof selectable?selectable:selectable.selector?selectable.selector:""},fluid.diagnoseFailedView=function(componentName,that,options,args){if(!that&&fluid.hasGrade(options,"fluid.viewComponent")){var container=fluid.wrap(args[1]),message1="Instantiation of view component with type "+componentName+" failed, since ";container?0===container.length?fluid.fail(message1+'selector "',fluid.dumpSelector(args[1]),'" did not match any markup in the document'):fluid.fail(message1+" component creator function did not return a value"):fluid.fail(message1+" container argument is empty")}},fluid.checkTryCatchParameter=function(){var GETparams=(window.location||{search:"",protocol:"file:"}).search.slice(1).split("&");return!0===fluid.find(GETparams,function(param){if(0===param.indexOf("notrycatch"))return!0})},fluid.notrycatch=fluid.checkTryCatchParameter(),fluid.wrap=function(obj,userJQuery){return userJQuery=userJQuery||$,!obj||obj.jquery?obj:userJQuery(obj)},fluid.unwrap=function(obj){return obj&&obj.jquery?obj[0]:obj},fluid.container=function(containerSpec,fallible,userJQuery){var selector=containerSpec.selector||containerSpec;userJQuery&&(containerSpec=fluid.unwrap(containerSpec));var container=fluid.wrap(containerSpec,userJQuery);if(fallible&&(!container||0===container.length))return null;if(!container||!container.jquery||1!==container.length){"string"!=typeof containerSpec&&(containerSpec=container.selector);var count=void 0!==container.length?container.length:0;fluid.fail((1<count?"More than one ("+count+") container elements were":"No container element was")+" found for selector "+containerSpec)}return fluid.isDOMNode(container[0])||fluid.fail("fluid.container was supplied a non-jQueryable element"),container.selector=selector,container.context=container.context||containerSpec.ownerDocument||document,container},fluid.createDomBinder=function(container,selectors){var that={id:fluid.allocateGuid(),cache:{}},userJQuery=container.constructor;function cacheKey(name,thisContainer){return fluid.allocateSimpleId(thisContainer)+"-"+name}return that.locate=function(name,localContainer){var selector,thisContainer,togo;if(void 0!==(selector=selectors[name]))return(thisContainer=localContainer?$(localContainer):container)||fluid.fail("DOM binder invoked for selector "+name+" without container"),(togo=""===selector?thisContainer:selector?"function"==typeof selector?userJQuery(selector.call(null,fluid.unwrap(thisContainer))):userJQuery(selector,thisContainer):userJQuery()).selector||(togo.selector=selector,togo.context=thisContainer),function(name,thisContainer,result){that.cache[cacheKey(name,thisContainer)]=result}(togo.selectorName=name,thisContainer,togo),togo},that.fastLocate=function(name,localContainer){var key=cacheKey(name,localContainer||container),togo=that.cache[key];return togo||that.locate(name,localContainer)},that.clear=function(){that.cache={}},that.refresh=function(names,localContainer){var thisContainer=localContainer||container;"string"==typeof names&&(names=[names]),void 0===thisContainer.length&&(thisContainer=[thisContainer]);for(var i=0;i<names.length;++i)for(var j=0;j<thisContainer.length;++j)that.locate(names[i],thisContainer[j])},that.resolvePathSegment=that.locate,that},fluid.expectFilledSelector=function(result,message){result&&0===result.length&&result.jquery&&fluid.fail(message+': selector "'+result.selector+'" with name '+result.selectorName+" returned no results in context "+fluid.dumpEl(result.context))},fluid.initView=function(componentName,containerSpec,userOptions,localOptions){var container=fluid.container(containerSpec,!0);if(fluid.expectFilledSelector(container,'Error instantiating component with name "'+componentName),!container)return null;var that=fluid.initLittleComponent(componentName,userOptions,localOptions||{gradeNames:["fluid.viewComponent"]},function(that){that.container=container});that.dom||fluid.initDomBinder(that);var userJQuery=that.options.jQuery;return fluid.log("Constructing view component "+componentName+" with container "+container.constructor.expando+(userJQuery?" user jQuery "+userJQuery.expando:"")+" env: "+$.expando),that},fluid.initDomBinder=function(that,selectors){return that.container||fluid.fail("fluid.initDomBinder called for component with typeName "+that.typeName+' without an initialised container - this has probably resulted from placing "fluid.viewComponent" in incorrect position in grade merging order. Make sure to place it to the right of any non-view grades in the gradeNames list to ensure that it overrides properly: resolved gradeNames is ',that.options.gradeNames," for component ",that),that.dom=fluid.createDomBinder(that.container,selectors||that.options.selectors||{}),that.locate=that.dom.locate,that.dom},fluid.findAncestor=function(element,test){for(element=fluid.unwrap(element);element;){if(test(element))return element;element=element.parentNode}},fluid.findForm=function(node){return fluid.findAncestor(node,function(element){return"form"===element.nodeName.toLowerCase()})},fluid.each(["text","html"],function(method){fluid[method]=function(node,newValue){return node=$(node),void 0===newValue?node[method]():node[method](newValue)}}),fluid.value=function(nodeIn,newValue){var node=fluid.unwrap(nodeIn),multiple=!1;if(void 0===node.nodeType&&1<node.length&&(node=node[0],multiple=!0),"input"!==node.nodeName.toLowerCase()||!/radio|checkbox/.test(node.type))return void 0===newValue?$(node).val():$(node).val(newValue);var elements,name=node.name;if(void 0===name&&fluid.fail("Cannot acquire value from node "+fluid.dumpEl(node)+" which does not have name attribute set"),multiple)elements=nodeIn;else{elements=node.ownerDocument.getElementsByName(name);var scope=fluid.findForm(node);elements=$.grep(elements,function(element){return element.name===name&&(!scope||fluid.dom.isContainer(scope,element))})}if(void 0===newValue){var checked=$.map(elements,function(element){return element.checked?element.value:null});return"radio"===node.type?checked[0]:checked}"boolean"==typeof newValue&&(newValue=newValue?"true":"false"),$.each(elements,function(){this.checked=newValue instanceof Array?-1!==newValue.indexOf(this.value):newValue===this.value})},fluid.BINDING_ROOT_KEY="fluid-binding-root",fluid.findData=function(elem,name){for(;elem;){var data=$.data(elem,name);if(data)return data;elem=elem.parentNode}},fluid.bindFossils=function(node,data,fossils){$.data(node,fluid.BINDING_ROOT_KEY,{data:data,fossils:fossils})},fluid.boundPathForNode=function(node,fossils){var record=fossils[(node=fluid.unwrap(node)).name||node.id];return record?record.EL:null},fluid.applyBoundChange=function(node,newValue,applier){node=fluid.unwrap(node),void 0===newValue&&(newValue=fluid.value(node)),void 0===node.nodeType&&0<node.length&&(node=node[0]);var root=fluid.findData(node,fluid.BINDING_ROOT_KEY);root||fluid.fail("Bound data could not be discovered in any node above "+fluid.dumpEl(node));var name=node.name,fossil=root.fossils[name];fossil||fluid.fail("No fossil discovered for name "+name+" in fossil record above "+fluid.dumpEl(node)),"boolean"==typeof fossil.oldvalue&&(newValue=!!newValue[0]);var EL=root.fossils[name].EL;applier?applier.fireChangeRequest({path:EL,value:newValue,source:"DOM:"+node.id}):fluid.set(root.data,EL,newValue)},fluid.jById=function(id,dokkument){dokkument=dokkument&&9===dokkument.nodeType?dokkument:document;var element=fluid.byId(id,dokkument),togo=element?$(element):[];return togo.selector="#"+id,togo.context=dokkument,togo},fluid.byId=function(id,dokkument){var el=(dokkument=dokkument&&9===dokkument.nodeType?dokkument:document).getElementById(id);return el?(el.id!==id&&fluid.fail("Problem in document structure - picked up element "+fluid.dumpEl(el)+" for id "+id+" without this id - most likely the element has a name which conflicts with this id"),el):null},fluid.getId=function(element){return fluid.unwrap(element).id},fluid.allocateSimpleId=function(element){if(!(element=fluid.unwrap(element))||fluid.isPrimitive(element))return null;if(!element.id){var simpleId="fluid-id-"+fluid.allocateGuid();element.id=simpleId}return element.id},fluid.getDocument=function(element){var node=fluid.unwrap(element);return 9===node.nodeType?node:node.ownerDocument},fluid.defaults("fluid.ariaLabeller",{gradeNames:["fluid.viewComponent"],labelAttribute:"aria-label",liveRegionMarkup:'<div class="liveRegion fl-hidden-accessible" aria-live="polite"></div>',liveRegionId:"fluid-ariaLabeller-liveRegion",invokers:{generateLiveElement:{funcName:"fluid.ariaLabeller.generateLiveElement",args:"{that}"},update:{funcName:"fluid.ariaLabeller.update",args:["{that}","{arguments}.0"]}},listeners:{onCreate:{func:"{that}.update",args:[null]}}}),fluid.ariaLabeller.update=function(that,newOptions){if(newOptions=newOptions||that.options,that.container.attr(that.options.labelAttribute,newOptions.text),newOptions.dynamicLabel){var live=fluid.jById(that.options.liveRegionId);0===live.length&&(live=that.generateLiveElement()),live.text(newOptions.text)}},fluid.ariaLabeller.generateLiveElement=function(that){var liveEl=$(that.options.liveRegionMarkup);return liveEl.prop("id",that.options.liveRegionId),$("body").append(liveEl),liveEl};fluid.getAriaLabeller=function(element){return element=$(element),fluid.getScopedData(element,"aria-labelling")},fluid.updateAriaLabel=function(element,text,options){options=$.extend({},options||{},{text:text});var that=fluid.getAriaLabeller(element);return that?that.update(options):(that=fluid.ariaLabeller(element,options),fluid.setScopedData(element,"aria-labelling",that)),that};var dismissList={};$(document).click(function(event){for(var target=fluid.resolveEventTarget(event);target;){if(dismissList[target.id])return;target=target.parentNode}fluid.each(dismissList,function(dismissFunc,key){dismissFunc(event),delete dismissList[key]})}),fluid.globalDismissal=function(nodes,dismissFunc){fluid.each(nodes,function(node){var id=fluid.unwrap(node).ownerDocument===document?fluid.allocateSimpleId(node):fluid.allocateGuid();dismissFunc?dismissList[id]=dismissFunc:delete dismissList[id]})},fluid.now=function(){return Date.now?Date.now():(new Date).getTime()},fluid.deadMansBlur=function(control,options){var that={options:$.extend(!0,{},fluid.defaults("fluid.deadMansBlur"),options),blurPending:!1,lastCancel:0,canceller:function(event){fluid.log("Cancellation through "+event.type+" on "+fluid.dumpEl(event.target)),that.lastCancel=fluid.now(),that.blurPending=!1},noteProceeded:function(){fluid.globalDismissal(that.options.exclusions)},reArm:function(){fluid.globalDismissal(that.options.exclusions,that.proceed)},addExclusion:function(exclusions){fluid.globalDismissal(exclusions,that.proceed)},proceed:function(event){fluid.log("Direct proceed through "+event.type+" on "+fluid.dumpEl(event.target)),that.blurPending=!1,that.options.handler(control)}};return fluid.each(that.options.exclusions,function(exclusion){exclusion=$(exclusion),fluid.each(exclusion,function(excludeEl){$(excludeEl).on("focusin",that.canceller).on("fluid-focus",that.canceller).click(that.canceller).mousedown(that.canceller)})}),that.options.cancelByDefault?that.reArm():$(control).on("focusout",function(event){fluid.log("Starting blur timer for element "+fluid.dumpEl(event.target));var now=fluid.now();fluid.log("back delay: "+(now-that.lastCancel)),now-that.lastCancel>that.options.backDelay&&(that.blurPending=!0),setTimeout(function(){that.blurPending&&that.options.handler(control)},that.options.delay)}),that},fluid.defaults("fluid.deadMansBlur",{gradeNames:"fluid.function",delay:150,backDelay:100})}(jQuery,fluid_3_0_0);fluid_3_0_0=fluid_3_0_0||{};!function($,fluid){"use strict";fluid.explodeLocalisedName=function(fileName,locale,defaultLocale){var lastDot=fileName.lastIndexOf(".");-1!==lastDot&&0!==lastDot||(lastDot=fileName.length);var baseName=fileName.substring(0,lastDot),extension=fileName.substring(lastDot),segs=locale.split("_"),exploded=fluid.transform(segs,function(seg,index){var shortSegs=segs.slice(0,index+1);return baseName+"_"+shortSegs.join("_")+extension});return defaultLocale&&exploded.unshift(baseName+"_"+defaultLocale+extension),exploded};var resourceCache={},pendingClass={};function canonUrl(url){return url}fluid.fetchResources=function(resourceSpecs,callback,options){var that={options:fluid.copy(options||{})};return that.resourceSpecs=resourceSpecs,that.callback=callback,that.operate=function(){fluid.fetchResources.fetchResourcesImpl(that)},fluid.each(resourceSpecs,function(resourceSpec,key){resourceSpec.recurseFirer=fluid.makeEventFirer({name:'I/O completion for resource "'+key+'"'}),resourceSpec.recurseFirer.addListener(that.operate),resourceSpec.url&&!resourceSpec.href&&(resourceSpec.href=resourceSpec.url),that.options.defaultLocale&&(resourceSpec.defaultLocale=that.options.defaultLocale),resourceSpec.locale||(resourceSpec.locale=resourceSpec.defaultLocale)}),that.options.amalgamateClasses&&fluid.fetchResources.amalgamateClasses(resourceSpecs,that.options.amalgamateClasses,that.operate),fluid.fetchResources.explodeForLocales(resourceSpecs),that.operate(),that},fluid.fetchResources.explodeForLocales=function(resourceSpecs){return fluid.each(resourceSpecs,function(resourceSpec,key){if(resourceSpec.locale){for(var exploded=fluid.explodeLocalisedName(resourceSpec.href,resourceSpec.locale,resourceSpec.defaultLocale),i=0;i<exploded.length;++i){var newKey=key+"$localised-"+i,newRecord=$.extend(!0,{},resourceSpec,{href:exploded[i],localeExploded:!0});resourceSpecs[newKey]=newRecord}resourceSpec.localeExploded=exploded.length}}),resourceSpecs},fluid.fetchResources.condenseOneResource=function(resourceSpecs,resourceSpec,key,localeCount){for(var localeSpecs=[resourceSpec],i=0;i<localeCount;++i){var localKey=key+"$localised-"+i;localeSpecs.unshift(resourceSpecs[localKey]),delete resourceSpecs[localKey]}var lastNonError=fluid.find_if(localeSpecs,function(spec){return!spec.fetchError});lastNonError&&(resourceSpecs[key]=lastNonError)},fluid.fetchResources.condenseForLocales=function(resourceSpecs){fluid.each(resourceSpecs,function(resourceSpec,key){"number"==typeof resourceSpec.localeExploded&&fluid.fetchResources.condenseOneResource(resourceSpecs,resourceSpec,key,resourceSpec.localeExploded)})},fluid.fetchResources.notifyResources=function(that,resourceSpecs,callback){fluid.fetchResources.condenseForLocales(resourceSpecs),callback(resourceSpecs)},fluid.fetchResources.amalgamateClasses=function(specs,classes,operator){fluid.each(classes,function(clazz){var pending=pendingClass[clazz];fluid.each(pending,function(pendingrec,canon){(specs[clazz+"!"+canon]=pendingrec).recurseFirer.addListener(operator)})})},fluid.fetchResources.timeSuccessCallback=function(resourceSpec){if(resourceSpec.timeSuccess&&resourceSpec.options&&resourceSpec.options.success){var success=resourceSpec.options.success;resourceSpec.options.success=function(){var startTime=new Date,ret=success.apply(null,arguments);return fluid.log("External callback for URL "+resourceSpec.href+" completed - callback time: "+((new Date).getTime()-startTime.getTime())+"ms"),ret}}},fluid.fetchResources.clearResourceCache=function(url){url?delete resourceCache[canonUrl(url)]:fluid.clear(resourceCache)},fluid.fetchResources.handleCachedRequest=function(resourceSpec,response,fetchError){var canon=canonUrl(resourceSpec.href),cached=resourceCache[canon];if(cached.$$firer$$){fluid.log("Handling request for "+canon+" from cache");var fetchClass=resourceSpec.fetchClass;fetchClass&&pendingClass[fetchClass]&&(fluid.log("Clearing pendingClass entry for class "+fetchClass),delete pendingClass[fetchClass][canon]);var result={response:response,fetchError:fetchError};resourceCache[canon]=result,cached.fire(response,fetchError)}},fluid.fetchResources.completeRequest=function(thisSpec){thisSpec.queued=!1,thisSpec.completeTime=new Date,fluid.log("Request to URL "+thisSpec.href+" completed - total elapsed time: "+(thisSpec.completeTime.getTime()-thisSpec.initTime.getTime())+"ms"),thisSpec.recurseFirer.fire()},fluid.fetchResources.makeResourceCallback=function(thisSpec){return{success:function(response){thisSpec.resourceText=response,thisSpec.resourceKey=thisSpec.href,thisSpec.forceCache&&fluid.fetchResources.handleCachedRequest(thisSpec,response),fluid.fetchResources.completeRequest(thisSpec)},error:function(response,textStatus,errorThrown){thisSpec.fetchError={status:response.status,textStatus:response.textStatus,errorThrown:errorThrown},thisSpec.forceCache&&fluid.fetchResources.handleCachedRequest(thisSpec,null,thisSpec.fetchError),fluid.fetchResources.completeRequest(thisSpec)}}},fluid.fetchResources.issueCachedRequest=function(resourceSpec,options){var canon=canonUrl(resourceSpec.href),cached=resourceCache[canon];if(cached)cached.$$firer$$?(fluid.log("Request for cached resource which is in flight: url "+canon),cached.addListener(function(response,fetchError){response?options.success(response):options.error(fetchError)})):cached.response?options.success(cached.response):options.error(cached.fetchError);else{fluid.log("First request for cached resource with url "+canon),(cached=fluid.makeEventFirer({name:"cache notifier for resource URL "+canon})).$$firer$$=!0,resourceCache[canon]=cached;var fetchClass=resourceSpec.fetchClass;fetchClass&&(pendingClass[fetchClass]||(pendingClass[fetchClass]={}),pendingClass[fetchClass][canon]=resourceSpec),options.cache=!1,$.ajax(options)}},fluid.fetchResources.composeCallbacks=function(internal,external){return external?internal?function(){try{external.apply(null,arguments)}catch(e){fluid.log("Exception applying external fetchResources callback: "+e)}internal.apply(null,arguments)}:external:internal},fluid.fetchResources.composePolicy=function(target,source){return fluid.fetchResources.composeCallbacks(target,source)},fluid.defaults("fluid.fetchResources.issueRequest",{mergePolicy:{success:fluid.fetchResources.composePolicy,error:fluid.fetchResources.composePolicy,url:"reverse"}}),fluid.fetchResources.issueRequest=function(resourceSpec,key){var thisCallback=fluid.fetchResources.makeResourceCallback(resourceSpec),options={url:resourceSpec.href,success:thisCallback.success,error:thisCallback.error,dataType:resourceSpec.dataType||"text"};fluid.fetchResources.timeSuccessCallback(resourceSpec),options=fluid.merge(fluid.defaults("fluid.fetchResources.issueRequest").mergePolicy,options,resourceSpec.options),resourceSpec.queued=!0,resourceSpec.initTime=new Date,fluid.log("Request with key "+key+" queued for "+resourceSpec.href),resourceSpec.forceCache?fluid.fetchResources.issueCachedRequest(resourceSpec,options):$.ajax(options)},fluid.fetchResources.fetchResourcesImpl=function(that){var complete=!0,resourceSpecs=that.resourceSpecs;for(var key in resourceSpecs){var resourceSpec=resourceSpecs[key];if(resourceSpec.href&&!resourceSpec.completeTime)resourceSpec.queued||fluid.fetchResources.issueRequest(resourceSpec,key),resourceSpec.queued&&(complete=!1);else if(resourceSpec.nodeId&&!resourceSpec.resourceText){var node=document.getElementById(resourceSpec.nodeId);resourceSpec.resourceText=fluid.dom.getElementText(node),resourceSpec.resourceKey=resourceSpec.nodeId}}complete&&that.callback&&!that.callbackCalled&&(that.callbackCalled=!0,setTimeout(function(){fluid.fetchResources.notifyResources(that,resourceSpecs,that.callback)},1))},fluid.fetchResources.primeCacheFromResources=function(componentName){var resources=fluid.defaults(componentName).resources,expanded=(fluid.expandOptions?fluid.expandOptions:fluid.identity)(fluid.copy(resources));fluid.fetchResources(expanded)},fluid.registerNamespace("fluid.expander"),fluid.expander.makeDefaultFetchOptions=function(successdisposer,failid,options){return $.extend(!0,{dataType:"text"},options,{success:function(response,environmentdisposer){var json=JSON.parse(response);environmentdisposer(successdisposer(json))},error:function(response,textStatus){fluid.log("Error fetching "+failid+": "+textStatus)}})},fluid.expander.makeFetchExpander=function(options){return{expander:{type:"fluid.expander.deferredFetcher",href:options.url,options:fluid.expander.makeDefaultFetchOptions(options.disposer,options.url,options.options),resourceSpecCollector:"{resourceSpecCollector}",fetchKey:options.fetchKey}}},fluid.expander.deferredFetcher=function(deliverer,source,expandOptions){var expander=source.expander,spec=fluid.copy(expander),collector=fluid.expand(expander.resourceSpecCollector,expandOptions);delete spec.type,delete spec.resourceSpecCollector,delete spec.fetchKey;var environmentdisposer=function(disposed){deliverer(disposed)};return spec.options.success=function(response){expander.options.success(response,environmentdisposer)},collector[expander.fetchKey||fluid.allocateGuid()]=spec,fluid.NO_VALUE}}(jQuery,fluid_3_0_0);fluid_3_0_0=fluid_3_0_0||{};!function($,fluid){"use strict";fluid.defaults("fluid.messageResolver",{gradeNames:["fluid.component"],mergePolicy:{messageBase:"nomerge",parents:"nomerge"},resolveFunc:fluid.stringTemplate,parseFunc:fluid.identity,messageBase:{},members:{messageBase:"@expand:{that}.options.parseFunc({that}.options.messageBase)"},invokers:{lookup:"fluid.messageResolver.lookup({that}, {arguments}.0)",resolve:"fluid.messageResolver.resolve({that}, {arguments}.0, {arguments}.1)"},parents:[]}),fluid.messageResolver.lookup=function(that,messagecodes){var resolved=fluid.messageResolver.resolveOne(that.messageBase,messagecodes);return void 0===resolved?fluid.find(that.options.parents,function(parent){return parent?parent.lookup(messagecodes):void 0}):{template:resolved,resolveFunc:that.options.resolveFunc}},fluid.messageResolver.resolve=function(that,messagecodes,args){if(!messagecodes)return"[No messagecodes provided]";messagecodes=fluid.makeArray(messagecodes);var looked=that.lookup(messagecodes);return looked?looked.resolveFunc(looked.template,args):"[Message string for key "+messagecodes[0]+" not found]"},fluid.messageResolver.resolveOne=function(messageBase,messagecodes){for(var i=0;i<messagecodes.length;++i){var message=messageBase[messagecodes[i]];if(void 0!==message)return message}},fluid.messageLocator=function(messageBase,resolveFunc){var resolver=fluid.messageResolver({messageBase:messageBase,resolveFunc:resolveFunc});return function(messagecodes,args){return resolver.resolve(messagecodes,args)}},fluid.resolveMessageSource=function(messageSource){if("data"===messageSource.type){if(void 0===messageSource.url)return fluid.messageLocator(messageSource.messages,messageSource.resolveFunc)}else if("resolver"===messageSource.type)return messageSource.resolver.resolve}}(jQuery,fluid_3_0_0);fluid_3_0_0=fluid_3_0_0||{};!function($,fluid){"use strict";fluid.defaults("fluid.resourceLoader",{gradeNames:["fluid.component"],listeners:{"onCreate.loadResources":{listener:"fluid.resourceLoader.loadResources",args:["{that}",{expander:{func:"{that}.resolveResources"}}]}},defaultLocale:null,locale:null,terms:{},resources:{},resourceOptions:{},invokers:{transformURL:{funcName:"fluid.stringTemplate",args:["{arguments}.0","{that}.options.terms"]},resolveResources:{funcName:"fluid.resourceLoader.resolveResources",args:"{that}"}},events:{onResourcesLoaded:null}}),fluid.resourceLoader.resolveResources=function(that){var mapped=fluid.transform(that.options.resources,that.transformURL);return fluid.transform(mapped,function(url){var resourceSpec={url:url,forceCache:!0,options:that.options.resourceOptions};return $.extend(resourceSpec,fluid.filterKeys(that.options,["defaultLocale","locale"]))})},fluid.resourceLoader.loadResources=function(that,resources){fluid.fetchResources(resources,function(){that.resources=resources,that.events.onResourcesLoaded.fire(resources)})}}(jQuery,fluid_3_0_0);fluid_3_0_0=fluid_3_0_0||{};!function($,fluid){"use strict";fluid.defaults("fluid.newViewComponent",{gradeNames:["fluid.modelComponent"],members:{dom:"@expand:fluid.initDomBinder({that}, {that}.options.selectors, {that}.container)",container:"@expand:fluid.container({that}.options.container)"}}),fluid.newViewComponent.addToParent=function(parentContainer,elm,method){method=method||"append",$(parentContainer)[method](elm)},fluid.defaults("fluid.containerRenderingView",{gradeNames:["fluid.newViewComponent"],container:"@expand:{that}.renderContainer()",parentContainer:"fluid.notImplemented",injectionType:"append",invokers:{renderMarkup:"fluid.identity({that}.options.markup.container)",renderContainer:"fluid.containerRenderingView.renderContainer({that}, {that}.renderMarkup, {that}.addToParent)",addToParent:{funcName:"fluid.newViewComponent.addToParent",args:["{that}.options.parentContainer","{arguments}.0","{that}.options.injectionType"]}}}),fluid.containerRenderingView.renderContainer=function(that,renderMarkup,addToParent){fluid.log("Rendering container for "+that.id);var containerMarkup=renderMarkup(),container=$(containerMarkup);return addToParent(container),container},fluid.defaults("fluid.templateRenderingView",{gradeNames:["fluid.newViewComponent","fluid.resourceLoader"],resources:{template:"fluid.notImplemented"},injectionType:"append",events:{afterRender:null},listeners:{"onResourcesLoaded.render":"{that}.render","onResourcesLoaded.afterRender":{listener:"{that}.events.afterRender",args:["{that}"],priority:"after:render"}},invokers:{render:{funcName:"fluid.newViewComponent.addToParent",args:["{that}.container","{that}.resources.template.resourceText","{that}.options.injectionType"]}},distributeOptions:{mapTemplateSource:{source:"{that}.options.template",removeSource:!0,target:"{that}.options.resources.template"}}})}(jQuery,fluid_3_0_0);fluid_3_0_0=fluid_3_0_0||{};!function($,fluid){"use strict";fluid.defaults("fluid.mutationObserver",{gradeNames:["fluid.viewComponent"],events:{onNodeAdded:null,onNodeRemoved:null,onAttributeChanged:null},listeners:{"onDestroy.disconnect":"{that}.disconnect"},members:{observer:{expander:{func:"{that}.createObserver"}}},defaultObserveConfig:{attributes:!0,childList:!0,subtree:!0},invokers:{observe:{funcName:"fluid.mutationObserver.observe",args:["{that}","{arguments}.0","{arguments}.1"]},disconnect:{this:"{that}.observer",method:"disconnect"},takeRecords:{this:"{that}.observer",method:"takeRecords"},createObserver:{funcName:"fluid.mutationObserver.createObserver",args:["{that}"]}}}),fluid.mutationObserver.createObserver=function(that){return new MutationObserver(function(mutationRecords){fluid.each(mutationRecords,function(mutationRecord){for(var i=0;i<mutationRecord.addedNodes.length;i++)that.events.onNodeAdded.fire(mutationRecord.addedNodes[i],mutationRecord);for(var j=0;j<mutationRecord.removedNodes.length;j++)that.events.onNodeRemoved.fire(mutationRecord.removedNodes[j],mutationRecord);"attributes"===mutationRecord.type&&that.events.onAttributeChanged.fire(mutationRecord.target,mutationRecord)})})},fluid.mutationObserver.observe=function(that,target,options){target=fluid.unwrap(target||that.container),that.observer.observe(target,options||that.options.defaultObserveConfig)}}(jQuery,fluid_3_0_0);fluid_3_0_0=fluid_3_0_0||{};!function($,fluid){"use strict";fluid.defaults("fluid.textNodeParser",{gradeNames:["fluid.component"],events:{onParsedTextNode:null,afterParse:null},invokers:{parse:{funcName:"fluid.textNodeParser.parse",args:["{that}","{arguments}.0","{arguments}.1","{that}.events.afterParse.fire"]},hasTextToRead:"fluid.textNodeParser.hasTextToRead",isWord:"fluid.textNodeParser.isWord",getLang:"fluid.textNodeParser.getLang"}}),fluid.textNodeParser.isWord=function(str){return fluid.isValue(str)&&/\S/.test(str)},fluid.textNodeParser.hasTextToRead=function(elm,acceptAriaHidden){return(elm=fluid.unwrap(elm))&&("body"===elm.tagName.toLowerCase()||elm.offsetParent)&&fluid.textNodeParser.isWord(elm.innerText)&&(acceptAriaHidden||!$(elm).closest('[aria-hidden="true"]').length)},fluid.textNodeParser.getLang=function(elm){return $(elm).closest("[lang]").attr("lang")},fluid.textNodeParser.parse=function(that,elm,lang,afterParseEvent){elm=fluid.unwrap(elm);var parsed=[];if(that.hasTextToRead(elm)){var childNodes=elm.childNodes,elementLang=elm.getAttribute("lang")||lang||that.getLang(elm);Array.prototype.forEach.call(childNodes,function(childNode,childIndex){if(childNode.nodeType===Node.TEXT_NODE){var textNodeData={node:childNode,lang:elementLang,childIndex:childIndex};parsed.push(textNodeData),that.events.onParsedTextNode.fire(textNodeData)}else childNode.nodeType===Node.ELEMENT_NODE&&(parsed=parsed.concat(fluid.textNodeParser.parse(that,childNode,elementLang)))})}return afterParseEvent&&afterParseEvent(that,parsed),parsed}}(jQuery,fluid_3_0_0);
//# sourceMappingURL=infusion-framework-no-jquery.min.js.map