/* Copyright (C) 2011 by Yehuda Katz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ var Handlebars={};(function(d,c){d.VERSION="1.0.0";d.COMPILER_REVISION=4;d.REVISION_CHANGES={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:">= 1.0.0"}; d.helpers={};d.partials={};var n=Object.prototype.toString,b="[object Function]",h="[object Object]";d.registerHelper=function(l,u,i){if(n.call(l)===h){if(i||u){throw new d.Exception("Arg not supported with multiple helpers"); }d.Utils.extend(this.helpers,l);}else{if(i){u.not=i;}this.helpers[l]=u;}};d.registerPartial=function(i,l){if(n.call(i)===h){d.Utils.extend(this.partials,i); }else{this.partials[i]=l;}};d.registerHelper("helperMissing",function(i){if(arguments.length===2){return c;}else{throw new Error("Missing helper: '"+i+"'"); }});d.registerHelper("blockHelperMissing",function(u,l){var i=l.inverse||function(){},w=l.fn;var v=n.call(u);if(v===b){u=u.call(this);}if(u===true){return w(this); }else{if(u===false||u==null){return i(this);}else{if(v==="[object Array]"){if(u.length>0){return d.helpers.each(u,l);}else{return i(this);}}else{return w(u); }}}});d.K=function(){};d.createFrame=Object.create||function(i){d.K.prototype=i;var l=new d.K();d.K.prototype=null;return l;};d.logger={DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,methodMap:{0:"debug",1:"info",2:"warn",3:"error"},log:function(u,i){if(d.logger.level<=u){var l=d.logger.methodMap[u]; if(typeof console!=="undefined"&&console[l]){console[l].call(console,i);}}}};d.log=function(l,i){d.logger.log(l,i);};d.registerHelper("each",function(l,C){var A=C.fn,v=C.inverse; var x=0,y="",w;var z=n.call(l);if(z===b){l=l.call(this);}if(C.data){w=d.createFrame(C.data);}if(l&&typeof l==="object"){if(l instanceof Array){for(var u=l.length; x2){G.push("'"+this.terminals_[Q]+"'");}}if(this.lexer.showPosition){S="Parse error on line "+(J+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+G.join(", ")+", got '"+(this.terminals_[V]||V)+"'"; }else{S="Parse error on line "+(J+1)+": Unexpected "+(V==1?"end of input":"'"+(this.terminals_[V]||V)+"'");}this.parseError(S,{text:this.lexer.match,token:this.terminals_[V]||V,line:this.lexer.yylineno,loc:B,expected:G}); }}if(U[0] instanceof Array&&U.length>1){throw new Error("Parse Error: multiple actions possible at state: "+E+", token: "+V);}switch(U[0]){case 1:F.push(V); Y.push(this.lexer.yytext);K.push(this.lexer.yylloc);F.push(U[1]);V=null;if(!R){W=this.lexer.yyleng;A=this.lexer.yytext;J=this.lexer.yylineno;B=this.lexer.yylloc; if(C>0){C--;}}else{V=R;R=null;}break;case 2:X=this.productions_[U[1]][1];T.$=Y[Y.length-X];T._$={first_line:K[K.length-(X||1)].first_line,last_line:K[K.length-1].last_line,first_column:K[K.length-(X||1)].first_column,last_column:K[K.length-1].last_column}; if(D){T._$.range=[K[K.length-(X||1)].range[0],K[K.length-1].range[1]];}L=this.performAction.call(T,A,W,J,this.yy,U[1],Y,K);if(typeof L!=="undefined"){return L; }if(X){F=F.slice(0,-1*X*2);Y=Y.slice(0,-1*X);K=K.slice(0,-1*X);}F.push(this.productions_[U[1]][0]);Y.push(T.$);K.push(T._$);z=Z[F[F.length-2]][F[F.length-1]]; F.push(z);break;case 3:return true;}}return true;}};var i=(function(){var C=({EOF:1,parseError:function E(H,G){if(this.yy.parser){this.yy.parser.parseError(H,G); }else{throw new Error(H);}},setInput:function(G){this._input=G;this._more=this._less=this.done=false;this.yylineno=this.yyleng=0;this.yytext=this.matched=this.match=""; this.conditionStack=["INITIAL"];this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0};if(this.options.ranges){this.yylloc.range=[0,0];}this.offset=0; return this;},input:function(){var H=this._input[0];this.yytext+=H;this.yyleng++;this.offset++;this.match+=H;this.matched+=H;var G=H.match(/(?:\r\n?|\n).*/g); if(G){this.yylineno++;this.yylloc.last_line++;}else{this.yylloc.last_column++;}if(this.options.ranges){this.yylloc.range[1]++;}this._input=this._input.slice(1); return H;},unput:function(I){var G=I.length;var H=I.split(/(?:\r\n?|\n)/g);this._input=I+this._input;this.yytext=this.yytext.substr(0,this.yytext.length-G-1); this.offset-=G;var K=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1);this.matched=this.matched.substr(0,this.matched.length-1); if(H.length-1){this.yylineno-=H.length-1;}var J=this.yylloc.range;this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:H?(H.length===K.length?this.yylloc.first_column:0)+K[K.length-H.length].length-H[0].length:this.yylloc.first_column-G}; if(this.options.ranges){this.yylloc.range=[J[0],J[0]+this.yyleng-G];}return this;},more:function(){this._more=true;return this;},less:function(G){this.unput(this.match.slice(G)); },pastInput:function(){var G=this.matched.substr(0,this.matched.length-this.match.length);return(G.length>20?"...":"")+G.substr(-20).replace(/\n/g,""); },upcomingInput:function(){var G=this.match;if(G.length<20){G+=this._input.substr(0,20-G.length);}return(G.substr(0,20)+(G.length>20?"...":"")).replace(/\n/g,""); },showPosition:function(){var G=this.pastInput();var H=new Array(G.length+1).join("-");return G+this.upcomingInput()+"\n"+H+"^";},next:function(){if(this.done){return this.EOF; }if(!this._input){this.done=true;}var M,K,H,J,I,G;if(!this._more){this.yytext="";this.match="";}var N=this._currentRules();for(var L=0;LK[0].length)){K=H;J=L;if(!this.options.flex){break;}}}if(K){G=K[0].match(/(?:\r\n?|\n).*/g);if(G){this.yylineno+=G.length;}this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:G?G[G.length-1].length-G[G.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+K[0].length}; this.yytext+=K[0];this.match+=K[0];this.matches=K;this.yyleng=this.yytext.length;if(this.options.ranges){this.yylloc.range=[this.offset,this.offset+=this.yyleng]; }this._more=false;this._input=this._input.slice(K[0].length);this.matched+=K[0];M=this.performAction.call(this,this.yy,this,N[J],this.conditionStack[this.conditionStack.length-1]); if(this.done&&this._input){this.done=false;}if(M){return M;}else{return;}}if(this._input===""){return this.EOF;}else{return this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno}); }},lex:function z(){var G=this.next();if(typeof G!=="undefined"){return G;}else{return this.lex();}},begin:function A(G){this.conditionStack.push(G);},popState:function F(){return this.conditionStack.pop(); },_currentRules:function D(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;},topState:function(){return this.conditionStack[this.conditionStack.length-2]; },pushState:function A(G){this.begin(G);}});C.options={};C.performAction=function B(K,H,J,G){var I=G;switch(J){case 0:H.yytext="\\";return 14;break;case 1:if(H.yytext.slice(-1)!=="\\"){this.begin("mu"); }if(H.yytext.slice(-1)==="\\"){H.yytext=H.yytext.substr(0,H.yyleng-1),this.begin("emu");}if(H.yytext){return 14;}break;case 2:return 14;break;case 3:if(H.yytext.slice(-1)!=="\\"){this.popState(); }if(H.yytext.slice(-1)==="\\"){H.yytext=H.yytext.substr(0,H.yyleng-1);}return 14;break;case 4:H.yytext=H.yytext.substr(0,H.yyleng-4);this.popState();return 15; break;case 5:return 25;break;case 6:return 16;break;case 7:return 20;break;case 8:return 19;break;case 9:return 19;break;case 10:return 23;break;case 11:return 22; break;case 12:this.popState();this.begin("com");break;case 13:H.yytext=H.yytext.substr(3,H.yyleng-5);this.popState();return 15;break;case 14:return 22; break;case 15:return 37;break;case 16:return 36;break;case 17:return 36;break;case 18:return 40;break;case 19:break;case 20:this.popState();return 24;break; case 21:this.popState();return 18;break;case 22:H.yytext=H.yytext.substr(1,H.yyleng-2).replace(/\\"/g,'"');return 31;break;case 23:H.yytext=H.yytext.substr(1,H.yyleng-2).replace(/\\'/g,"'"); return 31;break;case 24:return 38;break;case 25:return 33;break;case 26:return 33;break;case 27:return 32;break;case 28:return 36;break;case 29:H.yytext=H.yytext.substr(1,H.yyleng-2); return 36;break;case 30:return"INVALID";break;case 31:return 5;break;}};C.rules=[/^(?:\\\\(?=(\{\{)))/,/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\{\{>)/,/^(?:\{\{#)/,/^(?:\{\{\/)/,/^(?:\{\{\^)/,/^(?:\{\{\s*else\b)/,/^(?:\{\{\{)/,/^(?:\{\{&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{)/,/^(?:=)/,/^(?:\.(?=[}\/ ]))/,/^(?:\.\.)/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}\}\})/,/^(?:\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=[}\s]))/,/^(?:false(?=[}\s]))/,/^(?:-?[0-9]+(?=[}\s]))/,/^(?:[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.]))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/]; C.conditions={mu:{rules:[5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31],inclusive:false},emu:{rules:[3],inclusive:false},com:{rules:[4],inclusive:false},INITIAL:{rules:[0,1,2,31],inclusive:true}}; return C;})();y.lexer=i;function w(){this.yy={};}w.prototype=y;y.Parser=w;return new w;})();d.Parser=r;d.parse=function(i){if(i.constructor===d.AST.ProgramNode){return i; }d.Parser.yy=d.AST;return d.Parser.parse(i);};d.AST={};d.AST.ProgramNode=function(l,i){this.type="program";this.statements=l;if(i){this.inverse=new d.AST.ProgramNode(i); }};d.AST.MustacheNode=function(x,u,l){this.type="mustache";this.escaped=!l;this.hash=u;var w=this.id=x[0];var v=this.params=x.slice(1);var i=this.eligibleHelper=w.isSimple; this.isHelper=i&&(v.length||u);};d.AST.PartialNode=function(i,l){this.type="partial";this.partialName=i;this.context=l;};d.AST.BlockNode=function(u,l,i,w){var v=function(x,y){if(x.original!==y.original){throw new d.Exception(x.original+" doesn't match "+y.original); }};v(u.id,w);this.type="block";this.mustache=u;this.program=l;this.inverse=i;if(this.inverse&&!this.program){this.isInverse=true;}};d.AST.ContentNode=function(i){this.type="content"; this.string=i;};d.AST.HashNode=function(i){this.type="hash";this.pairs=i;};d.AST.IdNode=function(z){this.type="ID";var y="",w=[],A=0;for(var x=0,u=z.length; x0){throw new d.Exception("Invalid path: "+y);}else{if(v===".."){A++; }else{this.isScoped=true;}}}else{w.push(v);}}this.original=y;this.parts=w;this.string=w.join(".");this.depth=A;this.isSimple=z.length===1&&!this.isScoped&&A===0; this.stringModeValue=this.string;};d.AST.PartialNameNode=function(i){this.type="PARTIAL_NAME";this.name=i.original;};d.AST.DataNode=function(i){this.type="DATA"; this.id=i;};d.AST.StringNode=function(i){this.type="STRING";this.original=this.string=this.stringModeValue=i;};d.AST.IntegerNode=function(i){this.type="INTEGER"; this.original=this.integer=i;this.stringModeValue=Number(i);};d.AST.BooleanNode=function(i){this.type="BOOLEAN";this.bool=i;this.stringModeValue=i==="true"; };d.AST.CommentNode=function(i){this.type="comment";this.comment=i;};var q=["description","fileName","lineNumber","message","name","number","stack"];d.Exception=function(u){var l=Error.prototype.constructor.apply(this,arguments); for(var i=0;i":">",'"':""","'":"'","`":"`"};var e=/[&<>"'`]/g;var p=/[&<>"'`]/;var t=function(i){return k[i]||"&"; };d.Utils={extend:function(u,l){for(var i in l){if(l.hasOwnProperty(i)){u[i]=l[i];}}},escapeExpression:function(i){if(i instanceof d.SafeString){return i.toString(); }else{if(i==null||i===false){return"";}}i=i.toString();if(!p.test(i)){return i;}return i.replace(e,t);},isEmpty:function(i){if(!i&&i!==0){return true;}else{if(n.call(i)==="[object Array]"&&i.length===0){return true; }else{return false;}}}};var j=d.Compiler=function(){};var g=d.JavaScriptCompiler=function(){};j.prototype={compiler:j,disassemble:function(){var z=this.opcodes,y,w=[],B,A; for(var x=0,u=z.length;x0){this.source[1]=this.source[1]+", "+w.join(", ");}if(!this.isChild){for(var A in this.context.aliases){if(this.context.aliases.hasOwnProperty(A)){this.source[1]=this.source[1]+", "+A+"="+this.context.aliases[A]; }}}if(this.source[1]){this.source[1]="var "+this.source[1].substring(2)+";";}if(!this.isChild){this.source[1]+="\n"+this.context.programs.join("\n")+"\n"; }if(!this.environment.isSimple){this.source.push("return buffer;");}var y=this.isChild?["depth0","data"]:["Handlebars","depth0","helpers","partials","data"]; for(var z=0,x=this.environment.depths.list.length;zthis.stackVars.length){this.stackVars.push("stack"+this.stackSlot);}return this.topStackName();},topStackName:function(){return"stack"+this.stackSlot; },flushInline:function(){var v=this.inlineStack;if(v.length){this.inlineStack=[];for(var u=0,l=v.length;u