/*!@license
* Infragistics.Web.ClientUI templating localization resources 13.1.20131.2523
*
* Copyright (c) 2011-2014 Infragistics Inc.
*
* http://www.infragistics.com/
*
*/
(function($){$.ig=$.ig||{};if(!$.ig.Templating){$.ig.Templating={};$.extend($.ig.Templating,{locale:{undefinedArgument:"An error has occurred while trying to retrieve data source property: "}})}})(jQuery);/*!@license
 * Infragistics.Web.ClientUI Templating Engine 13.1.20131.2523
 *
 * Copyright (c) 2011-2014 Infragistics Inc.
 * 
 * Engine used for data templating
 *
 * http://www.infragistics.com/
 *
 * Depends on:
 *
 */
(function($){$.ig=$.ig||{};$.extend($.ig,{tmpl:function(template,data,args){var tmpl=template,cacheConst;tmpl=tmpl.replace(this.regExp.lineBreak,"");tmpl=tmpl.replace(this.regExp.comment,"");if(typeof data==="function"){if(args){data=data.apply(this,args)}else{data=data.call()}}if(this._internalTmplCache&&this._internalTmplCache.hasOwnProperty(tmpl)){this.tokens=this._internalTmplCache[tmpl].tokens;this.args=this._internalTmplCache[tmpl].args;this.i=this._internalTmplCache[tmpl].i;this._hasBlock=this._internalTmplCache[tmpl]._hasBlock;tmpl=this._internalTmplCache[tmpl].tmpl}else{this.tokens=[];this.args=[];this.i=0;this._tokenizeTemplate(tmpl);cacheConst=tmpl;this._internalTmplCache[cacheConst]={};this._internalTmplCache[cacheConst].tokens=this.tokens;if(this.regExp.block.test(tmpl)){this._hasBlock=true;tmpl=this._tokenizeDirectives(tmpl)}else{this._hasBlock=false}this._internalTmplCache[cacheConst].args=this.args;this._internalTmplCache[cacheConst].i=this.i;this._internalTmplCache[cacheConst]._hasBlock=this._hasBlock;this._internalTmplCache[cacheConst].tmpl=tmpl}if(!this.tokens){return tmpl}if(this._hasBlock){tmpl=this._compileTemplate(tmpl,data)}else{tmpl=this._populateTemplate(tmpl,data)}delete this.args;delete this.tokens;delete this._hasBlock;delete this.i;return tmpl},clearTmplCache:function(){delete this._internalTmplCache;this._internalTmplCache={}},encode:function(value){return value!==null&&value!==undefined?value.toString().replace(this.regExp.lt,"&lt;").replace(this.regExp.gt,"&gt;").replace(this.regExp.ap,"&#39;").replace(this.regExp.ic,"&#34;"):""},regExp:{comment:/\s#[^#]*#/g,sub:/\$\{(([\w\$]+(\.|\s)?[\w\$]*)+)\}/,nonEncodeSub:/\{\{html\s+([\w\$]+(\.|\s)?[\w\$]*)+\}\}/,forSub:/\$\{(([\w\$]+\.[\w\$]*)+)\}/,arg:/args\[\d+\](?!.*\+)/,block:/\{\{(\w+).*?\}\}+(.*)(\{\{\/\1\}\})/,blockCont:/\{\{(?!\/)(\S+)(.*)\}\}(.*)/,blockDirective:/\{\{\S+.*?\}\}/,index:/\$i/g,lineBreak:/(\r\n|\n|\r)/gm,lt:/</g,gt:/>/g,ap:/'/g,ic:/"/g},_directives:{"if":{start:"if (",close:") {",end:" }"},elseif:{start:" } else if (",close:") {",end:""},"else":{start:" } else {",close:"",end:""},each:{start:"for (var i = 0; i < $data.length; i++) {",close:"",end:" }"}},_internalTmplCache:{},_tokenizeTemplate:function(template){var tempToken,splitName;if(this.regExp.sub.test(template)){tempToken=this.regExp.sub.exec(template);while(tempToken!==null){splitName=tempToken[1].split(".");template=template.replace(new RegExp("\\$\\{"+tempToken[1].replace(/\$/g,"\\$")+"\\}","g"),"");tempToken[3]=new RegExp("\\$\\{"+tempToken[1].replace(/\$/g,"\\$")+"\\}","g");tempToken[1]=splitName;tempToken[2]=true;this.tokens.push(tempToken);tempToken=this.regExp.sub.exec(template)}}if(this.regExp.nonEncodeSub.test(template)){tempToken=this.regExp.nonEncodeSub.exec(template);while(tempToken!==null){splitName=tempToken[1].split(".");template=template.replace(new RegExp("\\{\\{html\\s+"+tempToken[1].replace(/\$/g,"\\$")+"\\}\\}","g"),"");tempToken[3]=new RegExp("\\{\\{html\\s+"+tempToken[1].replace(/\$/g,"\\$")+"\\}\\}","g");tempToken[1]=splitName;tempToken[2]=false;this.tokens.push(tempToken);tempToken=this.regExp.nonEncodeSub.exec(template)}}},_tokenizeDirectives:function(template){var tmpl='var result = "";',tokens=this.regExp.block.exec(template),temp;if(template.indexOf(tokens[0])>0||template.length!==tokens[0].length){temp=template.split(tokens[0]);if(temp[0]&&temp[0].length>0){this.args.push(temp[0]);tmpl+="result += args["+this.i++ +"];"}}tmpl+=this._handleCompleteBlock(tokens);if(temp&&temp.length>0&&temp[1].length>0){this.args.push(temp[1]);tmpl+="result += args["+this.i++ +"];"}tmpl+="return result;";return tmpl},_handleCompleteBlock:function(tokens){var tmpl=tokens[0],template="",blocks=[],tempTokens=[],i,temp;tmpl=tmpl.replace("{{"+tokens[1],this._directives[tokens[1]].start);if(tokens[1]==="each"){blocks.push(tokens[0].split(tokens[3]));blocks.push(tokens[2].split(tokens[3]));for(i=0;i<blocks[1].length;i++){if(blocks[0][i].indexOf("{{each")>0){temp=blocks[0][i].split("{{each")[0];this.args.push(temp);template+="result += args["+this.i++ +"];";blocks[0][i]=blocks[0][i].substr(blocks[0][i].indexOf("{{each"));temp=this.regExp.blockDirective.exec(blocks[1][i]);blocks[1][i]=blocks[1][i].substr(blocks[1][i].indexOf(temp[0])+temp[0].length)}blocks[0][i]=blocks[0][i].replace("{{"+tokens[1],this._directives[tokens[1]].start);template+=this._handleEach(blocks[0][i]+"{{/each}}",[blocks[0][i]+"{{/each}}","each",blocks[1][i],"{{/each}}"])}}else if(tokens[1]==="if"){template+=this._handleIfElse(tmpl,tokens)}return template},_handleEach:function(template,tokens){var tmpl=template,eachVar,body,forSub,sub,expr,inner;eachVar=this.regExp.sub.exec(tmpl);tmpl=tmpl.replace(eachVar[0],"");tmpl=tmpl.replace("$data",eachVar[0]);body=tokens[2];if(/\$data/.test(body)){body=body.replace(/\$data/g,'" + '+eachVar[0]+'[i] + "');this.args.push(eachVar[0]);this.i++}forSub=this.regExp.forSub.exec(body);while(forSub){body=body.replace(new RegExp("\\$\\{"+forSub[1]+"\\}","g"),'" + '+eachVar[0]+"[i]"+forSub[1].substr(forSub[1].indexOf("."))+' + "');forSub=this.regExp.forSub.exec(body)}body=body.replace(/\$index/g,'" + i + "');tmpl=tmpl.replace(tokens[2],'result += "'+body+'"');tmpl=tmpl.replace(/\}\}/,this._directives[tokens[1]].close);tmpl=tmpl.replace(tokens[3],this._directives[tokens[1]].end);if(this.regExp.block.test(tmpl)){inner=this.regExp.block.exec(tmpl);tmpl=tmpl.replace(inner[0],this._handleCompleteBlock(inner))}sub=this.regExp.sub.exec(tmpl);while(sub){expr=new RegExp("\\$\\{"+sub[1]+"\\}","g");tmpl=tmpl.replace(expr,"args["+this.i++ +"]");this.args.push(sub[0]);sub=this.regExp.sub.exec(tmpl)}return tmpl},_handleIfElse:function(template,tokens){var tmpl=template,i=0,htmlStrings,sub,inner,index,tmplArr=[];tmpl=tmpl.replace(/\}\}/,this._directives[tokens[1]].close);index=tmpl.lastIndexOf(tokens[3]);tmpl=tmpl.substr(0,index)+tmpl.slice(index+tokens[3].length-1);if(this.regExp.block.test(tmpl)){inner=this.regExp.block.exec(tmpl);tmpl=tmpl.replace(inner[0],this._handleCompleteBlock(inner))}htmlStrings=tokens[2].split(this.regExp.blockDirective);tmplArr.push(tmpl.slice(0,tmpl.indexOf(") {")+3));tmplArr.push(tmpl.slice(tmpl.indexOf(") {")+3));for(i;i<htmlStrings.length;i++){if(htmlStrings[i]&&htmlStrings[i].length&&htmlStrings[i].length>0){tmplArr[1]=tmplArr[1].replace(htmlStrings[i],"result += args["+this.i++ +"];");this.args.push(htmlStrings[i])}}tmpl=tmplArr.join("");tokens=this.regExp.blockCont.exec(tmpl);while(tokens){tmpl=tmpl.replace("{{"+tokens[1],this._directives[tokens[1]].start);tmpl=tmpl.replace(/\}\}/,this._directives[tokens[1]].close);tokens=this.regExp.blockCont.exec(tmpl)}sub=this.regExp.sub.exec(tmpl);while(sub){tmpl=tmpl.replace(new RegExp("\\$\\{"+sub[1]+"\\}","g"),"args["+this.i++ +"]");this.args.push(sub[0]);sub=this.regExp.sub.exec(tmpl)}return tmpl},_populateTemplate:function(template,data){var i,j,result="",temp;if(!data.length){for(i=0;i<this.tokens.length;i++){template=this._populateArgumentValue(data,this.tokens[i],template)}result=template}else if(data.length){for(j=0;j<data.length;j++){temp=template;for(i=0;i<this.tokens.length;i++){temp=this._populateArgumentValue(data[j],this.tokens[i],temp)}temp=temp.replace(this.regExp.index,j);result+=temp}}return result},_compileTemplate:function(template,data){var i,j,k,result="",temp,tempArgs=[],arg="",f;if(!data.length){for(j=0;j<this.args.length;j++){arg=this.args[j];for(i=0;i<this.tokens.length;i++){if(arg===this.tokens[i][0]){arg=this._getArgumentValue(data,this.tokens[i],arg);break}else if(typeof arg==="string"){arg=this._populateArgumentValue(data,this.tokens[i],arg)}}if(arg===undefined){throw new Error($.ig.Templating.locale.undefinedArgument+this.tokens[i][0])}if(typeof arg==="string"){arg=arg.replace(this.regExp.index,0)}tempArgs.push(arg)}template=template.replace(/\$i/g,0);result=new Function("args",template).call(this,tempArgs)||""}else if(data.length){temp=template.replace(this.regExp.index,"args["+this.args.length+"]");f=new Function("args",temp);for(j=0;j<data.length;j++){tempArgs=[];for(k=0;k<this.args.length;k++){arg=this.args[k];for(i=0;i<this.tokens.length;i++){if(arg===this.tokens[i][0]){arg=this._getArgumentValue(data[j],this.tokens[i],arg);break}else if(typeof arg==="string"){arg=this._populateArgumentValue(data[j],this.tokens[i],arg)}}if(arg===undefined){throw new Error($.ig.Templating.locale.undefinedArgument+this.tokens[i][0])}if(typeof arg==="string"){arg=arg.replace(this.regExp.index,j)}tempArgs.push(arg)}tempArgs.push(j);result+=f.call(this,tempArgs)||""}}return result},_getArgumentValue:function(data,token,arg){var tempData,l;if(token[1].length&&token[1].length>1){tempData=data;for(l=0;l<token[1].length;l++){if(tempData&&tempData.hasOwnProperty(token[1][l])){tempData=tempData[token[1][l]]}else{tempData="";break}}if(token[2]&&typeof tempData==="string"){arg=this.encode(tempData)}else{arg=tempData}}else{if(token[2]&&typeof data[token[1]]==="string"){arg=this.encode(data[token[1]])}else{arg=data[token[1]]}}return arg},_populateArgumentValue:function(data,token,arg){var tempData,l,self=this;if(token[1].length&&token[1].length>1){tempData=data;for(l=0;l<token[1].length;l++){if(tempData&&tempData.hasOwnProperty(token[1][l])){tempData=tempData[token[1][l]]}else{tempData="";break}}if(token[2]&&typeof tempData==="string"){arg=arg.replace(token[3],function(){return self.encode(tempData)})}else{arg=arg.replace(token[3],function(){return tempData===null?"":tempData})}}else{if(token[2]){arg=arg.replace(token[3],function(){return self.encode(typeof data[token[1]]==="function"?data[token[1]]():data[token[1]])})}else{arg=arg.replace(token[3],function(){return data[token[1]]===null?"":data[token[1]]})}}return arg}})})(jQuery);