/*!
 * infusion - v4.8.0
 *
 * Build Info:
 *  branch: main
 *  revision: 60d89fe69
 *  build date: 2025-02-16T09:56:42-05:00Z
 *  includes: fluid-framework
*/
/*!
 * jQuery JavaScript Library v3.7.1
 * https://jquery.com/
 *
 * Copyright OpenJS Foundation and other contributors
 * Released under the MIT license
 * https://jquery.org/license
 *
 * Date: 2023-08-28T13:37Z
 */
(function(global,factory){"use strict";if(typeof module==="object"&&typeof module.exports==="object"){module.exports=global.document?factory(global,true):function(w){if(!w.document){throw new Error("jQuery requires a window with a document")}return factory(w)}}else{factory(global)}})(typeof window!=="undefined"?window:this,(function(window,noGlobal){"use strict";var arr=[];var getProto=Object.getPrototypeOf;var slice=arr.slice;var flat=arr.flat?function(array){return arr.flat.call(array)}:function(array){return arr.concat.apply([],array)};var push=arr.push;var indexOf=arr.indexOf;var class2type={};var toString=class2type.toString;var hasOwn=class2type.hasOwnProperty;var fnToString=hasOwn.toString;var ObjectFunctionString=fnToString.call(Object);var support={};var isFunction=function isFunction(obj){return typeof obj==="function"&&typeof obj.nodeType!=="number"&&typeof obj.item!=="function"};var isWindow=function isWindow(obj){return obj!=null&&obj===obj.window};var document=window.document;var preservedScriptAttributes={type:true,src:true,nonce:true,noModule:true};function DOMEval(code,node,doc){doc=doc||document;var i,val,script=doc.createElement("script");script.text=code;if(node){for(i in preservedScriptAttributes){val=node[i]||node.getAttribute&&node.getAttribute(i);if(val){script.setAttribute(i,val)}}}doc.head.appendChild(script).parentNode.removeChild(script)}function toType(obj){if(obj==null){return obj+""}return typeof obj==="object"||typeof obj==="function"?class2type[toString.call(obj)]||"object":typeof obj}var version="3.7.1",rhtmlSuffix=/HTML$/i,jQuery=function(selector,context){return new jQuery.fn.init(selector,context)};jQuery.fn=jQuery.prototype={jquery:version,constructor:jQuery,length:0,toArray:function(){return slice.call(this)},get:function(num){if(num==null){return slice.call(this)}return num<0?this[num+this.length]:this[num]},pushStack:function(elems){var ret=jQuery.merge(this.constructor(),elems);ret.prevObject=this;return ret},each:function(callback){return jQuery.each(this,callback)},map:function(callback){return this.pushStack(jQuery.map(this,(function(elem,i){return callback.call(elem,i,elem)})))},slice:function(){return this.pushStack(slice.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(jQuery.grep(this,(function(_elem,i){return(i+1)%2})))},odd:function(){return this.pushStack(jQuery.grep(this,(function(_elem,i){return i%2})))},eq:function(i){var len=this.length,j=+i+(i<0?len:0);return this.pushStack(j>=0&&j<len?[this[j]]:[])},end:function(){return this.prevObject||this.constructor()},push:push,sort:arr.sort,splice:arr.splice};jQuery.extend=jQuery.fn.extend=function(){var options,name,src,copy,copyIsArray,clone,target=arguments[0]||{},i=1,length=arguments.length,deep=false;if(typeof target==="boolean"){deep=target;target=arguments[i]||{};i++}if(typeof target!=="object"&&!isFunction(target)){target={}}if(i===length){target=this;i--}for(;i<length;i++){if((options=arguments[i])!=null){for(name in options){copy=options[name];if(name==="__proto__"||target===copy){continue}if(deep&&copy&&(jQuery.isPlainObject(copy)||(copyIsArray=Array.isArray(copy)))){src=target[name];if(copyIsArray&&!Array.isArray(src)){clone=[]}else if(!copyIsArray&&!jQuery.isPlainObject(src)){clone={}}else{clone=src}copyIsArray=false;target[name]=jQuery.extend(deep,clone,copy)}else if(copy!==undefined){target[name]=copy}}}}return target};jQuery.extend({expando:"jQuery"+(version+Math.random()).replace(/\D/g,""),isReady:true,error:function(msg){throw new Error(msg)},noop:function(){},isPlainObject:function(obj){var proto,Ctor;if(!obj||toString.call(obj)!=="[object Object]"){return false}proto=getProto(obj);if(!proto){return true}Ctor=hasOwn.call(proto,"constructor")&&proto.constructor;return typeof Ctor==="function"&&fnToString.call(Ctor)===ObjectFunctionString},isEmptyObject:function(obj){var name;for(name in obj){return false}return true},globalEval:function(code,options,doc){DOMEval(code,{nonce:options&&options.nonce},doc)},each:function(obj,callback){var length,i=0;if(isArrayLike(obj)){length=obj.length;for(;i<length;i++){if(callback.call(obj[i],i,obj[i])===false){break}}}else{for(i in obj){if(callback.call(obj[i],i,obj[i])===false){break}}}return obj},text:function(elem){var node,ret="",i=0,nodeType=elem.nodeType;if(!nodeType){while(node=elem[i++]){ret+=jQuery.text(node)}}if(nodeType===1||nodeType===11){return elem.textContent}if(nodeType===9){return elem.documentElement.textContent}if(nodeType===3||nodeType===4){return elem.nodeValue}return ret},makeArray:function(arr,results){var ret=results||[];if(arr!=null){if(isArrayLike(Object(arr))){jQuery.merge(ret,typeof arr==="string"?[arr]:arr)}else{push.call(ret,arr)}}return ret},inArray:function(elem,arr,i){return arr==null?-1:indexOf.call(arr,elem,i)},isXMLDoc:function(elem){var namespace=elem&&elem.namespaceURI,docElem=elem&&(elem.ownerDocument||elem).documentElement;return!rhtmlSuffix.test(namespace||docElem&&docElem.nodeName||"HTML")},merge:function(first,second){var len=+second.length,j=0,i=first.length;for(;j<len;j++){first[i++]=second[j]}first.length=i;return first},grep:function(elems,callback,invert){var callbackInverse,matches=[],i=0,length=elems.length,callbackExpect=!invert;for(;i<length;i++){callbackInverse=!callback(elems[i],i);if(callbackInverse!==callbackExpect){matches.push(elems[i])}}return matches},map:function(elems,callback,arg){var length,value,i=0,ret=[];if(isArrayLike(elems)){length=elems.length;for(;i<length;i++){value=callback(elems[i],i,arg);if(value!=null){ret.push(value)}}}else{for(i in elems){value=callback(elems[i],i,arg);if(value!=null){ret.push(value)}}}return flat(ret)},guid:1,support:support});if(typeof Symbol==="function"){jQuery.fn[Symbol.iterator]=arr[Symbol.iterator]}jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),(function(_i,name){class2type["[object "+name+"]"]=name.toLowerCase()}));function isArrayLike(obj){var length=!!obj&&"length"in obj&&obj.length,type=toType(obj);if(isFunction(obj)||isWindow(obj)){return false}return type==="array"||length===0||typeof length==="number"&&length>0&&length-1 in obj}function nodeName(elem,name){return elem.nodeName&&elem.nodeName.toLowerCase()===name.toLowerCase()}var pop=arr.pop;var sort=arr.sort;var splice=arr.splice;var whitespace="[\\x20\\t\\r\\n\\f]";var rtrimCSS=new RegExp("^"+whitespace+"+|((?:^|[^\\\\])(?:\\\\.)*)"+whitespace+"+$","g");jQuery.contains=function(a,b){var bup=b&&b.parentNode;return a===bup||!!(bup&&bup.nodeType===1&&(a.contains?a.contains(bup):a.compareDocumentPosition&&a.compareDocumentPosition(bup)&16))};var rcssescape=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;function fcssescape(ch,asCodePoint){if(asCodePoint){if(ch==="\0"){return"�"}return ch.slice(0,-1)+"\\"+ch.charCodeAt(ch.length-1).toString(16)+" "}return"\\"+ch}jQuery.escapeSelector=function(sel){return(sel+"").replace(rcssescape,fcssescape)};var preferredDoc=document,pushNative=push;(function(){var i,Expr,outermostContext,sortInput,hasDuplicate,push=pushNative,document,documentElement,documentIsHTML,rbuggyQSA,matches,expando=jQuery.expando,dirruns=0,done=0,classCache=createCache(),tokenCache=createCache(),compilerCache=createCache(),nonnativeSelectorCache=createCache(),sortOrder=function(a,b){if(a===b){hasDuplicate=true}return 0},booleans="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|"+"loop|multiple|open|readonly|required|scoped",identifier="(?:\\\\[\\da-fA-F]{1,6}"+whitespace+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",attributes="\\["+whitespace+"*("+identifier+")(?:"+whitespace+"*([*^$|!~]?=)"+whitespace+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+identifier+"))|)"+whitespace+"*\\]",pseudos=":("+identifier+")(?:\\(("+"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|"+"((?:\\\\.|[^\\\\()[\\]]|"+attributes+")*)|"+".*"+")\\)|)",rwhitespace=new RegExp(whitespace+"+","g"),rcomma=new RegExp("^"+whitespace+"*,"+whitespace+"*"),rleadingCombinator=new RegExp("^"+whitespace+"*([>+~]|"+whitespace+")"+whitespace+"*"),rdescend=new RegExp(whitespace+"|>"),rpseudo=new RegExp(pseudos),ridentifier=new RegExp("^"+identifier+"$"),matchExpr={ID:new RegExp("^#("+identifier+")"),CLASS:new RegExp("^\\.("+identifier+")"),TAG:new RegExp("^("+identifier+"|[*])"),ATTR:new RegExp("^"+attributes),PSEUDO:new RegExp("^"+pseudos),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+whitespace+"*(even|odd|(([+-]|)(\\d*)n|)"+whitespace+"*(?:([+-]|)"+whitespace+"*(\\d+)|))"+whitespace+"*\\)|)","i"),bool:new RegExp("^(?:"+booleans+")$","i"),needsContext:new RegExp("^"+whitespace+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+whitespace+"*((?:-\\d)?\\d*)"+whitespace+"*\\)|)(?=[^-]|$)","i")},rinputs=/^(?:input|select|textarea|button)$/i,rheader=/^h\d$/i,rquickExpr=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,rsibling=/[+~]/,runescape=new RegExp("\\\\[\\da-fA-F]{1,6}"+whitespace+"?|\\\\([^\\r\\n\\f])","g"),funescape=function(escape,nonHex){var high="0x"+escape.slice(1)-65536;if(nonHex){return nonHex}return high<0?String.fromCharCode(high+65536):String.fromCharCode(high>>10|55296,high&1023|56320)},unloadHandler=function(){setDocument()},inDisabledFieldset=addCombinator((function(elem){return elem.disabled===true&&nodeName(elem,"fieldset")}),{dir:"parentNode",next:"legend"});function safeActiveElement(){try{return document.activeElement}catch(err){}}try{push.apply(arr=slice.call(preferredDoc.childNodes),preferredDoc.childNodes);arr[preferredDoc.childNodes.length].nodeType}catch(e){push={apply:function(target,els){pushNative.apply(target,slice.call(els))},call:function(target){pushNative.apply(target,slice.call(arguments,1))}}}function find(selector,context,results,seed){var m,i,elem,nid,match,groups,newSelector,newContext=context&&context.ownerDocument,nodeType=context?context.nodeType:9;results=results||[];if(typeof selector!=="string"||!selector||nodeType!==1&&nodeType!==9&&nodeType!==11){return results}if(!seed){setDocument(context);context=context||document;if(documentIsHTML){if(nodeType!==11&&(match=rquickExpr.exec(selector))){if(m=match[1]){if(nodeType===9){if(elem=context.getElementById(m)){if(elem.id===m){push.call(results,elem);return results}}else{return results}}else{if(newContext&&(elem=newContext.getElementById(m))&&find.contains(context,elem)&&elem.id===m){push.call(results,elem);return results}}}else if(match[2]){push.apply(results,context.getElementsByTagName(selector));return results}else if((m=match[3])&&context.getElementsByClassName){push.apply(results,context.getElementsByClassName(m));return results}}if(!nonnativeSelectorCache[selector+" "]&&(!rbuggyQSA||!rbuggyQSA.test(selector))){newSelector=selector;newContext=context;if(nodeType===1&&(rdescend.test(selector)||rleadingCombinator.test(selector))){newContext=rsibling.test(selector)&&testContext(context.parentNode)||context;if(newContext!=context||!support.scope){if(nid=context.getAttribute("id")){nid=jQuery.escapeSelector(nid)}else{context.setAttribute("id",nid=expando)}}groups=tokenize(selector);i=groups.length;while(i--){groups[i]=(nid?"#"+nid:":scope")+" "+toSelector(groups[i])}newSelector=groups.join(",")}try{push.apply(results,newContext.querySelectorAll(newSelector));return results}catch(qsaError){nonnativeSelectorCache(selector,true)}finally{if(nid===expando){context.removeAttribute("id")}}}}}return select(selector.replace(rtrimCSS,"$1"),context,results,seed)}function createCache(){var keys=[];function cache(key,value){if(keys.push(key+" ")>Expr.cacheLength){delete cache[keys.shift()]}return cache[key+" "]=value}return cache}function markFunction(fn){fn[expando]=true;return fn}function assert(fn){var el=document.createElement("fieldset");try{return!!fn(el)}catch(e){return false}finally{if(el.parentNode){el.parentNode.removeChild(el)}el=null}}function createInputPseudo(type){return function(elem){return nodeName(elem,"input")&&elem.type===type}}function createButtonPseudo(type){return function(elem){return(nodeName(elem,"input")||nodeName(elem,"button"))&&elem.type===type}}function createDisabledPseudo(disabled){return function(elem){if("form"in elem){if(elem.parentNode&&elem.disabled===false){if("label"in elem){if("label"in elem.parentNode){return elem.parentNode.disabled===disabled}else{return elem.disabled===disabled}}return elem.isDisabled===disabled||elem.isDisabled!==!disabled&&inDisabledFieldset(elem)===disabled}return elem.disabled===disabled}else if("label"in elem){return elem.disabled===disabled}return false}}function createPositionalPseudo(fn){return markFunction((function(argument){argument=+argument;return markFunction((function(seed,matches){var j,matchIndexes=fn([],seed.length,argument),i=matchIndexes.length;while(i--){if(seed[j=matchIndexes[i]]){seed[j]=!(matches[j]=seed[j])}}}))}))}function testContext(context){return context&&typeof context.getElementsByTagName!=="undefined"&&context}function setDocument(node){var subWindow,doc=node?node.ownerDocument||node:preferredDoc;if(doc==document||doc.nodeType!==9||!doc.documentElement){return document}document=doc;documentElement=document.documentElement;documentIsHTML=!jQuery.isXMLDoc(document);matches=documentElement.matches||documentElement.webkitMatchesSelector||documentElement.msMatchesSelector;if(documentElement.msMatchesSelector&&preferredDoc!=document&&(subWindow=document.defaultView)&&subWindow.top!==subWindow){subWindow.addEventListener("unload",unloadHandler)}support.getById=assert((function(el){documentElement.appendChild(el).id=jQuery.expando;return!document.getElementsByName||!document.getElementsByName(jQuery.expando).length}));support.disconnectedMatch=assert((function(el){return matches.call(el,"*")}));support.scope=assert((function(){return document.querySelectorAll(":scope")}));support.cssHas=assert((function(){try{document.querySelector(":has(*,:jqfake)");return false}catch(e){return true}}));if(support.getById){Expr.filter.ID=function(id){var attrId=id.replace(runescape,funescape);return function(elem){return elem.getAttribute("id")===attrId}};Expr.find.ID=function(id,context){if(typeof context.getElementById!=="undefined"&&documentIsHTML){var elem=context.getElementById(id);return elem?[elem]:[]}}}else{Expr.filter.ID=function(id){var attrId=id.replace(runescape,funescape);return function(elem){var node=typeof elem.getAttributeNode!=="undefined"&&elem.getAttributeNode("id");return node&&node.value===attrId}};Expr.find.ID=function(id,context){if(typeof context.getElementById!=="undefined"&&documentIsHTML){var node,i,elems,elem=context.getElementById(id);if(elem){node=elem.getAttributeNode("id");if(node&&node.value===id){return[elem]}elems=context.getElementsByName(id);i=0;while(elem=elems[i++]){node=elem.getAttributeNode("id");if(node&&node.value===id){return[elem]}}}return[]}}}Expr.find.TAG=function(tag,context){if(typeof context.getElementsByTagName!=="undefined"){return context.getElementsByTagName(tag)}else{return context.querySelectorAll(tag)}};Expr.find.CLASS=function(className,context){if(typeof context.getElementsByClassName!=="undefined"&&documentIsHTML){return context.getElementsByClassName(className)}};rbuggyQSA=[];assert((function(el){var input;documentElement.appendChild(el).innerHTML="<a id='"+expando+"' href='' disabled='disabled'></a>"+"<select id='"+expando+"-\r\\' disabled='disabled'>"+"<option selected=''></option></select>";if(!el.querySelectorAll("[selected]").length){rbuggyQSA.push("\\["+whitespace+"*(?:value|"+booleans+")")}if(!el.querySelectorAll("[id~="+expando+"-]").length){rbuggyQSA.push("~=")}if(!el.querySelectorAll("a#"+expando+"+*").length){rbuggyQSA.push(".#.+[+~]")}if(!el.querySelectorAll(":checked").length){rbuggyQSA.push(":checked")}input=document.createElement("input");input.setAttribute("type","hidden");el.appendChild(input).setAttribute("name","D");documentElement.appendChild(el).disabled=true;if(el.querySelectorAll(":disabled").length!==2){rbuggyQSA.push(":enabled",":disabled")}input=document.createElement("input");input.setAttribute("name","");el.appendChild(input);if(!el.querySelectorAll("[name='']").length){rbuggyQSA.push("\\["+whitespace+"*name"+whitespace+"*="+whitespace+"*(?:''|\"\")")}}));if(!support.cssHas){rbuggyQSA.push(":has")}rbuggyQSA=rbuggyQSA.length&&new RegExp(rbuggyQSA.join("|"));sortOrder=function(a,b){if(a===b){hasDuplicate=true;return 0}var compare=!a.compareDocumentPosition-!b.compareDocumentPosition;if(compare){return compare}compare=(a.ownerDocument||a)==(b.ownerDocument||b)?a.compareDocumentPosition(b):1;if(compare&1||!support.sortDetached&&b.compareDocumentPosition(a)===compare){if(a===document||a.ownerDocument==preferredDoc&&find.contains(preferredDoc,a)){return-1}if(b===document||b.ownerDocument==preferredDoc&&find.contains(preferredDoc,b)){return 1}return sortInput?indexOf.call(sortInput,a)-indexOf.call(sortInput,b):0}return compare&4?-1:1};return document}find.matches=function(expr,elements){return find(expr,null,null,elements)};find.matchesSelector=function(elem,expr){setDocument(elem);if(documentIsHTML&&!nonnativeSelectorCache[expr+" "]&&(!rbuggyQSA||!rbuggyQSA.test(expr))){try{var ret=matches.call(elem,expr);if(ret||support.disconnectedMatch||elem.document&&elem.document.nodeType!==11){return ret}}catch(e){nonnativeSelectorCache(expr,true)}}return find(expr,document,null,[elem]).length>0};find.contains=function(context,elem){if((context.ownerDocument||context)!=document){setDocument(context)}return jQuery.contains(context,elem)};find.attr=function(elem,name){if((elem.ownerDocument||elem)!=document){setDocument(elem)}var fn=Expr.attrHandle[name.toLowerCase()],val=fn&&hasOwn.call(Expr.attrHandle,name.toLowerCase())?fn(elem,name,!documentIsHTML):undefined;if(val!==undefined){return val}return elem.getAttribute(name)};find.error=function(msg){throw new Error("Syntax error, unrecognized expression: "+msg)};jQuery.uniqueSort=function(results){var elem,duplicates=[],j=0,i=0;hasDuplicate=!support.sortStable;sortInput=!support.sortStable&&slice.call(results,0);sort.call(results,sortOrder);if(hasDuplicate){while(elem=results[i++]){if(elem===results[i]){j=duplicates.push(i)}}while(j--){splice.call(results,duplicates[j],1)}}sortInput=null;return results};jQuery.fn.uniqueSort=function(){return this.pushStack(jQuery.uniqueSort(slice.apply(this)))};Expr=jQuery.expr={cacheLength:50,createPseudo:markFunction,match:matchExpr,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:true}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:true},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(match){match[1]=match[1].replace(runescape,funescape);match[3]=(match[3]||match[4]||match[5]||"").replace(runescape,funescape);if(match[2]==="~="){match[3]=" "+match[3]+" "}return match.slice(0,4)},CHILD:function(match){match[1]=match[1].toLowerCase();if(match[1].slice(0,3)==="nth"){if(!match[3]){find.error(match[0])}match[4]=+(match[4]?match[5]+(match[6]||1):2*(match[3]==="even"||match[3]==="odd"));match[5]=+(match[7]+match[8]||match[3]==="odd")}else if(match[3]){find.error(match[0])}return match},PSEUDO:function(match){var excess,unquoted=!match[6]&&match[2];if(matchExpr.CHILD.test(match[0])){return null}if(match[3]){match[2]=match[4]||match[5]||""}else if(unquoted&&rpseudo.test(unquoted)&&(excess=tokenize(unquoted,true))&&(excess=unquoted.indexOf(")",unquoted.length-excess)-unquoted.length)){match[0]=match[0].slice(0,excess);match[2]=unquoted.slice(0,excess)}return match.slice(0,3)}},filter:{TAG:function(nodeNameSelector){var expectedNodeName=nodeNameSelector.replace(runescape,funescape).toLowerCase();return nodeNameSelector==="*"?function(){return true}:function(elem){return nodeName(elem,expectedNodeName)}},CLASS:function(className){var pattern=classCache[className+" "];return pattern||(pattern=new RegExp("(^|"+whitespace+")"+className+"("+whitespace+"|$)"))&&classCache(className,(function(elem){return pattern.test(typeof elem.className==="string"&&elem.className||typeof elem.getAttribute!=="undefined"&&elem.getAttribute("class")||"")}))},ATTR:function(name,operator,check){return function(elem){var result=find.attr(elem,name);if(result==null){return operator==="!="}if(!operator){return true}result+="";if(operator==="="){return result===check}if(operator==="!="){return result!==check}if(operator==="^="){return check&&result.indexOf(check)===0}if(operator==="*="){return check&&result.indexOf(check)>-1}if(operator==="$="){return check&&result.slice(-check.length)===check}if(operator==="~="){return(" "+result.replace(rwhitespace," ")+" ").indexOf(check)>-1}if(operator==="|="){return result===check||result.slice(0,check.length+1)===check+"-"}return false}},CHILD:function(type,what,_argument,first,last){var simple=type.slice(0,3)!=="nth",forward=type.slice(-4)!=="last",ofType=what==="of-type";return first===1&&last===0?function(elem){return!!elem.parentNode}:function(elem,_context,xml){var cache,outerCache,node,nodeIndex,start,dir=simple!==forward?"nextSibling":"previousSibling",parent=elem.parentNode,name=ofType&&elem.nodeName.toLowerCase(),useCache=!xml&&!ofType,diff=false;if(parent){if(simple){while(dir){node=elem;while(node=node[dir]){if(ofType?nodeName(node,name):node.nodeType===1){return false}}start=dir=type==="only"&&!start&&"nextSibling"}return true}start=[forward?parent.firstChild:parent.lastChild];if(forward&&useCache){outerCache=parent[expando]||(parent[expando]={});cache=outerCache[type]||[];nodeIndex=cache[0]===dirruns&&cache[1];diff=nodeIndex&&cache[2];node=nodeIndex&&parent.childNodes[nodeIndex];while(node=++nodeIndex&&node&&node[dir]||(diff=nodeIndex=0)||start.pop()){if(node.nodeType===1&&++diff&&node===elem){outerCache[type]=[dirruns,nodeIndex,diff];break}}}else{if(useCache){outerCache=elem[expando]||(elem[expando]={});cache=outerCache[type]||[];nodeIndex=cache[0]===dirruns&&cache[1];diff=nodeIndex}if(diff===false){while(node=++nodeIndex&&node&&node[dir]||(diff=nodeIndex=0)||start.pop()){if((ofType?nodeName(node,name):node.nodeType===1)&&++diff){if(useCache){outerCache=node[expando]||(node[expando]={});outerCache[type]=[dirruns,diff]}if(node===elem){break}}}}}diff-=last;return diff===first||diff%first===0&&diff/first>=0}}},PSEUDO:function(pseudo,argument){var args,fn=Expr.pseudos[pseudo]||Expr.setFilters[pseudo.toLowerCase()]||find.error("unsupported pseudo: "+pseudo);if(fn[expando]){return fn(argument)}if(fn.length>1){args=[pseudo,pseudo,"",argument];return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase())?markFunction((function(seed,matches){var idx,matched=fn(seed,argument),i=matched.length;while(i--){idx=indexOf.call(seed,matched[i]);seed[idx]=!(matches[idx]=matched[i])}})):function(elem){return fn(elem,0,args)}}return fn}},pseudos:{not:markFunction((function(selector){var input=[],results=[],matcher=compile(selector.replace(rtrimCSS,"$1"));return matcher[expando]?markFunction((function(seed,matches,_context,xml){var elem,unmatched=matcher(seed,null,xml,[]),i=seed.length;while(i--){if(elem=unmatched[i]){seed[i]=!(matches[i]=elem)}}})):function(elem,_context,xml){input[0]=elem;matcher(input,null,xml,results);input[0]=null;return!results.pop()}})),has:markFunction((function(selector){return function(elem){return find(selector,elem).length>0}})),contains:markFunction((function(text){text=text.replace(runescape,funescape);return function(elem){return(elem.textContent||jQuery.text(elem)).indexOf(text)>-1}})),lang:markFunction((function(lang){if(!ridentifier.test(lang||"")){find.error("unsupported lang: "+lang)}lang=lang.replace(runescape,funescape).toLowerCase();return function(elem){var elemLang;do{if(elemLang=documentIsHTML?elem.lang:elem.getAttribute("xml:lang")||elem.getAttribute("lang")){elemLang=elemLang.toLowerCase();return elemLang===lang||elemLang.indexOf(lang+"-")===0}}while((elem=elem.parentNode)&&elem.nodeType===1);return false}})),target:function(elem){var hash=window.location&&window.location.hash;return hash&&hash.slice(1)===elem.id},root:function(elem){return elem===documentElement},focus:function(elem){return elem===safeActiveElement()&&document.hasFocus()&&!!(elem.type||elem.href||~elem.tabIndex)},enabled:createDisabledPseudo(false),disabled:createDisabledPseudo(true),checked:function(elem){return nodeName(elem,"input")&&!!elem.checked||nodeName(elem,"option")&&!!elem.selected},selected:function(elem){if(elem.parentNode){elem.parentNode.selectedIndex}return elem.selected===true},empty:function(elem){for(elem=elem.firstChild;elem;elem=elem.nextSibling){if(elem.nodeType<6){return false}}return true},parent:function(elem){return!Expr.pseudos.empty(elem)},header:function(elem){return rheader.test(elem.nodeName)},input:function(elem){return rinputs.test(elem.nodeName)},button:function(elem){return nodeName(elem,"input")&&elem.type==="button"||nodeName(elem,"button")},text:function(elem){var attr;return nodeName(elem,"input")&&elem.type==="text"&&((attr=elem.getAttribute("type"))==null||attr.toLowerCase()==="text")},first:createPositionalPseudo((function(){return[0]})),last:createPositionalPseudo((function(_matchIndexes,length){return[length-1]})),eq:createPositionalPseudo((function(_matchIndexes,length,argument){return[argument<0?argument+length:argument]})),even:createPositionalPseudo((function(matchIndexes,length){var i=0;for(;i<length;i+=2){matchIndexes.push(i)}return matchIndexes})),odd:createPositionalPseudo((function(matchIndexes,length){var i=1;for(;i<length;i+=2){matchIndexes.push(i)}return matchIndexes})),lt:createPositionalPseudo((function(matchIndexes,length,argument){var i;if(argument<0){i=argument+length}else if(argument>length){i=length}else{i=argument}for(;--i>=0;){matchIndexes.push(i)}return matchIndexes})),gt:createPositionalPseudo((function(matchIndexes,length,argument){var i=argument<0?argument+length:argument;for(;++i<length;){matchIndexes.push(i)}return matchIndexes}))}};Expr.pseudos.nth=Expr.pseudos.eq;for(i in{radio:true,checkbox:true,file:true,password:true,image:true}){Expr.pseudos[i]=createInputPseudo(i)}for(i in{submit:true,reset:true}){Expr.pseudos[i]=createButtonPseudo(i)}function setFilters(){}setFilters.prototype=Expr.filters=Expr.pseudos;Expr.setFilters=new setFilters;function tokenize(selector,parseOnly){var matched,match,tokens,type,soFar,groups,preFilters,cached=tokenCache[selector+" "];if(cached){return parseOnly?0:cached.slice(0)}soFar=selector;groups=[];preFilters=Expr.preFilter;while(soFar){if(!matched||(match=rcomma.exec(soFar))){if(match){soFar=soFar.slice(match[0].length)||soFar}groups.push(tokens=[])}matched=false;if(match=rleadingCombinator.exec(soFar)){matched=match.shift();tokens.push({value:matched,type:match[0].replace(rtrimCSS," ")});soFar=soFar.slice(matched.length)}for(type in Expr.filter){if((match=matchExpr[type].exec(soFar))&&(!preFilters[type]||(match=preFilters[type](match)))){matched=match.shift();tokens.push({value:matched,type:type,matches:match});soFar=soFar.slice(matched.length)}}if(!matched){break}}if(parseOnly){return soFar.length}return soFar?find.error(selector):tokenCache(selector,groups).slice(0)}function toSelector(tokens){var i=0,len=tokens.length,selector="";for(;i<len;i++){selector+=tokens[i].value}return selector}function addCombinator(matcher,combinator,base){var dir=combinator.dir,skip=combinator.next,key=skip||dir,checkNonElements=base&&key==="parentNode",doneName=done++;return combinator.first?function(elem,context,xml){while(elem=elem[dir]){if(elem.nodeType===1||checkNonElements){return matcher(elem,context,xml)}}return false}:function(elem,context,xml){var oldCache,outerCache,newCache=[dirruns,doneName];if(xml){while(elem=elem[dir]){if(elem.nodeType===1||checkNonElements){if(matcher(elem,context,xml)){return true}}}}else{while(elem=elem[dir]){if(elem.nodeType===1||checkNonElements){outerCache=elem[expando]||(elem[expando]={});if(skip&&nodeName(elem,skip)){elem=elem[dir]||elem}else if((oldCache=outerCache[key])&&oldCache[0]===dirruns&&oldCache[1]===doneName){return newCache[2]=oldCache[2]}else{outerCache[key]=newCache;if(newCache[2]=matcher(elem,context,xml)){return true}}}}}return false}}function elementMatcher(matchers){return matchers.length>1?function(elem,context,xml){var i=matchers.length;while(i--){if(!matchers[i](elem,context,xml)){return false}}return true}:matchers[0]}function multipleContexts(selector,contexts,results){var i=0,len=contexts.length;for(;i<len;i++){find(selector,contexts[i],results)}return results}function condense(unmatched,map,filter,context,xml){var elem,newUnmatched=[],i=0,len=unmatched.length,mapped=map!=null;for(;i<len;i++){if(elem=unmatched[i]){if(!filter||filter(elem,context,xml)){newUnmatched.push(elem);if(mapped){map.push(i)}}}}return newUnmatched}function setMatcher(preFilter,selector,matcher,postFilter,postFinder,postSelector){if(postFilter&&!postFilter[expando]){postFilter=setMatcher(postFilter)}if(postFinder&&!postFinder[expando]){postFinder=setMatcher(postFinder,postSelector)}return markFunction((function(seed,results,context,xml){var temp,i,elem,matcherOut,preMap=[],postMap=[],preexisting=results.length,elems=seed||multipleContexts(selector||"*",context.nodeType?[context]:context,[]),matcherIn=preFilter&&(seed||!selector)?condense(elems,preMap,preFilter,context,xml):elems;if(matcher){matcherOut=postFinder||(seed?preFilter:preexisting||postFilter)?[]:results;matcher(matcherIn,matcherOut,context,xml)}else{matcherOut=matcherIn}if(postFilter){temp=condense(matcherOut,postMap);postFilter(temp,[],context,xml);i=temp.length;while(i--){if(elem=temp[i]){matcherOut[postMap[i]]=!(matcherIn[postMap[i]]=elem)}}}if(seed){if(postFinder||preFilter){if(postFinder){temp=[];i=matcherOut.length;while(i--){if(elem=matcherOut[i]){temp.push(matcherIn[i]=elem)}}postFinder(null,matcherOut=[],temp,xml)}i=matcherOut.length;while(i--){if((elem=matcherOut[i])&&(temp=postFinder?indexOf.call(seed,elem):preMap[i])>-1){seed[temp]=!(results[temp]=elem)}}}}else{matcherOut=condense(matcherOut===results?matcherOut.splice(preexisting,matcherOut.length):matcherOut);if(postFinder){postFinder(null,results,matcherOut,xml)}else{push.apply(results,matcherOut)}}}))}function matcherFromTokens(tokens){var checkContext,matcher,j,len=tokens.length,leadingRelative=Expr.relative[tokens[0].type],implicitRelative=leadingRelative||Expr.relative[" "],i=leadingRelative?1:0,matchContext=addCombinator((function(elem){return elem===checkContext}),implicitRelative,true),matchAnyContext=addCombinator((function(elem){return indexOf.call(checkContext,elem)>-1}),implicitRelative,true),matchers=[function(elem,context,xml){var ret=!leadingRelative&&(xml||context!=outermostContext)||((checkContext=context).nodeType?matchContext(elem,context,xml):matchAnyContext(elem,context,xml));checkContext=null;return ret}];for(;i<len;i++){if(matcher=Expr.relative[tokens[i].type]){matchers=[addCombinator(elementMatcher(matchers),matcher)]}else{matcher=Expr.filter[tokens[i].type].apply(null,tokens[i].matches);if(matcher[expando]){j=++i;for(;j<len;j++){if(Expr.relative[tokens[j].type]){break}}return setMatcher(i>1&&elementMatcher(matchers),i>1&&toSelector(tokens.slice(0,i-1).concat({value:tokens[i-2].type===" "?"*":""})).replace(rtrimCSS,"$1"),matcher,i<j&&matcherFromTokens(tokens.slice(i,j)),j<len&&matcherFromTokens(tokens=tokens.slice(j)),j<len&&toSelector(tokens))}matchers.push(matcher)}}return elementMatcher(matchers)}function matcherFromGroupMatchers(elementMatchers,setMatchers){var bySet=setMatchers.length>0,byElement=elementMatchers.length>0,superMatcher=function(seed,context,xml,results,outermost){var elem,j,matcher,matchedCount=0,i="0",unmatched=seed&&[],setMatched=[],contextBackup=outermostContext,elems=seed||byElement&&Expr.find.TAG("*",outermost),dirrunsUnique=dirruns+=contextBackup==null?1:Math.random()||.1,len=elems.length;if(outermost){outermostContext=context==document||context||outermost}for(;i!==len&&(elem=elems[i])!=null;i++){if(byElement&&elem){j=0;if(!context&&elem.ownerDocument!=document){setDocument(elem);xml=!documentIsHTML}while(matcher=elementMatchers[j++]){if(matcher(elem,context||document,xml)){push.call(results,elem);break}}if(outermost){dirruns=dirrunsUnique}}if(bySet){if(elem=!matcher&&elem){matchedCount--}if(seed){unmatched.push(elem)}}}matchedCount+=i;if(bySet&&i!==matchedCount){j=0;while(matcher=setMatchers[j++]){matcher(unmatched,setMatched,context,xml)}if(seed){if(matchedCount>0){while(i--){if(!(unmatched[i]||setMatched[i])){setMatched[i]=pop.call(results)}}}setMatched=condense(setMatched)}push.apply(results,setMatched);if(outermost&&!seed&&setMatched.length>0&&matchedCount+setMatchers.length>1){jQuery.uniqueSort(results)}}if(outermost){dirruns=dirrunsUnique;outermostContext=contextBackup}return unmatched};return bySet?markFunction(superMatcher):superMatcher}function compile(selector,match){var i,setMatchers=[],elementMatchers=[],cached=compilerCache[selector+" "];if(!cached){if(!match){match=tokenize(selector)}i=match.length;while(i--){cached=matcherFromTokens(match[i]);if(cached[expando]){setMatchers.push(cached)}else{elementMatchers.push(cached)}}cached=compilerCache(selector,matcherFromGroupMatchers(elementMatchers,setMatchers));cached.selector=selector}return cached}function select(selector,context,results,seed){var i,tokens,token,type,find,compiled=typeof selector==="function"&&selector,match=!seed&&tokenize(selector=compiled.selector||selector);results=results||[];if(match.length===1){tokens=match[0]=match[0].slice(0);if(tokens.length>2&&(token=tokens[0]).type==="ID"&&context.nodeType===9&&documentIsHTML&&Expr.relative[tokens[1].type]){context=(Expr.find.ID(token.matches[0].replace(runescape,funescape),context)||[])[0];if(!context){return results}else if(compiled){context=context.parentNode}selector=selector.slice(tokens.shift().value.length)}i=matchExpr.needsContext.test(selector)?0:tokens.length;while(i--){token=tokens[i];if(Expr.relative[type=token.type]){break}if(find=Expr.find[type]){if(seed=find(token.matches[0].replace(runescape,funescape),rsibling.test(tokens[0].type)&&testContext(context.parentNode)||context)){tokens.splice(i,1);selector=seed.length&&toSelector(tokens);if(!selector){push.apply(results,seed);return results}break}}}}(compiled||compile(selector,match))(seed,context,!documentIsHTML,results,!context||rsibling.test(selector)&&testContext(context.parentNode)||context);return results}support.sortStable=expando.split("").sort(sortOrder).join("")===expando;setDocument();support.sortDetached=assert((function(el){return el.compareDocumentPosition(document.createElement("fieldset"))&1}));jQuery.find=find;jQuery.expr[":"]=jQuery.expr.pseudos;jQuery.unique=jQuery.uniqueSort;find.compile=compile;find.select=select;find.setDocument=setDocument;find.tokenize=tokenize;find.escape=jQuery.escapeSelector;find.getText=jQuery.text;find.isXML=jQuery.isXMLDoc;find.selectors=jQuery.expr;find.support=jQuery.support;find.uniqueSort=jQuery.uniqueSort})();var dir=function(elem,dir,until){var matched=[],truncate=until!==undefined;while((elem=elem[dir])&&elem.nodeType!==9){if(elem.nodeType===1){if(truncate&&jQuery(elem).is(until)){break}matched.push(elem)}}return matched};var siblings=function(n,elem){var matched=[];for(;n;n=n.nextSibling){if(n.nodeType===1&&n!==elem){matched.push(n)}}return matched};var rneedsContext=jQuery.expr.match.needsContext;var rsingleTag=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function winnow(elements,qualifier,not){if(isFunction(qualifier)){return jQuery.grep(elements,(function(elem,i){return!!qualifier.call(elem,i,elem)!==not}))}if(qualifier.nodeType){return jQuery.grep(elements,(function(elem){return elem===qualifier!==not}))}if(typeof qualifier!=="string"){return jQuery.grep(elements,(function(elem){return indexOf.call(qualifier,elem)>-1!==not}))}return jQuery.filter(qualifier,elements,not)}jQuery.filter=function(expr,elems,not){var elem=elems[0];if(not){expr=":not("+expr+")"}if(elems.length===1&&elem.nodeType===1){return jQuery.find.matchesSelector(elem,expr)?[elem]:[]}return jQuery.find.matches(expr,jQuery.grep(elems,(function(elem){return elem.nodeType===1})))};jQuery.fn.extend({find:function(selector){var i,ret,len=this.length,self=this;if(typeof selector!=="string"){return this.pushStack(jQuery(selector).filter((function(){for(i=0;i<len;i++){if(jQuery.contains(self[i],this)){return true}}})))}ret=this.pushStack([]);for(i=0;i<len;i++){jQuery.find(selector,self[i],ret)}return len>1?jQuery.uniqueSort(ret):ret},filter:function(selector){return this.pushStack(winnow(this,selector||[],false))},not:function(selector){return this.pushStack(winnow(this,selector||[],true))},is:function(selector){return!!winnow(this,typeof selector==="string"&&rneedsContext.test(selector)?jQuery(selector):selector||[],false).length}});var rootjQuery,rquickExpr=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,init=jQuery.fn.init=function(selector,context,root){var match,elem;if(!selector){return this}root=root||rootjQuery;if(typeof selector==="string"){if(selector[0]==="<"&&selector[selector.length-1]===">"&&selector.length>=3){match=[null,selector,null]}else{match=rquickExpr.exec(selector)}if(match&&(match[1]||!context)){if(match[1]){context=context instanceof jQuery?context[0]:context;jQuery.merge(this,jQuery.parseHTML(match[1],context&&context.nodeType?context.ownerDocument||context:document,true));if(rsingleTag.test(match[1])&&jQuery.isPlainObject(context)){for(match in context){if(isFunction(this[match])){this[match](context[match])}else{this.attr(match,context[match])}}}return this}else{elem=document.getElementById(match[2]);if(elem){this[0]=elem;this.length=1}return this}}else if(!context||context.jquery){return(context||root).find(selector)}else{return this.constructor(context).find(selector)}}else if(selector.nodeType){this[0]=selector;this.length=1;return this}else if(isFunction(selector)){return root.ready!==undefined?root.ready(selector):selector(jQuery)}return jQuery.makeArray(selector,this)};init.prototype=jQuery.fn;rootjQuery=jQuery(document);var rparentsprev=/^(?:parents|prev(?:Until|All))/,guaranteedUnique={children:true,contents:true,next:true,prev:true};jQuery.fn.extend({has:function(target){var targets=jQuery(target,this),l=targets.length;return this.filter((function(){var i=0;for(;i<l;i++){if(jQuery.contains(this,targets[i])){return true}}}))},closest:function(selectors,context){var cur,i=0,l=this.length,matched=[],targets=typeof selectors!=="string"&&jQuery(selectors);if(!rneedsContext.test(selectors)){for(;i<l;i++){for(cur=this[i];cur&&cur!==context;cur=cur.parentNode){if(cur.nodeType<11&&(targets?targets.index(cur)>-1:cur.nodeType===1&&jQuery.find.matchesSelector(cur,selectors))){matched.push(cur);break}}}}return this.pushStack(matched.length>1?jQuery.uniqueSort(matched):matched)},index:function(elem){if(!elem){return this[0]&&this[0].parentNode?this.first().prevAll().length:-1}if(typeof elem==="string"){return indexOf.call(jQuery(elem),this[0])}return indexOf.call(this,elem.jquery?elem[0]:elem)},add:function(selector,context){return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(),jQuery(selector,context))))},addBack:function(selector){return this.add(selector==null?this.prevObject:this.prevObject.filter(selector))}});function sibling(cur,dir){while((cur=cur[dir])&&cur.nodeType!==1){}return cur}jQuery.each({parent:function(elem){var parent=elem.parentNode;return parent&&parent.nodeType!==11?parent:null},parents:function(elem){return dir(elem,"parentNode")},parentsUntil:function(elem,_i,until){return dir(elem,"parentNode",until)},next:function(elem){return sibling(elem,"nextSibling")},prev:function(elem){return sibling(elem,"previousSibling")},nextAll:function(elem){return dir(elem,"nextSibling")},prevAll:function(elem){return dir(elem,"previousSibling")},nextUntil:function(elem,_i,until){return dir(elem,"nextSibling",until)},prevUntil:function(elem,_i,until){return dir(elem,"previousSibling",until)},siblings:function(elem){return siblings((elem.parentNode||{}).firstChild,elem)},children:function(elem){return siblings(elem.firstChild)},contents:function(elem){if(elem.contentDocument!=null&&getProto(elem.contentDocument)){return elem.contentDocument}if(nodeName(elem,"template")){elem=elem.content||elem}return jQuery.merge([],elem.childNodes)}},(function(name,fn){jQuery.fn[name]=function(until,selector){var matched=jQuery.map(this,fn,until);if(name.slice(-5)!=="Until"){selector=until}if(selector&&typeof selector==="string"){matched=jQuery.filter(selector,matched)}if(this.length>1){if(!guaranteedUnique[name]){jQuery.uniqueSort(matched)}if(rparentsprev.test(name)){matched.reverse()}}return this.pushStack(matched)}}));var rnothtmlwhite=/[^\x20\t\r\n\f]+/g;function createOptions(options){var object={};jQuery.each(options.match(rnothtmlwhite)||[],(function(_,flag){object[flag]=true}));return object}jQuery.Callbacks=function(options){options=typeof options==="string"?createOptions(options):jQuery.extend({},options);var firing,memory,fired,locked,list=[],queue=[],firingIndex=-1,fire=function(){locked=locked||options.once;fired=firing=true;for(;queue.length;firingIndex=-1){memory=queue.shift();while(++firingIndex<list.length){if(list[firingIndex].apply(memory[0],memory[1])===false&&options.stopOnFalse){firingIndex=list.length;memory=false}}}if(!options.memory){memory=false}firing=false;if(locked){if(memory){list=[]}else{list=""}}},self={add:function(){if(list){if(memory&&!firing){firingIndex=list.length-1;queue.push(memory)}(function add(args){jQuery.each(args,(function(_,arg){if(isFunction(arg)){if(!options.unique||!self.has(arg)){list.push(arg)}}else if(arg&&arg.length&&toType(arg)!=="string"){add(arg)}}))})(arguments);if(memory&&!firing){fire()}}return this},remove:function(){jQuery.each(arguments,(function(_,arg){var index;while((index=jQuery.inArray(arg,list,index))>-1){list.splice(index,1);if(index<=firingIndex){firingIndex--}}}));return this},has:function(fn){return fn?jQuery.inArray(fn,list)>-1:list.length>0},empty:function(){if(list){list=[]}return this},disable:function(){locked=queue=[];list=memory="";return this},disabled:function(){return!list},lock:function(){locked=queue=[];if(!memory&&!firing){list=memory=""}return this},locked:function(){return!!locked},fireWith:function(context,args){if(!locked){args=args||[];args=[context,args.slice?args.slice():args];queue.push(args);if(!firing){fire()}}return this},fire:function(){self.fireWith(this,arguments);return this},fired:function(){return!!fired}};return self};function Identity(v){return v}function Thrower(ex){throw ex}function adoptValue(value,resolve,reject,noValue){var method;try{if(value&&isFunction(method=value.promise)){method.call(value).done(resolve).fail(reject)}else if(value&&isFunction(method=value.then)){method.call(value,resolve,reject)}else{resolve.apply(undefined,[value].slice(noValue))}}catch(value){reject.apply(undefined,[value])}}jQuery.extend({Deferred:function(func){var tuples=[["notify","progress",jQuery.Callbacks("memory"),jQuery.Callbacks("memory"),2],["resolve","done",jQuery.Callbacks("once memory"),jQuery.Callbacks("once memory"),0,"resolved"],["reject","fail",jQuery.Callbacks("once memory"),jQuery.Callbacks("once memory"),1,"rejected"]],state="pending",promise={state:function(){return state},always:function(){deferred.done(arguments).fail(arguments);return this},catch:function(fn){return promise.then(null,fn)},pipe:function(){var fns=arguments;return jQuery.Deferred((function(newDefer){jQuery.each(tuples,(function(_i,tuple){var fn=isFunction(fns[tuple[4]])&&fns[tuple[4]];deferred[tuple[1]]((function(){var returned=fn&&fn.apply(this,arguments);if(returned&&isFunction(returned.promise)){returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject)}else{newDefer[tuple[0]+"With"](this,fn?[returned]:arguments)}}))}));fns=null})).promise()},then:function(onFulfilled,onRejected,onProgress){var maxDepth=0;function resolve(depth,deferred,handler,special){return function(){var that=this,args=arguments,mightThrow=function(){var returned,then;if(depth<maxDepth){return}returned=handler.apply(that,args);if(returned===deferred.promise()){throw new TypeError("Thenable self-resolution")}then=returned&&(typeof returned==="object"||typeof returned==="function")&&returned.then;if(isFunction(then)){if(special){then.call(returned,resolve(maxDepth,deferred,Identity,special),resolve(maxDepth,deferred,Thrower,special))}else{maxDepth++;then.call(returned,resolve(maxDepth,deferred,Identity,special),resolve(maxDepth,deferred,Thrower,special),resolve(maxDepth,deferred,Identity,deferred.notifyWith))}}else{if(handler!==Identity){that=undefined;args=[returned]}(special||deferred.resolveWith)(that,args)}},process=special?mightThrow:function(){try{mightThrow()}catch(e){if(jQuery.Deferred.exceptionHook){jQuery.Deferred.exceptionHook(e,process.error)}if(depth+1>=maxDepth){if(handler!==Thrower){that=undefined;args=[e]}deferred.rejectWith(that,args)}}};if(depth){process()}else{if(jQuery.Deferred.getErrorHook){process.error=jQuery.Deferred.getErrorHook()}else if(jQuery.Deferred.getStackHook){process.error=jQuery.Deferred.getStackHook()}window.setTimeout(process)}}}return jQuery.Deferred((function(newDefer){tuples[0][3].add(resolve(0,newDefer,isFunction(onProgress)?onProgress:Identity,newDefer.notifyWith));tuples[1][3].add(resolve(0,newDefer,isFunction(onFulfilled)?onFulfilled:Identity));tuples[2][3].add(resolve(0,newDefer,isFunction(onRejected)?onRejected:Thrower))})).promise()},promise:function(obj){return obj!=null?jQuery.extend(obj,promise):promise}},deferred={};jQuery.each(tuples,(function(i,tuple){var list=tuple[2],stateString=tuple[5];promise[tuple[1]]=list.add;if(stateString){list.add((function(){state=stateString}),tuples[3-i][2].disable,tuples[3-i][3].disable,tuples[0][2].lock,tuples[0][3].lock)}list.add(tuple[3].fire);deferred[tuple[0]]=function(){deferred[tuple[0]+"With"](this===deferred?undefined:this,arguments);return this};deferred[tuple[0]+"With"]=list.fireWith}));promise.promise(deferred);if(func){func.call(deferred,deferred)}return deferred},when:function(singleValue){var remaining=arguments.length,i=remaining,resolveContexts=Array(i),resolveValues=slice.call(arguments),primary=jQuery.Deferred(),updateFunc=function(i){return function(value){resolveContexts[i]=this;resolveValues[i]=arguments.length>1?slice.call(arguments):value;if(!--remaining){primary.resolveWith(resolveContexts,resolveValues)}}};if(remaining<=1){adoptValue(singleValue,primary.done(updateFunc(i)).resolve,primary.reject,!remaining);if(primary.state()==="pending"||isFunction(resolveValues[i]&&resolveValues[i].then)){return primary.then()}}while(i--){adoptValue(resolveValues[i],updateFunc(i),primary.reject)}return primary.promise()}});var rerrorNames=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;jQuery.Deferred.exceptionHook=function(error,asyncError){if(window.console&&window.console.warn&&error&&rerrorNames.test(error.name)){window.console.warn("jQuery.Deferred exception: "+error.message,error.stack,asyncError)}};jQuery.readyException=function(error){window.setTimeout((function(){throw error}))};var readyList=jQuery.Deferred();jQuery.fn.ready=function(fn){readyList.then(fn).catch((function(error){jQuery.readyException(error)}));return this};jQuery.extend({isReady:false,readyWait:1,ready:function(wait){if(wait===true?--jQuery.readyWait:jQuery.isReady){return}jQuery.isReady=true;if(wait!==true&&--jQuery.readyWait>0){return}readyList.resolveWith(document,[jQuery])}});jQuery.ready.then=readyList.then;function completed(){document.removeEventListener("DOMContentLoaded",completed);window.removeEventListener("load",completed);jQuery.ready()}if(document.readyState==="complete"||document.readyState!=="loading"&&!document.documentElement.doScroll){window.setTimeout(jQuery.ready)}else{document.addEventListener("DOMContentLoaded",completed);window.addEventListener("load",completed)}var access=function(elems,fn,key,value,chainable,emptyGet,raw){var i=0,len=elems.length,bulk=key==null;if(toType(key)==="object"){chainable=true;for(i in key){access(elems,fn,i,key[i],true,emptyGet,raw)}}else if(value!==undefined){chainable=true;if(!isFunction(value)){raw=true}if(bulk){if(raw){fn.call(elems,value);fn=null}else{bulk=fn;fn=function(elem,_key,value){return bulk.call(jQuery(elem),value)}}}if(fn){for(;i<len;i++){fn(elems[i],key,raw?value:value.call(elems[i],i,fn(elems[i],key)))}}}if(chainable){return elems}if(bulk){return fn.call(elems)}return len?fn(elems[0],key):emptyGet};var rmsPrefix=/^-ms-/,rdashAlpha=/-([a-z])/g;function fcamelCase(_all,letter){return letter.toUpperCase()}function camelCase(string){return string.replace(rmsPrefix,"ms-").replace(rdashAlpha,fcamelCase)}var acceptData=function(owner){return owner.nodeType===1||owner.nodeType===9||!+owner.nodeType};function Data(){this.expando=jQuery.expando+Data.uid++}Data.uid=1;Data.prototype={cache:function(owner){var value=owner[this.expando];if(!value){value={};if(acceptData(owner)){if(owner.nodeType){owner[this.expando]=value}else{Object.defineProperty(owner,this.expando,{value:value,configurable:true})}}}return value},set:function(owner,data,value){var prop,cache=this.cache(owner);if(typeof data==="string"){cache[camelCase(data)]=value}else{for(prop in data){cache[camelCase(prop)]=data[prop]}}return cache},get:function(owner,key){return key===undefined?this.cache(owner):owner[this.expando]&&owner[this.expando][camelCase(key)]},access:function(owner,key,value){if(key===undefined||key&&typeof key==="string"&&value===undefined){return this.get(owner,key)}this.set(owner,key,value);return value!==undefined?value:key},remove:function(owner,key){var i,cache=owner[this.expando];if(cache===undefined){return}if(key!==undefined){if(Array.isArray(key)){key=key.map(camelCase)}else{key=camelCase(key);key=key in cache?[key]:key.match(rnothtmlwhite)||[]}i=key.length;while(i--){delete cache[key[i]]}}if(key===undefined||jQuery.isEmptyObject(cache)){if(owner.nodeType){owner[this.expando]=undefined}else{delete owner[this.expando]}}},hasData:function(owner){var cache=owner[this.expando];return cache!==undefined&&!jQuery.isEmptyObject(cache)}};var dataPriv=new Data;var dataUser=new Data;var rbrace=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,rmultiDash=/[A-Z]/g;function getData(data){if(data==="true"){return true}if(data==="false"){return false}if(data==="null"){return null}if(data===+data+""){return+data}if(rbrace.test(data)){return JSON.parse(data)}return data}function dataAttr(elem,key,data){var name;if(data===undefined&&elem.nodeType===1){name="data-"+key.replace(rmultiDash,"-$&").toLowerCase();data=elem.getAttribute(name);if(typeof data==="string"){try{data=getData(data)}catch(e){}dataUser.set(elem,key,data)}else{data=undefined}}return data}jQuery.extend({hasData:function(elem){return dataUser.hasData(elem)||dataPriv.hasData(elem)},data:function(elem,name,data){return dataUser.access(elem,name,data)},removeData:function(elem,name){dataUser.remove(elem,name)},_data:function(elem,name,data){return dataPriv.access(elem,name,data)},_removeData:function(elem,name){dataPriv.remove(elem,name)}});jQuery.fn.extend({data:function(key,value){var i,name,data,elem=this[0],attrs=elem&&elem.attributes;if(key===undefined){if(this.length){data=dataUser.get(elem);if(elem.nodeType===1&&!dataPriv.get(elem,"hasDataAttrs")){i=attrs.length;while(i--){if(attrs[i]){name=attrs[i].name;if(name.indexOf("data-")===0){name=camelCase(name.slice(5));dataAttr(elem,name,data[name])}}}dataPriv.set(elem,"hasDataAttrs",true)}}return data}if(typeof key==="object"){return this.each((function(){dataUser.set(this,key)}))}return access(this,(function(value){var data;if(elem&&value===undefined){data=dataUser.get(elem,key);if(data!==undefined){return data}data=dataAttr(elem,key);if(data!==undefined){return data}return}this.each((function(){dataUser.set(this,key,value)}))}),null,value,arguments.length>1,null,true)},removeData:function(key){return this.each((function(){dataUser.remove(this,key)}))}});jQuery.extend({queue:function(elem,type,data){var queue;if(elem){type=(type||"fx")+"queue";queue=dataPriv.get(elem,type);if(data){if(!queue||Array.isArray(data)){queue=dataPriv.access(elem,type,jQuery.makeArray(data))}else{queue.push(data)}}return queue||[]}},dequeue:function(elem,type){type=type||"fx";var queue=jQuery.queue(elem,type),startLength=queue.length,fn=queue.shift(),hooks=jQuery._queueHooks(elem,type),next=function(){jQuery.dequeue(elem,type)};if(fn==="inprogress"){fn=queue.shift();startLength--}if(fn){if(type==="fx"){queue.unshift("inprogress")}delete hooks.stop;fn.call(elem,next,hooks)}if(!startLength&&hooks){hooks.empty.fire()}},_queueHooks:function(elem,type){var key=type+"queueHooks";return dataPriv.get(elem,key)||dataPriv.access(elem,key,{empty:jQuery.Callbacks("once memory").add((function(){dataPriv.remove(elem,[type+"queue",key])}))})}});jQuery.fn.extend({queue:function(type,data){var setter=2;if(typeof type!=="string"){data=type;type="fx";setter--}if(arguments.length<setter){return jQuery.queue(this[0],type)}return data===undefined?this:this.each((function(){var queue=jQuery.queue(this,type,data);jQuery._queueHooks(this,type);if(type==="fx"&&queue[0]!=="inprogress"){jQuery.dequeue(this,type)}}))},dequeue:function(type){return this.each((function(){jQuery.dequeue(this,type)}))},clearQueue:function(type){return this.queue(type||"fx",[])},promise:function(type,obj){var tmp,count=1,defer=jQuery.Deferred(),elements=this,i=this.length,resolve=function(){if(!--count){defer.resolveWith(elements,[elements])}};if(typeof type!=="string"){obj=type;type=undefined}type=type||"fx";while(i--){tmp=dataPriv.get(elements[i],type+"queueHooks");if(tmp&&tmp.empty){count++;tmp.empty.add(resolve)}}resolve();return defer.promise(obj)}});var pnum=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source;var rcssNum=new RegExp("^(?:([+-])=|)("+pnum+")([a-z%]*)$","i");var cssExpand=["Top","Right","Bottom","Left"];var documentElement=document.documentElement;var isAttached=function(elem){return jQuery.contains(elem.ownerDocument,elem)},composed={composed:true};if(documentElement.getRootNode){isAttached=function(elem){return jQuery.contains(elem.ownerDocument,elem)||elem.getRootNode(composed)===elem.ownerDocument}}var isHiddenWithinTree=function(elem,el){elem=el||elem;return elem.style.display==="none"||elem.style.display===""&&isAttached(elem)&&jQuery.css(elem,"display")==="none"};function adjustCSS(elem,prop,valueParts,tween){var adjusted,scale,maxIterations=20,currentValue=tween?function(){return tween.cur()}:function(){return jQuery.css(elem,prop,"")},initial=currentValue(),unit=valueParts&&valueParts[3]||(jQuery.cssNumber[prop]?"":"px"),initialInUnit=elem.nodeType&&(jQuery.cssNumber[prop]||unit!=="px"&&+initial)&&rcssNum.exec(jQuery.css(elem,prop));if(initialInUnit&&initialInUnit[3]!==unit){initial=initial/2;unit=unit||initialInUnit[3];initialInUnit=+initial||1;while(maxIterations--){jQuery.style(elem,prop,initialInUnit+unit);if((1-scale)*(1-(scale=currentValue()/initial||.5))<=0){maxIterations=0}initialInUnit=initialInUnit/scale}initialInUnit=initialInUnit*2;jQuery.style(elem,prop,initialInUnit+unit);valueParts=valueParts||[]}if(valueParts){initialInUnit=+initialInUnit||+initial||0;adjusted=valueParts[1]?initialInUnit+(valueParts[1]+1)*valueParts[2]:+valueParts[2];if(tween){tween.unit=unit;tween.start=initialInUnit;tween.end=adjusted}}return adjusted}var defaultDisplayMap={};function getDefaultDisplay(elem){var temp,doc=elem.ownerDocument,nodeName=elem.nodeName,display=defaultDisplayMap[nodeName];if(display){return display}temp=doc.body.appendChild(doc.createElement(nodeName));display=jQuery.css(temp,"display");temp.parentNode.removeChild(temp);if(display==="none"){display="block"}defaultDisplayMap[nodeName]=display;return display}function showHide(elements,show){var display,elem,values=[],index=0,length=elements.length;for(;index<length;index++){elem=elements[index];if(!elem.style){continue}display=elem.style.display;if(show){if(display==="none"){values[index]=dataPriv.get(elem,"display")||null;if(!values[index]){elem.style.display=""}}if(elem.style.display===""&&isHiddenWithinTree(elem)){values[index]=getDefaultDisplay(elem)}}else{if(display!=="none"){values[index]="none";dataPriv.set(elem,"display",display)}}}for(index=0;index<length;index++){if(values[index]!=null){elements[index].style.display=values[index]}}return elements}jQuery.fn.extend({show:function(){return showHide(this,true)},hide:function(){return showHide(this)},toggle:function(state){if(typeof state==="boolean"){return state?this.show():this.hide()}return this.each((function(){if(isHiddenWithinTree(this)){jQuery(this).show()}else{jQuery(this).hide()}}))}});var rcheckableType=/^(?:checkbox|radio)$/i;var rtagName=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i;var rscriptType=/^$|^module$|\/(?:java|ecma)script/i;(function(){var fragment=document.createDocumentFragment(),div=fragment.appendChild(document.createElement("div")),input=document.createElement("input");input.setAttribute("type","radio");input.setAttribute("checked","checked");input.setAttribute("name","t");div.appendChild(input);support.checkClone=div.cloneNode(true).cloneNode(true).lastChild.checked;div.innerHTML="<textarea>x</textarea>";support.noCloneChecked=!!div.cloneNode(true).lastChild.defaultValue;div.innerHTML="<option></option>";support.option=!!div.lastChild})();var wrapMap={thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};wrapMap.tbody=wrapMap.tfoot=wrapMap.colgroup=wrapMap.caption=wrapMap.thead;wrapMap.th=wrapMap.td;if(!support.option){wrapMap.optgroup=wrapMap.option=[1,"<select multiple='multiple'>","</select>"]}function getAll(context,tag){var ret;if(typeof context.getElementsByTagName!=="undefined"){ret=context.getElementsByTagName(tag||"*")}else if(typeof context.querySelectorAll!=="undefined"){ret=context.querySelectorAll(tag||"*")}else{ret=[]}if(tag===undefined||tag&&nodeName(context,tag)){return jQuery.merge([context],ret)}return ret}function setGlobalEval(elems,refElements){var i=0,l=elems.length;for(;i<l;i++){dataPriv.set(elems[i],"globalEval",!refElements||dataPriv.get(refElements[i],"globalEval"))}}var rhtml=/<|&#?\w+;/;function buildFragment(elems,context,scripts,selection,ignored){var elem,tmp,tag,wrap,attached,j,fragment=context.createDocumentFragment(),nodes=[],i=0,l=elems.length;for(;i<l;i++){elem=elems[i];if(elem||elem===0){if(toType(elem)==="object"){jQuery.merge(nodes,elem.nodeType?[elem]:elem)}else if(!rhtml.test(elem)){nodes.push(context.createTextNode(elem))}else{tmp=tmp||fragment.appendChild(context.createElement("div"));tag=(rtagName.exec(elem)||["",""])[1].toLowerCase();wrap=wrapMap[tag]||wrapMap._default;tmp.innerHTML=wrap[1]+jQuery.htmlPrefilter(elem)+wrap[2];j=wrap[0];while(j--){tmp=tmp.lastChild}jQuery.merge(nodes,tmp.childNodes);tmp=fragment.firstChild;tmp.textContent=""}}}fragment.textContent="";i=0;while(elem=nodes[i++]){if(selection&&jQuery.inArray(elem,selection)>-1){if(ignored){ignored.push(elem)}continue}attached=isAttached(elem);tmp=getAll(fragment.appendChild(elem),"script");if(attached){setGlobalEval(tmp)}if(scripts){j=0;while(elem=tmp[j++]){if(rscriptType.test(elem.type||"")){scripts.push(elem)}}}}return fragment}var rtypenamespace=/^([^.]*)(?:\.(.+)|)/;function returnTrue(){return true}function returnFalse(){return false}function on(elem,types,selector,data,fn,one){var origFn,type;if(typeof types==="object"){if(typeof selector!=="string"){data=data||selector;selector=undefined}for(type in types){on(elem,type,selector,data,types[type],one)}return elem}if(data==null&&fn==null){fn=selector;data=selector=undefined}else if(fn==null){if(typeof selector==="string"){fn=data;data=undefined}else{fn=data;data=selector;selector=undefined}}if(fn===false){fn=returnFalse}else if(!fn){return elem}if(one===1){origFn=fn;fn=function(event){jQuery().off(event);return origFn.apply(this,arguments)};fn.guid=origFn.guid||(origFn.guid=jQuery.guid++)}return elem.each((function(){jQuery.event.add(this,types,fn,data,selector)}))}jQuery.event={global:{},add:function(elem,types,handler,data,selector){var handleObjIn,eventHandle,tmp,events,t,handleObj,special,handlers,type,namespaces,origType,elemData=dataPriv.get(elem);if(!acceptData(elem)){return}if(handler.handler){handleObjIn=handler;handler=handleObjIn.handler;selector=handleObjIn.selector}if(selector){jQuery.find.matchesSelector(documentElement,selector)}if(!handler.guid){handler.guid=jQuery.guid++}if(!(events=elemData.events)){events=elemData.events=Object.create(null)}if(!(eventHandle=elemData.handle)){eventHandle=elemData.handle=function(e){return typeof jQuery!=="undefined"&&jQuery.event.triggered!==e.type?jQuery.event.dispatch.apply(elem,arguments):undefined}}types=(types||"").match(rnothtmlwhite)||[""];t=types.length;while(t--){tmp=rtypenamespace.exec(types[t])||[];type=origType=tmp[1];namespaces=(tmp[2]||"").split(".").sort();if(!type){continue}special=jQuery.event.special[type]||{};type=(selector?special.delegateType:special.bindType)||type;special=jQuery.event.special[type]||{};handleObj=jQuery.extend({type:type,origType:origType,data:data,handler:handler,guid:handler.guid,selector:selector,needsContext:selector&&jQuery.expr.match.needsContext.test(selector),namespace:namespaces.join(".")},handleObjIn);if(!(handlers=events[type])){handlers=events[type]=[];handlers.delegateCount=0;if(!special.setup||special.setup.call(elem,data,namespaces,eventHandle)===false){if(elem.addEventListener){elem.addEventListener(type,eventHandle)}}}if(special.add){special.add.call(elem,handleObj);if(!handleObj.handler.guid){handleObj.handler.guid=handler.guid}}if(selector){handlers.splice(handlers.delegateCount++,0,handleObj)}else{handlers.push(handleObj)}jQuery.event.global[type]=true}},remove:function(elem,types,handler,selector,mappedTypes){var j,origCount,tmp,events,t,handleObj,special,handlers,type,namespaces,origType,elemData=dataPriv.hasData(elem)&&dataPriv.get(elem);if(!elemData||!(events=elemData.events)){return}types=(types||"").match(rnothtmlwhite)||[""];t=types.length;while(t--){tmp=rtypenamespace.exec(types[t])||[];type=origType=tmp[1];namespaces=(tmp[2]||"").split(".").sort();if(!type){for(type in events){jQuery.event.remove(elem,type+types[t],handler,selector,true)}continue}special=jQuery.event.special[type]||{};type=(selector?special.delegateType:special.bindType)||type;handlers=events[type]||[];tmp=tmp[2]&&new RegExp("(^|\\.)"+namespaces.join("\\.(?:.*\\.|)")+"(\\.|$)");origCount=j=handlers.length;while(j--){handleObj=handlers[j];if((mappedTypes||origType===handleObj.origType)&&(!handler||handler.guid===handleObj.guid)&&(!tmp||tmp.test(handleObj.namespace))&&(!selector||selector===handleObj.selector||selector==="**"&&handleObj.selector)){handlers.splice(j,1);if(handleObj.selector){handlers.delegateCount--}if(special.remove){special.remove.call(elem,handleObj)}}}if(origCount&&!handlers.length){if(!special.teardown||special.teardown.call(elem,namespaces,elemData.handle)===false){jQuery.removeEvent(elem,type,elemData.handle)}delete events[type]}}if(jQuery.isEmptyObject(events)){dataPriv.remove(elem,"handle events")}},dispatch:function(nativeEvent){var i,j,ret,matched,handleObj,handlerQueue,args=new Array(arguments.length),event=jQuery.event.fix(nativeEvent),handlers=(dataPriv.get(this,"events")||Object.create(null))[event.type]||[],special=jQuery.event.special[event.type]||{};args[0]=event;for(i=1;i<arguments.length;i++){args[i]=arguments[i]}event.delegateTarget=this;if(special.preDispatch&&special.preDispatch.call(this,event)===false){return}handlerQueue=jQuery.event.handlers.call(this,event,handlers);i=0;while((matched=handlerQueue[i++])&&!event.isPropagationStopped()){event.currentTarget=matched.elem;j=0;while((handleObj=matched.handlers[j++])&&!event.isImmediatePropagationStopped()){if(!event.rnamespace||handleObj.namespace===false||event.rnamespace.test(handleObj.namespace)){event.handleObj=handleObj;event.data=handleObj.data;ret=((jQuery.event.special[handleObj.origType]||{}).handle||handleObj.handler).apply(matched.elem,args);if(ret!==undefined){if((event.result=ret)===false){event.preventDefault();event.stopPropagation()}}}}}if(special.postDispatch){special.postDispatch.call(this,event)}return event.result},handlers:function(event,handlers){var i,handleObj,sel,matchedHandlers,matchedSelectors,handlerQueue=[],delegateCount=handlers.delegateCount,cur=event.target;if(delegateCount&&cur.nodeType&&!(event.type==="click"&&event.button>=1)){for(;cur!==this;cur=cur.parentNode||this){if(cur.nodeType===1&&!(event.type==="click"&&cur.disabled===true)){matchedHandlers=[];matchedSelectors={};for(i=0;i<delegateCount;i++){handleObj=handlers[i];sel=handleObj.selector+" ";if(matchedSelectors[sel]===undefined){matchedSelectors[sel]=handleObj.needsContext?jQuery(sel,this).index(cur)>-1:jQuery.find(sel,this,null,[cur]).length}if(matchedSelectors[sel]){matchedHandlers.push(handleObj)}}if(matchedHandlers.length){handlerQueue.push({elem:cur,handlers:matchedHandlers})}}}}cur=this;if(delegateCount<handlers.length){handlerQueue.push({elem:cur,handlers:handlers.slice(delegateCount)})}return handlerQueue},addProp:function(name,hook){Object.defineProperty(jQuery.Event.prototype,name,{enumerable:true,configurable:true,get:isFunction(hook)?function(){if(this.originalEvent){return hook(this.originalEvent)}}:function(){if(this.originalEvent){return this.originalEvent[name]}},set:function(value){Object.defineProperty(this,name,{enumerable:true,configurable:true,writable:true,value:value})}})},fix:function(originalEvent){return originalEvent[jQuery.expando]?originalEvent:new jQuery.Event(originalEvent)},special:{load:{noBubble:true},click:{setup:function(data){var el=this||data;if(rcheckableType.test(el.type)&&el.click&&nodeName(el,"input")){leverageNative(el,"click",true)}return false},trigger:function(data){var el=this||data;if(rcheckableType.test(el.type)&&el.click&&nodeName(el,"input")){leverageNative(el,"click")}return true},_default:function(event){var target=event.target;return rcheckableType.test(target.type)&&target.click&&nodeName(target,"input")&&dataPriv.get(target,"click")||nodeName(target,"a")}},beforeunload:{postDispatch:function(event){if(event.result!==undefined&&event.originalEvent){event.originalEvent.returnValue=event.result}}}}};function leverageNative(el,type,isSetup){if(!isSetup){if(dataPriv.get(el,type)===undefined){jQuery.event.add(el,type,returnTrue)}return}dataPriv.set(el,type,false);jQuery.event.add(el,type,{namespace:false,handler:function(event){var result,saved=dataPriv.get(this,type);if(event.isTrigger&1&&this[type]){if(!saved){saved=slice.call(arguments);dataPriv.set(this,type,saved);this[type]();result=dataPriv.get(this,type);dataPriv.set(this,type,false);if(saved!==result){event.stopImmediatePropagation();event.preventDefault();return result}}else if((jQuery.event.special[type]||{}).delegateType){event.stopPropagation()}}else if(saved){dataPriv.set(this,type,jQuery.event.trigger(saved[0],saved.slice(1),this));event.stopPropagation();event.isImmediatePropagationStopped=returnTrue}}})}jQuery.removeEvent=function(elem,type,handle){if(elem.removeEventListener){elem.removeEventListener(type,handle)}};jQuery.Event=function(src,props){if(!(this instanceof jQuery.Event)){return new jQuery.Event(src,props)}if(src&&src.type){this.originalEvent=src;this.type=src.type;this.isDefaultPrevented=src.defaultPrevented||src.defaultPrevented===undefined&&src.returnValue===false?returnTrue:returnFalse;this.target=src.target&&src.target.nodeType===3?src.target.parentNode:src.target;this.currentTarget=src.currentTarget;this.relatedTarget=src.relatedTarget}else{this.type=src}if(props){jQuery.extend(this,props)}this.timeStamp=src&&src.timeStamp||Date.now();this[jQuery.expando]=true};jQuery.Event.prototype={constructor:jQuery.Event,isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse,isSimulated:false,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=returnTrue;if(e&&!this.isSimulated){e.preventDefault()}},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=returnTrue;if(e&&!this.isSimulated){e.stopPropagation()}},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=returnTrue;if(e&&!this.isSimulated){e.stopImmediatePropagation()}this.stopPropagation()}};jQuery.each({altKey:true,bubbles:true,cancelable:true,changedTouches:true,ctrlKey:true,detail:true,eventPhase:true,metaKey:true,pageX:true,pageY:true,shiftKey:true,view:true,char:true,code:true,charCode:true,key:true,keyCode:true,button:true,buttons:true,clientX:true,clientY:true,offsetX:true,offsetY:true,pointerId:true,pointerType:true,screenX:true,screenY:true,targetTouches:true,toElement:true,touches:true,which:true},jQuery.event.addProp);jQuery.each({focus:"focusin",blur:"focusout"},(function(type,delegateType){function focusMappedHandler(nativeEvent){if(document.documentMode){var handle=dataPriv.get(this,"handle"),event=jQuery.event.fix(nativeEvent);event.type=nativeEvent.type==="focusin"?"focus":"blur";event.isSimulated=true;handle(nativeEvent);if(event.target===event.currentTarget){handle(event)}}else{jQuery.event.simulate(delegateType,nativeEvent.target,jQuery.event.fix(nativeEvent))}}jQuery.event.special[type]={setup:function(){var attaches;leverageNative(this,type,true);if(document.documentMode){attaches=dataPriv.get(this,delegateType);if(!attaches){this.addEventListener(delegateType,focusMappedHandler)}dataPriv.set(this,delegateType,(attaches||0)+1)}else{return false}},trigger:function(){leverageNative(this,type);return true},teardown:function(){var attaches;if(document.documentMode){attaches=dataPriv.get(this,delegateType)-1;if(!attaches){this.removeEventListener(delegateType,focusMappedHandler);dataPriv.remove(this,delegateType)}else{dataPriv.set(this,delegateType,attaches)}}else{return false}},_default:function(event){return dataPriv.get(event.target,type)},delegateType:delegateType};jQuery.event.special[delegateType]={setup:function(){var doc=this.ownerDocument||this.document||this,dataHolder=document.documentMode?this:doc,attaches=dataPriv.get(dataHolder,delegateType);if(!attaches){if(document.documentMode){this.addEventListener(delegateType,focusMappedHandler)}else{doc.addEventListener(type,focusMappedHandler,true)}}dataPriv.set(dataHolder,delegateType,(attaches||0)+1)},teardown:function(){var doc=this.ownerDocument||this.document||this,dataHolder=document.documentMode?this:doc,attaches=dataPriv.get(dataHolder,delegateType)-1;if(!attaches){if(document.documentMode){this.removeEventListener(delegateType,focusMappedHandler)}else{doc.removeEventListener(type,focusMappedHandler,true)}dataPriv.remove(dataHolder,delegateType)}else{dataPriv.set(dataHolder,delegateType,attaches)}}}}));jQuery.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},(function(orig,fix){jQuery.event.special[orig]={delegateType:fix,bindType:fix,handle:function(event){var ret,target=this,related=event.relatedTarget,handleObj=event.handleObj;if(!related||related!==target&&!jQuery.contains(target,related)){event.type=handleObj.origType;ret=handleObj.handler.apply(this,arguments);event.type=fix}return ret}}}));jQuery.fn.extend({on:function(types,selector,data,fn){return on(this,types,selector,data,fn)},one:function(types,selector,data,fn){return on(this,types,selector,data,fn,1)},off:function(types,selector,fn){var handleObj,type;if(types&&types.preventDefault&&types.handleObj){handleObj=types.handleObj;jQuery(types.delegateTarget).off(handleObj.namespace?handleObj.origType+"."+handleObj.namespace:handleObj.origType,handleObj.selector,handleObj.handler);return this}if(typeof types==="object"){for(type in types){this.off(type,selector,types[type])}return this}if(selector===false||typeof selector==="function"){fn=selector;selector=undefined}if(fn===false){fn=returnFalse}return this.each((function(){jQuery.event.remove(this,types,fn,selector)}))}});var rnoInnerhtml=/<script|<style|<link/i,rchecked=/checked\s*(?:[^=]|=\s*.checked.)/i,rcleanScript=/^\s*<!\[CDATA\[|\]\]>\s*$/g;function manipulationTarget(elem,content){if(nodeName(elem,"table")&&nodeName(content.nodeType!==11?content:content.firstChild,"tr")){return jQuery(elem).children("tbody")[0]||elem}return elem}function disableScript(elem){elem.type=(elem.getAttribute("type")!==null)+"/"+elem.type;return elem}function restoreScript(elem){if((elem.type||"").slice(0,5)==="true/"){elem.type=elem.type.slice(5)}else{elem.removeAttribute("type")}return elem}function cloneCopyEvent(src,dest){var i,l,type,pdataOld,udataOld,udataCur,events;if(dest.nodeType!==1){return}if(dataPriv.hasData(src)){pdataOld=dataPriv.get(src);events=pdataOld.events;if(events){dataPriv.remove(dest,"handle events");for(type in events){for(i=0,l=events[type].length;i<l;i++){jQuery.event.add(dest,type,events[type][i])}}}}if(dataUser.hasData(src)){udataOld=dataUser.access(src);udataCur=jQuery.extend({},udataOld);dataUser.set(dest,udataCur)}}function fixInput(src,dest){var nodeName=dest.nodeName.toLowerCase();if(nodeName==="input"&&rcheckableType.test(src.type)){dest.checked=src.checked}else if(nodeName==="input"||nodeName==="textarea"){dest.defaultValue=src.defaultValue}}function domManip(collection,args,callback,ignored){args=flat(args);var fragment,first,scripts,hasScripts,node,doc,i=0,l=collection.length,iNoClone=l-1,value=args[0],valueIsFunction=isFunction(value);if(valueIsFunction||l>1&&typeof value==="string"&&!support.checkClone&&rchecked.test(value)){return collection.each((function(index){var self=collection.eq(index);if(valueIsFunction){args[0]=value.call(this,index,self.html())}domManip(self,args,callback,ignored)}))}if(l){fragment=buildFragment(args,collection[0].ownerDocument,false,collection,ignored);first=fragment.firstChild;if(fragment.childNodes.length===1){fragment=first}if(first||ignored){scripts=jQuery.map(getAll(fragment,"script"),disableScript);hasScripts=scripts.length;for(;i<l;i++){node=fragment;if(i!==iNoClone){node=jQuery.clone(node,true,true);if(hasScripts){jQuery.merge(scripts,getAll(node,"script"))}}callback.call(collection[i],node,i)}if(hasScripts){doc=scripts[scripts.length-1].ownerDocument;jQuery.map(scripts,restoreScript);for(i=0;i<hasScripts;i++){node=scripts[i];if(rscriptType.test(node.type||"")&&!dataPriv.access(node,"globalEval")&&jQuery.contains(doc,node)){if(node.src&&(node.type||"").toLowerCase()!=="module"){if(jQuery._evalUrl&&!node.noModule){jQuery._evalUrl(node.src,{nonce:node.nonce||node.getAttribute("nonce")},doc)}}else{DOMEval(node.textContent.replace(rcleanScript,""),node,doc)}}}}}}return collection}function remove(elem,selector,keepData){var node,nodes=selector?jQuery.filter(selector,elem):elem,i=0;for(;(node=nodes[i])!=null;i++){if(!keepData&&node.nodeType===1){jQuery.cleanData(getAll(node))}if(node.parentNode){if(keepData&&isAttached(node)){setGlobalEval(getAll(node,"script"))}node.parentNode.removeChild(node)}}return elem}jQuery.extend({htmlPrefilter:function(html){return html},clone:function(elem,dataAndEvents,deepDataAndEvents){var i,l,srcElements,destElements,clone=elem.cloneNode(true),inPage=isAttached(elem);if(!support.noCloneChecked&&(elem.nodeType===1||elem.nodeType===11)&&!jQuery.isXMLDoc(elem)){destElements=getAll(clone);srcElements=getAll(elem);for(i=0,l=srcElements.length;i<l;i++){fixInput(srcElements[i],destElements[i])}}if(dataAndEvents){if(deepDataAndEvents){srcElements=srcElements||getAll(elem);destElements=destElements||getAll(clone);for(i=0,l=srcElements.length;i<l;i++){cloneCopyEvent(srcElements[i],destElements[i])}}else{cloneCopyEvent(elem,clone)}}destElements=getAll(clone,"script");if(destElements.length>0){setGlobalEval(destElements,!inPage&&getAll(elem,"script"))}return clone},cleanData:function(elems){var data,elem,type,special=jQuery.event.special,i=0;for(;(elem=elems[i])!==undefined;i++){if(acceptData(elem)){if(data=elem[dataPriv.expando]){if(data.events){for(type in data.events){if(special[type]){jQuery.event.remove(elem,type)}else{jQuery.removeEvent(elem,type,data.handle)}}}elem[dataPriv.expando]=undefined}if(elem[dataUser.expando]){elem[dataUser.expando]=undefined}}}}});jQuery.fn.extend({detach:function(selector){return remove(this,selector,true)},remove:function(selector){return remove(this,selector)},text:function(value){return access(this,(function(value){return value===undefined?jQuery.text(this):this.empty().each((function(){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){this.textContent=value}}))}),null,value,arguments.length)},append:function(){return domManip(this,arguments,(function(elem){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var target=manipulationTarget(this,elem);target.appendChild(elem)}}))},prepend:function(){return domManip(this,arguments,(function(elem){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var target=manipulationTarget(this,elem);target.insertBefore(elem,target.firstChild)}}))},before:function(){return domManip(this,arguments,(function(elem){if(this.parentNode){this.parentNode.insertBefore(elem,this)}}))},after:function(){return domManip(this,arguments,(function(elem){if(this.parentNode){this.parentNode.insertBefore(elem,this.nextSibling)}}))},empty:function(){var elem,i=0;for(;(elem=this[i])!=null;i++){if(elem.nodeType===1){jQuery.cleanData(getAll(elem,false));elem.textContent=""}}return this},clone:function(dataAndEvents,deepDataAndEvents){dataAndEvents=dataAndEvents==null?false:dataAndEvents;deepDataAndEvents=deepDataAndEvents==null?dataAndEvents:deepDataAndEvents;return this.map((function(){return jQuery.clone(this,dataAndEvents,deepDataAndEvents)}))},html:function(value){return access(this,(function(value){var elem=this[0]||{},i=0,l=this.length;if(value===undefined&&elem.nodeType===1){return elem.innerHTML}if(typeof value==="string"&&!rnoInnerhtml.test(value)&&!wrapMap[(rtagName.exec(value)||["",""])[1].toLowerCase()]){value=jQuery.htmlPrefilter(value);try{for(;i<l;i++){elem=this[i]||{};if(elem.nodeType===1){jQuery.cleanData(getAll(elem,false));elem.innerHTML=value}}elem=0}catch(e){}}if(elem){this.empty().append(value)}}),null,value,arguments.length)},replaceWith:function(){var ignored=[];return domManip(this,arguments,(function(elem){var parent=this.parentNode;if(jQuery.inArray(this,ignored)<0){jQuery.cleanData(getAll(this));if(parent){parent.replaceChild(elem,this)}}}),ignored)}});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},(function(name,original){jQuery.fn[name]=function(selector){var elems,ret=[],insert=jQuery(selector),last=insert.length-1,i=0;for(;i<=last;i++){elems=i===last?this:this.clone(true);jQuery(insert[i])[original](elems);push.apply(ret,elems.get())}return this.pushStack(ret)}}));var rnumnonpx=new RegExp("^("+pnum+")(?!px)[a-z%]+$","i");var rcustomProp=/^--/;var getStyles=function(elem){var view=elem.ownerDocument.defaultView;if(!view||!view.opener){view=window}return view.getComputedStyle(elem)};var swap=function(elem,options,callback){var ret,name,old={};for(name in options){old[name]=elem.style[name];elem.style[name]=options[name]}ret=callback.call(elem);for(name in options){elem.style[name]=old[name]}return ret};var rboxStyle=new RegExp(cssExpand.join("|"),"i");(function(){function computeStyleTests(){if(!div){return}container.style.cssText="position:absolute;left:-11111px;width:60px;"+"margin-top:1px;padding:0;border:0";div.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;"+"margin:auto;border:1px;padding:1px;"+"width:60%;top:1%";documentElement.appendChild(container).appendChild(div);var divStyle=window.getComputedStyle(div);pixelPositionVal=divStyle.top!=="1%";reliableMarginLeftVal=roundPixelMeasures(divStyle.marginLeft)===12;div.style.right="60%";pixelBoxStylesVal=roundPixelMeasures(divStyle.right)===36;boxSizingReliableVal=roundPixelMeasures(divStyle.width)===36;div.style.position="absolute";scrollboxSizeVal=roundPixelMeasures(div.offsetWidth/3)===12;documentElement.removeChild(container);div=null}function roundPixelMeasures(measure){return Math.round(parseFloat(measure))}var pixelPositionVal,boxSizingReliableVal,scrollboxSizeVal,pixelBoxStylesVal,reliableTrDimensionsVal,reliableMarginLeftVal,container=document.createElement("div"),div=document.createElement("div");if(!div.style){return}div.style.backgroundClip="content-box";div.cloneNode(true).style.backgroundClip="";support.clearCloneStyle=div.style.backgroundClip==="content-box";jQuery.extend(support,{boxSizingReliable:function(){computeStyleTests();return boxSizingReliableVal},pixelBoxStyles:function(){computeStyleTests();return pixelBoxStylesVal},pixelPosition:function(){computeStyleTests();return pixelPositionVal},reliableMarginLeft:function(){computeStyleTests();return reliableMarginLeftVal},scrollboxSize:function(){computeStyleTests();return scrollboxSizeVal},reliableTrDimensions:function(){var table,tr,trChild,trStyle;if(reliableTrDimensionsVal==null){table=document.createElement("table");tr=document.createElement("tr");trChild=document.createElement("div");table.style.cssText="position:absolute;left:-11111px;border-collapse:separate";tr.style.cssText="box-sizing:content-box;border:1px solid";tr.style.height="1px";trChild.style.height="9px";trChild.style.display="block";documentElement.appendChild(table).appendChild(tr).appendChild(trChild);trStyle=window.getComputedStyle(tr);reliableTrDimensionsVal=parseInt(trStyle.height,10)+parseInt(trStyle.borderTopWidth,10)+parseInt(trStyle.borderBottomWidth,10)===tr.offsetHeight;documentElement.removeChild(table)}return reliableTrDimensionsVal}})})();function curCSS(elem,name,computed){var width,minWidth,maxWidth,ret,isCustomProp=rcustomProp.test(name),style=elem.style;computed=computed||getStyles(elem);if(computed){ret=computed.getPropertyValue(name)||computed[name];if(isCustomProp&&ret){ret=ret.replace(rtrimCSS,"$1")||undefined}if(ret===""&&!isAttached(elem)){ret=jQuery.style(elem,name)}if(!support.pixelBoxStyles()&&rnumnonpx.test(ret)&&rboxStyle.test(name)){width=style.width;minWidth=style.minWidth;maxWidth=style.maxWidth;style.minWidth=style.maxWidth=style.width=ret;ret=computed.width;style.width=width;style.minWidth=minWidth;style.maxWidth=maxWidth}}return ret!==undefined?ret+"":ret}function addGetHookIf(conditionFn,hookFn){return{get:function(){if(conditionFn()){delete this.get;return}return(this.get=hookFn).apply(this,arguments)}}}var cssPrefixes=["Webkit","Moz","ms"],emptyStyle=document.createElement("div").style,vendorProps={};function vendorPropName(name){var capName=name[0].toUpperCase()+name.slice(1),i=cssPrefixes.length;while(i--){name=cssPrefixes[i]+capName;if(name in emptyStyle){return name}}}function finalPropName(name){var final=jQuery.cssProps[name]||vendorProps[name];if(final){return final}if(name in emptyStyle){return name}return vendorProps[name]=vendorPropName(name)||name}var rdisplayswap=/^(none|table(?!-c[ea]).+)/,cssShow={position:"absolute",visibility:"hidden",display:"block"},cssNormalTransform={letterSpacing:"0",fontWeight:"400"};function setPositiveNumber(_elem,value,subtract){var matches=rcssNum.exec(value);return matches?Math.max(0,matches[2]-(subtract||0))+(matches[3]||"px"):value}function boxModelAdjustment(elem,dimension,box,isBorderBox,styles,computedVal){var i=dimension==="width"?1:0,extra=0,delta=0,marginDelta=0;if(box===(isBorderBox?"border":"content")){return 0}for(;i<4;i+=2){if(box==="margin"){marginDelta+=jQuery.css(elem,box+cssExpand[i],true,styles)}if(!isBorderBox){delta+=jQuery.css(elem,"padding"+cssExpand[i],true,styles);if(box!=="padding"){delta+=jQuery.css(elem,"border"+cssExpand[i]+"Width",true,styles)}else{extra+=jQuery.css(elem,"border"+cssExpand[i]+"Width",true,styles)}}else{if(box==="content"){delta-=jQuery.css(elem,"padding"+cssExpand[i],true,styles)}if(box!=="margin"){delta-=jQuery.css(elem,"border"+cssExpand[i]+"Width",true,styles)}}}if(!isBorderBox&&computedVal>=0){delta+=Math.max(0,Math.ceil(elem["offset"+dimension[0].toUpperCase()+dimension.slice(1)]-computedVal-delta-extra-.5))||0}return delta+marginDelta}function getWidthOrHeight(elem,dimension,extra){var styles=getStyles(elem),boxSizingNeeded=!support.boxSizingReliable()||extra,isBorderBox=boxSizingNeeded&&jQuery.css(elem,"boxSizing",false,styles)==="border-box",valueIsBorderBox=isBorderBox,val=curCSS(elem,dimension,styles),offsetProp="offset"+dimension[0].toUpperCase()+dimension.slice(1);if(rnumnonpx.test(val)){if(!extra){return val}val="auto"}if((!support.boxSizingReliable()&&isBorderBox||!support.reliableTrDimensions()&&nodeName(elem,"tr")||val==="auto"||!parseFloat(val)&&jQuery.css(elem,"display",false,styles)==="inline")&&elem.getClientRects().length){isBorderBox=jQuery.css(elem,"boxSizing",false,styles)==="border-box";valueIsBorderBox=offsetProp in elem;if(valueIsBorderBox){val=elem[offsetProp]}}val=parseFloat(val)||0;return val+boxModelAdjustment(elem,dimension,extra||(isBorderBox?"border":"content"),valueIsBorderBox,styles,val)+"px"}jQuery.extend({cssHooks:{opacity:{get:function(elem,computed){if(computed){var ret=curCSS(elem,"opacity");return ret===""?"1":ret}}}},cssNumber:{animationIterationCount:true,aspectRatio:true,borderImageSlice:true,columnCount:true,flexGrow:true,flexShrink:true,fontWeight:true,gridArea:true,gridColumn:true,gridColumnEnd:true,gridColumnStart:true,gridRow:true,gridRowEnd:true,gridRowStart:true,lineHeight:true,opacity:true,order:true,orphans:true,scale:true,widows:true,zIndex:true,zoom:true,fillOpacity:true,floodOpacity:true,stopOpacity:true,strokeMiterlimit:true,strokeOpacity:true},cssProps:{},style:function(elem,name,value,extra){if(!elem||elem.nodeType===3||elem.nodeType===8||!elem.style){return}var ret,type,hooks,origName=camelCase(name),isCustomProp=rcustomProp.test(name),style=elem.style;if(!isCustomProp){name=finalPropName(origName)}hooks=jQuery.cssHooks[name]||jQuery.cssHooks[origName];if(value!==undefined){type=typeof value;if(type==="string"&&(ret=rcssNum.exec(value))&&ret[1]){value=adjustCSS(elem,name,ret);type="number"}if(value==null||value!==value){return}if(type==="number"&&!isCustomProp){value+=ret&&ret[3]||(jQuery.cssNumber[origName]?"":"px")}if(!support.clearCloneStyle&&value===""&&name.indexOf("background")===0){style[name]="inherit"}if(!hooks||!("set"in hooks)||(value=hooks.set(elem,value,extra))!==undefined){if(isCustomProp){style.setProperty(name,value)}else{style[name]=value}}}else{if(hooks&&"get"in hooks&&(ret=hooks.get(elem,false,extra))!==undefined){return ret}return style[name]}},css:function(elem,name,extra,styles){var val,num,hooks,origName=camelCase(name),isCustomProp=rcustomProp.test(name);if(!isCustomProp){name=finalPropName(origName)}hooks=jQuery.cssHooks[name]||jQuery.cssHooks[origName];if(hooks&&"get"in hooks){val=hooks.get(elem,true,extra)}if(val===undefined){val=curCSS(elem,name,styles)}if(val==="normal"&&name in cssNormalTransform){val=cssNormalTransform[name]}if(extra===""||extra){num=parseFloat(val);return extra===true||isFinite(num)?num||0:val}return val}});jQuery.each(["height","width"],(function(_i,dimension){jQuery.cssHooks[dimension]={get:function(elem,computed,extra){if(computed){return rdisplayswap.test(jQuery.css(elem,"display"))&&(!elem.getClientRects().length||!elem.getBoundingClientRect().width)?swap(elem,cssShow,(function(){return getWidthOrHeight(elem,dimension,extra)})):getWidthOrHeight(elem,dimension,extra)}},set:function(elem,value,extra){var matches,styles=getStyles(elem),scrollboxSizeBuggy=!support.scrollboxSize()&&styles.position==="absolute",boxSizingNeeded=scrollboxSizeBuggy||extra,isBorderBox=boxSizingNeeded&&jQuery.css(elem,"boxSizing",false,styles)==="border-box",subtract=extra?boxModelAdjustment(elem,dimension,extra,isBorderBox,styles):0;if(isBorderBox&&scrollboxSizeBuggy){subtract-=Math.ceil(elem["offset"+dimension[0].toUpperCase()+dimension.slice(1)]-parseFloat(styles[dimension])-boxModelAdjustment(elem,dimension,"border",false,styles)-.5)}if(subtract&&(matches=rcssNum.exec(value))&&(matches[3]||"px")!=="px"){elem.style[dimension]=value;value=jQuery.css(elem,dimension)}return setPositiveNumber(elem,value,subtract)}}}));jQuery.cssHooks.marginLeft=addGetHookIf(support.reliableMarginLeft,(function(elem,computed){if(computed){return(parseFloat(curCSS(elem,"marginLeft"))||elem.getBoundingClientRect().left-swap(elem,{marginLeft:0},(function(){return elem.getBoundingClientRect().left})))+"px"}}));jQuery.each({margin:"",padding:"",border:"Width"},(function(prefix,suffix){jQuery.cssHooks[prefix+suffix]={expand:function(value){var i=0,expanded={},parts=typeof value==="string"?value.split(" "):[value];for(;i<4;i++){expanded[prefix+cssExpand[i]+suffix]=parts[i]||parts[i-2]||parts[0]}return expanded}};if(prefix!=="margin"){jQuery.cssHooks[prefix+suffix].set=setPositiveNumber}}));jQuery.fn.extend({css:function(name,value){return access(this,(function(elem,name,value){var styles,len,map={},i=0;if(Array.isArray(name)){styles=getStyles(elem);len=name.length;for(;i<len;i++){map[name[i]]=jQuery.css(elem,name[i],false,styles)}return map}return value!==undefined?jQuery.style(elem,name,value):jQuery.css(elem,name)}),name,value,arguments.length>1)}});function Tween(elem,options,prop,end,easing){return new Tween.prototype.init(elem,options,prop,end,easing)}jQuery.Tween=Tween;Tween.prototype={constructor:Tween,init:function(elem,options,prop,end,easing,unit){this.elem=elem;this.prop=prop;this.easing=easing||jQuery.easing._default;this.options=options;this.start=this.now=this.cur();this.end=end;this.unit=unit||(jQuery.cssNumber[prop]?"":"px")},cur:function(){var hooks=Tween.propHooks[this.prop];return hooks&&hooks.get?hooks.get(this):Tween.propHooks._default.get(this)},run:function(percent){var eased,hooks=Tween.propHooks[this.prop];if(this.options.duration){this.pos=eased=jQuery.easing[this.easing](percent,this.options.duration*percent,0,1,this.options.duration)}else{this.pos=eased=percent}this.now=(this.end-this.start)*eased+this.start;if(this.options.step){this.options.step.call(this.elem,this.now,this)}if(hooks&&hooks.set){hooks.set(this)}else{Tween.propHooks._default.set(this)}return this}};Tween.prototype.init.prototype=Tween.prototype;Tween.propHooks={_default:{get:function(tween){var result;if(tween.elem.nodeType!==1||tween.elem[tween.prop]!=null&&tween.elem.style[tween.prop]==null){return tween.elem[tween.prop]}result=jQuery.css(tween.elem,tween.prop,"");return!result||result==="auto"?0:result},set:function(tween){if(jQuery.fx.step[tween.prop]){jQuery.fx.step[tween.prop](tween)}else if(tween.elem.nodeType===1&&(jQuery.cssHooks[tween.prop]||tween.elem.style[finalPropName(tween.prop)]!=null)){jQuery.style(tween.elem,tween.prop,tween.now+tween.unit)}else{tween.elem[tween.prop]=tween.now}}}};Tween.propHooks.scrollTop=Tween.propHooks.scrollLeft={set:function(tween){if(tween.elem.nodeType&&tween.elem.parentNode){tween.elem[tween.prop]=tween.now}}};jQuery.easing={linear:function(p){return p},swing:function(p){return.5-Math.cos(p*Math.PI)/2},_default:"swing"};jQuery.fx=Tween.prototype.init;jQuery.fx.step={};var fxNow,inProgress,rfxtypes=/^(?:toggle|show|hide)$/,rrun=/queueHooks$/;function schedule(){if(inProgress){if(document.hidden===false&&window.requestAnimationFrame){window.requestAnimationFrame(schedule)}else{window.setTimeout(schedule,jQuery.fx.interval)}jQuery.fx.tick()}}function createFxNow(){window.setTimeout((function(){fxNow=undefined}));return fxNow=Date.now()}function genFx(type,includeWidth){var which,i=0,attrs={height:type};includeWidth=includeWidth?1:0;for(;i<4;i+=2-includeWidth){which=cssExpand[i];attrs["margin"+which]=attrs["padding"+which]=type}if(includeWidth){attrs.opacity=attrs.width=type}return attrs}function createTween(value,prop,animation){var tween,collection=(Animation.tweeners[prop]||[]).concat(Animation.tweeners["*"]),index=0,length=collection.length;for(;index<length;index++){if(tween=collection[index].call(animation,prop,value)){return tween}}}function defaultPrefilter(elem,props,opts){var prop,value,toggle,hooks,oldfire,propTween,restoreDisplay,display,isBox="width"in props||"height"in props,anim=this,orig={},style=elem.style,hidden=elem.nodeType&&isHiddenWithinTree(elem),dataShow=dataPriv.get(elem,"fxshow");if(!opts.queue){hooks=jQuery._queueHooks(elem,"fx");if(hooks.unqueued==null){hooks.unqueued=0;oldfire=hooks.empty.fire;hooks.empty.fire=function(){if(!hooks.unqueued){oldfire()}}}hooks.unqueued++;anim.always((function(){anim.always((function(){hooks.unqueued--;if(!jQuery.queue(elem,"fx").length){hooks.empty.fire()}}))}))}for(prop in props){value=props[prop];if(rfxtypes.test(value)){delete props[prop];toggle=toggle||value==="toggle";if(value===(hidden?"hide":"show")){if(value==="show"&&dataShow&&dataShow[prop]!==undefined){hidden=true}else{continue}}orig[prop]=dataShow&&dataShow[prop]||jQuery.style(elem,prop)}}propTween=!jQuery.isEmptyObject(props);if(!propTween&&jQuery.isEmptyObject(orig)){return}if(isBox&&elem.nodeType===1){opts.overflow=[style.overflow,style.overflowX,style.overflowY];restoreDisplay=dataShow&&dataShow.display;if(restoreDisplay==null){restoreDisplay=dataPriv.get(elem,"display")}display=jQuery.css(elem,"display");if(display==="none"){if(restoreDisplay){display=restoreDisplay}else{showHide([elem],true);restoreDisplay=elem.style.display||restoreDisplay;display=jQuery.css(elem,"display");showHide([elem])}}if(display==="inline"||display==="inline-block"&&restoreDisplay!=null){if(jQuery.css(elem,"float")==="none"){if(!propTween){anim.done((function(){style.display=restoreDisplay}));if(restoreDisplay==null){display=style.display;restoreDisplay=display==="none"?"":display}}style.display="inline-block"}}}if(opts.overflow){style.overflow="hidden";anim.always((function(){style.overflow=opts.overflow[0];style.overflowX=opts.overflow[1];style.overflowY=opts.overflow[2]}))}propTween=false;for(prop in orig){if(!propTween){if(dataShow){if("hidden"in dataShow){hidden=dataShow.hidden}}else{dataShow=dataPriv.access(elem,"fxshow",{display:restoreDisplay})}if(toggle){dataShow.hidden=!hidden}if(hidden){showHide([elem],true)}anim.done((function(){if(!hidden){showHide([elem])}dataPriv.remove(elem,"fxshow");for(prop in orig){jQuery.style(elem,prop,orig[prop])}}))}propTween=createTween(hidden?dataShow[prop]:0,prop,anim);if(!(prop in dataShow)){dataShow[prop]=propTween.start;if(hidden){propTween.end=propTween.start;propTween.start=0}}}}function propFilter(props,specialEasing){var index,name,easing,value,hooks;for(index in props){name=camelCase(index);easing=specialEasing[name];value=props[index];if(Array.isArray(value)){easing=value[1];value=props[index]=value[0]}if(index!==name){props[name]=value;delete props[index]}hooks=jQuery.cssHooks[name];if(hooks&&"expand"in hooks){value=hooks.expand(value);delete props[name];for(index in value){if(!(index in props)){props[index]=value[index];specialEasing[index]=easing}}}else{specialEasing[name]=easing}}}function Animation(elem,properties,options){var result,stopped,index=0,length=Animation.prefilters.length,deferred=jQuery.Deferred().always((function(){delete tick.elem})),tick=function(){if(stopped){return false}var currentTime=fxNow||createFxNow(),remaining=Math.max(0,animation.startTime+animation.duration-currentTime),temp=remaining/animation.duration||0,percent=1-temp,index=0,length=animation.tweens.length;for(;index<length;index++){animation.tweens[index].run(percent)}deferred.notifyWith(elem,[animation,percent,remaining]);if(percent<1&&length){return remaining}if(!length){deferred.notifyWith(elem,[animation,1,0])}deferred.resolveWith(elem,[animation]);return false},animation=deferred.promise({elem:elem,props:jQuery.extend({},properties),opts:jQuery.extend(true,{specialEasing:{},easing:jQuery.easing._default},options),originalProperties:properties,originalOptions:options,startTime:fxNow||createFxNow(),duration:options.duration,tweens:[],createTween:function(prop,end){var tween=jQuery.Tween(elem,animation.opts,prop,end,animation.opts.specialEasing[prop]||animation.opts.easing);animation.tweens.push(tween);return tween},stop:function(gotoEnd){var index=0,length=gotoEnd?animation.tweens.length:0;if(stopped){return this}stopped=true;for(;index<length;index++){animation.tweens[index].run(1)}if(gotoEnd){deferred.notifyWith(elem,[animation,1,0]);deferred.resolveWith(elem,[animation,gotoEnd])}else{deferred.rejectWith(elem,[animation,gotoEnd])}return this}}),props=animation.props;propFilter(props,animation.opts.specialEasing);for(;index<length;index++){result=Animation.prefilters[index].call(animation,elem,props,animation.opts);if(result){if(isFunction(result.stop)){jQuery._queueHooks(animation.elem,animation.opts.queue).stop=result.stop.bind(result)}return result}}jQuery.map(props,createTween,animation);if(isFunction(animation.opts.start)){animation.opts.start.call(elem,animation)}animation.progress(animation.opts.progress).done(animation.opts.done,animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always);jQuery.fx.timer(jQuery.extend(tick,{elem:elem,anim:animation,queue:animation.opts.queue}));return animation}jQuery.Animation=jQuery.extend(Animation,{tweeners:{"*":[function(prop,value){var tween=this.createTween(prop,value);adjustCSS(tween.elem,prop,rcssNum.exec(value),tween);return tween}]},tweener:function(props,callback){if(isFunction(props)){callback=props;props=["*"]}else{props=props.match(rnothtmlwhite)}var prop,index=0,length=props.length;for(;index<length;index++){prop=props[index];Animation.tweeners[prop]=Animation.tweeners[prop]||[];Animation.tweeners[prop].unshift(callback)}},prefilters:[defaultPrefilter],prefilter:function(callback,prepend){if(prepend){Animation.prefilters.unshift(callback)}else{Animation.prefilters.push(callback)}}});jQuery.speed=function(speed,easing,fn){var opt=speed&&typeof speed==="object"?jQuery.extend({},speed):{complete:fn||!fn&&easing||isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&!isFunction(easing)&&easing};if(jQuery.fx.off){opt.duration=0}else{if(typeof opt.duration!=="number"){if(opt.duration in jQuery.fx.speeds){opt.duration=jQuery.fx.speeds[opt.duration]}else{opt.duration=jQuery.fx.speeds._default}}}if(opt.queue==null||opt.queue===true){opt.queue="fx"}opt.old=opt.complete;opt.complete=function(){if(isFunction(opt.old)){opt.old.call(this)}if(opt.queue){jQuery.dequeue(this,opt.queue)}};return opt};jQuery.fn.extend({fadeTo:function(speed,to,easing,callback){return this.filter(isHiddenWithinTree).css("opacity",0).show().end().animate({opacity:to},speed,easing,callback)},animate:function(prop,speed,easing,callback){var empty=jQuery.isEmptyObject(prop),optall=jQuery.speed(speed,easing,callback),doAnimation=function(){var anim=Animation(this,jQuery.extend({},prop),optall);if(empty||dataPriv.get(this,"finish")){anim.stop(true)}};doAnimation.finish=doAnimation;return empty||optall.queue===false?this.each(doAnimation):this.queue(optall.queue,doAnimation)},stop:function(type,clearQueue,gotoEnd){var stopQueue=function(hooks){var stop=hooks.stop;delete hooks.stop;stop(gotoEnd)};if(typeof type!=="string"){gotoEnd=clearQueue;clearQueue=type;type=undefined}if(clearQueue){this.queue(type||"fx",[])}return this.each((function(){var dequeue=true,index=type!=null&&type+"queueHooks",timers=jQuery.timers,data=dataPriv.get(this);if(index){if(data[index]&&data[index].stop){stopQueue(data[index])}}else{for(index in data){if(data[index]&&data[index].stop&&rrun.test(index)){stopQueue(data[index])}}}for(index=timers.length;index--;){if(timers[index].elem===this&&(type==null||timers[index].queue===type)){timers[index].anim.stop(gotoEnd);dequeue=false;timers.splice(index,1)}}if(dequeue||!gotoEnd){jQuery.dequeue(this,type)}}))},finish:function(type){if(type!==false){type=type||"fx"}return this.each((function(){var index,data=dataPriv.get(this),queue=data[type+"queue"],hooks=data[type+"queueHooks"],timers=jQuery.timers,length=queue?queue.length:0;data.finish=true;jQuery.queue(this,type,[]);if(hooks&&hooks.stop){hooks.stop.call(this,true)}for(index=timers.length;index--;){if(timers[index].elem===this&&timers[index].queue===type){timers[index].anim.stop(true);timers.splice(index,1)}}for(index=0;index<length;index++){if(queue[index]&&queue[index].finish){queue[index].finish.call(this)}}delete data.finish}))}});jQuery.each(["toggle","show","hide"],(function(_i,name){var cssFn=jQuery.fn[name];jQuery.fn[name]=function(speed,easing,callback){return speed==null||typeof speed==="boolean"?cssFn.apply(this,arguments):this.animate(genFx(name,true),speed,easing,callback)}}));jQuery.each({slideDown:genFx("show"),slideUp:genFx("hide"),slideToggle:genFx("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},(function(name,props){jQuery.fn[name]=function(speed,easing,callback){return this.animate(props,speed,easing,callback)}}));jQuery.timers=[];jQuery.fx.tick=function(){var timer,i=0,timers=jQuery.timers;fxNow=Date.now();for(;i<timers.length;i++){timer=timers[i];if(!timer()&&timers[i]===timer){timers.splice(i--,1)}}if(!timers.length){jQuery.fx.stop()}fxNow=undefined};jQuery.fx.timer=function(timer){jQuery.timers.push(timer);jQuery.fx.start()};jQuery.fx.interval=13;jQuery.fx.start=function(){if(inProgress){return}inProgress=true;schedule()};jQuery.fx.stop=function(){inProgress=null};jQuery.fx.speeds={slow:600,fast:200,_default:400};jQuery.fn.delay=function(time,type){time=jQuery.fx?jQuery.fx.speeds[time]||time:time;type=type||"fx";return this.queue(type,(function(next,hooks){var timeout=window.setTimeout(next,time);hooks.stop=function(){window.clearTimeout(timeout)}}))};(function(){var input=document.createElement("input"),select=document.createElement("select"),opt=select.appendChild(document.createElement("option"));input.type="checkbox";support.checkOn=input.value!=="";support.optSelected=opt.selected;input=document.createElement("input");input.value="t";input.type="radio";support.radioValue=input.value==="t"})();var boolHook,attrHandle=jQuery.expr.attrHandle;jQuery.fn.extend({attr:function(name,value){return access(this,jQuery.attr,name,value,arguments.length>1)},removeAttr:function(name){return this.each((function(){jQuery.removeAttr(this,name)}))}});jQuery.extend({attr:function(elem,name,value){var ret,hooks,nType=elem.nodeType;if(nType===3||nType===8||nType===2){return}if(typeof elem.getAttribute==="undefined"){return jQuery.prop(elem,name,value)}if(nType!==1||!jQuery.isXMLDoc(elem)){hooks=jQuery.attrHooks[name.toLowerCase()]||(jQuery.expr.match.bool.test(name)?boolHook:undefined)}if(value!==undefined){if(value===null){jQuery.removeAttr(elem,name);return}if(hooks&&"set"in hooks&&(ret=hooks.set(elem,value,name))!==undefined){return ret}elem.setAttribute(name,value+"");return value}if(hooks&&"get"in hooks&&(ret=hooks.get(elem,name))!==null){return ret}ret=jQuery.find.attr(elem,name);return ret==null?undefined:ret},attrHooks:{type:{set:function(elem,value){if(!support.radioValue&&value==="radio"&&nodeName(elem,"input")){var val=elem.value;elem.setAttribute("type",value);if(val){elem.value=val}return value}}}},removeAttr:function(elem,value){var name,i=0,attrNames=value&&value.match(rnothtmlwhite);if(attrNames&&elem.nodeType===1){while(name=attrNames[i++]){elem.removeAttribute(name)}}}});boolHook={set:function(elem,value,name){if(value===false){jQuery.removeAttr(elem,name)}else{elem.setAttribute(name,name)}return name}};jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g),(function(_i,name){var getter=attrHandle[name]||jQuery.find.attr;attrHandle[name]=function(elem,name,isXML){var ret,handle,lowercaseName=name.toLowerCase();if(!isXML){handle=attrHandle[lowercaseName];attrHandle[lowercaseName]=ret;ret=getter(elem,name,isXML)!=null?lowercaseName:null;attrHandle[lowercaseName]=handle}return ret}}));var rfocusable=/^(?:input|select|textarea|button)$/i,rclickable=/^(?:a|area)$/i;jQuery.fn.extend({prop:function(name,value){return access(this,jQuery.prop,name,value,arguments.length>1)},removeProp:function(name){return this.each((function(){delete this[jQuery.propFix[name]||name]}))}});jQuery.extend({prop:function(elem,name,value){var ret,hooks,nType=elem.nodeType;if(nType===3||nType===8||nType===2){return}if(nType!==1||!jQuery.isXMLDoc(elem)){name=jQuery.propFix[name]||name;hooks=jQuery.propHooks[name]}if(value!==undefined){if(hooks&&"set"in hooks&&(ret=hooks.set(elem,value,name))!==undefined){return ret}return elem[name]=value}if(hooks&&"get"in hooks&&(ret=hooks.get(elem,name))!==null){return ret}return elem[name]},propHooks:{tabIndex:{get:function(elem){var tabindex=jQuery.find.attr(elem,"tabindex");if(tabindex){return parseInt(tabindex,10)}if(rfocusable.test(elem.nodeName)||rclickable.test(elem.nodeName)&&elem.href){return 0}return-1}}},propFix:{for:"htmlFor",class:"className"}});if(!support.optSelected){jQuery.propHooks.selected={get:function(elem){var parent=elem.parentNode;if(parent&&parent.parentNode){parent.parentNode.selectedIndex}return null},set:function(elem){var parent=elem.parentNode;if(parent){parent.selectedIndex;if(parent.parentNode){parent.parentNode.selectedIndex}}}}}jQuery.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){jQuery.propFix[this.toLowerCase()]=this}));function stripAndCollapse(value){var tokens=value.match(rnothtmlwhite)||[];return tokens.join(" ")}function getClass(elem){return elem.getAttribute&&elem.getAttribute("class")||""}function classesToArray(value){if(Array.isArray(value)){return value}if(typeof value==="string"){return value.match(rnothtmlwhite)||[]}return[]}jQuery.fn.extend({addClass:function(value){var classNames,cur,curValue,className,i,finalValue;if(isFunction(value)){return this.each((function(j){jQuery(this).addClass(value.call(this,j,getClass(this)))}))}classNames=classesToArray(value);if(classNames.length){return this.each((function(){curValue=getClass(this);cur=this.nodeType===1&&" "+stripAndCollapse(curValue)+" ";if(cur){for(i=0;i<classNames.length;i++){className=classNames[i];if(cur.indexOf(" "+className+" ")<0){cur+=className+" "}}finalValue=stripAndCollapse(cur);if(curValue!==finalValue){this.setAttribute("class",finalValue)}}}))}return this},removeClass:function(value){var classNames,cur,curValue,className,i,finalValue;if(isFunction(value)){return this.each((function(j){jQuery(this).removeClass(value.call(this,j,getClass(this)))}))}if(!arguments.length){return this.attr("class","")}classNames=classesToArray(value);if(classNames.length){return this.each((function(){curValue=getClass(this);cur=this.nodeType===1&&" "+stripAndCollapse(curValue)+" ";if(cur){for(i=0;i<classNames.length;i++){className=classNames[i];while(cur.indexOf(" "+className+" ")>-1){cur=cur.replace(" "+className+" "," ")}}finalValue=stripAndCollapse(cur);if(curValue!==finalValue){this.setAttribute("class",finalValue)}}}))}return this},toggleClass:function(value,stateVal){var classNames,className,i,self,type=typeof value,isValidValue=type==="string"||Array.isArray(value);if(isFunction(value)){return this.each((function(i){jQuery(this).toggleClass(value.call(this,i,getClass(this),stateVal),stateVal)}))}if(typeof stateVal==="boolean"&&isValidValue){return stateVal?this.addClass(value):this.removeClass(value)}classNames=classesToArray(value);return this.each((function(){if(isValidValue){self=jQuery(this);for(i=0;i<classNames.length;i++){className=classNames[i];if(self.hasClass(className)){self.removeClass(className)}else{self.addClass(className)}}}else if(value===undefined||type==="boolean"){className=getClass(this);if(className){dataPriv.set(this,"__className__",className)}if(this.setAttribute){this.setAttribute("class",className||value===false?"":dataPriv.get(this,"__className__")||"")}}}))},hasClass:function(selector){var className,elem,i=0;className=" "+selector+" ";while(elem=this[i++]){if(elem.nodeType===1&&(" "+stripAndCollapse(getClass(elem))+" ").indexOf(className)>-1){return true}}return false}});var rreturn=/\r/g;jQuery.fn.extend({val:function(value){var hooks,ret,valueIsFunction,elem=this[0];if(!arguments.length){if(elem){hooks=jQuery.valHooks[elem.type]||jQuery.valHooks[elem.nodeName.toLowerCase()];if(hooks&&"get"in hooks&&(ret=hooks.get(elem,"value"))!==undefined){return ret}ret=elem.value;if(typeof ret==="string"){return ret.replace(rreturn,"")}return ret==null?"":ret}return}valueIsFunction=isFunction(value);return this.each((function(i){var val;if(this.nodeType!==1){return}if(valueIsFunction){val=value.call(this,i,jQuery(this).val())}else{val=value}if(val==null){val=""}else if(typeof val==="number"){val+=""}else if(Array.isArray(val)){val=jQuery.map(val,(function(value){return value==null?"":value+""}))}hooks=jQuery.valHooks[this.type]||jQuery.valHooks[this.nodeName.toLowerCase()];if(!hooks||!("set"in hooks)||hooks.set(this,val,"value")===undefined){this.value=val}}))}});jQuery.extend({valHooks:{option:{get:function(elem){var val=jQuery.find.attr(elem,"value");return val!=null?val:stripAndCollapse(jQuery.text(elem))}},select:{get:function(elem){var value,option,i,options=elem.options,index=elem.selectedIndex,one=elem.type==="select-one",values=one?null:[],max=one?index+1:options.length;if(index<0){i=max}else{i=one?index:0}for(;i<max;i++){option=options[i];if((option.selected||i===index)&&!option.disabled&&(!option.parentNode.disabled||!nodeName(option.parentNode,"optgroup"))){value=jQuery(option).val();if(one){return value}values.push(value)}}return values},set:function(elem,value){var optionSet,option,options=elem.options,values=jQuery.makeArray(value),i=options.length;while(i--){option=options[i];if(option.selected=jQuery.inArray(jQuery.valHooks.option.get(option),values)>-1){optionSet=true}}if(!optionSet){elem.selectedIndex=-1}return values}}}});jQuery.each(["radio","checkbox"],(function(){jQuery.valHooks[this]={set:function(elem,value){if(Array.isArray(value)){return elem.checked=jQuery.inArray(jQuery(elem).val(),value)>-1}}};if(!support.checkOn){jQuery.valHooks[this].get=function(elem){return elem.getAttribute("value")===null?"on":elem.value}}}));var location=window.location;var nonce={guid:Date.now()};var rquery=/\?/;jQuery.parseXML=function(data){var xml,parserErrorElem;if(!data||typeof data!=="string"){return null}try{xml=(new window.DOMParser).parseFromString(data,"text/xml")}catch(e){}parserErrorElem=xml&&xml.getElementsByTagName("parsererror")[0];if(!xml||parserErrorElem){jQuery.error("Invalid XML: "+(parserErrorElem?jQuery.map(parserErrorElem.childNodes,(function(el){return el.textContent})).join("\n"):data))}return xml};var rfocusMorph=/^(?:focusinfocus|focusoutblur)$/,stopPropagationCallback=function(e){e.stopPropagation()};jQuery.extend(jQuery.event,{trigger:function(event,data,elem,onlyHandlers){var i,cur,tmp,bubbleType,ontype,handle,special,lastElement,eventPath=[elem||document],type=hasOwn.call(event,"type")?event.type:event,namespaces=hasOwn.call(event,"namespace")?event.namespace.split("."):[];cur=lastElement=tmp=elem=elem||document;if(elem.nodeType===3||elem.nodeType===8){return}if(rfocusMorph.test(type+jQuery.event.triggered)){return}if(type.indexOf(".")>-1){namespaces=type.split(".");type=namespaces.shift();namespaces.sort()}ontype=type.indexOf(":")<0&&"on"+type;event=event[jQuery.expando]?event:new jQuery.Event(type,typeof event==="object"&&event);event.isTrigger=onlyHandlers?2:3;event.namespace=namespaces.join(".");event.rnamespace=event.namespace?new RegExp("(^|\\.)"+namespaces.join("\\.(?:.*\\.|)")+"(\\.|$)"):null;event.result=undefined;if(!event.target){event.target=elem}data=data==null?[event]:jQuery.makeArray(data,[event]);special=jQuery.event.special[type]||{};if(!onlyHandlers&&special.trigger&&special.trigger.apply(elem,data)===false){return}if(!onlyHandlers&&!special.noBubble&&!isWindow(elem)){bubbleType=special.delegateType||type;if(!rfocusMorph.test(bubbleType+type)){cur=cur.parentNode}for(;cur;cur=cur.parentNode){eventPath.push(cur);tmp=cur}if(tmp===(elem.ownerDocument||document)){eventPath.push(tmp.defaultView||tmp.parentWindow||window)}}i=0;while((cur=eventPath[i++])&&!event.isPropagationStopped()){lastElement=cur;event.type=i>1?bubbleType:special.bindType||type;handle=(dataPriv.get(cur,"events")||Object.create(null))[event.type]&&dataPriv.get(cur,"handle");if(handle){handle.apply(cur,data)}handle=ontype&&cur[ontype];if(handle&&handle.apply&&acceptData(cur)){event.result=handle.apply(cur,data);if(event.result===false){event.preventDefault()}}}event.type=type;if(!onlyHandlers&&!event.isDefaultPrevented()){if((!special._default||special._default.apply(eventPath.pop(),data)===false)&&acceptData(elem)){if(ontype&&isFunction(elem[type])&&!isWindow(elem)){tmp=elem[ontype];if(tmp){elem[ontype]=null}jQuery.event.triggered=type;if(event.isPropagationStopped()){lastElement.addEventListener(type,stopPropagationCallback)}elem[type]();if(event.isPropagationStopped()){lastElement.removeEventListener(type,stopPropagationCallback)}jQuery.event.triggered=undefined;if(tmp){elem[ontype]=tmp}}}}return event.result},simulate:function(type,elem,event){var e=jQuery.extend(new jQuery.Event,event,{type:type,isSimulated:true});jQuery.event.trigger(e,null,elem)}});jQuery.fn.extend({trigger:function(type,data){return this.each((function(){jQuery.event.trigger(type,data,this)}))},triggerHandler:function(type,data){var elem=this[0];if(elem){return jQuery.event.trigger(type,data,elem,true)}}});var rbracket=/\[\]$/,rCRLF=/\r?\n/g,rsubmitterTypes=/^(?:submit|button|image|reset|file)$/i,rsubmittable=/^(?:input|select|textarea|keygen)/i;function buildParams(prefix,obj,traditional,add){var name;if(Array.isArray(obj)){jQuery.each(obj,(function(i,v){if(traditional||rbracket.test(prefix)){add(prefix,v)}else{buildParams(prefix+"["+(typeof v==="object"&&v!=null?i:"")+"]",v,traditional,add)}}))}else if(!traditional&&toType(obj)==="object"){for(name in obj){buildParams(prefix+"["+name+"]",obj[name],traditional,add)}}else{add(prefix,obj)}}jQuery.param=function(a,traditional){var prefix,s=[],add=function(key,valueOrFunction){var value=isFunction(valueOrFunction)?valueOrFunction():valueOrFunction;s[s.length]=encodeURIComponent(key)+"="+encodeURIComponent(value==null?"":value)};if(a==null){return""}if(Array.isArray(a)||a.jquery&&!jQuery.isPlainObject(a)){jQuery.each(a,(function(){add(this.name,this.value)}))}else{for(prefix in a){buildParams(prefix,a[prefix],traditional,add)}}return s.join("&")};jQuery.fn.extend({serialize:function(){return jQuery.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var elements=jQuery.prop(this,"elements");return elements?jQuery.makeArray(elements):this})).filter((function(){var type=this.type;return this.name&&!jQuery(this).is(":disabled")&&rsubmittable.test(this.nodeName)&&!rsubmitterTypes.test(type)&&(this.checked||!rcheckableType.test(type))})).map((function(_i,elem){var val=jQuery(this).val();if(val==null){return null}if(Array.isArray(val)){return jQuery.map(val,(function(val){return{name:elem.name,value:val.replace(rCRLF,"\r\n")}}))}return{name:elem.name,value:val.replace(rCRLF,"\r\n")}})).get()}});var r20=/%20/g,rhash=/#.*$/,rantiCache=/([?&])_=[^&]*/,rheaders=/^(.*?):[ \t]*([^\r\n]*)$/gm,rlocalProtocol=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,rnoContent=/^(?:GET|HEAD)$/,rprotocol=/^\/\//,prefilters={},transports={},allTypes="*/".concat("*"),originAnchor=document.createElement("a");originAnchor.href=location.href;function addToPrefiltersOrTransports(structure){return function(dataTypeExpression,func){if(typeof dataTypeExpression!=="string"){func=dataTypeExpression;dataTypeExpression="*"}var dataType,i=0,dataTypes=dataTypeExpression.toLowerCase().match(rnothtmlwhite)||[];if(isFunction(func)){while(dataType=dataTypes[i++]){if(dataType[0]==="+"){dataType=dataType.slice(1)||"*";(structure[dataType]=structure[dataType]||[]).unshift(func)}else{(structure[dataType]=structure[dataType]||[]).push(func)}}}}}function inspectPrefiltersOrTransports(structure,options,originalOptions,jqXHR){var inspected={},seekingTransport=structure===transports;function inspect(dataType){var selected;inspected[dataType]=true;jQuery.each(structure[dataType]||[],(function(_,prefilterOrFactory){var dataTypeOrTransport=prefilterOrFactory(options,originalOptions,jqXHR);if(typeof dataTypeOrTransport==="string"&&!seekingTransport&&!inspected[dataTypeOrTransport]){options.dataTypes.unshift(dataTypeOrTransport);inspect(dataTypeOrTransport);return false}else if(seekingTransport){return!(selected=dataTypeOrTransport)}}));return selected}return inspect(options.dataTypes[0])||!inspected["*"]&&inspect("*")}function ajaxExtend(target,src){var key,deep,flatOptions=jQuery.ajaxSettings.flatOptions||{};for(key in src){if(src[key]!==undefined){(flatOptions[key]?target:deep||(deep={}))[key]=src[key]}}if(deep){jQuery.extend(true,target,deep)}return target}function ajaxHandleResponses(s,jqXHR,responses){var ct,type,finalDataType,firstDataType,contents=s.contents,dataTypes=s.dataTypes;while(dataTypes[0]==="*"){dataTypes.shift();if(ct===undefined){ct=s.mimeType||jqXHR.getResponseHeader("Content-Type")}}if(ct){for(type in contents){if(contents[type]&&contents[type].test(ct)){dataTypes.unshift(type);break}}}if(dataTypes[0]in responses){finalDataType=dataTypes[0]}else{for(type in responses){if(!dataTypes[0]||s.converters[type+" "+dataTypes[0]]){finalDataType=type;break}if(!firstDataType){firstDataType=type}}finalDataType=finalDataType||firstDataType}if(finalDataType){if(finalDataType!==dataTypes[0]){dataTypes.unshift(finalDataType)}return responses[finalDataType]}}function ajaxConvert(s,response,jqXHR,isSuccess){var conv2,current,conv,tmp,prev,converters={},dataTypes=s.dataTypes.slice();if(dataTypes[1]){for(conv in s.converters){converters[conv.toLowerCase()]=s.converters[conv]}}current=dataTypes.shift();while(current){if(s.responseFields[current]){jqXHR[s.responseFields[current]]=response}if(!prev&&isSuccess&&s.dataFilter){response=s.dataFilter(response,s.dataType)}prev=current;current=dataTypes.shift();if(current){if(current==="*"){current=prev}else if(prev!=="*"&&prev!==current){conv=converters[prev+" "+current]||converters["* "+current];if(!conv){for(conv2 in converters){tmp=conv2.split(" ");if(tmp[1]===current){conv=converters[prev+" "+tmp[0]]||converters["* "+tmp[0]];if(conv){if(conv===true){conv=converters[conv2]}else if(converters[conv2]!==true){current=tmp[0];dataTypes.unshift(tmp[1])}break}}}}if(conv!==true){if(conv&&s.throws){response=conv(response)}else{try{response=conv(response)}catch(e){return{state:"parsererror",error:conv?e:"No conversion from "+prev+" to "+current}}}}}}}return{state:"success",data:response}}jQuery.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:location.href,type:"GET",isLocal:rlocalProtocol.test(location.protocol),global:true,processData:true,async:true,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":allTypes,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":true,"text json":JSON.parse,"text xml":jQuery.parseXML},flatOptions:{url:true,context:true}},ajaxSetup:function(target,settings){return settings?ajaxExtend(ajaxExtend(target,jQuery.ajaxSettings),settings):ajaxExtend(jQuery.ajaxSettings,target)},ajaxPrefilter:addToPrefiltersOrTransports(prefilters),ajaxTransport:addToPrefiltersOrTransports(transports),ajax:function(url,options){if(typeof url==="object"){options=url;url=undefined}options=options||{};var transport,cacheURL,responseHeadersString,responseHeaders,timeoutTimer,urlAnchor,completed,fireGlobals,i,uncached,s=jQuery.ajaxSetup({},options),callbackContext=s.context||s,globalEventContext=s.context&&(callbackContext.nodeType||callbackContext.jquery)?jQuery(callbackContext):jQuery.event,deferred=jQuery.Deferred(),completeDeferred=jQuery.Callbacks("once memory"),statusCode=s.statusCode||{},requestHeaders={},requestHeadersNames={},strAbort="canceled",jqXHR={readyState:0,getResponseHeader:function(key){var match;if(completed){if(!responseHeaders){responseHeaders={};while(match=rheaders.exec(responseHeadersString)){responseHeaders[match[1].toLowerCase()+" "]=(responseHeaders[match[1].toLowerCase()+" "]||[]).concat(match[2])}}match=responseHeaders[key.toLowerCase()+" "]}return match==null?null:match.join(", ")},getAllResponseHeaders:function(){return completed?responseHeadersString:null},setRequestHeader:function(name,value){if(completed==null){name=requestHeadersNames[name.toLowerCase()]=requestHeadersNames[name.toLowerCase()]||name;requestHeaders[name]=value}return this},overrideMimeType:function(type){if(completed==null){s.mimeType=type}return this},statusCode:function(map){var code;if(map){if(completed){jqXHR.always(map[jqXHR.status])}else{for(code in map){statusCode[code]=[statusCode[code],map[code]]}}}return this},abort:function(statusText){var finalText=statusText||strAbort;if(transport){transport.abort(finalText)}done(0,finalText);return this}};deferred.promise(jqXHR);s.url=((url||s.url||location.href)+"").replace(rprotocol,location.protocol+"//");s.type=options.method||options.type||s.method||s.type;s.dataTypes=(s.dataType||"*").toLowerCase().match(rnothtmlwhite)||[""];if(s.crossDomain==null){urlAnchor=document.createElement("a");try{urlAnchor.href=s.url;urlAnchor.href=urlAnchor.href;s.crossDomain=originAnchor.protocol+"//"+originAnchor.host!==urlAnchor.protocol+"//"+urlAnchor.host}catch(e){s.crossDomain=true}}if(s.data&&s.processData&&typeof s.data!=="string"){s.data=jQuery.param(s.data,s.traditional)}inspectPrefiltersOrTransports(prefilters,s,options,jqXHR);if(completed){return jqXHR}fireGlobals=jQuery.event&&s.global;if(fireGlobals&&jQuery.active++===0){jQuery.event.trigger("ajaxStart")}s.type=s.type.toUpperCase();s.hasContent=!rnoContent.test(s.type);cacheURL=s.url.replace(rhash,"");if(!s.hasContent){uncached=s.url.slice(cacheURL.length);if(s.data&&(s.processData||typeof s.data==="string")){cacheURL+=(rquery.test(cacheURL)?"&":"?")+s.data;delete s.data}if(s.cache===false){cacheURL=cacheURL.replace(rantiCache,"$1");uncached=(rquery.test(cacheURL)?"&":"?")+"_="+nonce.guid+++uncached}s.url=cacheURL+uncached}else if(s.data&&s.processData&&(s.contentType||"").indexOf("application/x-www-form-urlencoded")===0){s.data=s.data.replace(r20,"+")}if(s.ifModified){if(jQuery.lastModified[cacheURL]){jqXHR.setRequestHeader("If-Modified-Since",jQuery.lastModified[cacheURL])}if(jQuery.etag[cacheURL]){jqXHR.setRequestHeader("If-None-Match",jQuery.etag[cacheURL])}}if(s.data&&s.hasContent&&s.contentType!==false||options.contentType){jqXHR.setRequestHeader("Content-Type",s.contentType)}jqXHR.setRequestHeader("Accept",s.dataTypes[0]&&s.accepts[s.dataTypes[0]]?s.accepts[s.dataTypes[0]]+(s.dataTypes[0]!=="*"?", "+allTypes+"; q=0.01":""):s.accepts["*"]);for(i in s.headers){jqXHR.setRequestHeader(i,s.headers[i])}if(s.beforeSend&&(s.beforeSend.call(callbackContext,jqXHR,s)===false||completed)){return jqXHR.abort()}strAbort="abort";completeDeferred.add(s.complete);jqXHR.done(s.success);jqXHR.fail(s.error);transport=inspectPrefiltersOrTransports(transports,s,options,jqXHR);if(!transport){done(-1,"No Transport")}else{jqXHR.readyState=1;if(fireGlobals){globalEventContext.trigger("ajaxSend",[jqXHR,s])}if(completed){return jqXHR}if(s.async&&s.timeout>0){timeoutTimer=window.setTimeout((function(){jqXHR.abort("timeout")}),s.timeout)}try{completed=false;transport.send(requestHeaders,done)}catch(e){if(completed){throw e}done(-1,e)}}function done(status,nativeStatusText,responses,headers){var isSuccess,success,error,response,modified,statusText=nativeStatusText;if(completed){return}completed=true;if(timeoutTimer){window.clearTimeout(timeoutTimer)}transport=undefined;responseHeadersString=headers||"";jqXHR.readyState=status>0?4:0;isSuccess=status>=200&&status<300||status===304;if(responses){response=ajaxHandleResponses(s,jqXHR,responses)}if(!isSuccess&&jQuery.inArray("script",s.dataTypes)>-1&&jQuery.inArray("json",s.dataTypes)<0){s.converters["text script"]=function(){}}response=ajaxConvert(s,response,jqXHR,isSuccess);if(isSuccess){if(s.ifModified){modified=jqXHR.getResponseHeader("Last-Modified");if(modified){jQuery.lastModified[cacheURL]=modified}modified=jqXHR.getResponseHeader("etag");if(modified){jQuery.etag[cacheURL]=modified}}if(status===204||s.type==="HEAD"){statusText="nocontent"}else if(status===304){statusText="notmodified"}else{statusText=response.state;success=response.data;error=response.error;isSuccess=!error}}else{error=statusText;if(status||!statusText){statusText="error";if(status<0){status=0}}}jqXHR.status=status;jqXHR.statusText=(nativeStatusText||statusText)+"";if(isSuccess){deferred.resolveWith(callbackContext,[success,statusText,jqXHR])}else{deferred.rejectWith(callbackContext,[jqXHR,statusText,error])}jqXHR.statusCode(statusCode);statusCode=undefined;if(fireGlobals){globalEventContext.trigger(isSuccess?"ajaxSuccess":"ajaxError",[jqXHR,s,isSuccess?success:error])}completeDeferred.fireWith(callbackContext,[jqXHR,statusText]);if(fireGlobals){globalEventContext.trigger("ajaxComplete",[jqXHR,s]);if(!--jQuery.active){jQuery.event.trigger("ajaxStop")}}}return jqXHR},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json")},getScript:function(url,callback){return jQuery.get(url,undefined,callback,"script")}});jQuery.each(["get","post"],(function(_i,method){jQuery[method]=function(url,data,callback,type){if(isFunction(data)){type=type||callback;callback=data;data=undefined}return jQuery.ajax(jQuery.extend({url:url,type:method,dataType:type,data:data,success:callback},jQuery.isPlainObject(url)&&url))}}));jQuery.ajaxPrefilter((function(s){var i;for(i in s.headers){if(i.toLowerCase()==="content-type"){s.contentType=s.headers[i]||""}}}));jQuery._evalUrl=function(url,options,doc){return jQuery.ajax({url:url,type:"GET",dataType:"script",cache:true,async:false,global:false,converters:{"text script":function(){}},dataFilter:function(response){jQuery.globalEval(response,options,doc)}})};jQuery.fn.extend({wrapAll:function(html){var wrap;if(this[0]){if(isFunction(html)){html=html.call(this[0])}wrap=jQuery(html,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){wrap.insertBefore(this[0])}wrap.map((function(){var elem=this;while(elem.firstElementChild){elem=elem.firstElementChild}return elem})).append(this)}return this},wrapInner:function(html){if(isFunction(html)){return this.each((function(i){jQuery(this).wrapInner(html.call(this,i))}))}return this.each((function(){var self=jQuery(this),contents=self.contents();if(contents.length){contents.wrapAll(html)}else{self.append(html)}}))},wrap:function(html){var htmlIsFunction=isFunction(html);return this.each((function(i){jQuery(this).wrapAll(htmlIsFunction?html.call(this,i):html)}))},unwrap:function(selector){this.parent(selector).not("body").each((function(){jQuery(this).replaceWith(this.childNodes)}));return this}});jQuery.expr.pseudos.hidden=function(elem){return!jQuery.expr.pseudos.visible(elem)};jQuery.expr.pseudos.visible=function(elem){return!!(elem.offsetWidth||elem.offsetHeight||elem.getClientRects().length)};jQuery.ajaxSettings.xhr=function(){try{return new window.XMLHttpRequest}catch(e){}};var xhrSuccessStatus={0:200,1223:204},xhrSupported=jQuery.ajaxSettings.xhr();support.cors=!!xhrSupported&&"withCredentials"in xhrSupported;support.ajax=xhrSupported=!!xhrSupported;jQuery.ajaxTransport((function(options){var callback,errorCallback;if(support.cors||xhrSupported&&!options.crossDomain){return{send:function(headers,complete){var i,xhr=options.xhr();xhr.open(options.type,options.url,options.async,options.username,options.password);if(options.xhrFields){for(i in options.xhrFields){xhr[i]=options.xhrFields[i]}}if(options.mimeType&&xhr.overrideMimeType){xhr.overrideMimeType(options.mimeType)}if(!options.crossDomain&&!headers["X-Requested-With"]){headers["X-Requested-With"]="XMLHttpRequest"}for(i in headers){xhr.setRequestHeader(i,headers[i])}callback=function(type){return function(){if(callback){callback=errorCallback=xhr.onload=xhr.onerror=xhr.onabort=xhr.ontimeout=xhr.onreadystatechange=null;if(type==="abort"){xhr.abort()}else if(type==="error"){if(typeof xhr.status!=="number"){complete(0,"error")}else{complete(xhr.status,xhr.statusText)}}else{complete(xhrSuccessStatus[xhr.status]||xhr.status,xhr.statusText,(xhr.responseType||"text")!=="text"||typeof xhr.responseText!=="string"?{binary:xhr.response}:{text:xhr.responseText},xhr.getAllResponseHeaders())}}}};xhr.onload=callback();errorCallback=xhr.onerror=xhr.ontimeout=callback("error");if(xhr.onabort!==undefined){xhr.onabort=errorCallback}else{xhr.onreadystatechange=function(){if(xhr.readyState===4){window.setTimeout((function(){if(callback){errorCallback()}}))}}}callback=callback("abort");try{xhr.send(options.hasContent&&options.data||null)}catch(e){if(callback){throw e}}},abort:function(){if(callback){callback()}}}}}));jQuery.ajaxPrefilter((function(s){if(s.crossDomain){s.contents.script=false}}));jQuery.ajaxSetup({accepts:{script:"text/javascript, application/javascript, "+"application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(text){jQuery.globalEval(text);return text}}});jQuery.ajaxPrefilter("script",(function(s){if(s.cache===undefined){s.cache=false}if(s.crossDomain){s.type="GET"}}));jQuery.ajaxTransport("script",(function(s){if(s.crossDomain||s.scriptAttrs){var script,callback;return{send:function(_,complete){script=jQuery("<script>").attr(s.scriptAttrs||{}).prop({charset:s.scriptCharset,src:s.url}).on("load error",callback=function(evt){script.remove();callback=null;if(evt){complete(evt.type==="error"?404:200,evt.type)}});document.head.appendChild(script[0])},abort:function(){if(callback){callback()}}}}}));var oldCallbacks=[],rjsonp=/(=)\?(?=&|$)|\?\?/;jQuery.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var callback=oldCallbacks.pop()||jQuery.expando+"_"+nonce.guid++;this[callback]=true;return callback}});jQuery.ajaxPrefilter("json jsonp",(function(s,originalSettings,jqXHR){var callbackName,overwritten,responseContainer,jsonProp=s.jsonp!==false&&(rjsonp.test(s.url)?"url":typeof s.data==="string"&&(s.contentType||"").indexOf("application/x-www-form-urlencoded")===0&&rjsonp.test(s.data)&&"data");if(jsonProp||s.dataTypes[0]==="jsonp"){callbackName=s.jsonpCallback=isFunction(s.jsonpCallback)?s.jsonpCallback():s.jsonpCallback;if(jsonProp){s[jsonProp]=s[jsonProp].replace(rjsonp,"$1"+callbackName)}else if(s.jsonp!==false){s.url+=(rquery.test(s.url)?"&":"?")+s.jsonp+"="+callbackName}s.converters["script json"]=function(){if(!responseContainer){jQuery.error(callbackName+" was not called")}return responseContainer[0]};s.dataTypes[0]="json";overwritten=window[callbackName];window[callbackName]=function(){responseContainer=arguments};jqXHR.always((function(){if(overwritten===undefined){jQuery(window).removeProp(callbackName)}else{window[callbackName]=overwritten}if(s[callbackName]){s.jsonpCallback=originalSettings.jsonpCallback;oldCallbacks.push(callbackName)}if(responseContainer&&isFunction(overwritten)){overwritten(responseContainer[0])}responseContainer=overwritten=undefined}));return"script"}}));support.createHTMLDocument=function(){var body=document.implementation.createHTMLDocument("").body;body.innerHTML="<form></form><form></form>";return body.childNodes.length===2}();jQuery.parseHTML=function(data,context,keepScripts){if(typeof data!=="string"){return[]}if(typeof context==="boolean"){keepScripts=context;context=false}var base,parsed,scripts;if(!context){if(support.createHTMLDocument){context=document.implementation.createHTMLDocument("");base=context.createElement("base");base.href=document.location.href;context.head.appendChild(base)}else{context=document}}parsed=rsingleTag.exec(data);scripts=!keepScripts&&[];if(parsed){return[context.createElement(parsed[1])]}parsed=buildFragment([data],context,scripts);if(scripts&&scripts.length){jQuery(scripts).remove()}return jQuery.merge([],parsed.childNodes)};jQuery.fn.load=function(url,params,callback){var selector,type,response,self=this,off=url.indexOf(" ");if(off>-1){selector=stripAndCollapse(url.slice(off));url=url.slice(0,off)}if(isFunction(params)){callback=params;params=undefined}else if(params&&typeof params==="object"){type="POST"}if(self.length>0){jQuery.ajax({url:url,type:type||"GET",dataType:"html",data:params}).done((function(responseText){response=arguments;self.html(selector?jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector):responseText)})).always(callback&&function(jqXHR,status){self.each((function(){callback.apply(this,response||[jqXHR.responseText,status,jqXHR])}))})}return this};jQuery.expr.pseudos.animated=function(elem){return jQuery.grep(jQuery.timers,(function(fn){return elem===fn.elem})).length};jQuery.offset={setOffset:function(elem,options,i){var curPosition,curLeft,curCSSTop,curTop,curOffset,curCSSLeft,calculatePosition,position=jQuery.css(elem,"position"),curElem=jQuery(elem),props={};if(position==="static"){elem.style.position="relative"}curOffset=curElem.offset();curCSSTop=jQuery.css(elem,"top");curCSSLeft=jQuery.css(elem,"left");calculatePosition=(position==="absolute"||position==="fixed")&&(curCSSTop+curCSSLeft).indexOf("auto")>-1;if(calculatePosition){curPosition=curElem.position();curTop=curPosition.top;curLeft=curPosition.left}else{curTop=parseFloat(curCSSTop)||0;curLeft=parseFloat(curCSSLeft)||0}if(isFunction(options)){options=options.call(elem,i,jQuery.extend({},curOffset))}if(options.top!=null){props.top=options.top-curOffset.top+curTop}if(options.left!=null){props.left=options.left-curOffset.left+curLeft}if("using"in options){options.using.call(elem,props)}else{curElem.css(props)}}};jQuery.fn.extend({offset:function(options){if(arguments.length){return options===undefined?this:this.each((function(i){jQuery.offset.setOffset(this,options,i)}))}var rect,win,elem=this[0];if(!elem){return}if(!elem.getClientRects().length){return{top:0,left:0}}rect=elem.getBoundingClientRect();win=elem.ownerDocument.defaultView;return{top:rect.top+win.pageYOffset,left:rect.left+win.pageXOffset}},position:function(){if(!this[0]){return}var offsetParent,offset,doc,elem=this[0],parentOffset={top:0,left:0};if(jQuery.css(elem,"position")==="fixed"){offset=elem.getBoundingClientRect()}else{offset=this.offset();doc=elem.ownerDocument;offsetParent=elem.offsetParent||doc.documentElement;while(offsetParent&&(offsetParent===doc.body||offsetParent===doc.documentElement)&&jQuery.css(offsetParent,"position")==="static"){offsetParent=offsetParent.parentNode}if(offsetParent&&offsetParent!==elem&&offsetParent.nodeType===1){parentOffset=jQuery(offsetParent).offset();parentOffset.top+=jQuery.css(offsetParent,"borderTopWidth",true);parentOffset.left+=jQuery.css(offsetParent,"borderLeftWidth",true)}}return{top:offset.top-parentOffset.top-jQuery.css(elem,"marginTop",true),left:offset.left-parentOffset.left-jQuery.css(elem,"marginLeft",true)}},offsetParent:function(){return this.map((function(){var offsetParent=this.offsetParent;while(offsetParent&&jQuery.css(offsetParent,"position")==="static"){offsetParent=offsetParent.offsetParent}return offsetParent||documentElement}))}});jQuery.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},(function(method,prop){var top="pageYOffset"===prop;jQuery.fn[method]=function(val){return access(this,(function(elem,method,val){var win;if(isWindow(elem)){win=elem}else if(elem.nodeType===9){win=elem.defaultView}if(val===undefined){return win?win[prop]:elem[method]}if(win){win.scrollTo(!top?val:win.pageXOffset,top?val:win.pageYOffset)}else{elem[method]=val}}),method,val,arguments.length)}}));jQuery.each(["top","left"],(function(_i,prop){jQuery.cssHooks[prop]=addGetHookIf(support.pixelPosition,(function(elem,computed){if(computed){computed=curCSS(elem,prop);return rnumnonpx.test(computed)?jQuery(elem).position()[prop]+"px":computed}}))}));jQuery.each({Height:"height",Width:"width"},(function(name,type){jQuery.each({padding:"inner"+name,content:type,"":"outer"+name},(function(defaultExtra,funcName){jQuery.fn[funcName]=function(margin,value){var chainable=arguments.length&&(defaultExtra||typeof margin!=="boolean"),extra=defaultExtra||(margin===true||value===true?"margin":"border");return access(this,(function(elem,type,value){var doc;if(isWindow(elem)){return funcName.indexOf("outer")===0?elem["inner"+name]:elem.document.documentElement["client"+name]}if(elem.nodeType===9){doc=elem.documentElement;return Math.max(elem.body["scroll"+name],doc["scroll"+name],elem.body["offset"+name],doc["offset"+name],doc["client"+name])}return value===undefined?jQuery.css(elem,type,extra):jQuery.style(elem,type,value,extra)}),type,chainable?margin:undefined,chainable)}}))}));jQuery.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],(function(_i,type){jQuery.fn[type]=function(fn){return this.on(type,fn)}}));jQuery.fn.extend({bind:function(types,data,fn){return this.on(types,null,data,fn)},unbind:function(types,fn){return this.off(types,null,fn)},delegate:function(selector,types,data,fn){return this.on(types,selector,data,fn)},undelegate:function(selector,types,fn){return arguments.length===1?this.off(selector,"**"):this.off(types,selector||"**",fn)},hover:function(fnOver,fnOut){return this.on("mouseenter",fnOver).on("mouseleave",fnOut||fnOver)}});jQuery.each(("blur focus focusin focusout resize scroll click dblclick "+"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave "+"change select submit keydown keypress keyup contextmenu").split(" "),(function(_i,name){jQuery.fn[name]=function(data,fn){return arguments.length>0?this.on(name,null,data,fn):this.trigger(name)}}));var rtrim=/^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;jQuery.proxy=function(fn,context){var tmp,args,proxy;if(typeof context==="string"){tmp=fn[context];context=fn;fn=tmp}if(!isFunction(fn)){return undefined}args=slice.call(arguments,2);proxy=function(){return fn.apply(context||this,args.concat(slice.call(arguments)))};proxy.guid=fn.guid=fn.guid||jQuery.guid++;return proxy};jQuery.holdReady=function(hold){if(hold){jQuery.readyWait++}else{jQuery.ready(true)}};jQuery.isArray=Array.isArray;jQuery.parseJSON=JSON.parse;jQuery.nodeName=nodeName;jQuery.isFunction=isFunction;jQuery.isWindow=isWindow;jQuery.camelCase=camelCase;jQuery.type=toType;jQuery.now=Date.now;jQuery.isNumeric=function(obj){var type=jQuery.type(obj);return(type==="number"||type==="string")&&!isNaN(obj-parseFloat(obj))};jQuery.trim=function(text){return text==null?"":(text+"").replace(rtrim,"$1")};if(typeof define==="function"&&define.amd){define("jquery",[],(function(){return jQuery}))}var _jQuery=window.jQuery,_$=window.$;jQuery.noConflict=function(deep){if(window.$===jQuery){window.$=_$}if(deep&&window.jQuery===jQuery){window.jQuery=_jQuery}return jQuery};if(typeof noGlobal==="undefined"){window.jQuery=window.$=jQuery}return jQuery}));(function(factory){"use strict";if(typeof define==="function"&&define.amd){define(["jquery"],factory)}else{factory(jQuery)}})((function($){"use strict";$.ui=$.ui||{};return $.ui.version="1.14.1"}));
/*!
 * jQuery UI Widget 1.14.1
 * https://jqueryui.com
 *
 * Copyright OpenJS Foundation and other contributors
 * Released under the MIT license.
 * https://jquery.org/license
 */
(function(factory){"use strict";if(typeof define==="function"&&define.amd){define(["jquery","./version"],factory)}else{factory(jQuery)}})((function($){"use strict";var widgetUuid=0;var widgetHasOwnProperty=Array.prototype.hasOwnProperty;var widgetSlice=Array.prototype.slice;$.cleanData=function(orig){return function(elems){var events,elem,i;for(i=0;(elem=elems[i])!=null;i++){events=$._data(elem,"events");if(events&&events.remove){$(elem).triggerHandler("remove")}}orig(elems)}}($.cleanData);$.widget=function(name,base,prototype){var existingConstructor,constructor,basePrototype;var proxiedPrototype={};var namespace=name.split(".")[0];name=name.split(".")[1];if(name==="__proto__"||name==="constructor"){return $.error("Invalid widget name: "+name)}var fullName=namespace+"-"+name;if(!prototype){prototype=base;base=$.Widget}if(Array.isArray(prototype)){prototype=$.extend.apply(null,[{}].concat(prototype))}$.expr.pseudos[fullName.toLowerCase()]=function(elem){return!!$.data(elem,fullName)};$[namespace]=$[namespace]||{};existingConstructor=$[namespace][name];constructor=$[namespace][name]=function(options,element){if(!this||!this._createWidget){return new constructor(options,element)}if(arguments.length){this._createWidget(options,element)}};$.extend(constructor,existingConstructor,{version:prototype.version,_proto:$.extend({},prototype),_childConstructors:[]});basePrototype=new base;basePrototype.options=$.widget.extend({},basePrototype.options);$.each(prototype,(function(prop,value){if(typeof value!=="function"){proxiedPrototype[prop]=value;return}proxiedPrototype[prop]=function(){function _super(){return base.prototype[prop].apply(this,arguments)}function _superApply(args){return base.prototype[prop].apply(this,args)}return function(){var __super=this._super;var __superApply=this._superApply;var returnValue;this._super=_super;this._superApply=_superApply;returnValue=value.apply(this,arguments);this._super=__super;this._superApply=__superApply;return returnValue}}()}));constructor.prototype=$.widget.extend(basePrototype,{widgetEventPrefix:existingConstructor?basePrototype.widgetEventPrefix||name:name},proxiedPrototype,{constructor:constructor,namespace:namespace,widgetName:name,widgetFullName:fullName});if(existingConstructor){$.each(existingConstructor._childConstructors,(function(i,child){var childPrototype=child.prototype;$.widget(childPrototype.namespace+"."+childPrototype.widgetName,constructor,child._proto)}));delete existingConstructor._childConstructors}else{base._childConstructors.push(constructor)}$.widget.bridge(name,constructor);return constructor};$.widget.extend=function(target){var input=widgetSlice.call(arguments,1);var inputIndex=0;var inputLength=input.length;var key;var value;for(;inputIndex<inputLength;inputIndex++){for(key in input[inputIndex]){value=input[inputIndex][key];if(widgetHasOwnProperty.call(input[inputIndex],key)&&value!==undefined){if($.isPlainObject(value)){target[key]=$.isPlainObject(target[key])?$.widget.extend({},target[key],value):$.widget.extend({},value)}else{target[key]=value}}}}return target};$.widget.bridge=function(name,object){var fullName=object.prototype.widgetFullName||name;$.fn[name]=function(options){var isMethodCall=typeof options==="string";var args=widgetSlice.call(arguments,1);var returnValue=this;if(isMethodCall){if(!this.length&&options==="instance"){returnValue=undefined}else{this.each((function(){var methodValue;var instance=$.data(this,fullName);if(options==="instance"){returnValue=instance;return false}if(!instance){return $.error("cannot call methods on "+name+" prior to initialization; "+"attempted to call method '"+options+"'")}if(typeof instance[options]!=="function"||options.charAt(0)==="_"){return $.error("no such method '"+options+"' for "+name+" widget instance")}methodValue=instance[options].apply(instance,args);if(methodValue!==instance&&methodValue!==undefined){returnValue=methodValue&&methodValue.jquery?returnValue.pushStack(methodValue.get()):methodValue;return false}}))}}else{if(args.length){options=$.widget.extend.apply(null,[options].concat(args))}this.each((function(){var instance=$.data(this,fullName);if(instance){instance.option(options||{});if(instance._init){instance._init()}}else{$.data(this,fullName,new object(options,this))}}))}return returnValue}};$.Widget=function(){};$.Widget._childConstructors=[];$.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:false,create:null},_createWidget:function(options,element){element=$(element||this.defaultElement||this)[0];this.element=$(element);this.uuid=widgetUuid++;this.eventNamespace="."+this.widgetName+this.uuid;this.bindings=$();this.hoverable=$();this.focusable=$();this.classesElementLookup={};if(element!==this){$.data(element,this.widgetFullName,this);this._on(true,this.element,{remove:function(event){if(event.target===element){this.destroy()}}});this.document=$(element.style?element.ownerDocument:element.document||element);this.window=$(this.document[0].defaultView||this.document[0].parentWindow)}this.options=$.widget.extend({},this.options,this._getCreateOptions(),options);this._create();if(this.options.disabled){this._setOptionDisabled(this.options.disabled)}this._trigger("create",null,this._getCreateEventData());this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:$.noop,_create:$.noop,_init:$.noop,destroy:function(){var that=this;this._destroy();$.each(this.classesElementLookup,(function(key,value){that._removeClass(value,key)}));this.element.off(this.eventNamespace).removeData(this.widgetFullName);this.widget().off(this.eventNamespace).removeAttr("aria-disabled");this.bindings.off(this.eventNamespace)},_destroy:$.noop,widget:function(){return this.element},option:function(key,value){var options=key;var parts;var curOption;var i;if(arguments.length===0){return $.widget.extend({},this.options)}if(typeof key==="string"){options={};parts=key.split(".");key=parts.shift();if(parts.length){curOption=options[key]=$.widget.extend({},this.options[key]);for(i=0;i<parts.length-1;i++){curOption[parts[i]]=curOption[parts[i]]||{};curOption=curOption[parts[i]]}key=parts.pop();if(arguments.length===1){return curOption[key]===undefined?null:curOption[key]}curOption[key]=value}else{if(arguments.length===1){return this.options[key]===undefined?null:this.options[key]}options[key]=value}}this._setOptions(options);return this},_setOptions:function(options){var key;for(key in options){this._setOption(key,options[key])}return this},_setOption:function(key,value){if(key==="classes"){this._setOptionClasses(value)}this.options[key]=value;if(key==="disabled"){this._setOptionDisabled(value)}return this},_setOptionClasses:function(value){var classKey,elements,currentElements;for(classKey in value){currentElements=this.classesElementLookup[classKey];if(value[classKey]===this.options.classes[classKey]||!currentElements||!currentElements.length){continue}elements=$(currentElements.get());this._removeClass(currentElements,classKey);elements.addClass(this._classes({element:elements,keys:classKey,classes:value,add:true}))}},_setOptionDisabled:function(value){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!value);if(value){this._removeClass(this.hoverable,null,"ui-state-hover");this._removeClass(this.focusable,null,"ui-state-focus")}},enable:function(){return this._setOptions({disabled:false})},disable:function(){return this._setOptions({disabled:true})},_classes:function(options){var full=[];var that=this;options=$.extend({element:this.element,classes:this.options.classes||{}},options);function bindRemoveEvent(){var nodesToBind=[];options.element.each((function(_,element){var isTracked=$.map(that.classesElementLookup,(function(elements){return elements})).some((function(elements){return elements.is(element)}));if(!isTracked){nodesToBind.push(element)}}));that._on($(nodesToBind),{remove:"_untrackClassesElement"})}function processClassString(classes,checkOption){var current,i;for(i=0;i<classes.length;i++){current=that.classesElementLookup[classes[i]]||$();if(options.add){bindRemoveEvent();current=$($.uniqueSort(current.get().concat(options.element.get())))}else{current=$(current.not(options.element).get())}that.classesElementLookup[classes[i]]=current;full.push(classes[i]);if(checkOption&&options.classes[classes[i]]){full.push(options.classes[classes[i]])}}}if(options.keys){processClassString(options.keys.match(/\S+/g)||[],true)}if(options.extra){processClassString(options.extra.match(/\S+/g)||[])}return full.join(" ")},_untrackClassesElement:function(event){var that=this;$.each(that.classesElementLookup,(function(key,value){if($.inArray(event.target,value)!==-1){that.classesElementLookup[key]=$(value.not(event.target).get())}}));this._off($(event.target))},_removeClass:function(element,keys,extra){return this._toggleClass(element,keys,extra,false)},_addClass:function(element,keys,extra){return this._toggleClass(element,keys,extra,true)},_toggleClass:function(element,keys,extra,add){add=typeof add==="boolean"?add:extra;var shift=typeof element==="string"||element===null,options={extra:shift?keys:extra,keys:shift?element:keys,element:shift?this.element:element,add:add};options.element.toggleClass(this._classes(options),add);return this},_on:function(suppressDisabledCheck,element,handlers){var delegateElement;var instance=this;if(typeof suppressDisabledCheck!=="boolean"){handlers=element;element=suppressDisabledCheck;suppressDisabledCheck=false}if(!handlers){handlers=element;element=this.element;delegateElement=this.widget()}else{element=delegateElement=$(element);this.bindings=this.bindings.add(element)}$.each(handlers,(function(event,handler){function handlerProxy(){if(!suppressDisabledCheck&&(instance.options.disabled===true||$(this).hasClass("ui-state-disabled"))){return}return(typeof handler==="string"?instance[handler]:handler).apply(instance,arguments)}if(typeof handler!=="string"){handlerProxy.guid=handler.guid=handler.guid||handlerProxy.guid||$.guid++}var match=event.match(/^([\w:-]*)\s*(.*)$/);var eventName=match[1]+instance.eventNamespace;var selector=match[2];if(selector){delegateElement.on(eventName,selector,handlerProxy)}else{element.on(eventName,handlerProxy)}}))},_off:function(element,eventName){eventName=(eventName||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace;element.off(eventName);this.bindings=$(this.bindings.not(element).get());this.focusable=$(this.focusable.not(element).get());this.hoverable=$(this.hoverable.not(element).get())},_delay:function(handler,delay){function handlerProxy(){return(typeof handler==="string"?instance[handler]:handler).apply(instance,arguments)}var instance=this;return setTimeout(handlerProxy,delay||0)},_hoverable:function(element){this.hoverable=this.hoverable.add(element);this._on(element,{mouseenter:function(event){this._addClass($(event.currentTarget),null,"ui-state-hover")},mouseleave:function(event){this._removeClass($(event.currentTarget),null,"ui-state-hover")}})},_focusable:function(element){this.focusable=this.focusable.add(element);this._on(element,{focusin:function(event){this._addClass($(event.currentTarget),null,"ui-state-focus")},focusout:function(event){this._removeClass($(event.currentTarget),null,"ui-state-focus")}})},_trigger:function(type,event,data){var prop,orig;var callback=this.options[type];data=data||{};event=$.Event(event);event.type=(type===this.widgetEventPrefix?type:this.widgetEventPrefix+type).toLowerCase();event.target=this.element[0];orig=event.originalEvent;if(orig){for(prop in orig){if(!(prop in event)){event[prop]=orig[prop]}}}this.element.trigger(event,data);return!(typeof callback==="function"&&callback.apply(this.element[0],[event].concat(data))===false||event.isDefaultPrevented())}};$.each({show:"fadeIn",hide:"fadeOut"},(function(method,defaultEffect){$.Widget.prototype["_"+method]=function(element,options,callback){if(typeof options==="string"){options={effect:options}}var hasOptions;var effectName=!options?method:options===true||typeof options==="number"?defaultEffect:options.effect||defaultEffect;options=options||{};if(typeof options==="number"){options={duration:options}}else if(options===true){options={}}hasOptions=!$.isEmptyObject(options);options.complete=callback;if(options.delay){element.delay(options.delay)}if(hasOptions&&$.effects&&$.effects.effect[effectName]){element[method](options)}else if(effectName!==method&&element[effectName]){element[effectName](options.duration,options.easing,callback)}else{element.queue((function(next){$(this)[method]();if(callback){callback.call(element[0])}next()}))}}}));return $.widget}));(function(factory){"use strict";if(typeof define==="function"&&define.amd){define(["jquery","./version"],factory)}else{factory(jQuery)}})((function($){"use strict";return $.ui.plugin={add:function(module,option,set){var i,proto=$.ui[module].prototype;for(i in set){proto.plugins[i]=proto.plugins[i]||[];proto.plugins[i].push([option,set[i]])}},call:function(instance,name,args,allowDisconnected){var i,set=instance.plugins[name];if(!set){return}if(!allowDisconnected&&(!instance.element[0].parentNode||instance.element[0].parentNode.nodeType===11)){return}for(i=0;i<set.length;i++){if(instance.options[set[i][0]]){set[i][1].apply(instance.element,args)}}}}}));
/*!
 * jQuery UI Scroll Parent 1.14.1
 * https://jqueryui.com
 *
 * Copyright OpenJS Foundation and other contributors
 * Released under the MIT license.
 * https://jquery.org/license
 */
(function(factory){"use strict";if(typeof define==="function"&&define.amd){define(["jquery","./version"],factory)}else{factory(jQuery)}})((function($){"use strict";return $.fn.scrollParent=function(includeHidden){var position=this.css("position"),excludeStaticParent=position==="absolute",overflowRegex=includeHidden?/(auto|scroll|hidden)/:/(auto|scroll)/,scrollParent=this.parents().filter((function(){var parent=$(this);if(excludeStaticParent&&parent.css("position")==="static"){return false}return overflowRegex.test(parent.css("overflow")+parent.css("overflow-y")+parent.css("overflow-x"))})).eq(0);return position==="fixed"||!scrollParent.length?$(this[0].ownerDocument||document):scrollParent}}));
/*!
 * jQuery UI Position 1.14.1
 * https://jqueryui.com
 *
 * Copyright OpenJS Foundation and other contributors
 * Released under the MIT license.
 * https://jquery.org/license
 *
 * https://api.jqueryui.com/position/
 */
(function(factory){"use strict";if(typeof define==="function"&&define.amd){define(["jquery","./version"],factory)}else{factory(jQuery)}})((function($){"use strict";(function(){var cachedScrollbarWidth,max=Math.max,abs=Math.abs,rhorizontal=/left|center|right/,rvertical=/top|center|bottom/,roffset=/[\+\-]\d+(\.[\d]+)?%?/,rposition=/^\w+/,rpercent=/%$/,_position=$.fn.position;function getOffsets(offsets,width,height){return[parseFloat(offsets[0])*(rpercent.test(offsets[0])?width/100:1),parseFloat(offsets[1])*(rpercent.test(offsets[1])?height/100:1)]}function parseCss(element,property){return parseInt($.css(element,property),10)||0}function isWindow(obj){return obj!=null&&obj===obj.window}function getDimensions(elem){var raw=elem[0];if(raw.nodeType===9){return{width:elem.width(),height:elem.height(),offset:{top:0,left:0}}}if(isWindow(raw)){return{width:elem.width(),height:elem.height(),offset:{top:elem.scrollTop(),left:elem.scrollLeft()}}}if(raw.preventDefault){return{width:0,height:0,offset:{top:raw.pageY,left:raw.pageX}}}return{width:elem.outerWidth(),height:elem.outerHeight(),offset:elem.offset()}}$.position={scrollbarWidth:function(){if(cachedScrollbarWidth!==undefined){return cachedScrollbarWidth}var w1,w2,div=$("<div style="+"'display:block;position:absolute;width:200px;height:200px;overflow:hidden;'>"+"<div style='height:300px;width:auto;'></div></div>"),innerDiv=div.children()[0];$("body").append(div);w1=innerDiv.offsetWidth;div.css("overflow","scroll");w2=innerDiv.offsetWidth;if(w1===w2){w2=div[0].clientWidth}div.remove();return cachedScrollbarWidth=w1-w2},getScrollInfo:function(within){var overflowX=within.isWindow||within.isDocument?"":within.element.css("overflow-x"),overflowY=within.isWindow||within.isDocument?"":within.element.css("overflow-y"),hasOverflowX=overflowX==="scroll"||overflowX==="auto"&&within.width<within.element[0].scrollWidth,hasOverflowY=overflowY==="scroll"||overflowY==="auto"&&within.height<within.element[0].scrollHeight;return{width:hasOverflowY?$.position.scrollbarWidth():0,height:hasOverflowX?$.position.scrollbarWidth():0}},getWithinInfo:function(element){var withinElement=$(element||window),isElemWindow=isWindow(withinElement[0]),isDocument=!!withinElement[0]&&withinElement[0].nodeType===9,hasOffset=!isElemWindow&&!isDocument;return{element:withinElement,isWindow:isElemWindow,isDocument:isDocument,offset:hasOffset?$(element).offset():{left:0,top:0},scrollLeft:withinElement.scrollLeft(),scrollTop:withinElement.scrollTop(),width:withinElement.outerWidth(),height:withinElement.outerHeight()}}};$.fn.position=function(options){if(!options||!options.of){return _position.apply(this,arguments)}options=$.extend({},options);var atOffset,targetWidth,targetHeight,targetOffset,basePosition,dimensions,target=typeof options.of==="string"?$(document).find(options.of):$(options.of),within=$.position.getWithinInfo(options.within),scrollInfo=$.position.getScrollInfo(within),collision=(options.collision||"flip").split(" "),offsets={};dimensions=getDimensions(target);if(target[0].preventDefault){options.at="left top"}targetWidth=dimensions.width;targetHeight=dimensions.height;targetOffset=dimensions.offset;basePosition=$.extend({},targetOffset);$.each(["my","at"],(function(){var pos=(options[this]||"").split(" "),horizontalOffset,verticalOffset;if(pos.length===1){pos=rhorizontal.test(pos[0])?pos.concat(["center"]):rvertical.test(pos[0])?["center"].concat(pos):["center","center"]}pos[0]=rhorizontal.test(pos[0])?pos[0]:"center";pos[1]=rvertical.test(pos[1])?pos[1]:"center";horizontalOffset=roffset.exec(pos[0]);verticalOffset=roffset.exec(pos[1]);offsets[this]=[horizontalOffset?horizontalOffset[0]:0,verticalOffset?verticalOffset[0]:0];options[this]=[rposition.exec(pos[0])[0],rposition.exec(pos[1])[0]]}));if(collision.length===1){collision[1]=collision[0]}if(options.at[0]==="right"){basePosition.left+=targetWidth}else if(options.at[0]==="center"){basePosition.left+=targetWidth/2}if(options.at[1]==="bottom"){basePosition.top+=targetHeight}else if(options.at[1]==="center"){basePosition.top+=targetHeight/2}atOffset=getOffsets(offsets.at,targetWidth,targetHeight);basePosition.left+=atOffset[0];basePosition.top+=atOffset[1];return this.each((function(){var collisionPosition,using,elem=$(this),elemWidth=elem.outerWidth(),elemHeight=elem.outerHeight(),marginLeft=parseCss(this,"marginLeft"),marginTop=parseCss(this,"marginTop"),collisionWidth=elemWidth+marginLeft+parseCss(this,"marginRight")+scrollInfo.width,collisionHeight=elemHeight+marginTop+parseCss(this,"marginBottom")+scrollInfo.height,position=$.extend({},basePosition),myOffset=getOffsets(offsets.my,elem.outerWidth(),elem.outerHeight());if(options.my[0]==="right"){position.left-=elemWidth}else if(options.my[0]==="center"){position.left-=elemWidth/2}if(options.my[1]==="bottom"){position.top-=elemHeight}else if(options.my[1]==="center"){position.top-=elemHeight/2}position.left+=myOffset[0];position.top+=myOffset[1];collisionPosition={marginLeft:marginLeft,marginTop:marginTop};$.each(["left","top"],(function(i,dir){if($.ui.position[collision[i]]){$.ui.position[collision[i]][dir](position,{targetWidth:targetWidth,targetHeight:targetHeight,elemWidth:elemWidth,elemHeight:elemHeight,collisionPosition:collisionPosition,collisionWidth:collisionWidth,collisionHeight:collisionHeight,offset:[atOffset[0]+myOffset[0],atOffset[1]+myOffset[1]],my:options.my,at:options.at,within:within,elem:elem})}}));if(options.using){using=function(props){var left=targetOffset.left-position.left,right=left+targetWidth-elemWidth,top=targetOffset.top-position.top,bottom=top+targetHeight-elemHeight,feedback={target:{element:target,left:targetOffset.left,top:targetOffset.top,width:targetWidth,height:targetHeight},element:{element:elem,left:position.left,top:position.top,width:elemWidth,height:elemHeight},horizontal:right<0?"left":left>0?"right":"center",vertical:bottom<0?"top":top>0?"bottom":"middle"};if(targetWidth<elemWidth&&abs(left+right)<targetWidth){feedback.horizontal="center"}if(targetHeight<elemHeight&&abs(top+bottom)<targetHeight){feedback.vertical="middle"}if(max(abs(left),abs(right))>max(abs(top),abs(bottom))){feedback.important="horizontal"}else{feedback.important="vertical"}options.using.call(this,props,feedback)}}elem.offset($.extend(position,{using:using}))}))};$.ui.position={fit:{left:function(position,data){var within=data.within,withinOffset=within.isWindow?within.scrollLeft:within.offset.left,outerWidth=within.width,collisionPosLeft=position.left-data.collisionPosition.marginLeft,overLeft=withinOffset-collisionPosLeft,overRight=collisionPosLeft+data.collisionWidth-outerWidth-withinOffset,newOverRight;if(data.collisionWidth>outerWidth){if(overLeft>0&&overRight<=0){newOverRight=position.left+overLeft+data.collisionWidth-outerWidth-withinOffset;position.left+=overLeft-newOverRight}else if(overRight>0&&overLeft<=0){position.left=withinOffset}else{if(overLeft>overRight){position.left=withinOffset+outerWidth-data.collisionWidth}else{position.left=withinOffset}}}else if(overLeft>0){position.left+=overLeft}else if(overRight>0){position.left-=overRight}else{position.left=max(position.left-collisionPosLeft,position.left)}},top:function(position,data){var within=data.within,withinOffset=within.isWindow?within.scrollTop:within.offset.top,outerHeight=data.within.height,collisionPosTop=position.top-data.collisionPosition.marginTop,overTop=withinOffset-collisionPosTop,overBottom=collisionPosTop+data.collisionHeight-outerHeight-withinOffset,newOverBottom;if(data.collisionHeight>outerHeight){if(overTop>0&&overBottom<=0){newOverBottom=position.top+overTop+data.collisionHeight-outerHeight-withinOffset;position.top+=overTop-newOverBottom}else if(overBottom>0&&overTop<=0){position.top=withinOffset}else{if(overTop>overBottom){position.top=withinOffset+outerHeight-data.collisionHeight}else{position.top=withinOffset}}}else if(overTop>0){position.top+=overTop}else if(overBottom>0){position.top-=overBottom}else{position.top=max(position.top-collisionPosTop,position.top)}}},flip:{left:function(position,data){var within=data.within,withinOffset=within.offset.left+within.scrollLeft,outerWidth=within.width,offsetLeft=within.isWindow?within.scrollLeft:within.offset.left,collisionPosLeft=position.left-data.collisionPosition.marginLeft,overLeft=collisionPosLeft-offsetLeft,overRight=collisionPosLeft+data.collisionWidth-outerWidth-offsetLeft,myOffset=data.my[0]==="left"?-data.elemWidth:data.my[0]==="right"?data.elemWidth:0,atOffset=data.at[0]==="left"?data.targetWidth:data.at[0]==="right"?-data.targetWidth:0,offset=-2*data.offset[0],newOverRight,newOverLeft;if(overLeft<0){newOverRight=position.left+myOffset+atOffset+offset+data.collisionWidth-outerWidth-withinOffset;if(newOverRight<0||newOverRight<abs(overLeft)){position.left+=myOffset+atOffset+offset}}else if(overRight>0){newOverLeft=position.left-data.collisionPosition.marginLeft+myOffset+atOffset+offset-offsetLeft;if(newOverLeft>0||abs(newOverLeft)<overRight){position.left+=myOffset+atOffset+offset}}},top:function(position,data){var within=data.within,withinOffset=within.offset.top+within.scrollTop,outerHeight=within.height,offsetTop=within.isWindow?within.scrollTop:within.offset.top,collisionPosTop=position.top-data.collisionPosition.marginTop,overTop=collisionPosTop-offsetTop,overBottom=collisionPosTop+data.collisionHeight-outerHeight-offsetTop,top=data.my[1]==="top",myOffset=top?-data.elemHeight:data.my[1]==="bottom"?data.elemHeight:0,atOffset=data.at[1]==="top"?data.targetHeight:data.at[1]==="bottom"?-data.targetHeight:0,offset=-2*data.offset[1],newOverTop,newOverBottom;if(overTop<0){newOverBottom=position.top+myOffset+atOffset+offset+data.collisionHeight-outerHeight-withinOffset;if(newOverBottom<0||newOverBottom<abs(overTop)){position.top+=myOffset+atOffset+offset}}else if(overBottom>0){newOverTop=position.top-data.collisionPosition.marginTop+myOffset+atOffset+offset-offsetTop;if(newOverTop>0||abs(newOverTop)<overBottom){position.top+=myOffset+atOffset+offset}}}},flipfit:{left:function(){$.ui.position.flip.left.apply(this,arguments);$.ui.position.fit.left.apply(this,arguments)},top:function(){$.ui.position.flip.top.apply(this,arguments);$.ui.position.fit.top.apply(this,arguments)}}}})();return $.ui.position}));
/*!
 * jQuery UI :data 1.14.1
 * https://jqueryui.com
 *
 * Copyright OpenJS Foundation and other contributors
 * Released under the MIT license.
 * https://jquery.org/license
 */
(function(factory){"use strict";if(typeof define==="function"&&define.amd){define(["jquery","./version"],factory)}else{factory(jQuery)}})((function($){"use strict";return $.extend($.expr.pseudos,{data:$.expr.createPseudo((function(dataName){return function(elem){return!!$.data(elem,dataName)}}))})}));
/*!
 * jQuery UI Keycode 1.14.1
 * https://jqueryui.com
 *
 * Copyright OpenJS Foundation and other contributors
 * Released under the MIT license.
 * https://jquery.org/license
 */
(function(factory){"use strict";if(typeof define==="function"&&define.amd){define(["jquery","./version"],factory)}else{factory(jQuery)}})((function($){"use strict";return $.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}));
/*!
 * jQuery UI Unique ID 1.14.1
 * https://jqueryui.com
 *
 * Copyright OpenJS Foundation and other contributors
 * Released under the MIT license.
 * https://jquery.org/license
 */
(function(factory){"use strict";if(typeof define==="function"&&define.amd){define(["jquery","./version"],factory)}else{factory(jQuery)}})((function($){"use strict";return $.fn.extend({uniqueId:function(){var uuid=0;return function(){return this.each((function(){if(!this.id){this.id="ui-id-"+ ++uuid}}))}}(),removeUniqueId:function(){return this.each((function(){if(/^ui-id-\d+$/.test(this.id)){$(this).removeAttr("id")}}))}})}));
/*!
 * jQuery UI Mouse 1.14.1
 * https://jqueryui.com
 *
 * Copyright OpenJS Foundation and other contributors
 * Released under the MIT license.
 * https://jquery.org/license
 */
(function(factory){"use strict";if(typeof define==="function"&&define.amd){define(["jquery","../version","../widget"],factory)}else{factory(jQuery)}})((function($){"use strict";var mouseHandled=false;$(document).on("mouseup",(function(){mouseHandled=false}));return $.widget("ui.mouse",{version:"1.14.1",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var that=this;this.element.on("mousedown."+this.widgetName,(function(event){return that._mouseDown(event)})).on("click."+this.widgetName,(function(event){if(true===$.data(event.target,that.widgetName+".preventClickEvent")){$.removeData(event.target,that.widgetName+".preventClickEvent");event.stopImmediatePropagation();return false}}));this.started=false},_mouseDestroy:function(){this.element.off("."+this.widgetName);if(this._mouseMoveDelegate){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)}},_mouseDown:function(event){if(mouseHandled){return}this._mouseMoved=false;if(this._mouseStarted){this._mouseUp(event)}this._mouseDownEvent=event;var that=this,btnIsLeft=event.which===1,elIsCancel=typeof this.options.cancel==="string"?$(event.target).closest(this.options.cancel).length:false;if(!btnIsLeft||elIsCancel||!this._mouseCapture(event)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout((function(){that.mouseDelayMet=true}),this.options.delay)}if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=this._mouseStart(event)!==false;if(!this._mouseStarted){event.preventDefault();return true}}if(true===$.data(event.target,this.widgetName+".preventClickEvent")){$.removeData(event.target,this.widgetName+".preventClickEvent")}this._mouseMoveDelegate=function(event){return that._mouseMove(event)};this._mouseUpDelegate=function(event){return that._mouseUp(event)};this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate);event.preventDefault();mouseHandled=true;return true},_mouseMove:function(event){if(this._mouseMoved&&!event.which){if(event.originalEvent.altKey||event.originalEvent.ctrlKey||event.originalEvent.metaKey||event.originalEvent.shiftKey){this.ignoreMissingWhich=true}else if(!this.ignoreMissingWhich){return this._mouseUp(event)}}if(event.which||event.button){this._mouseMoved=true}if(this._mouseStarted){this._mouseDrag(event);return event.preventDefault()}if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=this._mouseStart(this._mouseDownEvent,event)!==false;if(this._mouseStarted){this._mouseDrag(event)}else{this._mouseUp(event)}}return!this._mouseStarted},_mouseUp:function(event){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;if(event.target===this._mouseDownEvent.target){$.data(event.target,this.widgetName+".preventClickEvent",true)}this._mouseStop(event)}if(this._mouseDelayTimer){clearTimeout(this._mouseDelayTimer);delete this._mouseDelayTimer}this.ignoreMissingWhich=false;mouseHandled=false;event.preventDefault()},_mouseDistanceMet:function(event){return Math.max(Math.abs(this._mouseDownEvent.pageX-event.pageX),Math.abs(this._mouseDownEvent.pageY-event.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})}));
/*!
 * jQuery UI Draggable 1.14.1
 * https://jqueryui.com
 *
 * Copyright OpenJS Foundation and other contributors
 * Released under the MIT license.
 * https://jquery.org/license
 */
(function(factory){"use strict";if(typeof define==="function"&&define.amd){define(["jquery","./mouse","../data","../plugin","../scroll-parent","../version","../widget"],factory)}else{factory(jQuery)}})((function($){"use strict";$.widget("ui.draggable",$.ui.mouse,{version:"1.14.1",widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false,drag:null,start:null,stop:null},_create:function(){if(this.options.helper==="original"){this._setPositionRelative()}if(this.options.addClasses){this._addClass("ui-draggable")}this._setHandleClassName();this._mouseInit()},_setOption:function(key,value){this._super(key,value);if(key==="handle"){this._removeHandleClassName();this._setHandleClassName()}},_destroy:function(){if((this.helper||this.element).is(".ui-draggable-dragging")){this.destroyOnClear=true;return}this._removeHandleClassName();this._mouseDestroy()},_mouseCapture:function(event){var o=this.options;if(this.helper||o.disabled||$(event.target).closest(".ui-resizable-handle").length>0){return false}this.handle=this._getHandle(event);if(!this.handle){return false}this._blurActiveElement(event);this._blockFrames(o.iframeFix===true?"iframe":o.iframeFix);return true},_blockFrames:function(selector){this.iframeBlocks=this.document.find(selector).map((function(){var iframe=$(this);return $("<div>").css("position","absolute").appendTo(iframe.parent()).outerWidth(iframe.outerWidth()).outerHeight(iframe.outerHeight()).offset(iframe.offset())[0]}))},_unblockFrames:function(){if(this.iframeBlocks){this.iframeBlocks.remove();delete this.iframeBlocks}},_blurActiveElement:function(event){var activeElement=this.document[0].activeElement,target=$(event.target);if(target.closest(activeElement).length){return}$(activeElement).trigger("blur")},_mouseStart:function(event){var o=this.options;this.helper=this._createHelper(event);this._addClass(this.helper,"ui-draggable-dragging");this._cacheHelperProportions();if($.ui.ddmanager){$.ui.ddmanager.current=this}this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent(true);this.offsetParent=this.helper.offsetParent();this.hasFixedAncestor=this.helper.parents().filter((function(){return $(this).css("position")==="fixed"})).length>0;this.positionAbs=this.element.offset();this._refreshOffsets(event);this.originalPosition=this.position=this._generatePosition(event,false);this.originalPageX=event.pageX;this.originalPageY=event.pageY;if(o.cursorAt){this._adjustOffsetFromHelper(o.cursorAt)}this._setContainment();if(this._trigger("start",event)===false){this._clear();return false}this._cacheHelperProportions();if($.ui.ddmanager&&!o.dropBehaviour){$.ui.ddmanager.prepareOffsets(this,event)}this._mouseDrag(event,true);if($.ui.ddmanager){$.ui.ddmanager.dragStart(this,event)}return true},_refreshOffsets:function(event){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:false,parent:this._getParentOffset(),relative:this._getRelativeOffset()};this.offset.click={left:event.pageX-this.offset.left,top:event.pageY-this.offset.top}},_mouseDrag:function(event,noPropagation){if(this.hasFixedAncestor){this.offset.parent=this._getParentOffset()}this.position=this._generatePosition(event,true);this.positionAbs=this._convertPositionTo("absolute");if(!noPropagation){var ui=this._uiHash();if(this._trigger("drag",event,ui)===false){this._mouseUp(new $.Event("mouseup",event));return false}this.position=ui.position}this.helper[0].style.left=this.position.left+"px";this.helper[0].style.top=this.position.top+"px";if($.ui.ddmanager){$.ui.ddmanager.drag(this,event)}return false},_mouseStop:function(event){var that=this,dropped=false;if($.ui.ddmanager&&!this.options.dropBehaviour){dropped=$.ui.ddmanager.drop(this,event)}if(this.dropped){dropped=this.dropped;this.dropped=false}if(this.options.revert==="invalid"&&!dropped||this.options.revert==="valid"&&dropped||this.options.revert===true||typeof this.options.revert==="function"&&this.options.revert.call(this.element,dropped)){$(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),(function(){if(that._trigger("stop",event)!==false){that._clear()}}))}else{if(this._trigger("stop",event)!==false){this._clear()}}return false},_mouseUp:function(event){this._unblockFrames();if($.ui.ddmanager){$.ui.ddmanager.dragStop(this,event)}if(this.handleElement.is(event.target)){this.element.trigger("focus")}return $.ui.mouse.prototype._mouseUp.call(this,event)},cancel:function(){if(this.helper.is(".ui-draggable-dragging")){this._mouseUp(new $.Event("mouseup",{target:this.element[0]}))}else{this._clear()}return this},_getHandle:function(event){return this.options.handle?!!$(event.target).closest(this.element.find(this.options.handle)).length:true},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element;this._addClass(this.handleElement,"ui-draggable-handle")},_removeHandleClassName:function(){this._removeClass(this.handleElement,"ui-draggable-handle")},_createHelper:function(event){var o=this.options,helperIsFunction=typeof o.helper==="function",helper=helperIsFunction?$(o.helper.apply(this.element[0],[event])):o.helper==="clone"?this.element.clone().removeAttr("id"):this.element;if(!helper.parents("body").length){helper.appendTo(o.appendTo==="parent"?this.element[0].parentNode:o.appendTo)}if(helperIsFunction&&helper[0]===this.element[0]){this._setPositionRelative()}if(helper[0]!==this.element[0]&&!/(fixed|absolute)/.test(helper.css("position"))){helper.css("position","absolute")}return helper},_setPositionRelative:function(){if(!/^(?:r|a|f)/.test(this.element.css("position"))){this.element[0].style.position="relative"}},_adjustOffsetFromHelper:function(obj){if(typeof obj==="string"){obj=obj.split(" ")}if(Array.isArray(obj)){obj={left:+obj[0],top:+obj[1]||0}}if("left"in obj){this.offset.click.left=obj.left+this.margins.left}if("right"in obj){this.offset.click.left=this.helperProportions.width-obj.right+this.margins.left}if("top"in obj){this.offset.click.top=obj.top+this.margins.top}if("bottom"in obj){this.offset.click.top=this.helperProportions.height-obj.bottom+this.margins.top}},_isRootNode:function(element){return/(html|body)/i.test(element.tagName)||element===this.document[0]},_getParentOffset:function(){var po=this.offsetParent.offset(),document=this.document[0];if(this.cssPosition==="absolute"&&this.scrollParent[0]!==document&&$.contains(this.scrollParent[0],this.offsetParent[0])){po.left+=this.scrollParent.scrollLeft();po.top+=this.scrollParent.scrollTop()}if(this._isRootNode(this.offsetParent[0])){po={top:0,left:0}}return{top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition!=="relative"){return{top:0,left:0}}var p=this.element.position(),scrollIsRootNode=this._isRootNode(this.scrollParent[0]);return{top:p.top-(parseInt(this.helper.css("top"),10)||0)+(!scrollIsRootNode?this.scrollParent.scrollTop():0),left:p.left-(parseInt(this.helper.css("left"),10)||0)+(!scrollIsRootNode?this.scrollParent.scrollLeft():0)}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var isUserScrollable,c,ce,o=this.options,document=this.document[0];this.relativeContainer=null;if(!o.containment){this.containment=null;return}if(o.containment==="window"){this.containment=[$(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,$(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,$(window).scrollLeft()+$(window).width()-this.helperProportions.width-this.margins.left,$(window).scrollTop()+($(window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];return}if(o.containment==="document"){this.containment=[0,0,$(document).width()-this.helperProportions.width-this.margins.left,($(document).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];return}if(o.containment.constructor===Array){this.containment=o.containment;return}if(o.containment==="parent"){o.containment=this.helper[0].parentNode}c=$(o.containment);ce=c[0];if(!ce){return}isUserScrollable=/(scroll|auto)/.test(c.css("overflow"));this.containment=[(parseInt(c.css("borderLeftWidth"),10)||0)+(parseInt(c.css("paddingLeft"),10)||0),(parseInt(c.css("borderTopWidth"),10)||0)+(parseInt(c.css("paddingTop"),10)||0),(isUserScrollable?Math.max(ce.scrollWidth,ce.offsetWidth):ce.offsetWidth)-(parseInt(c.css("borderRightWidth"),10)||0)-(parseInt(c.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(isUserScrollable?Math.max(ce.scrollHeight,ce.offsetHeight):ce.offsetHeight)-(parseInt(c.css("borderBottomWidth"),10)||0)-(parseInt(c.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom];this.relativeContainer=c},_convertPositionTo:function(d,pos){if(!pos){pos=this.position}var mod=d==="absolute"?1:-1,scrollIsRootNode=this._isRootNode(this.scrollParent[0]);return{top:pos.top+this.offset.relative.top*mod+this.offset.parent.top*mod-(this.cssPosition==="fixed"?-this.offset.scroll.top:scrollIsRootNode?0:this.offset.scroll.top)*mod,left:pos.left+this.offset.relative.left*mod+this.offset.parent.left*mod-(this.cssPosition==="fixed"?-this.offset.scroll.left:scrollIsRootNode?0:this.offset.scroll.left)*mod}},_generatePosition:function(event,constrainPosition){var containment,co,top,left,o=this.options,scrollIsRootNode=this._isRootNode(this.scrollParent[0]),pageX=event.pageX,pageY=event.pageY;if(!scrollIsRootNode||!this.offset.scroll){this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}}if(constrainPosition){if(this.containment){if(this.relativeContainer){co=this.relativeContainer.offset();containment=[this.containment[0]+co.left,this.containment[1]+co.top,this.containment[2]+co.left,this.containment[3]+co.top]}else{containment=this.containment}if(event.pageX-this.offset.click.left<containment[0]){pageX=containment[0]+this.offset.click.left}if(event.pageY-this.offset.click.top<containment[1]){pageY=containment[1]+this.offset.click.top}if(event.pageX-this.offset.click.left>containment[2]){pageX=containment[2]+this.offset.click.left}if(event.pageY-this.offset.click.top>containment[3]){pageY=containment[3]+this.offset.click.top}}if(o.grid){top=o.grid[1]?this.originalPageY+Math.round((pageY-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY;pageY=containment?top-this.offset.click.top>=containment[1]||top-this.offset.click.top>containment[3]?top:top-this.offset.click.top>=containment[1]?top-o.grid[1]:top+o.grid[1]:top;left=o.grid[0]?this.originalPageX+Math.round((pageX-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX;pageX=containment?left-this.offset.click.left>=containment[0]||left-this.offset.click.left>containment[2]?left:left-this.offset.click.left>=containment[0]?left-o.grid[0]:left+o.grid[0]:left}if(o.axis==="y"){pageX=this.originalPageX}if(o.axis==="x"){pageY=this.originalPageY}}return{top:pageY-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(this.cssPosition==="fixed"?-this.offset.scroll.top:scrollIsRootNode?0:this.offset.scroll.top),left:pageX-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition==="fixed"?-this.offset.scroll.left:scrollIsRootNode?0:this.offset.scroll.left)}},_clear:function(){this._removeClass(this.helper,"ui-draggable-dragging");if(this.helper[0]!==this.element[0]&&!this.cancelHelperRemoval){this.helper.remove()}this.helper=null;this.cancelHelperRemoval=false;if(this.destroyOnClear){this.destroy()}},_trigger:function(type,event,ui){ui=ui||this._uiHash();$.ui.plugin.call(this,type,[event,ui,this],true);if(/^(drag|start|stop)/.test(type)){this.positionAbs=this._convertPositionTo("absolute");ui.offset=this.positionAbs}return $.Widget.prototype._trigger.call(this,type,event,ui)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}});$.ui.plugin.add("draggable","connectToSortable",{start:function(event,ui,draggable){var uiSortable=$.extend({},ui,{item:draggable.element});draggable.sortables=[];$(draggable.options.connectToSortable).each((function(){var sortable=$(this).sortable("instance");if(sortable&&!sortable.options.disabled){draggable.sortables.push(sortable);sortable.refreshPositions();sortable._trigger("activate",event,uiSortable)}}))},stop:function(event,ui,draggable){var uiSortable=$.extend({},ui,{item:draggable.element});draggable.cancelHelperRemoval=false;$.each(draggable.sortables,(function(){var sortable=this;if(sortable.isOver){sortable.isOver=0;draggable.cancelHelperRemoval=true;sortable.cancelHelperRemoval=false;sortable._storedCSS={position:sortable.placeholder.css("position"),top:sortable.placeholder.css("top"),left:sortable.placeholder.css("left")};sortable._mouseStop(event);sortable.options.helper=sortable.options._helper}else{sortable.cancelHelperRemoval=true;sortable._trigger("deactivate",event,uiSortable)}}))},drag:function(event,ui,draggable){$.each(draggable.sortables,(function(){var innermostIntersecting=false,sortable=this;sortable.positionAbs=draggable.positionAbs;sortable.helperProportions=draggable.helperProportions;sortable.offset.click=draggable.offset.click;if(sortable._intersectsWith(sortable.containerCache)){innermostIntersecting=true;$.each(draggable.sortables,(function(){this.positionAbs=draggable.positionAbs;this.helperProportions=draggable.helperProportions;this.offset.click=draggable.offset.click;if(this!==sortable&&this._intersectsWith(this.containerCache)&&$.contains(sortable.element[0],this.element[0])){innermostIntersecting=false}return innermostIntersecting}))}if(innermostIntersecting){if(!sortable.isOver){sortable.isOver=1;draggable._parent=ui.helper.parent();sortable.currentItem=ui.helper.appendTo(sortable.element).data("ui-sortable-item",true);sortable.options._helper=sortable.options.helper;sortable.options.helper=function(){return ui.helper[0]};event.target=sortable.currentItem[0];sortable._mouseCapture(event,true);sortable._mouseStart(event,true,true);sortable.offset.click.top=draggable.offset.click.top;sortable.offset.click.left=draggable.offset.click.left;sortable.offset.parent.left-=draggable.offset.parent.left-sortable.offset.parent.left;sortable.offset.parent.top-=draggable.offset.parent.top-sortable.offset.parent.top;draggable._trigger("toSortable",event);draggable.dropped=sortable.element;$.each(draggable.sortables,(function(){this.refreshPositions()}));draggable.currentItem=draggable.element;sortable.fromOutside=draggable}if(sortable.currentItem){sortable._mouseDrag(event);ui.position=sortable.position}}else{if(sortable.isOver){sortable.isOver=0;sortable.cancelHelperRemoval=true;sortable.options._revert=sortable.options.revert;sortable.options.revert=false;sortable._trigger("out",event,sortable._uiHash(sortable));sortable._mouseStop(event,true);sortable.options.revert=sortable.options._revert;sortable.options.helper=sortable.options._helper;if(sortable.placeholder){sortable.placeholder.remove()}ui.helper.appendTo(draggable._parent);draggable._refreshOffsets(event);ui.position=draggable._generatePosition(event,true);draggable._trigger("fromSortable",event);draggable.dropped=false;$.each(draggable.sortables,(function(){this.refreshPositions()}))}}}))}});$.ui.plugin.add("draggable","cursor",{start:function(event,ui,instance){var t=$("body"),o=instance.options;if(t.css("cursor")){o._cursor=t.css("cursor")}t.css("cursor",o.cursor)},stop:function(event,ui,instance){var o=instance.options;if(o._cursor){$("body").css("cursor",o._cursor)}}});$.ui.plugin.add("draggable","opacity",{start:function(event,ui,instance){var t=$(ui.helper),o=instance.options;if(t.css("opacity")){o._opacity=t.css("opacity")}t.css("opacity",o.opacity)},stop:function(event,ui,instance){var o=instance.options;if(o._opacity){$(ui.helper).css("opacity",o._opacity)}}});$.ui.plugin.add("draggable","scroll",{start:function(event,ui,i){if(!i.scrollParentNotHidden){i.scrollParentNotHidden=i.helper.scrollParent(false)}if(i.scrollParentNotHidden[0]!==i.document[0]&&i.scrollParentNotHidden[0].tagName!=="HTML"){i.overflowOffset=i.scrollParentNotHidden.offset()}},drag:function(event,ui,i){var o=i.options,scrolled=false,scrollParent=i.scrollParentNotHidden[0],document=i.document[0];if(scrollParent!==document&&scrollParent.tagName!=="HTML"){if(!o.axis||o.axis!=="x"){if(i.overflowOffset.top+scrollParent.offsetHeight-event.pageY<o.scrollSensitivity){scrollParent.scrollTop=scrolled=scrollParent.scrollTop+o.scrollSpeed}else if(event.pageY-i.overflowOffset.top<o.scrollSensitivity){scrollParent.scrollTop=scrolled=scrollParent.scrollTop-o.scrollSpeed}}if(!o.axis||o.axis!=="y"){if(i.overflowOffset.left+scrollParent.offsetWidth-event.pageX<o.scrollSensitivity){scrollParent.scrollLeft=scrolled=scrollParent.scrollLeft+o.scrollSpeed}else if(event.pageX-i.overflowOffset.left<o.scrollSensitivity){scrollParent.scrollLeft=scrolled=scrollParent.scrollLeft-o.scrollSpeed}}}else{if(!o.axis||o.axis!=="x"){if(event.pageY-$(document).scrollTop()<o.scrollSensitivity){scrolled=$(document).scrollTop($(document).scrollTop()-o.scrollSpeed)}else if($(window).height()-(event.pageY-$(document).scrollTop())<o.scrollSensitivity){scrolled=$(document).scrollTop($(document).scrollTop()+o.scrollSpeed)}}if(!o.axis||o.axis!=="y"){if(event.pageX-$(document).scrollLeft()<o.scrollSensitivity){scrolled=$(document).scrollLeft($(document).scrollLeft()-o.scrollSpeed)}else if($(window).width()-(event.pageX-$(document).scrollLeft())<o.scrollSensitivity){scrolled=$(document).scrollLeft($(document).scrollLeft()+o.scrollSpeed)}}}if(scrolled!==false&&$.ui.ddmanager&&!o.dropBehaviour){$.ui.ddmanager.prepareOffsets(i,event)}}});$.ui.plugin.add("draggable","snap",{start:function(event,ui,i){var o=i.options;i.snapElements=[];$(o.snap.constructor!==String?o.snap.items||":data(ui-draggable)":o.snap).each((function(){var $t=$(this),$o=$t.offset();if(this!==i.element[0]){i.snapElements.push({item:this,width:$t.outerWidth(),height:$t.outerHeight(),top:$o.top,left:$o.left})}}))},drag:function(event,ui,inst){var ts,bs,ls,rs,l,r,t,b,i,first,o=inst.options,d=o.snapTolerance,x1=ui.offset.left,x2=x1+inst.helperProportions.width,y1=ui.offset.top,y2=y1+inst.helperProportions.height;for(i=inst.snapElements.length-1;i>=0;i--){l=inst.snapElements[i].left-inst.margins.left;r=l+inst.snapElements[i].width;t=inst.snapElements[i].top-inst.margins.top;b=t+inst.snapElements[i].height;if(x2<l-d||x1>r+d||y2<t-d||y1>b+d||!$.contains(inst.snapElements[i].item.ownerDocument,inst.snapElements[i].item)){if(inst.snapElements[i].snapping){if(inst.options.snap.release){inst.options.snap.release.call(inst.element,event,$.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item}))}}inst.snapElements[i].snapping=false;continue}if(o.snapMode!=="inner"){ts=Math.abs(t-y2)<=d;bs=Math.abs(b-y1)<=d;ls=Math.abs(l-x2)<=d;rs=Math.abs(r-x1)<=d;if(ts){ui.position.top=inst._convertPositionTo("relative",{top:t-inst.helperProportions.height,left:0}).top}if(bs){ui.position.top=inst._convertPositionTo("relative",{top:b,left:0}).top}if(ls){ui.position.left=inst._convertPositionTo("relative",{top:0,left:l-inst.helperProportions.width}).left}if(rs){ui.position.left=inst._convertPositionTo("relative",{top:0,left:r}).left}}first=ts||bs||ls||rs;if(o.snapMode!=="outer"){ts=Math.abs(t-y1)<=d;bs=Math.abs(b-y2)<=d;ls=Math.abs(l-x1)<=d;rs=Math.abs(r-x2)<=d;if(ts){ui.position.top=inst._convertPositionTo("relative",{top:t,left:0}).top}if(bs){ui.position.top=inst._convertPositionTo("relative",{top:b-inst.helperProportions.height,left:0}).top}if(ls){ui.position.left=inst._convertPositionTo("relative",{top:0,left:l}).left}if(rs){ui.position.left=inst._convertPositionTo("relative",{top:0,left:r-inst.helperProportions.width}).left}}if(!inst.snapElements[i].snapping&&(ts||bs||ls||rs||first)){if(inst.options.snap.snap){inst.options.snap.snap.call(inst.element,event,$.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item}))}}inst.snapElements[i].snapping=ts||bs||ls||rs||first}}});$.ui.plugin.add("draggable","stack",{start:function(event,ui,instance){var min,o=instance.options,group=$.makeArray($(o.stack)).sort((function(a,b){return(parseInt($(a).css("zIndex"),10)||0)-(parseInt($(b).css("zIndex"),10)||0)}));if(!group.length){return}min=parseInt($(group[0]).css("zIndex"),10)||0;$(group).each((function(i){$(this).css("zIndex",min+i)}));this.css("zIndex",min+group.length)}});$.ui.plugin.add("draggable","zIndex",{start:function(event,ui,instance){var t=$(ui.helper),o=instance.options;if(t.css("zIndex")){o._zIndex=t.css("zIndex")}t.css("zIndex",o.zIndex)},stop:function(event,ui,instance){var o=instance.options;if(o._zIndex){$(ui.helper).css("zIndex",o._zIndex)}}});return $.ui.draggable}));
/*!
 * jQuery UI Tooltip 1.14.1
 * https://jqueryui.com
 *
 * Copyright OpenJS Foundation and other contributors
 * Released under the MIT license.
 * https://jquery.org/license
 */
(function(factory){"use strict";if(typeof define==="function"&&define.amd){define(["jquery","../keycode","../position","../unique-id","../version","../widget"],factory)}else{factory(jQuery)}})((function($){"use strict";$.widget("ui.tooltip",{version:"1.14.1",options:{classes:{"ui-tooltip":"ui-corner-all ui-widget-shadow"},content:function(){var title=$(this).attr("title");return $("<a>").text(title).html()},hide:true,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:true,track:false,close:null,open:null},_addDescribedBy:function(elem,id){var describedby=(elem.attr("aria-describedby")||"").split(/\s+/);describedby.push(id);elem.data("ui-tooltip-id",id).attr("aria-describedby",String.prototype.trim.call(describedby.join(" ")))},_removeDescribedBy:function(elem){var id=elem.data("ui-tooltip-id"),describedby=(elem.attr("aria-describedby")||"").split(/\s+/),index=$.inArray(id,describedby);if(index!==-1){describedby.splice(index,1)}elem.removeData("ui-tooltip-id");describedby=String.prototype.trim.call(describedby.join(" "));if(describedby){elem.attr("aria-describedby",describedby)}else{elem.removeAttr("aria-describedby")}},_create:function(){this._on({mouseover:"open",focusin:"open"});this.tooltips={};this.parents={};this.liveRegion=$("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body);this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible");this.disabledTitles=$([])},_setOption:function(key,value){var that=this;this._super(key,value);if(key==="content"){$.each(this.tooltips,(function(id,tooltipData){that._updateContent(tooltipData.element)}))}},_setOptionDisabled:function(value){this[value?"_disable":"_enable"]()},_disable:function(){var that=this;$.each(this.tooltips,(function(id,tooltipData){var event=$.Event("blur");event.target=event.currentTarget=tooltipData.element[0];that.close(event,true)}));this.disabledTitles=this.disabledTitles.add(this.element.find(this.options.items).addBack().filter((function(){var element=$(this);if(element.is("[title]")){return element.data("ui-tooltip-title",element.attr("title")).removeAttr("title")}})))},_enable:function(){this.disabledTitles.each((function(){var element=$(this);if(element.data("ui-tooltip-title")){element.attr("title",element.data("ui-tooltip-title"))}}));this.disabledTitles=$([])},open:function(event){var that=this,target=$(event?event.target:this.element).closest(this.options.items);if(!target.length||target.data("ui-tooltip-id")){return}if(target.attr("title")){target.data("ui-tooltip-title",target.attr("title"))}target.data("ui-tooltip-open",true);if(event&&event.type==="mouseover"){target.parents().each((function(){var parent=$(this),blurEvent;if(parent.data("ui-tooltip-open")){blurEvent=$.Event("blur");blurEvent.target=blurEvent.currentTarget=this;that.close(blurEvent,true)}if(parent.attr("title")){parent.uniqueId();that.parents[this.id]={element:this,title:parent.attr("title")};parent.attr("title","")}}))}this._registerCloseHandlers(event,target);this._updateContent(target,event)},_updateContent:function(target,event){var content,contentOption=this.options.content,that=this,eventType=event?event.type:null;if(typeof contentOption==="string"||contentOption.nodeType||contentOption.jquery){return this._open(event,target,contentOption)}content=contentOption.call(target[0],(function(response){if(!target.data("ui-tooltip-open")){return}if(event){event.type=eventType}that._open(event,target,response)}));if(content){this._open(event,target,content)}},_open:function(event,target,content){var tooltipData,tooltip,delayedShow,a11yContent,positionOption=$.extend({},this.options.position);if(!content){return}tooltipData=this._find(target);if(tooltipData){tooltipData.tooltip.find(".ui-tooltip-content").html(content);return}if(target.is("[title]")){if(event&&event.type==="mouseover"){target.attr("title","")}else{target.removeAttr("title")}}tooltipData=this._tooltip(target);tooltip=tooltipData.tooltip;this._addDescribedBy(target,tooltip.attr("id"));tooltip.find(".ui-tooltip-content").html(content);this.liveRegion.children().hide();a11yContent=$("<div>").html(tooltip.find(".ui-tooltip-content").html());a11yContent.removeAttr("name").find("[name]").removeAttr("name");a11yContent.removeAttr("id").find("[id]").removeAttr("id");a11yContent.appendTo(this.liveRegion);function position(event){positionOption.of=event;if(tooltip.is(":hidden")){return}tooltip.position(positionOption)}if(this.options.track&&event&&/^mouse/.test(event.type)){this._on(this.document,{mousemove:position});position(event)}else{tooltip.position($.extend({of:target},this.options.position))}tooltip.hide();this._show(tooltip,this.options.show);if(this.options.track&&this.options.show&&this.options.show.delay){delayedShow=this.delayedShow=setInterval((function(){if(tooltip.is(":visible")){position(positionOption.of);clearInterval(delayedShow)}}),13)}this._trigger("open",event,{tooltip:tooltip})},_registerCloseHandlers:function(event,target){var events={keyup:function(event){if(event.keyCode===$.ui.keyCode.ESCAPE){var fakeEvent=$.Event(event);fakeEvent.currentTarget=target[0];this.close(fakeEvent,true)}}};if(target[0]!==this.element[0]){events.remove=function(){var targetElement=this._find(target);if(targetElement){this._removeTooltip(targetElement.tooltip)}}}if(!event||event.type==="mouseover"){events.mouseleave="close"}if(!event||event.type==="focusin"){events.focusout="close"}this._on(true,target,events)},close:function(event){var tooltip,that=this,target=$(event?event.currentTarget:this.element),tooltipData=this._find(target);if(!tooltipData){target.removeData("ui-tooltip-open");return}tooltip=tooltipData.tooltip;if(tooltipData.closing){return}clearInterval(this.delayedShow);if(target.data("ui-tooltip-title")&&!target.attr("title")){target.attr("title",target.data("ui-tooltip-title"))}this._removeDescribedBy(target);tooltipData.hiding=true;tooltip.stop(true);this._hide(tooltip,this.options.hide,(function(){that._removeTooltip($(this))}));target.removeData("ui-tooltip-open");this._off(target,"mouseleave focusout keyup");if(target[0]!==this.element[0]){this._off(target,"remove")}this._off(this.document,"mousemove");if(event&&event.type==="mouseleave"){$.each(this.parents,(function(id,parent){$(parent.element).attr("title",parent.title);delete that.parents[id]}))}tooltipData.closing=true;this._trigger("close",event,{tooltip:tooltip});if(!tooltipData.hiding){tooltipData.closing=false}},_tooltip:function(element){var tooltip=$("<div>").attr("role","tooltip"),content=$("<div>").appendTo(tooltip),id=tooltip.uniqueId().attr("id");this._addClass(content,"ui-tooltip-content");this._addClass(tooltip,"ui-tooltip","ui-widget ui-widget-content");tooltip.appendTo(this._appendTo(element));return this.tooltips[id]={element:element,tooltip:tooltip}},_find:function(target){var id=target.data("ui-tooltip-id");return id?this.tooltips[id]:null},_removeTooltip:function(tooltip){clearInterval(this.delayedShow);tooltip.remove();delete this.tooltips[tooltip.attr("id")]},_appendTo:function(target){var element=target.closest(".ui-front, dialog");if(!element.length){element=this.document[0].body}return element},_destroy:function(){var that=this;$.each(this.tooltips,(function(id,tooltipData){var event=$.Event("blur"),element=tooltipData.element;event.target=event.currentTarget=element[0];that.close(event,true);$("#"+id).remove();if(element.data("ui-tooltip-title")){if(!element.attr("title")){element.attr("title",element.data("ui-tooltip-title"))}element.removeData("ui-tooltip-title")}}));this.liveRegion.remove()}});if($.uiBackCompat===true){$.widget("ui.tooltip",$.ui.tooltip,{options:{tooltipClass:null},_tooltip:function(){var tooltipData=this._superApply(arguments);if(this.options.tooltipClass){tooltipData.tooltip.addClass(this.options.tooltipClass)}return tooltipData}})}return $.ui.tooltip}));
/*!
 * Fluid Infusion v4.8.0
 *
 * Infusion is distributed under the Educational Community License 2.0 and new BSD licenses:
 * http://wiki.fluidproject.org/display/fluid/Fluid+Licensing
 *
 * Copyright The Infusion copyright holders
 * See the AUTHORS.md file at the top-level directory of this distribution and at
 * https://github.com/fluid-project/infusion/raw/main/AUTHORS.md
 */
"use strict";var fluid=fluid||{};fluid.version="Infusion 4.8.0";fluid.Error=Error;fluid.environment={fluid:fluid};fluid.global=fluid.global||typeof window!=="undefined"?window:typeof self!=="undefined"?self:{};fluid.invokeLater=function(func){return setTimeout(func,0)};fluid.defeatLogging=true;fluid.activityTracing=false;fluid.activityTrace=[];var activityParser=/(%\w+)/g;fluid.renderActivityArgument=function(arg){if(fluid.isComponent(arg)){return fluid.dumpComponentAndPath(arg)}else{return arg}};fluid.renderOneActivity=function(activity,nowhile){var togo=nowhile===true?[]:["    while "];var message=activity.message;var index=activityParser.lastIndex=0;while(true){var match=activityParser.exec(message);if(match){var key=match[1].substring(1);togo.push(message.substring(index,match.index));togo.push(fluid.renderActivityArgument(activity.args[key]));index=activityParser.lastIndex}else{break}}if(index<message.length){togo.push(message.substring(index))}return togo};fluid.renderActivity=function(activityStack,renderer){renderer=renderer||fluid.renderOneActivity;return fluid.transform(activityStack,renderer)};fluid.singleThreadLocal=function(initFunc){var value=initFunc();return function(newValue){return newValue===undefined?value:value=newValue}};fluid.threadLocal=fluid.singleThreadLocal;fluid.globalThreadLocal=fluid.threadLocal((function(){return{}}));fluid.getActivityStack=function(){var root=fluid.globalThreadLocal();if(!root.activityStack){root.activityStack=[]}return root.activityStack};fluid.describeActivity=fluid.getActivityStack;fluid.logActivity=function(activity){activity=activity||fluid.describeActivity();var rendered=fluid.renderActivity(activity).reverse();if(rendered.length>0){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()};if(fluid.activityTracing){fluid.activityTrace.push(record)}if(fluid.passLogLevel(fluid.logLevel.TRACE)){fluid.log.apply(null,fluid.renderOneActivity(record,true))}var activityStack=fluid.getActivityStack();activityStack.push(record)};fluid.popActivity=function(popframes){popframes=popframes||1;if(fluid.activityTracing){fluid.activityTrace.push({pop:popframes})}var activityStack=fluid.getActivityStack();var 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 arg===undefined?"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(...messages){var activity=fluid.makeArray(fluid.describeActivity());fluid.popActivity(activity.length);if(fluid.failureEvent){fluid.failureEvent.fire(messages,activity)}else{fluid.logFailure(messages,activity);fluid.builtinFail(messages,activity)}};fluid.notrycatch=false;fluid.tryCatch=function(tryfun,catchfun,finallyfun){finallyfun=finallyfun||fluid.identity;if(fluid.notrycatch){var togo=tryfun();finallyfun();return togo}else{try{return tryfun()}catch(e){if(catchfun){catchfun(e)}else{throw e}}finally{finallyfun()}}};fluid.expect=function(name,target,members){fluid.transform(fluid.makeArray(members),(function(key){if(target[key]===undefined){fluid.fail(name+" missing required member "+key)}}))};fluid.isLogging=function(){return logLevelStack[0].priority>fluid.logLevel.IMPORTANT.priority};fluid.isLogLevel=function(arg){return fluid.isMarker(arg)&&arg.priority!==undefined};fluid.passLogLevel=function(testLogLevel){return testLogLevel.priority<=logLevelStack[0].priority};fluid.setLogging=function(enabled){var logLevel;if(typeof enabled==="boolean"){logLevel=fluid.logLevel[enabled?"INFO":"IMPORTANT"]}else if(fluid.isLogLevel(enabled)){logLevel=enabled}else{fluid.fail("Unrecognised fluid logging level ",enabled)}logLevelStack.unshift(logLevel);fluid.defeatLogging=!fluid.isLogging()};fluid.setLogLevel=fluid.setLogging;fluid.popLogging=function(){var togo=logLevelStack.length===1?logLevelStack[0]:logLevelStack.shift();fluid.defeatLogging=!fluid.isLogging();return togo};fluid.doBrowserLog=function(args){if(typeof console!=="undefined"){if(console.debug){console.debug.apply(console,args)}else if(typeof console.log==="function"){console.log.apply(console,args)}}};fluid.log=function(){var directArgs=fluid.makeArray(arguments);var userLogLevel=fluid.logLevel.INFO;if(fluid.isLogLevel(directArgs[0])){userLogLevel=directArgs.shift()}if(fluid.passLogLevel(userLogLevel)){fluid.loggingEvent.fire(directArgs)}};fluid.isValue=function(value){return value!==undefined&&value!==null};fluid.isPrimitive=function(value){var valueType=typeof value;return!value||valueType==="string"||valueType==="boolean"||valueType==="number"||valueType==="function"};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.prototype.toString.call(totest)==="[object Array]"||fluid.isJQuery(totest))};fluid.isPlainObject=function(totest,strict){var string=Object.prototype.toString.call(totest);if(string==="[object Array]"){return!strict}else if(string!=="[object Object]"){return false}return!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 typeof ref==="string"&&ref.charAt(0)==="{"};fluid.isReferenceOrExpander=function(ref){return ref&&(fluid.isIoCReference(ref)||ref.expander)};fluid.isDOMNode=function(obj){return obj&&typeof obj.nodeType==="number"};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&&typeof totest.apply==="function"};fluid.identity=function(arg){return arg};fluid.notImplemented=function(){fluid.fail("This operation is not implemented")};fluid.firstDefined=function(a,b){return a===undefined?b:a};fluid.freshContainer=function(tocopy){return fluid.isArrayable(tocopy)?[]:{}};fluid.testStrategyRecursion=function(funcName,segs){if(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){fluid.testStrategyRecursion("fluid.copy",segs);if(fluid.isUncopyable(tocopy)){return tocopy}else{return fluid.transform(tocopy,(function(value,key){segs.push(key);var togo=fluid.copyRecurse(value,segs);segs.pop();return togo}))}};fluid.copy=function(tocopy){return fluid.copyRecurse(tocopy,[])};fluid.extend=$.extend;fluid.makeArray=function(arg){var togo=[];if(arg!==null&&arg!==undefined){if(fluid.isPrimitive(arg)||fluid.isPlainObject(arg,true)||typeof arg.length!=="number"){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]=[];if(Array.isArray(topush)){array.push.apply(array,topush)}else{array.push(topush)}};function transformInternal(source,togo,key,transformations){var transit=source[key];for(var j=0;j<transformations.length;++j){transit=transformations[j](transit,key)}if(transit!==fluid.NO_VALUE){togo[key]=transit}}fluid.transform=function(source,...transformations){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,transformations)}}else{for(var key in source){transformInternal(source,togo,key,transformations)}}return togo};fluid.forEachInRange=function(array,start,end,func){for(var i=start;i<end;++i){func(array[i],i)}};fluid.peek=function(array){return array.length===0?undefined:array[array.length-1]};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?false:undefined;return function(source,func,deffolt){var disp;if(fluid.isArrayable(source)){for(var i=0;i<source.length;++i){disp=func(source[i],i);if(disp!==target){return find_if?source[i]:disp}}}else{for(var key in source){disp=func(source[key],key);if(disp!==target){return find_if?source[key]:disp}}}return deffolt}};fluid.find=fluid.make_find(false);fluid.find_if=fluid.make_find(true);fluid.remove_if=function(source,fn,target){if(fluid.isArrayable(source)){for(var i=source.length-1;i>=0;--i){if(fn(source[i],i)){if(target){target.unshift(source[i])}source.splice(i,1)}}}else{for(var key in source){if(fn(source[key],key)){if(target){target[key]=source[key]}delete source[key]}}}return target||source};fluid.generate=function(n,generator,applyFunc){var togo=[];for(var i=0;i<n;++i){togo[i]=applyFunc?generator(i):generator}return togo};fluid.iota=function(count,first){first=first||0;var togo=[];for(var 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^keys.indexOf(key)===-1}))};fluid.censorKeys=function(toCensor,keys){return fluid.filterKeys(toCensor,keys,true)};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.keyForValue=function(obj,value){return fluid.find(obj,(function(thisValue,key){if(value===thisValue){return key}}))};fluid.arrayToHash=function(array){var togo={};fluid.each(array,(function(el){togo[el]=true}));return togo};fluid.hashToArray=function(hash,keyName,func){var togo=[];fluid.each(hash,(function(el,key){var newEl=el;if(keyName!==undefined){newEl={};newEl[keyName]=key}if(func){newEl=func(newEl,el,key)||newEl}else if(newEl!==el){$.extend(true,newEl,el)}togo.push(newEl)}));return togo};fluid.flatten=function(array){var togo=[];fluid.each(array,(function(element){if(fluid.isArrayable(element)){togo=togo.concat(element)}else{togo.push(element)}}));return 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){scale=scale&&scale>=0?Math.round(scale):0;if(method==="ceil"||method==="floor"){return Number(Math[method](num+"e"+scale)+"e-"+scale)}else{var sign=num>=0?1:-1;return Number(sign*(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;var later=function(){timeout=null;if(!immediate){result=func.apply(context,args)}};var callNow=immediate&&!timeout;clearTimeout(timeout);timeout=setTimeout(later,wait);if(callNow){result=func.apply(context,args)}return result}};fluid.freezeRecursive=function(tofreeze,segs){segs=segs||[];fluid.testStrategyRecursion("fluid.freezeRecursive",segs);if(fluid.isPlainObject(tofreeze)){fluid.each(tofreeze,(function(value,key){segs.push(key);fluid.freezeRecursive(value,segs);segs.pop()}));return Object.freeze(tofreeze)}else{return tofreeze}};fluid.marker=function(){};fluid.makeMarker=function(value,extra){var togo=Object.create(fluid.marker.prototype);togo.value=value;fluid.extend(togo,extra);return Object.freeze(togo)};fluid.NO_VALUE=fluid.makeMarker("NO_VALUE");fluid.EXPAND=fluid.makeMarker("EXPAND");fluid.isMarker=function(totest,type){if(!(totest instanceof fluid.marker)){return false}if(!type){return true}return 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(true,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 lastdot===-1?"":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(togo!==undefined){return togo}}if(create&&root[segment]===undefined){return root[segment]={}}return root[segment]};fluid.model.parseToSegments=function(EL,parseEL,copy){return typeof EL==="number"||typeof EL==="string"?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);var initPos=0;if(initSegs){initPos=initSegs.length;segs=initSegs.concat(segs)}var uncess=newValue===fluid.NO_VALUE?0:1;root=traverser(root,segs,initPos,config,uncess);if(newValue===fluid.NO_VALUE){return returnSegs?{root:root,segs:segs}:root}else{root[fluid.peek(segs)]=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){var origEnv=environment;var limit=segs.length-uncess;for(var i=0;i<limit;++i){if(!root){return undefined}var segment=segs[i];if(environment&&environment[segment]){root=environment[segment]}else{root=fluid.model.resolvePathSegment(root,segment,uncess===1,origEnv)}environment=null}return root};fluid.model.setSimple=function(root,EL,newValue,environment,initSegs){fluid.model.accessSimple(root,EL,newValue,environment,initSegs,false)};fluid.model.getSimple=function(root,EL,environment,initSegs){if(EL===null||EL===undefined||EL.length===0){return root}return fluid.model.accessSimple(root,EL,fluid.NO_VALUE,environment,initSegs,false)};fluid.getImmediate=function(root,segs,i){var limit=i===undefined?segs.length:i+1;for(var j=0;j<limit;++j){root=root?root[segs[j]]:undefined}return root};fluid.decodeAccessorArg=function(arg3){return!arg3||arg3===fluid.model.defaultGetConfig||arg3===fluid.model.defaultSetConfig?null:arg3.type==="environment"?arg3.value:undefined};fluid.set=function(root,EL,newValue,config,initSegs){var env=fluid.decodeAccessorArg(config);if(env===undefined){fluid.model.setWithStrategy(root,EL,newValue,config,initSegs)}else{fluid.model.setSimple(root,EL,newValue,env,initSegs)}};fluid.get=function(root,EL,config,initSegs){var env=fluid.decodeAccessorArg(config);return env===undefined?fluid.model.getWithStrategy(root,EL,config,initSegs):fluid.model.accessImpl(root,EL,fluid.NO_VALUE,env,null,false,fluid.model.traverseSimple)};fluid.getGlobalValue=function(path,env){if(path){env=env||fluid.environment;return fluid.get(fluid.global,path,{type:"environment",value:env})}};fluid.bind=function(obj,fnName,args){return obj[fnName].apply(obj,fluid.makeArray(args))};fluid.proxyComponentArgs=fluid.identity;fluid.invokeGlobalFunction=function(functionPath,args,environment){var func=fluid.getGlobalValue(functionPath,environment);if(!func){fluid.fail("Error invoking global function: "+functionPath+" could not be located")}else{var argsArray=fluid.isArrayable(args)?args:fluid.makeArray(args);fluid.proxyComponentArgs(argsArray);return func.apply(null,argsArray)}};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(path,env){env=env||fluid.environment;var existing=fluid.getGlobalValue(path,env);if(!existing){existing={};fluid.setGlobalValue(path,existing,env)}return existing};fluid.dumpEl=fluid.identity;fluid.renderTimestamp=fluid.identity;fluid.generateUniquePrefix=function(){return Math.floor(Math.random()*1e12).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,transaction:10,testing:20,authoring:30};fluid.parsePriorityConstraint=function(constraint,fixedOnly,site){var segs=constraint.split(":");var type=segs[0];var lookup=fluid.priorityTypes[type];if(lookup===undefined){fluid.fail("Invalid constraint type in priority field "+constraint+": the only supported values are "+fluid.keys(fluid.priorityTypes).join(", ")+" or numeric")}if(fixedOnly&&lookup===0){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")}return{type:segs[0],target:segs[1]}};fluid.parsePriority=function(priority,count,fixedOnly,site){priority=priority||0;var togo={count:count||0,fixed:null,constraint:null,site:site};if(typeof priority==="number"){togo.fixed=-priority}else{togo.constraint=fluid.parsePriorityConstraint(priority,fixedOnly,site)}var multiplier=togo.constraint?fluid.priorityTypes[togo.constraint.type]:0;if(multiplier!==0){var target=togo.constraint.target||"none";var extremal=fluid.extremalPriorities[target];if(extremal===undefined){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)}if(togo.fixed!==null){togo.fixed+=togo.count/1024}return 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){if(recA.priority.fixed!==null&&recB.priority.fixed!==null){return recA.priority.fixed-recB.priority.fixed}else{return(recA.priority.fixed===null)-(recB.priority.fixed===null)}};fluid.honourConstraint=function(array,firstConstraint,c){var constraint=array[c].priority.constraint;var matchIndex=fluid.find(array,(function(element,index){return element.namespace===constraint.target?index:undefined}),-1);if(matchIndex===-1){return true}else if(matchIndex>=firstConstraint){return false}else{var offset=constraint.type==="after"?1:0;var target=matchIndex+offset;var temp=array[c];for(var shift=c;shift>=target;--shift){array[shift]=array[shift-1]}array[target]=temp;return true}};fluid.sortByPriority=function(array){array.sort(fluid.compareByPriority);var firstConstraint=fluid.find(array,(function(element,index){return element.priority.constraint&&fluid.priorityTypes[element.priority.constraint.type]===0?index:undefined}),array.length);while(true){if(firstConstraint===array.length){return array}var oldFirstConstraint=firstConstraint;for(var c=firstConstraint;c<array.length;++c){var applied=fluid.honourConstraint(array,firstConstraint,c);if(applied){++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,false,name)}));fluid.sortByPriority(array);return array};fluid.event.identifyListener=function(listener,soft){if(typeof listener!=="string"&&!listener.$$fluid_guid&&!soft){listener.$$fluid_guid=fluid.allocateGuid()}return 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=[];fluid.each(listeners,(function(oneNamespace){var headHard;for(var i=0;i<oneNamespace.length;++i){var thisListener=oneNamespace[i];if(!thisListener.softNamespace&&!headHard){headHard=thisListener}}if(headHard){togo.push(headHard)}else{togo=togo.concat(oneNamespace)}}));return fluid.sortByPriority(togo)};fluid.event.resolveListener=function(listener){var listenerName=listener.globalName||(typeof listener==="string"?listener:null);if(listenerName){var listenerFunc=fluid.getGlobalValue(listenerName);if(!listenerFunc){fluid.fail("Unable to look up name "+listenerName+" as a global function")}else{listener=listenerFunc}}return listener};fluid.nameComponent=function(that){return that?fluid.dumpComponentAndPath(that):"[unknown component]"};fluid.event.nameEvent=function(that,eventName){return eventName+" of "+fluid.nameComponent(that)};fluid.event.firer=function(){};fluid.makeEventFirer=function(options){options=options||{};var name=options.name||"<anonymous>";var that;var lazyInit=function(){that.listeners={};that.byId={};that.sortedListeners=[];that.onDestroy=null;that.addListener=function(listener,namespace,priority,softNamespace,listenerId){var record;if(that.destroyed){fluid.fail("Cannot add listener to destroyed event firer "+that.name)}if(!listener){return}if(fluid.isPlainObject(listener,true)&&!fluid.isApplicable(listener)){record=listener;listener=record.listener;namespace=record.namespace;priority=record.priority;softNamespace=record.softNamespace;listenerId=record.listenerId}if(typeof listener==="string"){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,false,"listeners")});that.byId[id]=record;var thisListeners=that.listeners[namespace]=fluid.makeArray(that.listeners[namespace]);thisListeners[softNamespace?"push":"unshift"](record);that.sortedListeners=fluid.event.sortListeners(that.listeners)};that.addListener.apply(null,arguments)};that=Object.create(fluid.event.firer.prototype);fluid.extend(that,{eventId:fluid.allocateGuid(),name:name,ownerId:options.ownerId,typeName:"fluid.event.firer",destroy:function(){that.destroyed=true;fluid.each(that.onDestroy,(function(func){func()}))},addListener:function(){lazyInit.apply(null,arguments)},removeListener:function(listener){if(!that.listeners){return}var namespace,id,record;if(typeof listener==="string"){namespace=listener;record=that.listeners[namespace];if(!record){id=namespace;namespace=null}}else if(typeof listener==="function"){id=fluid.event.identifyListener(listener,true);if(!id){fluid.fail("Cannot remove unregistered listener function ",listener," from event "+that.name)}}var rec=that.byId[id];var softNamespace=rec&&rec.softNamespace;namespace=namespace||rec&&rec.namespace||id;delete that.byId[id];record=that.listeners[namespace];if(record){if(softNamespace){fluid.remove_if(record,(function(thisLis){return thisLis.listener.$$fluid_guid===id||thisLis.listenerId===id}))}else{record.shift()}if(record.length===0){delete that.listeners[namespace]}}that.sortedListeners=fluid.event.sortListeners(that.listeners)},fire:function(){var listeners=that.sortedListeners;if(options.promise){that.promisePayload=arguments[0]}if(!listeners||that.destroyed){return}for(var i=0;i<listeners.length;++i){var lisrec=listeners[i];if(typeof lisrec.listener!=="function"){lisrec.listener=fluid.event.resolveListener(lisrec.listener)}var listener=lisrec.listener;var ret=listener.apply(null,arguments);var value;if(options.preventable&&ret===false||that.destroyed){value=false}if(value!==undefined){return value}}}});if(options.promise){that.then=function(func){if("promisePayload"in that){func(that.promisePayload)}else{that.addListener(func)}}}return that};fluid.event.addPrimitiveListener=function(holder,name,func){var existing=holder[name];if(!existing){existing=holder[name]=[]}existing.push(func)};fluid.fireEvent=function(component,eventName,args){var firer=component.events&&component.events[eventName];if(firer){firer.fire.apply(null,fluid.makeArray(args))}};fluid.event.addListenerToFirer=function(firer,value,namespace,wrapper){wrapper=wrapper||fluid.identity;if(fluid.isArrayable(value)){for(var i=0;i<value.length;++i){fluid.event.addListenerToFirer(firer,value[i],namespace,wrapper)}}else if(typeof value==="function"||typeof value==="string"){wrapper(firer).addListener(value,namespace)}else if(value&&typeof value==="object"){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);if(!firer){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(".");if(keydot!==-1){namespace=key.substring(keydot+1);key=key.substring(0,keydot)}if(!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,true);fluid.event.addListenerToFirer(firer,record.records,namespace,record.adderWrapper)}))};fluid.eventFromRecord=function(eventSpec,eventKey,that){var isIoCEvent=eventSpec&&(typeof eventSpec!=="string"||fluid.isIoCReference(eventSpec));var event;if(isIoCEvent){if(!fluid.event.resolveEvent){fluid.fail("fluid.event.resolveEvent could not be loaded - please include FluidIoC.js in order to operate IoC-driven event with descriptor ",eventSpec)}else{event=fluid.event.resolveEvent(that,eventKey,eventSpec)}}else{event=fluid.makeEventFirer({name:fluid.event.nameEvent(that,eventKey),preventable:eventSpec==="preventable",promise:eventSpec==="promise",ownerId:that.id})}return event};fluid.mergeListenerPolicy=function(target,source,key){if(typeof key!=="string"){fluid.fail("Error in listeners declaration - the keys in this structure must resolve to event names - got "+key+" from ",source)}var hasNamespace=!fluid.isIoCReference(key)&&key.indexOf(".")!==-1;return hasNamespace?source||target:fluid.arrayConcatPolicy(target,source)};fluid.makeMergeListenersPolicy=function(merger,modelRelay){return function(target,source){target=target||{};if(modelRelay&&(fluid.isArrayable(source)||"target"in source&&(typeof source.target==="string"||source.target.segs))){target[""]=merger(target[""],source,"")}else{fluid.each(source,(function(listeners,key){target[key]=merger(target[key],listeners,key)}))}return target}};fluid.validateListenersImplemented=function(that){var errors=[];fluid.each(that.events,(function(event,name){fluid.each(event.sortedListeners,(function(lisrec){if(lisrec.listener===fluid.notImplemented||lisrec.listener.globalName==="fluid.notImplemented"){errors.push({name:name,namespace:lisrec.namespace,componentSource:fluid.model.getSimple(that.options.listeners,[name+"."+lisrec.namespace,0,"componentSource"])})}}))}));return errors};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.upgradeError=function(originError,whileMsg){var error=originError instanceof Error?originError:fluid.isPrimitive(originError)?{message:originError}:fluid.extend({},originError);error.message=error.message+whileMsg;return error};fluid.failureEvent=fluid.makeEventFirer({name:"failure event"});fluid.failureEvent.addListener(fluid.builtinFail,"fail");fluid.failureEvent.addListener(fluid.logFailure,"log","before:fail");fluid.componentConstructor=function(){};Object.defineProperty(fluid.componentConstructor,"name",{value:"fluid.componentConstructor"});fluid.typeTag=function(type,id){var that=Object.create(fluid.componentConstructor.prototype);that.typeName=type;that.id=id||fluid.allocateGuid();return that};var gradeTick=1;var gradeTickStore={};fluid.defaultsStore={};fluid.flattenGradeName=function(gradeName){return typeof gradeName==="string"?gradeName:JSON.stringify(gradeName)};fluid.resolveGradesImpl=function(gs,gradeNames){gradeNames=fluid.makeArray(gradeNames);for(var i=gradeNames.length-1;i>=0;--i){var gradeName=gradeNames[i];var flatGradeName=fluid.flattenGradeName(gradeName);if(gradeName&&!gs.gradeHash[flatGradeName]){var isDynamic=fluid.isReferenceOrExpander(gradeName);var options=(isDynamic?null:fluid.rawDefaults(gradeName))||{};var thisTick=gradeTickStore[gradeName]||gradeTick-1;gs.lastTick=Math.max(gs.lastTick,thisTick);gs.gradeHash[flatGradeName]=true;gs.gradeChain.push(gradeName);var oGradeNames=fluid.makeArray(options.gradeNames);for(var j=oGradeNames.length-1;j>=0;--j){fluid.resolveGradesImpl(gs,oGradeNames[j])}}}return gs};fluid.resolveGradeStructure=function(defaultName,gradeNames){var gradeStruct={lastTick:0,gradeChain:[],gradeHash:{}};fluid.resolveGradesImpl(gradeStruct,[defaultName].concat(fluid.makeArray(gradeNames)));gradeStruct.gradeChain.reverse();return gradeStruct};fluid.hasGrade=function(options,gradeName){return!options||!options.gradeNames?false:options.gradeNames.includes(gradeName)};fluid.resolveGrade=function(defaults,defaultName,gradeNames){var gradeStruct=fluid.resolveGradeStructure(defaultName,gradeNames);var mergeArgs=fluid.transform(gradeStruct.gradeChain,fluid.rawDefaults,fluid.copy);fluid.remove_if(mergeArgs,(function(options){return!options}));var mergePolicy={};for(var i=0;i<mergeArgs.length;++i){if(mergeArgs[i]&&mergeArgs[i].mergePolicy){mergePolicy=$.extend(true,mergePolicy,mergeArgs[i].mergePolicy)}}mergeArgs=[mergePolicy,{}].concat(mergeArgs);var mergedDefaults=fluid.merge.apply(null,mergeArgs);mergedDefaults.gradeNames=gradeStruct.gradeChain;fluid.freezeRecursive(mergedDefaults);return{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);var mergedDefaults=fluid.mergedDefaultsCache[key];if(mergedDefaults){var lastTick=0;var searchGrades=mergedDefaults.defaults.gradeNames;for(var i=0;i<searchGrades.length;++i){lastTick=Math.max(lastTick,gradeTickStore[searchGrades[i]]||0)}if(lastTick>mergedDefaults.lastTick){if(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.NO_ARGUMENTS=fluid.makeMarker("NO_ARGUMENTS");fluid.upgradePrimitiveFunc=function(rec,key){if(rec&&fluid.isPrimitive(rec)){var togo={};togo[key||(typeof rec==="string"&&rec.charAt(0)!=="{"?"funcName":"func")]=rec;togo.args=fluid.NO_ARGUMENTS;return togo}else{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){onerec=fluid.upgradePrimitiveFunc(onerec,"listener");onerec.componentSource=componentName;return onerec}))}));options.invokers=fluid.transform(options.invokers,(function(record){record=fluid.upgradePrimitiveFunc(record);if(record){record.componentSource=componentName}return record}))};fluid.workflowCache={};fluid.workflowCacheSorted=[];fluid.resortWorkflows=function(workflowType,baseIndex){var thisCache=fluid.workflowCache[workflowType];var parsed=fluid.parsePriorityRecords(thisCache,workflowType+" workflows");parsed.forEach((function(oneParsed,index){thisCache[oneParsed.namespace].index=index+baseIndex}));return parsed};fluid.indexOneWorkflows=function(gradeName,workflowType,workflows,baseIndex){fluid.each(workflows,(function(oneWorkflow,workflowKey){fluid.model.setSimple(fluid.workflowCache,[workflowType,workflowKey],{workflowType:workflowType,workflowName:workflowKey,priority:oneWorkflow.priority,gradeName:gradeName,workflowOptions:oneWorkflow})}));return fluid.resortWorkflows(workflowType,baseIndex)};fluid.clearGradeWorkflows=function(gradeName,workflowType){var cacheForType=fluid.workflowCache[workflowType];fluid.each(cacheForType,(function(oneWorkflow,workflowKey){if(oneWorkflow.gradeName===gradeName){delete cacheForType[workflowKey]}}))};fluid.indexGradeWorkflows=function(gradeName,options){fluid.clearGradeWorkflows(gradeName,"global");fluid.clearGradeWorkflows(gradeName,"local");var sortedGlobal=fluid.indexOneWorkflows(gradeName,"global",fluid.getImmediate(options,["workflows","global"]),0);var globalWorkflowCount=sortedGlobal.length;var sortedLocal=fluid.indexOneWorkflows(gradeName,"local",fluid.getImmediate(options,["workflows","local"]),globalWorkflowCount);fluid.workflowCacheSorted=sortedGlobal.concat(sortedLocal)};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);fluid.indexGradeWorkflows(componentName,optionsCopy);delete optionsCopy.workflows;var callerInfo=fluid.getCallerInfo&&fluid.getCallerInfo(6);fluid.freezeRecursive(optionsCopy);fluid.defaultsStore[componentName]={options:optionsCopy,callerInfo:callerInfo};gradeTickStore[componentName]=gradeTick++;fluid.popActivity()};fluid.doIndexDefaults=function(defaultName,defaults,index,indexSpec){var requiredGrades=fluid.makeArray(indexSpec.gradeNames);for(var i=0;i<requiredGrades.length;++i){if(!fluid.hasGrade(defaults,requiredGrades[i])){return}}var indexFunc=typeof indexSpec.indexFunc==="function"?indexSpec.indexFunc:fluid.getGlobalValue(indexSpec.indexFunc);var keys=indexFunc(defaults)||[];for(var 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(options===undefined){return fluid.getMergedDefaults(componentName)}else{if(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);if(!fluid.hasGrade(gradedDefaults,"fluid.function")){fluid.makeComponentCreator(componentName)}}};fluid.validateCreatorGrade=function(message,componentName){var defaults=fluid.getMergedDefaults(componentName);if(!defaults||!defaults.gradeNames||defaults.gradeNames.length===0){fluid.fail(message+" type "+componentName+" which does not have any gradeNames defined")}else if(!defaults.argumentMap){var blankGrades=[];for(var i=0;i<defaults.gradeNames.length;++i){var gradeName=defaults.gradeNames[i];var rawDefaults=fluid.rawDefaults(gradeName);if(!rawDefaults){blankGrades.push(gradeName)}}if(blankGrades.length===0){fluid.fail(message+" type "+componentName+" which is not derived from fluid.component")}else{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")}}};fluid.makeComponentCreator=function(componentName){var creator=function(){fluid.validateCreatorGrade("Cannot make component creator for",componentName);return fluid.initFreeComponent(componentName,arguments)};var existing=fluid.getGlobalValue(componentName);if(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={};var togo={builtins:builtins,defaultValues:defaultValues};if(!mergePolicy){return togo}fluid.each(mergePolicy,(function(value,key){var parsed={},builtin=true;if(typeof value==="function"){parsed.func=value}else if(typeof value==="object"){parsed=value}else if(!fluid.isDefaultValueMergePolicy(value)){var split=value.split(/\s*,\s*/);for(var i=0;i<split.length;++i){parsed[split[i]]=true}}else{fluid.set(defaultValues,key,"{that}.options."+value);togo.hasDefaults=true;builtin=false}if(builtin){fluid.set(builtins,fluid.composePath(key,"*"),parsed)}}));return togo};fluid.isDefaultValueMergePolicy=function(policy){return typeof policy==="string"&&(policy.indexOf(",")===-1&&!/replace|nomerge|noexpand/.test(policy))};fluid.mergeOneImpl=function(thisTarget,thisSource,j,sources,newPolicy,newPolicyHolder,i,segs){var togo=thisTarget;var primitiveTarget=fluid.isPrimitive(thisTarget);if(thisSource!==undefined){if(!newPolicy.func&&thisSource!==null&&fluid.isPlainObject(thisSource)&&!newPolicy.nomerge){if(primitiveTarget){togo=thisTarget=fluid.freshContainer(thisSource)}}else{sources[j]=undefined;if(newPolicy.func){togo=newPolicy.func.call(null,thisTarget,thisSource,newPolicyHolder,segs,i)}else{togo=thisSource}}}return togo};fluid.regenerateCursor=function(source,segs,limit,sourceStrategy){for(var i=0;i<limit;++i){source=sourceStrategy(source,segs[i],i,fluid.makeArray(segs))}return source};fluid.regenerateSources=function(sources,segs,limit,sourceStrategies){var togo=[];for(var i=0;i<sources.length;++i){var thisSource=fluid.regenerateCursor(sources[i],segs,limit,sourceStrategies[i]);togo.push(thisSource)}return togo};fluid.fetchMergeChildren=function(target,i,segs,sources,mergePolicy,options){var thisPolicy=fluid.derefMergePolicy(mergePolicy);for(var j=sources.length-1;j>=0;--j){var source=sources[j];if(source!==undefined){fluid.each(source,(function(newSource,name){var childPolicy=fluid.concreteTrundler(mergePolicy,name);if(!(name in target)||options.evaluateFully&&childPolicy===undefined&&!fluid.isPrimitive(target[name])){segs[i]=name;options.strategy(target,name,i+1,segs,sources,mergePolicy)}}));if(thisPolicy.replace){break}}}return target};fluid.inEvaluationMarker=Object.freeze({__CURRENTLY_IN_EVALUATION__:true});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')}if(fluid.isPrimitive(target)){return undefined}if(fluid.isTracing){fluid.tracing.pathCount.push(fluid.path(segs.slice(0,i)))}var oldTarget;if(name in target||options.fullyEvaluated){oldTarget=target[name];if(!options.evaluateFully){return oldTarget}}if(sources===undefined){segs=fluid.makeArray(segs);sources=fluid.regenerateSources(options.sources,segs,i-1,options.sourceStrategies);policy=fluid.regenerateCursor(options.mergePolicy,segs,i-1,fluid.concreteTrundler)}var newPolicyHolder=fluid.concreteTrundler(policy,name);var newPolicy=fluid.derefMergePolicy(newPolicyHolder);var start,limit,mul;if(newPolicy.replace){start=1-sources.length;limit=0;mul=-1}else{start=0;limit=sources.length-1;mul=+1}var newSources=[];var thisTarget;for(var j=start;j<=limit;++j){var k=mul*j;var thisSource=options.sourceStrategies[k](sources[k],name,i,segs);if(thisSource!==undefined){if(!fluid.isPrimitive(thisSource)){newSources[k]=thisSource}if(oldTarget===undefined){if(mul===-1){thisTarget=target[name]=thisSource;break}else{thisTarget=fluid.mergeOneImpl(thisTarget,thisSource,j,newSources,newPolicy,newPolicyHolder,i,segs,options);target[name]=thisTarget}}}}if(oldTarget!==undefined){thisTarget=oldTarget}if(newSources.length>0){if(fluid.isPlainObject(thisTarget)){fluid.fetchMergeChildren(thisTarget,i,segs,newSources,newPolicyHolder,options)}}return thisTarget};options.strategy=strategy;return strategy};fluid.driveStrategy=function(root,pathSegs,strategy){pathSegs=fluid.makeArray(pathSegs);for(var i=0;i<pathSegs.length;++i){if(!root){return undefined}root=strategy(root,pathSegs[i],i+1,pathSegs)}return root};fluid.concreteTrundler=function(source,seg){return!source?undefined:source[seg]};fluid.merge=function(policy,...sources){var compiled=fluid.compileMergePolicy(policy).builtins;var options=fluid.makeMergeOptions(compiled,sources,{});options.initter();return options.target};fluid.makeMergeOptions=function(policy,sources,userOptions){var options={mergePolicy:policy,sources:sources};options=$.extend(options,userOptions);options.target=options.target||fluid.freshContainer(options.sources[0]);options.sourceStrategies=options.sourceStrategies||fluid.generate(options.sources.length,fluid.concreteTrundler);options.initter=function(){options.evaluateFully=true;fluid.fetchMergeChildren(options.target,0,[],options.sources,options.mergePolicy,options);options.fullyEvaluated=true};fluid.makeMergeStrategy(options);return options};fluid.transformOptions=function(options,transRec){fluid.expect("Options transformation record",transRec,["transformer","config"]);var transFunc=fluid.getGlobalValue(transRec.transformer);return transFunc.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||source==="target"?"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 true}else{byNamespace[ns]=mergeBlock.contextThat.id}}}))};fluid.mergeRecordTypes={defaults:1e3,defaultValueMerge:900,lensedComponents:800,subcomponentRecord:700,user:600,distribution:100};fluid.model.applyChangeRequest=function(model,request){var segs=request.segs;if(segs.length===0){if(request.type==="ADD"){$.extend(true,model,request.value)}else{fluid.clear(model)}}else if(request.type==="ADD"){fluid.model.setSimple(model,request.segs,request.value)}else{for(var i=0;i<segs.length-1;++i){model=model[segs[i]];if(!model){return}}var last=fluid.peek(segs);delete model[last]}};fluid.destroyValue=function(target,segs){if(target){fluid.model.applyChangeRequest(target,{type:"DELETE",segs:segs})}};fluid.mergeComponentOptions=function(that,potentia,lightMerge){fluid.validateCreatorGrade("Cannot construct component of",lightMerge.type);var sharedMergePolicy={};var mergeBlocks=fluid.expandComponentOptions(sharedMergePolicy,potentia,lightMerge,that);var options={};var sourceStrategies=[],sources=[];var baseMergeOptions={target:options,sourceStrategies:sourceStrategies};var updateBlocks=function(){fluid.each(mergeBlocks,(function(block){if(fluid.isPrimitive(block.priority)){block.priority=fluid.parsePriority(block.priority,0,false,block.recordType)}}));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 mergeOptions=fluid.makeMergeOptions(sharedMergePolicy,sources,baseMergeOptions);mergeOptions.mergeBlocks=mergeBlocks;mergeOptions.updateBlocks=updateBlocks;mergeOptions.destroyValue=function(segs){for(var i=0;i<mergeBlocks.length;++i){if(!mergeBlocks[i].immutableTarget){fluid.destroyValue(mergeBlocks[i].target,segs)}}fluid.destroyValue(baseMergeOptions.target,segs)};var compiledPolicy;var mergePolicy;function computeMergePolicy(){mergePolicy=fluid.driveStrategy(options,"mergePolicy",mergeOptions.strategy);mergePolicy=$.extend({},fluid.rootMergePolicy,mergePolicy);compiledPolicy=fluid.compileMergePolicy(mergePolicy);$.extend(true,sharedMergePolicy,compiledPolicy.builtins)}computeMergePolicy();mergeOptions.computeMergePolicy=computeMergePolicy;if(compiledPolicy.hasDefaults){mergeBlocks.push(fluid.generateExpandBlock({options:compiledPolicy.defaultValues,recordType:"defaultValueMerge",priority:fluid.mergeRecordTypes.defaultValueMerge},that,{}));updateBlocks()}that.options=options;fluid.driveStrategy(options,"gradeNames",mergeOptions.strategy);fluid.deliverOptionsStrategy(that,options,mergeOptions);fluid.computeComponentAccessor(that,potentia.localRecord);var transformOptions=fluid.driveStrategy(options,"transformOptions",mergeOptions.strategy);if(transformOptions){fluid.transformOptionsBlocks(mergeBlocks,transformOptions,["user","subcomponentRecord"]);updateBlocks()}if(!baseMergeOptions.target.mergePolicy){computeMergePolicy()}return mergeOptions};fluid.defaults("fluid.function",{});fluid.invokeGradedFunction=function(name,spec){var defaults=fluid.defaults(name);if(!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=[];fluid.each(defaults.argumentMap,(function(value,key){args[value]=spec[key]}));return fluid.invokeGlobalFunction(name,args)};fluid.noNamespaceDistributionPrefix="no-namespace-distribution-";fluid.mergeOneDistribution=function(target,source,key){var namespace=source.namespace||key||fluid.noNamespaceDistributionPrefix+fluid.allocateGuid();source.namespace=namespace;target[namespace]=$.extend(true,{},target[namespace],source)};fluid.distributeOptionsPolicy=function(target,source){target=target||{};if(fluid.isArrayable(source)){for(var i=0;i<source.length;++i){fluid.mergeOneDistribution(target,source[i])}}else if(typeof source.target==="string"){fluid.mergeOneDistribution(target,source)}else{fluid.each(source,(function(oneSource,key){fluid.mergeOneDistribution(target,oneSource,key)}))}return target};fluid.mergingArray=function(){};fluid.mergingArray.prototype=[];fluid.deferringMergePolicy=function(target,source,mergePolicyHolder){target=target||{};fluid.each(source,(function(oneSource,key){if(!target[key]){target[key]=new fluid.mergingArray}if(fluid.derefMergePolicy(mergePolicyHolder[key]).replace&&oneSource!==undefined){target[key].length=0}if(oneSource instanceof fluid.mergingArray){target[key].push.apply(target[key],oneSource)}else if(oneSource!==undefined){target[key].push(oneSource)}}));return target};fluid.invokerStrategies=fluid.arrayToHash(["func","funcName","listener","this","method","changePath","value"]);fluid.invokersMergePolicy=function(target,source){target=target||{};fluid.each(source,(function(oneInvoker,name){if(!oneInvoker){target[name]=oneInvoker;return}else{oneInvoker=fluid.upgradePrimitiveFunc(oneInvoker)}var oneT=target[name];if(!oneT){oneT=target[name]={}}for(var key in fluid.invokerStrategies){if(key in oneInvoker){for(var key2 in fluid.invokerStrategies){oneT[key2]=undefined}}}$.extend(oneT,oneInvoker)}));return target};fluid.rootMergePolicy=fluid.freezeRecursive({gradeNames:fluid.arrayConcatPolicy,distributeOptions:fluid.distributeOptionsPolicy,members:{noexpand:true,func:fluid.deferringMergePolicy},invokers:{noexpand:true,func:fluid.invokersMergePolicy},components:{noexpand:true,func:fluid.deferringMergePolicy},dynamicComponents:{noexpand:true,func:fluid.deferringMergePolicy},transformOptions:"replace",listeners:fluid.makeMergeListenersPolicy(fluid.mergeListenerPolicy)});fluid.defaults("fluid.component",{mergePolicy:fluid.rootMergePolicy,argumentMap:{options:0},workflows:{local:{concludeComponentObservation:{funcName:"fluid.concludeComponentObservation",priority:"first"},concludeComponentInit:{funcName:"fluid.concludeComponentInit",waitIO:true,priority:"last"}}},events:{onCreate:"promise",onDestroy:"promise",afterDestroy:"promise"}});fluid.computeNickName=function(typeName){var segs=fluid.model.parseEL(typeName);return fluid.peek(segs)};fluid.isDestroyed=function(that,strict){return that.lifecycleStatus==="destroyed"||!strict&&that.lifecycleStatus==="destroying"};fluid.computeGlobalMemberName=function(type,id){var nickName=fluid.computeNickName(type);return nickName+"-"+id};fluid.adaptTransactionFailure=function(transRec){var returned=false;transRec.promise.then(null,(function(e){if(!returned){throw e}else{if(transRec.promise.onReject.length===0){fluid.fireUnhandledRejection(transRec.promise,e)}}}));returned=true};fluid.initFreeComponent=function(type,initArgs){var id=fluid.allocateGuid();var path=[fluid.computeGlobalMemberName(type,id)];var userRecord={recordType:"user",type:type};var upDefaults=fluid.defaults(type);var argMap=fluid.defaults(upDefaults.argumentMap.container!==undefined?"fluid.viewComponent":"fluid.component").argumentMap;fluid.each(argMap,(function(index,name){var arg=initArgs[index];userRecord[name]=name==="options"?fluid.expandCompact(arg,true):arg}));var potentia={type:"create",path:path,componentId:id,records:[userRecord]};var transRec=fluid.registerPotentia(potentia);var shadow=fluid.commitPotentiae(transRec.transactionId);fluid.adaptTransactionFailure(transRec);return shadow&&shadow.that};var charStart="(?:[\\w\\u00c0-\\uFFFF*_-";fluid.simpleCSSMatcher={regexp:new RegExp("([#.]?)("+charStart+"]|\\\\.)+)","g"),charToTag:{"":"tag","#":"id",".":"clazz"}};fluid.IoCSSMatcher={regexp:new RegExp("([&#]?)("+charStart+"]|\\.|\\/)+)","g"),charToTag:{"":"context","&":"context","#":"id"}};var childSeg=new RegExp("\\s*(>)?\\s*","g");fluid.parseSelector=function(selstring,strategy){var togo=[];selstring=selstring.trim();var regexp=strategy.regexp;regexp.lastIndex=0;var lastIndex=0;while(true){var atNode=[];var first=true;while(true){var segMatch=regexp.exec(selstring);if(!segMatch){break}if(segMatch.index!==lastIndex){if(first){fluid.fail("Error in selector string - cannot match child selector expression starting at "+selstring.substring(lastIndex))}else{break}}var thisNode={};var text=segMatch[2];var targetTag=strategy.charToTag[segMatch[1]];if(targetTag){thisNode[targetTag]=text}atNode[atNode.length]=thisNode;lastIndex=regexp.lastIndex;first=false}childSeg.lastIndex=lastIndex;var fullAtNode={predList:atNode};var 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))}if(childMatch[1]===">"){fullAtNode.child=true}togo[togo.length]=fullAtNode;if(childSeg.lastIndex>=selstring.length){break}lastIndex=childSeg.lastIndex;regexp.lastIndex=childSeg.lastIndex}return togo};fluid.flattenObjectPaths=function(originalObject){var flattenedObject={};fluid.each(originalObject,(function(value,key){if(value!==null&&typeof value==="object"){var flattenedSubObject=fluid.flattenObjectPaths(value);fluid.each(flattenedSubObject,(function(subValue,subKey){flattenedObject[key+"."+subKey]=subValue}));if(typeof fluid.get(value,"toString")==="function"){flattenedObject[key]=value.toString()}}else{flattenedObject[key]=value}}));return flattenedObject};fluid.stringTemplate=function(template,values){var flattenedValues=fluid.flattenObjectPaths(values);var keys=fluid.keys(flattenedValues);keys=keys.sort(fluid.compareStringLength());for(var i=0;i<keys.length;++i){var key=keys[i];var templatePlaceholder="%"+key;var replacementValue=flattenedValues[key];var indexOfPlaceHolder=-1;while((indexOfPlaceHolder=template.indexOf(templatePlaceholder))!==-1){template=template.slice(0,indexOfPlaceHolder)+replacementValue+template.slice(indexOfPlaceHolder+templatePlaceholder.length)}}return template};
/*!
 Copyright 2011 unscriptable.com / John Hann
 Copyright The Infusion copyright holders
 See the AUTHORS.md file at the top-level directory of this distribution and at
 https://github.com/fluid-project/infusion/raw/main/AUTHORS.md.

 License MIT
*/
"use strict";fluid.promise=function(){var that={onResolve:[],onReject:[],onCancel:[]};that.then=function(onResolve,onReject,onCancel){fluid.promise.pushHandler(that,onResolve,"onResolve","resolve");fluid.promise.pushHandler(that,onReject,"onReject","reject");fluid.promise.pushHandler(that,onCancel,"onCancel","cancel");return that};that.resolve=function(value){if(that.disposition){if(that.disposition!=="cancel"){fluid.fail("Error: resolving promise ",that,' which has already received "'+that.disposition+'"')}}else{that.complete("resolve",that.onResolve,value)}return that};that.reject=function(reason){if(that.disposition){if(that.disposition!=="cancel"){fluid.fail("Error: rejecting promise ",that,'which has already received "'+that.disposition+'"')}}else{if(that.onReject.length===0){fluid.armUnhandledRejection(that,reason)}that.complete("reject",that.onReject,reason)}return that};that.cancel=function(reason){if(!that.disposition){that.complete("cancel",that.onCancel,reason)}};that.complete=function(which,queue,arg){that.disposition=which;that.value=arg;for(var i=0;i<queue.length;++i){queue[i](arg)}delete that.onResolve;delete that.onReject;delete that.onCancel};return that};fluid.promise.pushHandler=function(promise,handler,eventName,disposition){if(handler){if(promise.disposition){if(promise.disposition===disposition){handler(promise.value);promise.directHandle=disposition}}else{promise[eventName].push(handler)}}};fluid.armUnhandledRejection=function(promise,reason){fluid.invokeLater((function(){if(promise.directHandle!=="reject"){fluid.fireUnhandledRejection(promise,reason)}}))};fluid.fireUnhandledRejection=function(promise,reason){fluid.unhandledRejectionEvent.fire(reason,promise)};fluid.unhandledRejectionEvent=fluid.makeEventFirer({name:"Global unhandled rejection handler"});fluid.logUnhandledRejection=function(reason){fluid.log(fluid.logLevel.WARN,"Unhandled promise rejection: ",reason)};fluid.unhandledRejectionEvent.addListener(fluid.logUnhandledRejection,"log");fluid.isPromise=function(totest){return totest&&typeof totest.then==="function"};fluid.toPromise=function(promiseOrValue){if(fluid.isPromise(promiseOrValue)){return promiseOrValue}else{var togo=fluid.promise();togo.resolve(promiseOrValue);return togo}};fluid.promise.follow=function(source,target){source.then(target.resolve,target.reject);target.then(null,null,source.cancel)};fluid.promise.map=function(source,func){var promise=fluid.toPromise(source);var togo=fluid.promise();promise.then((function(value){var mapped=func(value);if(fluid.isPromise(mapped)){fluid.promise.follow(mapped,togo)}else{togo.resolve(mapped)}}),(function(error){togo.reject(error)}));return togo};fluid.promise.makeSequencer=function(sources,options,strategy){if(!fluid.isArrayable(sources)){fluid.fail("fluid.promise sequence algorithms must be supplied an array as source")}var sequencer={sources:sources,resolvedSources:[],index:0,strategy:strategy,options:options,returns:[],sequenceStarted:false,sequenceCancelled:false,promise:fluid.promise()};sequencer.promise.then(null,null,(function(){fluid.promise.cancelSequencer(sequencer)}));sequencer.promise.sequencer=sequencer;return sequencer};fluid.promise.cancelSequencer=function(sequencer){sequencer.sequenceCancelled=true;sequencer.resolvedSources.forEach((function(source){if(fluid.isPromise(source)){source.cancel()}}))};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;i>=0;--i){var resolved=that.resolvedSources[i];var accumulator=fluid.isPromise(resolved)&&typeof resolved.accumulateRejectionReason==="function"?resolved.accumulateRejectionReason:fluid.identity;error=accumulator(error)}that.promise.reject(error)};fluid.promise.resumeSequence=function(that){that.sequenceStarted=true;if(that.sequenceCancelled){return}else 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;if(fluid.isPromise(value)){value.then((function(retValue){fluid.promise.progressSequence(that,retValue)}),(function(error){fluid.promise.processSequenceReject(that,error)}))}else{fluid.promise.progressSequence(that,value)}}};fluid.promise.makeSequenceStrategy=function(){return{invokeNext:function(that){var source=that.sources[that.index];return typeof source==="function"?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());fluid.promise.resumeSequence(sequencer);return sequencer.promise};fluid.promise.makeTransformerStrategy=function(){return{invokeNext:function(that){var lisrec=that.sources[that.index];lisrec.listener=fluid.event.resolveListener(lisrec.listener);var value=lisrec.listener.apply(null,[that.returns[that.index],that.options]);return value},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());sequencer.returns.push(null);return sequencer};fluid.promise.filterNamespaces=function(listeners,namespaces){if(!namespaces){return listeners}return fluid.remove_if(fluid.makeArray(listeners),(function(element){return element.namespace&&!element.softNamespace&&!namespaces.includes(element.namespace)}))};fluid.promise.fireTransformEvent=function(event,payload,options){options=options||{};var listeners=options.reverse?fluid.makeArray(event.sortedListeners).reverse():fluid.makeArray(event.sortedListeners);listeners=fluid.promise.filterNamespaces(listeners,options.filterNamespaces);var sequencer=fluid.promise.makeTransformer(listeners,payload,options);var canceller=sequencer.promise.cancel;var remover=function(){fluid.remove_if(event.onDestroy,(function(func){return func===canceller}))};fluid.event.addPrimitiveListener(event,"onDestroy",canceller);sequencer.promise.then(remover,remover,remover);fluid.promise.resumeSequence(sequencer);return sequencer.promise};"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){togo.resolve(undefined)}else{try{togo.resolve(JSON.parse(string))}catch(err){togo.reject(err)}}return togo};fluid.dataSource.stringifyJSON=function(obj){return obj===undefined?"":JSON.stringify(obj,null,4)};fluid.defaults("fluid.dataSource",{gradeNames:["fluid.component","fluid.contextAware"],contextAwareness:{writable:{checks:{writableValue:{contextValue:"{fluid.dataSource}.options.writable",gradeNames:"{fluid.dataSource}.options.writableGrade"}}}},writable:false,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,requestOptions){promise.then(requestOptions.callback,requestOptions.onError?requestOptions.onError:that.events.onError.fire)};fluid.dataSource.defaultiseOptions=function(componentOptions,directOptions,directModel,isSet){var options=typeof directOptions==="function"?{callback:directOptions}:fluid.copy(directOptions)||{};options.directModel=directModel;options.operation=isSet?"set":"get";options.notFoundIsEmpty=options.notFoundIsEmpty||componentOptions.notFoundIsEmpty;return options};fluid.dataSource.get=function(that,directModel,directOptions){var requestOptions=fluid.dataSource.defaultiseOptions(that.options,directOptions,directModel);var promise=fluid.promise.fireTransformEvent(that.events.onRead,undefined,requestOptions);fluid.dataSource.registerStandardPromiseHandlers(that,promise,requestOptions);return promise};fluid.dataSource.set=function(that,directModel,model,directOptions){var requestOptions=fluid.dataSource.defaultiseOptions(that.options,directOptions,directModel,true);var transformPromise=fluid.promise.fireTransformEvent(that.events.onWrite,model,requestOptions);var togo=fluid.promise();transformPromise.then((function(setResponse){var options2=fluid.dataSource.defaultiseOptions(that.options,fluid.copy(requestOptions),directModel);var retransformed=fluid.promise.fireTransformEvent(that.events.onWriteResponse,setResponse,options2);fluid.promise.follow(retransformed,togo)}),(function(error){togo.reject(error)}));fluid.dataSource.registerStandardPromiseHandlers(that,togo,requestOptions);return togo};fluid.defaults("fluid.dataSource.URL",{gradeNames:["fluid.dataSource"],writableGrade:"fluid.dataSource.URL.writable",invokers:{resolveUrl:"fluid.dataSource.URL.resolveUrl",handleHttp:"fluid.dataSource.URL.handleHttp"},listeners:{"onRead.impl":{funcName:"fluid.dataSource.URL.handle",args:["{that}","{that}.options.permittedRequestOptions","{arguments}.0","{arguments}.1"]}},permittedRequestOptions:"fluid.dataSource.URL.requestOptions",components:{cookieJar:"{cookieJar}"},termMap:{}});fluid.defaults("fluid.dataSource.URL.writable",{gradeNames:["fluid.dataSource.writable"],listeners:{"onWrite.impl":{funcName:"fluid.dataSource.URL.handle",args:["{that}","{that}.options.permittedRequestOptions","{arguments}.0","{arguments}.1"]}}});fluid.dataSource.URL.resolveUrl=function(url,termMap,directModel,noencode){var map=fluid.transform(termMap,(function resolve(entry){entry=String(entry);var encode=!noencode;if(entry.indexOf("noencode:")===0){encode=false;entry=entry.substring("noencode:".length)}var value=entry.charAt(0)==="%"?fluid.get(directModel,entry.substring(1)):entry;if(encode){value=encodeURIComponent(value)}return value}));var replaced=fluid.stringTemplate(url,map);return replaced};fluid.dataSource.URL.urlFields=fluid.freezeRecursive(["protocol","username","password","hostname","port","pathname","search"]);fluid.dataSource.URL.condenseUrl=function(requestOptions){var togo=new fluid.resourceLoader.UrlClass("http://localhost/");fluid.dataSource.URL.urlFields.forEach((function(field){if(requestOptions[field]){togo[field]=requestOptions[field]}}));return togo};fluid.dataSource.URL.requestOptions=fluid.dataSource.URL.urlFields.concat(["url","method","headers","termMap"]);fluid.dataSource.URL.prepareRequestOptions=function(componentOptions,cookieJar,userOptions,permittedOptions,directModel,userStaticOptions){var staticOptions=fluid.filterKeys(componentOptions,permittedOptions);var requestOptions=fluid.extend(true,{headers:{}},userStaticOptions,staticOptions,userOptions);if(fluid.contextAware.isNode()){if(requestOptions.hostname==="localhost"){requestOptions.hostname="127.0.0.1"}}requestOptions.writeMethod=requestOptions.writeMethod||componentOptions.writeMethod||"PUT";requestOptions.pathname=fluid.dataSource.URL.resolveUrl(requestOptions.pathname,requestOptions.termMap,directModel);if(cookieJar&&cookieJar.cookie&&componentOptions.storeCookies){requestOptions.headers.Cookie=cookieJar.cookie}return requestOptions};fluid.dataSource.URL.parse=function(url,permittedOptions){var parsed=fluid.filterKeys(new fluid.resourceLoader.UrlClass(url,typeof window!=="undefined"&&window.location||undefined),fluid.dataSource.URL.urlFields);permittedOptions.forEach((function(oneOption){if(!parsed[oneOption]){delete parsed[oneOption]}}));return parsed};fluid.dataSource.URL.isErrorStatus=function(statusCode){return statusCode<200||statusCode>=300};fluid.dataSource.URL.handle=function(that,permittedRequestOptions,model,userOptions){var permittedOptions=fluid.getGlobalValue(permittedRequestOptions);permittedOptions.forEach((function(oneOption){fluid.getForComponent(that,["options",oneOption])}));var directModel=userOptions.directModel;var url=that.resolveUrl(that.options.url,that.options.termMap,directModel);var parsed=fluid.dataSource.URL.parse(url,permittedOptions);var finalRequestOptions=fluid.dataSource.URL.prepareRequestOptions(that.options,that.cookieJar,userOptions,permittedOptions,directModel,parsed);return that.handleHttp(that,finalRequestOptions,model)};fluid.extractHtmlError=function(received){var matches=/<pre>(.*)<\/pre>/gm.exec(received);return matches?matches[1]:received};fluid.dataSource.URL.relayError=function(statusCode,received,whileMsg){var rejectPayload;try{rejectPayload=JSON.parse(received)}catch(e){var message=typeof received==="string"&&received.indexOf("<html")!==-1?fluid.extractHtmlError(received):received;rejectPayload={message:message}}rejectPayload.message=rejectPayload.message||rejectPayload.error;delete rejectPayload.error;rejectPayload.isError=true;rejectPayload.statusCode=statusCode;return fluid.upgradeError(rejectPayload,whileMsg)};"use strict";var fluid=fluid||{};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"}};fluid.assignJQueryBrowser=function($){if(!$.browser){var matched=fluid.uaMatch(navigator.userAgent);var browser={};if(matched.browser){browser[matched.browser]=true;browser.version=matched.version}if(browser.chrome){browser.webkit=true}else if(browser.webkit){browser.safari=true}$.browser=browser}};fluid.assignJQueryBrowser(jQuery);fluid.getScopedData=function(target,key){var data=$(target).data("fluid-scoped-data");return data?data[key]:undefined};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)}))};fluid.lastFocusedElement=null;$(document).on("focusin",(function(event){fluid.lastFocusedElement=event.target}));fluid.enabled=function(target,state){target=$(target);if(state===undefined){return fluid.getScopedData(target,"enablement")!==false}else{$("*",target).add(target).each((function(){if(fluid.getScopedData(this,"enablement")!==undefined){fluid.setScopedData(this,"enablement",state)}else if(/select|textarea|input/i.test(this.nodeName)){$(this).prop("disabled",!state)}}));fluid.setScopedData(target,"enablement",state)}};fluid.initEnablement=function(target){fluid.setScopedData(target,"enablement",true)};fluid.resolveEventTarget=function(event){while(event.originalEvent&&event.originalEvent.target){event=event.originalEvent}return event.target};async function applyOp(node,func){node=$(node)[0];if(node){var promise=new Promise((function(resolve){node.addEventListener(func,resolve,{once:true})}));node[func]();return promise}}$.each(["focus","blur"],(function(i,name){fluid[name]=function(elem){return applyOp(elem,name)}}));"use strict";fluid.dom=fluid.dom||{};fluid.dom.getNextNode=function(iterator){if(iterator.node.firstChild){iterator.node=iterator.node.firstChild;iterator.depth+=1;return iterator}while(iterator.node){if(iterator.node.nextSibling){iterator.node=iterator.node.nextSibling;return iterator}iterator.node=iterator.node.parentNode;iterator.depth-=1}return iterator};fluid.dom.iterateDom=function(node,acceptor,allNodes){var currentNode={node:node,depth:0};var prevNode=node;var condition;while(currentNode.node!==null&&currentNode.depth>=0&&currentNode.depth<fluid.dom.iterateDom.DOM_BAIL_DEPTH){condition=null;if(currentNode.node.nodeType===1||allNodes){condition=acceptor(currentNode.node,currentNode.depth)}if(condition){if(condition==="delete"){currentNode.node.parentNode.removeChild(currentNode.node);currentNode.node=prevNode}else if(condition==="stop"){return currentNode.node}}prevNode=currentNode.node;currentNode=fluid.dom.getNextNode(currentNode)}};fluid.dom.iterateDom.DOM_BAIL_DEPTH=256;"use strict";fluid.unUnicode=/(\\u[\dabcdef]{4}|\\x[\dabcdef]{2})/g;fluid.unescapeProperties=function(string){string=string.replace(fluid.unUnicode,(function(match){var code=match.substring(2);var parsed=parseInt(code,16);return String.fromCharCode(parsed)}));var pos=0;while(true){var backpos=string.indexOf("\\",pos);if(backpos===-1){break}if(backpos===string.length-1){return[string.substring(0,string.length-1),true]}var replace=string.charAt(backpos+1);if(replace==="n"){replace="\n"}if(replace==="r"){replace="\r"}if(replace==="t"){replace="\t"}string=string.substring(0,backpos)+replace+string.substring(backpos+2);pos=backpos+1}return[string,false]};fluid.breakPos=/[^\\][\s:=]/;fluid.parseJavaProperties=function(text){var togo={};text=text.replace(/\r\n/g,"\n");text=text.replace(/\r/g,"\n");var lines=text.split("\n");var contin,key,valueComp,valueRaw,valueEsc;for(var i=0;i<lines.length;++i){var line=lines[i].trim();if(!line||line.charAt(0)==="#"||line.charAt(0)==="!"){continue}if(!contin){valueComp="";var breakpos=line.search(fluid.breakPos);if(breakpos===-1){key=line;valueRaw=""}else{key=line.substring(0,breakpos+1).trim();valueRaw=line.substring(breakpos+2).trim();if(valueRaw.charAt(0)===":"||valueRaw.charAt(0)==="="){valueRaw=valueRaw.substring(1).trim()}}key=fluid.unescapeProperties(key)[0];valueEsc=fluid.unescapeProperties(valueRaw)}else{valueEsc=fluid.unescapeProperties(line)}contin=valueEsc[1];if(!valueEsc[1]){togo[key]=valueComp+valueEsc[0]}else{valueComp+=valueEsc[0]}}return togo};fluid.formatMessage=function(messageString,args){if(!args){return messageString}if(typeof args==="string"){args=[args]}for(var i=0;i<args.length;++i){messageString=messageString.replace("{"+i+"}",args[i])}return messageString};"use strict";fluid.renderTimestamp=function(date){var zeropad=function(num,width){if(!width){width=2}var numstr=num===undefined?"":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=false;fluid.registerNamespace("fluid.tracing");fluid.tracing.pathCount=[];fluid.tracing.summarisePathCount=function(pathCount){pathCount=pathCount||fluid.tracing.pathCount;var togo={};for(var i=0;i<pathCount.length;++i){var path=pathCount[i];if(!togo[path]){togo[path]=1}else{++togo[path]}}var toReallyGo=[];fluid.each(togo,(function(el,path){toReallyGo.push({path:path,count:el})}));toReallyGo.sort((function(a,b){return b.count-a.count}));return toReallyGo};fluid.tracing.condensePathCount=function(prefixes,pathCount){prefixes=fluid.makeArray(prefixes);var prefixCount={};fluid.each(prefixes,(function(prefix){prefixCount[prefix]=0}));var togo=[];fluid.each(pathCount,(function(el){var path=el.path;if(!fluid.find(prefixes,(function(prefix){if(path.indexOf(prefix)===0){prefixCount[prefix]+=el.count;return true}}))){togo.push(el)}}));fluid.each(prefixCount,(function(count,path){togo.unshift({path:path,count:count})}));return togo};fluid.obtainException=function(){return new Error("Trace exception")};fluid.registerNamespace("fluid.exceptionDecoders");fluid.decodeStack=function(){var e=fluid.obtainException();return fluid.exceptionDecoders.standard(e)};fluid.exceptionDecoders.standard=function(e){var delimiter="at ";var lines=e.stack.replace(/(?:\n@:0)?\s+$/m,"").replace(/^\(/gm,"{anonymous}(").split("\n");return fluid.transform(lines,(function(line){line=line.replace(/\)/g,"");var atind=line.indexOf(delimiter);return atind===-1?[line]:[line.substring(atind+delimiter.length),line.substring(0,atind)]}))};fluid.getCallerInfo=function(atDepth){atDepth=atDepth||3;var stack=fluid.decodeStack();var element=stack&&stack[atDepth]&&stack[atDepth][0];if(element){var lastslash=element.lastIndexOf("/");if(lastslash===-1){lastslash=0}var nextColon=element.indexOf(":",lastslash);return{path:element.substring(0,lastslash),filename:element.substring(lastslash+1,nextColon),index:element.substring(nextColon+1)}}else{return null}};fluid.generatePadding=function(c,count){var togo="";for(var 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.prettyPrintJSONImpl=function(obj,small,options){function out(str){options.output+=str}var big=small+options.indentChars,isFunction=typeof obj==="function";if(options.maxRenderChars!==undefined&&options.output.length>options.maxRenderChars){return true}if(obj===null){out("null")}else if(obj===undefined){out("undefined")}else if(obj===fluid.SYNTHETIC_PROPERTY){out("[Synthetic property]")}else if(fluid.isPrimitive(obj)&&!isFunction){out(JSON.stringify(obj))}else{if(options.stack.indexOf(obj)!==-1){out("(CIRCULAR)");return}options.stack.push(obj);var i;if(fluid.isArrayable(obj)){if(obj.length===0){out("[]")}else{out("[\n"+big);for(i=0;i<obj.length;++i){if(fluid.prettyPrintJSONImpl(obj[i],big,options)){return true}if(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];var value=fluid.getSafeProperty(obj,key);out(JSON.stringify(key)+": ");if(fluid.prettyPrintJSONImpl(value,big,options)){return true}if(i!==keys.length-1){out(",\n"+big)}}out("\n"+small+"}")}options.stack.pop()}return};fluid.prettyPrintJSON=function(obj,options){options=$.extend({indent:4,stack:[],output:""},options);options.indentChars=fluid.generatePadding(" ",options.indent);fluid.prettyPrintJSONImpl(obj,"",options);return options.output};fluid.dumpEl=function(element){var togo;if(!element){return"null"}if(element.nodeType===3||element.nodeType===8){return"[data: "+element.data+"]"}if(element.nodeType===9){return"[document: location "+element.location+"]"}if(!element.nodeType&&fluid.isArrayable(element)){togo="[";for(var i=0;i<element.length;++i){togo+=fluid.dumpEl(element[i]);if(i<element.length-1){togo+=", "}}return togo+"]"}element=$(element);togo=element.get(0).tagName;if(element.id){togo+="#"+element.id}if(element.attr("class")){togo+="."+element.attr("class")}return togo};fluid["debugger"]=function(){debugger};fluid.defaults("fluid.debuggingProbe",{gradeNames:["fluid.component"]});fluid.probeToDistribution=function(probe){var instantiator=fluid.globalInstantiator;var parsed=fluid.parseContextReference(probe.target);var segs=fluid.model.parseToSegments(parsed.path,instantiator.parseEL,true);if(segs[0]!=="options"){segs.unshift("options")}var parsedPriority=fluid.parsePriority(probe.priority);if(parsedPriority.constraint&&!parsedPriority.constraint.target){parsedPriority.constraint.target="authoring"}return{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);var memberName="fluid_debuggingProbe_"+fluid.allocateGuid();fluid.construct([memberName],{type:"fluid.debuggingProbe",distributeOptions:probeDistribution});return memberName};fluid.deregisterProbes=function(probeName){fluid.destroy([probeName])};"use strict";fluid.visitComponentChildren=function(that,visitor,options,segs){segs=segs||[];var shadow=fluid.shadowForComponent(that);for(var name in shadow.childComponents){var component=shadow.childComponents[name];if(options.visited&&options.visited[component.id]){continue}segs.push(name);if(options.visited){options.visited[component.id]=true}if(visitor(component,name,segs,segs.length-1)){return true}if(!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];var contextHashes=[fluid.getContextHash(instantiator,that)];var visitorWrapper=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)};fluid.visitComponentChildren(that,visitorWrapper,options,[])};fluid.getMemberNames=function(instantiator,thatStack){if(thatStack.length===0){return[]}else{var path=instantiator.idToPath(fluid.peek(thatStack).id);var segs=instantiator.parseEL(path);segs.unshift.apply(segs,fluid.generate(thatStack.length-segs.length,""));return segs}};fluid.visitComponentsForVisibility=function(instantiator,thatStack,visitor,options){options=options||{visited:{},flat:true,instantiator:instantiator};var memberNames=fluid.getMemberNames(instantiator,thatStack);for(var i=thatStack.length-1;i>=0;--i){var that=thatStack[i];options.visited[that.id]=true;if(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){return}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):undefined;fluid.popActivity();return invoker};fluid.memberFromRecord=function(memberrecs,name,that){var shadow=fluid.shadowForComponent(that);var togo;for(var i=0;i<memberrecs.length;++i){var expanded=fluid.expandImmediate(memberrecs[i],that,shadow.localRecord);if(!fluid.isPlainObject(togo)){togo=expanded}else{togo=$.extend(true,togo,expanded)}}return togo};fluid.resourceFromRecord=function(resourceRec,name,that){var resourceFetcher=fluid.getForComponent(that,"resourceFetcher");var resourceSpec=resourceFetcher.resourceSpecs[name];var oneFetcher=new fluid.fetchResources.FetchOne(resourceSpec,resourceFetcher);var existing=that.resources[name];if(existing&&existing!==fluid.inEvaluationMarker){return existing}else{var promise=oneFetcher.resourceSpec.promise;if(!promise.disposition){var transRec=fluid.currentTreeTransaction();transRec.pendingIO.push(promise)}return oneFetcher}};fluid.recordStrategy=function(that,options,optionsStrategy,recordPath,recordMaker,prefix,exceptions){prefix=prefix||[];var fullyEvaluated=false;return{strategy:function(target,name,i){if(i!==1||fullyEvaluated){return}var record=fluid.driveStrategy(options,[recordPath,name],optionsStrategy);if(record===undefined){if(prefix.length>0){fluid.fail("Reference to "+recordPath+" record with name "+name+" which is not registered for component "+fluid.dumpComponentAndPath(that))}else{return}}fluid.set(target,[name],fluid.inEvaluationMarker);var member=recordMaker(record,name,that);fluid.set(target,[name],member);return member},initter:function(){var records=fluid.driveStrategy(options,recordPath,optionsStrategy)||{};for(var name in records){if(!exceptions||!exceptions[name]){fluid.getForComponent(that,prefix.concat([name]))}}fullyEvaluated=true}}};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:{}};fluid.model.applyChangeRequest(record,{segs:targetSegs,type:"ADD",value:source});fluid.checkComponentRecord(record,fluid.componentRecordExpected);fluid.popActivity();return $.extend(record,{contextThat:contextThat,recordType:sourceType})};fluid.filterBlocks=function(contextThat,sourceBlocks,sourceSegs,targetSegs,exclusions,removeSource){var togo=[];fluid.each(sourceBlocks,(function(block){var source=fluid.get(block.source,sourceSegs);if(source!==undefined){togo.push(fluid.makeDistributionRecord(contextThat,block.source,sourceSegs,targetSegs,exclusions,"distribution"));var rescued=$.extend({},source);if(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)}))}}));return togo};fluid.noteCollectedDistribution=function(parentShadow,memberName,distribution){fluid.model.setSimple(parentShadow,["collectedDistributions",memberName,distribution.id],true)};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=fluid.peek(memberNames);if(!fluid.isCollectedDistribution(parentShadow,lastMember,distribution)&&fluid.matchIoCSelector(distribution.selector,thatStack,contextHashes,memberNames,i)){distributedBlocks.push.apply(distributedBlocks,fluid.copy(distribution.blocks));fluid.noteCollectedDistribution(parentShadow,lastMember,distribution)}};fluid.registerCollectedClearer=function(shadow,parentShadow,memberName){if(!shadow.collectedClearer&&parentShadow){shadow.collectedClearer=function(){fluid.clearCollectedDistributions(parentShadow,memberName)}}};fluid.receiveDistributions=function(parentThat,gradeNames,memberName,that){var instantiator=fluid.getInstantiator(parentThat||that);var thatStack=instantiator.getThatStack(parentThat||that);thatStack.unshift(fluid.rootComponent);var memberNames=fluid.getMemberNames(instantiator,thatStack);var shadows=fluid.transform(thatStack,(function(thisThat){return instantiator.idToShadow[thisThat.id]}));var parentShadow=shadows[shadows.length-(parentThat?1:2)];var contextHashes=fluid.getMembers(shadows,"contextHash");if(parentThat){memberNames.push(memberName);contextHashes.push(fluid.gradeNamesToHash(gradeNames));thatStack.push(that)}else{fluid.registerCollectedClearer(fluid.peek(shadows),parentShadow,fluid.peek(memberNames))}var distributedBlocks=[];for(var 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){var i=0;while(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);var targetStack=instantiator.getThatStack(targetThat);var targetPath=fluid.getMemberNames(instantiator,targetStack);var sourceStack=instantiator.getThatStack(distributedBlock.contextThat);var sourcePath=fluid.getMemberNames(instantiator,sourceStack);var 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)}));var mergeOptions=targetShadow.mergeOptions;mergeOptions.mergeBlocks.push.apply(mergeOptions.mergeBlocks,distributedBlocks);mergeOptions.updateBlocks();return distributedBlocks};fluid.matchIoCSelector=function(selector,thatStack,contextHashes,memberNames,i){var thatpos=thatStack.length-1;var selpos=selector.length-1;while(true){var isChild=selector[selpos].child;var mustMatchHere=thatpos===thatStack.length-1||isChild;var that=thatStack[thatpos];var selel=selector[selpos];var match=true;for(var j=0;j<selel.predList.length;++j){var pred=selel.predList[j];var context=pred.context;if(context&&context!=="*"&&!(contextHashes[thatpos][context]||memberNames[thatpos]===context)){match=false;break}if(pred.id&&that.id!==pred.id){match=false;break}}if(selpos===0&&thatpos>i&&mustMatchHere&&isChild){match=false}if(match){if(selpos===0){return true}--thatpos;--selpos}else{if(mustMatchHere){return false}else{--thatpos}}if(thatpos<i){return false}}return false};fluid.queryIoCSelector=function(root,selector,flat){var parsed=fluid.parseSelector(selector,fluid.IoCSSMatcher);var togo=[];fluid.visitComponentsForMatching(root,{flat:flat},(function(that,thatStack,contextHashes){if(fluid.matchIoCSelector(parsed,thatStack,contextHashes,[],1)){togo.push(that)}}));return togo};fluid.isIoCSSSelector=function(context){return context.indexOf(" ")!==-1};fluid.pushDistributions=function(targetHead,selector,target,blocks){var targetShadow=fluid.shadowForComponent(targetHead);var id=fluid.allocateGuid();var distribution={id:id,target:target,selector:selector,blocks:blocks};Object.freeze(distribution);Object.freeze(distribution.blocks);distribution.blocks.forEach((function(block){fluid.freezeRecursive(block.options)}));fluid.pushArray(targetShadow,"distributions",distribution);return id};fluid.clearDistribution=function(targetHeadId,id){var targetHeadShadow=fluid.globalInstantiator.idToShadow[targetHeadId];if(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;var context=predList[0].context;predList.length=0;return context};fluid.parseExpectedOptionsPath=function(path,role){var segs=fluid.model.parseEL(path);if(segs[0]!=="options"){fluid.fail("Error in options distribution path ",path," - only "+role+' paths beginning with "options" are supported')}return segs.slice(1)};fluid.replicateProperty=function(source,property,targets){if(source[property]!==undefined){fluid.each(targets,(function(target){target[property]=source[property]}))}};fluid.undistributableOptions=["gradeNames","distributeOptions","argumentMap","mergePolicy"];fluid.distributeOptionsOne=function(that,record,targetRef,selector,context){fluid.pushActivity("distributeOptions","parsing distributeOptions block %record %that ",{that:that,record:record});var targetHead=fluid.resolveContext(context,that);if(!targetHead){fluid.fail("Error in options distribution record ",record," - could not resolve context {"+context+"} to a head component")}var thatShadow=fluid.shadowForComponent(that);var targetSegs=fluid.model.parseEL(targetRef.path);var preBlocks;if(record.record!==undefined){preBlocks=[fluid.makeDistributionRecord(that,record.record,[],targetSegs,[])]}else{var source=fluid.parseContextReference(record.source);if(source.context!=="that"){fluid.fail("Error in options distribution record ",record," only a source context of {that} is supported")}var sourceSegs=fluid.parseExpectedOptionsPath(source.path,"source");var fullExclusions=fluid.makeArray(record.exclusions).concat(sourceSegs.length===0?fluid.undistributableOptions:[]);var 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()}fluid.replicateProperty(record,"priority",preBlocks);fluid.replicateProperty(record,"namespace",preBlocks);if(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.distributeOptions=function(that,optionsStrategy){var records=fluid.driveStrategy(that.options,"distributeOptions",optionsStrategy);fluid.each(records,(function distributeOptionsOne(record){if(typeof record.target!=="string"){fluid.fail("Error in options distribution record ",record,' a member named "target" must be supplied holding an IoC reference')}if(typeof record.source==="string"^record.record===undefined){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 targetRef=fluid.parseContextReference(record.target);var selector,context;if(fluid.isIoCSSSelector(targetRef.context)){selector=fluid.parseSelector(targetRef.context,fluid.IoCSSMatcher);context=fluid.extractSelectorHead(selector)}else{context=targetRef.context}if(context==="/"||context==="that"){fluid.distributeOptionsOne(that,record,targetRef,selector,context)}else{var transRec=fluid.currentTreeTransaction();transRec.deferredDistributions.push({that:that,record:record,targetRef:targetRef,selector:selector,context:context})}}))};fluid.contextName=1;fluid.memberName=2;fluid.gradeNamesToHash=function(gradeNames){var contextHash={};fluid.each(gradeNames,(function(gradeName){if(!fluid.isReferenceOrExpander(gradeName)){contextHash[gradeName]=fluid.contextName;contextHash[fluid.computeNickName(gradeName)]=fluid.contextName}}));return contextHash};fluid.applyToContexts=function(hash,key,disposition){var existing=hash[key];hash[key]=(existing||0)|disposition};fluid.applyToScope=function(scope,key,value,disposition){var existing=scope[key];if(!existing||disposition&fluid.memberName){scope[key]=value}};fluid.cacheShadowGrades=function(that,shadow){var contextHash=fluid.gradeNamesToHash(that.options&&that.options.gradeNames||[that.typeName]);fluid.applyToContexts(contextHash,shadow.memberName,fluid.memberName);shadow.contextHash=contextHash;fluid.each(contextHash,(function(disposition,context){shadow.ownScope[context]=that;if(shadow.parentShadow&&shadow.parentShadow.that.typeName!=="fluid.rootComponent"){fluid.applyToScope(shadow.parentShadow.childrenScope,context,that,disposition)}}))};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(distributedBlocks.length>0){var readyBlocks=fluid.applyDistributions(rec.that,distributedBlocks,rec.shadow);var 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){if(!fluid.isReferenceOrExpander(gradeName)){rec.seenGrades[gradeName]=true}}));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){var flatGradeName=fluid.flattenGradeName(gradeName);if(!rec.seenGrades[flatGradeName]){if(fluid.isReferenceOrExpander(gradeName)){rec.rawDynamic.push(gradeName);rec.seenGrades[flatGradeName]=true}else if(!rec.oldGradeNames.includes(gradeName)){rec.plainDynamic.push(gradeName)}}}))};fluid.accumulateContextAwareGrades=function(that,rec){var newContextAware=[];if(rec.gradeNames.includes("fluid.contextAware")){var contextAwarenessOptions=fluid.getForComponent(that,["options","contextAwareness"]);newContextAware=fluid.contextAware.check(that,contextAwarenessOptions);var lostGrade=fluid.find_if(rec.contextAware,(function(gradeName){return!newContextAware.includes(gradeName)}));if(lostGrade){fluid.fail("Failure operating contextAwareness definition ",contextAwarenessOptions," for component "+fluid.dumpComponentAndPath(that)+": grade name "+lostGrade+" returned by an earlier round of checks was lost through a context change caused by a raw dynamic grade")}rec.contextAware=newContextAware}return newContextAware};fluid.computeDynamicGrades=function(that,shadow,strategy){delete that.options.gradeNames;var gradeNames=fluid.driveStrategy(that.options,"gradeNames",strategy);gradeNames.length=0;var defaultsBlock=fluid.findMergeBlocks(shadow.mergeOptions.mergeBlocks,"defaults")[0];var rec={that:that,shadow:shadow,defaultsBlock:defaultsBlock,gradeNames:gradeNames,seenGrades:{},plainDynamic:[],contextAware:[],rawDynamic:[]};fluid.each(shadow.mergeOptions.mergeBlocks,(function(block){gradeNames.push.apply(gradeNames,fluid.makeArray(block.target&&block.target.gradeNames));fluid.applyDynamicGrades(rec)}));fluid.collectDistributedGrades(rec);var checkContextAware=true;while(true){while(rec.plainDynamic.length>0){gradeNames.push.apply(gradeNames,rec.plainDynamic);rec.plainDynamic.length=0;fluid.applyDynamicGrades(rec);fluid.collectDistributedGrades(rec)}if(checkContextAware){var newContextAware=fluid.accumulateContextAwareGrades(that,rec);rec.plainDynamic=rec.plainDynamic.concat(newContextAware);checkContextAware=false}else if(rec.rawDynamic.length>0){var toexpand=rec.rawDynamic.shift();var expanded=fluid.expandImmediate(toexpand,that,shadow.localRecord);if(typeof expanded==="function"){expanded=expanded()}if(expanded){rec.plainDynamic=rec.plainDynamic.concat(expanded)}checkContextAware=true}else{break}}fluid.remove_if(gradeNames,fluid.isReferenceOrExpander);if(shadow.collectedClearer){shadow.collectedClearer();delete shadow.collectedClearer}};fluid.computeComponentAccessor=function(that,localRecord){var instantiator=fluid.globalInstantiator;var shadow=fluid.shadowForComponent(that);shadow.localRecord=localRecord;var options=that.options;var strategy=shadow.mergeOptions.strategy;var 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);shadow.memberStrategy=fluid.recordStrategy(that,options,strategy,"members",fluid.memberFromRecord,null,{model:true,modelRelay:true});shadow.getConfig={strategies:[fluid.concreteStrategy,fluid.model.funcResolverStrategy,optionsStrategy,shadow.invokerStrategy.strategy,shadow.memberStrategy.strategy,eventStrategy]};fluid.computeDynamicGrades(that,shadow,strategy,shadow.mergeOptions.mergeBlocks);if(shadow.contextHash["fluid.resourceLoader"]){shadow.resourceStrategyBlock=fluid.recordStrategy(that,options,strategy,"resources",fluid.resourceFromRecord,["resources"]);var resourceStrategy=fluid.mountStrategy(["resources"],that,shadow.resourceStrategyBlock.strategy);shadow.getConfig.strategies.push(resourceStrategy);that.resources={}}fluid.distributeOptions(that,strategy);if(shadow.contextHash["fluid.resolveRoot"]){var memberName;if(shadow.contextHash["fluid.resolveRootSingle"]){var singleRootType=fluid.getForComponent(that,["options","singleRootType"]);if(!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.typeName,that.id)}var parent=fluid.resolveRootComponent;if(parent[memberName]){instantiator.clearComponent(parent,memberName)}instantiator.recordKnownComponent(parent,that,memberName,false)}return shadow.getConfig};fluid.shadowForComponent=function(component){var instantiator=fluid.getInstantiator(component);return instantiator&&component?instantiator.idToShadow[component.id]:null};fluid.pathInEvaluation=function(path,paths){var index=paths.indexOf(path);return index!==-1&&index!==paths.length-1};fluid.getForComponent=function(component,path){var segs=fluid.model.pathToSegments(path);if(segs.length===0){return component}var instantiator=fluid.globalInstantiator;var shadow=fluid.shadowForComponent(component);if(shadow){var next=fluid.get(component,segs[0],shadow.getConfig);if(fluid.isComponent(next)){return fluid.getForComponent(next,segs.slice(1))}else{var inEvaluationPaths=instantiator.inEvaluationPaths;var inEvaluationPath=component.id+":"+path;if(fluid.pathInEvaluation(inEvaluationPath,inEvaluationPaths)){fluid.fail("Error in component configuration - a circular reference was found during evaluation of path "+path+" for component "+fluid.dumpComponentAndPath(component)+": a circular set of references was found - for more details, see the activity records following this message in the console")}else{inEvaluationPaths.push(inEvaluationPath);var togo=fluid.get(component,path,shadow.getConfig);inEvaluationPaths.pop();return togo}}}else{return fluid.get(component,path)}};fluid.concreteStrategy=function(component,thisSeg,index,segs){var atval=component[thisSeg];if(atval===fluid.inEvaluationMarker){fluid.fail('Error in component configuration - a circular reference was found during evaluation of path segment "'+thisSeg+" of path ",segs,'": for more details, see the activity records following this message in the console, or issue fluid.setLogging(fluid.logLevel.TRACE) when running your application')}if(index>1){return atval}if(atval===undefined&&component.hasOwnProperty(thisSeg)){return fluid.NO_VALUE}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 fluid.frameworkGrades.indexOf(gradeName)!==-1}))};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+" id: "+that.id+'"'+fluid.dumpGradeNames(that)+"}"};fluid.dumpThatStack=function(thatStack,instantiator){var togo=fluid.transform(thatStack,(function(that){var path=instantiator.idToPath(that.id);return fluid.dumpThat(that)+(path?" - path: "+path:"")}));return togo.join("\n")};fluid.dumpComponentPath=function(that){var path=fluid.pathForComponent(that);return path?fluid.pathUtil.composeSegments.apply(null,path):"** no path registered for component **"};fluid.dumpComponentAndPath=function(that){return"component "+fluid.dumpThat(that)+" at path "+fluid.dumpComponentPath(that)};fluid.resolveContext=function(context,that,fast){if(context==="that"){return that}else if(context==="/"){return fluid.rootComponent}if(typeof context==="object"){var innerContext=fluid.resolveContext(context.context,that,fast);if(!fluid.isComponent(innerContext)){fluid.triggerMismatchedPathError(context.context,that)}var rawValue=fluid.getForComponent(innerContext,context.path);var expanded=fluid.expandOptions(rawValue,that);if(!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 "+fluid.dumpComponentAndPath(that)+": got ",expanded)}return expanded}else{var foundComponent;var instantiator=fluid.globalInstantiator;if(fast){var shadow=instantiator.idToShadow[that.id];return shadow.ownScope[context]}else{var thatStack=instantiator.getFullStack(that);fluid.visitComponentsForVisibility(instantiator,thatStack,(function(component,memberName){var shadow=fluid.shadowForComponent(component);var scopeValue=shadow.contextHash[context];if(scopeValue&&scopeValue!==fluid.memberName||context===memberName){foundComponent=component;return true}}));return 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 "+fluid.dumpComponentAndPath(parentThat))};fluid.makeStackFetcher=function(parentThat,localRecord,fast){var fetcher=function(parsed){if(parentThat&&parentThat.lifecycleStatus==="destroyed"){fluid.fail("Cannot resolve reference "+fluid.renderContextReference(parsed)+" from component "+fluid.dumpComponentAndPath(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);if(!foundComponent&&parsed.path!==""){fluid.triggerMismatchedPathError(parsed,parentThat)}return fluid.getForComponent(foundComponent,parsed.path)};return fetcher};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:true,modelRelay:true}}})};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){if(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;childShadow.childComponents={};fluid.cacheShadowGrades(child,childShadow)};fluid.clearChildrenScope=function(parentShadow,child,childShadow,memberName){var keys=fluid.keys(childShadow.contextHash);keys.push(memberName);keys.forEach((function(context){if(parentShadow.childrenScope[context]===child){delete parentShadow.childrenScope[context]}}))};fluid.clearComponentIndexes=function(instantiator,destroyRec){var shadow=destroyRec.shadow;fluid.clearChildrenScope(shadow,destroyRec.child,destroyRec.childShadow,destroyRec.name);delete instantiator.pathToComponent[destroyRec.childPath];delete shadow.childComponents[destroyRec.name]};fluid.doDestroy=function(instantiator,destroyRec){var shadow=destroyRec.childShadow,that=destroyRec.child;fluid.each(shadow.injectedPaths,(function(troo,injectedPath){var parentPath=fluid.model.getToTailPath(injectedPath);var otherParent=instantiator.pathToComponent[parentPath];instantiator.clearComponent(otherParent,fluid.model.getTailPath(injectedPath),that)}));fluid.clearComponentIndexes(instantiator,destroyRec);fluid.clearDistributions(shadow);fluid.clearListeners(shadow);for(var key in that.events){if(key!=="afterDestroy"&&typeof that.events[key].destroy==="function"){that.events[key].destroy()}}if(that.applier){that.applier.destroy()}that.lifecycleStatus="destroyed";fluid.fireEvent(destroyRec.child,"afterDestroy",[destroyRec.child,destroyRec.name,destroyRec.component]);delete instantiator.idToShadow[destroyRec.child.id]};fluid.instantiator=function(){var that=fluid.typeTag("instantiator");$.extend(that,{lifecycleStatus:"constructed",pathToComponent:{},idToShadow:{},modelTransactions:{},treeTransactions:{},inEvaluationPaths:[],currentTreeTransactionId:null,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"}),onBeginTreeTransaction:fluid.makeEventFirer({name:"instantiator's onBeginTransaction event"}),onEndTreeTransaction:fluid.makeEventFirer({name:"instantiator's onEndTransaction event"})}});that.parseToSegments=function(path){return fluid.model.parseToSegments(path,that.parseEL,true)};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){var path=shadow.path;var parsed=that.parseEL(path);var root=that.pathToComponent[""],togo=[];for(var i=0;i<parsed.length;++i){root=root[parsed[i]];togo.push(root)}return togo}else{return[]}};that.getFullStack=function(component){var thatStack=component?that.getThatStack(component):[];thatStack.unshift(fluid.resolveRootComponent);return thatStack};function recordComponent(parent,component,path,name,created){var shadow;if(created){shadow=that.idToShadow[component.id]={};shadow.that=component;shadow.path=path;shadow.memberName=name;fluid.constructScopeObjects(that,parent,component,shadow)}else{shadow=that.idToShadow[component.id];shadow.injectedPaths=shadow.injectedPaths||{};shadow.injectedPaths[path]=true;var parentShadow=that.idToShadow[parent.id];var keys=fluid.keys(shadow.contextHash);fluid.remove_if(keys,(function(key){return shadow.contextHash&&shadow.contextHash[key]===fluid.memberName}));keys.push(name);keys.forEach((function(context){if(!parentShadow.childrenScope.hasOwnProperty(context)){parentShadow.childrenScope[context]=component}}))}if(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}that.recordRoot=function(component){recordComponent(null,component,"","",true)};that.recordKnownComponent=function(parent,component,name,created){parent[name]=component;if(fluid.isComponent(component)||component.type==="instantiator"){var parentShadow=that.idToShadow[parent.id];parentShadow.childComponents[name]=component;var path=that.composePath(parentShadow.path,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.clearComponent=function(component,name,child,options,nested,path){var shadow=that.idToShadow[component.id];options=options||{flat:true,destroyRecs:[]};child=child||component[name];path=path||shadow.path;if(path===undefined){fluid.fail("Cannot clear component "+name+" from component ",component," which was not created by this instantiator")}var childPath=that.composePath(path,name);var childShadow=that.idToShadow[child.id];if(!childShadow){return}var created=childShadow.path===childPath;that.events.onComponentClear.fire(child,childPath,component,created);var destroyRec={child:child,childShadow:childShadow,name:name,component:component,shadow:shadow,childPath:childPath};if(created){if(fluid.isDestroyed(child)){fluid.fail('Cannot destroy component which is already in status "'+child.lifecycleStatus+'"')}child.lifecycleStatus="destroying";fluid.visitComponentChildren(child,(function(gchild,gchildname,segs,i){var parentPath=that.composeSegments.apply(null,segs.slice(0,i));that.clearComponent(child,gchildname,null,options,true,parentPath)}),options,that.parseEL(childPath));fluid.fireEvent(child,"onDestroy",[child,name||"",component]);options.destroyRecs.push(destroyRec)}else{fluid.remove_if(childShadow.injectedPaths,(function(troo,path){return path===childPath}));fluid.clearComponentIndexes(that,destroyRec)}if(!nested){delete component[name];options.destroyRecs.forEach((function(destroyRec){fluid.doDestroy(that,destroyRec)}))}};return 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",true);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",true);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);fluid.popActivity();return expanded};fluid.computeMergeListPriority=function(toMerge){toMerge.forEach((function(record){var recordType=record.recordType;if(recordType!=="distribution"){record.priority=fluid.mergeRecordTypes[recordType]+(record.priorityDelta||0);if(!Number.isInteger(record.priority)){fluid.fail("Merge record with unrecognised type "+recordType+": ",record)}}}))};var addPolicyBuiltins=function(policy){fluid.each(["gradeNames","mergePolicy","argumentMap","components","dynamicComponents","events","listeners","modelListeners","modelRelay","distributeOptions","transformOptions"],(function(key){fluid.set(policy,[key,"*","noexpand"],true)}));return policy};fluid.generateExpandBlock=function(record,that,mergePolicy,localRecord){var expanded=fluid.expandOptions(record.options||{},record.contextThat||that,mergePolicy,localRecord,{defer:true});expanded.priority=record.priority;expanded.namespace=record.namespace;expanded.recordType=record.recordType;return expanded};fluid.fabricateDestroyMethod=function(that){return function(){var currentTrans=fluid.currentTreeTransaction();var shadow=fluid.shadowForComponent(that);var transRec=fluid.destroy(shadow.path);if(!currentTrans){transRec.promise.then(null,(function(e){throw e}))}}};fluid.typeNameToMemberName=function(typeName){return typeName.replace(/\./g,"_")};fluid.expandComponentOptions=function(mergePolicy,potentia,lightMerge,that){var toMerge=lightMerge.toMerge;var container=fluid.lightMergeValue(toMerge,"container");if(container){toMerge.push({recordType:"distribution",priority:fluid.mergeRecordTypes.distribution,options:{container:container},contextThat:potentia.parentThat})}that.destroy=fluid.fabricateDestroyMethod(that);addPolicyBuiltins(mergePolicy);var shadow=fluid.shadowForComponent(that);shadow.mergePolicy=mergePolicy;fluid.computeMergeListPriority(toMerge);var togo=fluid.transform(toMerge,(function(value){return fluid.generateExpandBlock(value,that,mergePolicy,potentia.localRecord)}));return togo};fluid.computeDynamicComponentKey=function(recordKey,sourceKey){return recordKey+(sourceKey===0||sourceKey==="0"?"":"-"+sourceKey)};fluid.concludeAnyTreeTransaction=function(){var instantiator=fluid.globalInstantiator;var transactionId=instantiator.currentTreeTransactionId;if(transactionId){var transRec=instantiator.treeTransactions[transactionId];var errorOut;transRec.promise.then(null,(function(e){errorOut=e}));fluid.commitPotentiae(transactionId);if(errorOut){throw errorOut}}};fluid.bindDeferredComponent=function(that,componentName,lightMerge,dynamicComponent){var eventName=lightMerge.createOnEvent;var event=fluid.isIoCReference(eventName)?fluid.expandOptions(eventName,that):that.events[eventName];if(!event||!event.addListener){fluid.fail("Error instantiating createOnEvent component with name "+componentName+" of parent "+fluid.dumpComponentAndPath(that)+" since event specification "+eventName+" could not be expanded to an event - got ",event)}var shadow=fluid.shadowForComponent(that);if(dynamicComponent){fluid.set(shadow,["dynamicComponentCount",componentName],0)}var constructListener=function(){var key=dynamicComponent?fluid.computeDynamicComponentKey(componentName,shadow.dynamicComponentCount[componentName]++):componentName;var localRecord={arguments:fluid.makeArray(arguments)};fluid.pushActivity("initDeferred","instantiating deferred component %componentName of parent %that due to event %eventName",{componentName:componentName,that:that,eventName:eventName});var freshLightMerge=fluid.copy(lightMerge);delete freshLightMerge.createOnEvent;fluid.registerConcreteSubPotentia(freshLightMerge,key,0,that,localRecord);fluid.popActivity()};event.addListener(constructListener);fluid.recordListener(event,constructListener,shadow);event.addListener(fluid.concludeAnyTreeTransaction,"fluid-componentConstruction","last:transaction");fluid.recordListener(event,fluid.concludeAnyTreeTransaction,shadow)};fluid.markSubtree=function(instantiator,that,path,state){that.lifecycleStatus=state;fluid.visitComponentChildren(that,(function(child,name){var childPath=instantiator.composePath(path,name);var childShadow=instantiator.idToShadow[child.id];var created=childShadow&&childShadow.path===childPath;if(created){fluid.markSubtree(instantiator,child,childPath,state)}}),{flat:true})};fluid.assessTreeConstruction=function(that,shadow){var instantiator=fluid.globalInstantiator;var thatStack=instantiator.getThatStack(that);var unstableUp=fluid.find_if(thatStack,(function(that){return that.lifecycleStatus==="constructing"}));if(unstableUp){that.lifecycleStatus="constructed"}else{fluid.markSubtree(instantiator,that,shadow.path,"treeConstructed")}};fluid.concludeComponentObservation=function(shadow){var that=shadow.that;var mergeOptions=shadow.mergeOptions;fluid.pushActivity("concludeComponentObservation","constructing component of type %componentName at path %path",{componentName:that.typeName,path:shadow.path});mergeOptions.evaluateFully=true;for(var i=0;i<mergeOptions.mergeBlocks.length;++i){mergeOptions.mergeBlocks[i].initter()}mergeOptions.initter();delete that.options.mergePolicy;shadow.memberStrategy.initter();shadow.invokerStrategy.initter();fluid.freezeRecursive(that.options);fluid.each(shadow.lightMergeComponents,(function(lightMerge,key){if(lightMerge.createOnEvent){fluid.bindDeferredComponent(that,key,lightMerge)}}));fluid.each(shadow.lightMergeDynamicComponents,(function(lightMerge,key){if(lightMerge.createOnEvent){fluid.bindDeferredComponent(that,key,lightMerge,true)}}));fluid.popActivity()};fluid.concludeComponentInit=function(shadow){var that=shadow.that;if(fluid.isDestroyed(that)){return}that.lifecycleStatus="constructed";fluid.assessTreeConstruction(that,shadow);that.events.onCreate.fire(that);fluid.popActivity();return that};fluid.pushCreatePotentia=function(potentiaList,path,topush){var existing=potentiaList.pathToPotentia[path];if(existing&&!existing.applied){fluid.lightMergeRecords.pushRecords(existing,topush.records||topush.lightMerge.toMerge)}else{potentiaList.pathToPotentia[path]=topush;if(topush.records){topush.lightMerge=fluid.lightMergeRecords(topush.records);delete topush.records}return topush}};fluid.blankPotentiaList=function(){return{destroys:[],creates:[],activeCount:0,pathToPotentia:{}}};fluid.isInjectedComponentRecord=function(record){return typeof record==="string"||fluid.isPlainObject(record,true)&&record.expander};fluid.lightMergeValue=function(records,member){var value;records.forEach((function(record){var recValue=record[member];value=recValue===undefined?value:recValue}));return value};fluid.lightMergeRecords=function(records){var togo={toMerge:[],isInjected:false};fluid.lightMergeRecords.pushRecords(togo,records);return togo};fluid.lightMergeRecords.pushRecord=function(lightMerge,record){if(fluid.isInjectedComponentRecord(record)){lightMerge.toMerge=[{injected:record}];lightMerge.isInjected=true}else{lightMerge.type=record.type||lightMerge.type;lightMerge.createOnEvent=record.createOnEvent||lightMerge.createOnEvent;lightMerge.source=record.source||lightMerge.source;lightMerge.sources=record.sources||lightMerge.sources;if(lightMerge.isInjected){lightMerge.toMerge=[record]}else{lightMerge.toMerge.push(record)}lightMerge.isInjected=false}};fluid.lightMergeRecords.pushRecords=function(lightMerge,records){records.forEach((function(record){fluid.lightMergeRecords.pushRecord(lightMerge,record)}))};fluid.instantiateEvents=function(shadow){var that=shadow.that;shadow.eventStrategyBlock.initter();var listeners=fluid.getForComponent(that,["options","listeners"]);fluid.mergeListeners(that,that.events,listeners);var errors=fluid.validateListenersImplemented(that);if(errors.length>0){fluid.fail(fluid.transform(errors,(function(error){return["Error constructing component "+fluid.dumpComponentAndPath(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")}};fluid.initComponentShell=function(potentia,lightMerge){var instantiator=fluid.globalInstantiator,upDefaults=fluid.defaults(lightMerge.type),parentThat=potentia.parentThat,memberName=potentia.memberName,fakeThat={};var distributions=fluid.receiveDistributions(parentThat,upDefaults&&upDefaults.gradeNames,memberName,fakeThat);fluid.each(distributions,(function(distribution){fluid.computeDistributionPriority(parentThat,distribution);if(fluid.isPrimitive(distribution.priority)){distribution.priority=fluid.parsePriority(distribution.priority,0,false,"options distribution")}}));fluid.sortByPriority(distributions);fluid.lightMergeRecords.pushRecords(lightMerge,distributions);upDefaults=fluid.defaults(lightMerge.type);var defaultCopy=fluid.copy(upDefaults);lightMerge.toMerge.unshift({options:defaultCopy,recordType:"defaults"});var that=lightMerge.type==="fluid.emptySubcomponent"?null:fluid.typeTag(lightMerge.type,potentia.componentId);if(that){that.lifecycleStatus="constructing";instantiator.recordKnownComponent(parentThat,that,memberName,true);var mergeOptions=fluid.mergeComponentOptions(that,potentia,lightMerge);mergeOptions.exceptions={members:{model:true,modelRelay:true}};that.events={}}return that};fluid.registerConcreteSubPotentia=function(lightMerge,key,componentDepth,parentShell,localRecord,transactionId){componentDepth=componentDepth||0;var newSegs=fluid.pathForComponent(parentShell).concat([key]);var existing=parentShell[key];if(existing){fluid.registerPotentia({segs:newSegs,type:"destroy"},transactionId)}lightMerge.toMerge=fluid.transform(lightMerge.toMerge,(function(toMerge){var record=$.extend({componentDepth:componentDepth+1,sourceComponentId:parentShell.id,recordType:"subcomponentRecord"},toMerge);return record}));lightMerge.type=fluid.expandImmediate(lightMerge.type,parentShell,localRecord);var subPotentia={type:"create",segs:newSegs,lightMerge:lightMerge,localRecord:localRecord};fluid.registerPotentia(subPotentia,transactionId)};fluid.lightMergeComponentRecord=function(shadow,shadowKey,key,mergingArray){var lightMerge=fluid.lightMergeRecords(mergingArray);fluid.set(shadow,[shadowKey,key],lightMerge);return lightMerge};fluid.componentRecordExpected=fluid.arrayToHash(["type","options","container","createOnEvent"]);fluid.dynamicComponentRecordExpected=$.extend({},fluid.componentRecordExpected,fluid.arrayToHash(["source","sources"]));fluid.checkComponentRecord=function(localRecord,expected){if(!fluid.isInjectedComponentRecord(localRecord)){if(fluid.isPlainObject(localRecord,true)){fluid.each(localRecord,(function(value,key){if(!expected[key]){fluid.fail("Error in subcomponent record "+JSON.stringify(localRecord)+' - key "'+key+'" found, where the only legal options are '+fluid.keys(expected).join(", "))}}))}else{fluid.fail("Error in subcomponent record "+JSON.stringify(localRecord)+' - this should either be an object with member "type" or else a reference to another component')}}};fluid.checkSubcomponentRecords=function(subcomponentRecords,expected){subcomponentRecords.forEach((function(oneRecord){fluid.checkComponentRecord(oneRecord,expected)}))};fluid.registerSourcedDynamicComponent=function(potentia,shell,source,sourceKey,lightMerge,key,localRecordContributor){var localRecord=$.extend({},potentia.localRecord,{source:source,sourcePath:sourceKey});(localRecordContributor||fluid.identity)(localRecord,source,sourceKey);var dynamicKey=fluid.computeDynamicComponentKey(key,sourceKey);var freshLightMerge=fluid.copy(lightMerge);fluid.registerConcreteSubPotentia(freshLightMerge,dynamicKey,potentia.componentDepth,shell,localRecord)};fluid.registerSourcedDynamicComponents=function(potentia,shell,sources,lightMerge,key,localRecordContributor){fluid.each(sources,(function(source,sourceKey){fluid.registerSourcedDynamicComponent(potentia,shell,source,sourceKey,lightMerge,key,localRecordContributor)}))};fluid.lensedComponentModelListener=function(that,key,segs,value,isBoolean){var isEmptyValue=function(value){return isBoolean?!value:value===undefined};var shadow=fluid.shadowForComponent(that);var sourceKey=isBoolean?0:fluid.peek(segs);var expectedMemberName=fluid.computeDynamicComponentKey(key,sourceKey);var currentComponent=that[expectedMemberName];if(!isEmptyValue(value)&&!currentComponent){var lightMerge=shadow.lightMergeDynamicComponents[key];var parentRecord=shadow.modelSourcedDynamicComponents[key];fluid.registerSourcedDynamicComponent(shadow.potentia,that,value,sourceKey,lightMerge,key,parentRecord.localRecordContributor)}else if(isEmptyValue(value)&&currentComponent){currentComponent.destroy()}};fluid.lensedComponentDefToBlock=function(key,sourcesParsed,isBoolean){var fromModelPath=sourcesParsed.segs.slice(1);var modelListener={path:{context:sourcesParsed.context,segs:fromModelPath.concat(isBoolean?[]:["*"])},excludeSource:"init",transactional:true,funcName:"fluid.lensedComponentModelListener",args:["{that}",key,"{change}.path","{change}.value",isBoolean]};var modelListeners={};modelListeners["lensedComponents-"+key]=modelListener;return{modelListeners:modelListeners}};fluid.addLensedComponentBlocks=function(lensedComponentBlocks,potentia,shadow){var merged=fluid.extend.apply(null,[true,{}].concat(lensedComponentBlocks));shadow.mergeOptions.mergeBlocks.push(fluid.generateExpandBlock({options:merged,recordType:"lensedComponents",priority:fluid.mergeRecordTypes.lensedComponents},shadow.that,shadow.mergePolicy,potentia.localRecord));shadow.mergeOptions.updateBlocks()};fluid.pushMarkupSourcedDynamicComponentListener=function(shell,key,sourcesParsed,registerDynamicComponents){var namespace=shell.id+"-markupDynamicComponents-"+key;var context=fluid.resolveContext(sourcesParsed.context,shell);if(context.events.onDomBind){context.events.onDomBind.addListener(registerDynamicComponents,namespace)}else{var targetShadow=fluid.shadowForComponent(context);fluid.addLensedComponentBlocks([{listeners:{onDomBind:{namespace:namespace,listener:registerDynamicComponents}}}],{},targetShadow)}};fluid.expectExactlyOne=function(failStart,target,members){var found=0;members.forEach((function(member){if(target[member]!==undefined){++found}}));if(found!==1){fluid.fail.apply(null,failStart.concat([" must contain exactly one member out of "+members.join(", ")]))}};fluid.registerSourcedDynamicComponentsTriage=function(potentia,shell,sourceOrSources,lightMerge,key,isBoolean,localRecordContributor){if(isBoolean&&sourceOrSources){fluid.registerSourcedDynamicComponent(potentia,shell,sourceOrSources,0,lightMerge,key,localRecordContributor)}else{fluid.registerSourcedDynamicComponents(potentia,shell,sourceOrSources,lightMerge,key,localRecordContributor)}};fluid.processComponentShell=function(potentia,shell,transRec){var instantiator=fluid.globalInstantiator;var shadow=instantiator.idToShadow[shell.id];shadow.potentia=potentia;shadow.createdTransactionId=transRec.transactionId;var mergeOptions=shadow.mergeOptions;var components=fluid.driveStrategy(shell.options,"components",mergeOptions.strategy);fluid.each(components,(function(subcomponentRecords,key){fluid.checkSubcomponentRecords(subcomponentRecords,fluid.componentRecordExpected);var lightMerge=fluid.lightMergeComponentRecord(shadow,"lightMergeComponents",key,subcomponentRecords);if(!lightMerge.createOnEvent){fluid.registerConcreteSubPotentia(lightMerge,key,potentia.componentDepth,shell,potentia.localRecord)}}));var dynamicComponents=fluid.driveStrategy(shell.options,"dynamicComponents",mergeOptions.strategy);var lensedComponentBlocks=[];fluid.each(dynamicComponents,(function(subcomponentRecords,key){fluid.checkSubcomponentRecords(subcomponentRecords,fluid.dynamicComponentRecordExpected);var lightMerge=fluid.lightMergeComponentRecord(shadow,"lightMergeDynamicComponents",key,subcomponentRecords);fluid.expectExactlyOne(["dynamicComponents records ",subcomponentRecords],lightMerge,["source","sources","createOnEvent"]);if(lightMerge.sources!==undefined||lightMerge.source!==undefined){var recordSources=lightMerge.sources,isBoolean=false;if(lightMerge.source!==undefined){recordSources=lightMerge.source;isBoolean=true}if(fluid.isIoCReference(recordSources)){var sourcesParsed=fluid.parseValidModelReference(shell,"dynamicComponents source",recordSources,true);var registerDynamicComponents=function(){var sources=fluid.getForComponent(sourcesParsed.that,sourcesParsed.segs);fluid.registerSourcedDynamicComponentsTriage(potentia,shell,sources,lightMerge,key,null,isBoolean)};if(sourcesParsed.nonModel){if(sourcesParsed.segs[0]==="dom"){fluid.pushMarkupSourcedDynamicComponentListener(shell,key,sourcesParsed,registerDynamicComponents)}else{registerDynamicComponents()}}else{fluid.set(shadow,["modelSourcedDynamicComponents",key],{sourcesParsed:sourcesParsed,isBoolean:isBoolean});lensedComponentBlocks.push(fluid.lensedComponentDefToBlock(key,sourcesParsed,isBoolean))}}else{var sources=fluid.expandImmediate(recordSources,shell,potentia.localRecord);fluid.registerSourcedDynamicComponentsTriage(potentia,shell,sources,lightMerge,key,null,isBoolean)}}}));if(lensedComponentBlocks.length){fluid.addLensedComponentBlocks(lensedComponentBlocks,potentia,shadow)}if(transRec.deferredDistributions.length){transRec.pendingPotentiae.creates.push({type:"distributeOptions",distributions:transRec.deferredDistributions});++transRec.pendingPotentiae.activeCount;transRec.deferredDistributions=[]}};fluid.preparePathedPotentia=function(potentia,instantiator){var segs=potentia.segs||instantiator.parseToSegments(potentia.path);potentia.segs=segs;potentia.memberName=fluid.peek(segs);potentia.parentThat=fluid.getImmediate(fluid.rootComponent,segs.slice(0,-1));if(potentia.type==="create"&&!potentia.parentThat){fluid.fail("Cannot construct component at path ",segs," whose parent does not exist")}};fluid.fetchNestedInjectedComponentReference=function(transRec,potentiaList,injected,head,parentPath,segs){var instantiator=fluid.globalInstantiator;var path=parentPath,current=head;for(var i=0;i<segs.length;++i){path=fluid.composePath(path,segs[i]);current=instantiator.pathToComponent[path];if(!current){var upcoming=potentiaList.pathToPotentia[path];if(upcoming){if(upcoming.applied){fluid.fail("Circular reference found when resolving injected component reference ",injected," - the target of the reference is still in construction")}else{current=fluid.operateCreatePotentia(transRec,upcoming);if(current){path=instantiator.idToShadow[current.id].path}}}}if(!current&&i!==segs.length-1){fluid.fail("Failed to resolved injected component reference ",injected," - component at segment "+segs[i]+" was not found")}}return current};fluid.fetchInjectedComponentReference=function(transRec,potentiaList,injected,parentThat){var instantiator=fluid.globalInstantiator;if(injected.expander){return fluid.expandImmediate(injected,parentThat,null,true)}else{var parsed=fluid.parseContextReference(injected);var head=fluid.resolveContext(parsed.context,parentThat);if(!head){if(parsed.path!==""){fluid.fail("Error in injected component reference ",injected," - could not resolve context {"+parsed.context+"} to a head component")}else{return head}}else{var parentPath=instantiator.idToShadow[head.id].path;var segs=fluid.model.parseEL(parsed.path);return fluid.fetchNestedInjectedComponentReference(transRec,potentiaList,injected,head,parentPath,segs)}}};fluid.operateCreatePotentia=function(transRec,potentia){var instantiator=fluid.globalInstantiator;var potentiaList=transRec.pendingPotentiae;fluid.preparePathedPotentia(potentia,instantiator);var memberName=potentia.memberName,parentThat=potentia.parentThat,shell;fluid.pushActivity("operateCreatePotentia",'operating create potentia for path "%path" with records %records',{path:potentia.path,records:potentia.records});potentia.applied=true;--potentiaList.activeCount;var lightMerge=potentia.lightMerge;if(lightMerge.isInjected){parentThat[memberName]=fluid.inEvaluationMarker;shell=fluid.fetchInjectedComponentReference(transRec,potentiaList,lightMerge.toMerge[0].injected,parentThat);if(shell){instantiator.recordKnownComponent(parentThat,shell,memberName,false)}else{delete parentThat[memberName]}}else if(lightMerge.type){shell=fluid.initComponentShell(potentia,lightMerge);if(shell){fluid.processComponentShell(potentia,shell,transRec);var shadow=instantiator.idToShadow[shell.id];transRec.outputShadows.push(shadow)}}else{fluid.fail("Unrecognised material in place of subcomponent "+memberName+" - could not recognise the records ",potentia.records," as designating either an injected or concrete component")}fluid.pushPotentia(transRec.restoreRecords,instantiator,{type:"destroy",segs:potentia.segs});fluid.popActivity();return shell};fluid.operateDestroyPotentia=function(transRec,potentia,instantiator){instantiator=instantiator||fluid.globalInstantiator;fluid.preparePathedPotentia(potentia,instantiator);var that=fluid.getImmediate(fluid.rootComponent,potentia.segs);if(that){instantiator.clearComponent(potentia.parentThat,potentia.memberName,that)}};fluid.lookupWorkflowStage=function(workflowName){if(!workflowName){return fluid.workflowCacheSorted.length}else if(workflowName==="shells"){return 0}else{var found=fluid.find_if(fluid.workflowCacheSorted,(function(workflowEntry){return workflowEntry.workflowName===workflowName}));if(found){return found.index+1}else{fluid.fail("Unknown workflow name "+workflowName+' supplied as "breakAt" for tree transaction: '+": valid names are "+fluid.getMembers(fluid.workflowCacheSorted,"workflowName").join(", "))}}};fluid.evaluateWorkflows=function(shadows,workflowType){var togo=[];fluid.workflowCacheSorted[workflowType].forEach((function(workflowRecord){var workflowShadows=shadows.filter((function(oneShadow){return fluid.componentHasGrade(oneShadow.that,workflowRecord.gradeName)}));if(workflowShadows.length>0){togo.push({shadows:shadows,workflowIndex:workflowRecord.index,workflowOptions:workflowRecord.workflowOptions})}}));return togo};fluid.findWorkflowShadows=function(shadows,blockStart,blockEnd,workflowRecord){var workflowShadows=[];for(var i=blockStart;i<blockEnd;++i){if(fluid.componentHasGrade(shadows[i].that,workflowRecord.gradeName)){if(workflowRecord.workflowType==="global"){workflowShadows.push(shadows[i])}else{workflowShadows.unshift(shadows[i])}}}return workflowShadows};fluid.waitPendingIOTask=function(transRec){var sequence;var waitIOTask=function(){return transRec.pendingIO.length?sequence=fluid.promise.sequence(transRec.pendingIO):null};waitIOTask.taskName="waitIO";waitIOTask.sequence=sequence;return waitIOTask};fluid.enqueueWorkflowBlock=function(transRec,shadows,workflowStart,workflowEnd,blockStart,blockEnd,sequencer){var workQueued=false;var instantiator=fluid.globalInstantiator;var resumeCurrentTransaction=function(){instantiator.currentTreeTransactionId=transRec.transactionId};transRec.lastWorkflowShadow=Math.max(transRec.lastWorkflowShadow,blockEnd);fluid.forEachInRange(fluid.workflowCacheSorted,workflowStart,workflowEnd,(function(workflowRecord,workflowIndex){if(workflowIndex===0){for(var i=blockStart;i<blockEnd;++i){fluid.instantiateEvents(shadows[i])}}var workflowShadows=fluid.findWorkflowShadows(shadows,blockStart,blockEnd,workflowRecord);transRec.maximumWorkflowStage=Math.max(transRec.maximumWorkflowStage,workflowIndex+1);if(workflowShadows.length>0){var workflow=workflowRecord.workflowOptions;var workflowFunc=fluid.getGlobalValue(workflow.funcName);var sequence=sequencer.sources;if(workflow.waitIO){sequence.push(fluid.waitPendingIOTask(transRec))}if(workflowRecord.workflowType==="global"){var globalWorkflowTask=function(){resumeCurrentTransaction();workflowFunc(workflowShadows,transRec)};globalWorkflowTask.taskName=workflowRecord.namespace;sequence.push(globalWorkflowTask)}else{var localWorkflowTask=function(){resumeCurrentTransaction();if(workflowRecord.namespace==="concludeComponentInit"){sequencer.hasStartedConcludeInit=true}workflowShadows.forEach((function(shadow){workflowFunc(shadow,transRec)}))};localWorkflowTask.taskName=workflowRecord.namespace;sequence.push(localWorkflowTask)}workQueued=true}}));if(transRec.maximumWorkflowStage===transRec.workflowStageBreak){transRec.maximumWorkflowStage=0;transRec.restartLastWorkflowShadow=transRec.lastWorkflowShadow}return workQueued};fluid.applyWorkflowPhase=function(transRec,sequencer){var shadows=transRec.outputShadows;if(shadows.length>transRec.lastWorkflowShadow&&transRec.maximumWorkflowStage>0){fluid.enqueueWorkflowBlock(transRec,shadows,0,transRec.maximumWorkflowStage,transRec.lastWorkflowShadow,shadows.length,sequencer);return true}else if(transRec.maximumWorkflowStage<transRec.workflowStageBreak){for(var workflowStage=transRec.maximumWorkflowStage;workflowStage<transRec.workflowStageBreak;++workflowStage){var workQueued=fluid.enqueueWorkflowBlock(transRec,shadows,workflowStage,workflowStage+1,transRec.restartLastWorkflowShadow,shadows.length,sequencer);if(workQueued){return workQueued}}}return false};fluid.commitPotentiaePhase=function(transRec){var pendingPotentiae=transRec.pendingPotentiae;pendingPotentiae.destroys.forEach((function(potentia){if(!potentia.applied){potentia.applied=true;--pendingPotentiae.activeCount;fluid.operateDestroyPotentia(transRec,potentia)}}));for(var i=0;i<pendingPotentiae.creates.length;++i){var potentia=pendingPotentiae.creates[i];if(!potentia.applied){if(potentia.type==="create"){fluid.operateCreatePotentia(transRec,potentia)}else if(potentia.type==="distributeOptions"){potentia.distributions.forEach((function(distro){fluid.distributeOptionsOne(distro.that,distro.record,distro.targetRef,distro.selector,distro.context)}));potentia.applied=true;--pendingPotentiae.activeCount}else{fluid.fail("Unrecognised potentia type "+potentia.type)}}}};fluid.isPopulatedPotentiaList=function(potentiaList){return potentiaList.activeCount>0};fluid.commitPotentiae=function(transactionId,resumeSequencer){var instantiator=fluid.globalInstantiator;var transRec=instantiator.treeTransactions[transactionId];++transRec.commitDepth;var lastWorkflowShadow=transRec.lastWorkflowShadow;var rootSequencer=transRec.rootSequencer;var sequencer=resumeSequencer;if(!sequencer){var topSequencer=fluid.getImmediate(fluid.peek(rootSequencer.sources),["sequencer"]);if(!topSequencer||topSequencer.hasStartedConcludeInit||topSequencer.promise.disposition){sequencer=fluid.promise.makeSequencer([],{},fluid.promise.makeSequenceStrategy());sequencer.promise.sequencer=sequencer;rootSequencer.sources.push(sequencer.promise)}else{sequencer=topSequencer}}fluid.tryCatch((function commitPotentiae(){if(fluid.isPopulatedPotentiaList(transRec.pendingPotentiae)){fluid.commitPotentiaePhase(transRec)}var workflowEnqueued=fluid.applyWorkflowPhase(transRec,sequencer);if(workflowEnqueued){sequencer.sources.push((function(){if(!sequencer.hasStartedConcludeInit){fluid.commitPotentiae(transactionId,sequencer)}else if(sequencer===fluid.peek(rootSequencer.sources).sequencer){fluid.commitPotentiae(transactionId,null)}}))}if(!sequencer.sequenceStarted){fluid.promise.resumeSequence(sequencer)}if(!rootSequencer.sequenceStarted){fluid.promise.resumeSequence(rootSequencer)}}),(function(e){if(!transRec.promise.disposition){transRec.promise.reject(e)}}));--transRec.commitDepth;if(transRec.commitDepth===0&&!resumeSequencer){instantiator.currentTreeTransactionId=null}return transRec.outputShadows[lastWorkflowShadow]};fluid.pushPotentia=function(potentiaList,instantiator,potentia){var segs=potentia.segs=potentia.segs||instantiator.parseToSegments(potentia.path);var path=potentia.path=instantiator.composeSegments.apply(null,segs);if(potentia.type==="destroy"){potentiaList.destroys.push(potentia);potentiaList.activeCount++;fluid.remove_if(potentiaList.creates,(function(create){if(!create.applied&&create.path.startsWith(potentia.path)){potentiaList.activeCount--;return true}}))}else{var newPotentia=potentia;if(potentia.type==="create"){newPotentia=fluid.pushCreatePotentia(potentiaList,path,potentia)}if(newPotentia){potentiaList.creates.push(potentia);potentiaList.activeCount++}}};fluid.pathForComponent=function(component,instantiator){instantiator=instantiator||fluid.getInstantiator(component)||fluid.globalInstantiator;var shadow=instantiator.idToShadow[component.id];if(!shadow){return null}return instantiator.parseEL(shadow.path)};fluid.currentTreeTransaction=function(){var instantiator=fluid.globalInstantiator;return instantiator.treeTransactions[instantiator.currentTreeTransactionId]};fluid.clearTreeTransaction=function(transRec){transRec.rootSequencer=fluid.promise.makeSequencer([],{},fluid.promise.makeSequenceStrategy());transRec.restoreRecords=fluid.blankPotentiaList();transRec.initModelTransaction={};transRec.outputShadows=[];transRec.lastWorkflowShadow=0;transRec.maximumWorkflowStage=0;transRec.restartLastWorkflowShadow=0;transRec.deferredDistributions=[]};fluid.beginTreeTransaction=function(transactionOptions){var instantiator=fluid.globalInstantiator;if(instantiator.currentTreeTransactionId){fluid.fail("Attempt to start new tree transaction when transaction "+instantiator.currentTreeTransactionId+" is already active")}var transactionId=instantiator.currentTreeTransactionId=fluid.allocateGuid();var transRec=$.extend({transactionId:transactionId,workflowStageBreak:undefined,pendingPotentiae:fluid.blankPotentiaList(),commitDepth:0,cancelled:false,cancellationError:null,pendingIO:[]},transactionOptions);fluid.clearTreeTransaction(transRec);transRec.promise=transRec.rootSequencer.promise;var onConclude=function(){instantiator.events.onEndTreeTransaction.fire(transRec);if(transRec.rootSequencer.promise.disposition){instantiator.currentTreeTransactionId=null;delete instantiator.treeTransactions[transactionId]}};var onException=function(err){if(!transRec.cancelled){delete transRec.rootSequencer;instantiator.inEvaluationPaths.length=0;fluid.cancelTreeTransaction(transactionId,instantiator,err);onConclude()}};transRec.promise.then(onConclude,onException);instantiator.treeTransactions[transactionId]=transRec;try{transRec.workflowStageBreak=fluid.lookupWorkflowStage(transRec.breakAt)}catch(e){transRec.promise.reject(e)}instantiator.events.onBeginTreeTransaction.fire(transRec);return transRec};fluid.registerPotentia=function(potentia,transactionId){var instantiator=fluid.globalInstantiator;transactionId=transactionId||instantiator.currentTreeTransactionId;if(!transactionId){transactionId=fluid.beginTreeTransaction().transactionId}var transRec=instantiator.treeTransactions[transactionId];fluid.pushPotentia(transRec.pendingPotentiae,instantiator,potentia);return transRec};fluid.cancelTreeTransaction=function(transactionId,instantiator){var transRec=instantiator.treeTransactions[transactionId];if(transRec){try{transRec.pendingPotentiae=transRec.restoreRecords;transRec.cancelled=true;fluid.clearTreeTransaction(transRec);fluid.commitPotentiae(transactionId)}catch(e){fluid.log(fluid.logLevel.FAIL,"Fatal error cancelling transaction "+transactionId+": destroying all affected paths");transRec.restoreRecords.creates.forEach((function(potentia){instantiator.clearComponent(potentia.parentThat,potentia.memberName,potentia.parentThat[potentia.memberName])}));throw e}}};fluid.constructChild=function(parent,memberName,options){var parentPath=fluid.pathForComponent(parent);var path=parentPath.concat([memberName]);return fluid.construct(path,options)};fluid.construct=function(path,componentOptions,constructOptions){constructOptions=constructOptions||{};var transRec=fluid.registerPotentia({path:path,type:"destroy"},constructOptions.transactionId);var record={recordType:"user"};fluid.each(fluid.componentRecordExpected,(function(troo,key){if(componentOptions[key]!==undefined){record[key]=componentOptions[key]}}));record.options=componentOptions;var potentia={path:path,type:"create",localRecord:constructOptions.localRecord,records:[record]};fluid.registerPotentia(potentia,transRec.transactionId);if(!constructOptions.transactionId){fluid.commitPotentiae(transRec.transactionId)}fluid.adaptTransactionFailure(transRec);return constructOptions.returnTransaction?transRec:fluid.getImmediate(fluid.rootComponent,potentia.segs)};fluid.destroy=function(path,instantiator){instantiator=instantiator||fluid.globalInstantiator;var segs=instantiator.parseToSegments(path);if(segs.length===0){fluid.fail("Cannot destroy the root component")}var transRec=fluid.registerPotentia({path:path,type:"destroy"});fluid.commitPotentiae(transRec.transactionId);return transRec};fluid.constructSingle=function(parentPath,options,instantiator){instantiator=instantiator||fluid.globalInstantiator;parentPath=parentPath||"";var segs=fluid.model.parseToSegments(parentPath,instantiator.parseEL,true);if(typeof options==="string"){options={type:options}}var type=options.type;if(!type){fluid.fail("Cannot construct singleton object without a type entry")}options=$.extend({},options);var gradeNames=options.gradeNames=fluid.makeArray(options.gradeNames);gradeNames.unshift(type);options.type="fluid.component";var root=segs.length===0;if(root){gradeNames.push("fluid.resolveRoot")}var memberName=fluid.typeNameToMemberName(options.singleRootType||type);segs.push(memberName);return fluid.construct(segs,options)};fluid.destroySingle=function(parentPath,typeName,instantiator){instantiator=instantiator||fluid.globalInstantiator;var segs=fluid.model.parseToSegments(parentPath,instantiator.parseEL,true);var 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.thisistToApplicable=function(record,recthis,that){return{apply:function(noThis,args){var resolvedThis=fluid.expandImmediate(recthis,that);if(typeof resolvedThis==="string"){resolvedThis=fluid.getGlobalValue(resolvedThis)}if(!resolvedThis){fluid.fail("Could not resolve reference "+recthis+" to a value")}var resolvedFunc=resolvedThis[record.method];if(typeof resolvedFunc!=="function"){fluid.fail("Object ",resolvedThis," at reference "+recthis+" has no member named "+record.method+" which is a function ")}if(fluid.passLogLevel(fluid.logLevel.TRACE)){fluid.log(fluid.logLevel.TRACE,"Applying arguments ",args," to method "+record.method+" of instance ",resolvedThis)}return resolvedFunc.apply(resolvedThis,args)}}};fluid.changeToApplicable=function(record,that){fluid.getForComponent(that,"applier");var parsed=fluid.parseValidModelReference(that,"changePath listener record",record.changePath);fluid.materialiseModelPath(parsed.that,parsed.modelSegs);return{apply:function(noThis,args,localRecord,mergeRecord){var value;if(record.func||record.funcName){var invoker=fluid.makeInvoker(that,fluid.filterKeys(record,["func","funcName","args"]),"changePath listener record",localRecord);value=invoker()}else{value=fluid.expandImmediate(record.value,that,fluid.extend(localRecord,{arguments:args}))}var 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(record.changePath!==undefined){return fluid.changeToApplicable(record,that,standard)}var recthis=record["this"];if(record.method^recthis){fluid.fail("Record ",that,' must contain both entries "method" and "this" if it contains either')}return record.method?fluid.thisistToApplicable(record,recthis,that):null};fluid.getGlobalValueNonComponent=function(funcName,context){var defaults=fluid.defaults(funcName);if(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")}return fluid.getGlobalValue(funcName)};fluid.makeInvoker=function(that,invokerec,name,localRecord){invokerec=fluid.upgradePrimitiveFunc(invokerec);if(invokerec.args!==undefined&&invokerec.args!==fluid.NO_ARGUMENTS&&!fluid.isArrayable(invokerec.args)){invokerec.args=fluid.makeArray(invokerec.args)}var func=fluid.recordToApplicable(invokerec,that);var invokePre=fluid.preExpand(invokerec.args);localRecord=localRecord||{};var expandOptions=fluid.makeStackResolverOptions(that,localRecord,true);func=func||(invokerec.funcName?fluid.getGlobalValueNonComponent(invokerec.funcName,"an invoker"):fluid.expandImmediate(invokerec.func,that));if(!func||!func.apply){fluid.fail("Error in invoker record: could not resolve members func, funcName or method to a function implementation - got "+func+" from ",invokerec)}else if(func===fluid.notImplemented){fluid.fail("Error constructing component "+fluid.dumpComponentAndPath(that)+" - the invoker named "+name+" which was defined in grade "+invokerec.componentSource+" needs to be overridden with a concrete implementation")}return function invokeInvoker(){if(fluid.defeatLogging===false){fluid.pushActivity("invokeInvoker","invoking invoker with name %name and record %record holding component %that",{name:name,record:invokerec,that:that})}var togo,finalArgs;if(that.lifecycleStatus==="destroyed"){fluid.log(fluid.logLevel.WARN,"Ignoring call to invoker "+name+" of component "+fluid.dumpComponentAndPath(that)+" which has been destroyed")}else{localRecord.arguments=arguments;if(invokerec.args===undefined||invokerec.args===fluid.NO_ARGUMENTS){finalArgs=arguments}else{fluid.expandImmediateImpl(invokePre,expandOptions);finalArgs=invokePre.source}togo=func.apply(null,finalArgs)}if(fluid.defeatLogging===false){fluid.popActivity()}return 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={};function checkFire(){var notall=fluid.find(eventSpec,(function(value,key){if(argstruc[key]===undefined){return true}}));if(!notall){var oldstruc=argstruc;argstruc={};callback(oldstruc)}}fluid.each(eventSpec,(function(event,eventName){adder(event).addListener((function(){argstruc[eventName]=fluid.makeArray(arguments);checkFire()}))}))};fluid.event.dispatchListener=function(that,listener,eventName,eventSpec,wrappedArgs){if(eventSpec.args!==undefined&&eventSpec.args!==fluid.NO_ARGUMENTS&&!fluid.isArrayable(eventSpec.args)){eventSpec.args=fluid.makeArray(eventSpec.args)}listener=fluid.event.resolveListener(listener);var dispatchPre=fluid.preExpand(eventSpec.args);var localRecord={};var expandOptions=fluid.makeStackResolverOptions(that,localRecord,true);var togo=function(){if(fluid.defeatLogging===false){fluid.pushActivity("dispatchListener","firing to listener to event named %eventName of component %that",{eventName:eventName,that:that})}var args=wrappedArgs?arguments[0]:arguments,finalArgs;localRecord.arguments=args;if(eventSpec.args!==undefined&&eventSpec.args!==fluid.NO_ARGUMENTS){fluid.expandImmediateImpl(dispatchPre,expandOptions);finalArgs=dispatchPre.source}else{finalArgs=args}var togo=listener.apply(null,finalArgs);if(fluid.defeatLogging===false){fluid.popActivity()}return togo};fluid.event.impersonateListener(listener,togo);return togo};fluid.event.resolveSoftNamespace=function(key){if(typeof key!=="string"){return null}else{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);var transRecs=fluid.transform(records,(function(record){var expanded=fluid.isPrimitive(record)||record.expander?{listener:record}:fluid.copy(record);var methodist=fluid.recordToApplicable(record,that,standard);if(methodist){expanded.listener=methodist}else{expanded.listener=expanded.listener||expanded.func||expanded.funcName}if(!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);if(!expanded.namespace&&!namespace&&softNamespace){expanded.softNamespace=true;expanded.namespace=(record.componentSource?record.componentSource:that.typeName)+"."+softNamespace}var listener=expanded.listener=fluid.expandOptions(expanded.listener,that);if(!listener){badRec(record,"")}var firer=false;if(listener.typeName==="fluid.event.firer"){listener=listener.fire;firer=true}expanded.listener=standard&&(expanded.args&&listener!=="fluid.notImplemented"||firer)?fluid.event.dispatchListener(that,listener,eventName,expanded):listener;expanded.listenerId=fluid.allocateGuid();return expanded}));var togo={records:transRecs,adderWrapper:standard?fluid.event.makeTrackedListenerAdder(that):null};fluid.popActivity();return togo};fluid.event.expandOneEvent=function(that,event){var origin;if(typeof event==="string"&&event.charAt(0)!=="{"){origin=fluid.getForComponent(that,["events",event])}else{origin=fluid.expandOptions(event,that)}if(!origin||origin.typeName!=="fluid.event.firer"){fluid.fail("Error in event specification - could not resolve base event reference ",event," to an event firer: got ",origin)}return origin};fluid.event.expandEvents=function(that,event){return typeof event==="string"?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);if(typeof eventSpec==="string"){eventSpec={event:eventSpec}}var event=eventSpec.typeName==="fluid.event.firer"?eventSpec:eventSpec.event||eventSpec.events;if(!event){fluid.fail("Event specification for event with name "+eventName+" does not include a base event specification: ",eventSpec)}var origin=event.typeName==="fluid.event.firer"?event:fluid.event.expandEvents(that,event);var isMultiple=origin.typeName!=="fluid.event.firer";var isComposite=eventSpec.args||isMultiple;var firer;if(isComposite){firer=fluid.makeEventFirer({name:" [composite] "+fluid.event.nameEvent(that,eventName)});var dispatcher=fluid.event.dispatchListener(that,firer.fire,eventName,eventSpec,isMultiple);if(isMultiple){fluid.event.listenerEngine(origin,dispatcher,adder)}else{adder(origin).addListener(dispatcher)}}else{firer={typeName:"fluid.event.firer"};firer.fire=function(){var outerArgs=fluid.makeArray(arguments);fluid.pushActivity("fireSynthetic","firing synthetic event %eventName ",{eventName:eventName});var togo=origin.fire.apply(null,outerArgs);fluid.popActivity();return togo};firer.addListener=function(listener,namespace,priority,softNamespace,listenerId){var dispatcher=fluid.event.dispatchListener(that,listener,eventName,eventSpec);adder(origin).addListener(dispatcher,namespace,priority,softNamespace,listenerId)};firer.removeListener=function(listener){origin.removeListener(listener)};firer.originEvent=origin}fluid.popActivity();return firer};fluid.coerceToPrimitive=function(string){return string==="false"?false:string==="true"?true:isFinite(string)?Number(string):string};fluid.compactStringToRec=function(string,type){var openPos=string.indexOf("(");var closePos=string.indexOf(")");if(openPos===-1^closePos===-1||openPos>closePos){fluid.fail("Badly-formed compact "+type+" record without matching parentheses: "+string)}if(openPos!==-1&&closePos!==-1){var trail=string.substring(closePos+1);if(trail.trim()!==""){fluid.fail("Badly-formed compact "+type+" record "+string+" - unexpected material following close parenthesis: "+trail)}var prefix=string.substring(0,openPos);var body=string.substring(openPos+1,closePos).trim();var args=body===""?[]:fluid.transform(body.split(","),(function(str){return str.trim()}),fluid.coerceToPrimitive);var togo=fluid.upgradePrimitiveFunc(prefix,null);togo.args=args;return togo}else if(type==="expander"){fluid.fail("Badly-formed compact expander record without parentheses: "+string)}return string};fluid.expandPrefix="@expand:";fluid.expandCompactString=function(string,active){var rec=string;if(string.indexOf(fluid.expandPrefix)===0){var rem=string.substring(fluid.expandPrefix.length);rec={expander:fluid.compactStringToRec(rem,"expander")}}else if(active){rec=fluid.compactStringToRec(string,active)}return rec};var singularPenRecord={listeners:"listener",modelListeners:"modelListener"};var singularRecord=$.extend({invokers:"invoker"},singularPenRecord);fluid.expandCompactRec=function(segs,target,source){fluid.guardCircularExpansion(segs,segs.length);var pen=fluid.peek(segs);var active=singularRecord[pen];if(!active&&segs.length>1){active=singularPenRecord[segs[segs.length-2]]}fluid.each(source,(function(value,key){if(fluid.isPlainObject(value)){target[key]=fluid.freshContainer(value);segs.push(key);fluid.expandCompactRec(segs,target[key],value);segs.pop();return}else if(typeof value==="string"){value=fluid.expandCompactString(value,active)}target[key]=value}))};fluid.expandCompact=function(options){var togo={};fluid.expandCompactRec([],togo,options);return togo};fluid.extractEL=function(string,options){if(options.ELstyle==="ALL"||options.ELstyle==="{}"){return string}else if(options.ELstyle.length===1){if(string.charAt(0)===options.ELstyle){return string.substring(1)}}else if(options.ELstyle==="${}"){var i1=string.indexOf("${");var i2=string.lastIndexOf("}");if(i1===0&&i2!==-1){return string.substring(2,i2)}}};fluid.extractELWithContext=function(string,options){var EL=fluid.extractEL(string,options);if(fluid.isIoCReference(EL)){return fluid.parseContextReference(EL)}else if(options.ELstyle==="{}"){return null}return EL?{path:EL}:EL};fluid.parseContextReference=function(reference,index,delimiter){index=index||0;var isNested=reference.charAt(index+1)==="{",endcpos,context,nested;if(isNested){nested=fluid.parseContextReference(reference,index+1,"}");endcpos=nested.endpos}else{endcpos=reference.indexOf("}",index+1)}if(endcpos===-1){fluid.fail('Cannot parse context reference "'+reference+'": Malformed context reference without }')}if(isNested){context=nested}else{context=reference.substring(index+1,endcpos)}var endpos=delimiter?reference.indexOf(delimiter,endcpos+1):reference.length;var path=reference.substring(endcpos+1,endpos);if(path.charAt(0)==="."){path=path.substring(1)}return{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);fluid.pushActivity("resolvedContextValue","resolved value %parsed to value %value",{parsed:parsed,value:togo});fluid.popActivity(2);return togo}var parsed;if(options.bareContextRefs&&fluid.isIoCReference(string)){parsed=fluid.parseContextReference(string);return fetch(parsed)}else if(options.ELstyle&&options.ELstyle!=="${}"){parsed=fluid.extractELWithContext(string,options);if(parsed){return fetch(parsed)}}if(options.ELstyle==="${}"){while(typeof string==="string"){var i1=string.indexOf("${");var i2=string.indexOf("}",i1+2);if(i1!==-1&&i2!==-1){if(string.charAt(i1+2)==="{"){parsed=fluid.parseContextReference(string,i1+2,"}");i2=parsed.endpos}else{parsed={path:string.substring(i1+2,i2)}}var subs=fetch(parsed);var all=i1===0&&i2===string.length-1;if(subs===undefined||subs===null){return subs}string=all?subs:string.substring(0,i1)+subs+string.substring(i2+1)}else{break}}}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}else{$.extend(true,target,expanded)}}fluid.each(source,(function(newSource,key){if(newSource===undefined){target[key]=undefined}else if(key!=="expander"){segs[i]=key;if(fluid.getImmediate(options.exceptions,segs,i)!==true){options.strategy(target,key,i+1,segs,source,mergePolicy)}}}));return 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;var thisPolicy=fluid.derefMergePolicy(policy);if(typeof source==="string"&&!thisPolicy.noexpand){if(!options.defaultEL||source.charAt(0)==="{"){fluid.pushActivity("expandContextValue","expanding context value %source held at path %path",{source:source,path:fluid.path.apply(null,segs.slice(0,i))});expanded=fluid.copy(fluid.resolveContextValue(source,options));fluid.popActivity(1)}else{expanded=source}}else if(thisPolicy.noexpand||fluid.isUnexpandable(source)){expanded=fluid.copy(source)}else if(source.expander){expanded=fluid.expandExpander(deliverer,source,options)}else{expanded=fluid.freshContainer(source);isTrunk=true}if(expanded!==fluid.NO_VALUE){deliverer(expanded)}if(isTrunk){recurse(expanded,source,i,segs,policy)}return expanded};fluid.guardCircularExpansion=function(segs,i){if(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)};var strategy=function(target,name,i,segs,source,policy){fluid.guardCircularExpansion(segs,i);if(!target){return}if(target.hasOwnProperty(name)){return target[name]}if(source===undefined){source=fluid.regenerateCursor(options.source,segs,i-1,options.sourceStrategy);policy=fluid.regenerateCursor(options.mergePolicy,segs,i-1,fluid.concreteTrundler)}var thisSource=options.sourceStrategy(source,name,i,segs);var thisPolicy=fluid.concreteTrundler(policy,name);function deliverer(value){target[name]=value}return fluid.expandSource(options,target,i,segs,deliverer,thisSource,thisPolicy,recurse)};options.recurse=recurse;options.strategy=strategy;return strategy};fluid.defaults("fluid.makeExpandOptions",{ELstyle:"${}",bareContextRefs:true,target:fluid.inCreationMarker});fluid.makeExpandOptions=function(source,options){options=$.extend({},fluid.rawDefaults("fluid.makeExpandOptions"),options);options.defaultEL=options.ELStyle==="${}"&&options.bareContextRefs;options.expandSource=function(source){return fluid.expandSource(options,null,0,[],fluid.identity,source,options.mergePolicy,false)};if(!fluid.isUnexpandable(source)){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)}}else{options.strategy=fluid.concreteTrundler;options.initter=fluid.identity;if(typeof source==="string"){options.target=(options.defer?fluid.copy:fluid.identity)(options.expandSource(source))}else{options.target=source}options.immutableTarget=true}return options};fluid.expand=function(source,options){var expandOptions=fluid.makeExpandOptions(source,options);expandOptions.initter();return expandOptions.target};fluid.preExpandRecurse=function(root,source,holder,member,rootSegs){fluid.guardCircularExpansion(rootSegs,rootSegs.length);function pushExpander(expander){root.expanders.push({expander:expander,holder:holder,member:member});delete holder[member]}if(fluid.isIoCReference(source)){var parsed=fluid.parseContextReference(source);var segs=fluid.model.parseEL(parsed.path);pushExpander({typeFunc:fluid.expander.fetch,context:parsed.context,segs:segs})}else if(fluid.isPlainObject(source)){if(source.expander){source.expander.typeFunc=fluid.getGlobalValue(source.expander.type||"fluid.expander.invokeFunc");pushExpander(source.expander)}else{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)};fluid.preExpandRecurse(root,root.source,root,"source",[]);return root};fluid.expandImmediate=function(source,that,localRecord,noproxy){var options=fluid.makeStackResolverOptions(that,localRecord,true);options.noproxy=!!noproxy;var root=fluid.preExpand(source);fluid.expandImmediateImpl(root,options);return root.source};fluid.expandImmediateImpl=function(root,options){var expanders=root.expanders;for(var 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.expander.invokeFunc");if(!expander){fluid.fail("Unknown expander with type "+source.expander.type)}return expander(deliverer,source,options)};fluid.proxyComponentHandler=function(target,prop){return prop===Symbol.toStringTag?Object.prototype.toString.call(target):prop in target?target[prop]:fluid.getForComponent(target,prop)};fluid.proxyComponent=function(component){var shadow=fluid.shadowForComponent(component);if(!shadow.proxy){shadow.proxy=new Proxy(component,{get:fluid.proxyComponentHandler})}return shadow.proxy};fluid.possiblyProxyComponent=function(value){return fluid.isComponent(value)&&value.lifecycleStatus!=="treeConstructed"?fluid.proxyComponent(value):value};fluid.proxyComponentArgs=function(args){args.forEach((function(arg,i){args[i]=fluid.possiblyProxyComponent(arg)}))};fluid.registerNamespace("fluid.expander");fluid.expander.fetch=function(deliverer,source,options){var localRecord=options.localRecord,context=source.expander.context,segs=source.expander.segs;var inLocal=localRecord[context]!==undefined;var contextStatus=options.contextThat.lifecycleStatus;var fast=contextStatus==="treeConstructed"||contextStatus==="destroyed";var component=inLocal?localRecord[context]:fluid.resolveContext(context,options.contextThat,fast);if(component!==undefined){var root=component;if(inLocal||component.lifecycleStatus!=="constructing"){for(var i=0;i<segs.length;++i){root=root?root[segs[i]]:undefined}}else{root=fluid.getForComponent(component,segs)}if(root===undefined&&!inLocal){root=fluid.getForComponent(component,segs)}if(!fast&&!options.noproxy&&fluid.isComponent(root)){return fluid.proxyComponent(root)}return root}else if(segs.length>0){fluid.triggerMismatchedPathError(source.expander,options.contextThat)}};fluid.expander.invokeFunc=function(deliverer,source,options){var expander=source.expander;var args=fluid.makeArray(expander.args);var whichFuncEntry=expander.func?"func":expander.funcName?"funcName":null;expander.args=args;if(options.recurse){args=options.recurse([],args)}else{expander=fluid.expandImmediate(expander,options.contextThat,options.localRecord,expander.noproxy);args=expander.args}if(!expander.noproxy){fluid.proxyComponentArgs(args)}var funcEntry=expander[whichFuncEntry];var func=(options.expandSource?options.expandSource(funcEntry):funcEntry)||fluid.recordToApplicable(expander,options.contextThat);if(typeof func==="string"){func=fluid.getGlobalValue(func)}if(!func){fluid.fail("Error in expander record ",source.expander,": "+source.expander[whichFuncEntry]+" could not be resolved to a function for component ",options.contextThat)}return func.apply(null,args)};fluid.expander.noexpand=function(deliverer,source){return source.expander.value?source.expander.value:source.expander.tree};fluid.noexpand=fluid.expander.noexpand;"use strict";fluid.model.makeEnvironmentStrategy=function(environment){return function(root,segment,index){return index===0&&environment[segment]?environment[segment]:undefined}};fluid.model.defaultCreatorStrategy=function(root,segment){if(root[segment]===undefined){root[segment]={};return 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){var strategies=config.strategies;var limit=segs.length-uncess;for(var i=initPos;i<limit;++i){if(!root){return root}var accepted;for(var j=0;j<strategies.length;++j){accepted=strategies[j](root,segs[i],i+1,segs);if(accepted!==undefined){break}}if(accepted===fluid.NO_VALUE){accepted=undefined}root=accepted}return root};fluid.model.getValueAndSegments=function(root,EL,config,initSegs){return fluid.model.accessWithStrategy(root,EL,fluid.NO_VALUE,config,initSegs,true)};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)){var key=EL.type||"default";var resolver=config.resolvers[key];if(!resolver){fluid.fail("Unable to find resolver of type "+key)}var trundler=fluid.model.makeTrundler(config);var valueSeg={root:root,segs:initSegs};valueSeg=resolver(valueSeg,EL,trundler);if(EL.path&&valueSeg){valueSeg=trundler(valueSeg,EL.path)}return returnSegs?valueSeg:valueSeg?valueSeg.root:undefined}else{return fluid.model.accessImpl(root,EL,newValue,config,initSegs,returnSegs,fluid.model.traverseWithStrategy)}};fluid.registerNamespace("fluid.pathUtil");fluid.pathUtil.getPathSegmentImpl=function(accept,path,i){var segment=null;if(accept){segment=""}var escaped=false;var limit=path.length;for(;i<limit;++i){var c=path.charAt(i);if(!escaped){if(c==="."){break}else if(c==="\\"){escaped=true}else if(segment!==null){segment+=c}}else{escaped=false;if(segment!==null){segment+=c}}}if(segment!==null){accept[0]=segment}return i};var globalAccept=[];fluid.pathUtil.parseEL=function(path){var togo=[];var index=0;var limit=path.length;while(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);if(c==="."||c==="\\"||c==="}"){prefix+="\\"}prefix+=c}return prefix};fluid.pathUtil.escapeSegment=function(segment){return fluid.pathUtil.composeSegment("",segment)};fluid.pathUtil.composePath=function(prefix,suffix){if(prefix.length!==0){prefix+="."}return fluid.pathUtil.composeSegment(prefix,suffix)};fluid.pathUtil.composeSegments=function(){var path="";for(var 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 false}for(var i=start;i<end;++i){if(segs[i]!==toMatch[i-start]){return false}}return true};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};vertices.forEach((function(vertex){delete vertex.lowIndex;delete vertex.tarjanIndex;delete vertex.onStack}));vertices.forEach((function(vertex){if(vertex.tarjanIndex===undefined){fluid.stronglyConnectedOne(vertex,that)}}));return that.components};fluid.stronglyConnectedOne=function(vertex,that){vertex.tarjanIndex=that.index;vertex.lowIndex=that.index;++that.index;that.stack.push(vertex);vertex.onStack=true;var outEdges=that.accessor(vertex);outEdges.forEach((function(outVertex){if(outVertex.tarjanIndex===undefined){fluid.stronglyConnectedOne(outVertex,that);vertex.lowIndex=Math.min(vertex.lowIndex,outVertex.lowIndex)}else if(outVertex.onStack){vertex.lowIndex=Math.min(vertex.lowIndex,outVertex.tarjanIndex)}}));if(vertex.lowIndex===vertex.tarjanIndex){var component=[],outVertex;do{outVertex=that.stack.pop();outVertex.onStack=false;component.push(outVertex)}while(outVertex!==vertex);that.components.push(component)}};fluid.initRelayModel=function(that){return that.model};fluid.findInitModelTransaction=function(that){var transRec=fluid.currentTreeTransaction();if(transRec&&fluid.isComponent(that)){return transRec.initModelTransaction[that.id]}};fluid.enlistModelComponent=function(that){var treeTransaction=fluid.currentTreeTransaction();var transId=treeTransaction.initModelTransactionId;var initModelTransaction=treeTransaction.initModelTransaction;var enlist=initModelTransaction[that.id];if(!enlist){var shadow=fluid.shadowForComponent(that);enlist={that:that,applier:fluid.getForComponent(that,"applier"),initModels:[],completeOnInit:!!shadow.initTransactionId,transaction:that.applier.initiate(null,"init",transId)};initModelTransaction[that.id]=enlist;var transRec=fluid.getModelTransactionRec(fluid.rootComponent,transId);transRec[that.applier.applierId]={transaction:enlist.transaction};fluid.registerMaterialisationListener(that,that.applier)}return enlist};fluid.clearTransactions=function(){var instantiator=fluid.globalInstantiator;fluid.clear(instantiator.modelTransactions)};fluid.failureEvent.addListener(fluid.clearTransactions,"clearTransactions","before:fail");fluid.clearLinkCounts=function(transRec,relaysAlso){fluid.each(transRec,(function(value,key){if(typeof value==="number"){transRec[key]=0}else if(relaysAlso&&value.options&&typeof value.relayCount==="number"){value.relayCount=0}}))};fluid.computeInitialOutArcs=function(transacs,initModelTransaction){return fluid.transform(initModelTransaction,(function(recel,id){var oneOutArcs={};var listeners=recel.that.applier.listeners.sortedListeners;fluid.each(listeners,(function(listener){if(listener.isRelay&&!fluid.isExcludedChangeSource(transacs[id],listener.cond)){var targetId=listener.targetId;if(targetId!==id){oneOutArcs[targetId]=true}}}));var oneOutArcList=Object.keys(oneOutArcs);var togo=oneOutArcList.map((function(id){return initModelTransaction[id]}));fluid.remove_if(togo,(function(rec){return rec===undefined}));return togo}))};fluid.sortCompleteLast=function(reca,recb){return(reca.completeOnInit?1:0)-(recb.completeOnInit?1:0)};fluid.subscribeResourceModelUpdates=function(that,resourceMapEntry){var treeTransaction=fluid.currentTreeTransaction();var resourceSpec=resourceMapEntry.resourceSpec;var resourceUpdateListener=function(){var initTransaction=fluid.getImmediate(treeTransaction,["initModelTransaction",that.id]);var trans=initTransaction?initTransaction.transaction:that.applier.initiate();resourceMapEntry.listeners.forEach((function(oneListener){var innerValue=fluid.getImmediate(resourceSpec,oneListener.resourceSegs);var segs=oneListener.segs;trans.change(segs,null,"DELETE");trans.change(segs,innerValue)}));if(!initTransaction){trans.commit()}else{var transRec=fluid.getModelTransactionRec(fluid.rootComponent,trans.id);fluid.clearLinkCounts(transRec,true);that.applier.preCommit.fire(trans,that)}};resourceSpec.onFetched.addListener(resourceUpdateListener);fluid.recordListener(resourceSpec.onFetched,resourceUpdateListener,fluid.shadowForComponent(that))};fluid.resolveResourceModelWorkflow=function(shadows,treeTransaction){var initModelTransaction=treeTransaction.initModelTransaction;shadows.forEach((function(shadow){var that=shadow.that;fluid.registerMergedModelListeners(that,that.options.modelListeners);fluid.each(shadow.modelSourcedDynamicComponents,(function(componentRecord,key){fluid.constructLensedComponents(shadow,initModelTransaction[that.id],componentRecord.sourcesParsed,key)}))}))};fluid.condenseResourceMap=function(resourceMap){var byId={};resourceMap.forEach((function(resourceMapEntry){var resourceSpec=resourceMapEntry.fetchOne.resourceSpec;var id=resourceSpec.transformEvent.eventId;var existing=byId[id];if(!existing){existing=byId[id]={resourceSpec:resourceSpec,listeners:[]}}existing.listeners.push({resourceSegs:resourceMapEntry.fetchOne.segs,segs:resourceMapEntry.segs})}));return byId};fluid.operateInitialTransaction=function(initModelTransaction,transId){var transacs=fluid.transform(initModelTransaction,(function(recel){return recel.transaction}));var outArcs=fluid.computeInitialOutArcs(transacs,initModelTransaction);var arcAccessor=function(initTransactionRecord){return outArcs[initTransactionRecord.that.id]};var recs=fluid.values(initModelTransaction);var components=fluid.stronglyConnected(recs,arcAccessor);var priorityIndex=0;components.forEach((function(component){component.forEach((function(recel){recel.initPriority=recel.completeOnInit?Infinity:priorityIndex++}))}));recs.sort((function(reca,recb){return reca.initPriority-recb.initPriority}));var transRec=fluid.getModelTransactionRec(fluid.rootComponent,transId);recs.forEach((function applyInitialModelTransactionValues(recel){var that=recel.that,applier=recel.that.applier,transac=transacs[that.id];if(recel.completeOnInit){fluid.notifyModelChanges(applier.listeners.sortedListeners,"ADD",transac.oldHolder,fluid.emptyHolder,null,transac,applier,that)}else{fluid.each(recel.initModels,(function(oneInitModel){if(oneInitModel!==undefined){transac.fireChangeRequest({type:"ADD",segs:[],value:oneInitModel})}fluid.clearLinkCounts(transRec,true)}))}}));recs.forEach((function updateInitialModelTransactionRelays(recel){var that=recel.that,applier=recel.that.applier,transac=transacs[that.id];applier.preCommit.fire(transac,that);if(!recel.completeOnInit){var resourceMapById=fluid.condenseResourceMap(applier.resourceMap);fluid.each(resourceMapById,(function(resourceMapEntry){fluid.subscribeResourceModelUpdates(that,resourceMapEntry)}));applier.earlyModelResolved.fire(that.model);applier.preCommit.fire(transac,that);recel.completeOnInit=true;var shadow=fluid.shadowForComponent(that);if(shadow&&!shadow.initTransactionId){shadow.initTransactionId=transId}}}))};fluid.parseModelReference=function(that,ref){var parsed=fluid.parseContextReference(ref);parsed.segs=fluid.pathUtil.parseEL(parsed.path);return parsed};fluid.parseValidModelReference=function(that,name,ref,permitNonModel){var localRecord=fluid.shadowForComponent(that).localRecord;var reject=function(){var failArgs=["Error in "+name+": ",ref].concat(fluid.makeArray(arguments));fluid.fail.apply(null,failArgs)};var rejectNonModel=function(value){reject(" must be a reference to a component with a ChangeApplier (descended from fluid.modelComponent), instead got ",value)};var parsed;if(typeof ref==="string"){if(fluid.isIoCReference(ref)){parsed=fluid.parseModelReference(that,ref);var modelPoint=parsed.segs.indexOf("model");if(modelPoint===-1){if(permitNonModel){parsed.nonModel=true}else{reject(' must be a reference into a component model via a path including the segment "model"')}}else{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{if(!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.expandImmediate(ref.segs,that,localRecord)};fluid.each(parsed.modelSegs,(function(seg,index){if(!fluid.isValue(seg)){reject(" did not resolve path segment reference "+ref.segs[index]+" at index "+index)}}))}var contextTarget,target;if(parsed.context){if(localRecord&&parsed.context in localRecord){if(parsed.context==="source"&&localRecord.sourceModelReference){target=localRecord.sourceModelReference.that;parsed.modelSegs=localRecord.sourceModelReference.modelSegs.concat(parsed.segs);parsed.nonModel=false}else{target=localRecord[parsed.context]}}else{contextTarget=fluid.resolveContext(parsed.context,that);if(!contextTarget){reject(" context must be a reference to an existing component")}target=parsed.contextSegs?fluid.getForComponent(contextTarget,parsed.contextSegs):contextTarget}}else{target=that}if(!parsed.nonModel){if(!fluid.isComponent(target)){rejectNonModel(target)}if(!target.applier){fluid.getForComponent(target,["applier"])}if(!target.applier){rejectNonModel(target)}}parsed.that=target;parsed.applier=target&&target.applier;if(!parsed.path&&parsed.applier){parsed.path=target&&parsed.applier.composeSegments.apply(null,parsed.modelSegs)}return parsed};fluid.registerNamespace("fluid.materialiserRegistry");fluid.matchMaterialiserSpec=function(record,segs){var trundle=record;var routedPath=null;for(var i=0;i<segs.length;++i){var seg=segs[i];var wildcard=trundle["*"];if(wildcard){routedPath=wildcard}trundle=trundle[seg]||wildcard;if(!trundle){break}else if(trundle.materialiser){return trundle}}if(routedPath){fluid.fail("Materialised DOM path ",segs," did not match any registered materialiser - available paths are "+Object.keys(routedPath).join(", "))}return null};fluid.materialiseModelPath=function(that,segs){var shadow=fluid.shadowForComponent(that);var materialisedPath=["materialisedPaths"].concat(segs);if(!fluid.getImmediate(shadow,materialisedPath)){fluid.each(fluid.materialiserRegistry,(function(gradeRecord,grade){if(fluid.componentHasGrade(that,grade)){var record=fluid.matchMaterialiserSpec(gradeRecord,segs);if(record&&record.materialiser){fluid.model.setSimple(shadow,materialisedPath,{});var args=fluid.makeArray(record.args);fluid.invokeGlobalFunction(record.materialiser,[that,fluid.makeArray(segs)].concat(args))}}}))}};fluid.materialiseAgainstValue=function(that,newValue,segs){if(fluid.isPlainObject(newValue)){fluid.each(newValue,(function(inner,seg){segs.push(seg);fluid.materialiseAgainstValue(that,inner,segs);segs.pop()}))}else{fluid.materialiseModelPath(that,segs)}};fluid.registerMaterialisationListener=function(that,applier){fluid.each(fluid.materialiserRegistry,(function(gradeRecord,grade){if(fluid.componentHasGrade(that,grade)){fluid.each(gradeRecord,(function(rest,root){applier.modelChanged.addListener({transactional:false,path:root},(function(newValue){var segs=[root];fluid.materialiseAgainstValue(that,newValue,segs)}))}))}}))};fluid.getModelTransactionRec=function(that,transId){if(!transId){fluid.fail("Cannot get transaction record without transaction id")}var instantiator=fluid.isComponent(that)&&!fluid.isDestroyed(that,true)?fluid.globalInstantiator:null;if(!instantiator){return null}var transRec=instantiator.modelTransactions[transId];if(!transRec){transRec=instantiator.modelTransactions[transId]={relays:[],sources:{},externalChanges:{}}}return 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);var transEl=transRec[targetApplier.applierId]={transaction:newTrans,relayCount:0,namespace:npOptions.namespace,priority:npOptions.priority,options:options};transEl.priority=fluid.parsePriority(transEl.priority,transRec.relays.length,false,"model relay");transRec.relays.push(transEl);return transEl};fluid.relayRecursionBailout=100;fluid.registerDirectChangeRelay=function(target,targetSegs,source,sourceSegs,linkId,transducer,options,npOptions){var targetApplier=options.targetApplier||target.applier;var sourceApplier=options.sourceApplier||source.applier;if(!options.targetApplier){fluid.materialiseModelPath(target,targetSegs)}if(!options.sourceApplier){fluid.materialiseModelPath(source,sourceSegs)}var applierId=targetApplier.applierId;targetSegs=fluid.makeArray(targetSegs);sourceSegs=fluid.makeArray(sourceSegs);var sourceListener=function(newValue,oldValue,path,changeRequest,trans,applier){var transId=trans.id;var transRec=fluid.getModelTransactionRec(target,transId);if(applier&&trans&&!transRec[applier.applierId]){transRec[applier.applierId]={transaction:trans}}var transEl=transRec[applierId];transRec[linkId]=transRec[linkId]||0;var relay=true;if(relay){++transRec[linkId];if(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)}if(!transEl){transEl=fluid.registerRelayTransaction(transRec,targetApplier,transId,options,npOptions)}if(transducer&&!options.targetApplier){fluid.pushActivity("relayTransducer",'computing modelRelay output for rule with target path "%targetSegs" and namespace "%namespace"',{targetSegs:targetSegs,namespace:npOptions.namespace});transducer(transEl.transaction,options.sourceApplier?undefined:newValue,source,sourceSegs,targetSegs,changeRequest);fluid.popActivity()}else{if(changeRequest&&changeRequest.type==="DELETE"){var deleteSegs=targetSegs.concat(changeRequest.segs.slice(sourceSegs.length));transEl.transaction.fireChangeRequest({type:"DELETE",segs:deleteSegs})}else if(newValue!==undefined){transEl.transaction.fireChangeRequest({type:"ADD",segs:targetSegs,value:newValue})}}}};var spec=sourceApplier.modelChanged.addListener({isRelay:true,cond:transducer&&transducer.cond,targetId:target.id,targetApplierId:targetApplier.id,segs:sourceSegs,transactional:options.transactional},sourceListener);if(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)}if(source){fluid.recordChangeListener(source,sourceApplier,sourceListener,spec.listenerId);if(target!==source){fluid.recordChangeListener(target,sourceApplier,sourceListener,spec.listenerId)}}};fluid.connectModelRelay=function(source,sourceSegs,target,targetSegs,options){var linkId=fluid.allocateGuid();fluid.enlistModelComponent(target);fluid.enlistModelComponent(source);var npOptions=fluid.filterKeys(options,["namespace","priority"]);if(options.update){if(options.targetApplier){fluid.registerDirectChangeRelay(source,sourceSegs,target,targetSegs,linkId,null,{transactional:false,targetApplier:options.targetApplier,refCount:options.refCount,update:options.update},npOptions)}else{fluid.registerDirectChangeRelay(target,targetSegs,source,[],linkId+"-transform",options.forwardAdapter,{transactional:true,sourceApplier:options.forwardApplier},npOptions)}}else{fluid.registerDirectChangeRelay(target,targetSegs,source,sourceSegs,linkId,options.forwardAdapter,{transactional:false},npOptions);fluid.registerDirectChangeRelay(source,sourceSegs,target,targetSegs,linkId,options.backwardAdapter,{transactional:false},npOptions)}};fluid.parseSourceExclusionSpec=function(targetSpec,sourceSpec){targetSpec.excludeSource=fluid.arrayToHash(fluid.makeArray(sourceSpec.excludeSource||(sourceSpec.includeSource?"*":undefined)));targetSpec.includeSource=fluid.arrayToHash(fluid.makeArray(sourceSpec.includeSource));return targetSpec};fluid.isExcludedChangeSource=function(transaction,spec){if(!spec||!spec.excludeSource){return false}var excluded=spec.excludeSource["*"];for(var source in transaction.fullSources){if(spec.excludeSource[source]){excluded=true}if(spec.includeSource[source]){excluded=false}}return excluded};fluid.model.guardedAdapter=function(transaction,cond,func,args){if(!fluid.isExcludedChangeSource(transaction,cond)&&func!==fluid.model.transform.uninvertibleTransform){func.apply(null,args)}};fluid.transformToAdapter=function(transform,targetPath){var basedTransform={};basedTransform[targetPath]=transform;return function(trans,newValue,source,sourceSegs,targetSegs,changeRequest){if(changeRequest&&changeRequest.type==="DELETE"){trans.fireChangeRequest({type:"DELETE",path:targetPath})}var oldTarget=fluid.getImmediate(trans.oldHolder.model,targetSegs);var oldSource=fluid.getImmediate(source.model,sourceSegs);fluid.model.transformWithRules(newValue,basedTransform,{finalApplier:trans,oldTarget:oldTarget,oldSource:oldSource})}};fluid.makeTransformPackage=function(componentThat,transform,sourcePath,targetPath,forwardCond,backwardCond,namespace,priority){var that={forwardHolder:{model:transform},backwardHolder:{model:null}};that.generateAdapters=function(trans){that.forwardAdapterImpl=fluid.transformToAdapter(trans?trans.newHolder.model:that.forwardHolder.model,targetPath);if(sourcePath!==null){var inverted=fluid.model.transform.invertConfiguration(transform);if(inverted!==fluid.model.transform.uninvertibleTransform){that.backwardHolder.model=inverted;that.backwardAdapterImpl=fluid.transformToAdapter(that.backwardHolder.model,sourcePath)}else{that.backwardAdapterImpl=inverted}}};that.forwardAdapter=function(transaction,newValue){if(newValue===undefined){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=true;that.invalidator=fluid.makeEventFirer({name:"Invalidator for model relay with applier "+that.forwardApplier.applierId});if(sourcePath!==null){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};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);return that};fluid.singleTransformToFull=function(singleTransform){var expanded=typeof singleTransform==="string"?{type:singleTransform}:singleTransform;var withPath=$.extend(true,{inputPath:""},expanded);return{"":{transform:withPath}}};fluid.funcToSingleTransform=function(that,mrrec){if(mrrec.func){if((mrrec.args!==undefined)+(mrrec.source!==undefined)+(mrrec.value!==undefined)!==1){fluid.fail("Error in model relay definition: short-form relay must specify just one out of (args, source, value)")}return{type:"fluid.transforms.free",func:mrrec.func,args:mrrec.args?mrrec.args:[fluid.isIoCReference(mrrec.source)?mrrec.source:"{that}.model."+mrrec.source]}}else{return null}};fluid.model.relayConditions={initOnly:{includeSource:"init"},liveOnly:{excludeSource:"init"},never:{includeSource:[]},always:{}};fluid.model.expandRelayCondition=function(condition){var exclusionRec;if(condition==="initOnly"){fluid.log(fluid.logLevel.WARN,'The relay condition "initOnly" is deprecated: Please use the form \'includeSource: "init"\' instead')}else if(condition==="liveOnly"){fluid.log(fluid.logLevel.WARN,'The relay condition "liveOnly" is deprecated: Please use the form \'excludeSource: "init"\' instead')}if(!condition){exclusionRec={}}else if(typeof condition==="string"){exclusionRec=fluid.model.relayConditions[condition];if(!exclusionRec){fluid.fail('Unrecognised model relay condition string "'+condition+'": the supported values are "never" or a record with members "includeSource" and/or "excludeSource"')}}else{exclusionRec=condition}return exclusionRec};fluid.model.parseRelayConditions=function(conditions){var expanded=conditions.map(fluid.model.expandRelayCondition);var mergeArgs=[true,{}].concat(expanded);var merged=fluid.extend.apply(null,mergeArgs);return fluid.parseSourceExclusionSpec({},merged)};fluid.parseModelRelay=function(that,mrrec,key){fluid.pushActivity("parseModelRelay",'parsing modelRelay definition with key "%key" and body "%body" attached to component "%that"',{key:key,body:mrrec,that:that});if(typeof mrrec.target!=="string"&&!(fluid.isPlainObject(mrrec.target,true)&&mrrec.target.segs)){fluid.fail('Error parsing model relay definition: model reference must be specified for "target"')}var parsedSource=mrrec.source!==undefined?fluid.parseValidModelReference(that,'modelRelay record member "source"',mrrec.source,true):mrrec.value!==undefined?{nonModel:true}:{path:null,modelSegs:null};var parsedTarget=fluid.parseValidModelReference(that,'modelRelay record member "target"',mrrec.target);var namespace=mrrec.namespace||key;var singleTransform=typeof mrrec.singleTransform==="string"?{type:mrrec.singleTransform}:mrrec.singleTransform;var shortSingleTransform=fluid.funcToSingleTransform(that,mrrec);var transform=mrrec.transform||fluid.singleTransformToFull(singleTransform||shortSingleTransform||{type:"fluid.transforms.identity"});var upDefaults=singleTransform?fluid.defaults(singleTransform.type):null;var relayOptions=upDefaults&&upDefaults.relayOptions||{};var forwardCond=fluid.model.parseRelayConditions([relayOptions.forward,mrrec.forward]),backwardCond=fluid.model.parseRelayConditions([relayOptions.backward,mrrec.backward]);var transformPackage=fluid.makeTransformPackage(that,transform,parsedSource.path,parsedTarget.path,forwardCond,backwardCond,namespace,mrrec.priority);if(parsedSource.nonModel){var initValue=fluid.parseImplicitRelay(that,fluid.firstDefined(mrrec.source,mrrec.value),parsedTarget.modelSegs),transformed;if(transform[""].transform.type!=="fluid.transforms.identity"){var localTransform=fluid.copy(transform);localTransform[""].transform.args=[initValue];transformed=fluid.model.transformWithRules(initValue,localTransform)}else{transformed=initValue}var enlist=fluid.enlistModelComponent(parsedTarget.that);var initModel={};fluid.model.setSimple(initModel,parsedTarget.modelSegs,transformed);enlist.initModels.push(initModel)}else{if(transformPackage.refCount===0){fluid.connectModelRelay(parsedSource.that||that,parsedSource.modelSegs,parsedTarget.that,parsedTarget.modelSegs,fluid.filterKeys(transformPackage,["forwardAdapter","backwardAdapter","namespace","priority"]))}else{if(parsedSource.modelSegs&&!shortSingleTransform){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.popActivity()};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,true);if(parsed.nonModel){value=fluid.isComponent(parsed.that)?fluid.possiblyProxyComponent(fluid.getForComponent(parsed.that,parsed.segs)):fluid.getImmediate(parsed.that,parsed.segs);if(value instanceof fluid.fetchResources.FetchOne){that.applier.resourceMap.push({segs:fluid.makeArray(segs),fetchOne:value});return undefined}}else{++options.refCount;fluid.connectModelRelay(that,segs,parsed.that,parsed.modelSegs,options)}}else if(fluid.isPrimitive(modelRec)||!fluid.isPlainObject(modelRec)){value=modelRec}else if(modelRec.expander&&fluid.isPlainObject(modelRec.expander)){value=fluid.expandOptions(modelRec,that)}else{value=fluid.freshContainer(modelRec);fluid.each(modelRec,(function(innerValue,key){segs.push(key);var innerTrans=fluid.parseImplicitRelay(that,innerValue,segs,options);if(innerTrans!==undefined){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];var targetApplier=change.args[5];if(!targetApplier.destroyed){change.listener.apply(null,change.args)}}fluid.clearLinkCounts(transRec,true)};fluid.model.commitRelays=function(instantiator,transactionId){var transRec=instantiator.modelTransactions[transactionId];fluid.each(transRec,(function(transEl){if(transEl.transaction){transEl.transaction.commit("relay");transEl.transaction.reset()}}))};fluid.model.updateRelays=function(instantiator,transactionId){var transRec=instantiator.modelTransactions[transactionId];var updates=0;fluid.sortByPriority(transRec.relays);fluid.each(transRec.relays,(function(transEl){var maxRelay=transEl.options.refCount?transEl.options.refCount*4:4;if(transEl.transaction.changeRecord.changes>0&&transEl.relayCount<maxRelay&&transEl.options.update){transEl.relayCount++;fluid.clearLinkCounts(transRec);transEl.options.update(transEl.transaction,transRec);++updates}}));return updates};fluid.concludeModelTransaction=function(transaction){var instantiator=fluid.globalInstantiator;fluid.model.notifyExternal(instantiator.modelTransactions[transaction.id]);delete instantiator.modelTransactions[transaction.id]};fluid.establishModelRelay=function(that,optionsModel,optionsML,optionsMR,applier){var shadow=fluid.shadowForComponent(that);if(!shadow.modelRelayEstablished){shadow.modelRelayEstablished=true}else{fluid.fail("FLUID-5887 failure: Model relay initialised twice on component",that)}var enlist=fluid.enlistModelComponent(that);var initModels=(optionsModel||[]).map((function(modelRec){return fluid.parseImplicitRelay(that,modelRec,[],{refCount:0,priority:"first"})}));Array.prototype.push.apply(enlist.initModels,initModels);fluid.each(optionsMR,(function(mrrec,key){if(key===""){for(var i=0;i<mrrec.length;++i){fluid.parseModelRelay(that,mrrec[i],key)}}else{var lightMerge=fluid.extend.apply(null,[true,{}].concat(mrrec));fluid.parseModelRelay(that,lightMerge,key)}}));var instantiator=fluid.getInstantiator(that);function updateRelays(transaction){while(fluid.model.updateRelays(instantiator,transaction.id)>0){}}function commitRelays(transaction){fluid.model.commitRelays(instantiator,transaction.id)}applier.preCommit.addListener(updateRelays);applier.preCommit.addListener(commitRelays);applier.postCommit.addListener(fluid.concludeModelTransaction);applier.postCommit.addListener(fluid.concludeAnyTreeTransaction);return null};fluid.destroyLensedComponentSource=function(that,isBoolean){var shadow=fluid.shadowForComponent(that);var sourceModelReference=shadow.localRecord.sourceModelReference;if(sourceModelReference&&!fluid.isDestroyed(sourceModelReference.that,true)){sourceModelReference.that.applier.change(sourceModelReference.modelSegs,false,isBoolean?"ADD":"DELETE")}};fluid.constructLensedComponents=function(shadow,initTransRec,sourcesParsed,dynamicComponentKey){var lightMerge=shadow.lightMergeDynamicComponents[dynamicComponentKey];var sources=fluid.getImmediate(shadow.that.model,sourcesParsed.modelSegs);var shadowRecord=shadow.modelSourcedDynamicComponents[dynamicComponentKey];var localRecordContributor=shadowRecord.localRecordContributor=function(localRecord,source,sourceKey){localRecord.sourceModelReference={that:sourcesParsed.that,modelSegs:sourcesParsed.modelSegs.concat(shadowRecord.isBoolean?[]:[sourceKey])}};fluid.lightMergeRecords.pushRecord(lightMerge,{options:{listeners:{afterDestroy:{funcName:"fluid.destroyLensedComponentSource",args:["{that}",shadowRecord.isBoolean]}}}});fluid.registerSourcedDynamicComponentsTriage(shadow.potentia,shadow.that,sources,lightMerge,dynamicComponentKey,shadowRecord.isBoolean,localRecordContributor)};fluid.operateInitialTransactionWorkflow=function(shadows,treeTransaction){fluid.tryCatch((function(){var initModelTransaction=treeTransaction.initModelTransaction;var transId=treeTransaction.initModelTransactionId;fluid.operateInitialTransaction(initModelTransaction,transId)}),(function(e){treeTransaction.initModelTransaction={};treeTransaction.initModelTransactionId=null;fluid.clearTransactions();throw e}),fluid.identity)};fluid.enlistModelWorkflow=function(shadows,treeTransaction){var transId=treeTransaction.initModelTransactionId;if(!transId){transId=fluid.allocateGuid();treeTransaction.initModelTransactionId=transId}shadows.forEach((function(shadow){fluid.getForComponent(shadow.that,"modelRelay")}));fluid.operateInitialTransactionWorkflow(shadows,treeTransaction)};fluid.notifyInitModelWorkflow=function(shadow,treeTransaction){if(!shadow.modelComplete){var initModelTransaction=treeTransaction.initModelTransaction;var transRec=fluid.getModelTransactionRec(fluid.rootComponent,shadow.initTransactionId);var trans=fluid.values(initModelTransaction)[0].transaction;treeTransaction.initModelTransaction={};treeTransaction.initModelTransactionId=null;trans.commit();fluid.each(initModelTransaction,(function(oneRec){var that=oneRec.that,applier=that.applier;trans=transRec[applier.applierId].transaction;var listeners=applier.transListeners.sortedListeners;var initShadow=fluid.shadowForComponent(that);initShadow.modelComplete=true;var shadowTrans=initShadow.initTransactionId;if(shadowTrans===shadow.initTransactionId){fluid.notifyModelChanges(listeners,"ADD",trans.oldHolder,fluid.emptyHolder,null,trans,applier,that)}else{}}));fluid.concludeModelTransaction(trans)}};fluid.defaults("fluid.modelComponent",{gradeNames:["fluid.component"],workflows:{global:{enlistModel:{funcName:"fluid.enlistModelWorkflow"},resolveResourceModel:{funcName:"fluid.resolveResourceModelWorkflow",priority:"after:enlistModel",waitIO:true}},local:{notifyInitModelWorkflow:{funcName:"fluid.notifyInitModelWorkflow",priority:"before:concludeComponentInit"}}},members:{model:{expander:{funcName:"fluid.initRelayModel",args:["{that}","{that}.modelRelay"],noproxy:true}},applier:{expander:{funcName:"fluid.makeHolderChangeApplier",args:["{that}","{that}.options.changeApplierOptions"],noproxy:true}},modelRelay:{expander:{funcName:"fluid.establishModelRelay",args:["{that}","{that}.options.model","{that}.options.modelListeners","{that}.options.modelRelay","{that}.applier"],noproxy:true}}},mergePolicy:{model:{noexpand:true,func:fluid.arrayConcatPolicy},modelListeners:fluid.makeMergeListenersPolicy(fluid.arrayConcatPolicy),modelRelay:fluid.makeMergeListenersPolicy(fluid.arrayConcatPolicy,true)}});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){if(typeof listener==="string"){listener=fluid.event.resolveListener(listener)}return listener.apply(null,args,localRecord,mergeRecord)};fluid.resolveModelListener=function(that,record){var togo=function(){if(fluid.isDestroyed(that,true)){return}var change=fluid.modelChangedToChange(arguments);var args=arguments;var localRecord={change:change,arguments:args};var mergeRecord={source:Object.keys(change.transaction.sources)};if(record.args){args=fluid.expandImmediate(record.args,that,localRecord)}fluid.event.invokeListener(record.listener,fluid.makeArray(args),localRecord,mergeRecord)};fluid.event.impersonateListener(record.listener,togo);return togo};fluid.registerModelListeners=function(that,record,paths,namespace){var func=fluid.resolveModelListener(that,record);fluid.each(record.byTarget,(function(parsedArray){var parsed=parsedArray[0];var spec={listener:func,listenerId:fluid.allocateGuid(),segsArray:fluid.getMembers(parsedArray,"modelSegs"),includeSource:record.includeSource,excludeSource:record.excludeSource,priority:fluid.expandOptions(record.priority,that),transactional:true};spec=parsed.applier.modelChanged.addListener(spec,func,namespace,record.softNamespace);spec.segsArray.forEach((function(segs){fluid.materialiseModelPath(that,segs)}));fluid.recordChangeListener(that,parsed.applier,func,spec.listenerId)}))};fluid.registerMergedModelListeners=function(that,listeners){fluid.each(listeners,(function(value,key){if(typeof value==="string"){value={funcName:value}}var records=fluid.event.resolveListenerRecord(value,that,"modelListeners",null,false).records;fluid.each(records,(function(record){record.byTarget={};var paths=fluid.makeArray(record.path===undefined?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)||(record.path!==undefined?key:null);fluid.registerModelListeners(that,record,paths,namespace)}))}))};fluid.replaceModelValue=function(applier,path,newValue){var transaction=applier.initiate();transaction.fireChangeRequest({path:path,type:"DELETE"});transaction.fireChangeRequest({path:path,value:newValue});transaction.commit();return applier.holder.model};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(typeof changeMap==="string"){return changeMap}if(i<segs.length&&changeMap){changeMap=changeMap[segs[i]]}}return null};fluid.model.setChangedPath=function(options,segs,value){var notePath=function(record){var root=options;segs.unshift(record);for(var i=0;i<segs.length-1;++i){var seg=segs[i];if(root[seg]===undefined){root[seg]={}}root=root[seg]}if(fluid.isPlainObject(root)){root[fluid.peek(segs)]=value}segs.shift()};if(fluid.model.isChangedPath(options.changeMap,segs)!==value){++options.changes;notePath("changeMap")}if(fluid.model.isChangedPath(options.deltaMap,segs)!==value){++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){if(typeof a!=="number"||typeof b!=="number"){return a===b}else{if(a===b||a!==a&&b!==b){return true}else{var relError=Math.abs((a-b)/b);return relError<1e-12}}};fluid.model.applyChangeStrategy=function(target,name,i,segs,source,options){var targetSlot=target[name];var sourceCode=fluid.typeCode(source);var targetCode=fluid.typeCode(targetSlot);var changedValue=fluid.NO_VALUE;if(sourceCode==="primitive"){if(!fluid.model.isSameValue(targetSlot,source)){changedValue=source;++options.unchanged}}else if(targetCode!==sourceCode||sourceCode==="array"&&source.length!==targetSlot.length){changedValue=fluid.freshContainer(source)}if(changedValue!==fluid.NO_VALUE){target[name]=changedValue;if(options.changeMap){fluid.model.setChangedPath(options,segs,options.inverse?"DELETE":"ADD")}}if(sourceCode!=="primitive"){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){continue}var oldTrunk=target[segs[i]];target=fluid.model.traverseWithStrategy(target,segs,i,options[type==="ADD"?"resolverSetConfig":"resolverGetConfig"],segs.length-i-1);if(oldTrunk!==target&&options.changeMap){fluid.model.setChangedPath(options,segs.slice(0,i+1),"ADD")}}return{root:target,last:segs[endpos]}};fluid.model.defaultAccessorConfig=function(options){options=options||{};options.resolverSetConfig=options.resolverSetConfig||fluid.model.escapedSetConfig;options.resolverGetConfig=options.resolverGetConfig||fluid.model.escapedGetConfig;return options};fluid.model.applyHolderChangeRequest=function(holder,request,options){options=fluid.model.defaultAccessorConfig(options);options.deltaMap=options.changeMap?{}:null;options.deltas=0;var length=request.segs.length;var pen,atRoot=length===0;if(atRoot){pen={root:holder,last:"model"}}else{if(!holder.model&&request.type!=="DELETE"){holder.model={};fluid.model.setChangedPath(options,[],options.inverse?"DELETE":"ADD")}pen=fluid.model.stepTargetAccess(holder.model,request.type,request.segs,0,length-1,options)}if(request.type==="ADD"){var value=request.value;var segs=fluid.makeArray(request.segs);fluid.model.applyChangeStrategy(pen.root,pen.last,length-1,segs,value,options,atRoot)}else if(request.type==="DELETE"){if(pen.root&&pen.root[pen.last]!==undefined){delete pen.root[pen.last];if(options.changeMap){fluid.model.setChangedPath(options,request.segs,"DELETE")}}}else{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 typea=fluid.typeCode(modela);var typeb=fluid.typeCode(modelb);var togo;if(typea==="primitive"&&typeb==="primitive"){togo=fluid.model.isSameValue(modela,modelb)}else if(typea==="primitive"^typeb==="primitive"){togo=false}else{var holderb={model:fluid.copy(modelb)};options.inverse=true;fluid.model.applyHolderChangeRequest(holderb,{value:modela,segs:[],type:"ADD"},options);var holdera={model:fluid.copy(modela)};options.inverse=false;fluid.model.applyHolderChangeRequest(holdera,{value:modelb,segs:[],type:"ADD"},options);togo=options.changes===0}if(togo===false&&options.changes===0){options.changes=1;options.changeMap=modelb===undefined?"DELETE":"ADD"}else if(togo===true&&options.unchanged===0){options.unchanged=1}return togo};fluid.outputWildcardMatches=function(matches,outSegs,root){fluid.each(root,(function(value,key){matches.push(outSegs.concat(key))}))};fluid.matchChanges=function(changeMap,specSegs,newHolder,oldHolder){var newRoot=newHolder.model;var oldRoot=oldHolder.model;var map=changeMap;var outSegs=["model"];var wildcard=false;var togo=[];for(var i=0;i<specSegs.length;++i){var seg=specSegs[i];if(seg==="*"){if(i===specSegs.length-1){wildcard=true}else{fluid.fail("Wildcard specification in modelChanged listener is only supported for the final path segment: "+specSegs.join("."))}}else{outSegs.push(seg);map=fluid.isPrimitive(map)?map:map[seg];newRoot=newRoot?newRoot[seg]:undefined;oldRoot=oldRoot?oldRoot[seg]:undefined}}if(map){if(wildcard){if(typeof map==="string"){var allKeys=fluid.extend({},oldRoot,newRoot);fluid.outputWildcardMatches(togo,outSegs,allKeys)}else{fluid.outputWildcardMatches(togo,outSegs,map)}}else{togo.push(outSegs)}}return togo};fluid.storeExternalChange=function(transRec,applier,invalidPath,spec,args){var pathString=applier.composeSegments.apply(null,invalidPath);var keySegs=[applier.holder.id,spec.listenerId,spec.wildcard?pathString:""];var keyString=keySegs.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){return}var transRec=fluid.getModelTransactionRec(that,transaction.id);for(var i=0;i<listeners.length;++i){var spec=listeners[i];var multiplePaths=spec.segsArray.length>1;for(var j=0;j<spec.segsArray.length;++j){var invalidPaths=fluid.matchChanges(changeMap,spec.segsArray[j],newHolder,oldHolder);for(var 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){var isNull=fluid.model.diff(args[0],args[1]);if(isNull){continue}var sourceExcluded=fluid.isExcludedChangeSource(transaction,spec);if(sourceExcluded){continue}}if(transRec&&!spec.isRelay&&spec.transactional){fluid.storeExternalChange(transRec,applier,invalidPath,spec,args)}else{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.emptyHolder=fluid.freezeRecursive({model:undefined});fluid.preFireChangeRequest=function(applier,changeRequest){if(!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.mergeChangeSources=function(target,globalSources){if(fluid.isPlainObject(globalSources,true)){fluid.extend(target,globalSources)}else{fluid.each(fluid.makeArray(globalSources),(function(globalSource){target[globalSource]=true}))}};fluid.ChangeApplier=function(){};fluid.makeHolderChangeApplier=function(holder,options){options=fluid.model.defaultAccessorConfig(options);var applierId=fluid.allocateGuid();var that=new fluid.ChangeApplier;var name=fluid.isComponent(holder)?"ChangeApplier for component "+fluid.dumpThat(holder):"ChangeApplier with id "+applierId;$.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:{},resourceMap:[],earlyModelResolved:fluid.makeEventFirer({name:"earlyModelResolved event for "+name}),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=true};that.modelChanged.addListener=function(spec,listener,namespace,softNamespace){if(typeof spec==="string"){spec={path:spec}}else{spec=fluid.copy(spec)}spec.listenerId=spec.listenerId||fluid.allocateGuid();spec.namespace=namespace;spec.softNamespace=softNamespace;if(typeof listener==="string"){listener={globalName:listener}}spec.listener=listener;if(spec.transactional!==false){spec.transactional=true}if(!spec.segsArray){if(spec.path!==undefined){spec.segs=spec.segs||that.parseEL(spec.path)}spec.segsArray=[spec.segs]}if(!spec.isRelay){fluid.parseSourceExclusionSpec(spec,spec);spec.wildcard=spec.segsArray.some((function(segs){return segs.includes("*")}));if(spec.wildcard&&spec.segsArray.length>1){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")}}var firer=that[spec.transactional?"transListeners":"listeners"];firer.addListener(spec);return spec};that.modelChanged.removeListener=function(listener){that.listeners.removeListener(listener);that.transListeners.removeListener(listener)};that.fireChangeRequest=function(changeRequest){var initTransaction=fluid.findInitModelTransaction(holder);if(initTransaction){initTransaction.transaction.fireChangeRequest(changeRequest)}else{var ation=that.initiate("local",changeRequest.source);ation.fireChangeRequest(changeRequest);ation.commit()}};that.initiate=function(localSource,globalSources,transactionId){localSource=globalSources==="init"?null:localSource||"local";var defeatPost=localSource==="relay"||globalSources==="init";var 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(code!=="relay"){that.preCommit.fire(trans,that,code)}if(trans.changeRecord.changes>0){var oldHolder={model:holder.model};holder.model=trans.newHolder.model;fluid.notifyModelChanges(that.transListeners.sortedListeners,trans.changeRecord.changeMap,holder,oldHolder,null,trans,that,holder)}if(!defeatPost&&code!=="relay"){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]}};var transRec=fluid.getModelTransactionRec(holder,trans.id);if(transRec){fluid.mergeChangeSources(transRec.sources,globalSources);trans.sources=transRec.sources;trans.fullSources=Object.create(transRec.sources);if(localSource){trans.fullSources[localSource]=true}}trans.reset();fluid.bindRequestChange(trans);return trans};fluid.bindRequestChange(that);fluid.bindELMethods(that);return that};fluid.modelPairToChanges=function(value,oldValue,changePathPrefix){changePathPrefix=changePathPrefix||"";var diffOptions={changes:0,unchanged:0,changeMap:{}};fluid.model.diff(oldValue,value,diffOptions);var changes=[];fluid.modelPairToChangesImpl(value,fluid.pathUtil.parseEL(changePathPrefix),diffOptions.changeMap,[],changes);return changes};fluid.modelPairToChangesImpl=function(value,changePathPrefixSegs,changeMap,changeSegs,changes){if(changeMap==="ADD"){changes.push({path:changePathPrefixSegs,value:value,type:"ADD"})}else if(changeMap==="DELETE"){changes.push({path:changePathPrefixSegs,value:null,type:"DELETE"})}else if(fluid.isPlainObject(changeMap,true)){fluid.each(changeMap,(function(change,seg){var currentChangeSegs=changeSegs.concat([seg]);if(change==="ADD"){changes.push({path:changePathPrefixSegs.concat(currentChangeSegs),value:fluid.get(value,currentChangeSegs),type:"ADD"})}else if(change==="DELETE"){changes.push({path:changePathPrefixSegs.concat(currentChangeSegs),value:null,type:"DELETE"})}else if(fluid.isPlainObject(change,true)){fluid.modelPairToChangesImpl(value,changePathPrefixSegs,change,currentChangeSegs,changes)}}))}};"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:false},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:false,priority:"after:updateRemoteModel"},"onWriteError.unblock":{changePath:"requestInFlight",value:false}},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){if(!that.model.requestInFlight){if(that.pendingRequests.fetch){that.fetch()}else if(that.pendingRequests.write){that.write()}}};fluid.remoteModelComponent.updateModelFromFetch=function(that,fetchedModel){var remoteChanges=fluid.modelPairToChanges(fetchedModel,that.model.remote,"local");var localChanges=fluid.modelPairToChanges(that.model.local,that.model.remote,"local");var changes=remoteChanges.concat(localChanges);var 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){fluid.replaceModelValue(that.applier,"remote",that.model.local)};fluid.remoteModelComponent.makeSequenceStrategy=function(payload){return{invokeNext:function(that){var lisrec=that.sources[that.index];lisrec.listener=fluid.event.resolveListener(lisrec.listener);var value=lisrec.listener.apply(null,[payload,that.options]);return value},resolveResult:function(){return payload}}};fluid.remoteModelComponent.makeSequence=function(listeners,payload,options){var sequencer=fluid.promise.makeSequencer(listeners,options,fluid.remoteModelComponent.makeSequenceStrategy(payload));fluid.promise.resumeSequence(sequencer);return sequencer};fluid.remoteModelComponent.fireEventSequence=function(event,payload,options){var listeners=fluid.makeArray(event.sortedListeners);var sequence=fluid.remoteModelComponent.makeSequence(listeners,payload,options);return sequence.promise};fluid.remoteModelComponent.fetch=function(that){var promise=fluid.promise();var activePromise;if(that.pendingRequests.fetch){activePromise=that.pendingRequests.fetch;fluid.promise.follow(activePromise,promise)}else{activePromise=promise;that.pendingRequests.fetch=promise}if(!that.model.requestInFlight){var onFetchSeqPromise=fluid.remoteModelComponent.fireEventSequence(that.events.onFetch);onFetchSeqPromise.then((function(){that.applier.change("requestInFlight",true);var reqPromise=that.fetchImpl();reqPromise.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",false)};fluid.remoteModelComponent.write=function(that){var promise=fluid.promise();var activePromise;if(that.pendingRequests.write){activePromise=that.pendingRequests.write;fluid.promise.follow(that.pendingRequests.write,promise)}else{activePromise=promise}if(that.model.requestInFlight){that.pendingRequests.write=activePromise}else{var onWriteSeqPromise=fluid.remoteModelComponent.fireEventSequence(that.events.onWrite);onWriteSeqPromise.then((function(){that.applier.change("requestInFlight",true);that.pendingRequests.write=null;if(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{var reqPromise=that.writeImpl(that.model.local);reqPromise.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};"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){prefix=prefix===0?"0":prefix||"";suffix=suffix===0?"0":suffix||"";return!prefix?suffix:!suffix?prefix:prefix+"."+suffix};fluid.model.transform.accumulateInputPath=function(inputPath,transformer,paths){if(inputPath!==undefined){paths.push(fluid.model.composePaths(transformer.inputPrefix,inputPath))}};fluid.model.transform.accumulateStandardInputPath=function(input,transformSpec,transformer,paths){fluid.model.transform.getValue(undefined,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;if(inputPath!==undefined){togo=fluid.get(transformer.source,fluid.model.composePaths(transformer.inputPrefix,inputPath),transformer.resolverGetConfig)}if(togo===undefined){togo=fluid.isPrimitive(value)?value:"literalValue"in value?value.literalValue:value.transform===undefined?value:transformer.expand(value)}return togo};fluid.model.transform.NONDEFAULT_OUTPUT_PATH_RETURN={};fluid.model.transform.setValue=function(userOutputPath,value,transformer){var toset=fluid.copy(value);var outputPath=fluid.model.composePaths(transformer.outputPrefix,userOutputPath);if(toset!==undefined){transformer.applier.change(outputPath,toset)}return 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 val!==undefined?val:def};fluid.model.transform.matchValue=function(expected,actual,partialMatches){var stats={changes:0,unchanged:0,changeMap:{}};fluid.model.diff(expected,actual,stats);return stats.unchanged===0?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);transformSpec.outputPath=fluid.model.composePaths(transformer.inputPrefix,transformSpec.inputPath);transformSpec.inputPath=oldOutput;return transformSpec};fluid.model.transform.prefixApplier=function(transformSpec,transformer){if(transformSpec.inputPrefix){transformer.inputPrefixOp.push(transformSpec.inputPrefix)}if(transformSpec.outputPrefix){transformer.outputPrefixOp.push(transformSpec.outputPrefix)}transformer.expand(transformSpec.input);if(transformSpec.inputPrefix){transformer.inputPrefixOp.pop()}if(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"]=[];transform[prefixName]="";return{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;var transformFn=fluid.getGlobalValue(transformOpts.typeName);if(typeof transformFn!=="function"){fluid.fail("Transformation record specifies transformation function with name "+transformSpec.type+" which is not a function - ",transformFn)}if(!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);input=input===undefined&&v!==null?v:input;return input}}));transformArgs.unshift(inputs)}if(fluid.hasGrade(expdef,"fluid.standardInputTransformFunction")){if(!("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);transformArgs.unshift(expanded);if(expanded===undefined){return undefined}}var transformed=transformFn.apply(null,transformArgs);if(fluid.hasGrade(expdef,"fluid.standardOutputTransformFunction")){var outputPath=transformSpec.outputPath!==undefined?transformSpec.outputPath:transformOpts.doOutput?"":undefined;if(outputPath!==undefined&&transformed!==undefined){fluid.model.transform.setValue(transformSpec.outputPath,transformed,transformer);transformed=undefined}}return transformed};var globalAccept=[];fluid.registerNamespace("fluid.pathUtil");fluid.pathUtil.getPathSegment=function(path,i){fluid.pathUtil.getPathSegmentImpl(globalAccept,path,i);return 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){var togo=[];while(true){if(path===""^spec===""&&exact){return null}if(!spec||!path){break}var spechead=fluid.pathUtil.getHeadPath(spec);var 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,true)){var esCopy=fluid.copy(q[i].transformSpec);if(esCopy.inputPath===undefined||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);var result=fluid.model.transform.doTransform(esCopy,transformer,transformOpts);if(result!==undefined){fluid.model.transform.setValue(null,result,transformer)}transformer.outputPrefixOp.pop();transformer.inputPrefixOp.pop()}}if(!fluid.isPrimitive(value)){fluid.model.transform.expandWildcards(transformer,value)}transformer.pathOp.pop()}))};fluid.model.transform.hasWildcard=function(path){return typeof path==="string"&&path.indexOf("*")!==-1};fluid.model.transform.maybePushWildcard=function(transformSpec,transformer){var hw=fluid.model.transform.hasWildcard;var matchPath;if(hw(transformSpec.inputPath)){matchPath=fluid.model.composePaths(transformer.inputPrefix,transformSpec.inputPath)}else if(hw(transformer.outputPrefix)||hw(transformSpec.outputPath)){matchPath=fluid.model.composePaths(transformer.outputPrefix,transformSpec.outputPath)}if(matchPath){transformer.queuedTransforms.push({transformSpec:transformSpec,outputPrefix:transformer.outputPrefix,inputPrefix:transformer.inputPrefix,matchPath:matchPath});return true}return false};fluid.model.sortByKeyLength=function(inObject){var keys=fluid.keys(inObject);return keys.sort(fluid.compareStringLength(true))};fluid.model.transform.handleTransformStrategy=function(transformSpec,transformer,transformOpts){if(fluid.model.transform.maybePushWildcard(transformSpec,transformer)){return}else{return fluid.model.transform.doTransform(transformSpec,transformer,transformOpts)}};fluid.model.transform.handleInvertStrategy=function(transformSpec,transformer,transformOpts){transformSpec=fluid.copy(transformSpec);if(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;var standardInput=fluid.hasGrade(defaults,"fluid.standardInputTransformFunction");var multiInput=fluid.hasGrade(defaults,"fluid.multiInputTransformFunction");if(standardInput){fluid.model.transform.accumulateStandardInputPath("input",transformSpec,transformer,transformer.inputPaths)}if(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){if(!typeName){fluid.fail("Transformation record is missing a type name: ",transformSpec)}if(typeName.indexOf(".")===-1){typeName="fluid.transforms."+typeName}var defaults=fluid.defaults(typeName);return{defaults:defaults,typeName:typeName}};fluid.model.transform.processRule=function(rule,transformer){if(typeof rule==="string"){rule=fluid.model.transform.pathToRule(rule)}else if(rule.literalValue!==undefined){rule=fluid.model.transform.literalValueToRule(rule.literalValue)}var togo;if(rule.transform){var transformSpec,transformOpts;if(fluid.isArrayable(rule.transform)){var transforms=rule.transform;togo=undefined;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)}}if(fluid.isArrayable(rule)){transformer.collectedFlatSchemaOpts=transformer.collectedFlatSchemaOpts||{};transformer.collectedFlatSchemaOpts[transformer.outputPrefix]="array"}fluid.each(rule,(function(value,key){if(key!=="transform"){transformer.outputPrefixOp.push(key);var togo=transformer.expand(value,transformer);if(togo!==undefined){fluid.model.transform.setValue(null,togo,transformer);togo=undefined}transformer.outputPrefixOp.pop()}}));return 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:[]};fluid.model.transform.makeStrategy(transformer,fluid.model.transform.handleInvertStrategy);transformer.expand(rules);var invertible=transformer.inverted.indexOf(fluid.model.transform.uninvertibleTransform)===-1;return invertible?{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){var path=getConfig.parser.compose.apply(null,segs.slice(0,index));for(var i=0;i<keys.length;++i){var key=keys[i];if(fluid.pathUtil.matchPath(key,path,true)!==null){return flatSchema[key]}}}};fluid.model.transform.defaultSchemaValue=function(schemaValue){var type=fluid.isPrimitive(schemaValue)?schemaValue:schemaValue.type;return type==="array"?[]:{}};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){if(options.isomorphic){return fluid.model.transform.isomorphicSchemaStrategy(source,getConfig)}else if(options.flatSchema){return fluid.model.transform.flatSchemaStrategy(options.flatSchema,getConfig)}};fluid.model.transform.schemaToCreatorStrategy=function(strategy){return function(root,segment,index,segs){if(root[segment]===undefined){var schemaValue=strategy(root,segment,index,segs);root[segment]=fluid.model.transform.defaultSchemaValue(schemaValue);return 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 pdiff===0?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;var setConfig=fluid.model.escapedSetConfig;var schemaStrategy=fluid.model.transform.decodeStrategy(source,options,getConfig);var transformer={source:source,target:{model:schemaStrategy?fluid.model.transform.defaultSchemaValue(schemaStrategy(null,"",0,[""])):{}},oldSource:options.oldSource,oldTarget:options.oldTarget,resolverGetConfig:getConfig,resolverSetConfig:setConfig,collectedFlatSchemaOpts:undefined,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);if(transformer.collectedFlatSchemaOpts!==undefined){$.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});if(transformer.queuedTransforms.length>0){transformer.typeStack=[];transformer.pathOp=fluid.model.makePathStack(transformer,"path");fluid.model.transform.expandWildcards(transformer,source)}fluid.model.fireSortedChanges(transformer.queuedChanges,transformer.finalApplier);return 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}}};"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){transformSpec.type="fluid.transforms.identity";return 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)?undefined:newValue};fluid.transforms.stringToNumber.invert=function(transformSpec){transformSpec.type="fluid.transforms.numberToString";return transformSpec};fluid.defaults("fluid.transforms.numberToString",{gradeNames:["fluid.standardTransformFunction","fluid.lens"],invertConfiguration:"fluid.transforms.numberToString.invert"});fluid.transforms.numberToString=function(value,transformSpec){if(typeof value==="number"){if(typeof transformSpec.scale==="number"&&!isNaN(transformSpec.scale)){var rounded=fluid.roundToDecimal(value,transformSpec.scale,transformSpec.method);return rounded.toString()}else{return value.toString()}}};fluid.transforms.numberToString.invert=function(transformSpec){transformSpec.type="fluid.transforms.stringToNumber";return 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){if(!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];var expanded=transformer.expand(value);if(expanded!==undefined){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();var offset=extraInputs.offset();if(typeof input!=="number"||typeof factor!=="number"||typeof offset!=="number"){return undefined}return input*factor+offset};fluid.transforms.linearScale.invert=function(transformSpec){delete transformSpec.factorPath;delete transformSpec.offsetPath;if(transformSpec.factor!==undefined){transformSpec.factor=transformSpec.factor===0?0:1/transformSpec.factor}if(transformSpec.offset!==undefined){transformSpec.offset=-transformSpec.offset*(transformSpec.factor!==undefined?transformSpec.factor:1)}return 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 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},"&&":function(a,b){return a&&b},"||":function(a,b){return a||b}};fluid.transforms.binaryOp=function(inputs,transformSpec,transformer){var left=inputs.left();var right=inputs.right();var operator=fluid.model.transform.getValue(undefined,transformSpec.operator,transformer);var fun=fluid.transforms.binaryLookup[operator];return fun===undefined||left===undefined||right===undefined?undefined: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(condition===null){return undefined}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 matchDiff===0?speca.index-specb.index:matchDiff};fluid.transforms.valueMapper=function(transformSpec,transformer){if(!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);var matchedEntry=fluid.isArrayable(transformSpec.match)?fluid.transforms.valueMapper.longFormMatch(value,transformSpec,transformer):transformSpec.match[value];if(matchedEntry===undefined){matchedEntry=transformSpec.noMatch}if(matchedEntry===undefined){return}var outputPath=matchedEntry.outputPath===undefined?transformSpec.defaultOutputPath:matchedEntry.outputPath;transformer.outputPrefixOp.push(outputPath);var outputValue;if(fluid.isPrimitive(matchedEntry)){outputValue=matchedEntry}else if(matchedEntry.outputUndefinedValue){outputValue=undefined}else{outputValue=fluid.model.transform.resolveParam(matchedEntry,transformer,"outputValue",undefined);outputValue=outputValue===undefined?transformSpec.defaultOutputValue:outputValue}if(typeof outputPath==="string"&&outputValue!==undefined){fluid.model.transform.setValue(undefined,outputValue,transformer,transformSpec.merge);outputValue=undefined}transformer.outputPrefixOp.pop();return outputValue};fluid.transforms.valueMapper.longFormMatch=function(valueFromDefaultPath,transformSpec,transformer){var o=transformSpec.match;if(o.length===0){fluid.fail("valueMapper supplied empty list of matches: ",transformSpec)}var matchPower=[];for(var i=0;i<o.length;++i){var option=o[i];var value=option.inputPath?fluid.model.transform.getValue(option.inputPath,undefined,transformer):valueFromDefaultPath;var matchValue=fluid.model.transform.matchValue(option.inputValue,value,option.partialMatches);matchPower[i]={index:i,matchValue:matchValue}}matchPower.sort(fluid.model.transform.compareMatches);return matchPower[0].matchValue<=0?undefined:o[matchPower[0].index]};fluid.transforms.valueMapper.invert=function(transformSpec,transformer){var match=[];var togo={type:"fluid.transforms.valueMapper",match:match};var 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;fluid.each(transformSpec.match,(function(option,key){if(option.outputUndefinedValue===true){return}var outOption={};var origInputValue=def(isArray?option.inputValue:key,transformSpec.defaultInputValue);if(origInputValue===undefined){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);if(option.outputPath){outOption.inputPath=fluid.model.composePaths(transformer.outputPrefix,def(option.outputPath,transformSpec.outputPath))}if(option.inputPath){outOption.outputPath=fluid.model.composePaths(transformer.inputPrefix,def(option.inputPath,transformSpec.inputPath))}match.push(outOption)}));return togo};fluid.transforms.valueMapper.collect=function(transformSpec,transformer){var togo=[];fluid.model.transform.accumulateStandardInputPath("defaultInput",transformSpec,transformer,togo);fluid.each(transformSpec.match,(function(option){fluid.model.transform.accumulateInputPath(option.inputPath,transformer,togo)}));return togo};fluid.defaults("fluid.transforms.arrayToSetMembership",{gradeNames:["fluid.standardTransformFunction","fluid.lens"],invertConfiguration:"fluid.transforms.arrayToSetMembership.invert"});fluid.transforms.arrayToSetMembership=function(value,transformSpec){if(!value||!fluid.isArrayable(value)){fluid.fail("arrayToSetMembership didn't find array at inputPath nor passed as value.")}transformSpec=transformSpec||{};var output=transformSpec.arrayValue?[]:{};var presentValue=transformSpec.presentValue===undefined?true:transformSpec.presentValue,missingValue=transformSpec.missingValue===undefined?false:transformSpec.missingValue,options=transformSpec.options;if(options===undefined){fluid.each(value,(function(outPath){output[outPath]=presentValue}))}else{fluid.each(options,(function(outPath,key){var outVal=value.indexOf(key)!==-1?presentValue:missingValue;output[outPath]=outVal}))}return output};fluid.transforms.arrayToSetMembership.invert=function(transformSpec){return fluid.transforms.arrayToSetMembership.invertWithType(transformSpec,"fluid.transforms.setMembershipToArray")};fluid.transforms.arrayToSetMembership.invertWithType=function(transformSpec,newType){transformSpec.type=newType;var newOptions={};fluid.each(transformSpec.options,(function(path,oldKey){newOptions[path]=oldKey}));if(!$.isEmptyObject(newOptions)){transformSpec.options=newOptions}return transformSpec};fluid.defaults("fluid.transforms.setMembershipToArray",{gradeNames:["fluid.standardTransformFunction","fluid.lens"],invertConfiguration:"fluid.transforms.setMembershipToArray.invert"});fluid.transforms.setMembershipToArray=function(input,transformSpec){if(!fluid.isPlainObject(input)){fluid.fail("setMembershipToArray didn't find object at inputPath nor passed as value.")}var outputArr=[];transformSpec=transformSpec||{};var presentValue=transformSpec.presentValue===undefined?true:transformSpec.presentValue,options=transformSpec.options;if(options===undefined){fluid.each(input,(function(keyValue,outputVal){if(keyValue===presentValue){outputArr.push(outputVal)}}))}else{fluid.each(options,(function(outputVal,key){if(input[key]===presentValue){outputArr.push(outputVal)}}))}return outputArr};fluid.transforms.setMembershipToArray.invert=function(transformSpec){return fluid.transforms.arrayToSetMembership.invertWithType(transformSpec,"fluid.transforms.arrayToSetMembership")};fluid.model.transform.applyPaths=function(operation,pathOp,paths){for(var i=0;i<paths.length;++i){if(operation==="push"){pathOp.push(paths[i])}else{pathOp.pop()}}};fluid.model.transform.expandInnerValues=function(inputPath,outputPath,transformer,innerValues){var inputPrefixOp=transformer.inputPrefixOp;var outputPrefixOp=transformer.outputPrefixOp;var apply=fluid.model.transform.applyPaths;apply("push",inputPrefixOp,inputPath);apply("push",outputPrefixOp,outputPath);var expanded={};fluid.each(innerValues,(function(innerValue){var expandedInner=transformer.expand(innerValue);if(!fluid.isPrimitive(expandedInner)){$.extend(true,expanded,expandedInner)}else{expanded=expandedInner}}));apply("pop",outputPrefixOp,outputPath);apply("pop",inputPrefixOp,inputPath);return expanded};fluid.defaults("fluid.transforms.indexArrayByKey",{gradeNames:["fluid.standardTransformFunction","fluid.lens"],invertConfiguration:"fluid.transforms.indexArrayByKey.invert"});fluid.transforms.indexArrayByKey=function(arr,transformSpec,transformer){if(transformSpec.key===undefined){fluid.fail("indexArrayByKey requires a 'key' option.",transformSpec)}if(!fluid.isArrayable(arr)){fluid.fail("indexArrayByKey didn't find array at inputPath.",transformSpec)}var newHash={};var pivot=transformSpec.key;fluid.each(arr,(function(v,k){var newKey=v[pivot];var keyType=typeof newKey;if(keyType!=="string"&&keyType!=="boolean"&&keyType!=="number"){fluid.fail("indexArrayByKey encountered untransformable array due to missing or invalid key",v)}var content=fluid.copy(v);delete content[pivot];if(transformSpec.innerValue){content=fluid.model.transform.expandInnerValues([transformer.inputPrefix,transformSpec.inputPath,k.toString()],[transformSpec.outputPath,newKey],transformer,transformSpec.innerValue)}newHash[newKey]=content}));return newHash};fluid.transforms.indexArrayByKey.invert=function(transformSpec){transformSpec.type="fluid.transforms.deindexIntoArrayByKey";if(transformSpec.innerValue){var innerValue=transformSpec.innerValue;for(var i=0;i<innerValue.length;++i){var inverted=fluid.model.transform.invertConfiguration(innerValue[i]);if(inverted===fluid.model.transform.uninvertibleTransform){return inverted}else{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){if(transformSpec.key===undefined){fluid.fail('deindexIntoArrayByKey requires a "key" option.',transformSpec)}var newArray=[];var pivot=transformSpec.key;fluid.each(hash,(function(v,k){var content={};content[pivot]=k;if(transformSpec.innerValue){v=fluid.model.transform.expandInnerValues([transformSpec.inputPath,k],[transformSpec.outputPath,newArray.length.toString()],transformer,transformSpec.innerValue)}$.extend(true,content,v);newArray.push(content)}));return newArray};fluid.transforms.deindexIntoArrayByKey.invert=function(transformSpec){transformSpec.type="fluid.transforms.indexArrayByKey";if(transformSpec.innerValue){var innerValue=transformSpec.innerValue;for(var 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;if(min!==undefined){var excludeMin=transformSpec.excludeMin||0;min+=excludeMin;if(value<min){value=min}}var max=transformSpec.max;if(max!==undefined){var excludeMax=transformSpec.excludeMax||0;max-=excludeMax;if(value>max){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){if(typeof transformSpec.notFound==="number"&&transformSpec.notFound>=0){fluid.fail("A positive number is not allowed as 'notFound' value for indexOf")}var offset=fluid.transforms.parseIndexationOffset(transformSpec.offset,"indexOf");var array=fluid.makeArray(transformSpec.array);var originalIndex=array.indexOf(value);return originalIndex===-1&&transformSpec.notFound?transformSpec.notFound:originalIndex+offset};fluid.transforms.indexOf.invert=function(transformSpec,transformer){var togo=fluid.transforms.invertArrayIndexation(transformSpec,transformer);togo.type="fluid.transforms.dereference";return togo};fluid.defaults("fluid.transforms.dereference",{gradeNames:["fluid.standardTransformFunction","fluid.lens"],invertConfiguration:"fluid.transforms.dereference.invert"});fluid.transforms.dereference=function(value,transformSpec){if(typeof value!=="number"){return undefined}var offset=fluid.transforms.parseIndexationOffset(transformSpec.offset,"dereference");var array=fluid.makeArray(transformSpec.array);var index=value+offset;return array[index]};fluid.transforms.dereference.invert=function(transformSpec,transformer){var togo=fluid.transforms.invertArrayIndexation(transformSpec,transformer);togo.type="fluid.transforms.indexOf";return togo};fluid.transforms.parseIndexationOffset=function(offset,transformName){var parsedOffset=0;if(offset!==undefined){parsedOffset=fluid.parseInteger(offset);if(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.")}}return parsedOffset};fluid.transforms.invertArrayIndexation=function(transformSpec){if(!isNaN(Number(transformSpec.offset))){transformSpec.offset=Number(transformSpec.offset)*-1}return 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);if(!transformSpec.func){fluid.fail("Error in transform specification ",transformSpec,' required member "func" was not set')}return fluid.event.invokeListener(transformSpec.func,args)};fluid.defaults("fluid.transforms.quantize",{gradeNames:"fluid.standardTransformFunction",collectInputPaths:"fluid.transforms.quantize.collect"});fluid.transforms.quantize=function(value,transformSpec,transformer){if(!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||rangeSpec.upperBound===undefined&&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){if(!fluid.isPrimitive(rangeSpec.output)){transformer.expand(rangeSpec.output)}}))};fluid.defaults("fluid.transforms.inRange",{gradeNames:"fluid.standardTransformFunction"});fluid.transforms.inRange=function(value,transformSpec){return(transformSpec.min===undefined||transformSpec.min<=value)&&(transformSpec.max===undefined||transformSpec.max>=value)?true:false};fluid.defaults("fluid.transforms.toggle",{gradeNames:["fluid.standardTransformFunction"],invertConfiguration:"fluid.transforms.toggle.invert",relayOptions:{forward:{excludeSource:"init"},backward:{includeSource:"init"}}});fluid.transforms.toggle=function(source,transformSpec,transformer){var oldSource=transformer.oldSource,oldTarget=transformer.oldTarget;var phase=(oldSource||0)-fluid.transforms.inverseToggle.base(oldTarget);return fluid.transforms.toggle.base(source+phase)};fluid.transforms.toggle.base=function(source){return(source||0)%2===1};fluid.transforms.toggle.invert=function(transformSpec){transformSpec.type="fluid.transforms.inverseToggle";return transformSpec};fluid.defaults("fluid.transforms.inverseToggle",{gradeNames:["fluid.standardTransformFunction"]});fluid.transforms.inverseToggle=function(source,transformSpec,transformer){return transformer.originalTarget||undefined};fluid.transforms.inverseToggle.base=function(source){return source?1:0};fluid.transforms.parseClasses=function(classes){var classList=classes.match(fluid.transforms.parseClasses.rnothtmlwhite)||[];return fluid.arrayToHash(classList)};fluid.transforms.parseClasses.rnothtmlwhite=/[^\x20\t\r\n\f]+/g;fluid.transforms.stringToBoolean=function(value){if(value){return!(value==="0"||value==="false")}else{return false}};fluid.transforms.stringToBoolean.invert=function(transformSpec){transformSpec.type="fluid.transforms.booleanToString";return 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){transformSpec.type="fluid.transforms.stringToBoolean";return 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 undefined}};fluid.transforms.JSONstringToObject.invert=function(transformSpec){transformSpec.type="fluid.transforms.objectToJSONString";return 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){transformSpec.type="fluid.transforms.JSONstringToObject";return 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())?undefined:date};fluid.transforms.stringToDate.invert=function(transformSpec){transformSpec.type="fluid.transforms.dateToString";return 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();var dateString=isoString.substring(0,isoString.indexOf("T"));return dateString}else{return undefined}};fluid.transforms.dateToString.invert=function(transformSpec){transformSpec.type="fluid.transforms.stringToDate";return 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():undefined};fluid.defaults("fluid.transforms.dateTimeToString",{gradeNames:["fluid.standardTransformFunction","fluid.lens"],invertConfiguration:"fluid.transforms.dateToString.invert"});"use strict";var fluid=fluid||{};(function($){fluid.thatistBridge=function(name,peer){var togo=function(funcname){var segs=funcname.split(".");var move=peer;for(var i=0;i<segs.length;++i){move=move[segs[i]]}var args=[this];if(arguments.length===2){args=args.concat($.makeArray(arguments[1]))}var ret=move.apply(null,args);this.that=function(){return ret};return ret&&ret.constructor&&ret.constructor.name==="fluid.componentConstructor"?this:ret};$.fn[name]=togo;return togo};fluid.thatistBridge("fluid",fluid);var canHaveDefaultTabindex=function(elements){if(elements.length<=0){return false}return $(elements[0]).is("a, input, button, select, area, textarea, object")};var getValue=function(elements){if(elements.length<=0){return undefined}if(!fluid.tabindex.hasAttr(elements)){return canHaveDefaultTabindex(elements)?Number(0):undefined}var value=elements.attr("tabindex");return Number(value)};var setValue=function(elements,toIndex){return elements.each((function(i,item){$(item).attr("tabindex",toIndex)}))};fluid.tabindex=function(target,toIndex){target=$(target);if(toIndex!==null&&toIndex!==undefined){return setValue(target,toIndex)}else{return getValue(target)}};fluid.tabindex.remove=function(target){target=$(target);return target.each((function(i,item){$(item).removeAttr("tabindex")}))};fluid.tabindex.hasAttr=function(target){target=$(target);if(target.length<=0){return false}var togo=target.map((function(){var attributeNode=this.getAttributeNode("tabindex");return attributeNode?attributeNode.specified:false}));return togo.length===1?togo[0]:togo};fluid.tabindex.has=function(target){target=$(target);return 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};var LEFT_RIGHT_KEYMAP={next:$.ui.keyCode.RIGHT,previous:$.ui.keyCode.LEFT};var unwrap=function(element){return element.jquery?element[0]:element};var makeElementsTabFocussable=function(elements){elements.each((function(idx,item){item=$(item);if(!item.fluid("tabindex.has")||item.fluid("tabindex")<0){item.fluid("tabindex",0)}}))};fluid.tabbable=function(target){target=$(target);makeElementsTabFocussable(target)};var CONTEXT_KEY="selectionContext";var NO_SELECTION=-32768;var cleanUpWhenLeavingContainer=function(selectionContext){if(selectionContext.activeItemIndex!==NO_SELECTION){if(selectionContext.options.onLeaveContainer){selectionContext.options.onLeaveContainer(selectionContext.selectables[selectionContext.activeItemIndex])}else if(selectionContext.options.onUnselect){selectionContext.options.onUnselect(selectionContext.selectables[selectionContext.activeItemIndex])}}if(!selectionContext.options.rememberSelectionState){selectionContext.activeItemIndex=NO_SELECTION}};var drawSelection=function(elementToSelect,handler){if(handler){handler(elementToSelect)}};var eraseSelection=function(selectedElement,handler){if(handler&&selectedElement){handler(selectedElement)}};var unselectElement=function(selectedElement,selectionContext){eraseSelection(selectedElement,selectionContext.options.onUnselect)};var selectElement=function(elementToSelect,selectionContext){unselectElement(selectionContext.selectedElement(),selectionContext);elementToSelect=unwrap(elementToSelect);var newIndex=selectionContext.selectables.index(elementToSelect);if(newIndex===-1){return}selectionContext.activeItemIndex=newIndex;drawSelection(elementToSelect,selectionContext.options.onSelect)};var selectableFocusHandler=function(selectionContext){return function(evt){$(evt.target).fluid("tabindex",0);selectElement(evt.target,selectionContext);return evt.stopPropagation()}};var selectableBlurHandler=function(selectionContext){return function(evt){$(evt.target).fluid("tabindex",selectionContext.options.selectablesTabindex);unselectElement(evt.target,selectionContext);return evt.stopPropagation()}};var reifyIndex=async function(sc_that){var elements=sc_that.selectables;if(sc_that.activeItemIndex>=elements.length){sc_that.activeItemIndex=sc_that.options.noWrap?elements.length-1:0}if(sc_that.activeItemIndex<0&&sc_that.activeItemIndex!==NO_SELECTION){sc_that.activeItemIndex=sc_that.options.noWrap?0:elements.length-1}if(sc_that.activeItemIndex>=0){return fluid.focus(elements[sc_that.activeItemIndex])}};var prepareShift=async function(selectionContext){var selElm=selectionContext.selectedElement();if(selElm){await fluid.blur(selElm)}unselectElement(selectionContext.selectedElement(),selectionContext);if(selectionContext.activeItemIndex===NO_SELECTION){selectionContext.activeItemIndex=-1}};var focusNextElement=async function(selectionContext){await prepareShift(selectionContext);++selectionContext.activeItemIndex;return reifyIndex(selectionContext)};var focusPreviousElement=async function(selectionContext){await prepareShift(selectionContext);--selectionContext.activeItemIndex;return reifyIndex(selectionContext)};var arrowKeyHandler=function(selectionContext,keyMap){return async function(evt){if(evt.which===keyMap.next){await focusNextElement(selectionContext);evt.preventDefault()}else if(evt.which===keyMap.previous){await focusPreviousElement(selectionContext);evt.preventDefault()}}};var getKeyMapForDirection=function(direction){var keyMap;if(direction===fluid.a11y.orientation.HORIZONTAL){keyMap=LEFT_RIGHT_KEYMAP}else if(direction===fluid.a11y.orientation.VERTICAL){keyMap=UP_DOWN_KEYMAP}return keyMap};var tabKeyHandler=function(selectionContext){return function(evt){if(evt.which!==$.ui.keyCode.TAB){return}cleanUpWhenLeavingContainer(selectionContext);if(evt.shiftKey){selectionContext.focusIsLeavingContainer=true}}};var containerFocusHandler=function(selectionContext){return async function(evt){var shouldOrig=selectionContext.options.autoSelectFirstItem;var shouldSelect=typeof shouldOrig==="function"?shouldOrig():shouldOrig;if(selectionContext.focusIsLeavingContainer){shouldSelect=false}if(shouldSelect&&evt.target===selectionContext.container.get(0)){if(selectionContext.activeItemIndex===NO_SELECTION){selectionContext.activeItemIndex=0}await fluid.focus(selectionContext.selectables[selectionContext.activeItemIndex])}return evt.stopPropagation()}};var containerBlurHandler=function(selectionContext){return function(evt){selectionContext.focusIsLeavingContainer=false;return evt.stopPropagation()}};var makeElementsSelectable=function(container,defaults,userOptions){var options=$.extend(true,{},defaults,userOptions);var keyMap=getKeyMapForDirection(options.direction);var selectableElements=options.selectableElements?options.selectableElements:container.find(options.selectableSelector);var that={container:container,activeItemIndex:NO_SELECTION,selectables:selectableElements,focusIsLeavingContainer:false,options:options};that.selectablesUpdated=async function(focusedItem){if(typeof that.options.selectablesTabindex==="number"){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,selectableFocusHandler(that));that.selectables.on("blur."+CONTEXT_KEY,selectableBlurHandler(that));if(keyMap&&that.options.noBubbleListeners){that.selectables.off("keydown."+CONTEXT_KEY);that.selectables.on("keydown."+CONTEXT_KEY,arrowKeyHandler(that,keyMap))}if(focusedItem){selectElement(focusedItem,that)}else{return reifyIndex(that)}};that.refresh=async function(){if(!that.options.selectableSelector){fluid.fail("Cannot refresh selectable context which was not initialised by a selector")}that.selectables=container.find(options.selectableSelector);return that.selectablesUpdated()};that.selectedElement=function(){return that.activeItemIndex<0?null:that.selectables[that.activeItemIndex]};if(keyMap&&!that.options.noBubbleListeners){container.on("keydown",arrowKeyHandler(that,keyMap))}container.on("keydown",tabKeyHandler(that));container.on("focus",containerFocusHandler(that));container.on("blur",containerBlurHandler(that));that.promise=that.selectablesUpdated();return that};fluid.selectable=function(target,options){target=$(target);var that=makeElementsSelectable(target,fluid.selectable.defaults,options);fluid.setScopedData(target,CONTEXT_KEY,that);return that};fluid.selectable.select=async function(target,toSelect){return fluid.focus(toSelect)};fluid.selectable.selectNext=async function(target){target=$(target);return focusNextElement(fluid.getScopedData(target,CONTEXT_KEY))};fluid.selectable.selectPrevious=async function(target){target=$(target);return 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:true,rememberSelectionState:true,selectableSelector:".selectable",selectableElements:null,onSelect:null,onUnselect:null,onLeaveContainer:null,noWrap:false};var checkForModifier=function(binding,evt){if(!binding.modifier){return true}var modifierKey=binding.modifier;var isCtrlKeyPresent=modifierKey&&evt.ctrlKey;var isAltKeyPresent=modifierKey&&evt.altKey;var isShiftKeyPresent=modifierKey&&evt.shiftKey;return isCtrlKeyPresent||isAltKeyPresent||isShiftKeyPresent};var makeActivationHandler=function(binding){return function(evt){var target=evt.target;if(!fluid.enabled(target)){return}var code=evt.which?evt.which:evt.keyCode;if(code===binding.key&&binding.activateHandler&&checkForModifier(binding,evt)){var event=$.Event("fluid-activate");$(target).trigger(event,[binding.activateHandler]);if(event.isDefaultPrevented()){evt.preventDefault()}}}};var makeElementsActivatable=function(elements,onActivateHandler,defaultKeys,options){var bindings=[];$(defaultKeys).each((function(index,key){bindings.push({modifier:null,key:key,activateHandler:onActivateHandler})}));if(options&&options.additionalBindings){bindings=bindings.concat(options.additionalBindings)}fluid.initEnablement(elements);for(var i=0;i<bindings.length;++i){var binding=bindings[i];elements.on("keydown",makeActivationHandler(binding))}elements.on("fluid-activate",(function(evt,handler){handler=handler||onActivateHandler;return handler?handler(evt):null}))};fluid.activatable=function(target,fn,options){target=$(target);makeElementsActivatable(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);"use strict";fluid.apply=function(options){return options.func.apply(null,options.args)};fluid.defaults("fluid.baseViewComponent",{gradeNames:"fluid.component",argumentMap:{container:0,options:1},events:{onDomBind:"promise"},listeners:{"onCreate.onDomBind":"{that}.events.onDomBind"},selectors:{},members:{dom:"@expand:fluid.createDomBinder({that}.container, {that}.options.selectors)",locate:"{that}.dom.locate"},mergePolicy:{"members.dom":"replace","members.container":"replace"}});fluid.defaults("fluid.viewComponent",{gradeNames:["fluid.modelComponent","fluid.baseViewComponent"],members:{container:"@expand:fluid.containerForViewComponent({that}, {that}.options.container)"}});fluid.dumpSelector=function(selectable){return typeof selectable==="string"?selectable:selectable.selector?selectable.selector:""};fluid.checkTryCatchParameter=function(){var location=window.location||{search:"",protocol:"file:"};var GETparams=location.search.slice(1).split("&");return fluid.find(GETparams,(function(param){if(param.indexOf("notrycatch")===0){return true}}))===true};fluid.notrycatch=fluid.checkTryCatchParameter();fluid.wrap=function(obj,userJQuery){userJQuery=userJQuery||$;return!obj||obj.jquery?obj:userJQuery(obj)};fluid.unwrap=function(obj){return obj&&obj.jquery?obj[0]:obj};fluid.container=function(containerSpec,fallible,userJQuery){if(!containerSpec){fluid.fail("fluid.container argument is empty")}var selector=containerSpec.selector||containerSpec;if(userJQuery){containerSpec=fluid.unwrap(containerSpec)}var container=fluid.wrap(containerSpec,userJQuery);if(fallible&&(!container||container.length===0)){return null}if(!container||!container.jquery||container.length!==1){if(typeof containerSpec!=="string"){containerSpec=container.selector}var count=container.length!==undefined?container.length:0;var extraMessage=container.selectorName?" with selector name "+container.selectorName+" in context "+fluid.dumpEl(containerSpec.context):"";fluid.fail((count>1?"More than one ("+count+") container elements were":"No container element was")+" found for selector "+containerSpec+extraMessage)}if(!fluid.isDOMNode(container[0])){fluid.fail("fluid.container was supplied a non-jQueryable element")}container.selector=selector;container.context=container.context||containerSpec.ownerDocument||document;return container};fluid.createDomBinder=function(container,selectors){var userJQuery=container.constructor;var that={container:container,id:fluid.allocateGuid(),doQuery:function(selector){return userJQuery(selector,that.container)},cache:{}};that.locate=function(selectorName){var selector=selectorName==="container"?"":selectors[selectorName];if(selector===undefined){fluid.fail("DOM binder request for selector "+selectorName+" which is not registered")}var togo;if(selector===""){togo=that.container}else{togo=that.doQuery(selector,selectorName)}togo.selector=selector;togo.context=that.container;togo.selectorName=selectorName;that.cache[selectorName]=togo;return togo};that.fastLocate=function(selectorName){return that.cache[selectorName]||that.locate(selectorName)};that.resetContainer=function(container){that.container=container;that.clear()};that.clear=function(){that.cache={}};that.resolvePathSegment=that.locate;return that};fluid.createLocalContainerDomBinder=function(container,selectors){var that={container:container,id:fluid.allocateGuid(),cache:{}};var userJQuery=container.constructor;function cacheKey(name,thisContainer){return fluid.allocateSimpleId(thisContainer)+"-"+name}function record(name,thisContainer,result){that.cache[cacheKey(name,thisContainer)]=result}that.locate=function(name,localContainer){var selector,thisContainer,togo;selector=selectors[name];if(selector===undefined){if(name==="container"){selector=""}else{fluid.fail("DOM binder request for selector "+name+" which is not registered")}}thisContainer=localContainer||that.container;if(!thisContainer){fluid.fail("DOM binder invoked for selector "+name+" without container")}if(selector===""){togo=userJQuery(thisContainer)}else{if(typeof selector==="function"){togo=userJQuery(selector.call(null,fluid.unwrap(thisContainer)))}else{togo=userJQuery(selector,thisContainer)}}if(!togo.selector){togo.selector=selector;togo.context=thisContainer}togo.selectorName=name;record(name,thisContainer,togo);return togo};that.fastLocate=function(name,localContainer){var thisContainer=localContainer?localContainer:that.container;var key=cacheKey(name,thisContainer);var togo=that.cache[key];return togo?togo:that.locate(name,localContainer)};that.resetContainer=function(container){that.container=container;that.clear()};that.clear=function(){that.cache={}};that.refresh=function(names,localContainer){var thisContainer=localContainer?localContainer:that.container;if(typeof names==="string"){names=[names]}if(thisContainer.length===undefined){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;return that};fluid.expectFilledSelector=function(result,message){if(result&&result.length===0&&result.jquery){fluid.fail(message+': selector "'+result.selector+'" with name '+result.selectorName+" returned no results in context "+fluid.dumpEl(result.context))}};fluid.containerForViewComponent=function(that,containerSpec){var container=fluid.container(containerSpec);fluid.expectFilledSelector(container,'Error instantiating viewComponent at path "'+fluid.pathForComponent(that));return container};fluid.getId=function(element){return fluid.unwrap(element).id};fluid.allocateSimpleId=function(element){element=fluid.unwrap(element);if(!element||fluid.isPrimitive(element)){return null}if(!element.id){var simpleId="fluid-id-"+fluid.allocateGuid();element.id=simpleId}return element.id};fluid.registerNamespace("fluid.materialisers");fluid.makeDomMaterialiserManager=function(){var that={idToModelListeners:{}};return that};fluid.checkMaterialisedElement=function(element,selectorName,that){if(!element||!element.length){fluid.fail("Could not locate element for selector "+selectorName+" for component "+fluid.dumpComponentAndPath(that))}};fluid.domMaterialiserManager=fluid.makeDomMaterialiserManager();fluid.materialisers.domOutput=function(that,segs,type,options){fluid.freezeRecursive(segs);var selectorName=segs[1];var listener=function(value){if(that.dom){var element=that.dom.locate(selectorName);fluid.checkMaterialisedElement(element,selectorName,that);if(type==="jQuery"){var model={value:value,segs:segs};var args=options.makeArgs?options.makeArgs(model):[model.value];element[options.method].apply(element,args)}else if(type==="booleanAttr"){if(value===undefined){var markupValue=!!element.attr(options.attr);that.applier.change(segs,options.negate?!markupValue:markupValue)}else{var attrValue=options.negate?!value:value;if(attrValue){element.attr(options.attr,options.attr)}else{element.removeAttr(options.attr)}}}}};that.applier.modelChanged.addListener({segs:segs},listener);that.events.onDomBind.addListener((function(){var modelValue=fluid.getImmediate(that.model,segs);listener(modelValue)}))};fluid.incrementModel=function(that,segs){var oldValue=fluid.getImmediate(that.model,segs)||0;that.applier.change(segs,oldValue+1)};fluid.materialisers.domClick=function(that,segs){var listener=function(){fluid.incrementModel(that,segs)};that.events.onDomBind.addListener((function(){that.dom.locate(segs[1]).click(listener)}))};fluid.materialisers.hover=function(that,segs){var makeListener=function(state){return function(){that.applier.change(segs,state)}};that.events.onDomBind.addListener((function(){that.dom.locate(segs[1]).hover(makeListener(true),makeListener(false))}))};fluid.materialisers.focusin=function(that,segs){var makeListener=function(state){return function(){that.applier.change(segs,state)}};that.events.onDomBind.addListener((function(){that.dom.locate(segs[1]).focusin(makeListener(true)).focusout(makeListener(false))}))};fluid.materialisers.id=function(that,segs){that.events.onDomBind.addListener((function(){var element=that.dom.locate(segs[1])[0];var modelValue=fluid.getImmediate(that.model,segs);if(modelValue===undefined){var id=fluid.allocateSimpleId(element);that.applier.change(segs,id,"ADD","DOM")}else{element.id=modelValue}var modelListener=function(value){if(value!==undefined){element.id=value}};that.applier.modelChanged.addListener({segs:segs},modelListener)}))};fluid.materialisers.domValue=function(that,segs){that.events.onDomBind.addListener((function(){var element=that.dom.locate(segs[1]);var domListener=function(){var val=fluid.value(element);that.applier.change(segs,val,"ADD","DOM")};var modelListener=function(value){if(value!==undefined){fluid.value(element,value)}};that.applier.modelChanged.addListener({segs:segs},modelListener);var options=fluid.getImmediate(that,["options","bindingOptions",fluid.model.composeSegments.apply(null,segs)]);var changeEvent=options&&options.changeEvent||"change";element.on(changeEvent,domListener);modelListener(fluid.getImmediate(that.model,segs))}))};fluid.materialisers.style=function(that,segs){var selectorName=segs[1];that.events.onDomBind.addListener((function(){var element=that.dom.locate(selectorName);fluid.checkMaterialisedElement(element,selectorName,that);var modelValue=fluid.getImmediate(that.model,segs);element[0].style[segs[3]]=modelValue}))};fluid.registerNamespace("fluid.materialiserRegistry");fluid.materialiserRegistry["fluid.viewComponent"]={dom:{"*":{text:{materialiser:"fluid.materialisers.domOutput",args:["jQuery",{method:"text"}]},attr:{materialiser:"fluid.materialisers.domOutput",args:["jQuery",{method:"attr",makeArgs:function(model){return[model.segs[3],model.value]}}]},visible:{materialiser:"fluid.materialisers.domOutput",args:["jQuery",{method:"toggle"}]},enabled:{materialiser:"fluid.materialisers.domOutput",args:["booleanAttr",{attr:"disabled",negate:true}]},click:{materialiser:"fluid.materialisers.domClick"},hover:{materialiser:"fluid.materialisers.hover"},focusin:{materialiser:"fluid.materialisers.focusin"},value:{materialiser:"fluid.materialisers.domValue"},class:{materialiser:"fluid.materialisers.domOutput",args:["jQuery",{method:"toggleClass",makeArgs:function(model){return[model.segs[3],!!model.value]}}]},style:{materialiser:"fluid.materialisers.style"},id:{materialiser:"fluid.materialisers.id"}}}};fluid.value=function(nodeIn,newValue){var node=fluid.unwrap(nodeIn);var isMultiple=false;if(node.nodeType===undefined&&node.length>1){node=node[0];isMultiple=true}if("input"!==node.nodeName.toLowerCase()||!/radio|checkbox/.test(node.type)){return newValue===undefined?$(node).val():$(node).val(newValue)}var name=node.name;var elements;if(isMultiple||name===""){elements=nodeIn}else{elements=node.ownerDocument.getElementsByName(name);var scope=fluid.findForm(node);elements=$.grep(elements,(function(element){if(element.name!==name){return false}return!scope||scope.contains(element)}));isMultiple=elements.length>1}if(newValue!==undefined){if(typeof newValue==="boolean"){newValue=newValue?"true":"false"}$.each(elements,(function(){this.checked=newValue instanceof Array?newValue.indexOf(this.value)!==-1:newValue===this.value}))}else{var checked=$.map(elements,(function(element){return element.checked?element.value:null}));return node.type==="radio"?checked[0]:isMultiple?checked:!!checked[0]}};fluid.defaults("fluid.ariaLabeller",{gradeNames:"fluid.viewComponent"});"use strict";fluid.changeElementValue=function(node,value){node=$(node);fluid.value(node,value);node.change()};fluid.findAncestor=function(element,test){element=fluid.unwrap(element);while(element){if(test(element)){return element}element=element.parentNode}};fluid.findForm=function(node){return fluid.findAncestor(node,(function(element){return element.nodeName.toLowerCase()==="form"}))};fluid.each(["text","html"],(function(method){fluid[method]=function(node,newValue){node=$(node);return newValue===undefined?node[method]():node[method](newValue)}}));fluid.BINDING_ROOT_KEY="fluid-binding-root";fluid.findData=function(elem,name){while(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){node=fluid.unwrap(node);var key=node.name||node.id;var record=fossils[key];return record?record.EL:null};fluid.applyBoundChange=function(node,newValue,applier){node=fluid.unwrap(node);if(newValue===undefined){newValue=fluid.value(node)}if(node.nodeType===undefined&&node.length>0){node=node[0]}var root=fluid.findData(node,fluid.BINDING_ROOT_KEY);if(!root){fluid.fail("Bound data could not be discovered in any node above "+fluid.dumpEl(node))}var name=node.name;var fossil=root.fossils[name];if(!fossil){fluid.fail("No fossil discovered for name "+name+" in fossil record above "+fluid.dumpEl(node))}var EL=root.fossils[name].EL;if(applier){applier.fireChangeRequest({path:EL,value:newValue,source:"DOM:"+node.id})}else{fluid.set(root.data,EL,newValue)}};fluid.jById=function(id,dokkument){dokkument=dokkument&&dokkument.nodeType===9?dokkument:document;var element=fluid.byId(id,dokkument);var togo=element?$(element):[];togo.selector="#"+id;togo.context=dokkument;return togo};fluid.byId=function(id,dokkument){dokkument=dokkument&&dokkument.nodeType===9?dokkument:document;var el=dokkument.getElementById(id);if(el){if(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")}return el}else{return null}};fluid.getDocument=function(element){var node=fluid.unwrap(element);return node.nodeType===9?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){newOptions=newOptions||that.options;that.container.attr(that.options.labelAttribute,newOptions.text);if(newOptions.dynamicLabel){var live=fluid.jById(that.options.liveRegionId);if(live.length===0){live=that.generateLiveElement()}live.text(newOptions.text)}};fluid.ariaLabeller.generateLiveElement=function(that){var liveEl=$(that.options.liveRegionMarkup);liveEl.prop("id",that.options.liveRegionId);$("body").append(liveEl);return liveEl};var LABEL_KEY="aria-labelling";fluid.getAriaLabeller=function(element){element=$(element);var that=fluid.getScopedData(element,LABEL_KEY);return that};fluid.updateAriaLabel=function(element,text,options){options=$.extend({},options||{},{text:text});var that=fluid.getAriaLabeller(element);if(!that){that=fluid.ariaLabeller(element,options);fluid.setScopedData(element,LABEL_KEY,that)}else{that.update(options)}return that};fluid.dismissList={};$(document).click((function(event){var target=fluid.resolveEventTarget(event);while(target){if(fluid.dismissList[target.id]){return}target=target.parentNode}fluid.each(fluid.dismissList,(function(dismissFunc,key){dismissFunc(event);delete fluid.dismissList[key]}))}));fluid.globalDismissal=function(nodes,dismissFunc){fluid.each(nodes,(function(node){var id=fluid.unwrap(node).ownerDocument===document?fluid.allocateSimpleId(node):fluid.allocateGuid();if(dismissFunc){fluid.dismissList[id]=dismissFunc}else{delete fluid.dismissList[id]}}))};fluid.deadMansBlur=function(control,options){var that={options:$.extend(true,{},fluid.defaults("fluid.deadMansBlur"),options)};that.blurPending=false;that.lastCancel=0;that.canceller=function(event){fluid.log("Cancellation through "+event.type+" on "+fluid.dumpEl(event.target));that.lastCancel=Date.now();that.blurPending=false};that.noteProceeded=function(){fluid.globalDismissal(that.options.exclusions)};that.reArm=function(){fluid.globalDismissal(that.options.exclusions,that.proceed)};that.addExclusion=function(exclusions){fluid.globalDismissal(exclusions,that.proceed)};that.proceed=function(event){fluid.log("Direct proceed through "+event.type+" on "+fluid.dumpEl(event.target));that.blurPending=false;that.options.handler(control)};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)}))}));if(!that.options.cancelByDefault){$(control).on("focusout",(function(event){fluid.log("Starting blur timer for element "+fluid.dumpEl(event.target));var now=Date.now();fluid.log("back delay: "+(now-that.lastCancel));if(now-that.lastCancel>that.options.backDelay){that.blurPending=true}setTimeout((function(){if(that.blurPending){that.options.handler(control)}}),that.options.delay)}))}else{that.reArm()}return that};fluid.defaults("fluid.deadMansBlur",{gradeNames:"fluid.function",delay:150,backDelay:100});"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);if(resolved===undefined){return fluid.find(that.options.parents,(function(parent){return parent?parent.lookup(messagecodes):undefined}))}else{return{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){if(messageBase instanceof fluid.fetchResources.FetchOne){messageBase=fluid.fetchResources.resolveFetchOne(messageBase)}for(var i=0;i<messagecodes.length;++i){var code=messagecodes[i];var message=messageBase[code];if(message instanceof fluid.fetchResources.FetchOne){message=fluid.fetchResources.resolveFetchOne(message)}if(message!==undefined){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(messageSource.type==="data"){if(messageSource.url===undefined){return fluid.messageLocator(messageSource.messages,messageSource.resolveFunc)}else{}}else if(messageSource.type==="resolver"){return messageSource.resolver.resolve}};"use strict";fluid.explodeLocalisedName=function(fileName,locale,defaultLocale){var lastDot=fileName.lastIndexOf(".");if(lastDot===-1||lastDot===0){lastDot=fileName.length}var baseName=fileName.substring(0,lastDot);var extension=fileName.substring(lastDot);var segs=locale?locale.split("_"):[];var exploded=fluid.transform(segs,(function(seg,index){var shortSegs=segs.slice(0,index+1);return baseName+"_"+shortSegs.join("_")+extension}));if(defaultLocale){exploded.unshift(baseName+"_"+defaultLocale+extension)}exploded.unshift(fileName);return exploded};fluid.fetchResources=function(resourceSpecs,callback,options){var that=fluid.makeResourceFetcher(resourceSpecs,callback,options,fluid.identity);that.optionsReady.resolve();that.fetchAll();return that};fluid.fetchResources.explodeForLocales=function(resourceFetcher){fluid.each(resourceFetcher.resourceSpecs,(function(resourceSpec){resourceSpec.resolvedDefaultLocale=resourceSpec.defaultLocale||resourceFetcher.options.defaultLocale;resourceSpec.resolvedLocale=resourceFetcher.options.locale||resourceSpec.locale||resourceSpec.resolvedDefaultLocale;if(!resourceSpec.loader.loader.noPath){var pathKey=resourceSpec.loader.pathKey;var path=resourceSpec[pathKey];var resolvedPath=resourceSpec[pathKey]=resourceFetcher.transformResourceURL(path);resourceSpec.localeExploded=fluid.explodeLocalisedName(resolvedPath,resourceSpec.resolvedLocale,resourceSpec.resolvedDefaultLocale);resourceSpec.localeExplodedSpecs=fluid.transform(resourceSpec.localeExploded,(function(oneExploded){var togo={loader:resourceSpec.loader,options:resourceSpec.options};togo[pathKey]=oneExploded;return togo}),fluid.fetchResources.prepareRequestOptions)}}))};fluid.fetchResources.launchExplodedLocales=function(localeExplodedSpecs,loader){var promiseArray=fluid.transform(localeExplodedSpecs,loader,(function(promise){var promiseToGo=fluid.promise();promise.then((function(resolve){promiseToGo.resolve({resolved:resolve})}),(function(error){promiseToGo.resolve({rejected:error})}));return promiseToGo}));var settledArrayPromise=fluid.promise.sequence(promiseArray);return settledArrayPromise};fluid.fetchResources.condenseExplodedLocales=function(resourceSpec,settledArray){var togo=fluid.promise();settledArray.reverse();var lastNonError=fluid.find(settledArray,(function(settled){return settled.resolved}));if(lastNonError){togo.resolve(lastNonError)}else{togo.reject({isError:true,message:"No localised variants of the resource could be found at any of the paths "+resourceSpec.localeExploded.join(", ")})}return togo};fluid.fetchResources.resolveLoaderTask=function(resourceSpec,loader){if(resourceSpec.localeExplodedSpecs){return function(){var togo=fluid.promise();var settledArrayPromise=fluid.fetchResources.launchExplodedLocales(resourceSpec.localeExplodedSpecs,loader);settledArrayPromise.then((function(settledArray){var condensed=fluid.fetchResources.condenseExplodedLocales(resourceSpec,settledArray);fluid.promise.follow(condensed,togo)}));return togo}}else{return function(){return loader(resourceSpec)}}};fluid.fetchResources.checkCompletion=function(resourceSpecs,resourceFetcher){var incomplete=fluid.find_if(resourceSpecs,(function(resourceSpec){return!resourceSpec.promise.disposition}));if(!incomplete){var completionPromise=resourceFetcher.completionPromise;fluid.invokeLater((function(){if(!completionPromise.disposition){completionPromise.resolve(resourceSpecs)}}))}};fluid.fetchResources.noteResourceText=function(resourceText,options){options.resourceSpec.resourceText=resourceText;return resourceText};fluid.fetchResources.noteParsed=function(parsed,options){options.resourceSpec.parsed=parsed;return parsed};fluid.fetchResources.fireFetched=function(parsed,options){options.resourceSpec.onFetched.fire(parsed);return parsed};fluid.fetchResources.prepareRequestOptions=function(resourceSpec){var pathKey=resourceSpec.loader.pathKey;var requestOptions={};requestOptions[pathKey]=resourceSpec[pathKey];resourceSpec.options=$.extend(true,{},resourceSpec.options,requestOptions);return resourceSpec};fluid.fetchResources.initOneResource=function(resourceSpec){resourceSpec.promise=fluid.promise();resourceSpec.launched=false};fluid.fetchResources.subscribeOneResource=function(resourceSpec,key,ownerComponentId){if(resourceSpec.transformEvent){fluid.fail("Cannot subscribe resource ",resourceSpec," which has already been subscribed for I/O")}resourceSpec.key=key;resourceSpec.transformEvent=fluid.makeEventFirer({name:'Transform chain for resource "'+key+'"',ownerId:ownerComponentId});resourceSpec.transformEvent.addListener(fluid.fetchResources.noteParsed,"noteParsed","last");var parser=fluid.resourceLoader.resolveResourceParser(resourceSpec);resourceSpec.transformEvent.addListener(parser,"parser","before:noteParsed");resourceSpec.transformEvent.addListener((function(parsed){return fluid.resourceLoader.renderImmutable(parsed,resourceSpec)}),"renderImmutable","after:parser");resourceSpec.transformEvent.addListener(fluid.fetchResources.noteResourceText,"resourceText","before:parser");resourceSpec.transformEvent.addListener(fluid.fetchResources.resolveLoaderTask(resourceSpec,resourceSpec.loader.loader),"loader","before:resourceText");resourceSpec.onFetched=fluid.makeEventFirer({name:'onFetched event for resources "'+key+'"',ownerId:ownerComponentId});resourceSpec.onError=fluid.makeEventFirer({name:'onError event for resources "'+key+'"',ownerId:ownerComponentId});resourceSpec.transformEvent.addListener(fluid.fetchResources.fireFetched,"fireFetched","last");fluid.fetchResources.prepareRequestOptions(resourceSpec);fluid.fetchResources.initOneResource(resourceSpec)};fluid.fetchResources.FetchOne=function(resourceSpec,resourceFetcher,segs){var FetchOne=this;FetchOne.resourceFetcher=resourceFetcher;FetchOne.resourceSpec=resourceSpec;FetchOne.segs=segs||[];var thisPromise=FetchOne.promise=fluid.promise();fluid.fetchResources.fetchOneResource(resourceSpec,resourceFetcher).then((function(){thisPromise.resolve(fluid.fetchResources.resolveFetchOne(FetchOne))}))};fluid.fetchResources.resolveFetchOne=function(FetchOne){return fluid.getImmediate(FetchOne.resourceSpec,FetchOne.segs)};fluid.fetchResources.FetchOne.prototype.resolvePathSegment=function(seg){return new fluid.fetchResources.FetchOne(this.resourceSpec,this.resourceFetcher,this.segs.concat(fluid.makeArray(seg)))};fluid.initResourceFetcher=function(resourceFetcher){resourceFetcher.completionPromise=fluid.promise();fluid.fetchResources.explodeForLocales(resourceFetcher);resourceFetcher.onInit.fire(resourceFetcher.completionPromise)};fluid.resourceFetcher=function(){};fluid.makeResourceFetcher=function(sourceResourceSpecs,callback,options,transformResourceURL){options=options||{};var that=Object.create(fluid.resourceFetcher.prototype);fluid.extend(that,{sourceResourceSpecs:sourceResourceSpecs,options:fluid.copy(options),optionsReady:fluid.promise(),onInit:fluid.makeEventFirer({name:"onInit for resourceFetcher",ownerId:options.ownerComponentId}),transformResourceURL:transformResourceURL});that.fetchAll=function(){return fluid.fetchResources.fetchAll(that)};that.refetchAll=function(){return fluid.fetchResources.refetchAll(that)};that.fetchOneResource=function(key){return fluid.fetchResources.fetchOneResource(that.resourceSpecs[key],that)};that.refetchOneResource=function(key){return fluid.fetchResources.refetchOneResource(that.resourceSpecs[key],that)};that.resourceSpecs=fluid.copy(that.sourceResourceSpecs);that.onInit.addListener((function(completionPromise){completionPromise.then(callback,callback)}));fluid.each(options.onInitListeners,(function(args){that.onInit.addListener.apply(null,args)}));fluid.each(that.resourceSpecs,(function(resourceSpec){resourceSpec.dataType=resourceSpec.dataType||that.options.dataType;resourceSpec.loader=fluid.resourceLoader.resolveResourceLoader(resourceSpec)}));fluid.initResourceFetcher(that);fluid.each(that.resourceSpecs,(function(resourceSpec,key){fluid.fetchResources.subscribeOneResource(resourceSpec,key,that.options.ownerComponentId)}));return that};fluid.fetchResources.fetchAll=function(resourceFetcher){fluid.each(resourceFetcher.resourceSpecs,(function(resourceSpec){fluid.fetchResources.fetchOneResource(resourceSpec,resourceFetcher)}));fluid.fetchResources.checkCompletion(resourceFetcher.resourceSpecs,resourceFetcher);return resourceFetcher.completionPromise};fluid.fetchResources.mutableResourceSpecFields=["promise","resourceText","parsed","locale","defaultLocale"];fluid.fetchResources.refetchOneResource=function(resourceSpec,resourceFetcher,defeatInitiate){resourceSpec.promise.cancel();fluid.fetchResources.mutableResourceSpecFields.forEach((function(field){delete resourceSpec[field]}));fluid.fetchResources.initOneResource(resourceSpec);if(!defeatInitiate){fluid.fetchResources.initiateRefetch(resourceFetcher)}return resourceSpec.promise};fluid.fetchResources.initiateRefetch=function(resourceFetcher){resourceFetcher.completionPromise.cancel();delete resourceFetcher.completionPromise;fluid.initResourceFetcher(resourceFetcher,true);fluid.fetchResources.fetchAll(resourceFetcher);resourceFetcher.fetchAll()};fluid.fetchResources.refetchAll=function(resourceFetcher){var anyLaunched=false;fluid.each(resourceFetcher.resourceSpecs,(function(resourceSpec){if(resourceSpec.resolvedLocale){anyLaunched=true;fluid.fetchResources.refetchOneResource(resourceSpec,resourceFetcher,true)}}));if(anyLaunched){fluid.fetchResources.initiateRefetch(resourceFetcher)}return resourceFetcher.completionPromise};fluid.fetchResources.fireTransformEvent=function(resourceSpec,resourceFetcher){return fluid.promise.fireTransformEvent(resourceSpec.transformEvent,null,{resourceSpec:resourceSpec,resourceFetcher:resourceFetcher})};fluid.fetchResources.fetchOneResource=function(resourceSpec,resourceFetcher){if(!resourceSpec.launched){resourceSpec.launched=true;resourceFetcher.optionsReady.then((function(){var transformPromise=fluid.fetchResources.fireTransformEvent(resourceSpec,resourceFetcher);fluid.promise.follow(transformPromise,resourceSpec.promise);resourceSpec.promise.then((function(){fluid.fetchResources.checkCompletion(resourceFetcher.resourceSpecs,resourceFetcher)}),(function(error){resourceSpec.fetchError=error;resourceSpec.onError.fire(error);resourceFetcher.completionPromise.reject(error)}))}))}return resourceSpec.promise};fluid.registerNamespace("fluid.resourceLoader.loaders");fluid.resourceLoader.modelUpdated=function(resourceFetcher,modelOptions,early){resourceFetcher.options=$.extend(true,{},resourceFetcher.options,modelOptions);if(early){fluid.fetchResources.explodeForLocales(resourceFetcher);resourceFetcher.optionsReady.resolve()}else{resourceFetcher.refetchAll()}};fluid.resourceLoader.sanitizeResourceSpec=function(resourceSpec){return fluid.transform(resourceSpec,(function(value){return fluid.isPrimitive(value)||fluid.isPlainObject(value)&&!fluid.isPromise(value)?value:fluid.NO_VALUE}))};fluid.ImmutableArray=function(){};fluid.ImmutableArray.prototype=[];fluid.ImmutableObject=function(){};fluid.copyImmutableResource=function(tocopy){var newContainer=fluid.isArrayable(tocopy)?new fluid.ImmutableArray:new fluid.ImmutableObject;fluid.each(tocopy,(function(value,key){newContainer[key]=value}));return newContainer};fluid.resourceLoader.renderImmutable=function(parsed,resourceSpec){if(resourceSpec.immutableModelResource){return fluid.copyImmutableResource(parsed)}else{return parsed}};fluid.resourceLoader.resolveResourceLoader=function(resourceSpec){var loaders=[];fluid.each(fluid.resourceLoader.loaders,(function(loader,key){if(fluid.isValue(resourceSpec[key])){loaders.push({loader:loader,pathKey:key})}}));if(loaders.length===0){loaders.push({loader:fluid.resourceLoader.loaders.noLoader})}else if(loaders.length>1){fluid.fail("Resource spec ",fluid.resourceLoader.sanitizeResourceSpec(resourceSpec)," is ambiguous because it has fields for multiple resource loaders filled out: at most one of the fields ",fluid.getMembers(loaders,"pathKey")," can be used")}return loaders[0]};fluid.resourceLoader.loaders.resourceText=function(resourceSpec){return resourceSpec.resourceText};fluid.resourceLoader.loaders.resourceText.noPath=true;fluid.resourceLoader.loaders.promiseFunc=function(resourceSpec){var promiseFunc=fluid.event.resolveListener(resourceSpec.promiseFunc);return promiseFunc.apply(null,fluid.makeArray(resourceSpec.promiseArgs))};fluid.resourceLoader.loaders.promiseFunc.noPath=true;fluid.resourceLoader.loaders.dataSource=function(resourceSpec){fluid.getForComponent(resourceSpec.dataSource,"get");return resourceSpec.dataSource.get(resourceSpec.directModel,resourceSpec.options)};fluid.resourceLoader.loaders.dataSource.noPath=true;fluid.resourceLoader.loaders.dataSource.parsed=true;fluid.resourceLoader.loaders.noLoader=function(resourceSpec){return fluid.promise().resolve({noResource:true,message:["No resource was configured for resource spec ",fluid.resourceLoader.sanitizeResourceSpec(resourceSpec),"; since it had none of the fields fields ",Object.keys(fluid.resourceLoader.loaders)+" filled out"]})};fluid.resourceLoader.loaders.noLoader.noPath=true;fluid.resourceLoader.loaders.noLoader.parsed=true;fluid.registerNamespace("fluid.resourceLoader.parsers");fluid.resourceLoader.resolveResourceParser=function(resourceSpec){return!resourceSpec.loader.loader.parsed&&fluid.resourceLoader.parsers[resourceSpec.dataType]||fluid.identity};fluid.resourceLoader.parsers.json=function(resourceText){return fluid.dataSource.parseJSON(resourceText)};fluid.resourcesMergePolicy=function(target,source){target=target||{};fluid.each(source,(function(oneResource,name){if(!oneResource){target[name]=oneResource;return}else if(fluid.isPrimitive(oneResource)){oneResource={url:oneResource}}var oneR=target[name];if(!oneR){oneR=target[name]={}}for(var key in fluid.resourceLoader.loaders){if(key in oneResource){for(var key2 in fluid.resourceLoader.loaders){delete oneR[key2]}}}$.extend(oneR,oneResource)}));return target};fluid.defaults("fluid.resourceLoader",{gradeNames:["fluid.modelComponent"],listeners:{"onCreate.loadResources":"{that}.resourceFetcher.fetchAll","onDestroy.destroyResourceEvents":"fluid.resourceLoader.destroyResourceEvents({that}.resourceFetcher)","{that}.resourceFetcher.onInit":{namespace:"resourceLoaderCompletion",funcName:"fluid.resourceLoader.subscribeCompletion",args:["{arguments}.0","{that}"]},"{that}.applier.earlyModelResolved":{funcName:"fluid.resourceLoader.modelUpdated",args:["{that}.resourceFetcher","{arguments}.0.resourceLoader",true]}},modelListeners:{resourceLoader:{namespace:"resourceLoader",funcName:"fluid.resourceLoader.modelUpdated",excludeSource:"init",args:["{that}.resourceFetcher","{change}.value"]}},mergePolicy:{resources:fluid.resourcesMergePolicy},members:{resourceFetcher:{expander:{funcName:"fluid.resourceLoader.makeResourceFetcher",args:["{that}","{that}.options.resources","{that}.options.resourceOptions","{that}.transformResourceURL"]}}},resourceOptions:{terms:{}},resources:{},invokers:{transformResourceURL:{funcName:"fluid.stringTemplate",args:["{arguments}.0","{that}.options.resourceOptions.terms"]}},events:{onResourcesLoaded:null,onResourceError:null}});fluid.resourceLoader.makeResourceFetcher=function(that,resourceSpecs,userResourceOptions,transformResourceURL){var resourceOptions=$.extend({ownerComponentId:that.id,ownerComponentPath:fluid.pathForComponent(that),onInitListeners:[[function(completionPromise){fluid.resourceLoader.subscribeCompletion(completionPromise,that)},"resourceLoaderCompletion"]]},userResourceOptions);var fetcher=fluid.makeResourceFetcher(resourceSpecs,null,resourceOptions,transformResourceURL);fluid.each(fetcher.resourceSpecs,(function(resourceSpec,key){resourceSpec.transformEvent.addListener((function(parsed){that.resources[key]=resourceSpec;return parsed}),"noteComponentResource","after:parsed");resourceSpec.onError.addListener(that.events.onResourceError.fire)}));return fetcher};fluid.resourceLoader.subscribeCompletion=function(completionPromise,resourceLoader){var fire=function(){resourceLoader.events.onResourcesLoaded.fire(resourceLoader.resourceFetcher.resourceSpecs)};completionPromise.then((function(){if(resourceLoader.lifecycleStatus==="constructed"||resourceLoader.lifecycleStatus==="treeConstructed"){fire()}else if(resourceLoader.lifecycleStatus!=="destroyed"){resourceLoader.events.onCreate.addListener(fire,"fireOnResourcesLoaded")}}),(function(error){fluid.log("Failure loading resources for component at path "+fluid.dumpComponentPath(resourceLoader)+": ",error)}))};fluid.resourceLoader.destroyResourceEvents=function(resourceFetcher){fluid.each(resourceFetcher.resourceSpecs,(function(resourceSpec){resourceSpec.transformEvent.destroy();resourceSpec.onFetched.destroy()}))};"use strict";fluid.resourceLoader.UrlClass=URL;fluid.resourceLoader.configureXHR=function(xhr,options){fluid.resourceLoader.loaders.XHR.copyProps.forEach((function(prop){if(fluid.isValue(options[prop])){xhr[prop]=options[prop]}}));fluid.each(options.headers,(function(value,key){var values=fluid.makeArray(value);values.forEach((function(oneValue){xhr.setRequestHeader(key,oneValue)}))}))};fluid.resourceLoader.loaders.XHR=function(resourceSpec){var togo=fluid.promise();var xhr=resourceSpec.xhr=new XMLHttpRequest;togo.then(null,null,(function(){xhr.abort()}));var sendSuccess=function(){fluid.invokeLater((function(){var response=!xhr.responseType||xhr.responseType==="text"?xhr.responseText:xhr.response;togo.resolve(response)}))};var sendError=function(){fluid.invokeLater((function(){togo.reject({isError:true,status:xhr.status,textStatus:xhr.statusText})}))};xhr.addEventListener("load",(function(){var isError=fluid.dataSource.URL.isErrorStatus(xhr.status);isError?sendError():sendSuccess()}));xhr.addEventListener("error",sendError);var options=$.extend({async:true},resourceSpec.options);xhr.open(options.method||"GET",resourceSpec.url,options.async,options.username,options.password);fluid.resourceLoader.configureXHR(xhr,options);xhr.send();return togo};fluid.resourceLoader.loaders.XHR.copyProps=["contentType","responseType","timeout"];fluid.resourceLoader.loaders.url=fluid.resourceLoader.loaders.XHR;fluid.dataSource.URL.handleHttp=function(that,baseOptions,data){var promise=fluid.promise();var defaultOptions={method:"GET",async:true};if(baseOptions.operation==="set"){defaultOptions.headers={"Content-Type":that.encoding.options.contentType};defaultOptions.method=baseOptions.writeMethod}var requestOptions=fluid.extend(true,defaultOptions,baseOptions);var whileMsg=" while executing HTTP "+requestOptions.method+" on url "+requestOptions.url;promise.accumulateRejectionReason=function(originError){return fluid.upgradeError(originError,whileMsg)};var xhr=promise.xhr=new XMLHttpRequest;var sendError=function(){var relayed=fluid.dataSource.URL.relayError(xhr.status,xhr.statusText,whileMsg);if(requestOptions.notFoundIsEmpty&&relayed.statusCode===404){promise.resolve(undefined)}else{promise.reject(relayed)}};xhr.addEventListener("load",(function(){if(fluid.dataSource.URL.isErrorStatus(xhr.status)){sendError()}else{var response=!xhr.responseType||xhr.responseType==="text"?xhr.responseText:xhr.response;promise.resolve(response)}}));xhr.addEventListener("error",sendError);var url=fluid.dataSource.URL.condenseUrl(requestOptions);requestOptions.url=url;fluid.log("DataSource Issuing "+requestOptions.protocol.toUpperCase().slice(0,-1)+" request with options ",requestOptions);xhr.open(requestOptions.method||"GET",url.toString(),requestOptions.async);fluid.resourceLoader.configureXHR(xhr,requestOptions);xhr.send(data);return promise};"use strict";fluid.defaults("fluid.newViewComponent",{gradeNames:"fluid.viewComponent",listeners:{"onCreate.onDomBind":null}});fluid.defaults("fluid.containerRenderingView",{gradeNames:["fluid.newViewComponent"],members:{container:"@expand:{that}.renderContainer()"},parentContainer:"{that}.options.container",injectionType:"append",invokers:{renderMarkup:"fluid.identity({that}.options.markup.container)",renderContainer:"fluid.containerRenderingView.renderContainer({that}, {that}.renderMarkup, {that}.addToParent)",addToParent:{funcName:"fluid.containerRenderingView.addToParent",args:["{that}.options.parentContainer","{arguments}.0","{that}.options.injectionType"]}},workflows:{global:{evaluateContainers:{funcName:"fluid.renderer.evaluateContainers",priority:"last",waitIO:true}}},listeners:{"onDestroy.clearInjectedMarkup":{this:"{that}.container",method:"remove",args:[]}}});fluid.registerNamespace("fluid.renderer");fluid.defaults("fluid.templateResourceFetcher",{gradeNames:"fluid.resourceLoader",rendererTemplateResources:{template:true},skipTemplateFetch:false,workflows:{global:{fetchTemplates:{funcName:"fluid.renderer.fetchTemplates",priority:"after:resolveResourceModel"}}}});fluid.renderer.fetchTemplates=function(shadows){shadows.forEach((function(shadow){var that=shadow.that;if(fluid.componentHasGrade(that,"fluid.templateResourceFetcher")){var skipTemplateFetch=fluid.getForComponent(that,["options","skipTemplateFetch"]);if(!skipTemplateFetch){var rendererTemplateResources=fluid.getForComponent(that,["options","rendererTemplateResources"]);fluid.each(rendererTemplateResources,(function(value,key){if(value){fluid.getForComponent(that,["resources",key])}}))}}}))};fluid.containerRenderingView.addToParent=function(parentContainer,elm,method){if(!parentContainer){fluid.fail('fluid.containerRenderingView needs to have "parentContainer" or "container" option supplied')}method=method||"append";$(parentContainer)[method](elm)};fluid.renderer.evaluateContainers=function(shadows){shadows.forEach((function(shadow){fluid.getForComponent(shadow.that,"container")}));shadows.forEach((function(shadow){shadow.that.events.onDomBind.fire(shadow.that)}))};fluid.containerRenderingView.renderContainer=function(that,renderMarkup,addToParent){fluid.log("Rendering container for "+that.id);var containerMarkup=renderMarkup();var container=$(containerMarkup);addToParent(container);return container};fluid.defaults("fluid.templateRenderingView",{gradeNames:["fluid.containerRenderingView","fluid.templateResourceFetcher"],invokers:{renderMarkup:"fluid.identity({that}.resources.template.parsed)"},distributeOptions:{mapTemplateUrl:{source:"{that}.options.templateUrl",target:"{that}.options.resources.template.url"}}});"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:true,childList:true,subtree:true},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){var observer=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)}if(mutationRecord.type==="attributes"){that.events.onAttributeChanged.fire(mutationRecord.target,mutationRecord)}}))}));return observer};fluid.mutationObserver.observe=function(that,target,options){target=fluid.unwrap(target||that.container);that.observer.observe(target,options||that.options.defaultObserveConfig)};"use strict";fluid.defaults("fluid.textNodeParser",{gradeNames:["fluid.component"],events:{onParsedTextNode:null,afterParse:null},ignoredSelectors:{ariaHidden:'[aria-hidden="true"]'},parseHidden:false,invokers:{parse:{funcName:"fluid.textNodeParser.parse",args:["{that}","{arguments}.0","{arguments}.1","{that}.events.afterParse.fire"]},hasTextToRead:{funcName:"fluid.textNodeParser.hasTextToRead",args:["{arguments}.0","{that}.options.ignoredSelectors","{that}.options.parseHidden"]},getLang:"fluid.textNodeParser.getLang"}});fluid.textNodeParser.hasGlyph=function(str){return fluid.isValue(str)&&/\S/.test(str)};fluid.textNodeParser.hasTextToRead=function(elm,ignoredSelectors,parseHidden){if(elm&&(elm.tagName.toLowerCase()==="body"||parseHidden||elm.offsetParent)&&fluid.textNodeParser.hasGlyph(elm.innerText)){var selectors=Object.values(ignoredSelectors).filter((sel=>sel));return!selectors.find((selector=>elm.closest(selector)))}else{return false}};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;var 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 if(childNode.nodeType===Node.ELEMENT_NODE){parsed=parsed.concat(fluid.textNodeParser.parse(that,childNode,elementLang))}}))}if(afterParseEvent){afterParseEvent(that,parsed)}return parsed};
//# sourceMappingURL=infusion-framework.js.map